Update forgegradle and minecraftforge

Switch to official mappings
This commit is contained in:
Marcel Konrad
2021-03-25 23:14:35 +01:00
parent 27b614280b
commit 7498440cd8
72 changed files with 530 additions and 553 deletions

View File

@@ -34,8 +34,8 @@ public class ActionHelper
{
public static void backToGame()
{
Minecraft.getInstance().displayGuiScreen(null);
Minecraft.getInstance().mouseHelper.grabMouse();
Minecraft.getInstance().setScreen(null);
Minecraft.getInstance().mouseHandler.grabMouse();
}
public static void back(Content content) throws Exception
@@ -58,90 +58,90 @@ public class ActionHelper
{
if(content != null && !(content instanceof ContentContinue))
{
if(content instanceof ContentChild && Minecraft.getInstance().currentScreen != null && Minecraft.getInstance().currentScreen instanceof GuiWorldHandler)
if(content instanceof ContentChild && Minecraft.getInstance().screen != null && Minecraft.getInstance().screen instanceof GuiWorldHandler)
{
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(((ContentChild) content).withParent(((GuiWorldHandler) Minecraft.getInstance().currentScreen).getContent())));
Minecraft.getInstance().setScreen(new GuiWorldHandler(((ContentChild) content).withParent(((GuiWorldHandler) Minecraft.getInstance().screen).getContent())));
}
else
{
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(content));
Minecraft.getInstance().setScreen(new GuiWorldHandler(content));
}
}
}
public static void timeDawn()
{
CommandHelper.sendCommand(Minecraft.getInstance().getSession().getUsername(), new BuilderTime(EnumMode.SET, Config.getSettings().getDawn()));
CommandHelper.sendCommand(Minecraft.getInstance().getUser().getName(), new BuilderTime(EnumMode.SET, Config.getSettings().getDawn()));
}
public static void timeNoon()
{
CommandHelper.sendCommand(Minecraft.getInstance().getSession().getUsername(), new BuilderTime(EnumMode.SET, Config.getSettings().getNoon()));
CommandHelper.sendCommand(Minecraft.getInstance().getUser().getName(), new BuilderTime(EnumMode.SET, Config.getSettings().getNoon()));
}
public static void timeSunset()
{
CommandHelper.sendCommand(Minecraft.getInstance().getSession().getUsername(), new BuilderTime(EnumMode.SET, Config.getSettings().getSunset()));
CommandHelper.sendCommand(Minecraft.getInstance().getUser().getName(), new BuilderTime(EnumMode.SET, Config.getSettings().getSunset()));
}
public static void timeMidnight()
{
CommandHelper.sendCommand(Minecraft.getInstance().getSession().getUsername(), new BuilderTime(EnumMode.SET, Config.getSettings().getMidnight()));
CommandHelper.sendCommand(Minecraft.getInstance().getUser().getName(), new BuilderTime(EnumMode.SET, Config.getSettings().getMidnight()));
}
public static void weatherClear()
{
CommandHelper.sendCommand(Minecraft.getInstance().getSession().getUsername(), new BuilderWeather(EnumWeather.CLEAR));
CommandHelper.sendCommand(Minecraft.getInstance().getUser().getName(), new BuilderWeather(EnumWeather.CLEAR));
}
public static void weatherRain()
{
CommandHelper.sendCommand(Minecraft.getInstance().getSession().getUsername(), new BuilderWeather(EnumWeather.RAIN));
CommandHelper.sendCommand(Minecraft.getInstance().getUser().getName(), new BuilderWeather(EnumWeather.RAIN));
}
public static void weatherThunder()
{
CommandHelper.sendCommand(Minecraft.getInstance().getSession().getUsername(), new BuilderWeather(EnumWeather.THUNDER));
CommandHelper.sendCommand(Minecraft.getInstance().getUser().getName(), new BuilderWeather(EnumWeather.THUNDER));
}
public static void difficultyPeaceful()
{
CommandHelper.sendCommand(Minecraft.getInstance().getSession().getUsername(), new BuilderDifficulty(Difficulty.PEACEFUL));
CommandHelper.sendCommand(Minecraft.getInstance().getUser().getName(), new BuilderDifficulty(Difficulty.PEACEFUL));
}
public static void difficultyEasy()
{
CommandHelper.sendCommand(Minecraft.getInstance().getSession().getUsername(), new BuilderDifficulty(Difficulty.EASY));
CommandHelper.sendCommand(Minecraft.getInstance().getUser().getName(), new BuilderDifficulty(Difficulty.EASY));
}
public static void difficultyNormal()
{
CommandHelper.sendCommand(Minecraft.getInstance().getSession().getUsername(), new BuilderDifficulty(Difficulty.NORMAL));
CommandHelper.sendCommand(Minecraft.getInstance().getUser().getName(), new BuilderDifficulty(Difficulty.NORMAL));
}
public static void difficultyHard()
{
CommandHelper.sendCommand(Minecraft.getInstance().getSession().getUsername(), new BuilderDifficulty(Difficulty.HARD));
CommandHelper.sendCommand(Minecraft.getInstance().getUser().getName(), new BuilderDifficulty(Difficulty.HARD));
}
public static void gamemodeSurvival()
{
CommandHelper.sendCommand(Minecraft.getInstance().getSession().getUsername(), new BuilderGamemode(EnumGamemode.SURVIVAL));
CommandHelper.sendCommand(Minecraft.getInstance().getUser().getName(), new BuilderGamemode(EnumGamemode.SURVIVAL));
}
public static void gamemodeCreative()
{
CommandHelper.sendCommand(Minecraft.getInstance().getSession().getUsername(), new BuilderGamemode(EnumGamemode.CREATIVE));
CommandHelper.sendCommand(Minecraft.getInstance().getUser().getName(), new BuilderGamemode(EnumGamemode.CREATIVE));
}
public static void gamemodeAdventure()
{
CommandHelper.sendCommand(Minecraft.getInstance().getSession().getUsername(), new BuilderGamemode(EnumGamemode.ADVENTURE));
CommandHelper.sendCommand(Minecraft.getInstance().getUser().getName(), new BuilderGamemode(EnumGamemode.ADVENTURE));
}
public static void gamemodeSpectator()
{
CommandHelper.sendCommand(Minecraft.getInstance().getSession().getUsername(), new BuilderGamemode(EnumGamemode.SPECTATOR));
CommandHelper.sendCommand(Minecraft.getInstance().getUser().getName(), new BuilderGamemode(EnumGamemode.SPECTATOR));
}
public static void tryRun(ActionHandler action)
@@ -155,14 +155,14 @@ public class ActionHelper
}
catch(Exception e)
{
Minecraft.getInstance().displayGuiScreen(null);
Minecraft.getInstance().mouseHelper.grabMouse();
Minecraft.getInstance().setScreen(null);
Minecraft.getInstance().mouseHandler.grabMouse();
ITextComponent message = new TranslationTextComponent("<" + Main.NAME + "> %s", new TranslationTextComponent("worldhandler.error.gui")).mergeStyle(TextFormatting.RED);
ITextComponent cause = new StringTextComponent(" " + e.getClass().getCanonicalName() + ": " + e.getMessage()).mergeStyle(TextFormatting.RED);
ITextComponent message = new TranslationTextComponent("<" + Main.NAME + "> %s", new TranslationTextComponent("worldhandler.error.gui")).withStyle(TextFormatting.RED);
ITextComponent cause = new StringTextComponent(" " + e.getClass().getCanonicalName() + ": " + e.getMessage()).withStyle(TextFormatting.RED);
Minecraft.getInstance().ingameGUI.func_238450_a_(ChatType.SYSTEM, message, Util.DUMMY_UUID);
Minecraft.getInstance().ingameGUI.func_238450_a_(ChatType.SYSTEM, cause, Util.DUMMY_UUID);
Minecraft.getInstance().gui.handleChat(ChatType.SYSTEM, message, Util.NIL_UUID);
Minecraft.getInstance().gui.handleChat(ChatType.SYSTEM, cause, Util.NIL_UUID);
WorldHandler.LOGGER.throwing(e);
}
@@ -172,8 +172,8 @@ public class ActionHelper
{
if(!CommandHelper.canPlayerIssueCommand() && Config.getSettings().permissionQuery())
{
Minecraft.getInstance().ingameGUI.func_238450_a_(ChatType.SYSTEM, new StringTextComponent(TextFormatting.RED + I18n.format("worldhandler.permission.refused")), Util.DUMMY_UUID);
Minecraft.getInstance().ingameGUI.func_238450_a_(ChatType.SYSTEM, new StringTextComponent(TextFormatting.RED + I18n.format("worldhandler.permission.refused.change", I18n.format("gui.worldhandler.config.settings.permission_query"))), Util.DUMMY_UUID);
Minecraft.getInstance().gui.handleChat(ChatType.SYSTEM, new StringTextComponent(TextFormatting.RED + I18n.get("worldhandler.permission.refused")), Util.NIL_UUID);
Minecraft.getInstance().gui.handleChat(ChatType.SYSTEM, new StringTextComponent(TextFormatting.RED + I18n.get("worldhandler.permission.refused.change", I18n.get("gui.worldhandler.config.settings.permission_query"))), Util.NIL_UUID);
}
else
{

View File

@@ -34,13 +34,13 @@ public class AdvancementHelper implements IFutureReloadListener
return CompletableFuture.supplyAsync(() ->
{
SimpleReloadableResourceManager serverResourceManager = new SimpleReloadableResourceManager(ResourcePackType.SERVER_DATA);
serverResourceManager.addReloadListener(new NetworkTagManager());
serverResourceManager.addReloadListener(this.manager);
serverResourceManager.registerReloadListener(new NetworkTagManager());
serverResourceManager.registerReloadListener(this.manager);
return serverResourceManager;
}).thenCompose(stage::markCompleteAwaitingOthers).thenAcceptAsync(serverResourceManager ->
}).thenCompose(stage::wait).thenAcceptAsync(serverResourceManager ->
{
List<IResourcePack> list = Minecraft.getInstance().getResourcePackList().getEnabledPacks().stream().map(ResourcePackInfo::getResourcePack).collect(Collectors.toList());
serverResourceManager.reloadResources(backgroundExecutor, gameExecutor, CompletableFuture.completedFuture(Unit.INSTANCE), list);
List<IResourcePack> list = Minecraft.getInstance().getResourcePackRepository().getSelectedPacks().stream().map(ResourcePackInfo::open).collect(Collectors.toList());
serverResourceManager.createFullReload(backgroundExecutor, gameExecutor, CompletableFuture.completedFuture(Unit.INSTANCE), list);
});
}

View File

@@ -44,16 +44,16 @@ public class BlockHelper
@Nonnull
public static BlockPos getFocusedBlockPos()
{
World world = Minecraft.getInstance().world;
RayTraceResult result = Minecraft.getInstance().objectMouseOver;
World world = Minecraft.getInstance().level;
RayTraceResult result = Minecraft.getInstance().hitResult;
if(result != null && Type.BLOCK.equals(result.getType()) && world != null)
{
BlockRayTraceResult blockResult = (BlockRayTraceResult) result;
if(!ArrayUtils.contains(BLACKLIST, world.getBlockState(blockResult.getPos()).getBlock()))
if(!ArrayUtils.contains(BLACKLIST, world.getBlockState(blockResult.getBlockPos()).getBlock()))
{
return blockResult.getPos();
return blockResult.getBlockPos();
}
}
@@ -61,7 +61,7 @@ public class BlockHelper
if(player != null)
{
return player.getPosition();
return player.blockPosition();
}
return BlockPos.ZERO;
@@ -76,7 +76,7 @@ public class BlockHelper
@Nonnull
public static Block getBlock(BlockPos pos)
{
World world = Minecraft.getInstance().world;
World world = Minecraft.getInstance().level;
if(world != null)
{
@@ -170,11 +170,11 @@ public class BlockHelper
{
if(CommandHelper.canPlayerIssueCommand() && Minecraft.getInstance().getConnection() != null)
{
BlockPos pos = Minecraft.getInstance().player.getPosition().add(0, 3, 0);
BlockPos pos = Minecraft.getInstance().player.blockPosition().offset(0, 3, 0);
BuilderFill placeFill = new BuilderFill();
placeFill.setPosition1(pos);
placeFill.setPosition2(pos.up());
placeFill.setPosition2(pos.above());
placeFill.setBlock1(new BlockResourceLocation(Blocks.COMMAND_BLOCK.getRegistryName()));
BuilderFill removeFill = new BuilderFill();
@@ -186,7 +186,7 @@ public class BlockHelper
removeFill.setZ2(new CoordinateInt(0, EnumType.GLOBAL));
removeFill.setBlock1(new BlockResourceLocation(Blocks.AIR.getRegistryName()));
Minecraft.getInstance().player.sendChatMessage(placeFill.toActualCommand());
Minecraft.getInstance().player.chat(placeFill.toActualCommand());
BuilderExecute wrapped = new BuilderExecute();
wrapped.setMode1(EnumMode.AT);
@@ -194,8 +194,8 @@ public class BlockHelper
wrapped.setMode2(EnumMode.RUN);
wrapped.setCommand(command);
Minecraft.getInstance().getConnection().sendPacket(new CUpdateCommandBlockPacket(pos, wrapped.toActualCommand(), CommandBlockTileEntity.Mode.REDSTONE, true, false, true));
Minecraft.getInstance().getConnection().sendPacket(new CUpdateCommandBlockPacket(pos.up(), removeFill.toActualCommand(), CommandBlockTileEntity.Mode.REDSTONE, true, false, true));
Minecraft.getInstance().getConnection().send(new CUpdateCommandBlockPacket(pos, wrapped.toActualCommand(), CommandBlockTileEntity.Mode.REDSTONE, true, false, true));
Minecraft.getInstance().getConnection().send(new CUpdateCommandBlockPacket(pos.above(), removeFill.toActualCommand(), CommandBlockTileEntity.Mode.REDSTONE, true, false, true));
return true;
}
@@ -209,7 +209,7 @@ public class BlockHelper
if(Minecraft.getInstance().player != null)
{
builder.setState(BlockStateProperties.HORIZONTAL_FACING, Minecraft.getInstance().player.getHorizontalFacing().getOpposite());
builder.setState(BlockStateProperties.HORIZONTAL_FACING, Minecraft.getInstance().player.getDirection().getOpposite());
}
CommandHelper.sendCommand(player, builder);

View File

@@ -17,14 +17,14 @@ public class CommandHelper
{
public static void sendFeedback(CommandSource source, String message)
{
source.sendFeedback(new StringTextComponent(message), false);
source.sendSuccess(new StringTextComponent(message), false);
}
public static boolean canPlayerIssueCommand()
{
if(Minecraft.getInstance().player != null)
{
return Minecraft.getInstance().player.hasPermissionLevel(1);
return Minecraft.getInstance().player.hasPermissions(1);
}
return false;
@@ -66,7 +66,7 @@ public class CommandHelper
}
else if(Minecraft.getInstance().player != null)
{
Minecraft.getInstance().player.sendChatMessage(command);
Minecraft.getInstance().player.chat(command);
}
}
}

View File

@@ -44,7 +44,7 @@ public class MutableStringTextComponent extends StringTextComponent implements I
}
@Override
public String getUnformattedComponentText()
public String getContents()
{
return this.text;
}
@@ -74,13 +74,13 @@ public class MutableStringTextComponent extends StringTextComponent implements I
public IReorderingProcessor formatter(String string, Integer index)
{
return IReorderingProcessor.fromString(string, this.getStyle());
return IReorderingProcessor.forward(string, this.getStyle());
}
@Override
public INBT serialize()
{
if(this.getUnformattedComponentText() != null && !this.getUnformattedComponentText().isEmpty())
if(this.getContents() != null && !this.getContents().isEmpty())
{
return StringNBT.valueOf(this.toString());
}
@@ -91,13 +91,13 @@ public class MutableStringTextComponent extends StringTextComponent implements I
@Override
public String toString()
{
MutableStringTextComponent serial = (MutableStringTextComponent) this.deepCopy();
serial.setText(MutableStringTextComponent.getSpecialFormattedText(this.getUnformattedComponentText()));
MutableStringTextComponent serial = (MutableStringTextComponent) this.copy();
serial.setText(MutableStringTextComponent.getSpecialFormattedText(this.getContents()));
return ITextComponent.Serializer.toJson(serial);
}
@Override
public MutableStringTextComponent copyRaw()
public MutableStringTextComponent plainCopy()
{
return new MutableStringTextComponent(this.text);
}
@@ -116,7 +116,7 @@ public class MutableStringTextComponent extends StringTextComponent implements I
else
{
MutableStringTextComponent stringtextcomponent = (MutableStringTextComponent) object;
return this.text.equals(stringtextcomponent.getUnformattedComponentText()) && super.equals(object);
return this.text.equals(stringtextcomponent.getContents()) && super.equals(object);
}
}
}

View File

@@ -32,19 +32,19 @@ public class RegistryHelper
static
{
registerRegistry(ForgeRegistries.BLOCKS, Block::getTranslationKey);
registerRegistry(ForgeRegistries.ITEMS, Item::getTranslationKey);
registerRegistry(ForgeRegistries.POTIONS, Effect::getName);
registerRegistry(ForgeRegistries.BLOCKS, Block::getDescriptionId);
registerRegistry(ForgeRegistries.ITEMS, Item::getDescriptionId);
registerRegistry(ForgeRegistries.POTIONS, Effect::getDescriptionId);
registerRegistry(ForgeRegistries.BIOMES, biome ->
{
MutableRegistry<Biome> registry = DynamicRegistries.func_239770_b_().getRegistry(Registry.BIOME_KEY);
MutableRegistry<Biome> registry = DynamicRegistries.builtin().registryOrThrow(Registry.BIOME_REGISTRY);
ResourceLocation resource = registry.getKey(biome);
String key = "biome." + biome.getRegistryName().getNamespace() + "." + resource.getPath();
return LanguageMap.getInstance().func_230506_b_(key) ? key : resource.toString();
return LanguageMap.getInstance().has(key) ? key : resource.toString();
});
registerRegistry(ForgeRegistries.ENCHANTMENTS, Enchantment::getName);
registerRegistry(ForgeRegistries.ENTITIES, EntityType::getTranslationKey);
registerRegistry(ForgeRegistries.ENCHANTMENTS, Enchantment::getDescriptionId);
registerRegistry(ForgeRegistries.ENTITIES, EntityType::getDescriptionId);
registerRegistry(ForgeRegistries.STAT_TYPES, stat -> "stat." + stat.toString().replace(':', '.'));
}

View File

@@ -39,41 +39,41 @@ public class RenderUtils
float rotationHour = (360 / 12) * (hour >= 12 ? (hour - 12) : hour) - 180F;
float rotationMinute = (360 / 60) * minute - 180F;
matrix.push();
matrix.pushPose();
matrix.translate(width + 5, height + 5, 0F);
matrix.scale(0.25F, 0.25F, 0.25F);
matrix.rotate(Vector3f.ZP.rotationDegrees(rotationHour));
matrix.mulPose(Vector3f.ZP.rotationDegrees(rotationHour));
AbstractGui.fill(matrix, -1, -1, 1, 11, 0xFF383838);
matrix.rotate(Vector3f.ZN.rotationDegrees(rotationHour));
matrix.mulPose(Vector3f.ZN.rotationDegrees(rotationHour));
matrix.rotate(Vector3f.ZP.rotationDegrees(rotationMinute));
matrix.mulPose(Vector3f.ZP.rotationDegrees(rotationMinute));
AbstractGui.fill(matrix, -1, -1, 1, 15, 0xFF6F6F6F);
matrix.rotate(Vector3f.ZN.rotationDegrees(rotationMinute));
matrix.mulPose(Vector3f.ZN.rotationDegrees(rotationMinute));
matrix.pop();
matrix.popPose();
RenderUtils.colorDefaultButton();
Minecraft.getInstance().getTextureManager().bindTexture(ResourceHelper.iconTexture());
Minecraft.getInstance().getTextureManager().bind(ResourceHelper.iconTexture());
gui.blit(matrix, width + 0, height, 48, 0, 10, 10);
matrix.push();
matrix.pushPose();
matrix.scale(0.5F, 0.5F, 0.5F);
AbstractGui.fill(matrix, (width + 5) * 2 - 1, (height + 4) * 2 + 1, (width + 6) * 2 - 1, (height + 5) * 2 + 1, 0xFF000000);
matrix.pop();
matrix.popPose();
}
public static void renderItemIntoGUI(MatrixStack matrix, ItemStack stack, int x, int y)
{
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
TextureManager textureManager = Minecraft.getInstance().getTextureManager();
IBakedModel bakedmodel = Minecraft.getInstance().getItemRenderer().getItemModelWithOverrides(stack, (World) null, (LivingEntity) null);
IBakedModel bakedmodel = Minecraft.getInstance().getItemRenderer().getModel(stack, (World) null, (LivingEntity) null);
matrix.push();
matrix.pushPose();
textureManager.bindTexture(PlayerContainer.LOCATION_BLOCKS_TEXTURE);
textureManager.getTexture(PlayerContainer.LOCATION_BLOCKS_TEXTURE).setBlurMipmapDirect(false, false);
textureManager.bind(PlayerContainer.BLOCK_ATLAS);
textureManager.getTexture(PlayerContainer.BLOCK_ATLAS).setFilter(false, false);
RenderUtils.enableRescaleNormal();
RenderUtils.enableAlphaTest();
@@ -82,33 +82,33 @@ public class RenderUtils
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
RenderUtils.color(1.0F, 1.0F, 1.0F, 1.0F);
matrix.translate((float) x, (float) y, 100.0F + itemRenderer.zLevel);
matrix.translate((float) x, (float) y, 100.0F + itemRenderer.blitOffset);
matrix.translate(8.0F, 8.0F, 0.0F);
matrix.scale(1.0F, -1.0F, 1.0F);
matrix.scale(16.0F, 16.0F, 16.0F);
IRenderTypeBuffer.Impl buffer = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();
boolean flag = !bakedmodel.isSideLit();
IRenderTypeBuffer.Impl buffer = Minecraft.getInstance().renderBuffers().bufferSource();
boolean flag = !bakedmodel.usesBlockLight();
if(flag)
{
RenderHelper.setupGuiFlatDiffuseLighting();
RenderHelper.setupForFlatItems();
}
itemRenderer.renderItem(stack, ItemCameraTransforms.TransformType.GUI, false, matrix, buffer, 15728880, OverlayTexture.NO_OVERLAY, bakedmodel);
buffer.finish();
itemRenderer.render(stack, ItemCameraTransforms.TransformType.GUI, false, matrix, buffer, 15728880, OverlayTexture.NO_OVERLAY, bakedmodel);
buffer.endBatch();
RenderSystem.enableDepthTest();
if(flag)
{
RenderHelper.setupGui3DDiffuseLighting();
RenderHelper.setupFor3DItems();
}
RenderUtils.disableAlphaTest();
RenderUtils.disableRescaleNormal();
matrix.pop();
matrix.popPose();
}
@SuppressWarnings("deprecation")

View File

@@ -33,14 +33,14 @@ public class ScoreboardHelper
private void init()
{
//Lists
final List<Node> colors = this.createList(TextFormatting.values(), TextFormatting::getFriendlyName, TextFormatting::isColor);
final List<Node> visibility = this.createList(Visible.values(), value -> value.internalName);
final List<Node> colors = this.createList(TextFormatting.values(), TextFormatting::getName, TextFormatting::isColor);
final List<Node> visibility = this.createList(Visible.values(), value -> value.name);
final List<Node> collision = this.createList(CollisionRule.values(), value -> value.name);
final List<Node> bool = this.createList(new Boolean[] {true, false}, String::valueOf);
//Objectives
for(String scoreCriteria : ScoreCriteria.INSTANCES.keySet())
for(String scoreCriteria : ScoreCriteria.CRITERIA_BY_NAME.keySet())
{
this.objectives.insertNode(scoreCriteria.split("[.:]"));
}

View File

@@ -40,11 +40,11 @@ public class SignText implements INBTWritable
{
if(command != null && !command.isEmpty())
{
this.text.getStyle().setClickEvent(new ClickEvent(Action.RUN_COMMAND, command));
this.text.getStyle().withClickEvent(new ClickEvent(Action.RUN_COMMAND, command));
}
else
{
this.text.getStyle().setClickEvent(null);
this.text.getStyle().withClickEvent(null);
}
}
@@ -73,9 +73,9 @@ public class SignText implements INBTWritable
@Override
public String toString()
{
if(this.text.getUnformattedComponentText().isEmpty())
if(this.text.getContents().isEmpty())
{
return this.text.getUnformattedComponentText();
return this.text.getContents();
}
if(this.text.getStyle().isEmpty() && !this.hasCommand())

View File

@@ -13,8 +13,8 @@ public class TextUtils
{
public static final StringTextComponent ARROW_LEFT = new StringTextComponent("<");
public static final StringTextComponent ARROW_RIGHT = new StringTextComponent(">");
public static final IFormattableTextComponent ARROW_LEFT_BOLD = new StringTextComponent("<").mergeStyle(net.minecraft.util.text.TextFormatting.BOLD);
public static final IFormattableTextComponent ARROW_RIGHT_BOLD = new StringTextComponent(">").mergeStyle(net.minecraft.util.text.TextFormatting.BOLD);
public static final IFormattableTextComponent ARROW_LEFT_BOLD = new StringTextComponent("<").withStyle(net.minecraft.util.text.TextFormatting.BOLD);
public static final IFormattableTextComponent ARROW_RIGHT_BOLD = new StringTextComponent(">").withStyle(net.minecraft.util.text.TextFormatting.BOLD);
public static IFormattableTextComponent stripText(IFormattableTextComponent string, int maxWidth, FontRenderer fontRenderer)
{
@@ -23,7 +23,7 @@ public class TextUtils
public static IFormattableTextComponent stripText(IFormattableTextComponent string, IFormattableTextComponent prefix, int maxWidth, FontRenderer fontRenderer)
{
if(fontRenderer.getStringPropertyWidth(prefix) + fontRenderer.getStringPropertyWidth(string) > (maxWidth - fontRenderer.getStringPropertyWidth(prefix)))
if(fontRenderer.width(prefix) + fontRenderer.width(string) > (maxWidth - fontRenderer.width(prefix)))
{
IFormattableTextComponent result = new StringTextComponent("").setStyle(string.getStyle());
@@ -31,7 +31,7 @@ public class TextUtils
{
IFormattableTextComponent extension = new StringTextComponent(result.getString() + c + "...").setStyle(string.getStyle());
if(fontRenderer.getStringPropertyWidth(extension) < maxWidth)
if(fontRenderer.width(extension) < maxWidth)
{
result = new StringTextComponent(result.getString() + c).setStyle(string.getStyle());
}
@@ -42,7 +42,7 @@ public class TextUtils
}
}
return prefix.copyRaw().append(string);
return prefix.plainCopy().append(string);
}
public static String formatTotalTime(long tick)