From fe92f8fb4183a9bf0f76ff1f187395b62a8d3cf5 Mon Sep 17 00:00:00 2001 From: grimmauld Date: Tue, 22 Sep 2020 21:17:11 +0200 Subject: [PATCH] Even more porty --- .../java/com/simibubi/create/AllBlocks.java | 1 - .../block/chute/ChuteTileEntity.java | 17 +++-- .../logistics/block/depot/DepotBlock.java | 4 +- .../logistics/block/depot/DepotRenderer.java | 2 +- .../diodes/AdjustableRepeaterTileEntity.java | 5 -- .../block/funnel/BeltFunnelGenerator.java | 4 +- .../logistics/block/funnel/FunnelBlock.java | 5 +- .../block/funnel/FunnelMovementBehaviour.java | 6 +- .../block/funnel/FunnelTileEntity.java | 2 +- .../HorizontalInteractionFunnelBlock.java | 2 +- .../inventories/AdjustableCrateScreen.java | 14 ++-- .../mechanicalArm/ArmInteractionPoint.java | 2 +- .../ArmInteractionPointHandler.java | 10 +-- .../block/mechanicalArm/ArmTileEntity.java | 6 +- .../block/redstone/AnalogLeverTileEntity.java | 10 +-- .../block/redstone/NixieTubeRenderer.java | 6 +- .../block/redstone/NixieTubeTileEntity.java | 5 +- .../block/redstone/RedstoneLinkBlock.java | 3 +- .../redstone/RedstoneLinkTileEntity.java | 4 +- .../block/redstone/StockpileSwitchScreen.java | 29 +++---- .../redstone/StockpileSwitchTileEntity.java | 4 +- .../logistics/item/CardboardBoxItem.java | 11 ++- .../item/filter/AbstractFilterScreen.java | 10 +-- .../item/filter/AttributeFilterContainer.java | 2 +- .../item/filter/AttributeFilterScreen.java | 75 ++++++++++--------- .../logistics/item/filter/FilterItem.java | 22 +++--- .../logistics/item/filter/FilterScreen.java | 21 +++--- .../logistics/item/filter/ItemAttribute.java | 7 +- .../create/content/palettes/MetalBlock.java | 25 ------- .../content/palettes/PaletteBlockPartial.java | 17 +++-- .../schematics/block/LaunchedItem.java | 5 +- .../block/SchematicannonTileEntity.java | 2 +- .../gui/AbstractSimiContainerScreen.java | 31 ++++---- .../create/foundation/gui/widgets/Label.java | 30 ++++---- .../foundation/gui/widgets/ScrollInput.java | 20 ++--- .../gui/widgets/SelectionScrollInput.java | 19 ++--- .../foundation/item/ItemDescription.java | 17 ++++- .../create/foundation/item/TooltipHelper.java | 11 +-- .../tileEntity/behaviour/ValueBox.java | 21 +++--- .../scrollvalue/ScrollOptionBehaviour.java | 3 +- .../scrollvalue/ScrollValueBehaviour.java | 7 +- .../scrollvalue/ScrollValueRenderer.java | 3 +- .../create/foundation/utility/Lang.java | 8 +- .../foundation/worldgen/OxidizingBlock.java | 1 - .../resources/META-INF/accesstransformer.cfg | 4 +- 45 files changed, 259 insertions(+), 254 deletions(-) delete mode 100644 src/main/java/com/simibubi/create/content/palettes/MetalBlock.java diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 6f5a8db2d..d883c5a0a 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -126,7 +126,6 @@ import com.simibubi.create.content.logistics.block.redstone.RedstoneContactBlock import com.simibubi.create.content.logistics.block.redstone.RedstoneLinkBlock; import com.simibubi.create.content.logistics.block.redstone.RedstoneLinkGenerator; import com.simibubi.create.content.logistics.block.redstone.StockpileSwitchBlock; -import com.simibubi.create.content.palettes.MetalBlock; import com.simibubi.create.content.schematics.block.SchematicTableBlock; import com.simibubi.create.content.schematics.block.SchematicannonBlock; import com.simibubi.create.foundation.config.StressConfigDefaults; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java index 5a0520993..262b7f713 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java @@ -44,6 +44,7 @@ import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; @@ -277,7 +278,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor private void spawnAirFlow(float verticalStart, float verticalEnd, float motion, float drag) { AirParticleData airParticleData = new AirParticleData(drag, motion); - Vector3d origin = new Vector3d(pos); + Vector3d origin = Vector3d.of(pos); float xOff = Create.random.nextFloat() * .5f + .25f; float zOff = Create.random.nextFloat() * .5f + .25f; Vector3d v = origin.add(xOff, verticalStart, zOff); @@ -324,7 +325,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor BlockState stateBelow = world.getBlockState(pos.down()); if (stateBelow.getBlock() instanceof FunnelBlock) { - if (stateBelow.has(BrassFunnelBlock.POWERED) && stateBelow.get(BrassFunnelBlock.POWERED)) + if (stateBelow.method_28500(BrassFunnelBlock.POWERED).orElse(false)) return false; if (stateBelow.get(BrassFunnelBlock.FACING) != Direction.UP) return false; @@ -373,7 +374,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor private boolean handleUpwardOutput(boolean simulate) { BlockState stateAbove = world.getBlockState(pos.up()); if (stateAbove.getBlock() instanceof FunnelBlock) { - boolean powered = stateAbove.has(BrassFunnelBlock.POWERED) && stateAbove.get(BrassFunnelBlock.POWERED); + boolean powered = stateAbove.method_28500(BrassFunnelBlock.POWERED).orElse(false); if (!powered && stateAbove.get(BrassFunnelBlock.FACING) == Direction.DOWN) { ItemStack remainder = FunnelBlock.tryInsert(world, pos.up(), item, simulate); if (remainder.isEmpty()) { @@ -414,7 +415,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor return remainder.isEmpty(); } - if (Block.hasSolidSide(stateAbove, world, pos.up(), Direction.DOWN)) + if (BlockHelper.hasBlockSolidSide(stateAbove, world, pos.up(), Direction.DOWN)) return false; if (!inputChutes.isEmpty()) return false; @@ -630,10 +631,10 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor } @Override - public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { - tooltip.add(spacing + TextFormatting.GOLD + "Pull: " + TextFormatting.WHITE + pull); - tooltip.add(spacing + TextFormatting.GOLD + "Push: " + TextFormatting.WHITE + push); - tooltip.add(TextFormatting.YELLOW + "-> Item Motion: " + TextFormatting.WHITE + getItemMotion()); + public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { + tooltip.add(ITextComponent.of(spacing + TextFormatting.GOLD + "Pull: " + TextFormatting.WHITE + pull)); + tooltip.add(ITextComponent.of(spacing + TextFormatting.GOLD + "Push: " + TextFormatting.WHITE + push)); + tooltip.add(ITextComponent.of(TextFormatting.YELLOW + "-> Item Motion: " + TextFormatting.WHITE + getItemMotion())); return true; } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotBlock.java index c29347c7c..cce0a0867 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotBlock.java @@ -111,7 +111,7 @@ public class DepotBlock extends Block implements ITE { @Override public void onLanded(IBlockReader worldIn, Entity entityIn) { super.onLanded(worldIn, entityIn); - if (!AllBlocks.DEPOT.has(worldIn.getBlockState(entityIn.getPosition()))) + if (!AllBlocks.DEPOT.has(worldIn.getBlockState(entityIn.getBlockPos()))) return; if (!(entityIn instanceof ItemEntity)) return; @@ -121,7 +121,7 @@ public class DepotBlock extends Block implements ITE { return; ItemEntity itemEntity = (ItemEntity) entityIn; DirectBeltInputBehaviour inputBehaviour = - TileEntityBehaviour.get(worldIn, entityIn.getPosition(), DirectBeltInputBehaviour.TYPE); + TileEntityBehaviour.get(worldIn, entityIn.getBlockPos(), DirectBeltInputBehaviour.TYPE); if (inputBehaviour == null) return; ItemStack remainder = inputBehaviour.handleInsertion(itemEntity.getItem(), Direction.DOWN, false); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotRenderer.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotRenderer.java index b759215a4..9fb8d0cfb 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotRenderer.java @@ -12,7 +12,6 @@ import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.ItemRenderer; -import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.entity.Entity; @@ -20,6 +19,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.math.vector.Vector3f; public class DepotRenderer extends SafeTileEntityRenderer { diff --git a/src/main/java/com/simibubi/create/content/logistics/block/diodes/AdjustableRepeaterTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/diodes/AdjustableRepeaterTileEntity.java index 7c4515a1c..67a444c52 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/diodes/AdjustableRepeaterTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/diodes/AdjustableRepeaterTileEntity.java @@ -94,11 +94,6 @@ public class AdjustableRepeaterTileEntity extends SmartTileEntity { updateState(powered, powering, atMax, atMin); } - @Override - public boolean hasFastRenderer() { - return true; - } - protected void updateState(boolean powered, boolean powering, boolean atMax, boolean atMin) { if (!charging && powered) charging = true; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/BeltFunnelGenerator.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/BeltFunnelGenerator.java index e047e1d0f..58caeee10 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/BeltFunnelGenerator.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/BeltFunnelGenerator.java @@ -34,9 +34,9 @@ public class BeltFunnelGenerator extends SpecialBlockStateGen { public ModelFile getModel(DataGenContext ctx, RegistrateBlockstateProvider prov, BlockState state) { boolean pushing = state.get(BeltFunnelBlock.PUSHING); - boolean powered = state.has(BlockStateProperties.POWERED) && state.get(BeltFunnelBlock.POWERED); + boolean powered = state.method_28500(BlockStateProperties.POWERED).orElse(false); String shapeName = state.get(BeltFunnelBlock.SHAPE) - .getName(); + .getString(); String pushingSuffix = (pushing ? "push" : "pull") ; String poweredSuffix = powered ? "_powered" : ""; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelBlock.java index bf00c3e37..6382e2a95 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelBlock.java @@ -10,6 +10,7 @@ import com.simibubi.create.foundation.block.ProperDirectionalBlock; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour; +import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.block.Block; @@ -177,9 +178,9 @@ public abstract class FunnelBlock extends ProperDirectionalBlock implements ITE< @Nullable public static Direction getFunnelFacing(BlockState state) { - if (state.has(FACING)) + if (BlockHelper.hasBlockStateProperty(state, FACING)) return state.get(FACING); - if (state.has(BlockStateProperties.HORIZONTAL_FACING)) + if (BlockHelper.hasBlockStateProperty(state, BlockStateProperties.HORIZONTAL_FACING)) return state.get(BlockStateProperties.HORIZONTAL_FACING); return null; } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelMovementBehaviour.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelMovementBehaviour.java index 5cf5e0d39..0fd41516a 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelMovementBehaviour.java @@ -10,7 +10,7 @@ import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraftforge.items.ItemHandlerHelper; @@ -31,8 +31,8 @@ public class FunnelMovementBehaviour extends MovementBehaviour { } @Override - public Vec3d getActiveAreaOffset(MovementContext context) { - return new Vec3d(FunnelBlock.getFunnelFacing(context.state) + public Vector3d getActiveAreaOffset(MovementContext context) { + return Vector3d.of(FunnelBlock.getFunnelFacing(context.state) .getDirectionVec()).scale(.65); } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelTileEntity.java index c606f8bf4..513b93c3d 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelTileEntity.java @@ -51,7 +51,7 @@ public class FunnelTileEntity extends SmartTileEntity { BlockState state = getBlockState(); if (!FunnelBlock.isFunnel(state)) return Mode.INVALID; - if (state.has(BlockStateProperties.POWERED) && state.get(BlockStateProperties.POWERED)) + if (state.method_28500(BlockStateProperties.POWERED).orElse(false)) return Mode.PAUSED; if (FunnelBlock.getFunnelFacing(state) == Direction.UP && autoExtractor.hasInventory()) return Mode.HOPPER; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/HorizontalInteractionFunnelBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/HorizontalInteractionFunnelBlock.java index 3216e1d8a..f3236083b 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/HorizontalInteractionFunnelBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/HorizontalInteractionFunnelBlock.java @@ -88,7 +88,7 @@ public abstract class HorizontalInteractionFunnelBlock extends HorizontalBlock i BlockPos pos, BlockPos p_196271_6_) { if (!canStillInteract(state, world, pos)) { BlockState parentState = parent.getDefaultState(); - if (state.has(POWERED) && state.get(POWERED)) + if (state.method_28500(POWERED).orElse(false)) parentState = parentState.with(POWERED, true); return parentState.with(FunnelBlock.FACING, state.get(HORIZONTAL_FACING)); } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateScreen.java b/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateScreen.java index 2a58b5e08..a247d6e20 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateScreen.java @@ -7,6 +7,7 @@ import static com.simibubi.create.foundation.gui.AllGuiTextures.PLAYER_INVENTORY import java.util.ArrayList; import java.util.List; +import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlocks; import com.simibubi.create.content.logistics.packet.ConfigureFlexcratePacket; import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen; @@ -64,7 +65,7 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen slot * 64) @@ -111,8 +111,8 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen= 0) lastModification++; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInteractionPoint.java b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInteractionPoint.java index 78e8c6ba0..5e46d4fcf 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInteractionPoint.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInteractionPoint.java @@ -338,7 +338,7 @@ public abstract class ArmInteractionPoint { FilteringBehaviour filtering = TileEntityBehaviour.get(world, pos, FilteringBehaviour.TYPE); InvManipulationBehaviour inserter = TileEntityBehaviour.get(world, pos, InvManipulationBehaviour.TYPE); BlockState state = world.getBlockState(pos); - if (state.has(BlockStateProperties.POWERED) && state.get(BlockStateProperties.POWERED)) + if (state.method_28500(BlockStateProperties.POWERED).orElse(false)) return stack; if (inserter == null) return stack; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInteractionPointHandler.java b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInteractionPointHandler.java index 573bc1c28..f0cccf810 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInteractionPointHandler.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInteractionPointHandler.java @@ -63,10 +63,9 @@ public class ArmInteractionPointHandler { if (player != null) { String key = selected.mode == Mode.DEPOSIT ? "mechanical_arm.deposit_to" : "mechanical_arm.extract_from"; TextFormatting colour = selected.mode == Mode.DEPOSIT ? TextFormatting.GOLD : TextFormatting.AQUA; - String translatedBlock = new TranslationTextComponent(selected.state.getBlock() - .getTranslationKey()).getFormattedText(); - player.sendStatusMessage( - new StringTextComponent(colour + Lang.translate(key, TextFormatting.WHITE + translatedBlock + colour)), + TranslationTextComponent translatedBlock = new TranslationTextComponent(selected.state.getBlock() + .getTranslationKey()); + player.sendStatusMessage((Lang.translate(key, translatedBlock.formatted(TextFormatting.WHITE, colour)).formatted(colour)), true); } @@ -101,8 +100,7 @@ public class ArmInteractionPointHandler { } if (removed > 0) - Minecraft.getInstance().player.sendStatusMessage(new StringTextComponent( - TextFormatting.RED + Lang.translate("mechanical_arm.points_outside_range", removed)), true); + Minecraft.getInstance().player.sendStatusMessage(Lang.translate("mechanical_arm.points_outside_range", removed).formatted(TextFormatting.RED), true); AllPackets.channel.sendToServer(new ArmPlacementPacket(currentSelection, pos)); currentSelection.clear(); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmTileEntity.java index 5619564d1..04e231001 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmTileEntity.java @@ -85,7 +85,7 @@ public class ArmTileEntity extends KineticTileEntity { public void addBehaviours(List behaviours) { super.addBehaviours(behaviours); - selectionMode = new ScrollOptionBehaviour<>(SelectionMode.class, + selectionMode = new ScrollOptionBehaviour(SelectionMode.class, Lang.translate("logistics.when_multiple_outputs_available"), this, new SelectionModeValueBox()); selectionMode.requiresWrench(); behaviours.add(selectionMode); @@ -137,7 +137,7 @@ public class ArmTileEntity extends KineticTileEntity { if (!(armInteractionPoint instanceof Jukebox)) continue; BlockState state = world.getBlockState(armInteractionPoint.pos); - if (state.has(JukeboxBlock.HAS_RECORD) && state.get(JukeboxBlock.HAS_RECORD)) + if (state.method_28500(JukeboxBlock.HAS_RECORD).orElse(false)) return true; } return false; @@ -173,7 +173,7 @@ public class ArmTileEntity extends KineticTileEntity { protected boolean isOnCeiling() { BlockState state = getBlockState(); - return hasWorld() && state != null && state.has(ArmBlock.CEILING) && state.get(ArmBlock.CEILING); + return hasWorld() && state.method_28500(ArmBlock.CEILING).orElse(false); } @Nullable diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverTileEntity.java index 99558c5d1..09075f2dc 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverTileEntity.java @@ -11,6 +11,7 @@ import com.simibubi.create.foundation.utility.Lang; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; public class AnalogLeverTileEntity extends SmartTileEntity implements IHaveGoggleInformation { @@ -57,11 +58,6 @@ public class AnalogLeverTileEntity extends SmartTileEntity implements IHaveGoggl public void addBehaviours(List behaviours) { } - @Override - public boolean hasFastRenderer() { - return true; - } - public void changeState(boolean back) { int prevState = state; state += back ? -1 : 1; @@ -72,8 +68,8 @@ public class AnalogLeverTileEntity extends SmartTileEntity implements IHaveGoggl } @Override - public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { - tooltip.add(spacing + Lang.translate("tooltip.analogStrength", this.state)); + public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { + tooltip.add(ITextComponent.of(spacing).copy().append(Lang.translate("tooltip.analogStrength", this.state))); return true; } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeRenderer.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeRenderer.java index 5993f4d04..0ed6ec397 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeRenderer.java @@ -13,6 +13,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.util.text.Style; public class NixieTubeRenderer extends SafeTileEntityRenderer { @@ -53,7 +54,7 @@ public class NixieTubeRenderer extends SafeTileEntityRenderer " + compoundnbt.getString("Address")) - .applyTextStyle(TextFormatting.GOLD)); + .formatted(TextFormatting.GOLD)); } if (!compoundnbt.contains("Items", Constants.NBT.TAG_LIST)) @@ -117,16 +117,15 @@ public class CardboardBoxItem extends Item { ++j; if (i <= 4) { ++i; - ITextComponent itextcomponent = itemstack.getDisplayName().deepCopy(); - itextcomponent.appendText(" x").appendText(String.valueOf(itemstack.getCount())) - .applyTextStyle(TextFormatting.GRAY); - tooltip.add(itextcomponent); + ITextComponent itextcomponent = itemstack.getDisplayName(); + tooltip.add(itextcomponent.copy().append(" x").append(String.valueOf(itemstack.getCount())) + .formatted(TextFormatting.GRAY)); } } if (j - i > 0) { tooltip.add((new TranslationTextComponent("container.shulkerBox.more", j - i)) - .applyTextStyle(TextFormatting.ITALIC)); + .formatted(TextFormatting.ITALIC)); } } diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java index a699fb0cb..a422a3740 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java @@ -15,7 +15,6 @@ import com.simibubi.create.foundation.gui.GuiGameElement; import com.simibubi.create.foundation.gui.widgets.IconButton; import com.simibubi.create.foundation.gui.widgets.Indicator; import com.simibubi.create.foundation.gui.widgets.Indicator.State; -import com.simibubi.create.foundation.item.ItemDescription; import com.simibubi.create.foundation.item.ItemDescription.Palette; import com.simibubi.create.foundation.item.TooltipHelper; import com.simibubi.create.foundation.networking.AllPackets; @@ -23,6 +22,7 @@ import com.simibubi.create.foundation.networking.AllPackets; import net.minecraft.client.gui.widget.Widget; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.util.text.IFormattableTextComponent; import net.minecraft.util.text.ITextComponent; public abstract class AbstractFilterScreen extends AbstractSimiContainerScreen { @@ -106,12 +106,12 @@ public abstract class AbstractFilterScreen ex for (IconButton button : tooltipButtons) { if (!button.getToolTip().isEmpty()) { button.setToolTip(button.getToolTip().get(0)); - button.getToolTip().add(ITextComponent.of(TooltipHelper.holdShift(Palette.Yellow, hasShiftDown()))); + button.getToolTip().add(TooltipHelper.holdShift(Palette.Yellow, hasShiftDown())); } } if (hasShiftDown()) { - List tooltipDescriptions = getTooltipDescriptions(); + List tooltipDescriptions = getTooltipDescriptions(); for (int i = 0; i < tooltipButtons.size(); i++) fillToolTip(tooltipButtons.get(i), tooltipDescriptions.get(i)); } @@ -121,11 +121,11 @@ public abstract class AbstractFilterScreen ex return Collections.emptyList(); } - protected List getTooltipDescriptions() { + protected List getTooltipDescriptions() { return Collections.emptyList(); } - private void fillToolTip(IconButton button, String tooltip) { + private void fillToolTip(IconButton button, ITextComponent tooltip) { if (!button.isHovered()) return; List tip = button.getToolTip(); diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterContainer.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterContainer.java index 45595fd97..710e29ca5 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterContainer.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterContainer.java @@ -51,7 +51,7 @@ public class AttributeFilterContainer extends AbstractFilterContainer { super.init(); ItemStack stack = new ItemStack(Items.NAME_TAG); stack.setDisplayName( - new StringTextComponent("Selected Tags").applyTextStyles(TextFormatting.RESET, TextFormatting.BLUE)); + new StringTextComponent("Selected Tags").formatted(TextFormatting.RESET, TextFormatting.BLUE)); filterInventory.setStackInSlot(1, stack); } diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterScreen.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterScreen.java index d31e29cf9..7e601a0d4 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterScreen.java @@ -2,10 +2,11 @@ package com.simibubi.create.content.logistics.item.filter; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.stream.Collectors; -import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.content.logistics.item.filter.AttributeFilterContainer.WhitelistMode; import com.simibubi.create.content.logistics.item.filter.FilterScreenPacket.Option; import com.simibubi.create.foundation.gui.AllGuiTextures; @@ -20,7 +21,9 @@ import com.simibubi.create.foundation.utility.Lang; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.text.IFormattableTextComponent; import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; public class AttributeFilterScreen extends AbstractFilterScreen { @@ -31,20 +34,20 @@ public class AttributeFilterScreen extends AbstractFilterScreen attributesOfItem = new ArrayList<>(); - private List selectedAttributes = new ArrayList<>(); + private List selectedAttributes = new ArrayList<>(); private SelectionScrollInput attributeSelector; private Label attributeSelectorLabel; @@ -78,7 +81,7 @@ public class AttributeFilterScreen extends AbstractFilterScreen { }); referenceItemChanged(container.filterInventory.getStackInSlot(0)); @@ -88,8 +91,8 @@ public class AttributeFilterScreen extends AbstractFilterScreen selectedAttributes.add(TextFormatting.GRAY + "- " + at.format())); + .add((container.selectedAttributes.isEmpty() ? noSelectedT : selectedT).copy().formatted(TextFormatting.YELLOW)); + container.selectedAttributes.forEach(at -> selectedAttributes.add(new StringTextComponent("- ").append(at.format()).formatted(TextFormatting.GRAY))); } @@ -99,7 +102,7 @@ public class AttributeFilterScreen extends AbstractFilterScreen { }); @@ -107,11 +110,11 @@ public class AttributeFilterScreen extends AbstractFilterScreen options = attributesOfItem.stream().map(ItemAttribute::format).collect(Collectors.toList()); + attributesOfItem.addAll(itemAttribute.listAttributesOf(stack, this.client.world)); + List options = attributesOfItem.stream().map(ItemAttribute::format).collect(Collectors.toList()); attributeSelector.forOptions(options); attributeSelector.active = true; attributeSelector.visible = true; @@ -135,19 +138,19 @@ public class AttributeFilterScreen extends AbstractFilterScreen getTooltipDescriptions() { - return Arrays.asList(blacklistDESC, whitelistConDESC, whitelistDisDESC); + protected List getTooltipDescriptions() { + return Arrays.asList(blacklistDESC.copy(), whitelistConDESC.copy(), whitelistDisDESC.copy()); } @Override @@ -216,8 +219,8 @@ public class AttributeFilterScreen extends AbstractFilterScreen tooltip, ITooltipFlag flagIn) { if (!AllKeys.shiftDown()) { - List makeSummary = makeSummary(stack); + List makeSummary = makeSummary(stack); if (makeSummary.isEmpty()) return; ItemDescription.add(tooltip, " "); @@ -79,28 +79,26 @@ public class FilterItem extends Item implements INamedContainerProvider { } } - private List makeSummary(ItemStack filter) { - List list = new ArrayList<>(); + private List makeSummary(ItemStack filter) { + List list = new ArrayList<>(); if (type == FilterType.REGULAR) { ItemStackHandler filterItems = getFilterItems(filter); boolean blacklist = filter.getOrCreateTag() .getBoolean("Blacklist"); - list.add(TextFormatting.GOLD - + (blacklist ? Lang.translate("gui.filter.blacklist") : Lang.translate("gui.filter.whitelist"))); + list.add((blacklist ? Lang.translate("gui.filter.blacklist") : Lang.translate("gui.filter.whitelist")).formatted(TextFormatting.GOLD)); int count = 0; for (int i = 0; i < filterItems.getSlots(); i++) { if (count > 3) { - list.add(TextFormatting.DARK_GRAY + "- ..."); + list.add(new StringTextComponent("- ...").formatted(TextFormatting.DARK_GRAY)); break; } ItemStack filterStack = filterItems.getStackInSlot(i); if (filterStack.isEmpty()) continue; - list.add(TextFormatting.GRAY + "- " + filterStack.getDisplayName() - .getFormattedText()); + list.add(new StringTextComponent("- ").append(filterStack.getDisplayName()).formatted(TextFormatting.GRAY)); count++; } @@ -111,11 +109,11 @@ public class FilterItem extends Item implements INamedContainerProvider { if (type == FilterType.ATTRIBUTE) { WhitelistMode whitelistMode = WhitelistMode.values()[filter.getOrCreateTag() .getInt("WhitelistMode")]; - list.add(TextFormatting.GOLD + (whitelistMode == WhitelistMode.WHITELIST_CONJ + list.add((whitelistMode == WhitelistMode.WHITELIST_CONJ ? Lang.translate("gui.attribute_filter.whitelist_conjunctive") : whitelistMode == WhitelistMode.WHITELIST_DISJ ? Lang.translate("gui.attribute_filter.whitelist_disjunctive") - : Lang.translate("gui.attribute_filter.blacklist"))); + : Lang.translate("gui.attribute_filter.blacklist")).formatted(TextFormatting.GOLD)); int count = 0; ListNBT attributes = filter.getOrCreateTag() @@ -123,10 +121,10 @@ public class FilterItem extends Item implements INamedContainerProvider { for (INBT inbt : attributes) { ItemAttribute attribute = ItemAttribute.fromNBT((CompoundNBT) inbt); if (count > 3) { - list.add(TextFormatting.DARK_GRAY + "- ..."); + list.add(new StringTextComponent("- ...").formatted(TextFormatting.DARK_GRAY)); break; } - list.add(TextFormatting.GRAY + "- " + attribute.format()); + list.add(new StringTextComponent("- ").append(attribute.format())); count++; } diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterScreen.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterScreen.java index 9a1defe51..0617a5cf8 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterScreen.java @@ -11,21 +11,22 @@ import com.simibubi.create.foundation.gui.widgets.Indicator; import com.simibubi.create.foundation.utility.Lang; import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.util.text.IFormattableTextComponent; import net.minecraft.util.text.ITextComponent; public class FilterScreen extends AbstractFilterScreen { private static final String PREFIX = "gui.filter."; - private String whitelistN = Lang.translate(PREFIX + "whitelist"); - private String whitelistDESC = Lang.translate(PREFIX + "whitelist.description"); - private String blacklistN = Lang.translate(PREFIX + "blacklist"); - private String blacklistDESC = Lang.translate(PREFIX + "blacklist.description"); + private ITextComponent whitelistN = Lang.translate(PREFIX + "whitelist"); + private ITextComponent whitelistDESC = Lang.translate(PREFIX + "whitelist.description"); + private ITextComponent blacklistN = Lang.translate(PREFIX + "blacklist"); + private ITextComponent blacklistDESC = Lang.translate(PREFIX + "blacklist.description"); - private String respectDataN = Lang.translate(PREFIX + "respect_data"); - private String respectDataDESC = Lang.translate(PREFIX + "respect_data.description"); - private String ignoreDataN = Lang.translate(PREFIX + "ignore_data"); - private String ignoreDataDESC = Lang.translate(PREFIX + "ignore_data.description"); + private ITextComponent respectDataN = Lang.translate(PREFIX + "respect_data"); + private ITextComponent respectDataDESC = Lang.translate(PREFIX + "respect_data.description"); + private ITextComponent ignoreDataN = Lang.translate(PREFIX + "ignore_data"); + private ITextComponent ignoreDataDESC = Lang.translate(PREFIX + "ignore_data.description"); private IconButton whitelist, blacklist; private IconButton respectNBT, ignoreNBT; @@ -100,8 +101,8 @@ public class FilterScreen extends AbstractFilterScreen { } @Override - protected List getTooltipDescriptions() { - return Arrays.asList(blacklistDESC, whitelistDESC, respectDataDESC, ignoreDataDESC); + protected List getTooltipDescriptions() { + return Arrays.asList(blacklistDESC.copy(), whitelistDESC.copy(), respectDataDESC.copy(), ignoreDataDESC.copy()); } @Override diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/ItemAttribute.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/ItemAttribute.java index 3759744aa..aff220b79 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/ItemAttribute.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/ItemAttribute.java @@ -9,6 +9,7 @@ import java.util.function.BiPredicate; import java.util.function.Predicate; import java.util.stream.Collectors; +import net.minecraft.util.text.TranslationTextComponent; import org.apache.commons.lang3.StringUtils; import com.google.common.base.Predicates; @@ -95,7 +96,7 @@ public interface ItemAttribute { } @OnlyIn(value = Dist.CLIENT) - default String format() { + default TranslationTextComponent format() { return Lang.translate("item_attributes." + getTranslationKey(), getTranslationParameters()); } @@ -250,8 +251,8 @@ public interface ItemAttribute { } @OnlyIn(value = Dist.CLIENT) - public String format() { - return Lang.translate("item_attributes." + getTranslationKey(), I18n.format(group.getTranslationKey())); + public TranslationTextComponent format() { + return Lang.translate("item_attributes." + getTranslationKey(), group.getTranslationKey()); } @Override diff --git a/src/main/java/com/simibubi/create/content/palettes/MetalBlock.java b/src/main/java/com/simibubi/create/content/palettes/MetalBlock.java deleted file mode 100644 index cb2fc6e10..000000000 --- a/src/main/java/com/simibubi/create/content/palettes/MetalBlock.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.simibubi.create.content.palettes; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IWorldReader; - -public class MetalBlock extends Block { - private final boolean isBeaconBaseBlock; - - public MetalBlock(Properties properties) { - super(properties); - isBeaconBaseBlock = false; - } - - public MetalBlock(Properties properties, boolean isBeaconBaseBlock) { - super(properties); - this.isBeaconBaseBlock = isBeaconBaseBlock; - } - - @Override - public boolean isBeaconBase(BlockState state, IWorldReader world, BlockPos pos, BlockPos beacon) { - return isBeaconBaseBlock ? true : super.isBeaconBase(state, world, pos, beacon); - } -} diff --git a/src/main/java/com/simibubi/create/content/palettes/PaletteBlockPartial.java b/src/main/java/com/simibubi/create/content/palettes/PaletteBlockPartial.java index 482969ac4..356f690ef 100644 --- a/src/main/java/com/simibubi/create/content/palettes/PaletteBlockPartial.java +++ b/src/main/java/com/simibubi/create/content/palettes/PaletteBlockPartial.java @@ -21,6 +21,7 @@ import net.minecraft.block.WallBlock; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ITag; import net.minecraft.tags.ItemTags; import net.minecraft.tags.Tag; import net.minecraft.util.ResourceLocation; @@ -73,9 +74,9 @@ public abstract class PaletteBlockPartial { return builder; } - protected abstract Iterable> getBlockTags(); + protected abstract Iterable> getBlockTags(); - protected abstract Iterable> getItemTags(); + protected abstract Iterable> getItemTags(); protected abstract B createBlock(Supplier block); @@ -104,12 +105,12 @@ public abstract class PaletteBlockPartial { } @Override - protected Iterable> getBlockTags() { + protected Iterable> getBlockTags() { return Arrays.asList(BlockTags.STAIRS); } @Override - protected Iterable> getItemTags() { + protected Iterable> getItemTags() { return Arrays.asList(ItemTags.STAIRS); } @@ -164,12 +165,12 @@ public abstract class PaletteBlockPartial { } @Override - protected Iterable> getBlockTags() { + protected Iterable> getBlockTags() { return Arrays.asList(BlockTags.SLABS); } @Override - protected Iterable> getItemTags() { + protected Iterable> getItemTags() { return Arrays.asList(ItemTags.SLABS); } @@ -209,12 +210,12 @@ public abstract class PaletteBlockPartial { } @Override - protected Iterable> getBlockTags() { + protected Iterable> getBlockTags() { return Arrays.asList(BlockTags.WALLS); } @Override - protected Iterable> getItemTags() { + protected Iterable> getItemTags() { return Arrays.asList(ItemTags.WALLS); } diff --git a/src/main/java/com/simibubi/create/content/schematics/block/LaunchedItem.java b/src/main/java/com/simibubi/create/content/schematics/block/LaunchedItem.java index c106c0046..b4ab5975f 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/LaunchedItem.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/LaunchedItem.java @@ -8,6 +8,7 @@ import com.simibubi.create.content.contraptions.relays.belt.BeltPart; import com.simibubi.create.content.contraptions.relays.belt.item.BeltConnectorItem; import com.simibubi.create.content.contraptions.relays.elementary.ShaftBlock; +import com.simibubi.create.foundation.utility.BlockHelper; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -114,9 +115,9 @@ public abstract class LaunchedItem { @Override void place(World world) { // Piston - if (state.has(BlockStateProperties.EXTENDED)) + if (BlockHelper.hasBlockStateProperty(state, BlockStateProperties.EXTENDED)) state = state.with(BlockStateProperties.EXTENDED, Boolean.FALSE); - if (state.has(BlockStateProperties.WATERLOGGED)) + if (BlockHelper.hasBlockStateProperty(state, BlockStateProperties.WATERLOGGED)) state = state.with(BlockStateProperties.WATERLOGGED, Boolean.FALSE); if (AllBlocks.BELT.has(state)) { diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java index 500777a35..c17657e8e 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java @@ -539,7 +539,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC schematicAnchor = anchor; blockReader = new SchematicWorld(schematicAnchor, world); PlacementSettings settings = SchematicItem.getSettings(blueprint); - activeTemplate.addBlocksToWorld(blockReader, schematicAnchor, settings); + activeTemplate.place(blockReader, schematicAnchor, settings); schematicLoaded = true; state = State.PAUSED; statusMsg = "ready"; diff --git a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java index de27fd248..de7c439a7 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java @@ -5,11 +5,13 @@ import java.util.Collections; import java.util.List; import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget; +import mcp.MethodsReturnNonnullByDefault; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.screen.inventory.ContainerScreen; import net.minecraft.client.gui.widget.Widget; @@ -26,6 +28,8 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault public abstract class AbstractSimiContainerScreen extends ContainerScreen { protected List widgets; @@ -41,14 +45,14 @@ public abstract class AbstractSimiContainerScreen extends C } @Override - public void render(int mouseX, int mouseY, float partialTicks) { - renderBackground(); - renderWindow(mouseX, mouseY, partialTicks); + public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { + renderBackground(matrixStack); + renderWindow(matrixStack, mouseX, mouseY, partialTicks); for (Widget widget : widgets) - widget.render(mouseX, mouseY, partialTicks); + widget.render(matrixStack, mouseX, mouseY, partialTicks); - super.render(mouseX, mouseY, partialTicks); + super.render(matrixStack, mouseX, mouseY, partialTicks); RenderSystem.enableAlphaTest(); RenderSystem.enableBlend(); @@ -56,9 +60,9 @@ public abstract class AbstractSimiContainerScreen extends C RenderHelper.disableStandardItemLighting(); RenderSystem.disableLighting(); RenderSystem.disableDepthTest(); - renderWindowForeground(mouseX, mouseY, partialTicks); + renderWindowForeground(matrixStack, mouseX, mouseY, partialTicks); for (Widget widget : widgets) - widget.renderToolTip(mouseX, mouseY); + widget.renderToolTip(matrixStack, mouseX, mouseY); } @Override @@ -123,7 +127,8 @@ public abstract class AbstractSimiContainerScreen extends C protected abstract void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks); @Override - protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { + protected void drawBackground(MatrixStack p_230450_1_, float p_230450_2_, int p_230450_3_, int p_230450_4_) { + } protected void renderWindowForeground(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { @@ -138,7 +143,7 @@ public abstract class AbstractSimiContainerScreen extends C } } - protected void renderItemOverlayIntoGUI(FontRenderer fr, ItemStack stack, int xPosition, int yPosition, + protected void renderItemOverlayIntoGUI(MatrixStack matrixStack, FontRenderer fr, ItemStack stack, int xPosition, int yPosition, @Nullable String text, int textColor) { if (!stack.isEmpty()) { if (stack.getItem().showDurabilityBar(stack)) { @@ -169,14 +174,14 @@ public abstract class AbstractSimiContainerScreen extends C RenderSystem.disableBlend(); RenderSystem.pushMatrix(); - int guiScaleFactor = (int) minecraft.getWindow().getGuiScaleFactor(); + int guiScaleFactor = (int) client.getWindow().getGuiScaleFactor(); RenderSystem.translated((float) (xPosition + 16.5f), (float) (yPosition + 16.5f), 0); double scale = getItemCountTextScale(); RenderSystem.scaled(scale, scale, 0); RenderSystem.translated(-fr.getStringWidth(s) - (guiScaleFactor > 1 ? 0 : -.5f), - -font.FONT_HEIGHT + (guiScaleFactor > 1 ? 1 : 1.75f), 0); - fr.drawStringWithShadow(s, 0, 0, textColor); + -textRenderer.FONT_HEIGHT + (guiScaleFactor > 1 ? 1 : 1.75f), 0); + fr.drawWithShadow(matrixStack, s, 0, 0, textColor); RenderSystem.popMatrix(); RenderSystem.enableBlend(); @@ -188,7 +193,7 @@ public abstract class AbstractSimiContainerScreen extends C } public double getItemCountTextScale() { - int guiScaleFactor = (int) minecraft.getWindow().getGuiScaleFactor(); + int guiScaleFactor = (int) client.getWindow().getGuiScaleFactor(); double scale = 1; switch (guiScaleFactor) { case 1: diff --git a/src/main/java/com/simibubi/create/foundation/gui/widgets/Label.java b/src/main/java/com/simibubi/create/foundation/gui/widgets/Label.java index f7d3e3dcb..468ec1922 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/widgets/Label.java +++ b/src/main/java/com/simibubi/create/foundation/gui/widgets/Label.java @@ -1,13 +1,16 @@ package com.simibubi.create.foundation.gui.widgets; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; public class Label extends AbstractSimiWidget { - public String text; + public ITextComponent text; public String suffix; protected boolean hasShadow; protected int color; @@ -16,7 +19,7 @@ public class Label extends AbstractSimiWidget { public Label(int x, int y, String text) { super(x, y, Minecraft.getInstance().fontRenderer.getStringWidth(text), 10); font = Minecraft.getInstance().fontRenderer; - this.text = "Label"; + this.text = ITextComponent.of("Label"); color = 0xFFFFFF; hasShadow = false; suffix = ""; @@ -37,10 +40,10 @@ public class Label extends AbstractSimiWidget { return this; } - public void setTextAndTrim(String newText, boolean trimFront, int maxWidthPx) { + public void setTextAndTrim(ITextComponent newText, boolean trimFront, int maxWidthPx) { FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer; - if (fontRenderer.getStringWidth(newText) <= maxWidthPx) { + if (fontRenderer.getWidth(newText) <= maxWidthPx) { text = newText; return; } @@ -48,15 +51,16 @@ public class Label extends AbstractSimiWidget { String trim = "..."; int trimWidth = fontRenderer.getStringWidth(trim); - StringBuilder builder = new StringBuilder(newText); - int startIndex = trimFront ? 0 : newText.length() - 1; - int endIndex = !trimFront ? 0 : newText.length() - 1; + String raw = newText.getUnformattedComponentText(); + StringBuilder builder = new StringBuilder(raw); + int startIndex = trimFront ? 0 : raw.length() - 1; + int endIndex = !trimFront ? 0 : raw.length() - 1; int step = (int) Math.signum(endIndex - startIndex); for (int i = startIndex; i != endIndex; i += step) { String sub = builder.substring(trimFront ? i : startIndex, trimFront ? endIndex + 1 : i + 1); - if (fontRenderer.getStringWidth(sub) + trimWidth <= maxWidthPx) { - text = trimFront ? trim + sub : sub + trim; + if (fontRenderer.getWidth(new StringTextComponent(sub).setStyle(newText.getStyle())) + trimWidth <= maxWidthPx) { + text = new StringTextComponent(trimFront ? trim + sub : sub + trim).setStyle(newText.getStyle()); return; } } @@ -64,17 +68,17 @@ public class Label extends AbstractSimiWidget { } @Override - public void render(int mouseX, int mouseY, float partialTicks) { + public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { if (!visible) return; - if (text == null || text.isEmpty()) + if (text == null || text.toString().isEmpty()) return; RenderSystem.color4f(1, 1, 1, 1); if (hasShadow) - font.drawStringWithShadow(text + suffix, x, y, color); + font.drawWithShadow(matrixStack, text + suffix, x, y, color); else - font.drawString(text + suffix, x, y, color); + font.draw(matrixStack, text + suffix, x, y, color); } } diff --git a/src/main/java/com/simibubi/create/foundation/gui/widgets/ScrollInput.java b/src/main/java/com/simibubi/create/foundation/gui/widgets/ScrollInput.java index 415fae287..fe1c9baa6 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/widgets/ScrollInput.java +++ b/src/main/java/com/simibubi/create/foundation/gui/widgets/ScrollInput.java @@ -7,15 +7,17 @@ import com.simibubi.create.AllKeys; import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour.StepContext; import com.simibubi.create.foundation.utility.Lang; +import net.minecraft.util.text.IFormattableTextComponent; +import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextFormatting; public class ScrollInput extends AbstractSimiWidget { protected Consumer onScroll; protected int state; - protected String title = Lang.translate("gui.scrollInput.defaultTitle"); - protected final String scrollToModify = Lang.translate("gui.scrollInput.scrollToModify"); - protected final String shiftScrollsFaster = Lang.translate("gui.scrollInput.shiftScrollsFaster"); + protected IFormattableTextComponent title = Lang.translate("gui.scrollInput.defaultTitle"); + protected final IFormattableTextComponent scrollToModify = Lang.translate("gui.scrollInput.scrollToModify"); + protected final IFormattableTextComponent shiftScrollsFaster = Lang.translate("gui.scrollInput.shiftScrollsFaster"); protected Label displayLabel; protected int min, max; @@ -46,7 +48,7 @@ public class ScrollInput extends AbstractSimiWidget { return this; } - public ScrollInput titled(String title) { + public ScrollInput titled(IFormattableTextComponent title) { this.title = title; updateTooltip(); return this; @@ -83,7 +85,7 @@ public class ScrollInput extends AbstractSimiWidget { @Override public boolean mouseScrolled(double mouseX, double mouseY, double delta) { - if (!isHovered) + if (!hovered) return false; StepContext context = new StepContext(); @@ -124,14 +126,14 @@ public class ScrollInput extends AbstractSimiWidget { } protected void writeToLabel() { - displayLabel.text = "" + state; + displayLabel.text = ITextComponent.of(String.valueOf(state)); } protected void updateTooltip() { toolTip.clear(); - toolTip.add(TextFormatting.BLUE + title); - toolTip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + scrollToModify); - toolTip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + shiftScrollsFaster); + toolTip.add(title.formatted(TextFormatting.BLUE)); + toolTip.add(scrollToModify.formatted(TextFormatting.ITALIC, TextFormatting.DARK_GRAY)); + toolTip.add(shiftScrollsFaster.formatted(TextFormatting.ITALIC, TextFormatting.DARK_GRAY)); } } diff --git a/src/main/java/com/simibubi/create/foundation/gui/widgets/SelectionScrollInput.java b/src/main/java/com/simibubi/create/foundation/gui/widgets/SelectionScrollInput.java index b3e528baa..6bbfc9b2d 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/widgets/SelectionScrollInput.java +++ b/src/main/java/com/simibubi/create/foundation/gui/widgets/SelectionScrollInput.java @@ -5,19 +5,22 @@ import java.util.List; import com.simibubi.create.foundation.utility.Lang; +import net.minecraft.util.text.IFormattableTextComponent; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; public class SelectionScrollInput extends ScrollInput { - private final String scrollToSelect = Lang.translate("gui.scrollInput.scrollToSelect"); - protected List options; + private final IFormattableTextComponent scrollToSelect = Lang.translate("gui.scrollInput.scrollToSelect"); + protected List options; public SelectionScrollInput(int xIn, int yIn, int widthIn, int heightIn) { super(xIn, yIn, widthIn, heightIn); options = new ArrayList<>(); } - public ScrollInput forOptions(List options) { + public ScrollInput forOptions(List options) { this.options = options; this.max = options.size(); updateTooltip(); @@ -37,16 +40,14 @@ public class SelectionScrollInput extends ScrollInput { @Override protected void updateTooltip() { toolTip.clear(); - toolTip.add(TextFormatting.BLUE + title); + toolTip.add(title.formatted(TextFormatting.BLUE)); for (int i = min; i < max; i++) { - StringBuilder result = new StringBuilder(); if (i == state) - result.append(TextFormatting.WHITE).append("-> ").append(options.get(i)); + toolTip.add(StringTextComponent.EMPTY.copy().append("-> ").append(options.get(i)).formatted(TextFormatting.WHITE)); else - result.append(TextFormatting.GRAY).append("> ").append(options.get(i)); - toolTip.add(result.toString()); + toolTip.add(StringTextComponent.EMPTY.copy().append("> ").append(options.get(i)).formatted(TextFormatting.GRAY)); } - toolTip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + scrollToSelect); + toolTip.add( StringTextComponent.EMPTY.copy().append(scrollToSelect).formatted(TextFormatting.ITALIC, TextFormatting.DARK_GRAY)); } } diff --git a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java index c93f6d243..565594e98 100644 --- a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java +++ b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java @@ -38,6 +38,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screen.Screen; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.IFormattableTextComponent; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; @@ -155,8 +156,8 @@ public class ItemDescription { add(linesOnShift, GRAY + Lang.translate("tooltip.capacityProvided")); add(linesOnShift, level); - String genSpeed = generatorSpeed(block, rpmUnit); - if (!genSpeed.equals("")) { + IFormattableTextComponent genSpeed = generatorSpeed(block, rpmUnit); + if (!genSpeed.getUnformattedComponentText().equals("")) { add(linesOnShift, GREEN + " " + genSpeed); } } @@ -251,10 +252,18 @@ public class ItemDescription { textLines.forEach(s -> add(infoList, s)); } + public static void add(List infoList, List textLines) { + infoList.addAll(textLines); + } + public static void add(List infoList, String line) { infoList.add(new StringTextComponent(line)); } + public static void add(List infoList, ITextComponent line) { + infoList.add(line); + } + public Palette getPalette() { return palette; } @@ -286,7 +295,7 @@ public class ItemDescription { return linesOnShift; } - private String generatorSpeed(Block block, String unitRPM) { + private IFormattableTextComponent generatorSpeed(Block block, String unitRPM) { String value = ""; if (block instanceof WaterWheelBlock) { @@ -303,7 +312,7 @@ public class ItemDescription { value = baseSpeed + "-" + (baseSpeed * 2); } - return !value.equals("") ? Lang.translate("tooltip.generationSpeed", value, unitRPM) : ""; + return !value.equals("") ? Lang.translate("tooltip.generationSpeed", value, unitRPM) : StringTextComponent.EMPTY.copy(); } } diff --git a/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java b/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java index 199cb453a..e88e06901 100644 --- a/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java +++ b/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java @@ -25,6 +25,8 @@ import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.TieredItem; +import net.minecraft.util.text.IFormattableTextComponent; +import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextFormatting; public class TooltipHelper { @@ -34,14 +36,13 @@ public class TooltipHelper { public static Language cachedLanguage; private static boolean gogglesMode; - public static String holdShift(Palette color, boolean highlighted) { + public static IFormattableTextComponent holdShift(Palette color, boolean highlighted) { TextFormatting colorFormat = highlighted ? color.hColor : color.color; - return DARK_GRAY - + Lang.translate("tooltip.holdKey", colorFormat + Lang.translate("tooltip.keyShift") + DARK_GRAY); + return Lang.translate("tooltip.holdKey", DARK_GRAY).append(Lang.translate("tooltip.keyShift").formatted(colorFormat)); } - public static List cutString(String s, TextFormatting defaultColor, TextFormatting highlightColor) { - return cutString(s, defaultColor, highlightColor, 0); + public static List cutString(ITextComponent s, TextFormatting defaultColor, TextFormatting highlightColor) { + return cutString(s.getUnformattedComponentText(), defaultColor, highlightColor, 0); } public static List cutString(String s, TextFormatting defaultColor, TextFormatting highlightColor, diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/ValueBox.java b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/ValueBox.java index d1f8f6b75..02bce8463 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/ValueBox.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/ValueBox.java @@ -18,11 +18,12 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.text.ITextComponent; public class ValueBox extends ChasingAABBOutline { - protected String label = "Value Box"; - protected String sublabel = ""; + protected ITextComponent label = ITextComponent.of("Value Box"); + protected ITextComponent sublabel = ITextComponent.of(""); protected String scrollTooltip = ""; protected Vector3d labelOffset = Vector3d.ZERO; @@ -34,7 +35,7 @@ public class ValueBox extends ChasingAABBOutline { protected ValueBoxTransform transform; protected BlockState blockState; - public ValueBox(String label, AxisAlignedBB bb, BlockPos pos) { + public ValueBox(ITextComponent label, AxisAlignedBB bb, BlockPos pos) { super(bb); this.label = label; this.pos = pos; @@ -51,7 +52,7 @@ public class ValueBox extends ChasingAABBOutline { return this; } - public ValueBox subLabel(String sublabel) { + public ValueBox subLabel(ITextComponent sublabel) { this.sublabel = sublabel; return this; } @@ -103,7 +104,7 @@ public class ValueBox extends ChasingAABBOutline { ms.translate(labelOffset.x, labelOffset.y, labelOffset.z); renderHoveringText(ms, buffer, label); - if (!sublabel.isEmpty()) { + if (!sublabel.toString().isEmpty()) { ms.translate(0, 10, 0); renderHoveringText(ms, buffer, sublabel); } @@ -162,7 +163,7 @@ public class ValueBox extends ChasingAABBOutline { public static class TextValueBox extends ValueBox { String text; - public TextValueBox(String label, AxisAlignedBB bb, BlockPos pos, String text) { + public TextValueBox(ITextComponent label, AxisAlignedBB bb, BlockPos pos, String text) { super(label, bb, pos); this.text = text; } @@ -185,7 +186,7 @@ public class ValueBox extends ChasingAABBOutline { ms.scale(numberScale, numberScale, numberScale); ms.translate(singleDigit ? stringWidth / 2 : 0, singleDigit ? -verticalMargin : verticalMargin, 0); - renderHoveringText(ms, buffer, text, 0xEDEDED, 0x4f4f4f); + renderHoveringText(ms, buffer, ITextComponent.of(text), 0xEDEDED, 0x4f4f4f); } } @@ -212,11 +213,11 @@ public class ValueBox extends ChasingAABBOutline { // util - protected void renderHoveringText(MatrixStack ms, IRenderTypeBuffer buffer, String text) { + protected void renderHoveringText(MatrixStack ms, IRenderTypeBuffer buffer, ITextComponent text) { renderHoveringText(ms, buffer, text, highlightColor, ColorHelper.mixColors(passiveColor, 0, 0.75f)); } - protected void renderHoveringText(MatrixStack ms, IRenderTypeBuffer buffer, String text, int color, + protected void renderHoveringText(MatrixStack ms, IRenderTypeBuffer buffer, ITextComponent text, int color, int shadowColor) { ms.push(); drawString(ms, buffer, text, 0, 0, color); @@ -225,7 +226,7 @@ public class ValueBox extends ChasingAABBOutline { ms.pop(); } - private static void drawString(MatrixStack ms, IRenderTypeBuffer buffer, String text, float x, float y, int color) { + private static void drawString(MatrixStack ms, IRenderTypeBuffer buffer, ITextComponent text, float x, float y, int color) { Minecraft.getInstance().fontRenderer.draw(text, x, y, color, false, ms.peek() .getModel(), buffer, false, 0, 15728880); } diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/scrollvalue/ScrollOptionBehaviour.java b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/scrollvalue/ScrollOptionBehaviour.java index 808cb8257..8fc70eda2 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/scrollvalue/ScrollOptionBehaviour.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/scrollvalue/ScrollOptionBehaviour.java @@ -2,12 +2,13 @@ package com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue; import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; +import net.minecraft.util.text.ITextComponent; public class ScrollOptionBehaviour & INamedIconOptions> extends ScrollValueBehaviour { private E[] options; - public ScrollOptionBehaviour(Class enum_, String label, SmartTileEntity te, ValueBoxTransform slot) { + public ScrollOptionBehaviour(Class enum_, ITextComponent label, SmartTileEntity te, ValueBoxTransform slot) { super(label, te, slot); options = enum_.getEnumConstants(); between(0, options.length - 1); diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/scrollvalue/ScrollValueBehaviour.java b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/scrollvalue/ScrollValueBehaviour.java index 8724e6501..9b03595fd 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/scrollvalue/ScrollValueBehaviour.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/scrollvalue/ScrollValueBehaviour.java @@ -13,6 +13,7 @@ import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.text.ITextComponent; public class ScrollValueBehaviour extends TileEntityBehaviour { @@ -27,7 +28,7 @@ public class ScrollValueBehaviour extends TileEntityBehaviour { public int scrollableValue; int ticksUntilScrollPacket; boolean forceClientState; - String label; + ITextComponent label; Consumer callback; Consumer clientCallback; Function formatter; @@ -35,7 +36,7 @@ public class ScrollValueBehaviour extends TileEntityBehaviour { Function step; boolean needsWrench; - public ScrollValueBehaviour(String label, SmartTileEntity te, ValueBoxTransform slot) { + public ScrollValueBehaviour(ITextComponent label, SmartTileEntity te, ValueBoxTransform slot) { super(te); this.setLabel(label); slotPositioning = slot; @@ -166,7 +167,7 @@ public class ScrollValueBehaviour extends TileEntityBehaviour { return slotPositioning.testHit(state, localHit); } - public void setLabel(String label) { + public void setLabel(ITextComponent label) { this.label = label; } diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/scrollvalue/ScrollValueRenderer.java b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/scrollvalue/ScrollValueRenderer.java index 64aeb6d60..116b4aee4 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/scrollvalue/ScrollValueRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/scrollvalue/ScrollValueRenderer.java @@ -18,6 +18,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.text.ITextComponent; public class ScrollValueRenderer { @@ -55,7 +56,7 @@ public class ScrollValueRenderer { AxisAlignedBB bb = new AxisAlignedBB(Vector3d.ZERO, Vector3d.ZERO).grow(.5f) .contract(0, 0, -.5f) .offset(0, 0, -.125f); - String label = behaviour.label; + ITextComponent label = behaviour.label; ValueBox box; if (behaviour instanceof ScrollOptionBehaviour) { diff --git a/src/main/java/com/simibubi/create/foundation/utility/Lang.java b/src/main/java/com/simibubi/create/foundation/utility/Lang.java index 479ae60e0..85db137ba 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/Lang.java +++ b/src/main/java/com/simibubi/create/foundation/utility/Lang.java @@ -11,8 +11,8 @@ import net.minecraft.util.text.TranslationTextComponent; public class Lang { - public static String translate(String key, Object... args) { - return createTranslationTextComponent(key, args).getFormattedText(); + public static TranslationTextComponent translate(String key, Object... args) { + return createTranslationTextComponent(key, args); } public static TranslationTextComponent createTranslationTextComponent(String key, Object... args) { @@ -23,8 +23,8 @@ public class Lang { player.sendStatusMessage(createTranslationTextComponent(key, args), true); } - public static List translatedOptions(String prefix, String... keys) { - List result = new ArrayList<>(keys.length); + public static List translatedOptions(String prefix, String... keys) { + List result = new ArrayList<>(keys.length); for (String key : keys) { result.add(translate(prefix + "." + key)); } diff --git a/src/main/java/com/simibubi/create/foundation/worldgen/OxidizingBlock.java b/src/main/java/com/simibubi/create/foundation/worldgen/OxidizingBlock.java index 76dd50eb2..bd799f370 100644 --- a/src/main/java/com/simibubi/create/foundation/worldgen/OxidizingBlock.java +++ b/src/main/java/com/simibubi/create/foundation/worldgen/OxidizingBlock.java @@ -1,7 +1,6 @@ package com.simibubi.create.foundation.worldgen; import com.simibubi.create.content.curiosities.tools.SandPaperItem; -import com.simibubi.create.content.palettes.MetalBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 549553b12..b22a85caa 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -13,4 +13,6 @@ public net.minecraft.world.server.ChunkManager field_219253_g #chunksToUnload # ChunkStatus public-f net.minecraft.world.chunk.ChunkStatus field_222617_m #FULL public net.minecraft.world.chunk.ChunkStatus$IGenerationWorker -public net.minecraft.world.chunk.ChunkStatus$ILoadingWorker \ No newline at end of file +public net.minecraft.world.chunk.ChunkStatus$ILoadingWorker + +public net.minecraft.client.gui.FontRenderer func_238419_a_(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/gui/fonts/Font; # getFontStorage \ No newline at end of file