Fixed unexpected behavior on Fossil Cleaner and its recipe handling
Fixed missing Jade compatibility with Fossil Cleaner
This commit is contained in:
@@ -257,6 +257,53 @@ public class MachineJadePlugin implements IWailaPlugin {
|
||||
}
|
||||
}, EmbryonicMachineBlock.class
|
||||
);
|
||||
reg.registerBlockComponent(new snownee.jade.api.IBlockComponentProvider() {
|
||||
//? if >1.20.1 {
|
||||
/*@Override
|
||||
public void appendTooltip(ITooltip tooltip, BlockAccessor accessor, IPluginConfig config) {
|
||||
CompoundTag data = accessor.getServerData();
|
||||
if (data == null || !data.contains(NBT_PROGRESS) || !data.contains(NBT_MAX)) return;
|
||||
|
||||
int progress = Math.max(0, data.getInt(NBT_PROGRESS));
|
||||
int max = Math.max(1, data.getInt(NBT_MAX));
|
||||
float ratio = Mth.clamp(progress / (float) max, 0.0f, 1.0f);
|
||||
|
||||
IElementHelper h = IElementHelper.get();
|
||||
ProgressStyle style = h.progressStyle()
|
||||
.color(0xFFFFFFFF, 0xFFFFFFFF)
|
||||
.direction(ScreenDirection.RIGHT)
|
||||
.fitContentX(true)
|
||||
.fitContentY(true);
|
||||
BoxStyle box = BoxStyle.getNestedBox();
|
||||
IElement bar = h.progress(ratio, Component.empty(), style, box, true);
|
||||
tooltip.add(bar);
|
||||
}
|
||||
*///?} else {
|
||||
@Override
|
||||
public void appendTooltip(ITooltip tooltip, BlockAccessor accessor, IPluginConfig config) {
|
||||
CompoundTag data = accessor.getServerData();
|
||||
if (!data.contains(NBT_PROGRESS) || !data.contains(NBT_MAX)) return;
|
||||
|
||||
int progress = data.getInt(NBT_PROGRESS);
|
||||
int max = Math.max(1, data.getInt(NBT_MAX));
|
||||
float ratio = Mth.clamp(progress / (float) max, 0.0f, 1.0f);
|
||||
|
||||
IElementHelper h = tooltip.getElementHelper();
|
||||
IProgressStyle pStyle = h.progressStyle()
|
||||
.color(0xFFFFFFFF)
|
||||
.textColor(0xFFFFFFFF);
|
||||
IBoxStyle box = new ThickBorderBox(1.0f);
|
||||
|
||||
tooltip.add(h.progress(ratio, Component.empty(), pStyle, box, false));
|
||||
}
|
||||
//?}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getUid() {
|
||||
return UID;
|
||||
}
|
||||
}, FossilCleanerBlock.class
|
||||
);
|
||||
reg.registerBlockComponent(new snownee.jade.api.IBlockComponentProvider() {
|
||||
//? if >1.20.1 {
|
||||
/*@Override
|
||||
|
||||
@@ -59,8 +59,8 @@ public class FossilCleanerRecipe implements Recipe<FossilCleanerRecipeInput> {
|
||||
if (level.isClientSide()) return false;
|
||||
if (inputs.isEmpty()) return false;
|
||||
|
||||
// Single fossil block ingredient lives in machine slot 1 (input.getItem(1))
|
||||
return inputs.get(0).test(input.getItem(1));
|
||||
// Single fossil block ingredient lives in machine slot 0 (input.getItem(0))
|
||||
return inputs.get(0).test(input.getItem(0));
|
||||
}
|
||||
|
||||
//? if >1.20.1 {
|
||||
|
||||
@@ -10,12 +10,12 @@ import net.minecraft.world.SimpleContainer;
|
||||
import java.util.List;
|
||||
|
||||
//? if >1.20.1 {
|
||||
/*public record FossilCleanerRecipeInput(ItemStack material, ItemStack fuel) implements RecipeInput {
|
||||
/*public record FossilCleanerRecipeInput(ItemStack fossil, ItemStack waterSlot) implements RecipeInput {
|
||||
@Override
|
||||
public ItemStack getItem(int index) {
|
||||
return switch (index) {
|
||||
case 0 -> material;
|
||||
case 1 -> fuel;
|
||||
case 0 -> fossil;
|
||||
case 1 -> waterSlot;
|
||||
default -> throw new IllegalArgumentException("Unexpected slot index: " + index);
|
||||
};
|
||||
}
|
||||
@@ -27,8 +27,8 @@ import java.util.List;
|
||||
}
|
||||
*///?} else {
|
||||
public class FossilCleanerRecipeInput extends SimpleContainer {
|
||||
public FossilCleanerRecipeInput(ItemStack material, ItemStack fuel) {
|
||||
super(material, fuel);
|
||||
public FossilCleanerRecipeInput(ItemStack fossil, ItemStack waterSlot) {
|
||||
super(fossil, waterSlot);
|
||||
}
|
||||
}
|
||||
//?}
|
||||
Reference in New Issue
Block a user