From 7ccd5bcebdcce4731889451972e750874cf7d95c Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sun, 26 Apr 2020 16:29:38 +0100 Subject: [PATCH] 20w17a compile pass --- build.gradle | 10 ++-- src/main/java/techreborn/TechReborn.java | 3 -- .../blockentity/cable/CableBlockEntity.java | 27 +++++++--- .../blockentity/data/DataDrivenGui.java | 15 +++--- .../blockentity/data/DataDrivenSlot.java | 7 +-- .../generator/SolarPanelBlockEntity.java | 46 ++++++++++++++--- .../machine/misc/AlarmBlockEntity.java | 8 ++- .../FusionControlComputerBlockEntity.java | 18 ++++--- .../storage/energy/idsu/IDSUManager.java | 24 +++++---- .../fluid/TankUnitBaseBlockEntity.java | 18 ++++++- .../item/StorageUnitBaseBlockEntity.java | 19 +++++-- .../machine/tier1/BlockPlayerDetector.java | 13 +++-- .../java/techreborn/client/gui/GuiAESU.java | 31 +++++++----- .../client/gui/GuiAlloyFurnace.java | 21 ++++---- .../client/gui/GuiAlloySmelter.java | 25 +++++----- .../client/gui/GuiAssemblingMachine.java | 23 +++++---- .../client/gui/GuiAutoCrafting.java | 24 +++++---- .../java/techreborn/client/gui/GuiBatbox.java | 26 +++++++--- .../client/gui/GuiBlastFurnace.java | 31 ++++++------ .../techreborn/client/gui/GuiCentrifuge.java | 29 +++++------ .../techreborn/client/gui/GuiChargeBench.java | 23 +++++---- .../client/gui/GuiChemicalReactor.java | 25 +++++----- .../techreborn/client/gui/GuiChunkLoader.java | 14 ++++-- .../techreborn/client/gui/GuiCompressor.java | 21 ++++---- .../client/gui/GuiDieselGenerator.java | 21 ++++---- .../client/gui/GuiDistillationTower.java | 29 +++++------ .../client/gui/GuiElectricFurnace.java | 21 ++++---- .../techreborn/client/gui/GuiExtractor.java | 21 ++++---- .../client/gui/GuiFluidReplicator.java | 31 ++++++------ .../client/gui/GuiFusionReactor.java | 49 ++++++++++-------- .../techreborn/client/gui/GuiGasTurbine.java | 21 ++++---- .../techreborn/client/gui/GuiGenerator.java | 19 +++---- .../client/gui/GuiGreenhouseController.java | 50 ++++++++++++------- .../java/techreborn/client/gui/GuiIDSU.java | 28 +++++++---- .../client/gui/GuiImplosionCompressor.java | 31 ++++++------ .../client/gui/GuiIndustrialElectrolyzer.java | 23 +++++---- .../client/gui/GuiIndustrialGrinder.java | 39 ++++++++------- .../client/gui/GuiIndustrialSawmill.java | 37 +++++++------- .../techreborn/client/gui/GuiIronFurnace.java | 33 ++++++------ .../java/techreborn/client/gui/GuiLESU.java | 22 ++++---- .../java/techreborn/client/gui/GuiMFE.java | 27 ++++++---- .../java/techreborn/client/gui/GuiMFSU.java | 20 ++++---- .../java/techreborn/client/gui/GuiManual.java | 29 ++++++----- .../client/gui/GuiMatterFabricator.java | 29 +++++------ .../client/gui/GuiPlasmaGenerator.java | 21 ++++---- .../techreborn/client/gui/GuiRecycler.java | 19 +++---- .../client/gui/GuiRollingMachine.java | 39 ++++++++------- .../client/gui/GuiScrapboxinator.java | 21 ++++---- .../client/gui/GuiSemifluidGenerator.java | 21 ++++---- .../java/techreborn/client/gui/GuiSolar.java | 21 ++++---- .../client/gui/GuiSolidCanningMachine.java | 25 +++++----- .../techreborn/client/gui/GuiStorageUnit.java | 32 ++++++------ .../techreborn/client/gui/GuiTankUnit.java | 38 +++++++------- .../client/gui/GuiThermalGenerator.java | 21 ++++---- .../client/gui/GuiVacuumFreezer.java | 29 +++++------ .../techreborn/client/gui/GuiWireMill.java | 23 +++++---- .../compat/rei/MachineRecipeCategory.java | 7 +-- .../java/techreborn/compat/rei/ReiPlugin.java | 4 +- .../FluidGeneratorRecipeCategory.java | 4 +- .../FluidReplicatorRecipeCategory.java | 4 +- .../RollingMachineCategory.java | 3 +- .../events/StackToolTipHandler.java | 3 +- .../items/FrequencyTransmitterItem.java | 45 ++++++++++------- .../techreborn/items/tool/DebugToolItem.java | 2 +- .../industrial/IndustrialJackhammerItem.java | 5 +- .../world/RubberSaplingGenerator.java | 13 ++--- .../techreborn/world/RubberTreeFeature.java | 26 +++++----- .../java/techreborn/world/WorldGenerator.java | 19 +++---- 68 files changed, 868 insertions(+), 658 deletions(-) diff --git a/build.gradle b/build.gradle index f6d4eff26..af2fef69d 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ buildscript { } } dependencies { - classpath "net.fabricmc:fabric-loom:0.2.7-SNAPSHOT" + classpath "net.fabricmc:fabric-loom:0.4.+" classpath "gradle.plugin.net.minecrell:licenser:0.2.1" classpath 'de.undercouch:gradle-download-task:3.4.3' classpath "com.wynprice.cursemaven:CurseMaven:2.1.1" @@ -72,14 +72,14 @@ license { group = 'TechReborn' dependencies { - minecraft "com.mojang:minecraft:20w15a" - mappings "net.fabricmc:yarn:20w15a+build.2:v2" + minecraft "com.mojang:minecraft:20w17a" + mappings "net.fabricmc:yarn:20w17a+build.5:v2" modImplementation "net.fabricmc:fabric-loader:0.8.2+build.194" //Fabric api - modImplementation "net.fabricmc.fabric-api:fabric-api:0.5.9+build.319-1.16" + modImplementation "net.fabricmc.fabric-api:fabric-api:0.6.2+build.327-1.16" - optionalDependency ("me.shedaniel:RoughlyEnoughItems:4.1.1-unstable") + optionalDependency ("me.shedaniel:RoughlyEnoughItems:4.2.0-unstable") disabledOptionalDependency ('io.github.cottonmc:LibCD:2.3.0+1.15.2') disabledOptionalDependency ('com.github.emilyploszaj:trinkets:2.4.2') diff --git a/src/main/java/techreborn/TechReborn.java b/src/main/java/techreborn/TechReborn.java index cdcf4acd6..670e6318f 100644 --- a/src/main/java/techreborn/TechReborn.java +++ b/src/main/java/techreborn/TechReborn.java @@ -49,7 +49,6 @@ import reborncore.common.blockentity.RedstoneConfiguration; import reborncore.common.config.Configuration; import reborncore.common.recipes.RecipeCrafter; import reborncore.common.util.Torus; -import reborncore.common.world.DataAttachment; import techreborn.blockentity.storage.energy.idsu.IDSUManager; import techreborn.client.GuiType; import techreborn.compat.trinkets.Trinkets; @@ -109,8 +108,6 @@ public class TechReborn implements ModInitializer { Torus.genSizeMap(TechRebornConfig.fusionControlComputerMaxCoilSize); - DataAttachment.REGISTRY.register(IDSUManager.class, IDSUManager::new); - RedstoneConfiguration.fluidStack = DynamicCellItem.getCellWithFluid(Fluids.LAVA); RedstoneConfiguration.powerStack = new ItemStack(TRContent.RED_CELL_BATTERY); diff --git a/src/main/java/techreborn/blockentity/cable/CableBlockEntity.java b/src/main/java/techreborn/blockentity/cable/CableBlockEntity.java index 4a0568efd..d5135e1fe 100644 --- a/src/main/java/techreborn/blockentity/cable/CableBlockEntity.java +++ b/src/main/java/techreborn/blockentity/cable/CableBlockEntity.java @@ -34,6 +34,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtHelper; import net.minecraft.text.LiteralText; import net.minecraft.text.Text; +import net.minecraft.text.TranslatableText; import net.minecraft.util.Formatting; import net.minecraft.util.Tickable; import net.minecraft.util.math.Direction; @@ -173,13 +174,27 @@ public class CableBlockEntity extends BlockEntity // IListInfoProvider @Override public void addInfo(List info, boolean isReal, boolean hasData) { - info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.transferRate") + ": " - + Formatting.GOLD - + PowerSystem.getLocaliszedPowerFormatted(getCableType().transferRate) + "/t")); - info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.tier") + ": " - + Formatting.GOLD + StringUtils.toFirstCapitalAllLowercase(getCableType().tier.toString()))); + info.add( + new TranslatableText("techreborn.tooltip.transferRate") + .formatted(Formatting.GRAY) + .append(": ") + .append(PowerSystem.getLocaliszedPowerFormatted(getCableType().transferRate)) + .formatted(Formatting.GOLD) + .append("/t") + ); + + info.add( + new TranslatableText("techreborn.tooltip.tier") + .formatted(Formatting.GRAY) + .append(": ") + .append( + new LiteralText(StringUtils.toFirstCapitalAllLowercase(getCableType().tier.toString())) + .formatted(Formatting.GOLD) + ) + ); + if (!getCableType().canKill) { - info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.cable.can_cover"))); + info.add(new TranslatableText("techreborn.tooltip.cable.can_cover").formatted(Formatting.GRAY)); } } diff --git a/src/main/java/techreborn/blockentity/data/DataDrivenGui.java b/src/main/java/techreborn/blockentity/data/DataDrivenGui.java index 31a1c0f80..f95dad283 100644 --- a/src/main/java/techreborn/blockentity/data/DataDrivenGui.java +++ b/src/main/java/techreborn/blockentity/data/DataDrivenGui.java @@ -24,6 +24,7 @@ package techreborn.blockentity.data; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -41,20 +42,20 @@ public class DataDrivenGui extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; final DataDrivenGui gui = this; - provider.getSlots().forEach(slot -> slot.draw(gui, layer)); + provider.getSlots().forEach(slot -> slot.draw(matrixStack, gui, layer)); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } } \ No newline at end of file diff --git a/src/main/java/techreborn/blockentity/data/DataDrivenSlot.java b/src/main/java/techreborn/blockentity/data/DataDrivenSlot.java index 1dee3be32..d444bd3ad 100644 --- a/src/main/java/techreborn/blockentity/data/DataDrivenSlot.java +++ b/src/main/java/techreborn/blockentity/data/DataDrivenSlot.java @@ -28,6 +28,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.JsonHelper; import org.apache.commons.lang3.Validate; import reborncore.client.screen.builder.BlockEntityScreenHandlerBuilder; @@ -82,12 +83,12 @@ public class DataDrivenSlot { } @Environment(EnvType.CLIENT) - public void draw(GuiBase guiBase, GuiBase.Layer layer){ + public void draw(MatrixStack matrixStack, GuiBase guiBase, GuiBase.Layer layer){ //TODO find a better way to do this if(getType() == SlotType.OUTPUT){ - guiBase.drawOutputSlot(getX(), getY(), layer); + guiBase.drawOutputSlot(matrixStack, getX(), getY(), layer); } else { - guiBase.drawSlot(getX(), getY(), layer); + guiBase.drawSlot(matrixStack, getX(), getY(), layer); } } } diff --git a/src/main/java/techreborn/blockentity/generator/SolarPanelBlockEntity.java b/src/main/java/techreborn/blockentity/generator/SolarPanelBlockEntity.java index a475b52bb..d23cfa504 100644 --- a/src/main/java/techreborn/blockentity/generator/SolarPanelBlockEntity.java +++ b/src/main/java/techreborn/blockentity/generator/SolarPanelBlockEntity.java @@ -31,6 +31,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundTag; import net.minecraft.text.LiteralText; import net.minecraft.text.Text; +import net.minecraft.text.TranslatableText; import net.minecraft.util.Formatting; import net.minecraft.util.math.Direction; import reborncore.api.IToolDrop; @@ -215,17 +216,46 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I if (panel == SolarPanels.CREATIVE) { return; } - info.add(new LiteralText(Formatting.GRAY + StringUtils.t("reborncore.tooltip.energy.maxEnergy") + ": " - + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted(getMaxPower()))); - info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.generationRate.day") + ": " - + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted(panel.generationRateD))); + info.add( + new TranslatableText("reborncore.tooltip.energy.maxEnergy") + .formatted(Formatting.GRAY) + .append(": ") + .append( + new LiteralText(PowerSystem.getLocaliszedPowerFormatted(getMaxPower())) + .formatted(Formatting.GOLD) + ) + ); - info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.generationRate.night") + ": " - + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted(panel.generationRateN))); + info.add( + new TranslatableText("techreborn.tooltip.generationRate.day") + .formatted(Formatting.GRAY) + .append(": ") + .append( + new LiteralText(PowerSystem.getLocaliszedPowerFormatted(panel.generationRateD)) + .formatted(Formatting.GOLD) + ) + ); - info.add(new LiteralText(Formatting.GRAY + StringUtils.t("reborncore.tooltip.energy.tier") + ": " - + Formatting.GOLD + StringUtils.toFirstCapitalAllLowercase(getTier().toString()))); + info.add( + new TranslatableText("techreborn.tooltip.generationRate.night") + .formatted(Formatting.GRAY) + .append(": ") + .append( + new LiteralText(PowerSystem.getLocaliszedPowerFormatted(panel.generationRateN)) + .formatted(Formatting.GOLD) + ) + ); + + info.add( + new TranslatableText("reborncore.tooltip.energy.tier") + .formatted(Formatting.GRAY) + .append(": ") + .append( + new LiteralText(StringUtils.toFirstCapitalAllLowercase(getTier().toString())) + .formatted(Formatting.GOLD) + ) + ); } @Override diff --git a/src/main/java/techreborn/blockentity/machine/misc/AlarmBlockEntity.java b/src/main/java/techreborn/blockentity/machine/misc/AlarmBlockEntity.java index 3f910cac5..4a5a075d7 100644 --- a/src/main/java/techreborn/blockentity/machine/misc/AlarmBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/misc/AlarmBlockEntity.java @@ -31,6 +31,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundTag; import net.minecraft.sound.SoundCategory; import net.minecraft.text.LiteralText; +import net.minecraft.text.TranslatableText; import net.minecraft.util.Formatting; import net.minecraft.util.Tickable; import reborncore.api.IToolDrop; @@ -60,8 +61,11 @@ public class AlarmBlockEntity extends BlockEntity } else { selectedSound = 1; } - ChatUtils.sendNoSpamMessages(MessageIDs.alarmID, new LiteralText( - Formatting.GRAY + StringUtils.t("techreborn.message.alarm") + " " + "Alarm " + selectedSound)); + + ChatUtils.sendNoSpamMessages(MessageIDs.alarmID, new TranslatableText("techreborn.message.alarm") + .formatted(Formatting.GRAY) + .append(" Alarm ") + .append(String.valueOf(selectedSound))); } // BlockEntity diff --git a/src/main/java/techreborn/blockentity/machine/multiblock/FusionControlComputerBlockEntity.java b/src/main/java/techreborn/blockentity/machine/multiblock/FusionControlComputerBlockEntity.java index 409d35caf..73d249f3c 100644 --- a/src/main/java/techreborn/blockentity/machine/multiblock/FusionControlComputerBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/multiblock/FusionControlComputerBlockEntity.java @@ -28,6 +28,8 @@ import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundTag; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -41,6 +43,7 @@ import reborncore.common.crafting.ingredient.RebornIngredient; import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import reborncore.common.util.ItemUtils; import reborncore.common.util.RebornInventory; +import reborncore.common.util.StringUtils; import reborncore.common.util.Torus; import techreborn.api.recipe.recipes.FusionReactorRecipe; import techreborn.config.TechRebornConfig; @@ -484,22 +487,23 @@ public class FusionControlComputerBlockEntity extends PowerAcceptorBlockEntity .orElse(null); } - public String getStateString(){ + public Text getStateText(){ if(state == -1){ - return ""; + return LiteralText.EMPTY; } else if (state == 0){ - return "No recipe"; + return new LiteralText("No recipe"); } else if (state == 1){ FusionReactorRecipe r = getCurrentRecipeFromID(); if(r == null) { - return "Charging"; + return new LiteralText("Charging"); } int percentage = percentage(r.getStartEnergy(), getEnergy()); - return "Charging (" + percentage + "%)"; + return new LiteralText("Charging (") + .append(StringUtils.getPercentageText(percentage)); } else if (state == 2){ - return "Crafting"; + return new LiteralText("Crafting"); } - return ""; + return LiteralText.EMPTY; } private int percentage(double MaxValue, double CurrentValue) { diff --git a/src/main/java/techreborn/blockentity/storage/energy/idsu/IDSUManager.java b/src/main/java/techreborn/blockentity/storage/energy/idsu/IDSUManager.java index d9f42ef2a..012eaedb2 100644 --- a/src/main/java/techreborn/blockentity/storage/energy/idsu/IDSUManager.java +++ b/src/main/java/techreborn/blockentity/storage/energy/idsu/IDSUManager.java @@ -25,15 +25,21 @@ package techreborn.blockentity.storage.energy.idsu; import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.world.PersistentState; import net.minecraft.world.World; import reborncore.common.util.NBTSerializable; -import reborncore.common.world.DataAttachment; -import reborncore.common.world.DataAttachmentProvider; import javax.annotation.Nonnull; import java.util.HashMap; -public class IDSUManager implements DataAttachment { +public class IDSUManager extends PersistentState { + + private static final String KEY = "techreborn_idsu"; + + public IDSUManager() { + super(KEY); + } @Nonnull public static IDSUPlayer getPlayer(World world, String uuid){ @@ -41,7 +47,8 @@ public class IDSUManager implements DataAttachment { } public static IDSUManager get(World world){ - return DataAttachmentProvider.get(world, IDSUManager.class); + ServerWorld serverWorld = (ServerWorld) world; + return serverWorld.getPersistentStateManager().getOrCreate(IDSUManager::new, KEY); } private final HashMap playerHashMap = new HashMap<>(); @@ -52,21 +59,19 @@ public class IDSUManager implements DataAttachment { } @Override - public void read(@Nonnull CompoundTag tag) { + public void fromTag(CompoundTag tag) { for(String uuid : tag.getKeys()){ playerHashMap.put(uuid, new IDSUPlayer(tag.getCompound(uuid))); } } - @Nonnull @Override - public CompoundTag write() { - CompoundTag tag = new CompoundTag(); + public CompoundTag toTag(CompoundTag tag) { playerHashMap.forEach((uuid, player) -> tag.put(uuid, player.write())); return tag; } - public static class IDSUPlayer implements NBTSerializable { + public class IDSUPlayer implements NBTSerializable { private double energy; @@ -96,6 +101,7 @@ public class IDSUManager implements DataAttachment { public void setEnergy(double energy) { this.energy = energy; + markDirty(); } } diff --git a/src/main/java/techreborn/blockentity/storage/fluid/TankUnitBaseBlockEntity.java b/src/main/java/techreborn/blockentity/storage/fluid/TankUnitBaseBlockEntity.java index 0f11d956f..d6d03738c 100644 --- a/src/main/java/techreborn/blockentity/storage/fluid/TankUnitBaseBlockEntity.java +++ b/src/main/java/techreborn/blockentity/storage/fluid/TankUnitBaseBlockEntity.java @@ -155,12 +155,26 @@ public class TankUnitBaseBlockEntity extends MachineBaseBlockEntity implements I public void addInfo(final List info, final boolean isReal, boolean hasData) { if (isReal || hasData) { if (!this.tank.getFluidInstance().isEmpty()) { - info.add(new LiteralText(this.tank.getFluidAmount() + StringUtils.t("techreborn.tooltip.unit.divider") + WordUtils.capitalize(FluidUtil.getFluidName(this.tank.getFluid())))); + info.add( + new LiteralText(String.valueOf(this.tank.getFluidAmount())) + .append(new TranslatableText("techreborn.tooltip.unit.divider")) + .append(WordUtils.capitalize(FluidUtil.getFluidName(this.tank.getFluid()))) + ); } else { info.add(new TranslatableText("techreborn.tooltip.unit.empty")); } } - info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.unit.capacity") + Formatting.GOLD + this.tank.getCapacity() + " (" + this.tank.getCapacity().getRawValue() / 1000 + ")")); + info.add( + new TranslatableText("techreborn.tooltip.unit.capacity") + .formatted(Formatting.GRAY) + .append( + new LiteralText(String.valueOf(this.tank.getCapacity())) + .formatted(Formatting.GOLD) + .append(" (") + .append(String.valueOf(this.tank.getCapacity().getRawValue() / 1000)) + .append(")") + ) + ); } // IContainerProvider diff --git a/src/main/java/techreborn/blockentity/storage/item/StorageUnitBaseBlockEntity.java b/src/main/java/techreborn/blockentity/storage/item/StorageUnitBaseBlockEntity.java index 8cbbd0bfd..f3574738d 100644 --- a/src/main/java/techreborn/blockentity/storage/item/StorageUnitBaseBlockEntity.java +++ b/src/main/java/techreborn/blockentity/storage/item/StorageUnitBaseBlockEntity.java @@ -332,14 +332,27 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity public void addInfo(final List info, final boolean isReal, boolean hasData) { if (isReal || hasData) { if (!this.isEmpty()) { - info.add(new LiteralText(this.getCurrentCapacity() + StringUtils.t("techreborn.tooltip.unit.divider") + this.getStoredStack().getName().asString())); + info.add( + new LiteralText(String.valueOf(this.getCurrentCapacity())) + .append(new TranslatableText("techreborn.tooltip.unit.divider")) + .append(this.getStoredStack().getName()) + ); } else { info.add(new TranslatableText("techreborn.tooltip.unit.empty")); } } - info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.unit.capacity") + Formatting.GOLD + this.getMaxCapacity() + - " items (" + this.getMaxCapacity() / 64 + ")")); + info.add( + new TranslatableText("techreborn.tooltip.unit.capacity") + .formatted(Formatting.GRAY) + .append( + new LiteralText(String.valueOf(this.getMaxCapacity())) + .formatted(Formatting.GOLD) + .append(" items (") + .append(String.valueOf(this.getMaxCapacity() / 64)) + .append(")") + ) + ); } @Override diff --git a/src/main/java/techreborn/blocks/machine/tier1/BlockPlayerDetector.java b/src/main/java/techreborn/blocks/machine/tier1/BlockPlayerDetector.java index 17796bd24..f80bb7264 100644 --- a/src/main/java/techreborn/blocks/machine/tier1/BlockPlayerDetector.java +++ b/src/main/java/techreborn/blocks/machine/tier1/BlockPlayerDetector.java @@ -25,6 +25,7 @@ package techreborn.blocks.machine.tier1; import net.minecraft.text.LiteralText; +import net.minecraft.text.TranslatableText; import net.minecraft.util.ActionResult; import net.minecraft.util.Formatting; import net.minecraft.block.Block; @@ -123,9 +124,15 @@ public class BlockPlayerDetector extends BlockMachineBase { } if (worldIn.isClient) { - ChatUtils.sendNoSpamMessages(MessageIDs.playerDetectorID, new LiteralText( - Formatting.GRAY + StringUtils.t("techreborn.message.detects") + " " + color - + StringUtils.toFirstCapital(newType.asString()))); + ChatUtils.sendNoSpamMessages(MessageIDs.playerDetectorID, + new TranslatableText("techreborn.message.detects") + .formatted(Formatting.GRAY) + .append(" ") + .append( + new LiteralText(StringUtils.toFirstCapital(newType.asString())) + .formatted(color) + ) + ); } return ActionResult.SUCCESS; } diff --git a/src/main/java/techreborn/client/gui/GuiAESU.java b/src/main/java/techreborn/client/gui/GuiAESU.java index 56c845372..8bf01d457 100644 --- a/src/main/java/techreborn/client/gui/GuiAESU.java +++ b/src/main/java/techreborn/client/gui/GuiAESU.java @@ -26,7 +26,10 @@ package techreborn.client.gui; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.widget.GuiButtonUpDown; @@ -55,31 +58,35 @@ public class GuiAESU extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - this.drawSlot(62, 45, layer); - this.drawSlot(98, 45, layer); - this.drawArmourSlots(8, 18, layer); - this.builder.drawEnergyOutput(this, 155, 61, this.blockEntity.getCurrentOutput(), layer); + this.drawSlot(matrixStack, 62, 45, layer); + this.drawSlot(matrixStack, 98, 45, layer); + this.drawArmourSlots(matrixStack, 8, 18, layer); + this.builder.drawEnergyOutput(matrixStack, this, 155, 61, this.blockEntity.getCurrentOutput(), layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final Layer layer = Layer.FOREGROUND; if(!hideGuiElements()){ RenderSystem.pushMatrix(); RenderSystem.scaled(0.6, 0.6, 1); - drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getEnergy()) + "/" - + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getMaxPower()) + " " - + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer); + Text text = new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getEnergy())) + .append("/") + .append(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getMaxPower())) + .append(" ") + .append(PowerSystem.getDisplayPower().abbreviation); + + drawCentredText(matrixStack, text, 35, 0, 58, layer); RenderSystem.popMatrix(); } - builder.drawMultiEnergyBar(this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(matrixStack, this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } public void onClick(int amount){ diff --git a/src/main/java/techreborn/client/gui/GuiAlloyFurnace.java b/src/main/java/techreborn/client/gui/GuiAlloyFurnace.java index 415838209..ff3dd9484 100644 --- a/src/main/java/techreborn/client/gui/GuiAlloyFurnace.java +++ b/src/main/java/techreborn/client/gui/GuiAlloyFurnace.java @@ -24,6 +24,7 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -40,25 +41,25 @@ public class GuiAlloyFurnace extends GuiBase { } @Override - protected void drawBackground(float lastFrameDuration, int mouseX, int mouseY) { - super.drawBackground(lastFrameDuration, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, float lastFrameDuration, int mouseX, int mouseY) { + super.drawBackground(matrixStack, lastFrameDuration, mouseX, mouseY); GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; // Input slots - drawSlot(47, 17, layer); - drawSlot(65, 17, layer); + drawSlot(matrixStack, 47, 17, layer); + drawSlot(matrixStack, 65, 17, layer); // Fuel slot - drawSlot(56, 53, layer); + drawSlot(matrixStack, 56, 53, layer); - drawOutputSlot(116, 35, layer); + drawOutputSlot(matrixStack, 116, 35, layer); } @Override - protected void drawForeground(int mouseX, int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, int mouseX, int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 85, 36, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawBurnBar(this, blockEntity.getBurnTimeRemainingScaled(100), 100, 56, 36, mouseX, mouseY, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 85, 36, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawBurnBar(matrixStack, this, blockEntity.getBurnTimeRemainingScaled(100), 100, 56, 36, mouseX, mouseY, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiAlloySmelter.java b/src/main/java/techreborn/client/gui/GuiAlloySmelter.java index 99bd781b0..c0999c150 100644 --- a/src/main/java/techreborn/client/gui/GuiAlloySmelter.java +++ b/src/main/java/techreborn/client/gui/GuiAlloySmelter.java @@ -24,6 +24,7 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -41,26 +42,26 @@ public class GuiAlloySmelter extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); - drawSlot(34, 47, layer); - drawSlot(126, 47, layer); - drawOutputSlot(80, 47, layer); + drawSlot(matrixStack, 34, 47, layer); + drawSlot(matrixStack, 126, 47, layer); + drawOutputSlot(matrixStack, 80, 47, layer); - builder.drawJEIButton(this, 158, 5, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer); - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiAssemblingMachine.java b/src/main/java/techreborn/client/gui/GuiAssemblingMachine.java index 7fb6e0b43..fae08b617 100644 --- a/src/main/java/techreborn/client/gui/GuiAssemblingMachine.java +++ b/src/main/java/techreborn/client/gui/GuiAssemblingMachine.java @@ -24,6 +24,7 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -40,28 +41,28 @@ public class GuiAssemblingMachine extends GuiBase { } @Override - protected void drawBackground(final float partialTicks, final int mouseX, final int mouseY) { - super.drawBackground(partialTicks, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float partialTicks, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, partialTicks, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; // Battery slot - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); // Input slots - drawSlot(55, 35, layer); - drawSlot(55, 55, layer); + drawSlot(matrixStack, 55, 35, layer); + drawSlot(matrixStack, 55, 55, layer); - drawOutputSlot(101, 45, layer); + drawOutputSlot(matrixStack, 101, 45, layer); - builder.drawJEIButton(this, 158, 5, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiAutoCrafting.java b/src/main/java/techreborn/client/gui/GuiAutoCrafting.java index 665009a17..d8b357960 100644 --- a/src/main/java/techreborn/client/gui/GuiAutoCrafting.java +++ b/src/main/java/techreborn/client/gui/GuiAutoCrafting.java @@ -25,9 +25,11 @@ package techreborn.client.gui; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.recipe.CraftingRecipe; +import net.minecraft.text.LiteralText; import net.minecraft.util.Identifier; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -55,32 +57,32 @@ public class GuiAutoCrafting extends GuiBase { } @Override - protected void drawForeground(int mouseX, int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, int mouseX, int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); CraftingRecipe recipe = blockEntityAutoCraftingTable.getCurrentRecipe(); if (recipe != null) { renderItemStack(recipe.getOutput(), 95, 42); } final Layer layer = Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntityAutoCraftingTable.getProgress(), blockEntityAutoCraftingTable.getMaxProgress(), 120, 44, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawMultiEnergyBar(this, 9, 26, (int) blockEntityAutoCraftingTable.getEnergy(), (int) blockEntityAutoCraftingTable.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(matrixStack, this, blockEntityAutoCraftingTable.getProgress(), blockEntityAutoCraftingTable.getMaxProgress(), 120, 44, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 26, (int) blockEntityAutoCraftingTable.getEnergy(), (int) blockEntityAutoCraftingTable.getMaxPower(), mouseX, mouseY, 0, layer); } @Override - protected void drawBackground(final float f, int mouseX, int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, int mouseX, int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { - drawSlot(28 + (i * 18), 25 + (j * 18), layer); + drawSlot(matrixStack, 28 + (i * 18), 25 + (j * 18), layer); } } - drawOutputSlot(145, 42, layer); - drawOutputSlot(95, 42, layer); - drawString("Inventory", 8, 82, 4210752, layer); + drawOutputSlot(matrixStack, 145, 42, layer); + drawOutputSlot(matrixStack, 95, 42, layer); + method_27534(matrixStack, client.textRenderer, new LiteralText("Inventory"), 8, 82, 4210752); - builder.drawLockButton(this, 145, 4, mouseX, mouseY, layer, blockEntityAutoCraftingTable.locked); + builder.drawLockButton(matrixStack, this, 145, 4, mouseX, mouseY, layer, blockEntityAutoCraftingTable.locked); } @Override diff --git a/src/main/java/techreborn/client/gui/GuiBatbox.java b/src/main/java/techreborn/client/gui/GuiBatbox.java index 672f05e52..51ed632fe 100644 --- a/src/main/java/techreborn/client/gui/GuiBatbox.java +++ b/src/main/java/techreborn/client/gui/GuiBatbox.java @@ -25,7 +25,10 @@ package techreborn.client.gui; import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; import reborncore.common.powerSystem.PowerSystem; @@ -41,26 +44,33 @@ public class GuiBatbox extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - drawSlot(62, 45, layer); - drawSlot(98, 45, layer); + drawSlot(matrixStack, 62, 45, layer); + drawSlot(matrixStack, 98, 45, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final Layer layer = Layer.FOREGROUND; if(!hideGuiElements()){ RenderSystem.pushMatrix(); RenderSystem.scaled(0.6, 0.6, 5); - drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer); + Text text = new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getEnergy())) + .append("/") + .append(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getMaxPower())) + .append(" ") + .append(PowerSystem.getDisplayPower().abbreviation); + + drawCentredText(matrixStack, text, 35, 0, 58, layer); + RenderSystem.popMatrix(); } - builder.drawMultiEnergyBar(this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(matrixStack, this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiBlastFurnace.java b/src/main/java/techreborn/client/gui/GuiBlastFurnace.java index f94ebc28b..43cc8b46d 100644 --- a/src/main/java/techreborn/client/gui/GuiBlastFurnace.java +++ b/src/main/java/techreborn/client/gui/GuiBlastFurnace.java @@ -26,6 +26,7 @@ package techreborn.client.gui; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.block.BlockState; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -54,42 +55,42 @@ public class GuiBlastFurnace extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); this.hasMultiBlock = this.blockEntity.getCachedHeat() != 0; RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); final GuiBase.Layer layer = Layer.BACKGROUND; - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); - drawSlot(50, 27, layer); - drawSlot(50, 47, layer); - drawOutputSlotBar(92, 36, 2, layer); + drawSlot(matrixStack, 50, 27, layer); + drawSlot(matrixStack, 50, 47, layer); + drawOutputSlotBar(matrixStack, 92, 36, 2, layer); - builder.drawJEIButton(this, 158, 5, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); if (hasMultiBlock) { - builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer); + builder.drawHologramButton(matrixStack, this, 6, 4, mouseX, mouseY, layer); } } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); this.hasMultiBlock = blockEntity.getCachedHeat() != 0; final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 71, 40, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 71, 40, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawBigHeatBar(this, 31, 71, blockEntity.getCachedHeat(), 3230, layer); + builder.drawBigHeatBar(matrixStack, this, 31, 71, blockEntity.getCachedHeat(), 3230, layer); if (hasMultiBlock) { addHologramButton(4, 4, 212, layer).clickHandler(this::onClick); } else { - builder.drawMultiblockMissingBar(this, layer); + builder.drawMultiblockMissingBar(matrixStack, this, layer); addHologramButton(76, 56, 212, layer).clickHandler(this::onClick); - builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer); + builder.drawHologramButton(matrixStack, this, 76, 56, mouseX, mouseY, layer); } - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } public void onClick(GuiButtonExtended button, Double x, Double y){ diff --git a/src/main/java/techreborn/client/gui/GuiCentrifuge.java b/src/main/java/techreborn/client/gui/GuiCentrifuge.java index e7df370ba..176c54629 100644 --- a/src/main/java/techreborn/client/gui/GuiCentrifuge.java +++ b/src/main/java/techreborn/client/gui/GuiCentrifuge.java @@ -24,6 +24,7 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -40,29 +41,29 @@ public class GuiCentrifuge extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); - drawSlot(40, 34, layer); - drawSlot(40, 54, layer); + drawSlot(matrixStack, 40, 34, layer); + drawSlot(matrixStack, 40, 54, layer); - drawSlot(82, 44, layer); - drawSlot(101, 25, layer); - drawSlot(120, 44, layer); - drawSlot(101, 63, layer); + drawSlot(matrixStack, 82, 44, layer); + drawSlot(matrixStack, 101, 25, layer); + drawSlot(matrixStack, 120, 44, layer); + drawSlot(matrixStack, 101, 63, layer); - builder.drawJEIButton(this, 158, 5, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 61, 47, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 61, 47, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiChargeBench.java b/src/main/java/techreborn/client/gui/GuiChargeBench.java index b07b46953..ad99433e6 100644 --- a/src/main/java/techreborn/client/gui/GuiChargeBench.java +++ b/src/main/java/techreborn/client/gui/GuiChargeBench.java @@ -24,6 +24,7 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -39,23 +40,23 @@ public class GuiChargeBench extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - drawSlot(62, 25, layer); - drawSlot(98, 25, layer); - drawSlot(62, 45, layer); - drawSlot(98, 45, layer); - drawSlot(62, 65, layer); - drawSlot(98, 65, layer); + drawSlot(matrixStack, 62, 25, layer); + drawSlot(matrixStack, 98, 25, layer); + drawSlot(matrixStack, 62, 45, layer); + drawSlot(matrixStack, 98, 45, layer); + drawSlot(matrixStack, 62, 65, layer); + drawSlot(matrixStack, 98, 65, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - builder.drawMultiEnergyBar(this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(matrixStack, this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiChemicalReactor.java b/src/main/java/techreborn/client/gui/GuiChemicalReactor.java index 70cdee88f..f419ec0a4 100644 --- a/src/main/java/techreborn/client/gui/GuiChemicalReactor.java +++ b/src/main/java/techreborn/client/gui/GuiChemicalReactor.java @@ -24,6 +24,7 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -40,26 +41,26 @@ public class GuiChemicalReactor extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); - drawSlot(34, 47, layer); - drawSlot(126, 47, layer); - drawOutputSlot(80, 47, layer); + drawSlot(matrixStack, 34, 47, layer); + drawSlot(matrixStack, 126, 47, layer); + drawOutputSlot(matrixStack, 80, 47, layer); - builder.drawJEIButton(this, 158, 5, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer); - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiChunkLoader.java b/src/main/java/techreborn/client/gui/GuiChunkLoader.java index 022a47bec..9e3794936 100644 --- a/src/main/java/techreborn/client/gui/GuiChunkLoader.java +++ b/src/main/java/techreborn/client/gui/GuiChunkLoader.java @@ -24,7 +24,10 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; import reborncore.client.ClientChunkManager; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -51,18 +54,19 @@ public class GuiChunkLoader extends GuiBase { addButton(new GuiButtonUpDown(x + 64 + 24, y + 40, this, b -> onClick(-1), UpDownButtonType.REWIND)); addButton(new GuiButtonUpDown(x + 64 + 36, y + 40, this, b -> onClick(-5), UpDownButtonType.FASTREWIND)); - addButton(new GuiButtonSimple(x + 10, y + 70, 155, 20, "Toggle Loaded Chunks", b -> ClientChunkManager.toggleLoadedChunks(blockEntity.getPos()))); + addButton(new GuiButtonSimple(x + 10, y + 70, 155, 20, new LiteralText("Toggle Loaded Chunks"), b -> ClientChunkManager.toggleLoadedChunks(blockEntity.getPos()))); } @Override - protected void drawBackground(float partialTicks, int mouseX, int mouseY) { - super.drawBackground(partialTicks, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) { + super.drawBackground(matrixStack, partialTicks, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; if (hideGuiElements()) return; - String text = "Radius: " + blockEntity.getRadius(); - drawCentredString(text, 25, 4210752, layer); + Text text = new LiteralText("Radius: ") + .append(String.valueOf(blockEntity.getRadius())); + drawCentredText(matrixStack, text, 25, 4210752, layer); } public void onClick(int amount){ diff --git a/src/main/java/techreborn/client/gui/GuiCompressor.java b/src/main/java/techreborn/client/gui/GuiCompressor.java index 40d8257a4..c5e50803d 100644 --- a/src/main/java/techreborn/client/gui/GuiCompressor.java +++ b/src/main/java/techreborn/client/gui/GuiCompressor.java @@ -24,6 +24,7 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -40,24 +41,24 @@ public class GuiCompressor extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); - drawSlot(55, 45, layer); - drawOutputSlot(101, 45, layer); + drawSlot(matrixStack, 55, 45, layer); + drawOutputSlot(matrixStack, 101, 45, layer); - builder.drawJEIButton(this, 158, 5, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - this.builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + this.builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + this.builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiDieselGenerator.java b/src/main/java/techreborn/client/gui/GuiDieselGenerator.java index b8b398d58..f45ad353f 100644 --- a/src/main/java/techreborn/client/gui/GuiDieselGenerator.java +++ b/src/main/java/techreborn/client/gui/GuiDieselGenerator.java @@ -26,6 +26,7 @@ package techreborn.client.gui; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -43,23 +44,23 @@ public class GuiDieselGenerator extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - drawSlot(25, 35, layer); - drawSlot(25, 55, layer); - builder.drawJEIButton(this, 158, 5, layer); + drawSlot(matrixStack, 25, 35, layer); + drawSlot(matrixStack, 25, 55, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawMultiEnergyBar(this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); - builder.drawTank(this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(matrixStack, this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawTank(matrixStack, this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer); } diff --git a/src/main/java/techreborn/client/gui/GuiDistillationTower.java b/src/main/java/techreborn/client/gui/GuiDistillationTower.java index 25d94b6b7..e4444d922 100644 --- a/src/main/java/techreborn/client/gui/GuiDistillationTower.java +++ b/src/main/java/techreborn/client/gui/GuiDistillationTower.java @@ -26,6 +26,7 @@ package techreborn.client.gui; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.block.BlockState; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -47,37 +48,37 @@ public class GuiDistillationTower extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); final GuiBase.Layer layer = Layer.BACKGROUND; // Battery slot - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); // Input slots - drawSlot(35, 27, layer); - drawSlot(35, 47, layer); + drawSlot(matrixStack, 35, 27, layer); + drawSlot(matrixStack, 35, 47, layer); // Four output slots - drawOutputSlotBar(78, 36, 4, layer); + drawOutputSlotBar(matrixStack, 78, 36, 4, layer); // JEI Button - builder.drawJEIButton(this, 158, 5, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 55, 40, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 55, 40, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); if (blockEntity.getMutliBlock()) { addHologramButton(6, 4, 212, layer).clickHandler(this::onClick); - builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer); + builder.drawHologramButton(matrixStack, this, 6, 4, mouseX, mouseY, layer); } else { - builder.drawMultiblockMissingBar(this, layer); + builder.drawMultiblockMissingBar(matrixStack, this, layer); addHologramButton(76, 56, 212, layer).clickHandler(this::onClick); - builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer); + builder.drawHologramButton(matrixStack, this, 76, 56, mouseX, mouseY, layer); } - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } diff --git a/src/main/java/techreborn/client/gui/GuiElectricFurnace.java b/src/main/java/techreborn/client/gui/GuiElectricFurnace.java index 47980ff4a..2b8ed4e22 100644 --- a/src/main/java/techreborn/client/gui/GuiElectricFurnace.java +++ b/src/main/java/techreborn/client/gui/GuiElectricFurnace.java @@ -24,6 +24,7 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -40,24 +41,24 @@ public class GuiElectricFurnace extends GuiBase { } @Override - protected void drawBackground(float partialTicks, int mouseX, int mouseY) { - super.drawBackground(partialTicks, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) { + super.drawBackground(matrixStack, partialTicks, mouseX, mouseY); Layer layer = Layer.BACKGROUND; - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); - drawSlot(55, 45, layer); - drawOutputSlot(101, 45, layer); + drawSlot(matrixStack, 55, 45, layer); + drawOutputSlot(matrixStack, 101, 45, layer); - builder.drawJEIButton(this, 158, 5, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); } @Override - protected void drawForeground(int mouseX, int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, int mouseX, int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); Layer layer = Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiExtractor.java b/src/main/java/techreborn/client/gui/GuiExtractor.java index 602162527..1c7f4837c 100644 --- a/src/main/java/techreborn/client/gui/GuiExtractor.java +++ b/src/main/java/techreborn/client/gui/GuiExtractor.java @@ -24,6 +24,7 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -40,24 +41,24 @@ public class GuiExtractor extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); - drawSlot(55, 45, layer); - drawOutputSlot(101, 45, layer); + drawSlot(matrixStack, 55, 45, layer); + drawOutputSlot(matrixStack, 101, 45, layer); - builder.drawJEIButton(this, 158, 5, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiFluidReplicator.java b/src/main/java/techreborn/client/gui/GuiFluidReplicator.java index 17855c5b8..bed2c66d2 100644 --- a/src/main/java/techreborn/client/gui/GuiFluidReplicator.java +++ b/src/main/java/techreborn/client/gui/GuiFluidReplicator.java @@ -25,6 +25,7 @@ package techreborn.client.gui; import net.minecraft.block.BlockState; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -50,39 +51,39 @@ public class GuiFluidReplicator extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; // Battery slot - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); // Input slot - drawSlot(55, 45, layer); + drawSlot(matrixStack, 55, 45, layer); // Liquid input slot - drawSlot(124, 35, layer); + drawSlot(matrixStack, 124, 35, layer); // Liquid output slot - drawSlot(124, 55, layer); + drawSlot(matrixStack, 124, 55, layer); // JEI button - builder.drawJEIButton(this, 158, 5, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); if (blockEntity.getMultiBlock()) { - builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer); + builder.drawHologramButton(matrixStack, this, 6, 4, mouseX, mouseY, layer); } } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawTank(this, 99, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer); - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawTank(matrixStack, this, 99, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); if (blockEntity.getMultiBlock()) { addHologramButton(6, 4, 212, layer).clickHandler(this::onClick); } else { - builder.drawMultiblockMissingBar(this, layer); + builder.drawMultiblockMissingBar(matrixStack, this, layer); addHologramButton(76, 56, 212, layer).clickHandler(this::onClick); - builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer); + builder.drawHologramButton(matrixStack, this, 76, 56, mouseX, mouseY, layer); } - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } // GuiScreen diff --git a/src/main/java/techreborn/client/gui/GuiFusionReactor.java b/src/main/java/techreborn/client/gui/GuiFusionReactor.java index 21990e84e..a1dc42600 100644 --- a/src/main/java/techreborn/client/gui/GuiFusionReactor.java +++ b/src/main/java/techreborn/client/gui/GuiFusionReactor.java @@ -26,7 +26,10 @@ package techreborn.client.gui; import net.minecraft.block.BlockState; import net.minecraft.client.gui.widget.ButtonWidget; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; import net.minecraft.util.math.BlockPos; import org.apache.commons.lang3.tuple.Pair; import reborncore.client.screen.builder.BuiltScreenHandler; @@ -65,53 +68,59 @@ public class GuiFusionReactor extends GuiBase { } @Override - protected void drawBackground(final float partialTicks, final int mouseX, final int mouseY) { - super.drawBackground(partialTicks, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float partialTicks, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, partialTicks, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - drawSlot(34, 47, layer); - drawSlot(126, 47, layer); - drawOutputSlot(80, 47, layer); + drawSlot(matrixStack, 34, 47, layer); + drawSlot(matrixStack, 126, 47, layer); + drawOutputSlot(matrixStack, 80, 47, layer); - builder.drawJEIButton(this, 158, 5, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); if (blockEntity.getCoilStatus() > 0) { - builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer); + builder.drawHologramButton(matrixStack, this, 6, 4, mouseX, mouseY, layer); } } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer); if (blockEntity.getCoilStatus() > 0) { addHologramButton(6, 4, 212, layer).clickHandler(this::hologramToggle); - drawCentredString(blockEntity.getStateString(), 20, Color.BLUE.darker().getColor(), layer); + drawCentredText(matrixStack, blockEntity.getStateText(), 20, Color.BLUE.darker().getColor(), layer); if(blockEntity.state == 2){ - drawCentredString( PowerSystem.getLocaliszedPowerFormatted((int) blockEntity.getPowerChange()) + "/t", 30, Color.GREEN.darker().getColor(), layer); + drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocaliszedPowerFormatted((int) blockEntity.getPowerChange())).append("/t"), 30, Color.GREEN.darker().getColor(), layer); } } else { - builder.drawMultiblockMissingBar(this, layer); + builder.drawMultiblockMissingBar(matrixStack, this, layer); addHologramButton(76, 56, 212, layer).clickHandler(this::hologramToggle); - builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer); + builder.drawHologramButton(matrixStack, this, 76, 56, mouseX, mouseY, layer); Optional> stackSize = getCoilStackCount(); if(stackSize.isPresent()){ if(stackSize.get().getLeft() > 0){ - drawCentredString("Required Coils: " + stackSize.get().getLeft() + "x64 +" + stackSize.get().getRight(), 25, 0xFFFFFF, layer); + + drawCentredText(matrixStack, + new LiteralText("Required Coils: ") + .append(String.valueOf(stackSize.get().getLeft())) + .append("x64 +") + .append(String.valueOf(stackSize.get().getRight())) + , 25, 0xFFFFFF, layer); } else { - drawCentredString("Required Coils: " + stackSize.get().getRight(), 25, 0xFFFFFF, layer); + drawCentredText(matrixStack, new LiteralText("Required Coils: ").append(String.valueOf(stackSize.get().getRight())), 25, 0xFFFFFF, layer); } } } - drawString("Size: " + blockEntity.size, 83, 81, 0xFFFFFF, layer); - drawString("" + blockEntity.getPowerMultiplier() + "x", 10, 81, 0xFFFFFF, layer); + method_27535(matrixStack, client.textRenderer, new LiteralText("Size: ").append(String.valueOf(blockEntity.size)), 83, 81, 0xFFFFFF); + method_27535(matrixStack, client.textRenderer,new LiteralText(String.valueOf(blockEntity.getPowerMultiplier())).append("x"), 10, 81, 0xFFFFFF); - builder.drawMultiEnergyBar(this, 9, 19, (int) this.blockEntity.getEnergy(), (int) this.blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) this.blockEntity.getEnergy(), (int) this.blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } public void hologramToggle(GuiButtonExtended button, double x, double y){ diff --git a/src/main/java/techreborn/client/gui/GuiGasTurbine.java b/src/main/java/techreborn/client/gui/GuiGasTurbine.java index 8089c012c..858ed33b7 100644 --- a/src/main/java/techreborn/client/gui/GuiGasTurbine.java +++ b/src/main/java/techreborn/client/gui/GuiGasTurbine.java @@ -24,6 +24,7 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -40,23 +41,23 @@ public class GuiGasTurbine extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - drawSlot(25, 35, layer); - drawSlot(25, 55, layer); - builder.drawJEIButton(this, 158, 5, layer); + drawSlot(matrixStack, 25, 35, layer); + drawSlot(matrixStack, 25, 55, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawMultiEnergyBar(this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); - builder.drawTank(this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(matrixStack, this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawTank(matrixStack, this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiGenerator.java b/src/main/java/techreborn/client/gui/GuiGenerator.java index 0f451dc23..06194747c 100644 --- a/src/main/java/techreborn/client/gui/GuiGenerator.java +++ b/src/main/java/techreborn/client/gui/GuiGenerator.java @@ -24,6 +24,7 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -39,23 +40,23 @@ public class GuiGenerator extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); - drawSlot(80, 54, layer); + drawSlot(matrixStack, 80, 54, layer); - builder.drawJEIButton(this, 158, 5, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - builder.drawBurnBar(this, blockEntity.getScaledBurnTime(100), 100, 81, 38, mouseX, mouseY, layer); - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawBurnBar(matrixStack, this, blockEntity.getScaledBurnTime(100), 100, 81, 38, mouseX, mouseY, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiGreenhouseController.java b/src/main/java/techreborn/client/gui/GuiGreenhouseController.java index 22e037264..6e2ed10a7 100644 --- a/src/main/java/techreborn/client/gui/GuiGreenhouseController.java +++ b/src/main/java/techreborn/client/gui/GuiGreenhouseController.java @@ -27,8 +27,12 @@ package techreborn.client.gui; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.state.property.Properties; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; +import net.minecraft.text.TranslatableText; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -42,6 +46,8 @@ import techreborn.init.TRContent; import java.util.Arrays; import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; public class GuiGreenhouseController extends GuiBase { @@ -53,27 +59,31 @@ public class GuiGreenhouseController extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); int gridYPos = 22; - drawSlot(30, gridYPos, layer); - drawSlot(48, gridYPos, layer); - drawSlot(30, gridYPos + 18, layer); - drawSlot(48, gridYPos + 18, layer); - drawSlot(30, gridYPos + 36, layer); - drawSlot(48, gridYPos + 36, layer); + drawSlot(matrixStack, 30, gridYPos, layer); + drawSlot(matrixStack, 48, gridYPos, layer); + drawSlot(matrixStack, 30, gridYPos + 18, layer); + drawSlot(matrixStack, 48, gridYPos + 18, layer); + drawSlot(matrixStack, 30, gridYPos + 36, layer); + drawSlot(matrixStack, 48, gridYPos + 36, layer); if (!blockEntity.getMultiBlock()) { getMinecraft().getTextureManager().bindTexture(new Identifier("techreborn", "textures/item/part/digital_display.png")); - drawTexture(x + 68, y + 22, 0, 0, 16, 16, 16, 16); + drawTexture(matrixStack, x + 68, y + 22, 0, 0, 16, 16, 16, 16); if (isPointInRect(68, 22, 16, 16, mouseX, mouseY)) { - List list = Arrays.asList(StringUtils.t("techreborn.tooltip.greenhouse.upgrade_available").split("\\r?\\n")); + List list = Arrays.stream(new TranslatableText("techreborn.tooltip.greenhouse.upgrade_available").asString() + .split("\\r?\\n")) + .map(LiteralText::new) + .collect(Collectors.toList()); + RenderSystem.pushMatrix(); - renderTooltip(list, mouseX, mouseY); + renderTooltip(matrixStack, list, mouseX, mouseY); RenderSystem.popMatrix(); } } @@ -81,23 +91,27 @@ public class GuiGreenhouseController extends GuiBase { } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; addHologramButton(90, 24, 212, layer).clickHandler(this::onClick); - builder.drawHologramButton(this, 90, 24, mouseX, mouseY, layer); + builder.drawHologramButton(matrixStack, this, 90, 24, mouseX, mouseY, layer); if (!blockEntity.getMultiBlock()) { if (isPointInRect(68, 22, 16, 16, mouseX, mouseY)) { - List list = Arrays.asList(StringUtils.t("techreborn.tooltip.greenhouse.upgrade_available").split("\\r?\\n")); + List list = Arrays.stream(new TranslatableText("techreborn.tooltip.greenhouse.upgrade_available").asString() + .split("\\r?\\n")) + .map(LiteralText::new) + .collect(Collectors.toList()); + RenderSystem.pushMatrix(); - renderTooltip(list, mouseX - getGuiLeft(), mouseY - getGuiTop()); + renderTooltip(matrixStack, list, mouseX - getGuiLeft(), mouseY - getGuiTop()); RenderSystem.popMatrix(); } } - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } public void onClick(GuiButtonExtended button, Double x, Double y) { diff --git a/src/main/java/techreborn/client/gui/GuiIDSU.java b/src/main/java/techreborn/client/gui/GuiIDSU.java index 2177ffbdb..286cd768d 100644 --- a/src/main/java/techreborn/client/gui/GuiIDSU.java +++ b/src/main/java/techreborn/client/gui/GuiIDSU.java @@ -25,7 +25,10 @@ package techreborn.client.gui; import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; import reborncore.common.powerSystem.PowerSystem; @@ -41,26 +44,33 @@ public class GuiIDSU extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - drawSlot(62, 45, layer); - drawSlot(98, 45, layer); - drawArmourSlots(8, 18, layer); + drawSlot(matrixStack, 62, 45, layer); + drawSlot(matrixStack, 98, 45, layer); + drawArmourSlots(matrixStack, 8, 18, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final Layer layer = Layer.FOREGROUND; RenderSystem.pushMatrix(); RenderSystem.scaled(0.6, 0.6, 1); - drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) idsu.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) idsu.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer); + + Text text = new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) idsu.getEnergy())) + .append("/") + .append(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) idsu.getMaxPower())) + .append(" ") + .append(PowerSystem.getDisplayPower().abbreviation); + + drawCentredText(matrixStack, text, 35, 0, 58, layer); RenderSystem.popMatrix(); - builder.drawMultiEnergyBar(this, 81, 28, (int) idsu.getEnergy(), (int) idsu.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(matrixStack, this, 81, 28, (int) idsu.getEnergy(), (int) idsu.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java b/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java index e8b6a0545..8841cae6c 100644 --- a/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java +++ b/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java @@ -26,6 +26,7 @@ package techreborn.client.gui; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.block.BlockState; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.math.BlockPos; import reborncore.client.screen.builder.BuiltScreenHandler; @@ -46,40 +47,40 @@ public class GuiImplosionCompressor extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); final GuiBase.Layer layer = Layer.BACKGROUND; - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); - drawSlot(50, 27, layer); - drawSlot(50, 47, layer); - drawSlot(92, 36, layer); - drawSlot(110, 36, layer); + drawSlot(matrixStack, 50, 27, layer); + drawSlot(matrixStack, 50, 47, layer); + drawSlot(matrixStack, 92, 36, layer); + drawSlot(matrixStack, 110, 36, layer); if (blockEntity.getMutliBlock()) { - builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer); + builder.drawHologramButton(matrixStack, this, 6, 4, mouseX, mouseY, layer); } - builder.drawJEIButton(this, 158, 5, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 71, 40, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 71, 40, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); if (blockEntity.getMutliBlock()) { addHologramButton(6, 4, 212, layer).clickHandler(this::onClick); } else { - builder.drawMultiblockMissingBar(this, layer); + builder.drawMultiblockMissingBar(matrixStack, this, layer); addHologramButton(76, 56, 212, layer).clickHandler(this::onClick); - builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer); + builder.drawHologramButton(matrixStack, this, 76, 56, mouseX, mouseY, layer); } - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } diff --git a/src/main/java/techreborn/client/gui/GuiIndustrialElectrolyzer.java b/src/main/java/techreborn/client/gui/GuiIndustrialElectrolyzer.java index 4b6ad19e2..0cf606c62 100644 --- a/src/main/java/techreborn/client/gui/GuiIndustrialElectrolyzer.java +++ b/src/main/java/techreborn/client/gui/GuiIndustrialElectrolyzer.java @@ -24,6 +24,7 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -40,27 +41,27 @@ public class GuiIndustrialElectrolyzer extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; //Battery slot - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); //Input slots - drawSlot(47, 72, layer); - drawSlot(81, 72, layer); + drawSlot(matrixStack, 47, 72, layer); + drawSlot(matrixStack, 81, 72, layer); //Output slots - drawOutputSlotBar(50, 23, 4, layer); - builder.drawJEIButton(this, 158, 5, layer); + drawOutputSlotBar(matrixStack, 50, 23, 4, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 84, 52, mouseX, mouseY, GuiBuilder.ProgressDirection.UP, layer); - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 84, 52, mouseX, mouseY, GuiBuilder.ProgressDirection.UP, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } diff --git a/src/main/java/techreborn/client/gui/GuiIndustrialGrinder.java b/src/main/java/techreborn/client/gui/GuiIndustrialGrinder.java index f448e1bcf..8c6079764 100644 --- a/src/main/java/techreborn/client/gui/GuiIndustrialGrinder.java +++ b/src/main/java/techreborn/client/gui/GuiIndustrialGrinder.java @@ -26,6 +26,7 @@ package techreborn.client.gui; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -47,45 +48,45 @@ public class GuiIndustrialGrinder extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; // Battery slot - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); // Liquid input slot - drawSlot(34, 35, layer); + drawSlot(matrixStack, 34, 35, layer); // Liquid output slot - drawSlot(34, 55, layer); + drawSlot(matrixStack, 34, 55, layer); // Solid material input slot - drawSlot(84, 43, layer); + drawSlot(matrixStack, 84, 43, layer); // Output slots - drawSlot(126, 18, layer); - drawSlot(126, 36, layer); - drawSlot(126, 54, layer); - drawSlot(126, 72, layer); + drawSlot(matrixStack, 126, 18, layer); + drawSlot(matrixStack, 126, 36, layer); + drawSlot(matrixStack, 126, 54, layer); + drawSlot(matrixStack, 126, 72, layer); - builder.drawJEIButton(this, 158, 5, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); if (blockEntity.getMultiBlock()) { - builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer); + builder.drawHologramButton(matrixStack, this, 6, 4, mouseX, mouseY, layer); } } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawTank(this, 53, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawTank(matrixStack, this, 53, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer); if (blockEntity.getMultiBlock()) { addHologramButton(6, 4, 212, layer).clickHandler(this::onClick); } else { - builder.drawMultiblockMissingBar(this, layer); + builder.drawMultiblockMissingBar(matrixStack, this, layer); addHologramButton(76, 56, 212, layer).clickHandler(this::onClick); - builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer); + builder.drawHologramButton(matrixStack, this, 76, 56, mouseX, mouseY, layer); } - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } public void onClick(GuiButtonExtended button, double mouseX, double mouseY){ diff --git a/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java b/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java index 129063985..201a959ac 100644 --- a/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java +++ b/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java @@ -26,6 +26,7 @@ package techreborn.client.gui; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -53,44 +54,44 @@ public class GuiIndustrialSawmill extends GuiBase { } @Override - protected void drawBackground(final float partialTicks, final int mouseX, final int mouseY) { - super.drawBackground(partialTicks, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float partialTicks, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, partialTicks, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; // Battery slot - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); // Liquid input slot - drawSlot(34, 35, layer); + drawSlot(matrixStack, 34, 35, layer); // Liquid output slot - drawSlot(34, 55, layer); + drawSlot(matrixStack, 34, 55, layer); // Solid material input slot - drawSlot(84, 43, layer); + drawSlot(matrixStack, 84, 43, layer); // Output slots - drawSlot(126, 25, layer); - drawSlot(126, 43, layer); - drawSlot(126, 61, layer); + drawSlot(matrixStack, 126, 25, layer); + drawSlot(matrixStack, 126, 43, layer); + drawSlot(matrixStack, 126, 61, layer); - builder.drawJEIButton(this, 158, 5, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); if (blockEntity.getMutliBlock()) { - builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer); + builder.drawHologramButton(matrixStack, this, 6, 4, mouseX, mouseY, layer); } } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawTank(this, 53, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawTank(matrixStack, this, 53, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer); if (blockEntity.getMutliBlock()) { addHologramButton(6, 4, 212, layer).clickHandler(this::onClick); } else { - builder.drawMultiblockMissingBar(this, layer); + builder.drawMultiblockMissingBar(matrixStack, this, layer); addHologramButton(76, 56, 212, layer).clickHandler(this::onClick); - builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer); + builder.drawHologramButton(matrixStack, this, 76, 56, mouseX, mouseY, layer); } - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){ diff --git a/src/main/java/techreborn/client/gui/GuiIronFurnace.java b/src/main/java/techreborn/client/gui/GuiIronFurnace.java index adb7fcee1..8b004571f 100644 --- a/src/main/java/techreborn/client/gui/GuiIronFurnace.java +++ b/src/main/java/techreborn/client/gui/GuiIronFurnace.java @@ -30,9 +30,12 @@ import java.util.List; import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.widget.GuiButtonSimple; @@ -58,10 +61,10 @@ public class GuiIronFurnace extends GuiBase { @Override public void init() { super.init(); - addButton(new GuiButtonSimple(getGuiLeft() + 116, getGuiTop() + 57, 18, 18, "", b -> onClick()) { + addButton(new GuiButtonSimple(getGuiLeft() + 116, getGuiTop() + 57, 18, 18, LiteralText.EMPTY, b -> onClick()) { @Override - public void renderToolTip(int mouseX, int mouseY) { + public void renderToolTip(MatrixStack matrixStack, int mouseX, int mouseY) { PlayerEntity player = playerInventory.player; if (player == null) { return; @@ -89,40 +92,40 @@ public class GuiIronFurnace extends GuiBase { } } - List list = new ArrayList<>(); - list.add(message); - renderTooltip(list, mouseX, mouseY); + List list = new ArrayList<>(); + list.add(new LiteralText(message)); + renderTooltip(matrixStack, list, mouseX, mouseY); GlStateManager.disableLighting(); GlStateManager.color4f(1, 1, 1, 1); } @Override - public void renderBg(MinecraftClient mc, int mouseX, int mouseY) { + public void renderBg(MatrixStack matrixStack, MinecraftClient mc, int mouseX, int mouseY) { mc.getItemRenderer().renderGuiItem(new ItemStack(Items.EXPERIENCE_BOTTLE), x, y); } }); } @Override - protected void drawBackground(float lastFrameDuration, int mouseX, int mouseY) { - super.drawBackground(lastFrameDuration, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, float lastFrameDuration, int mouseX, int mouseY) { + super.drawBackground(matrixStack, lastFrameDuration, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; // Input slot - drawSlot(56, 17, layer); + drawSlot(matrixStack, 56, 17, layer); // Fuel slot - drawSlot(56, 53, layer); + drawSlot(matrixStack, 56, 53, layer); - drawOutputSlot(116, 35, layer); + drawOutputSlot(matrixStack, 116, 35, layer); } @Override - protected void drawForeground(int mouseX, int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, int mouseX, int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 85, 36, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawBurnBar(this, blockEntity.getBurnTimeRemainingScaled(100), 100, 56, 36, mouseX, mouseY, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 85, 36, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawBurnBar(matrixStack, this, blockEntity.getBurnTimeRemainingScaled(100), 100, 56, 36, mouseX, mouseY, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiLESU.java b/src/main/java/techreborn/client/gui/GuiLESU.java index 3458890ac..b460a9083 100644 --- a/src/main/java/techreborn/client/gui/GuiLESU.java +++ b/src/main/java/techreborn/client/gui/GuiLESU.java @@ -25,7 +25,9 @@ package techreborn.client.gui; import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.text.LiteralText; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; import reborncore.common.powerSystem.PowerSystem; @@ -41,27 +43,27 @@ public class GuiLESU extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - drawSlot(62, 45, layer); - drawSlot(98, 45, layer); - drawArmourSlots(8, 18, layer); + drawSlot(matrixStack, 62, 45, layer); + drawSlot(matrixStack, 98, 45, layer); + drawArmourSlots(matrixStack, 8, 18, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final Layer layer = Layer.FOREGROUND; RenderSystem.pushMatrix(); RenderSystem.scaled(0.6, 0.6, 1); - drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getEnergy()) + "/" + drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getMaxPower()) + " " - + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer); + + PowerSystem.getDisplayPower().abbreviation), 35, 0, 58, layer); RenderSystem.popMatrix(); - builder.drawMultiEnergyBar(this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(matrixStack, this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiMFE.java b/src/main/java/techreborn/client/gui/GuiMFE.java index 083b01648..75e8451a7 100644 --- a/src/main/java/techreborn/client/gui/GuiMFE.java +++ b/src/main/java/techreborn/client/gui/GuiMFE.java @@ -25,7 +25,9 @@ package techreborn.client.gui; import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.text.LiteralText; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; import reborncore.common.powerSystem.PowerSystem; @@ -41,27 +43,34 @@ public class GuiMFE extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - drawSlot(62, 45, layer); - drawSlot(98, 45, layer); - drawArmourSlots(8, 18, layer); + drawSlot(matrixStack, 62, 45, layer); + drawSlot(matrixStack, 98, 45, layer); + drawArmourSlots(matrixStack, 8, 18, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final Layer layer = Layer.FOREGROUND; if(!hideGuiElements()){ RenderSystem.pushMatrix(); RenderSystem.scaled(0.6, 0.6, 1); - drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfe.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfe.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer); + + drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfe.getEnergy())) + .append("/") + .append(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfe.getMaxPower())) + .append(" ") + .append(PowerSystem.getDisplayPower().abbreviation) + , 35, 0, 58, layer); + RenderSystem.popMatrix(); } - builder.drawMultiEnergyBar(this, 81, 28, (int) mfe.getEnergy(), (int) mfe.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(matrixStack, this, 81, 28, (int) mfe.getEnergy(), (int) mfe.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiMFSU.java b/src/main/java/techreborn/client/gui/GuiMFSU.java index 99b9b617c..4c3954c2d 100644 --- a/src/main/java/techreborn/client/gui/GuiMFSU.java +++ b/src/main/java/techreborn/client/gui/GuiMFSU.java @@ -25,7 +25,9 @@ package techreborn.client.gui; import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.text.LiteralText; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; import reborncore.common.powerSystem.PowerSystem; @@ -41,25 +43,25 @@ public class GuiMFSU extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - drawSlot(62, 45, layer); - drawSlot(98, 45, layer); - drawArmourSlots(8, 18, layer); + drawSlot(matrixStack, 62, 45, layer); + drawSlot(matrixStack, 98, 45, layer); + drawArmourSlots(matrixStack, 8, 18, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final Layer layer = Layer.FOREGROUND; RenderSystem.pushMatrix(); RenderSystem.scaled(0.6, 0.6, 1); - drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfsu.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfsu.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer); + drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfsu.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfsu.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation), 35, 0, 58, layer); RenderSystem.popMatrix(); - builder.drawMultiEnergyBar(this, 81, 28, (int) mfsu.getEnergy(), (int) mfsu.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(matrixStack, this, 81, 28, (int) mfsu.getEnergy(), (int) mfsu.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiManual.java b/src/main/java/techreborn/client/gui/GuiManual.java index 8de2afe67..63f771489 100644 --- a/src/main/java/techreborn/client/gui/GuiManual.java +++ b/src/main/java/techreborn/client/gui/GuiManual.java @@ -26,6 +26,9 @@ package techreborn.client.gui; import net.minecraft.client.gui.screen.ConfirmChatLinkScreen; import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.text.Text; +import net.minecraft.text.TranslatableText; import reborncore.common.util.StringUtils; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.text.LiteralText; @@ -45,9 +48,9 @@ public class GuiManual extends Screen { private static final Identifier texture = new Identifier("techreborn", "textures/gui/manual.png"); int guiWidth = 207; int guiHeight = 195; - private static final String text1 = StringUtils.t("techreborn.manual.wiki"); - private static final String text2 = StringUtils.t("techreborn.manual.discord"); - private static final String text3 = StringUtils.t("techreborn.manual.refund"); + private static final Text text1 = new TranslatableText("techreborn.manual.wiki"); + private static final Text text2 = new TranslatableText("techreborn.manual.discord"); + private static final Text text3 = new TranslatableText("techreborn.manual.refund"); public GuiManual(PlayerEntity player) { super(new LiteralText("gui.manual")); @@ -58,7 +61,7 @@ public class GuiManual extends Screen { public void init() { int y = (height / 2) - guiHeight / 2; y+= 40; - addButton(new GuiButtonExtended((width / 2 - 30), y + 10, 60, 20, StringUtils.t("techreborn.manual.wikibtn"), var1 -> client.openScreen(new ConfirmChatLinkScreen(t -> { + addButton(new GuiButtonExtended((width / 2 - 30), y + 10, 60, 20, new TranslatableText("techreborn.manual.wikibtn"), var1 -> client.openScreen(new ConfirmChatLinkScreen(t -> { if(t){ Util.getOperatingSystem().open("http://wiki.techreborn.ovh"); this.client.openScreen(this); @@ -66,7 +69,7 @@ public class GuiManual extends Screen { this.client.openScreen(this); } }, "http://wiki.techreborn.ovh", false)))); - addButton(new GuiButtonExtended((width / 2 - 30), y + 60, 60, 20, StringUtils.t("techreborn.manual.discordbtn"), var1 -> client.openScreen(new ConfirmChatLinkScreen(t -> { + addButton(new GuiButtonExtended((width / 2 - 30), y + 60, 60, 20, new TranslatableText("techreborn.manual.discordbtn"), var1 -> client.openScreen(new ConfirmChatLinkScreen(t -> { if(t){ Util.getOperatingSystem().open("https://discord.gg/teamreborn"); this.client.openScreen(this); @@ -75,7 +78,7 @@ public class GuiManual extends Screen { } }, "https://discord.gg/teamreborn", false)))); if(TechRebornConfig.allowManualRefund){ - addButton(new GuiButtonExtended((width / 2 - 30), y + 110, 60, 20, StringUtils.t("techreborn.manual.refundbtn"), var1 -> { + addButton(new GuiButtonExtended((width / 2 - 30), y + 110, 60, 20, new TranslatableText("techreborn.manual.refundbtn"), var1 -> { NetworkManager.sendToServer(ServerboundPackets.createRefundPacket()); this.client.openScreen(null); })); @@ -83,18 +86,18 @@ public class GuiManual extends Screen { } @Override - public void render(int mouseX, int mouseY, float partialTicks) { - renderBackground(); + public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { + renderBackground(matrixStack); client.getTextureManager().bindTexture(GuiManual.texture); int centerX = (width / 2) - guiWidth / 2; int centerY = (height / 2) - guiHeight / 2; - drawTexture(centerX, centerY, 0, 0, guiWidth, guiHeight); - textRenderer.draw(text1, ((width / 2) - textRenderer.getStringWidth(text1) / 2), centerY + 40, 4210752); - textRenderer.draw(text2, ((width / 2) - textRenderer.getStringWidth(text2) / 2), centerY + 90, 4210752); + drawTexture(matrixStack, centerX, centerY, 0, 0, guiWidth, guiHeight); + textRenderer.draw(matrixStack, text1, ((width / 2) - textRenderer.getWidth(text1) / 2), centerY + 40, 4210752); + textRenderer.draw(matrixStack, text2, ((width / 2) - textRenderer.getWidth(text2) / 2), centerY + 90, 4210752); if (TechRebornConfig.allowManualRefund) { - textRenderer.draw(text3, ((width / 2) - textRenderer.getStringWidth(text3) / 2), centerY + 140, 4210752); + textRenderer.draw(matrixStack, text3, ((width / 2) - textRenderer.getWidth(text3) / 2), centerY + 140, 4210752); } - super.render(mouseX, mouseY, partialTicks); + super.render(matrixStack, mouseX, mouseY, partialTicks); } } diff --git a/src/main/java/techreborn/client/gui/GuiMatterFabricator.java b/src/main/java/techreborn/client/gui/GuiMatterFabricator.java index 60389f8f8..cf55de04f 100644 --- a/src/main/java/techreborn/client/gui/GuiMatterFabricator.java +++ b/src/main/java/techreborn/client/gui/GuiMatterFabricator.java @@ -24,6 +24,7 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -40,28 +41,28 @@ public class GuiMatterFabricator extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); - drawSlot(30, 20, layer); - drawSlot(50, 20, layer); - drawSlot(70, 20, layer); - drawSlot(90, 20, layer); - drawSlot(110, 20, layer); - drawSlot(130, 20, layer); - drawOutputSlotBar(39, 65, 5, layer); + drawSlot(matrixStack, 30, 20, layer); + drawSlot(matrixStack, 50, 20, layer); + drawSlot(matrixStack, 70, 20, layer); + drawSlot(matrixStack, 90, 20, layer); + drawSlot(matrixStack, 110, 20, layer); + drawSlot(matrixStack, 130, 20, layer); + drawOutputSlotBar(matrixStack, 39, 65, 5, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 83, 41, mouseX, mouseY, GuiBuilder.ProgressDirection.DOWN, layer); - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 83, 41, mouseX, mouseY, GuiBuilder.ProgressDirection.DOWN, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiPlasmaGenerator.java b/src/main/java/techreborn/client/gui/GuiPlasmaGenerator.java index 7b0b0f2ef..7fa1e3ee5 100644 --- a/src/main/java/techreborn/client/gui/GuiPlasmaGenerator.java +++ b/src/main/java/techreborn/client/gui/GuiPlasmaGenerator.java @@ -26,6 +26,7 @@ package techreborn.client.gui; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -52,23 +53,23 @@ public class GuiPlasmaGenerator extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - drawSlot(25, 35, layer); - drawSlot(25, 55, layer); - builder.drawJEIButton(this, 158, 5, layer); + drawSlot(matrixStack, 25, 35, layer); + drawSlot(matrixStack, 25, 55, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawMultiEnergyBar(this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); - builder.drawTank(this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(matrixStack, this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawTank(matrixStack, this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer); } diff --git a/src/main/java/techreborn/client/gui/GuiRecycler.java b/src/main/java/techreborn/client/gui/GuiRecycler.java index 904166bed..7eb4ab928 100644 --- a/src/main/java/techreborn/client/gui/GuiRecycler.java +++ b/src/main/java/techreborn/client/gui/GuiRecycler.java @@ -24,6 +24,7 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -40,22 +41,22 @@ public class GuiRecycler extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); - drawSlot(55, 45, layer); - drawOutputSlot(101, 45, layer); + drawSlot(matrixStack, 55, 45, layer); + drawOutputSlot(matrixStack, 101, 45, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.gaugeProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.gaugeProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiRollingMachine.java b/src/main/java/techreborn/client/gui/GuiRollingMachine.java index eafebe98b..6c10e61b4 100644 --- a/src/main/java/techreborn/client/gui/GuiRollingMachine.java +++ b/src/main/java/techreborn/client/gui/GuiRollingMachine.java @@ -24,6 +24,7 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -42,35 +43,35 @@ public class GuiRollingMachine extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; int gridYPos = 22; - drawSlot(30, gridYPos, layer); - drawSlot(48, gridYPos, layer); - drawSlot(66, gridYPos, layer); - drawSlot(30, gridYPos + 18, layer); - drawSlot(48, gridYPos + 18, layer); - drawSlot(66, gridYPos + 18, layer); - drawSlot(30, gridYPos + 36, layer); - drawSlot(48, gridYPos + 36, layer); - drawSlot(66, gridYPos + 36, layer); + drawSlot(matrixStack, 30, gridYPos, layer); + drawSlot(matrixStack, 48, gridYPos, layer); + drawSlot(matrixStack, 66, gridYPos, layer); + drawSlot(matrixStack, 30, gridYPos + 18, layer); + drawSlot(matrixStack, 48, gridYPos + 18, layer); + drawSlot(matrixStack, 66, gridYPos + 18, layer); + drawSlot(matrixStack, 30, gridYPos + 36, layer); + drawSlot(matrixStack, 48, gridYPos + 36, layer); + drawSlot(matrixStack, 66, gridYPos + 36, layer); - drawSlot(8, 70, layer); - drawOutputSlot(124, gridYPos + 18, layer); + drawSlot(matrixStack, 8, 70, layer); + drawOutputSlot(matrixStack, 124, gridYPos + 18, layer); - builder.drawJEIButton(this, 158, 5, layer); - builder.drawLockButton(this, 130, 4, mouseX, mouseY, layer,rollingMachine.locked); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); + builder.drawLockButton(matrixStack, this, 130, 4, mouseX, mouseY, layer,rollingMachine.locked); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawProgressBar(this, rollingMachine.getProgressScaled(100), 100, 92, 43, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawMultiEnergyBar(this, 9, 17, (int) rollingMachine.getEnergy(), (int) rollingMachine.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(matrixStack, this, rollingMachine.getProgressScaled(100), 100, 92, 43, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 17, (int) rollingMachine.getEnergy(), (int) rollingMachine.getMaxPower(), mouseX, mouseY, 0, layer); } @Override diff --git a/src/main/java/techreborn/client/gui/GuiScrapboxinator.java b/src/main/java/techreborn/client/gui/GuiScrapboxinator.java index b5c16d5be..a000e3a54 100644 --- a/src/main/java/techreborn/client/gui/GuiScrapboxinator.java +++ b/src/main/java/techreborn/client/gui/GuiScrapboxinator.java @@ -24,6 +24,7 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -40,26 +41,26 @@ public class GuiScrapboxinator extends GuiBase { } @Override - protected void drawBackground(float partialTicks, int mouseX, int mouseY) { - super.drawBackground(partialTicks, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) { + super.drawBackground(matrixStack, partialTicks, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; // Battery slot - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); // Scrapboxes input slot - drawSlot(55, 45, layer); + drawSlot(matrixStack, 55, 45, layer); // Output slot - drawOutputSlot(101, 45, layer); + drawOutputSlot(matrixStack, 101, 45, layer); - builder.drawJEIButton(this, 158, 5, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiSemifluidGenerator.java b/src/main/java/techreborn/client/gui/GuiSemifluidGenerator.java index 028c14b77..fca12680b 100644 --- a/src/main/java/techreborn/client/gui/GuiSemifluidGenerator.java +++ b/src/main/java/techreborn/client/gui/GuiSemifluidGenerator.java @@ -24,6 +24,7 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -40,23 +41,23 @@ public class GuiSemifluidGenerator extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - drawSlot(25, 35, layer); - drawSlot(25, 55, layer); - builder.drawJEIButton(this, 158, 5, layer); + drawSlot(matrixStack, 25, 35, layer); + drawSlot(matrixStack, 25, 55, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawMultiEnergyBar(this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); - builder.drawTank(this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(matrixStack, this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawTank(matrixStack, this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiSolar.java b/src/main/java/techreborn/client/gui/GuiSolar.java index e9ce50cfd..7e9294889 100644 --- a/src/main/java/techreborn/client/gui/GuiSolar.java +++ b/src/main/java/techreborn/client/gui/GuiSolar.java @@ -24,7 +24,10 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.text.LiteralText; +import net.minecraft.text.TranslatableText; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; import reborncore.common.util.StringUtils; @@ -40,31 +43,31 @@ public class GuiSolar extends GuiBase { } @Override - protected void drawBackground(float lastFrameDuration, int mouseX, int mouseY) { - super.drawBackground(lastFrameDuration, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, float lastFrameDuration, int mouseX, int mouseY) { + super.drawBackground(matrixStack, lastFrameDuration, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; } @Override - protected void drawForeground(int mouseX, int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, int mouseX, int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawMultiEnergyBar(this, 156, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(matrixStack, this, 156, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); switch (blockEntity.getSunState()) { case SolarPanelBlockEntity.DAYGEN: - builder.drawString(this, StringUtils.t("techreborn.message.daygen"), 10, 20, 15129632); + builder.drawText(matrixStack, this, new TranslatableText("techreborn.message.daygen"), 10, 20, 15129632); break; case SolarPanelBlockEntity.NIGHTGEN: - builder.drawString(this, StringUtils.t("techreborn.message.nightgen"), 10, 20, 7566195); + builder.drawText(matrixStack, this, new TranslatableText("techreborn.message.nightgen"), 10, 20, 7566195); break; case SolarPanelBlockEntity.ZEROGEN: - builder.drawString(this, StringUtils.t("techreborn.message.zerogen"), 10, 20, 12066591); + builder.drawText(matrixStack, this, new TranslatableText("techreborn.message.zerogen"), 10, 20, 12066591); break; } - builder.drawString(this, "Generating: " + blockEntity.getGenerationRate() + " E/t", 10, 30, 0); + builder.drawText(matrixStack, this, new LiteralText("Generating: " + blockEntity.getGenerationRate() + " E/t"), 10, 30, 0); } } diff --git a/src/main/java/techreborn/client/gui/GuiSolidCanningMachine.java b/src/main/java/techreborn/client/gui/GuiSolidCanningMachine.java index e67b83318..60795e7bd 100644 --- a/src/main/java/techreborn/client/gui/GuiSolidCanningMachine.java +++ b/src/main/java/techreborn/client/gui/GuiSolidCanningMachine.java @@ -24,6 +24,7 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -41,26 +42,26 @@ public class GuiSolidCanningMachine extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); - drawSlot(34, 47, layer); - drawSlot(126, 47, layer); - drawOutputSlot(80, 47, layer); + drawSlot(matrixStack, 34, 47, layer); + drawSlot(matrixStack, 126, 47, layer); + drawOutputSlot(matrixStack, 80, 47, layer); - builder.drawJEIButton(this, 158, 5, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer); - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiStorageUnit.java b/src/main/java/techreborn/client/gui/GuiStorageUnit.java index cd30a499a..bf816df2e 100644 --- a/src/main/java/techreborn/client/gui/GuiStorageUnit.java +++ b/src/main/java/techreborn/client/gui/GuiStorageUnit.java @@ -24,7 +24,9 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.text.TranslatableText; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; import reborncore.common.util.StringUtils; @@ -40,36 +42,36 @@ public class GuiStorageUnit extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - drawString(StringUtils.t("gui.techreborn.unit.in"), 100, 43, 4210752, layer); - drawSlot(100, 53, layer); + client.textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.unit.in"), 100, 43, 4210752); + drawSlot(matrixStack, 100, 53, layer); - drawString(StringUtils.t("gui.techreborn.unit.out"), 140, 43, 4210752, layer); - drawSlot(140, 53, layer); + client.textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.unit.out"), 140, 43, 4210752); + drawSlot(matrixStack, 140, 53, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); if (storageEntity.isEmpty()) { - textRenderer.draw(StringUtils.t("techreborn.tooltip.unit.empty"), 10, 20, 4210752); + textRenderer.draw(matrixStack, new TranslatableText("techreborn.tooltip.unit.empty"), 10, 20, 4210752); } else { - textRenderer.draw(StringUtils.t("gui.techreborn.storage.store"), 10, 20, 4210752); - textRenderer.draw(storageEntity.getStoredStack().getName().asString(), 10, 30, 4210752); + textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.storage.store"), 10, 20, 4210752); + textRenderer.draw(matrixStack, storageEntity.getStoredStack().getName().asString(), 10, 30, 4210752); - textRenderer.draw(StringUtils.t("gui.techreborn.storage.amount"), 10, 50, 4210752); - textRenderer.draw(String.valueOf(storageEntity.getCurrentCapacity()), 10, 60, 4210752); + textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.storage.amount"), 10, 50, 4210752); + textRenderer.draw(matrixStack, String.valueOf(storageEntity.getCurrentCapacity()), 10, 60, 4210752); String percentFilled = String.valueOf((int) ((double) storageEntity.getCurrentCapacity() / (double) storageEntity.getMaxCapacity() * 100)); - textRenderer.draw(StringUtils.t("gui.techreborn.unit.used") + percentFilled + "%", 10, 70, 4210752); + textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.unit.used") + percentFilled + "%", 10, 70, 4210752); - textRenderer.draw(StringUtils.t("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680); + textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680); } } } diff --git a/src/main/java/techreborn/client/gui/GuiTankUnit.java b/src/main/java/techreborn/client/gui/GuiTankUnit.java index c6aee0c3c..9a138dfe8 100644 --- a/src/main/java/techreborn/client/gui/GuiTankUnit.java +++ b/src/main/java/techreborn/client/gui/GuiTankUnit.java @@ -24,7 +24,9 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.text.TranslatableText; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; import reborncore.common.fluid.FluidUtil; @@ -42,44 +44,44 @@ public class GuiTankUnit extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - drawString(StringUtils.t("gui.techreborn.unit.in"), 100, 43, 4210752, layer); - drawSlot(100, 53, layer); + method_27534(matrixStack, client.textRenderer, new TranslatableText("gui.techreborn.unit.in"), 100, 43, 4210752); + drawSlot(matrixStack, 100, 53, layer); - drawString(StringUtils.t("gui.techreborn.unit.out"), 140, 43, 4210752, layer); - drawSlot(140, 53, layer); + method_27534(matrixStack, client.textRenderer, new TranslatableText("gui.techreborn.unit.out"), 140, 43, 4210752); + drawSlot(matrixStack, 140, 53, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); FluidInstance fluid = tankEntity.getTank().getFluidInstance(); if (fluid.isEmpty()) { - textRenderer.draw(StringUtils.t("techreborn.tooltip.unit.empty"), 10, 20, 4210752); + textRenderer.draw(matrixStack, new TranslatableText("techreborn.tooltip.unit.empty"), 10, 20, 4210752); } else { - textRenderer.draw(StringUtils.t("gui.techreborn.tank.type"), 10, 20, 4210752); - textRenderer.draw(FluidUtil.getFluidName(fluid).replace("_", " "), 10, 30, 4210752); + textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.tank.type"), 10, 20, 4210752); + textRenderer.draw(matrixStack, FluidUtil.getFluidName(fluid).replace("_", " "), 10, 30, 4210752); - textRenderer.draw(StringUtils.t("gui.techreborn.tank.amount"), 10, 50, 4210752); - textRenderer.draw(fluid.getAmount().toString(), 10, 60, 4210752); + textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.tank.amount"), 10, 50, 4210752); + textRenderer.draw(matrixStack, fluid.getAmount().toString(), 10, 60, 4210752); String percentFilled = String.valueOf((int) ((double) fluid.getAmount().getRawValue() / (double) tankEntity.getTank().getCapacity().getRawValue() * 100)); - textRenderer.draw(StringUtils.t("gui.techreborn.unit.used") + percentFilled + "%", 10, 70, 4210752); + textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.unit.used") + percentFilled + "%", 10, 70, 4210752); - textRenderer.draw(StringUtils.t("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680); + textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680); } } @Override - public void render(int mouseX, int mouseY, float partialTicks) { - super.render(mouseX, mouseY, partialTicks); - drawMouseoverTooltip(mouseX, mouseY); + public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { + super.render(matrixStack, mouseX, mouseY, partialTicks); + drawMouseoverTooltip(matrixStack, mouseX, mouseY); } } diff --git a/src/main/java/techreborn/client/gui/GuiThermalGenerator.java b/src/main/java/techreborn/client/gui/GuiThermalGenerator.java index 581450a2e..8cb2d2776 100644 --- a/src/main/java/techreborn/client/gui/GuiThermalGenerator.java +++ b/src/main/java/techreborn/client/gui/GuiThermalGenerator.java @@ -24,6 +24,7 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -40,23 +41,23 @@ public class GuiThermalGenerator extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - drawSlot(25, 35, layer); - drawSlot(25, 55, layer); - builder.drawJEIButton(this, 158, 5, layer); + drawSlot(matrixStack, 25, 35, layer); + drawSlot(matrixStack, 25, 55, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawMultiEnergyBar(this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); - builder.drawTank(this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(matrixStack, this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawTank(matrixStack, this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiVacuumFreezer.java b/src/main/java/techreborn/client/gui/GuiVacuumFreezer.java index 58ddffca8..9d6c0c41f 100644 --- a/src/main/java/techreborn/client/gui/GuiVacuumFreezer.java +++ b/src/main/java/techreborn/client/gui/GuiVacuumFreezer.java @@ -25,6 +25,7 @@ package techreborn.client.gui; import net.minecraft.block.BlockState; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.math.BlockPos; import reborncore.client.screen.builder.BuiltScreenHandler; @@ -45,38 +46,38 @@ public class GuiVacuumFreezer extends GuiBase { } @Override - protected void drawBackground(final float f, final int mouseX, final int mouseY) { - super.drawBackground(f, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; // Battery slot - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); // Input slots - drawSlot(8, 72, layer); - drawSlot(55, 45, layer); + drawSlot(matrixStack, 8, 72, layer); + drawSlot(matrixStack, 55, 45, layer); // Output slot - drawOutputSlot(101, 45, layer); + drawOutputSlot(matrixStack, 101, 45, layer); - builder.drawJEIButton(this, 158, 5, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); if (blockEntity.getMultiBlock()) { - builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer); + builder.drawHologramButton(matrixStack, this, 6, 4, mouseX, mouseY, layer); } } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); if (blockEntity.getMultiBlock()) { addHologramButton(6, 4, 212, layer).clickHandler(this::onClick); } else { - builder.drawMultiblockMissingBar(this, layer); + builder.drawMultiblockMissingBar(matrixStack, this, layer); addHologramButton(76, 56, 212, layer).clickHandler(this::onClick); - builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer); + builder.drawHologramButton(matrixStack, this, 76, 56, mouseX, mouseY, layer); } - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){ diff --git a/src/main/java/techreborn/client/gui/GuiWireMill.java b/src/main/java/techreborn/client/gui/GuiWireMill.java index 340229d89..75410f72e 100644 --- a/src/main/java/techreborn/client/gui/GuiWireMill.java +++ b/src/main/java/techreborn/client/gui/GuiWireMill.java @@ -24,6 +24,7 @@ package techreborn.client.gui; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.gui.builder.GuiBase; @@ -40,28 +41,28 @@ public class GuiWireMill extends GuiBase { } @Override - protected void drawBackground(final float partialTicks, final int mouseX, final int mouseY) { - super.drawBackground(partialTicks, mouseX, mouseY); + protected void drawBackground(MatrixStack matrixStack, final float partialTicks, final int mouseX, final int mouseY) { + super.drawBackground(matrixStack, partialTicks, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; // Battery slot - drawSlot(8, 72, layer); + drawSlot(matrixStack, 8, 72, layer); // Input slots - drawSlot(55, 45, layer); - drawSlot(101, 45, layer); + drawSlot(matrixStack, 55, 45, layer); + drawSlot(matrixStack, 101, 45, layer); - drawOutputSlot(101, 45, layer); + drawOutputSlot(matrixStack, 101, 45, layer); - builder.drawJEIButton(this, 158, 5, layer); + builder.drawJEIButton(matrixStack, this, 158, 5, layer); } @Override - protected void drawForeground(final int mouseX, final int mouseY) { - super.drawForeground(mouseX, mouseY); + protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) { + super.drawForeground(matrixStack, mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); - builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/compat/rei/MachineRecipeCategory.java b/src/main/java/techreborn/compat/rei/MachineRecipeCategory.java index 25716d30d..354af12d0 100644 --- a/src/main/java/techreborn/compat/rei/MachineRecipeCategory.java +++ b/src/main/java/techreborn/compat/rei/MachineRecipeCategory.java @@ -34,6 +34,7 @@ import me.shedaniel.rei.gui.entries.RecipeEntry; import me.shedaniel.rei.gui.entries.SimpleRecipeEntry; import me.shedaniel.rei.gui.widget.Widget; import net.minecraft.item.Items; +import net.minecraft.text.LiteralText; import net.minecraft.text.Text; import net.minecraft.text.TranslatableText; import net.minecraft.util.Identifier; @@ -66,7 +67,7 @@ public class MachineRecipeCategory implements RecipeCate @Override public String getCategoryName() { - return StringUtils.t(rebornRecipeType.getName().toString()); + return new TranslatableText(rebornRecipeType.getName().toString()).asString(); } @Override @@ -94,7 +95,7 @@ public class MachineRecipeCategory implements RecipeCate Text energyPerTick = new TranslatableText("techreborn.jei.recipe.running.cost", "E", machineRecipe.getEnergy()); Label costLabel; - widgets.add(costLabel = Widgets.createLabel(new Point(startPoint.x + 1, startPoint.y + 1 + (i++ * 20)), energyPerTick.asFormattedString())); + widgets.add(costLabel = Widgets.createLabel(new Point(startPoint.x + 1, startPoint.y + 1 + (i++ * 20)), energyPerTick)); costLabel.shadow(false); costLabel.color(0xFF404040, 0xFFBBBBBB); @@ -105,7 +106,7 @@ public class MachineRecipeCategory implements RecipeCate int heat = machineRecipe.getHeat(); if (heat > 0) { - String neededHeat = heat + " " + StringUtils.t("techreborn.jei.recipe.heat"); + Text neededHeat = new LiteralText(String.valueOf(heat)).append(" ").append(new TranslatableText("techreborn.jei.recipe.heat")); Label heatLabel; widgets.add(heatLabel = Widgets.createLabel(new Point(startPoint.x + 61, startPoint.y + 1 + (i++ * 20)), neededHeat)); heatLabel.shadow(false); diff --git a/src/main/java/techreborn/compat/rei/ReiPlugin.java b/src/main/java/techreborn/compat/rei/ReiPlugin.java index 065e0190d..b5068b178 100644 --- a/src/main/java/techreborn/compat/rei/ReiPlugin.java +++ b/src/main/java/techreborn/compat/rei/ReiPlugin.java @@ -24,7 +24,7 @@ package techreborn.compat.rei; -import me.shedaniel.math.api.Rectangle; +import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.BaseBoundsHandler; import me.shedaniel.rei.api.DisplayHelper; import me.shedaniel.rei.api.EntryRegistry; @@ -32,8 +32,6 @@ import me.shedaniel.rei.api.EntryStack; import me.shedaniel.rei.api.RecipeDisplay; import me.shedaniel.rei.api.RecipeHelper; import me.shedaniel.rei.api.plugins.REIPluginV0; -import net.fabricmc.loader.api.SemanticVersion; -import net.fabricmc.loader.util.version.VersionParsingException; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.item.ItemConvertible; diff --git a/src/main/java/techreborn/compat/rei/fluidgenerator/FluidGeneratorRecipeCategory.java b/src/main/java/techreborn/compat/rei/fluidgenerator/FluidGeneratorRecipeCategory.java index e0669945c..ccc277f6e 100644 --- a/src/main/java/techreborn/compat/rei/fluidgenerator/FluidGeneratorRecipeCategory.java +++ b/src/main/java/techreborn/compat/rei/fluidgenerator/FluidGeneratorRecipeCategory.java @@ -58,7 +58,7 @@ public class FluidGeneratorRecipeCategory implements RecipeCategory method_11430(Random random) { - return createTreeFeature(random, false); - } - - //1.15.2 method @Nullable @Override - protected ConfiguredFeature createTreeFeature(Random random, boolean bl) { + protected ConfiguredFeature createTreeFeature(Random random, boolean bl) { return WorldGenerator.RUBBER_TREE_FEATURE.configure(WorldGenerator.RUBBER_TREE_CONFIG); } + } diff --git a/src/main/java/techreborn/world/RubberTreeFeature.java b/src/main/java/techreborn/world/RubberTreeFeature.java index c174731c6..aef05a22b 100644 --- a/src/main/java/techreborn/world/RubberTreeFeature.java +++ b/src/main/java/techreborn/world/RubberTreeFeature.java @@ -29,8 +29,9 @@ import net.minecraft.block.BlockState; import net.minecraft.util.math.BlockBox; import net.minecraft.util.math.BlockPos; import net.minecraft.world.ModifiableTestableWorld; -import net.minecraft.world.gen.feature.BranchedTreeFeatureConfig; -import net.minecraft.world.gen.feature.OakTreeFeature; +import net.minecraft.world.gen.feature.AbstractTreeFeature; + +import net.minecraft.world.gen.feature.TreeFeatureConfig; import techreborn.config.TechRebornConfig; import techreborn.init.TRContent; @@ -42,20 +43,21 @@ import java.util.function.Function; * @author drcrazy * */ -public class RubberTreeFeature extends OakTreeFeature { +public class RubberTreeFeature extends AbstractTreeFeature { - public RubberTreeFeature(Function, ? extends BranchedTreeFeatureConfig> configFactory) { + public RubberTreeFeature(Function, ? extends TreeFeatureConfig> configFactory) { super(configFactory); } - @Override - public boolean generate(ModifiableTestableWorld world, Random random, BlockPos blockPos, Set set, Set set2, BlockBox blockBox, BranchedTreeFeatureConfig branchedTreeFeatureConfig) { - if(super.generate(world, random, blockPos, set, set2, blockBox, branchedTreeFeatureConfig)) { - spawnSpike(world, blockPos); - return true; - } - return false; - } +// @Override +// public boolean generate(ModifiableTestableWorld world, Random random, BlockPos blockPos, Set set, Set set2, BlockBox blockBox, TreeFeatureConfig branchedTreeFeatureConfig) { +// if(super.generate(world, random, blockPos, set, set2, blockBox, branchedTreeFeatureConfig)) { +// spawnSpike(world, blockPos); +// return true; +// } +// return false; +// } + private void spawnSpike(ModifiableTestableWorld world, BlockPos pos) { final int startScan = pos.getY(); diff --git a/src/main/java/techreborn/world/WorldGenerator.java b/src/main/java/techreborn/world/WorldGenerator.java index b0e264407..e2510ec18 100644 --- a/src/main/java/techreborn/world/WorldGenerator.java +++ b/src/main/java/techreborn/world/WorldGenerator.java @@ -27,20 +27,21 @@ package techreborn.world; import com.google.common.collect.ImmutableList; import net.fabricmc.fabric.api.event.registry.RegistryEntryAddedCallback; import net.minecraft.block.Blocks; +import net.minecraft.class_5201; +import net.minecraft.class_5204; import net.minecraft.util.Identifier; import net.minecraft.util.math.Direction; import net.minecraft.util.registry.Registry; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome.Category; import net.minecraft.world.gen.GenerationStep; -import net.minecraft.world.gen.decorator.BeehiveTreeDecorator; import net.minecraft.world.gen.decorator.CountExtraChanceDecoratorConfig; import net.minecraft.world.gen.decorator.Decorator; import net.minecraft.world.gen.decorator.RangeDecoratorConfig; -import net.minecraft.world.gen.feature.BranchedTreeFeatureConfig; import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.OreFeatureConfig; import net.minecraft.world.gen.feature.OreFeatureConfig.Target; +import net.minecraft.world.gen.feature.TreeFeatureConfig; import net.minecraft.world.gen.foliage.BlobFoliagePlacer; import net.minecraft.world.gen.stateprovider.SimpleBlockStateProvider; import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider; @@ -61,9 +62,9 @@ import java.util.List; */ public class WorldGenerator { - public static Feature RUBBER_TREE_FEATURE; + public static Feature RUBBER_TREE_FEATURE; - public static BranchedTreeFeatureConfig RUBBER_TREE_CONFIG; + public static TreeFeatureConfig RUBBER_TREE_CONFIG; private static List checkedBiomes = new ArrayList<>(); @@ -79,7 +80,7 @@ public class WorldGenerator { } private static void setupTrees() { - RUBBER_TREE_FEATURE = Registry.register(Registry.FEATURE, new Identifier("techreborn:rubber_tree"), new RubberTreeFeature(BranchedTreeFeatureConfig::deserialize)); + RUBBER_TREE_FEATURE = Registry.register(Registry.FEATURE, new Identifier("techreborn:rubber_tree"), new RubberTreeFeature(TreeFeatureConfig::deserialize)); WeightedBlockStateProvider logProvider = new WeightedBlockStateProvider(); logProvider.addState(TRContent.RUBBER_LOG.getDefaultState(), 10); @@ -92,13 +93,13 @@ public class WorldGenerator { ) .forEach(state -> logProvider.addState(state, 1)); - RUBBER_TREE_CONFIG = new BranchedTreeFeatureConfig.Builder( + RUBBER_TREE_CONFIG = new TreeFeatureConfig.Builder( logProvider, new SimpleBlockStateProvider(TRContent.RUBBER_LEAVES.getDefaultState()), new BlobFoliagePlacer(2, 0, 0, 0, 3), - new StraightTrunkPlacer(TechRebornConfig.RubberTreeBaseHeight, 3, 0)) - .noVines() - .build(); + new StraightTrunkPlacer(TechRebornConfig.RubberTreeBaseHeight, 3, 0), + new class_5204(1, 0, 1) + ).build(); } private static void addToBiome(Biome biome){