diff --git a/src/main/generated/.cache/15d5dd4ace2ad25407a17728f6fbc07b246efd63 b/src/main/generated/.cache/15d5dd4ace2ad25407a17728f6fbc07b246efd63 index 9a6224e4..5c59c3eb 100644 --- a/src/main/generated/.cache/15d5dd4ace2ad25407a17728f6fbc07b246efd63 +++ b/src/main/generated/.cache/15d5dd4ace2ad25407a17728f6fbc07b246efd63 @@ -1,3 +1,3 @@ -// 1.20.1 2023-09-08T20:35:35.335872512 codechickenlib Languages: en_us -ce1ce42a962941336b9de69689e94a97219ad7d9 assets/codechickenlib/lang/en_us.json -ce1ce42a962941336b9de69689e94a97219ad7d9 data/codechickenlib/lang/en_us.json +// 1.20.1 2024-02-13T15:00:40.20834201 codechickenlib Languages: en_us +d535acbe9649e564744ed63aef209ce1508ec451 assets/codechickenlib/lang/en_us.json +d535acbe9649e564744ed63aef209ce1508ec451 data/codechickenlib/lang/en_us.json diff --git a/src/main/generated/assets/codechickenlib/lang/en_us.json b/src/main/generated/assets/codechickenlib/lang/en_us.json index ccfb00ae..b647596b 100644 --- a/src/main/generated/assets/codechickenlib/lang/en_us.json +++ b/src/main/generated/assets/codechickenlib/lang/en_us.json @@ -7,5 +7,14 @@ "ccl.commands.killall.fail": "Found no entities.", "ccl.commands.killall.fail.player": "You cannot kill players with this command.", "ccl.commands.killall.success": "Killed %s entities.", - "ccl.commands.killall.success.line": "Killed %s" + "ccl.commands.killall.success.line": "Killed %s", + "ccl.energy_bar.capacity": "Capacity:", + "ccl.energy_bar.energy_storage": "Energy Storage", + "ccl.energy_bar.rf": "RF", + "ccl.energy_bar.stored": "Stored:", + "ccl.fluid_tank.capacity": "Capacity:", + "ccl.fluid_tank.contains": "Contains:", + "ccl.fluid_tank.fluid_storage": "Fluid Storage", + "ccl.fluid_tank.mb": "mB", + "ccl.fluid_tank.stored": "Stored:" } \ No newline at end of file diff --git a/src/main/generated/data/codechickenlib/lang/en_us.json b/src/main/generated/data/codechickenlib/lang/en_us.json index ccfb00ae..b647596b 100644 --- a/src/main/generated/data/codechickenlib/lang/en_us.json +++ b/src/main/generated/data/codechickenlib/lang/en_us.json @@ -7,5 +7,14 @@ "ccl.commands.killall.fail": "Found no entities.", "ccl.commands.killall.fail.player": "You cannot kill players with this command.", "ccl.commands.killall.success": "Killed %s entities.", - "ccl.commands.killall.success.line": "Killed %s" + "ccl.commands.killall.success.line": "Killed %s", + "ccl.energy_bar.capacity": "Capacity:", + "ccl.energy_bar.energy_storage": "Energy Storage", + "ccl.energy_bar.rf": "RF", + "ccl.energy_bar.stored": "Stored:", + "ccl.fluid_tank.capacity": "Capacity:", + "ccl.fluid_tank.contains": "Contains:", + "ccl.fluid_tank.fluid_storage": "Fluid Storage", + "ccl.fluid_tank.mb": "mB", + "ccl.fluid_tank.stored": "Stored:" } \ No newline at end of file diff --git a/src/main/java/codechicken/lib/gui/modular/elements/GuiEnergyBar.java b/src/main/java/codechicken/lib/gui/modular/elements/GuiEnergyBar.java index 478e86a8..f91ce143 100644 --- a/src/main/java/codechicken/lib/gui/modular/elements/GuiEnergyBar.java +++ b/src/main/java/codechicken/lib/gui/modular/elements/GuiEnergyBar.java @@ -54,27 +54,27 @@ public static EnergyBar simpleBar(@NotNull GuiParent parent) { public static BiFunction> defaultFormatter() { return (energy, capacity) -> { List tooltip = new ArrayList<>(); - tooltip.add(Component.translatable("energy_bar.polylib.energy_storage").withStyle(DARK_AQUA)); + tooltip.add(Component.translatable("ccl.energy_bar.energy_storage").withStyle(DARK_AQUA)); boolean shift = Screen.hasShiftDown(); - tooltip.add(Component.translatable("energy_bar.polylib.capacity") + tooltip.add(Component.translatable("ccl.energy_bar.capacity") .withStyle(GOLD) .append(" ") .append(Component.literal(shift ? FormatUtil.addCommas(capacity) : FormatUtil.formatNumber(capacity)) .withStyle(GRAY) .append(" ") - .append(Component.translatable("energy_bar.polylib.rf") + .append(Component.translatable("ccl.energy_bar.rf") .withStyle(GRAY) ) ) ); - tooltip.add(Component.translatable("energy_bar.polylib.stored") + tooltip.add(Component.translatable("ccl.energy_bar.stored") .withStyle(GOLD) .append(" ") .append(Component.literal(shift ? FormatUtil.addCommas(energy) : FormatUtil.formatNumber(energy)) .withStyle(GRAY) ) .append(" ") - .append(Component.translatable("energy_bar.polylib.rf") + .append(Component.translatable("ccl.energy_bar.rf") .withStyle(GRAY) ) .append(Component.literal(String.format(" (%.2f%%)", ((double) energy / (double) capacity) * 100D)) diff --git a/src/main/java/codechicken/lib/gui/modular/elements/GuiFluidTank.java b/src/main/java/codechicken/lib/gui/modular/elements/GuiFluidTank.java index a2d4eb9a..12ce2600 100644 --- a/src/main/java/codechicken/lib/gui/modular/elements/GuiFluidTank.java +++ b/src/main/java/codechicken/lib/gui/modular/elements/GuiFluidTank.java @@ -182,9 +182,9 @@ private double computeGaugeSpacing() { public static BiFunction> defaultFormatter() { return (fluidStack, capacity) -> { List tooltip = new ArrayList<>(); - tooltip.add(Component.translatable("fluid_tank.polylib.fluid_storage").withStyle(DARK_AQUA)); + tooltip.add(Component.translatable("ccl.fluid_tank.fluid_storage").withStyle(DARK_AQUA)); if (!fluidStack.isEmpty()) { - tooltip.add(Component.translatable("fluid_tank.polylib.contains") + tooltip.add(Component.translatable("ccl.fluid_tank.contains") .withStyle(GOLD) .append(" ") .append(fluidStack.getDisplayName().copy() @@ -195,25 +195,25 @@ public static BiFunction> defaultFormatter() { ); } - tooltip.add(Component.translatable("fluid_tank.polylib.capacity") + tooltip.add(Component.translatable("ccl.fluid_tank.capacity") .withStyle(GOLD) .append(" ") .append(Component.literal(FormatUtil.addCommas(capacity)) .withStyle(GRAY) .append(" ") - .append(Component.translatable("fluid_tank.polylib.mb") + .append(Component.translatable("ccl.fluid_tank.mb") .withStyle(GRAY) ) ) ); - tooltip.add(Component.translatable("fluid_tank.polylib.stored") + tooltip.add(Component.translatable("ccl.fluid_tank.stored") .withStyle(GOLD) .append(" ") .append(Component.literal(FormatUtil.addCommas(fluidStack.getAmount())) .withStyle(GRAY) ) .append(" ") - .append(Component.translatable("fluid_tank.polylib.mb") + .append(Component.translatable("ccl.fluid_tank.mb") .withStyle(GRAY) ) .append(Component.literal(String.format(" (%.2f%%)", ((double) fluidStack.getAmount() / (double) capacity) * 100D)) diff --git a/src/main/java/codechicken/lib/internal/DataGenerators.java b/src/main/java/codechicken/lib/internal/DataGenerators.java index 62673c3f..89cad861 100644 --- a/src/main/java/codechicken/lib/internal/DataGenerators.java +++ b/src/main/java/codechicken/lib/internal/DataGenerators.java @@ -153,6 +153,16 @@ protected void addTranslations() { addServer("ccl.commands.killall.success.line", "Killed %s"); addServer("ccl.commands.count.fail", "Found no entities."); addServer("ccl.commands.count.total", "Found %s entities."); + + addServer("ccl.energy_bar.energy_storage", "Energy Storage"); + addServer("ccl.energy_bar.capacity", "Capacity:"); + addServer("ccl.energy_bar.stored", "Stored:"); + addServer("ccl.energy_bar.rf", "RF"); + addServer("ccl.fluid_tank.fluid_storage", "Fluid Storage"); + addServer("ccl.fluid_tank.capacity", "Capacity:"); + addServer("ccl.fluid_tank.stored", "Stored:"); + addServer("ccl.fluid_tank.mb", "mB"); + addServer("ccl.fluid_tank.contains", "Contains:"); } } } diff --git a/src/main/java/codechicken/lib/inventory/container/modular/ModularSlot.java b/src/main/java/codechicken/lib/inventory/container/modular/ModularSlot.java index bfa02872..c652f2cd 100644 --- a/src/main/java/codechicken/lib/inventory/container/modular/ModularSlot.java +++ b/src/main/java/codechicken/lib/inventory/container/modular/ModularSlot.java @@ -4,6 +4,9 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.Slot; import net.minecraft.world.item.ItemStack; +import net.minecraftforge.items.IItemHandler; +import net.minecraftforge.items.SlotItemHandler; +import net.minecraftforge.items.wrapper.InvWrapper; import java.util.function.*; @@ -13,7 +16,7 @@ *

* Created by brandon3055 on 10/09/2023 */ -public class ModularSlot extends Slot { +public class ModularSlot extends SlotItemHandler { private boolean canPlace = true; private boolean checkContainer = true; private Supplier enabled = () -> true; @@ -23,11 +26,19 @@ public class ModularSlot extends Slot { private BiConsumer onSet = (oldStack, newStack) -> {}; public ModularSlot(Container container, int index) { - this(container, index, 0, 0); + this(new InvWrapper(container), index, 0, 0); + } + + public ModularSlot(IItemHandler itemHandler, int index) { + this(itemHandler, index, 0, 0); } public ModularSlot(Container container, int index, int xPos, int yPos) { - super(container, index, xPos, yPos); + super(new InvWrapper(container), index, xPos, yPos); + } + + public ModularSlot(IItemHandler itemHandler, int index, int xPos, int yPos) { + super(itemHandler, index, xPos, yPos); } /**