Even more porty

This commit is contained in:
grimmauld 2020-09-22 21:17:11 +02:00
parent 83c64121eb
commit fe92f8fb41
45 changed files with 259 additions and 254 deletions

View file

@ -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.RedstoneLinkBlock;
import com.simibubi.create.content.logistics.block.redstone.RedstoneLinkGenerator; import com.simibubi.create.content.logistics.block.redstone.RedstoneLinkGenerator;
import com.simibubi.create.content.logistics.block.redstone.StockpileSwitchBlock; 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.SchematicTableBlock;
import com.simibubi.create.content.schematics.block.SchematicannonBlock; import com.simibubi.create.content.schematics.block.SchematicannonBlock;
import com.simibubi.create.foundation.config.StressConfigDefaults; import com.simibubi.create.foundation.config.StressConfigDefaults;

View file

@ -44,6 +44,7 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional; 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) { private void spawnAirFlow(float verticalStart, float verticalEnd, float motion, float drag) {
AirParticleData airParticleData = new AirParticleData(drag, motion); AirParticleData airParticleData = new AirParticleData(drag, motion);
Vector3d origin = new Vector3d(pos); Vector3d origin = Vector3d.of(pos);
float xOff = Create.random.nextFloat() * .5f + .25f; float xOff = Create.random.nextFloat() * .5f + .25f;
float zOff = Create.random.nextFloat() * .5f + .25f; float zOff = Create.random.nextFloat() * .5f + .25f;
Vector3d v = origin.add(xOff, verticalStart, zOff); Vector3d v = origin.add(xOff, verticalStart, zOff);
@ -324,7 +325,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
BlockState stateBelow = world.getBlockState(pos.down()); BlockState stateBelow = world.getBlockState(pos.down());
if (stateBelow.getBlock() instanceof FunnelBlock) { if (stateBelow.getBlock() instanceof FunnelBlock) {
if (stateBelow.has(BrassFunnelBlock.POWERED) && stateBelow.get(BrassFunnelBlock.POWERED)) if (stateBelow.method_28500(BrassFunnelBlock.POWERED).orElse(false))
return false; return false;
if (stateBelow.get(BrassFunnelBlock.FACING) != Direction.UP) if (stateBelow.get(BrassFunnelBlock.FACING) != Direction.UP)
return false; return false;
@ -373,7 +374,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
private boolean handleUpwardOutput(boolean simulate) { private boolean handleUpwardOutput(boolean simulate) {
BlockState stateAbove = world.getBlockState(pos.up()); BlockState stateAbove = world.getBlockState(pos.up());
if (stateAbove.getBlock() instanceof FunnelBlock) { 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) { if (!powered && stateAbove.get(BrassFunnelBlock.FACING) == Direction.DOWN) {
ItemStack remainder = FunnelBlock.tryInsert(world, pos.up(), item, simulate); ItemStack remainder = FunnelBlock.tryInsert(world, pos.up(), item, simulate);
if (remainder.isEmpty()) { if (remainder.isEmpty()) {
@ -414,7 +415,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
return remainder.isEmpty(); return remainder.isEmpty();
} }
if (Block.hasSolidSide(stateAbove, world, pos.up(), Direction.DOWN)) if (BlockHelper.hasBlockSolidSide(stateAbove, world, pos.up(), Direction.DOWN))
return false; return false;
if (!inputChutes.isEmpty()) if (!inputChutes.isEmpty())
return false; return false;
@ -630,10 +631,10 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
} }
@Override @Override
public boolean addToGoggleTooltip(List<String> tooltip, boolean isPlayerSneaking) { public boolean addToGoggleTooltip(List<ITextComponent> tooltip, boolean isPlayerSneaking) {
tooltip.add(spacing + TextFormatting.GOLD + "Pull: " + TextFormatting.WHITE + pull); tooltip.add(ITextComponent.of(spacing + TextFormatting.GOLD + "Pull: " + TextFormatting.WHITE + pull));
tooltip.add(spacing + TextFormatting.GOLD + "Push: " + TextFormatting.WHITE + push); tooltip.add(ITextComponent.of(spacing + TextFormatting.GOLD + "Push: " + TextFormatting.WHITE + push));
tooltip.add(TextFormatting.YELLOW + "-> Item Motion: " + TextFormatting.WHITE + getItemMotion()); tooltip.add(ITextComponent.of(TextFormatting.YELLOW + "-> Item Motion: " + TextFormatting.WHITE + getItemMotion()));
return true; return true;
} }

View file

@ -111,7 +111,7 @@ public class DepotBlock extends Block implements ITE<DepotTileEntity> {
@Override @Override
public void onLanded(IBlockReader worldIn, Entity entityIn) { public void onLanded(IBlockReader worldIn, Entity entityIn) {
super.onLanded(worldIn, entityIn); super.onLanded(worldIn, entityIn);
if (!AllBlocks.DEPOT.has(worldIn.getBlockState(entityIn.getPosition()))) if (!AllBlocks.DEPOT.has(worldIn.getBlockState(entityIn.getBlockPos())))
return; return;
if (!(entityIn instanceof ItemEntity)) if (!(entityIn instanceof ItemEntity))
return; return;
@ -121,7 +121,7 @@ public class DepotBlock extends Block implements ITE<DepotTileEntity> {
return; return;
ItemEntity itemEntity = (ItemEntity) entityIn; ItemEntity itemEntity = (ItemEntity) entityIn;
DirectBeltInputBehaviour inputBehaviour = DirectBeltInputBehaviour inputBehaviour =
TileEntityBehaviour.get(worldIn, entityIn.getPosition(), DirectBeltInputBehaviour.TYPE); TileEntityBehaviour.get(worldIn, entityIn.getBlockPos(), DirectBeltInputBehaviour.TYPE);
if (inputBehaviour == null) if (inputBehaviour == null)
return; return;
ItemStack remainder = inputBehaviour.handleInsertion(itemEntity.getItem(), Direction.DOWN, false); ItemStack remainder = inputBehaviour.handleInsertion(itemEntity.getItem(), Direction.DOWN, false);

View file

@ -12,7 +12,6 @@ import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.ItemRenderer; 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.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
@ -20,6 +19,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.vector.Vector3f;
public class DepotRenderer extends SafeTileEntityRenderer<DepotTileEntity> { public class DepotRenderer extends SafeTileEntityRenderer<DepotTileEntity> {

View file

@ -94,11 +94,6 @@ public class AdjustableRepeaterTileEntity extends SmartTileEntity {
updateState(powered, powering, atMax, atMin); updateState(powered, powering, atMax, atMin);
} }
@Override
public boolean hasFastRenderer() {
return true;
}
protected void updateState(boolean powered, boolean powering, boolean atMax, boolean atMin) { protected void updateState(boolean powered, boolean powering, boolean atMax, boolean atMin) {
if (!charging && powered) if (!charging && powered)
charging = true; charging = true;

View file

@ -34,9 +34,9 @@ public class BeltFunnelGenerator extends SpecialBlockStateGen {
public <T extends Block> ModelFile getModel(DataGenContext<Block, T> ctx, RegistrateBlockstateProvider prov, public <T extends Block> ModelFile getModel(DataGenContext<Block, T> ctx, RegistrateBlockstateProvider prov,
BlockState state) { BlockState state) {
boolean pushing = state.get(BeltFunnelBlock.PUSHING); 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) String shapeName = state.get(BeltFunnelBlock.SHAPE)
.getName(); .getString();
String pushingSuffix = (pushing ? "push" : "pull") ; String pushingSuffix = (pushing ? "push" : "pull") ;
String poweredSuffix = powered ? "_powered" : ""; String poweredSuffix = powered ? "_powered" : "";

View file

@ -10,6 +10,7 @@ import com.simibubi.create.foundation.block.ProperDirectionalBlock;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour;
import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -177,9 +178,9 @@ public abstract class FunnelBlock extends ProperDirectionalBlock implements ITE<
@Nullable @Nullable
public static Direction getFunnelFacing(BlockState state) { public static Direction getFunnelFacing(BlockState state) {
if (state.has(FACING)) if (BlockHelper.hasBlockStateProperty(state, FACING))
return state.get(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 state.get(BlockStateProperties.HORIZONTAL_FACING);
return null; return null;
} }

View file

@ -10,7 +10,7 @@ import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; 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.minecraft.world.World;
import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemHandlerHelper;
@ -31,8 +31,8 @@ public class FunnelMovementBehaviour extends MovementBehaviour {
} }
@Override @Override
public Vec3d getActiveAreaOffset(MovementContext context) { public Vector3d getActiveAreaOffset(MovementContext context) {
return new Vec3d(FunnelBlock.getFunnelFacing(context.state) return Vector3d.of(FunnelBlock.getFunnelFacing(context.state)
.getDirectionVec()).scale(.65); .getDirectionVec()).scale(.65);
} }

View file

@ -51,7 +51,7 @@ public class FunnelTileEntity extends SmartTileEntity {
BlockState state = getBlockState(); BlockState state = getBlockState();
if (!FunnelBlock.isFunnel(state)) if (!FunnelBlock.isFunnel(state))
return Mode.INVALID; return Mode.INVALID;
if (state.has(BlockStateProperties.POWERED) && state.get(BlockStateProperties.POWERED)) if (state.method_28500(BlockStateProperties.POWERED).orElse(false))
return Mode.PAUSED; return Mode.PAUSED;
if (FunnelBlock.getFunnelFacing(state) == Direction.UP && autoExtractor.hasInventory()) if (FunnelBlock.getFunnelFacing(state) == Direction.UP && autoExtractor.hasInventory())
return Mode.HOPPER; return Mode.HOPPER;

View file

@ -88,7 +88,7 @@ public abstract class HorizontalInteractionFunnelBlock extends HorizontalBlock i
BlockPos pos, BlockPos p_196271_6_) { BlockPos pos, BlockPos p_196271_6_) {
if (!canStillInteract(state, world, pos)) { if (!canStillInteract(state, world, pos)) {
BlockState parentState = parent.getDefaultState(); BlockState parentState = parent.getDefaultState();
if (state.has(POWERED) && state.get(POWERED)) if (state.method_28500(POWERED).orElse(false))
parentState = parentState.with(POWERED, true); parentState = parentState.with(POWERED, true);
return parentState.with(FunnelBlock.FACING, state.get(HORIZONTAL_FACING)); return parentState.with(FunnelBlock.FACING, state.get(HORIZONTAL_FACING));
} }

View file

@ -7,6 +7,7 @@ import static com.simibubi.create.foundation.gui.AllGuiTextures.PLAYER_INVENTORY
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.logistics.packet.ConfigureFlexcratePacket; import com.simibubi.create.content.logistics.packet.ConfigureFlexcratePacket;
import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen; import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen;
@ -64,7 +65,7 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen<Adjustabl
} }
@Override @Override
protected void renderWindow(int mouseX, int mouseY, float partialTicks) { protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
int crateLeft = guiLeft + 100; int crateLeft = guiLeft + 100;
int crateTop = guiTop; int crateTop = guiTop;
int invLeft = guiLeft + 50; int invLeft = guiLeft + 50;
@ -78,14 +79,13 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen<Adjustabl
} else } else
FLEXCRATE.draw(this, crateLeft, crateTop); FLEXCRATE.draw(this, crateLeft, crateTop);
font.drawStringWithShadow(title, crateLeft - 3 + (FLEXCRATE.width - font.getStringWidth(title)) / 2, textRenderer.drawWithShadow(matrixStack, title, crateLeft - 3 + (FLEXCRATE.width - textRenderer.getStringWidth(title)) / 2,
crateTop + 10, hFontColor); crateTop + 10, hFontColor);
String itemCount = "" + te.itemCount; String itemCount = "" + te.itemCount;
font.drawString(itemCount, guiLeft + 100 + 53 - font.getStringWidth(itemCount), crateTop + 107, fontColor); textRenderer.draw(matrixStack, itemCount, guiLeft + 100 + 53 - textRenderer.getStringWidth(itemCount), crateTop + 107, fontColor);
PLAYER_INVENTORY.draw(this, invLeft, invTop); PLAYER_INVENTORY.draw(this, invLeft, invTop);
font.drawString(playerInventory.getDisplayName() textRenderer.draw(matrixStack, playerInventory.getDisplayName(), invLeft + 7, invTop + 6, 0x666666);
.getFormattedText(), invLeft + 7, invTop + 6, 0x666666);
for (int slot = 0; slot < (container.doubleCrate ? 32 : 16); slot++) { for (int slot = 0; slot < (container.doubleCrate ? 32 : 16); slot++) {
if (allowedItems.getState() > slot * 64) if (allowedItems.getState() > slot * 64)
@ -111,8 +111,8 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen<Adjustabl
public void tick() { public void tick() {
super.tick(); super.tick();
if (!AllBlocks.ADJUSTABLE_CRATE.has(minecraft.world.getBlockState(te.getPos()))) if (!AllBlocks.ADJUSTABLE_CRATE.has(client.world.getBlockState(te.getPos())))
minecraft.displayGuiScreen(null); client.displayGuiScreen(null);
if (lastModification >= 0) if (lastModification >= 0)
lastModification++; lastModification++;

View file

@ -338,7 +338,7 @@ public abstract class ArmInteractionPoint {
FilteringBehaviour filtering = TileEntityBehaviour.get(world, pos, FilteringBehaviour.TYPE); FilteringBehaviour filtering = TileEntityBehaviour.get(world, pos, FilteringBehaviour.TYPE);
InvManipulationBehaviour inserter = TileEntityBehaviour.get(world, pos, InvManipulationBehaviour.TYPE); InvManipulationBehaviour inserter = TileEntityBehaviour.get(world, pos, InvManipulationBehaviour.TYPE);
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
if (state.has(BlockStateProperties.POWERED) && state.get(BlockStateProperties.POWERED)) if (state.method_28500(BlockStateProperties.POWERED).orElse(false))
return stack; return stack;
if (inserter == null) if (inserter == null)
return stack; return stack;

View file

@ -63,10 +63,9 @@ public class ArmInteractionPointHandler {
if (player != null) { if (player != null) {
String key = selected.mode == Mode.DEPOSIT ? "mechanical_arm.deposit_to" : "mechanical_arm.extract_from"; String key = selected.mode == Mode.DEPOSIT ? "mechanical_arm.deposit_to" : "mechanical_arm.extract_from";
TextFormatting colour = selected.mode == Mode.DEPOSIT ? TextFormatting.GOLD : TextFormatting.AQUA; TextFormatting colour = selected.mode == Mode.DEPOSIT ? TextFormatting.GOLD : TextFormatting.AQUA;
String translatedBlock = new TranslationTextComponent(selected.state.getBlock() TranslationTextComponent translatedBlock = new TranslationTextComponent(selected.state.getBlock()
.getTranslationKey()).getFormattedText(); .getTranslationKey());
player.sendStatusMessage( player.sendStatusMessage((Lang.translate(key, translatedBlock.formatted(TextFormatting.WHITE, colour)).formatted(colour)),
new StringTextComponent(colour + Lang.translate(key, TextFormatting.WHITE + translatedBlock + colour)),
true); true);
} }
@ -101,8 +100,7 @@ public class ArmInteractionPointHandler {
} }
if (removed > 0) if (removed > 0)
Minecraft.getInstance().player.sendStatusMessage(new StringTextComponent( Minecraft.getInstance().player.sendStatusMessage(Lang.translate("mechanical_arm.points_outside_range", removed).formatted(TextFormatting.RED), true);
TextFormatting.RED + Lang.translate("mechanical_arm.points_outside_range", removed)), true);
AllPackets.channel.sendToServer(new ArmPlacementPacket(currentSelection, pos)); AllPackets.channel.sendToServer(new ArmPlacementPacket(currentSelection, pos));
currentSelection.clear(); currentSelection.clear();

View file

@ -85,7 +85,7 @@ public class ArmTileEntity extends KineticTileEntity {
public void addBehaviours(List<TileEntityBehaviour> behaviours) { public void addBehaviours(List<TileEntityBehaviour> behaviours) {
super.addBehaviours(behaviours); super.addBehaviours(behaviours);
selectionMode = new ScrollOptionBehaviour<>(SelectionMode.class, selectionMode = new ScrollOptionBehaviour<SelectionMode>(SelectionMode.class,
Lang.translate("logistics.when_multiple_outputs_available"), this, new SelectionModeValueBox()); Lang.translate("logistics.when_multiple_outputs_available"), this, new SelectionModeValueBox());
selectionMode.requiresWrench(); selectionMode.requiresWrench();
behaviours.add(selectionMode); behaviours.add(selectionMode);
@ -137,7 +137,7 @@ public class ArmTileEntity extends KineticTileEntity {
if (!(armInteractionPoint instanceof Jukebox)) if (!(armInteractionPoint instanceof Jukebox))
continue; continue;
BlockState state = world.getBlockState(armInteractionPoint.pos); 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 true;
} }
return false; return false;
@ -173,7 +173,7 @@ public class ArmTileEntity extends KineticTileEntity {
protected boolean isOnCeiling() { protected boolean isOnCeiling() {
BlockState state = getBlockState(); 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 @Nullable

View file

@ -11,6 +11,7 @@ import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.ITextComponent;
public class AnalogLeverTileEntity extends SmartTileEntity implements IHaveGoggleInformation { public class AnalogLeverTileEntity extends SmartTileEntity implements IHaveGoggleInformation {
@ -57,11 +58,6 @@ public class AnalogLeverTileEntity extends SmartTileEntity implements IHaveGoggl
public void addBehaviours(List<TileEntityBehaviour> behaviours) { public void addBehaviours(List<TileEntityBehaviour> behaviours) {
} }
@Override
public boolean hasFastRenderer() {
return true;
}
public void changeState(boolean back) { public void changeState(boolean back) {
int prevState = state; int prevState = state;
state += back ? -1 : 1; state += back ? -1 : 1;
@ -72,8 +68,8 @@ public class AnalogLeverTileEntity extends SmartTileEntity implements IHaveGoggl
} }
@Override @Override
public boolean addToGoggleTooltip(List<String> tooltip, boolean isPlayerSneaking) { public boolean addToGoggleTooltip(List<ITextComponent> tooltip, boolean isPlayerSneaking) {
tooltip.add(spacing + Lang.translate("tooltip.analogStrength", this.state)); tooltip.add(ITextComponent.of(spacing).copy().append(Lang.translate("tooltip.analogStrength", this.state)));
return true; return true;
} }

View file

@ -13,6 +13,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.text.Style;
public class NixieTubeRenderer extends SafeTileEntityRenderer<NixieTubeTileEntity> { public class NixieTubeRenderer extends SafeTileEntityRenderer<NixieTubeTileEntity> {
@ -53,7 +54,7 @@ public class NixieTubeRenderer extends SafeTileEntityRenderer<NixieTubeTileEntit
private void drawTube(MatrixStack ms, IRenderTypeBuffer buffer, char c, float height) { private void drawTube(MatrixStack ms, IRenderTypeBuffer buffer, char c, float height) {
FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer; FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer;
float charWidth = fontRenderer.getCharWidth(c); float charWidth = getCharWidth(c, fontRenderer);
float shadowOffset = .5f; float shadowOffset = .5f;
float flicker = r.nextFloat(); float flicker = r.nextFloat();
int brightColor = 0xFF982B; int brightColor = 0xFF982B;
@ -86,4 +87,7 @@ public class NixieTubeRenderer extends SafeTileEntityRenderer<NixieTubeTileEntit
.getModel(), buffer, false, 0, 15728880); .getModel(), buffer, false, 0, 15728880);
} }
private static float getCharWidth(char p_211125_1_, FontRenderer fontRenderer) {
return p_211125_1_ == 167 ? 0.0F : fontRenderer.getFontStorage(Style.DEFAULT_FONT_ID).getGlyph(p_211125_1_).getAdvance(false);
}
} }

View file

@ -2,6 +2,7 @@ package com.simibubi.create.content.logistics.block.redstone;
import com.simibubi.create.foundation.tileEntity.SyncedTileEntity; import com.simibubi.create.foundation.tileEntity.SyncedTileEntity;
import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
@ -32,10 +33,10 @@ public class NixieTubeTileEntity extends SyncedTileEntity {
} }
@Override @Override
public void read(CompoundNBT nbt) { public void fromTag(BlockState state, CompoundNBT nbt) {
tube1 = (char) nbt.getInt("tube1"); tube1 = (char) nbt.getInt("tube1");
tube2 = (char) nbt.getInt("tube2"); tube2 = (char) nbt.getInt("tube2");
super.read(nbt); super.fromTag(state, nbt);
} }
} }

View file

@ -6,6 +6,7 @@ import com.simibubi.create.content.contraptions.wrench.IWrenchable;
import com.simibubi.create.content.logistics.block.funnel.FunnelBlock; import com.simibubi.create.content.logistics.block.funnel.FunnelBlock;
import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.block.ProperDirectionalBlock; import com.simibubi.create.foundation.block.ProperDirectionalBlock;
import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -167,7 +168,7 @@ public class RedstoneLinkBlock extends ProperDirectionalBlock implements ITE<Red
BlockState neighbour = worldIn.getBlockState(neighbourPos); BlockState neighbour = worldIn.getBlockState(neighbourPos);
if (FunnelBlock.isFunnel(neighbour)) if (FunnelBlock.isFunnel(neighbour))
return true; return true;
return Block.hasSolidSide(neighbour, worldIn, neighbourPos, state.get(FACING)); return BlockHelper.hasBlockSolidSide(neighbour, worldIn, neighbourPos, state.get(FACING));
} }
@Override @Override

View file

@ -113,8 +113,8 @@ public class RedstoneLinkTileEntity extends SmartTileEntity {
if (receivedSignalChanged) { if (receivedSignalChanged) {
Direction attachedFace = blockState.get(RedstoneLinkBlock.FACING).getOpposite(); Direction attachedFace = blockState.get(RedstoneLinkBlock.FACING).getOpposite();
BlockPos attachedPos = pos.offset(attachedFace); BlockPos attachedPos = pos.offset(attachedFace);
world.notifyNeighbors(pos, world.getBlockState(pos).getBlock()); world.updateNeighbors(pos, world.getBlockState(pos).getBlock());
world.notifyNeighbors(attachedPos, world.getBlockState(attachedPos).getBlock()); world.updateNeighbors(attachedPos, world.getBlockState(attachedPos).getBlock());
} }
} }

View file

@ -4,6 +4,7 @@ import static com.simibubi.create.foundation.gui.AllGuiTextures.STOCKSWITCH;
import java.util.Arrays; import java.util.Arrays;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.logistics.packet.ConfigureStockswitchPacket; import com.simibubi.create.content.logistics.packet.ConfigureStockswitchPacket;
@ -16,6 +17,8 @@ import com.simibubi.create.foundation.networking.AllPackets;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent;
public class StockpileSwitchScreen extends AbstractSimiScreen { public class StockpileSwitchScreen extends AbstractSimiScreen {
@ -24,13 +27,13 @@ public class StockpileSwitchScreen extends AbstractSimiScreen {
private ScrollInput onAbove; private ScrollInput onAbove;
private Label onAboveLabel; private Label onAboveLabel;
private final String title = Lang.translate("gui.stockpile_switch.title"); private final IFormattableTextComponent title = Lang.translate("gui.stockpile_switch.title");
private final String startAbove = Lang.translate("gui.stockpile_switch.startAbove"); private final IFormattableTextComponent startAbove = Lang.translate("gui.stockpile_switch.startAbove");
private final String startAt = Lang.translate("gui.stockpile_switch.startAt"); private final IFormattableTextComponent startAt = Lang.translate("gui.stockpile_switch.startAt");
private final String stopBelow = Lang.translate("gui.stockpile_switch.stopBelow"); private final IFormattableTextComponent stopBelow = Lang.translate("gui.stockpile_switch.stopBelow");
private final String stopAt = Lang.translate("gui.stockpile_switch.stopAt"); private final IFormattableTextComponent stopAt = Lang.translate("gui.stockpile_switch.stopAt");
private final String lowerLimit = Lang.translate("gui.stockpile_switch.lowerLimit"); private final IFormattableTextComponent lowerLimit = Lang.translate("gui.stockpile_switch.lowerLimit");
private final String upperLimit = Lang.translate("gui.stockpile_switch.upperLimit"); private final IFormattableTextComponent upperLimit = Lang.translate("gui.stockpile_switch.upperLimit");
private final ItemStack renderedItem = new ItemStack(AllBlocks.STOCKPILE_SWITCH.get()); private final ItemStack renderedItem = new ItemStack(AllBlocks.STOCKPILE_SWITCH.get());
private int lastModification; private int lastModification;
@ -83,26 +86,26 @@ public class StockpileSwitchScreen extends AbstractSimiScreen {
} }
@Override @Override
protected void renderWindow(int mouseX, int mouseY, float partialTicks) { protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
int hFontColor = 0xD3CBBE; int hFontColor = 0xD3CBBE;
int fontColor = 0x4B3A22; int fontColor = 0x4B3A22;
STOCKSWITCH.draw(this, guiLeft, guiTop); STOCKSWITCH.draw(this, guiLeft, guiTop);
textRenderer.drawWithShadow(title, guiLeft - 3 + (STOCKSWITCH.width - textRenderer.getStringWidth(title)) / 2, textRenderer.drawWithShadow(matrixStack, title, guiLeft - 3 + (STOCKSWITCH.width - textRenderer.getWidth(title)) / 2,
guiTop + 10, hFontColor); guiTop + 10, hFontColor);
textRenderer.draw(onAbove.getState() == 100 ? startAt : startAbove, guiLeft + 13, guiTop + 55, fontColor); textRenderer.draw(matrixStack, onAbove.getState() == 100 ? startAt : startAbove, guiLeft + 13, guiTop + 55, fontColor);
textRenderer.draw(offBelow.getState() == 0 ? stopAt : stopBelow, guiLeft + 13, guiTop + 72, fontColor); textRenderer.draw(matrixStack, offBelow.getState() == 0 ? stopAt : stopBelow, guiLeft + 13, guiTop + 72, fontColor);
AllGuiTextures sprite = AllGuiTextures.STOCKSWITCH_INTERVAL; AllGuiTextures sprite = AllGuiTextures.STOCKSWITCH_INTERVAL;
float lowerBound = offBelow.getState() / 100f * (sprite.width - 20) + 10; float lowerBound = offBelow.getState() / 100f * (sprite.width - 20) + 10;
float upperBound = onAbove.getState() / 100f * (sprite.width - 20) + 10; float upperBound = onAbove.getState() / 100f * (sprite.width - 20) + 10;
sprite.bind(); sprite.bind();
drawTexture((int) (guiLeft + lowerBound), guiTop + 26, (int) (sprite.startX + lowerBound), sprite.startY, drawTexture(matrixStack, (int) (guiLeft + lowerBound), guiTop + 26, (int) (sprite.startX + lowerBound), sprite.startY,
(int) (upperBound - lowerBound), sprite.height); (int) (upperBound - lowerBound), sprite.height);
sprite = AllGuiTextures.STOCKSWITCH_INTERVAL_END; sprite = AllGuiTextures.STOCKSWITCH_INTERVAL_END;
sprite.bind(); sprite.bind();
drawTexture((int) (guiLeft + upperBound), guiTop + 26, (int) (sprite.startX + upperBound), sprite.startY, drawTexture(matrixStack, (int) (guiLeft + upperBound), guiTop + 26, (int) (sprite.startX + upperBound), sprite.startY,
(int) (sprite.width - upperBound), sprite.height); (int) (sprite.width - upperBound), sprite.height);
AllGuiTextures.STOCKSWITCH_BOUND_LEFT.draw(this, (int) (guiLeft + lowerBound) - 1, guiTop + 24); AllGuiTextures.STOCKSWITCH_BOUND_LEFT.draw(this, (int) (guiLeft + lowerBound) - 1, guiTop + 24);

View file

@ -65,7 +65,7 @@ public class StockpileSwitchTileEntity extends SmartTileEntity {
world.setBlockState(pos, getBlockState().with(StockpileSwitchBlock.INDICATOR, 0), 3); world.setBlockState(pos, getBlockState().with(StockpileSwitchBlock.INDICATOR, 0), 3);
currentLevel = -1; currentLevel = -1;
powered = false; powered = false;
world.notifyNeighbors(pos, getBlockState().getBlock()); world.updateNeighbors(pos, getBlockState().getBlock());
} }
return; return;
} }
@ -101,7 +101,7 @@ public class StockpileSwitchTileEntity extends SmartTileEntity {
displayLevel = (int) (currentLevel * 6); displayLevel = (int) (currentLevel * 6);
world.setBlockState(pos, getBlockState().with(StockpileSwitchBlock.INDICATOR, displayLevel), update ? 3 : 2); world.setBlockState(pos, getBlockState().with(StockpileSwitchBlock.INDICATOR, displayLevel), update ? 3 : 2);
if (update) if (update)
world.notifyNeighbors(pos, getBlockState().getBlock()); world.updateNeighbors(pos, getBlockState().getBlock());
} }
@Override @Override

View file

@ -101,7 +101,7 @@ public class CardboardBoxItem extends Item {
if (compoundnbt.contains("Address", Constants.NBT.TAG_STRING)) { if (compoundnbt.contains("Address", Constants.NBT.TAG_STRING)) {
tooltip.add(new StringTextComponent("-> " + compoundnbt.getString("Address")) tooltip.add(new StringTextComponent("-> " + compoundnbt.getString("Address"))
.applyTextStyle(TextFormatting.GOLD)); .formatted(TextFormatting.GOLD));
} }
if (!compoundnbt.contains("Items", Constants.NBT.TAG_LIST)) if (!compoundnbt.contains("Items", Constants.NBT.TAG_LIST))
@ -117,16 +117,15 @@ public class CardboardBoxItem extends Item {
++j; ++j;
if (i <= 4) { if (i <= 4) {
++i; ++i;
ITextComponent itextcomponent = itemstack.getDisplayName().deepCopy(); ITextComponent itextcomponent = itemstack.getDisplayName();
itextcomponent.appendText(" x").appendText(String.valueOf(itemstack.getCount())) tooltip.add(itextcomponent.copy().append(" x").append(String.valueOf(itemstack.getCount()))
.applyTextStyle(TextFormatting.GRAY); .formatted(TextFormatting.GRAY));
tooltip.add(itextcomponent);
} }
} }
if (j - i > 0) { if (j - i > 0) {
tooltip.add((new TranslationTextComponent("container.shulkerBox.more", j - i)) tooltip.add((new TranslationTextComponent("container.shulkerBox.more", j - i))
.applyTextStyle(TextFormatting.ITALIC)); .formatted(TextFormatting.ITALIC));
} }
} }

View file

@ -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.IconButton;
import com.simibubi.create.foundation.gui.widgets.Indicator; import com.simibubi.create.foundation.gui.widgets.Indicator;
import com.simibubi.create.foundation.gui.widgets.Indicator.State; 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.ItemDescription.Palette;
import com.simibubi.create.foundation.item.TooltipHelper; import com.simibubi.create.foundation.item.TooltipHelper;
import com.simibubi.create.foundation.networking.AllPackets; 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.gui.widget.Widget;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> extends AbstractSimiContainerScreen<F> { public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> extends AbstractSimiContainerScreen<F> {
@ -106,12 +106,12 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
for (IconButton button : tooltipButtons) { for (IconButton button : tooltipButtons) {
if (!button.getToolTip().isEmpty()) { if (!button.getToolTip().isEmpty()) {
button.setToolTip(button.getToolTip().get(0)); 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()) { if (hasShiftDown()) {
List<String> tooltipDescriptions = getTooltipDescriptions(); List<IFormattableTextComponent> tooltipDescriptions = getTooltipDescriptions();
for (int i = 0; i < tooltipButtons.size(); i++) for (int i = 0; i < tooltipButtons.size(); i++)
fillToolTip(tooltipButtons.get(i), tooltipDescriptions.get(i)); fillToolTip(tooltipButtons.get(i), tooltipDescriptions.get(i));
} }
@ -121,11 +121,11 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
return Collections.emptyList(); return Collections.emptyList();
} }
protected List<String> getTooltipDescriptions() { protected List<IFormattableTextComponent> getTooltipDescriptions() {
return Collections.emptyList(); return Collections.emptyList();
} }
private void fillToolTip(IconButton button, String tooltip) { private void fillToolTip(IconButton button, ITextComponent tooltip) {
if (!button.isHovered()) if (!button.isHovered())
return; return;
List<ITextComponent> tip = button.getToolTip(); List<ITextComponent> tip = button.getToolTip();

View file

@ -51,7 +51,7 @@ public class AttributeFilterContainer extends AbstractFilterContainer {
super.init(); super.init();
ItemStack stack = new ItemStack(Items.NAME_TAG); ItemStack stack = new ItemStack(Items.NAME_TAG);
stack.setDisplayName( stack.setDisplayName(
new StringTextComponent("Selected Tags").applyTextStyles(TextFormatting.RESET, TextFormatting.BLUE)); new StringTextComponent("Selected Tags").formatted(TextFormatting.RESET, TextFormatting.BLUE));
filterInventory.setStackInSlot(1, stack); filterInventory.setStackInSlot(1, stack);
} }

View file

@ -2,10 +2,11 @@ package com.simibubi.create.content.logistics.item.filter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; 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.AttributeFilterContainer.WhitelistMode;
import com.simibubi.create.content.logistics.item.filter.FilterScreenPacket.Option; import com.simibubi.create.content.logistics.item.filter.FilterScreenPacket.Option;
import com.simibubi.create.foundation.gui.AllGuiTextures; 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.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterContainer> { public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterContainer> {
@ -31,20 +34,20 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
private Indicator whitelistDisIndicator, whitelistConIndicator, blacklistIndicator; private Indicator whitelistDisIndicator, whitelistConIndicator, blacklistIndicator;
private IconButton add; private IconButton add;
private String whitelistDisN = Lang.translate(PREFIX + "whitelist_disjunctive"); private ITextComponent whitelistDisN = Lang.translate(PREFIX + "whitelist_disjunctive");
private String whitelistDisDESC = Lang.translate(PREFIX + "whitelist_disjunctive.description"); private ITextComponent whitelistDisDESC = Lang.translate(PREFIX + "whitelist_disjunctive.description");
private String whitelistConN = Lang.translate(PREFIX + "whitelist_conjunctive"); private ITextComponent whitelistConN = Lang.translate(PREFIX + "whitelist_conjunctive");
private String whitelistConDESC = Lang.translate(PREFIX + "whitelist_conjunctive.description"); private ITextComponent whitelistConDESC = Lang.translate(PREFIX + "whitelist_conjunctive.description");
private String blacklistN = Lang.translate(PREFIX + "blacklist"); private ITextComponent blacklistN = Lang.translate(PREFIX + "blacklist");
private String blacklistDESC = Lang.translate(PREFIX + "blacklist.description"); private ITextComponent blacklistDESC = Lang.translate(PREFIX + "blacklist.description");
private String referenceH = Lang.translate(PREFIX + "add_reference_item"); private ITextComponent referenceH = Lang.translate(PREFIX + "add_reference_item");
private String noSelectedT = Lang.translate(PREFIX + "no_selected_attributes"); private ITextComponent noSelectedT = Lang.translate(PREFIX + "no_selected_attributes");
private String selectedT = Lang.translate(PREFIX + "selected_attributes"); private ITextComponent selectedT = Lang.translate(PREFIX + "selected_attributes");
private ItemStack lastItemScanned = ItemStack.EMPTY; private ItemStack lastItemScanned = ItemStack.EMPTY;
private List<ItemAttribute> attributesOfItem = new ArrayList<>(); private List<ItemAttribute> attributesOfItem = new ArrayList<>();
private List<String> selectedAttributes = new ArrayList<>(); private List<ITextComponent> selectedAttributes = new ArrayList<>();
private SelectionScrollInput attributeSelector; private SelectionScrollInput attributeSelector;
private Label attributeSelectorLabel; private Label attributeSelectorLabel;
@ -78,7 +81,7 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
attributeSelectorLabel = new Label(x + 40, y + 27, "").colored(0xF3EBDE).withShadow(); attributeSelectorLabel = new Label(x + 40, y + 27, "").colored(0xF3EBDE).withShadow();
attributeSelector = new SelectionScrollInput(x + 37, y + 24, 118, 14); attributeSelector = new SelectionScrollInput(x + 37, y + 24, 118, 14);
attributeSelector.forOptions(Arrays.asList("")); attributeSelector.forOptions(Collections.singletonList(StringTextComponent.EMPTY));
attributeSelector.calling(s -> { attributeSelector.calling(s -> {
}); });
referenceItemChanged(container.filterInventory.getStackInSlot(0)); referenceItemChanged(container.filterInventory.getStackInSlot(0));
@ -88,8 +91,8 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
selectedAttributes.clear(); selectedAttributes.clear();
selectedAttributes selectedAttributes
.add(TextFormatting.YELLOW + (container.selectedAttributes.isEmpty() ? noSelectedT : selectedT)); .add((container.selectedAttributes.isEmpty() ? noSelectedT : selectedT).copy().formatted(TextFormatting.YELLOW));
container.selectedAttributes.forEach(at -> selectedAttributes.add(TextFormatting.GRAY + "- " + at.format())); container.selectedAttributes.forEach(at -> selectedAttributes.add(new StringTextComponent("- ").append(at.format()).formatted(TextFormatting.GRAY)));
} }
@ -99,7 +102,7 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
if (stack.isEmpty()) { if (stack.isEmpty()) {
attributeSelector.active = false; attributeSelector.active = false;
attributeSelector.visible = false; attributeSelector.visible = false;
attributeSelectorLabel.text = TextFormatting.ITALIC + referenceH; attributeSelectorLabel.text = referenceH.copy().formatted(TextFormatting.ITALIC);
add.active = false; add.active = false;
attributeSelector.calling(s -> { attributeSelector.calling(s -> {
}); });
@ -107,11 +110,11 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
} }
add.active = true; add.active = true;
attributeSelector.titled(stack.getDisplayName().getFormattedText() + "..."); attributeSelector.titled(stack.getDisplayName().copy().append("..."));
attributesOfItem.clear(); attributesOfItem.clear();
for (ItemAttribute itemAttribute : ItemAttribute.types) for (ItemAttribute itemAttribute : ItemAttribute.types)
attributesOfItem.addAll(itemAttribute.listAttributesOf(stack, this.minecraft.world)); attributesOfItem.addAll(itemAttribute.listAttributesOf(stack, this.client.world));
List<String> options = attributesOfItem.stream().map(ItemAttribute::format).collect(Collectors.toList()); List<ITextComponent> options = attributesOfItem.stream().map(ItemAttribute::format).collect(Collectors.toList());
attributeSelector.forOptions(options); attributeSelector.forOptions(options);
attributeSelector.active = true; attributeSelector.active = true;
attributeSelector.visible = true; attributeSelector.visible = true;
@ -135,19 +138,19 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
} }
@Override @Override
public void renderWindowForeground(int mouseX, int mouseY, float partialTicks) { public void renderWindowForeground(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
ItemStack stack = container.filterInventory.getStackInSlot(1); ItemStack stack = container.filterInventory.getStackInSlot(1);
RenderSystem.pushMatrix(); matrixStack.push();
RenderSystem.translatef(0.0F, 0.0F, 32.0F); matrixStack.translate(0.0F, 0.0F, 32.0F);
this.setBlitOffset(200); this.setZOffset(200);
this.itemRenderer.zLevel = 200.0F; this.itemRenderer.zLevel = 200.0F;
this.itemRenderer.renderItemOverlayIntoGUI(font, stack, guiLeft + 59, guiTop + 56, this.itemRenderer.renderItemOverlayIntoGUI(textRenderer, stack, guiLeft + 59, guiTop + 56,
String.valueOf(selectedAttributes.size() - 1)); String.valueOf(selectedAttributes.size() - 1));
this.setBlitOffset(0); this.setZOffset(0);
this.itemRenderer.zLevel = 0.0F; this.itemRenderer.zLevel = 0.0F;
RenderSystem.popMatrix(); matrixStack.pop();
super.renderWindowForeground(mouseX, mouseY, partialTicks); super.renderWindowForeground(matrixStack, mouseX, mouseY, partialTicks);
} }
@Override @Override
@ -159,16 +162,16 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
} }
@Override @Override
protected void renderHoveredToolTip(int mouseX, int mouseY) { protected void drawMouseoverTooltip(MatrixStack matrixStack, int mouseX, int mouseY) {
if (this.minecraft.player.inventory.getItemStack().isEmpty() && this.hoveredSlot != null if (this.client.player.inventory.getItemStack().isEmpty() && this.hoveredSlot != null
&& this.hoveredSlot.getHasStack()) { && this.hoveredSlot.getHasStack()) {
if (this.hoveredSlot.slotNumber == 37) { if (this.hoveredSlot.slotNumber == 37) {
renderTooltip(selectedAttributes, mouseX, mouseY, font); renderTooltip(matrixStack, selectedAttributes, mouseX, mouseY);
return; return;
} }
this.renderTooltip(this.hoveredSlot.getStack(), mouseX, mouseY); this.renderTooltip(matrixStack, this.hoveredSlot.getStack(), mouseX, mouseY);
} }
super.renderHoveredToolTip(mouseX, mouseY); super.drawMouseoverTooltip(matrixStack, mouseX, mouseY);
} }
@Override @Override
@ -177,8 +180,8 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
} }
@Override @Override
protected List<String> getTooltipDescriptions() { protected List<IFormattableTextComponent> getTooltipDescriptions() {
return Arrays.asList(blacklistDESC, whitelistConDESC, whitelistDisDESC); return Arrays.asList(blacklistDESC.copy(), whitelistConDESC.copy(), whitelistDisDESC.copy());
} }
@Override @Override
@ -216,8 +219,8 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
AllPackets.channel.sendToServer(new FilterScreenPacket(Option.ADD_TAG, tag)); AllPackets.channel.sendToServer(new FilterScreenPacket(Option.ADD_TAG, tag));
container.selectedAttributes.add(itemAttribute); container.selectedAttributes.add(itemAttribute);
if (container.selectedAttributes.size() == 1) if (container.selectedAttributes.size() == 1)
selectedAttributes.set(0, TextFormatting.YELLOW + selectedT); selectedAttributes.set(0, selectedT.copy().formatted(TextFormatting.YELLOW));
selectedAttributes.add(TextFormatting.GRAY + "- " + itemAttribute.format()); selectedAttributes.add(new StringTextComponent("- ").append(itemAttribute.format()).formatted(TextFormatting.GRAY));
return true; return true;
} }
} }
@ -228,7 +231,7 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
@Override @Override
protected void contentsCleared() { protected void contentsCleared() {
selectedAttributes.clear(); selectedAttributes.clear();
selectedAttributes.add(TextFormatting.YELLOW + noSelectedT); selectedAttributes.add(noSelectedT.copy().formatted(TextFormatting.YELLOW));
if (!lastItemScanned.isEmpty()) if (!lastItemScanned.isEmpty())
add.active = true; add.active = true;
} }

View file

@ -71,7 +71,7 @@ public class FilterItem extends Item implements INamedContainerProvider {
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) { public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
if (!AllKeys.shiftDown()) { if (!AllKeys.shiftDown()) {
List<String> makeSummary = makeSummary(stack); List<ITextComponent> makeSummary = makeSummary(stack);
if (makeSummary.isEmpty()) if (makeSummary.isEmpty())
return; return;
ItemDescription.add(tooltip, " "); ItemDescription.add(tooltip, " ");
@ -79,28 +79,26 @@ public class FilterItem extends Item implements INamedContainerProvider {
} }
} }
private List<String> makeSummary(ItemStack filter) { private List<ITextComponent> makeSummary(ItemStack filter) {
List<String> list = new ArrayList<>(); List<ITextComponent> list = new ArrayList<>();
if (type == FilterType.REGULAR) { if (type == FilterType.REGULAR) {
ItemStackHandler filterItems = getFilterItems(filter); ItemStackHandler filterItems = getFilterItems(filter);
boolean blacklist = filter.getOrCreateTag() boolean blacklist = filter.getOrCreateTag()
.getBoolean("Blacklist"); .getBoolean("Blacklist");
list.add(TextFormatting.GOLD list.add((blacklist ? Lang.translate("gui.filter.blacklist") : Lang.translate("gui.filter.whitelist")).formatted(TextFormatting.GOLD));
+ (blacklist ? Lang.translate("gui.filter.blacklist") : Lang.translate("gui.filter.whitelist")));
int count = 0; int count = 0;
for (int i = 0; i < filterItems.getSlots(); i++) { for (int i = 0; i < filterItems.getSlots(); i++) {
if (count > 3) { if (count > 3) {
list.add(TextFormatting.DARK_GRAY + "- ..."); list.add(new StringTextComponent("- ...").formatted(TextFormatting.DARK_GRAY));
break; break;
} }
ItemStack filterStack = filterItems.getStackInSlot(i); ItemStack filterStack = filterItems.getStackInSlot(i);
if (filterStack.isEmpty()) if (filterStack.isEmpty())
continue; continue;
list.add(TextFormatting.GRAY + "- " + filterStack.getDisplayName() list.add(new StringTextComponent("- ").append(filterStack.getDisplayName()).formatted(TextFormatting.GRAY));
.getFormattedText());
count++; count++;
} }
@ -111,11 +109,11 @@ public class FilterItem extends Item implements INamedContainerProvider {
if (type == FilterType.ATTRIBUTE) { if (type == FilterType.ATTRIBUTE) {
WhitelistMode whitelistMode = WhitelistMode.values()[filter.getOrCreateTag() WhitelistMode whitelistMode = WhitelistMode.values()[filter.getOrCreateTag()
.getInt("WhitelistMode")]; .getInt("WhitelistMode")];
list.add(TextFormatting.GOLD + (whitelistMode == WhitelistMode.WHITELIST_CONJ list.add((whitelistMode == WhitelistMode.WHITELIST_CONJ
? Lang.translate("gui.attribute_filter.whitelist_conjunctive") ? Lang.translate("gui.attribute_filter.whitelist_conjunctive")
: whitelistMode == WhitelistMode.WHITELIST_DISJ : whitelistMode == WhitelistMode.WHITELIST_DISJ
? Lang.translate("gui.attribute_filter.whitelist_disjunctive") ? 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; int count = 0;
ListNBT attributes = filter.getOrCreateTag() ListNBT attributes = filter.getOrCreateTag()
@ -123,10 +121,10 @@ public class FilterItem extends Item implements INamedContainerProvider {
for (INBT inbt : attributes) { for (INBT inbt : attributes) {
ItemAttribute attribute = ItemAttribute.fromNBT((CompoundNBT) inbt); ItemAttribute attribute = ItemAttribute.fromNBT((CompoundNBT) inbt);
if (count > 3) { if (count > 3) {
list.add(TextFormatting.DARK_GRAY + "- ..."); list.add(new StringTextComponent("- ...").formatted(TextFormatting.DARK_GRAY));
break; break;
} }
list.add(TextFormatting.GRAY + "- " + attribute.format()); list.add(new StringTextComponent("- ").append(attribute.format()));
count++; count++;
} }

View file

@ -11,21 +11,22 @@ import com.simibubi.create.foundation.gui.widgets.Indicator;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
public class FilterScreen extends AbstractFilterScreen<FilterContainer> { public class FilterScreen extends AbstractFilterScreen<FilterContainer> {
private static final String PREFIX = "gui.filter."; private static final String PREFIX = "gui.filter.";
private String whitelistN = Lang.translate(PREFIX + "whitelist"); private ITextComponent whitelistN = Lang.translate(PREFIX + "whitelist");
private String whitelistDESC = Lang.translate(PREFIX + "whitelist.description"); private ITextComponent whitelistDESC = Lang.translate(PREFIX + "whitelist.description");
private String blacklistN = Lang.translate(PREFIX + "blacklist"); private ITextComponent blacklistN = Lang.translate(PREFIX + "blacklist");
private String blacklistDESC = Lang.translate(PREFIX + "blacklist.description"); private ITextComponent blacklistDESC = Lang.translate(PREFIX + "blacklist.description");
private String respectDataN = Lang.translate(PREFIX + "respect_data"); private ITextComponent respectDataN = Lang.translate(PREFIX + "respect_data");
private String respectDataDESC = Lang.translate(PREFIX + "respect_data.description"); private ITextComponent respectDataDESC = Lang.translate(PREFIX + "respect_data.description");
private String ignoreDataN = Lang.translate(PREFIX + "ignore_data"); private ITextComponent ignoreDataN = Lang.translate(PREFIX + "ignore_data");
private String ignoreDataDESC = Lang.translate(PREFIX + "ignore_data.description"); private ITextComponent ignoreDataDESC = Lang.translate(PREFIX + "ignore_data.description");
private IconButton whitelist, blacklist; private IconButton whitelist, blacklist;
private IconButton respectNBT, ignoreNBT; private IconButton respectNBT, ignoreNBT;
@ -100,8 +101,8 @@ public class FilterScreen extends AbstractFilterScreen<FilterContainer> {
} }
@Override @Override
protected List<String> getTooltipDescriptions() { protected List<IFormattableTextComponent> getTooltipDescriptions() {
return Arrays.asList(blacklistDESC, whitelistDESC, respectDataDESC, ignoreDataDESC); return Arrays.asList(blacklistDESC.copy(), whitelistDESC.copy(), respectDataDESC.copy(), ignoreDataDESC.copy());
} }
@Override @Override

View file

@ -9,6 +9,7 @@ import java.util.function.BiPredicate;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import net.minecraft.util.text.TranslationTextComponent;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
@ -95,7 +96,7 @@ public interface ItemAttribute {
} }
@OnlyIn(value = Dist.CLIENT) @OnlyIn(value = Dist.CLIENT)
default String format() { default TranslationTextComponent format() {
return Lang.translate("item_attributes." + getTranslationKey(), getTranslationParameters()); return Lang.translate("item_attributes." + getTranslationKey(), getTranslationParameters());
} }
@ -250,8 +251,8 @@ public interface ItemAttribute {
} }
@OnlyIn(value = Dist.CLIENT) @OnlyIn(value = Dist.CLIENT)
public String format() { public TranslationTextComponent format() {
return Lang.translate("item_attributes." + getTranslationKey(), I18n.format(group.getTranslationKey())); return Lang.translate("item_attributes." + getTranslationKey(), group.getTranslationKey());
} }
@Override @Override

View file

@ -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);
}
}

View file

@ -21,6 +21,7 @@ import net.minecraft.block.WallBlock;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tags.BlockTags; import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ITag;
import net.minecraft.tags.ItemTags; import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag; import net.minecraft.tags.Tag;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@ -73,9 +74,9 @@ public abstract class PaletteBlockPartial<B extends Block> {
return builder; return builder;
} }
protected abstract Iterable<Tag<Block>> getBlockTags(); protected abstract Iterable<ITag.INamedTag<Block>> getBlockTags();
protected abstract Iterable<Tag<Item>> getItemTags(); protected abstract Iterable<ITag.INamedTag<Item>> getItemTags();
protected abstract B createBlock(Supplier<? extends Block> block); protected abstract B createBlock(Supplier<? extends Block> block);
@ -104,12 +105,12 @@ public abstract class PaletteBlockPartial<B extends Block> {
} }
@Override @Override
protected Iterable<Tag<Block>> getBlockTags() { protected Iterable<ITag.INamedTag<Block>> getBlockTags() {
return Arrays.asList(BlockTags.STAIRS); return Arrays.asList(BlockTags.STAIRS);
} }
@Override @Override
protected Iterable<Tag<Item>> getItemTags() { protected Iterable<ITag.INamedTag<Item>> getItemTags() {
return Arrays.asList(ItemTags.STAIRS); return Arrays.asList(ItemTags.STAIRS);
} }
@ -164,12 +165,12 @@ public abstract class PaletteBlockPartial<B extends Block> {
} }
@Override @Override
protected Iterable<Tag<Block>> getBlockTags() { protected Iterable<ITag.INamedTag<Block>> getBlockTags() {
return Arrays.asList(BlockTags.SLABS); return Arrays.asList(BlockTags.SLABS);
} }
@Override @Override
protected Iterable<Tag<Item>> getItemTags() { protected Iterable<ITag.INamedTag<Item>> getItemTags() {
return Arrays.asList(ItemTags.SLABS); return Arrays.asList(ItemTags.SLABS);
} }
@ -209,12 +210,12 @@ public abstract class PaletteBlockPartial<B extends Block> {
} }
@Override @Override
protected Iterable<Tag<Block>> getBlockTags() { protected Iterable<ITag.INamedTag<Block>> getBlockTags() {
return Arrays.asList(BlockTags.WALLS); return Arrays.asList(BlockTags.WALLS);
} }
@Override @Override
protected Iterable<Tag<Item>> getItemTags() { protected Iterable<ITag.INamedTag<Item>> getItemTags() {
return Arrays.asList(ItemTags.WALLS); return Arrays.asList(ItemTags.WALLS);
} }

View file

@ -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.belt.item.BeltConnectorItem;
import com.simibubi.create.content.contraptions.relays.elementary.ShaftBlock; 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.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
@ -114,9 +115,9 @@ public abstract class LaunchedItem {
@Override @Override
void place(World world) { void place(World world) {
// Piston // Piston
if (state.has(BlockStateProperties.EXTENDED)) if (BlockHelper.hasBlockStateProperty(state, BlockStateProperties.EXTENDED))
state = state.with(BlockStateProperties.EXTENDED, Boolean.FALSE); 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); state = state.with(BlockStateProperties.WATERLOGGED, Boolean.FALSE);
if (AllBlocks.BELT.has(state)) { if (AllBlocks.BELT.has(state)) {

View file

@ -539,7 +539,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
schematicAnchor = anchor; schematicAnchor = anchor;
blockReader = new SchematicWorld(schematicAnchor, world); blockReader = new SchematicWorld(schematicAnchor, world);
PlacementSettings settings = SchematicItem.getSettings(blueprint); PlacementSettings settings = SchematicItem.getSettings(blueprint);
activeTemplate.addBlocksToWorld(blockReader, schematicAnchor, settings); activeTemplate.place(blockReader, schematicAnchor, settings);
schematicLoaded = true; schematicLoaded = true;
state = State.PAUSED; state = State.PAUSED;
statusMsg = "ready"; statusMsg = "ready";

View file

@ -5,11 +5,13 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget; import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.screen.inventory.ContainerScreen; import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.client.gui.widget.Widget; import net.minecraft.client.gui.widget.Widget;
@ -26,6 +28,8 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public abstract class AbstractSimiContainerScreen<T extends Container> extends ContainerScreen<T> { public abstract class AbstractSimiContainerScreen<T extends Container> extends ContainerScreen<T> {
protected List<Widget> widgets; protected List<Widget> widgets;
@ -41,14 +45,14 @@ public abstract class AbstractSimiContainerScreen<T extends Container> extends C
} }
@Override @Override
public void render(int mouseX, int mouseY, float partialTicks) { public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
renderBackground(); renderBackground(matrixStack);
renderWindow(mouseX, mouseY, partialTicks); renderWindow(matrixStack, mouseX, mouseY, partialTicks);
for (Widget widget : widgets) 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.enableAlphaTest();
RenderSystem.enableBlend(); RenderSystem.enableBlend();
@ -56,9 +60,9 @@ public abstract class AbstractSimiContainerScreen<T extends Container> extends C
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
RenderSystem.disableLighting(); RenderSystem.disableLighting();
RenderSystem.disableDepthTest(); RenderSystem.disableDepthTest();
renderWindowForeground(mouseX, mouseY, partialTicks); renderWindowForeground(matrixStack, mouseX, mouseY, partialTicks);
for (Widget widget : widgets) for (Widget widget : widgets)
widget.renderToolTip(mouseX, mouseY); widget.renderToolTip(matrixStack, mouseX, mouseY);
} }
@Override @Override
@ -123,7 +127,8 @@ public abstract class AbstractSimiContainerScreen<T extends Container> extends C
protected abstract void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks); protected abstract void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks);
@Override @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) { protected void renderWindowForeground(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
@ -138,7 +143,7 @@ public abstract class AbstractSimiContainerScreen<T extends Container> 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) { @Nullable String text, int textColor) {
if (!stack.isEmpty()) { if (!stack.isEmpty()) {
if (stack.getItem().showDurabilityBar(stack)) { if (stack.getItem().showDurabilityBar(stack)) {
@ -169,14 +174,14 @@ public abstract class AbstractSimiContainerScreen<T extends Container> extends C
RenderSystem.disableBlend(); RenderSystem.disableBlend();
RenderSystem.pushMatrix(); 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); RenderSystem.translated((float) (xPosition + 16.5f), (float) (yPosition + 16.5f), 0);
double scale = getItemCountTextScale(); double scale = getItemCountTextScale();
RenderSystem.scaled(scale, scale, 0); RenderSystem.scaled(scale, scale, 0);
RenderSystem.translated(-fr.getStringWidth(s) - (guiScaleFactor > 1 ? 0 : -.5f), RenderSystem.translated(-fr.getStringWidth(s) - (guiScaleFactor > 1 ? 0 : -.5f),
-font.FONT_HEIGHT + (guiScaleFactor > 1 ? 1 : 1.75f), 0); -textRenderer.FONT_HEIGHT + (guiScaleFactor > 1 ? 1 : 1.75f), 0);
fr.drawStringWithShadow(s, 0, 0, textColor); fr.drawWithShadow(matrixStack, s, 0, 0, textColor);
RenderSystem.popMatrix(); RenderSystem.popMatrix();
RenderSystem.enableBlend(); RenderSystem.enableBlend();
@ -188,7 +193,7 @@ public abstract class AbstractSimiContainerScreen<T extends Container> extends C
} }
public double getItemCountTextScale() { public double getItemCountTextScale() {
int guiScaleFactor = (int) minecraft.getWindow().getGuiScaleFactor(); int guiScaleFactor = (int) client.getWindow().getGuiScaleFactor();
double scale = 1; double scale = 1;
switch (guiScaleFactor) { switch (guiScaleFactor) {
case 1: case 1:

View file

@ -1,13 +1,16 @@
package com.simibubi.create.foundation.gui.widgets; package com.simibubi.create.foundation.gui.widgets;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
public class Label extends AbstractSimiWidget { public class Label extends AbstractSimiWidget {
public String text; public ITextComponent text;
public String suffix; public String suffix;
protected boolean hasShadow; protected boolean hasShadow;
protected int color; protected int color;
@ -16,7 +19,7 @@ public class Label extends AbstractSimiWidget {
public Label(int x, int y, String text) { public Label(int x, int y, String text) {
super(x, y, Minecraft.getInstance().fontRenderer.getStringWidth(text), 10); super(x, y, Minecraft.getInstance().fontRenderer.getStringWidth(text), 10);
font = Minecraft.getInstance().fontRenderer; font = Minecraft.getInstance().fontRenderer;
this.text = "Label"; this.text = ITextComponent.of("Label");
color = 0xFFFFFF; color = 0xFFFFFF;
hasShadow = false; hasShadow = false;
suffix = ""; suffix = "";
@ -37,10 +40,10 @@ public class Label extends AbstractSimiWidget {
return this; 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; FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer;
if (fontRenderer.getStringWidth(newText) <= maxWidthPx) { if (fontRenderer.getWidth(newText) <= maxWidthPx) {
text = newText; text = newText;
return; return;
} }
@ -48,15 +51,16 @@ public class Label extends AbstractSimiWidget {
String trim = "..."; String trim = "...";
int trimWidth = fontRenderer.getStringWidth(trim); int trimWidth = fontRenderer.getStringWidth(trim);
StringBuilder builder = new StringBuilder(newText); String raw = newText.getUnformattedComponentText();
int startIndex = trimFront ? 0 : newText.length() - 1; StringBuilder builder = new StringBuilder(raw);
int endIndex = !trimFront ? 0 : newText.length() - 1; int startIndex = trimFront ? 0 : raw.length() - 1;
int endIndex = !trimFront ? 0 : raw.length() - 1;
int step = (int) Math.signum(endIndex - startIndex); int step = (int) Math.signum(endIndex - startIndex);
for (int i = startIndex; i != endIndex; i += step) { for (int i = startIndex; i != endIndex; i += step) {
String sub = builder.substring(trimFront ? i : startIndex, trimFront ? endIndex + 1 : i + 1); String sub = builder.substring(trimFront ? i : startIndex, trimFront ? endIndex + 1 : i + 1);
if (fontRenderer.getStringWidth(sub) + trimWidth <= maxWidthPx) { if (fontRenderer.getWidth(new StringTextComponent(sub).setStyle(newText.getStyle())) + trimWidth <= maxWidthPx) {
text = trimFront ? trim + sub : sub + trim; text = new StringTextComponent(trimFront ? trim + sub : sub + trim).setStyle(newText.getStyle());
return; return;
} }
} }
@ -64,17 +68,17 @@ public class Label extends AbstractSimiWidget {
} }
@Override @Override
public void render(int mouseX, int mouseY, float partialTicks) { public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
if (!visible) if (!visible)
return; return;
if (text == null || text.isEmpty()) if (text == null || text.toString().isEmpty())
return; return;
RenderSystem.color4f(1, 1, 1, 1); RenderSystem.color4f(1, 1, 1, 1);
if (hasShadow) if (hasShadow)
font.drawStringWithShadow(text + suffix, x, y, color); font.drawWithShadow(matrixStack, text + suffix, x, y, color);
else else
font.drawString(text + suffix, x, y, color); font.draw(matrixStack, text + suffix, x, y, color);
} }
} }

View file

@ -7,15 +7,17 @@ import com.simibubi.create.AllKeys;
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour.StepContext; import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour.StepContext;
import com.simibubi.create.foundation.utility.Lang; 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; import net.minecraft.util.text.TextFormatting;
public class ScrollInput extends AbstractSimiWidget { public class ScrollInput extends AbstractSimiWidget {
protected Consumer<Integer> onScroll; protected Consumer<Integer> onScroll;
protected int state; protected int state;
protected String title = Lang.translate("gui.scrollInput.defaultTitle"); protected IFormattableTextComponent title = Lang.translate("gui.scrollInput.defaultTitle");
protected final String scrollToModify = Lang.translate("gui.scrollInput.scrollToModify"); protected final IFormattableTextComponent scrollToModify = Lang.translate("gui.scrollInput.scrollToModify");
protected final String shiftScrollsFaster = Lang.translate("gui.scrollInput.shiftScrollsFaster"); protected final IFormattableTextComponent shiftScrollsFaster = Lang.translate("gui.scrollInput.shiftScrollsFaster");
protected Label displayLabel; protected Label displayLabel;
protected int min, max; protected int min, max;
@ -46,7 +48,7 @@ public class ScrollInput extends AbstractSimiWidget {
return this; return this;
} }
public ScrollInput titled(String title) { public ScrollInput titled(IFormattableTextComponent title) {
this.title = title; this.title = title;
updateTooltip(); updateTooltip();
return this; return this;
@ -83,7 +85,7 @@ public class ScrollInput extends AbstractSimiWidget {
@Override @Override
public boolean mouseScrolled(double mouseX, double mouseY, double delta) { public boolean mouseScrolled(double mouseX, double mouseY, double delta) {
if (!isHovered) if (!hovered)
return false; return false;
StepContext context = new StepContext(); StepContext context = new StepContext();
@ -124,14 +126,14 @@ public class ScrollInput extends AbstractSimiWidget {
} }
protected void writeToLabel() { protected void writeToLabel() {
displayLabel.text = "" + state; displayLabel.text = ITextComponent.of(String.valueOf(state));
} }
protected void updateTooltip() { protected void updateTooltip() {
toolTip.clear(); toolTip.clear();
toolTip.add(TextFormatting.BLUE + title); toolTip.add(title.formatted(TextFormatting.BLUE));
toolTip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + scrollToModify); toolTip.add(scrollToModify.formatted(TextFormatting.ITALIC, TextFormatting.DARK_GRAY));
toolTip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + shiftScrollsFaster); toolTip.add(shiftScrollsFaster.formatted(TextFormatting.ITALIC, TextFormatting.DARK_GRAY));
} }
} }

View file

@ -5,19 +5,22 @@ import java.util.List;
import com.simibubi.create.foundation.utility.Lang; 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; import net.minecraft.util.text.TextFormatting;
public class SelectionScrollInput extends ScrollInput { public class SelectionScrollInput extends ScrollInput {
private final String scrollToSelect = Lang.translate("gui.scrollInput.scrollToSelect"); private final IFormattableTextComponent scrollToSelect = Lang.translate("gui.scrollInput.scrollToSelect");
protected List<String> options; protected List<ITextComponent> options;
public SelectionScrollInput(int xIn, int yIn, int widthIn, int heightIn) { public SelectionScrollInput(int xIn, int yIn, int widthIn, int heightIn) {
super(xIn, yIn, widthIn, heightIn); super(xIn, yIn, widthIn, heightIn);
options = new ArrayList<>(); options = new ArrayList<>();
} }
public ScrollInput forOptions(List<String> options) { public ScrollInput forOptions(List<ITextComponent> options) {
this.options = options; this.options = options;
this.max = options.size(); this.max = options.size();
updateTooltip(); updateTooltip();
@ -37,16 +40,14 @@ public class SelectionScrollInput extends ScrollInput {
@Override @Override
protected void updateTooltip() { protected void updateTooltip() {
toolTip.clear(); toolTip.clear();
toolTip.add(TextFormatting.BLUE + title); toolTip.add(title.formatted(TextFormatting.BLUE));
for (int i = min; i < max; i++) { for (int i = min; i < max; i++) {
StringBuilder result = new StringBuilder();
if (i == state) 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 else
result.append(TextFormatting.GRAY).append("> ").append(options.get(i)); toolTip.add(StringTextComponent.EMPTY.copy().append("> ").append(options.get(i)).formatted(TextFormatting.GRAY));
toolTip.add(result.toString());
} }
toolTip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + scrollToSelect); toolTip.add( StringTextComponent.EMPTY.copy().append(scrollToSelect).formatted(TextFormatting.ITALIC, TextFormatting.DARK_GRAY));
} }
} }

View file

@ -38,6 +38,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
@ -155,8 +156,8 @@ public class ItemDescription {
add(linesOnShift, GRAY + Lang.translate("tooltip.capacityProvided")); add(linesOnShift, GRAY + Lang.translate("tooltip.capacityProvided"));
add(linesOnShift, level); add(linesOnShift, level);
String genSpeed = generatorSpeed(block, rpmUnit); IFormattableTextComponent genSpeed = generatorSpeed(block, rpmUnit);
if (!genSpeed.equals("")) { if (!genSpeed.getUnformattedComponentText().equals("")) {
add(linesOnShift, GREEN + " " + genSpeed); add(linesOnShift, GREEN + " " + genSpeed);
} }
} }
@ -251,10 +252,18 @@ public class ItemDescription {
textLines.forEach(s -> add(infoList, s)); textLines.forEach(s -> add(infoList, s));
} }
public static void add(List<ITextComponent> infoList, List<ITextComponent> textLines) {
infoList.addAll(textLines);
}
public static void add(List<ITextComponent> infoList, String line) { public static void add(List<ITextComponent> infoList, String line) {
infoList.add(new StringTextComponent(line)); infoList.add(new StringTextComponent(line));
} }
public static void add(List<ITextComponent> infoList, ITextComponent line) {
infoList.add(line);
}
public Palette getPalette() { public Palette getPalette() {
return palette; return palette;
} }
@ -286,7 +295,7 @@ public class ItemDescription {
return linesOnShift; return linesOnShift;
} }
private String generatorSpeed(Block block, String unitRPM) { private IFormattableTextComponent generatorSpeed(Block block, String unitRPM) {
String value = ""; String value = "";
if (block instanceof WaterWheelBlock) { if (block instanceof WaterWheelBlock) {
@ -303,7 +312,7 @@ public class ItemDescription {
value = baseSpeed + "-" + (baseSpeed * 2); 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();
} }
} }

View file

@ -25,6 +25,8 @@ import net.minecraft.item.BlockItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.TieredItem; import net.minecraft.item.TieredItem;
import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
public class TooltipHelper { public class TooltipHelper {
@ -34,14 +36,13 @@ public class TooltipHelper {
public static Language cachedLanguage; public static Language cachedLanguage;
private static boolean gogglesMode; 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; TextFormatting colorFormat = highlighted ? color.hColor : color.color;
return DARK_GRAY return Lang.translate("tooltip.holdKey", DARK_GRAY).append(Lang.translate("tooltip.keyShift").formatted(colorFormat));
+ Lang.translate("tooltip.holdKey", colorFormat + Lang.translate("tooltip.keyShift") + DARK_GRAY);
} }
public static List<String> cutString(String s, TextFormatting defaultColor, TextFormatting highlightColor) { public static List<String> cutString(ITextComponent s, TextFormatting defaultColor, TextFormatting highlightColor) {
return cutString(s, defaultColor, highlightColor, 0); return cutString(s.getUnformattedComponentText(), defaultColor, highlightColor, 0);
} }
public static List<String> cutString(String s, TextFormatting defaultColor, TextFormatting highlightColor, public static List<String> cutString(String s, TextFormatting defaultColor, TextFormatting highlightColor,

View file

@ -18,11 +18,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.ITextComponent;
public class ValueBox extends ChasingAABBOutline { public class ValueBox extends ChasingAABBOutline {
protected String label = "Value Box"; protected ITextComponent label = ITextComponent.of("Value Box");
protected String sublabel = ""; protected ITextComponent sublabel = ITextComponent.of("");
protected String scrollTooltip = ""; protected String scrollTooltip = "";
protected Vector3d labelOffset = Vector3d.ZERO; protected Vector3d labelOffset = Vector3d.ZERO;
@ -34,7 +35,7 @@ public class ValueBox extends ChasingAABBOutline {
protected ValueBoxTransform transform; protected ValueBoxTransform transform;
protected BlockState blockState; protected BlockState blockState;
public ValueBox(String label, AxisAlignedBB bb, BlockPos pos) { public ValueBox(ITextComponent label, AxisAlignedBB bb, BlockPos pos) {
super(bb); super(bb);
this.label = label; this.label = label;
this.pos = pos; this.pos = pos;
@ -51,7 +52,7 @@ public class ValueBox extends ChasingAABBOutline {
return this; return this;
} }
public ValueBox subLabel(String sublabel) { public ValueBox subLabel(ITextComponent sublabel) {
this.sublabel = sublabel; this.sublabel = sublabel;
return this; return this;
} }
@ -103,7 +104,7 @@ public class ValueBox extends ChasingAABBOutline {
ms.translate(labelOffset.x, labelOffset.y, labelOffset.z); ms.translate(labelOffset.x, labelOffset.y, labelOffset.z);
renderHoveringText(ms, buffer, label); renderHoveringText(ms, buffer, label);
if (!sublabel.isEmpty()) { if (!sublabel.toString().isEmpty()) {
ms.translate(0, 10, 0); ms.translate(0, 10, 0);
renderHoveringText(ms, buffer, sublabel); renderHoveringText(ms, buffer, sublabel);
} }
@ -162,7 +163,7 @@ public class ValueBox extends ChasingAABBOutline {
public static class TextValueBox extends ValueBox { public static class TextValueBox extends ValueBox {
String text; 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); super(label, bb, pos);
this.text = text; this.text = text;
} }
@ -185,7 +186,7 @@ public class ValueBox extends ChasingAABBOutline {
ms.scale(numberScale, numberScale, numberScale); ms.scale(numberScale, numberScale, numberScale);
ms.translate(singleDigit ? stringWidth / 2 : 0, singleDigit ? -verticalMargin : verticalMargin, 0); 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 // 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)); 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) { int shadowColor) {
ms.push(); ms.push();
drawString(ms, buffer, text, 0, 0, color); drawString(ms, buffer, text, 0, 0, color);
@ -225,7 +226,7 @@ public class ValueBox extends ChasingAABBOutline {
ms.pop(); 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() Minecraft.getInstance().fontRenderer.draw(text, x, y, color, false, ms.peek()
.getModel(), buffer, false, 0, 15728880); .getModel(), buffer, false, 0, 15728880);
} }

View file

@ -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.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform;
import net.minecraft.util.text.ITextComponent;
public class ScrollOptionBehaviour<E extends Enum<E> & INamedIconOptions> extends ScrollValueBehaviour { public class ScrollOptionBehaviour<E extends Enum<E> & INamedIconOptions> extends ScrollValueBehaviour {
private E[] options; private E[] options;
public ScrollOptionBehaviour(Class<E> enum_, String label, SmartTileEntity te, ValueBoxTransform slot) { public ScrollOptionBehaviour(Class<E> enum_, ITextComponent label, SmartTileEntity te, ValueBoxTransform slot) {
super(label, te, slot); super(label, te, slot);
options = enum_.getEnumConstants(); options = enum_.getEnumConstants();
between(0, options.length - 1); between(0, options.length - 1);

View file

@ -13,6 +13,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.ITextComponent;
public class ScrollValueBehaviour extends TileEntityBehaviour { public class ScrollValueBehaviour extends TileEntityBehaviour {
@ -27,7 +28,7 @@ public class ScrollValueBehaviour extends TileEntityBehaviour {
public int scrollableValue; public int scrollableValue;
int ticksUntilScrollPacket; int ticksUntilScrollPacket;
boolean forceClientState; boolean forceClientState;
String label; ITextComponent label;
Consumer<Integer> callback; Consumer<Integer> callback;
Consumer<Integer> clientCallback; Consumer<Integer> clientCallback;
Function<Integer, String> formatter; Function<Integer, String> formatter;
@ -35,7 +36,7 @@ public class ScrollValueBehaviour extends TileEntityBehaviour {
Function<StepContext, Integer> step; Function<StepContext, Integer> step;
boolean needsWrench; boolean needsWrench;
public ScrollValueBehaviour(String label, SmartTileEntity te, ValueBoxTransform slot) { public ScrollValueBehaviour(ITextComponent label, SmartTileEntity te, ValueBoxTransform slot) {
super(te); super(te);
this.setLabel(label); this.setLabel(label);
slotPositioning = slot; slotPositioning = slot;
@ -166,7 +167,7 @@ public class ScrollValueBehaviour extends TileEntityBehaviour {
return slotPositioning.testHit(state, localHit); return slotPositioning.testHit(state, localHit);
} }
public void setLabel(String label) { public void setLabel(ITextComponent label) {
this.label = label; this.label = label;
} }

View file

@ -18,6 +18,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.ITextComponent;
public class ScrollValueRenderer { public class ScrollValueRenderer {
@ -55,7 +56,7 @@ public class ScrollValueRenderer {
AxisAlignedBB bb = new AxisAlignedBB(Vector3d.ZERO, Vector3d.ZERO).grow(.5f) AxisAlignedBB bb = new AxisAlignedBB(Vector3d.ZERO, Vector3d.ZERO).grow(.5f)
.contract(0, 0, -.5f) .contract(0, 0, -.5f)
.offset(0, 0, -.125f); .offset(0, 0, -.125f);
String label = behaviour.label; ITextComponent label = behaviour.label;
ValueBox box; ValueBox box;
if (behaviour instanceof ScrollOptionBehaviour) { if (behaviour instanceof ScrollOptionBehaviour) {

View file

@ -11,8 +11,8 @@ import net.minecraft.util.text.TranslationTextComponent;
public class Lang { public class Lang {
public static String translate(String key, Object... args) { public static TranslationTextComponent translate(String key, Object... args) {
return createTranslationTextComponent(key, args).getFormattedText(); return createTranslationTextComponent(key, args);
} }
public static TranslationTextComponent createTranslationTextComponent(String key, Object... args) { public static TranslationTextComponent createTranslationTextComponent(String key, Object... args) {
@ -23,8 +23,8 @@ public class Lang {
player.sendStatusMessage(createTranslationTextComponent(key, args), true); player.sendStatusMessage(createTranslationTextComponent(key, args), true);
} }
public static List<String> translatedOptions(String prefix, String... keys) { public static List<TranslationTextComponent> translatedOptions(String prefix, String... keys) {
List<String> result = new ArrayList<>(keys.length); List<TranslationTextComponent> result = new ArrayList<>(keys.length);
for (String key : keys) { for (String key : keys) {
result.add(translate(prefix + "." + key)); result.add(translate(prefix + "." + key));
} }

View file

@ -1,7 +1,6 @@
package com.simibubi.create.foundation.worldgen; package com.simibubi.create.foundation.worldgen;
import com.simibubi.create.content.curiosities.tools.SandPaperItem; import com.simibubi.create.content.curiosities.tools.SandPaperItem;
import com.simibubi.create.content.palettes.MetalBlock;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;

View file

@ -13,4 +13,6 @@ public net.minecraft.world.server.ChunkManager field_219253_g #chunksToUnload
# ChunkStatus # ChunkStatus
public-f net.minecraft.world.chunk.ChunkStatus field_222617_m #FULL public-f net.minecraft.world.chunk.ChunkStatus field_222617_m #FULL
public net.minecraft.world.chunk.ChunkStatus$IGenerationWorker public net.minecraft.world.chunk.ChunkStatus$IGenerationWorker
public net.minecraft.world.chunk.ChunkStatus$ILoadingWorker 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