diff --git a/AntimatterAPI b/AntimatterAPI index a57b5588a..15ed5b83c 160000 --- a/AntimatterAPI +++ b/AntimatterAPI @@ -1 +1 @@ -Subproject commit a57b5588a85b0f790c9efb9b613f505814be4eb8 +Subproject commit 15ed5b83c8ba0b0659ee028a9e10825987ac4443 diff --git a/common/src/main/java/muramasa/gregtech/block/BlockCoil.java b/common/src/main/java/muramasa/gregtech/block/BlockCoil.java index 69c64e481..ee0b34c1d 100644 --- a/common/src/main/java/muramasa/gregtech/block/BlockCoil.java +++ b/common/src/main/java/muramasa/gregtech/block/BlockCoil.java @@ -2,8 +2,8 @@ import muramasa.antimatter.block.BlockBasic; import muramasa.antimatter.texture.Texture; +import muramasa.antimatter.util.Utils; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.BlockGetter; @@ -45,7 +45,7 @@ public Texture[] getTextures() { @Override public void appendHoverText(ItemStack p_49816_, @Nullable BlockGetter p_49817_, List tooltip, TooltipFlag p_49819_) { super.appendHoverText(p_49816_, p_49817_, tooltip, p_49819_); - tooltip.add(new TranslatableComponent("antimatter.tooltip.heat_capacity").append(": ").append(String.valueOf(this.coilData.heat))); + tooltip.add(Utils.translatable("antimatter.tooltip.heat_capacity").append(": ").append(String.valueOf(this.coilData.heat))); } public record CoilData(int heat, float percentage){} diff --git a/common/src/main/java/muramasa/gregtech/blockentity/single/BlockEntityBuffer.java b/common/src/main/java/muramasa/gregtech/blockentity/single/BlockEntityBuffer.java index f422c9797..e53b0fad2 100644 --- a/common/src/main/java/muramasa/gregtech/blockentity/single/BlockEntityBuffer.java +++ b/common/src/main/java/muramasa/gregtech/blockentity/single/BlockEntityBuffer.java @@ -1,15 +1,17 @@ package muramasa.gregtech.blockentity.single; +import muramasa.antimatter.blockentity.BlockEntityMachine; import muramasa.antimatter.capability.item.TrackedItemHandler; import muramasa.antimatter.capability.machine.MachineEnergyHandler; import muramasa.antimatter.capability.machine.MachineItemHandler; import muramasa.antimatter.data.AntimatterDefaultTools; -import muramasa.antimatter.gui.*; +import muramasa.antimatter.gui.GuiInstance; +import muramasa.antimatter.gui.IGuiElement; +import muramasa.antimatter.gui.SlotType; import muramasa.antimatter.gui.event.GuiEvents; import muramasa.antimatter.gui.event.IGuiEvent; import muramasa.antimatter.machine.event.ContentEvent; import muramasa.antimatter.machine.types.Machine; -import muramasa.antimatter.blockentity.BlockEntityMachine; import muramasa.antimatter.tool.AntimatterToolType; import muramasa.antimatter.util.AntimatterPlatformUtils; import muramasa.antimatter.util.Utils; @@ -18,7 +20,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.TextComponent; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -60,7 +61,7 @@ public InteractionResult onInteractServer(BlockState state, Level world, BlockPo if (hit.getDirection() == getFacing().getOpposite()){ stackLimit++; if (stackLimit == 65) stackLimit = 1; - player.sendMessage(new TextComponent("Item Output Limit: " +stackLimit), player.getUUID()); + player.sendMessage(Utils.literal("Item Output Limit: " +stackLimit), player.getUUID()); stack.hurt(1, world.random, (ServerPlayer) player); return InteractionResult.SUCCESS; } @@ -131,12 +132,12 @@ public void onGuiEvent(IGuiEvent event, Player playerEntity) { switch (data[1]) { case 0 -> { emitEnergy = !emitEnergy; - playerEntity.sendMessage(new TextComponent((emitEnergy ? "Emit energy to output side" : "Don't emit energy")), playerEntity.getUUID()); + playerEntity.sendMessage(Utils.literal((emitEnergy ? "Emit energy to output side" : "Don't emit energy")), playerEntity.getUUID()); AntimatterPlatformUtils.markAndNotifyBlock(level, this.getBlockPos(), this.level.getChunkAt(this.getBlockPos()), this.getBlockState(), this.getBlockState(), 1, 512); } case 1 -> { /*outputRedstone = !outputRedstone; - playerEntity.sendMessage(new TextComponent((outputRedstone ? "Emit redstone if slots contain something" : "Don't emit redstone")), playerEntity.getUUID()); + playerEntity.sendMessage(Utils.literal((outputRedstone ? "Emit redstone if slots contain something" : "Don't emit redstone")), playerEntity.getUUID()); AntimatterPlatformUtils.markAndNotifyBlock(level, this.getBlockPos(), this.level.getChunkAt(this.getBlockPos()), this.getBlockState(), this.getBlockState(), 1, 512);*/ } } diff --git a/common/src/main/java/muramasa/gregtech/blockentity/single/BlockEntityItemFilter.java b/common/src/main/java/muramasa/gregtech/blockentity/single/BlockEntityItemFilter.java index 79e145b5b..bdc16c79b 100644 --- a/common/src/main/java/muramasa/gregtech/blockentity/single/BlockEntityItemFilter.java +++ b/common/src/main/java/muramasa/gregtech/blockentity/single/BlockEntityItemFilter.java @@ -15,7 +15,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.TextComponent; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -74,26 +73,26 @@ public void onGuiEvent(IGuiEvent event, Player playerEntity) { switch (data[1]) { case 0: emitEnergy = !emitEnergy; - playerEntity.sendMessage(new TextComponent( (emitEnergy ? "Emit energy to output side" : "Don't emit energy")), playerEntity.getUUID()); + playerEntity.sendMessage(Utils.literal( (emitEnergy ? "Emit energy to output side" : "Don't emit energy")), playerEntity.getUUID()); AntimatterPlatformUtils.markAndNotifyBlock(level, this.getBlockPos(), this.level.getChunkAt(this.getBlockPos()), this.getBlockState(), this.getBlockState(), 1, 512); break; case 1: outputRedstone = !outputRedstone; - playerEntity.sendMessage(new TextComponent( (outputRedstone ? "Emit redstone if slots contain something" : "Don't emit redstone")), playerEntity.getUUID()); + playerEntity.sendMessage(Utils.literal( (outputRedstone ? "Emit redstone if slots contain something" : "Don't emit redstone")), playerEntity.getUUID()); AntimatterPlatformUtils.markAndNotifyBlock(level, this.getBlockPos(), this.level.getChunkAt(this.getBlockPos()), this.getBlockState(), this.getBlockState(), 1, 512); break; case 2: invertRedstone = !invertRedstone; - playerEntity.sendMessage(new TextComponent( (invertRedstone ? "I" : "Don't i") + "nvert redstone"), playerEntity.getUUID()); + playerEntity.sendMessage(Utils.literal( (invertRedstone ? "I" : "Don't i") + "nvert redstone"), playerEntity.getUUID()); AntimatterPlatformUtils.markAndNotifyBlock(level, this.getBlockPos(), this.level.getChunkAt(this.getBlockPos()), this.getBlockState(), this.getBlockState(), 1, 512); break; case 3: blacklist = !blacklist; - playerEntity.sendMessage(new TextComponent( (blacklist ? "I" : "Don't i") + "nvert filter"), playerEntity.getUUID()); + playerEntity.sendMessage(Utils.literal( (blacklist ? "I" : "Don't i") + "nvert filter"), playerEntity.getUUID()); break; case 4: nbt = !nbt; - playerEntity.sendMessage(new TextComponent( (nbt ? "NBT has to match" : "Ignore NBT")), playerEntity.getUUID()); + playerEntity.sendMessage(Utils.literal( (nbt ? "NBT has to match" : "Ignore NBT")), playerEntity.getUUID()); break; } } diff --git a/common/src/main/java/muramasa/gregtech/cover/CoverShutter.java b/common/src/main/java/muramasa/gregtech/cover/CoverShutter.java index 57bc74e0a..b8dafb836 100644 --- a/common/src/main/java/muramasa/gregtech/cover/CoverShutter.java +++ b/common/src/main/java/muramasa/gregtech/cover/CoverShutter.java @@ -7,9 +7,9 @@ import muramasa.antimatter.data.AntimatterDefaultTools; import muramasa.antimatter.machine.Tier; import muramasa.antimatter.tool.AntimatterToolType; +import muramasa.antimatter.util.Utils; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.TextComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; @@ -63,19 +63,19 @@ public boolean onInteract(Player player, InteractionHand hand, Direction side, @ pipe.setConnection(this.side); } } - player.sendMessage(new TextComponent("Open if work disabled"), player.getUUID()); + player.sendMessage(Utils.literal("Open if work disabled"), player.getUUID()); } case OUTPUT_ONLY -> { if (handler.getTile() instanceof BlockEntityPipe pipe){ pipe.setConnection(this.side); } - player.sendMessage(new TextComponent("Output only"), player.getUUID()); + player.sendMessage(Utils.literal("Output only"), player.getUUID()); } case INPUT_ONLY -> { if (handler.getTile() instanceof BlockEntityPipe pipe){ pipe.setConnection(this.side); } - player.sendMessage(new TextComponent("Input only"), player.getUUID()); + player.sendMessage(Utils.literal("Input only"), player.getUUID()); } case OPEN_REDSTONE -> { if (handler.getTile() instanceof BlockEntityPipe pipe){ @@ -86,7 +86,7 @@ public boolean onInteract(Player player, InteractionHand hand, Direction side, @ } } - player.sendMessage(new TextComponent("Open if work enabled"), player.getUUID()); + player.sendMessage(Utils.literal("Open if work enabled"), player.getUUID()); } } return true; diff --git a/common/src/main/java/muramasa/gregtech/data/Machines.java b/common/src/main/java/muramasa/gregtech/data/Machines.java index d7e79b30a..2ec231f6c 100644 --- a/common/src/main/java/muramasa/gregtech/data/Machines.java +++ b/common/src/main/java/muramasa/gregtech/data/Machines.java @@ -1,26 +1,24 @@ package muramasa.gregtech.data; import com.google.common.collect.ImmutableMap; - import io.github.gregtechintergalactical.gtutility.GTUtilityData; import io.github.gregtechintergalactical.gtutility.machine.DrumMachine; import muramasa.antimatter.blockentity.single.BlockEntityBatteryBuffer; import muramasa.antimatter.blockentity.single.BlockEntityDigitalTransformer; +import muramasa.antimatter.blockentity.single.BlockEntityTransformer; import muramasa.antimatter.data.AntimatterMaterials; import muramasa.antimatter.machine.Tier; import muramasa.antimatter.machine.types.*; import muramasa.antimatter.material.Material; import muramasa.antimatter.texture.Texture; -import muramasa.antimatter.blockentity.single.BlockEntityTransformer; +import muramasa.antimatter.util.Utils; import muramasa.gregtech.GTIRef; +import muramasa.gregtech.blockentity.multi.*; +import muramasa.gregtech.blockentity.single.*; import muramasa.gregtech.machine.MultiblockTankMachine; import muramasa.gregtech.machine.SteamMachine; import muramasa.gregtech.nuclear.BlockEntityNuclearReactor; -import muramasa.gregtech.blockentity.multi.*; -import muramasa.gregtech.blockentity.single.*; import net.minecraft.ChatFormatting; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.sounds.SoundEvents; import static muramasa.antimatter.Data.*; @@ -145,11 +143,11 @@ public class Machines { tooltip.remove(tooltip.size() - 1); tooltip.remove(tooltip.size() - 1); Tier upper = Tier.getTier(machine.getTier().getVoltage() * 4); - tooltip.add(new TranslatableComponent("machine.transformer.voltage_info", new TextComponent(upper.getId().toUpperCase()), new TextComponent(machine.getTier().getId().toUpperCase()))); - tooltip.add(new TranslatableComponent("machine.voltage.in").append(": ").append(new TextComponent(upper.getVoltage() + " (" + upper.getId().toUpperCase() + ")")).withStyle(ChatFormatting.GREEN)); - tooltip.add(new TranslatableComponent("machine.voltage.out").append(": ").append(new TextComponent(machine.getTier().getVoltage() + " (" + machine.getTier().getId().toUpperCase() + ")")).withStyle(ChatFormatting.GREEN)); - tooltip.add(new TranslatableComponent("generic.amp").append(": ").append(new TextComponent(String.valueOf(4)).withStyle(ChatFormatting.YELLOW))); - tooltip.add(new TranslatableComponent("machine.power.capacity").append(": ").append(new TextComponent(String.valueOf(512L + machine.getTier().getVoltage() * 8L))).withStyle(ChatFormatting.BLUE)); + tooltip.add(Utils.translatable("machine.transformer.voltage_info", Utils.literal(upper.getId().toUpperCase()), Utils.literal(machine.getTier().getId().toUpperCase()))); + tooltip.add(Utils.translatable("machine.voltage.in").append(": ").append(Utils.literal(upper.getVoltage() + " (" + upper.getId().toUpperCase() + ")")).withStyle(ChatFormatting.GREEN)); + tooltip.add(Utils.translatable("machine.voltage.out").append(": ").append(Utils.literal(machine.getTier().getVoltage() + " (" + machine.getTier().getId().toUpperCase() + ")")).withStyle(ChatFormatting.GREEN)); + tooltip.add(Utils.translatable("generic.amp").append(": ").append(Utils.literal(String.valueOf(4)).withStyle(ChatFormatting.YELLOW))); + tooltip.add(Utils.translatable("machine.power.capacity").append(": ").append(Utils.literal(String.valueOf(512L + machine.getTier().getVoltage() * 8L))).withStyle(ChatFormatting.BLUE)); }); public static BasicMachine ADJUSTABLE_TRANSFORMER = new BasicMachine(GTIRef.ID, "adjustable_transformer").setTiers(EV, IV).addFlags(GUI, ENERGY).setTile(BlockEntityDigitalTransformer::new).noCovers().allowFrontIO(); /** diff --git a/common/src/main/java/muramasa/gregtech/gui/widgets/CoalBoilerFuelWidget.java b/common/src/main/java/muramasa/gregtech/gui/widgets/CoalBoilerFuelWidget.java index 72979cdec..f663922b8 100644 --- a/common/src/main/java/muramasa/gregtech/gui/widgets/CoalBoilerFuelWidget.java +++ b/common/src/main/java/muramasa/gregtech/gui/widgets/CoalBoilerFuelWidget.java @@ -9,10 +9,10 @@ import muramasa.antimatter.gui.widget.WidgetSupplier; import muramasa.antimatter.integration.jeirei.AntimatterJEIREIPlugin; import muramasa.antimatter.mixin.client.AbstractContainerScreenAccessor; +import muramasa.antimatter.util.Utils; import muramasa.gregtech.blockentity.single.BlockEntityCoalBoiler; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.network.chat.TextComponent; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -62,7 +62,7 @@ public void mouseOver(PoseStack stack, double mouseX, double mouseY, float parti @Environment(EnvType.CLIENT) protected void renderTooltip(PoseStack matrixStack, String text, double mouseX, double mouseY, int x, int y, int w, int h) { if (isInside(x, y, w, h, mouseX, mouseY)){ - renderTooltip(matrixStack, new TextComponent(text), mouseX, mouseY); + renderTooltip(matrixStack, Utils.literal(text), mouseX, mouseY); } } diff --git a/common/src/main/java/muramasa/gregtech/gui/widgets/CoalBoilerWidget.java b/common/src/main/java/muramasa/gregtech/gui/widgets/CoalBoilerWidget.java index 5dea5f687..2a2e3f2b0 100644 --- a/common/src/main/java/muramasa/gregtech/gui/widgets/CoalBoilerWidget.java +++ b/common/src/main/java/muramasa/gregtech/gui/widgets/CoalBoilerWidget.java @@ -7,10 +7,10 @@ import muramasa.antimatter.gui.container.ContainerMachine; import muramasa.antimatter.gui.widget.WidgetSupplier; import muramasa.antimatter.mixin.client.AbstractContainerScreenAccessor; +import muramasa.antimatter.util.Utils; import muramasa.gregtech.blockentity.single.BlockEntityCoalBoiler; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.network.chat.TextComponent; import tesseract.TesseractGraphWrappers; import javax.annotation.Nonnull; @@ -94,7 +94,7 @@ public void mouseOver(PoseStack stack, double mouseX, double mouseY, float parti @Environment(EnvType.CLIENT) protected void renderTooltip(PoseStack matrixStack, String text, double mouseX, double mouseY, int x, int y, int w, int h) { if (isInside(x, y, w, h, mouseX, mouseY)){ - renderTooltip(matrixStack, new TextComponent(text), mouseX, mouseY); + renderTooltip(matrixStack, Utils.literal(text), mouseX, mouseY); } } diff --git a/common/src/main/java/muramasa/gregtech/gui/widgets/FusionButtonWidget.java b/common/src/main/java/muramasa/gregtech/gui/widgets/FusionButtonWidget.java index 1e8e68334..3338d5dad 100644 --- a/common/src/main/java/muramasa/gregtech/gui/widgets/FusionButtonWidget.java +++ b/common/src/main/java/muramasa/gregtech/gui/widgets/FusionButtonWidget.java @@ -7,9 +7,9 @@ import muramasa.antimatter.gui.Widget; import muramasa.antimatter.gui.widget.WidgetSupplier; import muramasa.antimatter.integration.jeirei.AntimatterJEIREIPlugin; +import muramasa.antimatter.util.Utils; import muramasa.gregtech.GTIRef; import muramasa.gregtech.blockentity.multi.BlockEntityFusionReactor; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.resources.ResourceLocation; import javax.annotation.Nonnull; @@ -53,7 +53,7 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { public void mouseOver(PoseStack stack, double mouseX, double mouseY, float partialTicks) { super.mouseOver(stack, mouseX, mouseY, partialTicks); if (isInside(154, 4, 18, 18, mouseX, mouseY)){ - renderTooltip(stack, new TranslatableComponent("antimatter.gui.show_recipes"), mouseX, mouseY); + renderTooltip(stack, Utils.translatable("antimatter.gui.show_recipes"), mouseX, mouseY); } } diff --git a/common/src/main/java/muramasa/gregtech/gui/widgets/LavaBoilerWidget.java b/common/src/main/java/muramasa/gregtech/gui/widgets/LavaBoilerWidget.java index fe72a5865..511f75bf0 100644 --- a/common/src/main/java/muramasa/gregtech/gui/widgets/LavaBoilerWidget.java +++ b/common/src/main/java/muramasa/gregtech/gui/widgets/LavaBoilerWidget.java @@ -7,10 +7,10 @@ import muramasa.antimatter.gui.container.ContainerMachine; import muramasa.antimatter.gui.widget.WidgetSupplier; import muramasa.antimatter.mixin.client.AbstractContainerScreenAccessor; +import muramasa.antimatter.util.Utils; import muramasa.gregtech.blockentity.single.BlockEntityLavaBoiler; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.network.chat.TextComponent; import tesseract.TesseractGraphWrappers; import javax.annotation.Nonnull; @@ -111,7 +111,7 @@ public void mouseOver(PoseStack stack, double mouseX, double mouseY, float parti @Environment(EnvType.CLIENT) protected void renderTooltip(PoseStack matrixStack, String text, double mouseX, double mouseY, int x, int y, int w, int h) { if (isInside(x, y, w, h, mouseX, mouseY)){ - renderTooltip(matrixStack, new TextComponent(text), mouseX, mouseY); + renderTooltip(matrixStack, Utils.literal(text), mouseX, mouseY); } } diff --git a/common/src/main/java/muramasa/gregtech/gui/widgets/SolarBoilerWidget.java b/common/src/main/java/muramasa/gregtech/gui/widgets/SolarBoilerWidget.java index 4500e8f8b..99b8d94e9 100644 --- a/common/src/main/java/muramasa/gregtech/gui/widgets/SolarBoilerWidget.java +++ b/common/src/main/java/muramasa/gregtech/gui/widgets/SolarBoilerWidget.java @@ -7,10 +7,10 @@ import muramasa.antimatter.gui.container.ContainerMachine; import muramasa.antimatter.gui.widget.WidgetSupplier; import muramasa.antimatter.mixin.client.AbstractContainerScreenAccessor; +import muramasa.antimatter.util.Utils; import muramasa.gregtech.blockentity.single.BlockEntitySolarBoiler; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.network.chat.TextComponent; import tesseract.TesseractGraphWrappers; import javax.annotation.Nonnull; @@ -105,7 +105,7 @@ public void mouseOver(PoseStack stack, double mouseX, double mouseY, float parti @Environment(EnvType.CLIENT) protected void renderTooltip(PoseStack matrixStack, String text, double mouseX, double mouseY, int x, int y, int w, int h) { if (isInside(x, y, w, h, mouseX, mouseY)){ - renderTooltip(matrixStack, new TextComponent(text), mouseX, mouseY); + renderTooltip(matrixStack, Utils.literal(text), mouseX, mouseY); } } diff --git a/common/src/main/java/muramasa/gregtech/integration/rei/MaterialTreeCategory.java b/common/src/main/java/muramasa/gregtech/integration/rei/MaterialTreeCategory.java index 92ca8e064..16a175442 100644 --- a/common/src/main/java/muramasa/gregtech/integration/rei/MaterialTreeCategory.java +++ b/common/src/main/java/muramasa/gregtech/integration/rei/MaterialTreeCategory.java @@ -23,13 +23,13 @@ import muramasa.antimatter.pipe.types.FluidPipe; import muramasa.antimatter.pipe.types.ItemPipe; import muramasa.antimatter.pipe.types.Wire; +import muramasa.antimatter.util.Utils; import muramasa.gregtech.GTIRef; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiComponent; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -43,7 +43,7 @@ public class MaterialTreeCategory implements DisplayCategory { protected static Renderer icon = EntryStacks.of(DUST.get(AntimatterMaterials.Iron)); - private static final Component title = new TranslatableComponent(GTIRef.ID + ".rei.tooltip.material_tree"); + private static final Component title = Utils.translatable(GTIRef.ID + ".rei.tooltip.material_tree"); static CategoryIdentifier id = CategoryIdentifier.of(GTIRef.ID, "material_tree"); @Override diff --git a/common/src/main/java/muramasa/gregtech/integration/rei/OreProcessingCategory.java b/common/src/main/java/muramasa/gregtech/integration/rei/OreProcessingCategory.java index 00f22c0ba..73afe84d4 100644 --- a/common/src/main/java/muramasa/gregtech/integration/rei/OreProcessingCategory.java +++ b/common/src/main/java/muramasa/gregtech/integration/rei/OreProcessingCategory.java @@ -19,6 +19,7 @@ import muramasa.antimatter.data.AntimatterMaterials; import muramasa.antimatter.machine.types.Machine; import muramasa.antimatter.material.Material; +import muramasa.antimatter.util.Utils; import muramasa.gregtech.GTIRef; import muramasa.gregtech.data.GregTechMaterialTags; import muramasa.gregtech.data.Machines; @@ -26,7 +27,6 @@ import net.minecraft.client.gui.GuiComponent; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -41,7 +41,7 @@ public class OreProcessingCategory implements DisplayCategory { protected static Renderer icon = EntryStacks.of(Items.IRON_ORE); - private static final Component title = new TranslatableComponent(GTIRef.ID + ".rei.tooltip.ore.byproducts"); + private static final Component title = Utils.translatable(GTIRef.ID + ".rei.tooltip.ore.byproducts"); static CategoryIdentifier id = CategoryIdentifier.of(GTIRef.ID, "ore_byproducts"); @Override diff --git a/common/src/main/java/muramasa/gregtech/items/ItemPowerUnit.java b/common/src/main/java/muramasa/gregtech/items/ItemPowerUnit.java index f7e30c5cb..efec4f87e 100644 --- a/common/src/main/java/muramasa/gregtech/items/ItemPowerUnit.java +++ b/common/src/main/java/muramasa/gregtech/items/ItemPowerUnit.java @@ -6,9 +6,9 @@ import muramasa.antimatter.material.Material; import muramasa.antimatter.registration.IColorHandler; import muramasa.antimatter.texture.Texture; +import muramasa.antimatter.util.Utils; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; @@ -54,7 +54,7 @@ public int getItemColor(ItemStack stack, @Nullable Block block, int i) { @Override public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { - if (flagIn.isAdvanced()) tooltip.add(new TextComponent("Energy: " + getCurrentEnergy(stack) + " / " + getMaxEnergy(stack))); + if (flagIn.isAdvanced()) tooltip.add(Utils.literal("Energy: " + getCurrentEnergy(stack) + " / " + getMaxEnergy(stack))); super.appendHoverText(stack, worldIn, tooltip, flagIn); } diff --git a/common/src/main/java/muramasa/gregtech/items/ItemTurbineRotor.java b/common/src/main/java/muramasa/gregtech/items/ItemTurbineRotor.java index 53e40c501..a03983d1a 100644 --- a/common/src/main/java/muramasa/gregtech/items/ItemTurbineRotor.java +++ b/common/src/main/java/muramasa/gregtech/items/ItemTurbineRotor.java @@ -6,17 +6,15 @@ import muramasa.antimatter.tool.AntimatterItemTier; import muramasa.antimatter.tool.AntimatterToolType; import muramasa.antimatter.tool.MaterialTool; +import muramasa.antimatter.util.Utils; import muramasa.gregtech.data.ToolTypes; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; -import org.jetbrains.annotations.NotNull; import java.util.List; @@ -52,9 +50,9 @@ public Material getRodMaterial(){ @Override public void onGenericAddInformation(ItemStack stack, List tooltip, TooltipFlag flag) { super.onGenericAddInformation(stack, tooltip, flag); - tooltip.add(new TranslatableComponent("gti.rotor.tooltip.efficiency", new TextComponent("" + getEfficiency()).withStyle(ChatFormatting.BLUE))); - tooltip.add(new TranslatableComponent("gti.rotor.tooltip.steam_flow", new TextComponent("" + Math.max(Float.MIN_NORMAL, getSpeed() * 1000)).withStyle(ChatFormatting.LIGHT_PURPLE))); - tooltip.add(new TranslatableComponent("gti.rotor.tooltip.gas_flow", new TextComponent("" + Math.max(Float.MIN_NORMAL, getSpeed() * 50)).withStyle(ChatFormatting.LIGHT_PURPLE))); + tooltip.add(Utils.translatable("gti.rotor.tooltip.efficiency", Utils.literal("" + getEfficiency()).withStyle(ChatFormatting.BLUE))); + tooltip.add(Utils.translatable("gti.rotor.tooltip.steam_flow", Utils.literal("" + Math.max(Float.MIN_NORMAL, getSpeed() * 1000)).withStyle(ChatFormatting.LIGHT_PURPLE))); + tooltip.add(Utils.translatable("gti.rotor.tooltip.gas_flow", Utils.literal("" + Math.max(Float.MIN_NORMAL, getSpeed() * 50)).withStyle(ChatFormatting.LIGHT_PURPLE))); } @Override diff --git a/common/src/main/java/muramasa/gregtech/machine/MultiblockTankMachine.java b/common/src/main/java/muramasa/gregtech/machine/MultiblockTankMachine.java index c065189cd..f736215fd 100644 --- a/common/src/main/java/muramasa/gregtech/machine/MultiblockTankMachine.java +++ b/common/src/main/java/muramasa/gregtech/machine/MultiblockTankMachine.java @@ -8,11 +8,10 @@ import muramasa.antimatter.material.Material; import muramasa.antimatter.structure.FakeTileElement; import muramasa.antimatter.texture.Texture; +import muramasa.antimatter.util.Utils; import muramasa.gregtech.GTIRef; import muramasa.gregtech.blockentity.multi.TileEntityLargeTank; -import net.minecraft.network.chat.TranslatableComponent; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; import static muramasa.antimatter.data.AntimatterMaterials.Wood; public class MultiblockTankMachine extends MaterialBasicMultiMachine { @@ -33,7 +32,7 @@ public MultiblockTankMachine(String domain, Material material, boolean small, in .build()); } setTooltipInfo((machine, stack, world, tooltip, flag) -> { - tooltip.add(new TranslatableComponent("machine.drum.capacity", capacity)); + tooltip.add(Utils.translatable("machine.drum.capacity", capacity)); }); addFlags(MachineFlag.FLUID); setTile((type1, pos, state1) -> new TileEntityLargeTank(this, pos, state1));