From 40f48f0e6c2b1ab0024f2aa6dd3d3a7b22296981 Mon Sep 17 00:00:00 2001 From: Flanks255 <32142731+Flanks255@users.noreply.github.com> Date: Sat, 2 Dec 2023 07:49:10 -0600 Subject: [PATCH] More Cleanup. --- .../mod/blocks/BlockLavaFactoryController.java | 6 +++--- .../actuallyadditions/mod/blocks/BlockPhantom.java | 9 +++++---- .../actuallyadditions/mod/event/ClientEvents.java | 3 +-- .../mod/inventory/gui/GuiDrill.java | 4 ++-- .../mod/inventory/gui/GuiFeeder.java | 10 +++++----- .../mod/inventory/gui/GuiFilter.java | 4 ++-- .../inventory/gui/GuiLaserRelayItemWhitelist.java | 6 +++--- .../actuallyadditions/mod/items/ItemCoffee.java | 4 ++-- .../mod/tile/TileEntityLaserRelayEnergy.java | 6 +++--- .../mod/tile/TileEntityLaserRelayFluids.java | 6 +++--- .../mod/tile/TileEntityLaserRelayItem.java | 6 +++--- .../actuallyadditions/mod/util/AssetUtil.java | 10 +++------- .../actuallyadditions/mod/util/StringUtil.java | 12 ------------ 13 files changed, 35 insertions(+), 51 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java index 56933e8bd..3cc9efb32 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java @@ -18,6 +18,7 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.block.BlockState; import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -26,7 +27,6 @@ import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.text.TextFormatting; import net.minecraft.world.IBlockReader; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -54,9 +54,9 @@ public class BlockLavaFactoryController extends DirectionalBlock.Container imple if (factory != null) { int state = factory.isMultiblock(); if (state == TileEntityLavaFactoryController.NOT_MULTI) { - StringUtil.drawSplitString(minecraft.font, StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".factory.notPart.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 5, 200, 0xFFFFFF, true); + StringUtil.drawSplitString(minecraft.font, I18n.get("tooltip." + ActuallyAdditions.MODID + ".factory.notPart.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 5, 200, 0xFFFFFF, true); } else if (state == TileEntityLavaFactoryController.HAS_AIR || state == TileEntityLavaFactoryController.HAS_LAVA) { - StringUtil.drawSplitString(minecraft.font, StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".factory.works.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 5, 200, 0xFFFFFF, true); + StringUtil.drawSplitString(minecraft.font, I18n.get("tooltip." + ActuallyAdditions.MODID + ".factory.works.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 5, 200, 0xFFFFFF, true); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java index 62b20b6e3..02376d028 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java @@ -20,6 +20,7 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -127,7 +128,7 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay { if (tile != null) { if (tile instanceof IPhantomTile) { IPhantomTile phantom = (IPhantomTile) tile; - minecraft.font.drawShadow(matrices, TextFormatting.GOLD + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".blockPhantomRange.desc") + ": " + phantom.getRange(), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 - 40, TextFormatting.WHITE.getColor()); + minecraft.font.drawShadow(matrices, TextFormatting.GOLD + I18n.get("tooltip." + ActuallyAdditions.MODID + ".blockPhantomRange.desc") + ": " + phantom.getRange(), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 - 40, TextFormatting.WHITE.getColor()); if (phantom.hasBoundPosition()) { int distance = MathHelper.ceil(new Vector3d(pos.getX(), pos.getY(), pos.getZ()).distanceTo(new Vector3d(phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ()))); BlockState state = minecraft.level.getBlockState(phantom.getBoundPosition()); @@ -137,12 +138,12 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay { StringUtil.drawSplitString(minecraft.font, StringUtil.localizeFormatted("tooltip." + ActuallyAdditions.MODID + ".phantom.blockInfo.desc", name, phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ(), distance), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 - 30, 200, 0xFFFFFF, true); if (phantom.isBoundThingInRange()) { - StringUtil.drawSplitString(minecraft.font, TextFormatting.DARK_GREEN + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".phantom.connectedRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, 0xFFFFFF, true); + StringUtil.drawSplitString(minecraft.font, TextFormatting.DARK_GREEN + I18n.get("tooltip." + ActuallyAdditions.MODID + ".phantom.connectedRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, 0xFFFFFF, true); } else { - StringUtil.drawSplitString(minecraft.font, TextFormatting.DARK_RED + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".phantom.connectedNoRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, 0xFFFFFF, true); + StringUtil.drawSplitString(minecraft.font, TextFormatting.DARK_RED + I18n.get("tooltip." + ActuallyAdditions.MODID + ".phantom.connectedNoRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, 0xFFFFFF, true); } } else { - minecraft.font.drawShadow(matrices, TextFormatting.RED + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".phantom.notConnected.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, TextFormatting.WHITE.getColor()); + minecraft.font.drawShadow(matrices, TextFormatting.RED + I18n.get("tooltip." + ActuallyAdditions.MODID + ".phantom.notConnected.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, TextFormatting.WHITE.getColor()); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java index 7686af06c..dd7ad04fc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java @@ -19,7 +19,6 @@ import de.ellpeck.actuallyadditions.mod.inventory.gui.EnergyDisplay; import de.ellpeck.actuallyadditions.mod.tile.IEnergyDisplay; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -191,7 +190,7 @@ public class ClientEvents { if (tileHit instanceof TileEntityBase) { TileEntityBase base = (TileEntityBase) tileHit; if (base.isRedstoneToggle()) { - String strg = String.format("%s: %s", StringUtil.localize("info." + ActuallyAdditions.MODID + ".redstoneMode"), TextFormatting.DARK_RED + StringUtil.localize("info." + ActuallyAdditions.MODID + ".redstoneMode." + (base.isPulseMode + String strg = String.format("%s: %s", I18n.get("info." + ActuallyAdditions.MODID + ".redstoneMode"), TextFormatting.DARK_RED + I18n.get("info." + ActuallyAdditions.MODID + ".redstoneMode." + (base.isPulseMode ? "pulse" : "deactivation")) + TextFormatting.RESET); font.drawShadow(event.getMatrixStack(), strg, event.getWindow().getGuiScaledWidth() / 2f + 5, event.getWindow().getGuiScaledHeight() / 2f + 5, 0xFFFFFF); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDrill.java index 88064abf1..06ded003c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDrill.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDrill.java @@ -15,7 +15,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.inventory.ContainerDrill; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; @@ -38,7 +38,7 @@ public class GuiDrill extends AAScreen { @Override public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + ".drill.name")); + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, I18n.get("container." + ActuallyAdditions.MODID + ".drill.name")); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java index 55ac55ccd..00b2b36cf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java @@ -16,7 +16,7 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFeeder; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; @@ -42,11 +42,11 @@ public class GuiFeeder extends AAScreen { public void render(@Nonnull MatrixStack matrices, int x, int y, float f) { super.render(matrices, x, y, f); if (x >= this.leftPos + 69 && y >= this.topPos + 30 && x <= this.leftPos + 69 + 10 && y <= this.topPos + 30 + 10) { - String[] array = new String[]{this.tileFeeder.currentAnimalAmount + " " + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.animals"), this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < TileEntityFeeder.THRESHOLD - ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.enoughToBreed") + String[] array = new String[]{this.tileFeeder.currentAnimalAmount + " " + I18n.get("info." + ActuallyAdditions.MODID + ".gui.animals"), this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < TileEntityFeeder.THRESHOLD + ? I18n.get("info." + ActuallyAdditions.MODID + ".gui.enoughToBreed") : this.tileFeeder.currentAnimalAmount >= TileEntityFeeder.THRESHOLD - ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.tooMany") - : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.notEnough")}; + ? I18n.get("info." + ActuallyAdditions.MODID + ".gui.tooMany") + : I18n.get("info." + ActuallyAdditions.MODID + ".gui.notEnough")}; //this.drawHoveringText(Arrays.asList(array), x, y); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFilter.java index 92450cf29..44635cc4b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFilter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFilter.java @@ -15,7 +15,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFilter; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; @@ -37,7 +37,7 @@ public class GuiFilter extends AAScreen { @Override public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + ".filter.name")); + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, I18n.get("container." + ActuallyAdditions.MODID + ".filter.name")); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java index 5021e84b8..b4d955e25 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java @@ -16,8 +16,8 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.inventory.ContainerLaserRelayItemWhitelist; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemAdvanced; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.gui.widget.button.Button; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; @@ -90,8 +90,8 @@ public class GuiLaserRelayItemWhitelist extends AAScreen