diff --git a/common/src/main/java/net/cmr/jurassicrevived/compat/MachineJadePlugin.java b/common/src/main/java/net/cmr/jurassicrevived/compat/MachineJadePlugin.java index 91c66ee..79cf03f 100644 --- a/common/src/main/java/net/cmr/jurassicrevived/compat/MachineJadePlugin.java +++ b/common/src/main/java/net/cmr/jurassicrevived/compat/MachineJadePlugin.java @@ -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 diff --git a/common/src/main/java/net/cmr/jurassicrevived/recipe/FossilCleanerRecipe.java b/common/src/main/java/net/cmr/jurassicrevived/recipe/FossilCleanerRecipe.java index 2ed9179..235cdac 100644 --- a/common/src/main/java/net/cmr/jurassicrevived/recipe/FossilCleanerRecipe.java +++ b/common/src/main/java/net/cmr/jurassicrevived/recipe/FossilCleanerRecipe.java @@ -59,8 +59,8 @@ public class FossilCleanerRecipe implements Recipe { 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 { diff --git a/common/src/main/java/net/cmr/jurassicrevived/recipe/FossilCleanerRecipeInput.java b/common/src/main/java/net/cmr/jurassicrevived/recipe/FossilCleanerRecipeInput.java index 9b1dc26..10986f2 100644 --- a/common/src/main/java/net/cmr/jurassicrevived/recipe/FossilCleanerRecipeInput.java +++ b/common/src/main/java/net/cmr/jurassicrevived/recipe/FossilCleanerRecipeInput.java @@ -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); } } //?} \ No newline at end of file