Update to 1.16.2
This commit is contained in:
@@ -163,11 +163,11 @@ public class ActionHelper
|
||||
Minecraft.getInstance().displayGuiScreen(null);
|
||||
Minecraft.getInstance().mouseHelper.grabMouse();
|
||||
|
||||
ITextComponent message = new TranslationTextComponent("<" + Main.NAME + "> %s", new TranslationTextComponent("worldhandler.error.gui")).func_240699_a_(TextFormatting.RED);
|
||||
ITextComponent cause = new StringTextComponent(" " + e.getClass().getCanonicalName() + ": " + e.getMessage()).func_240699_a_(TextFormatting.RED);
|
||||
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);
|
||||
|
||||
Minecraft.getInstance().ingameGUI.func_238450_a_(ChatType.SYSTEM, message, Util.field_240973_b_);
|
||||
Minecraft.getInstance().ingameGUI.func_238450_a_(ChatType.SYSTEM, cause, Util.field_240973_b_);
|
||||
Minecraft.getInstance().ingameGUI.func_238450_a_(ChatType.SYSTEM, message, Util.DUMMY_UUID);
|
||||
Minecraft.getInstance().ingameGUI.func_238450_a_(ChatType.SYSTEM, cause, Util.DUMMY_UUID);
|
||||
|
||||
WorldHandler.LOGGER.throwing(e);
|
||||
}
|
||||
@@ -177,8 +177,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.field_240973_b_);
|
||||
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.field_240973_b_);
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -53,7 +53,7 @@ public class BlockHelper
|
||||
}
|
||||
}
|
||||
|
||||
return Minecraft.getInstance().player.func_233580_cy_();
|
||||
return Minecraft.getInstance().player.getPosition();
|
||||
}
|
||||
|
||||
public static Block getFocusedBlock()
|
||||
@@ -150,7 +150,7 @@ public class BlockHelper
|
||||
{
|
||||
if(CommandHelper.canPlayerIssueCommand() && Minecraft.getInstance().getConnection() != null)
|
||||
{
|
||||
BlockPos pos = Minecraft.getInstance().player.func_233580_cy_().add(0, 3, 0);
|
||||
BlockPos pos = Minecraft.getInstance().player.getPosition().add(0, 3, 0);
|
||||
|
||||
BuilderFill placeFill = new BuilderFill();
|
||||
placeFill.setPosition1(pos);
|
||||
|
||||
@@ -4,9 +4,9 @@ package exopandora.worldhandler.util;
|
||||
import exopandora.worldhandler.builder.INBTWritable;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.StringNBT;
|
||||
import net.minecraft.util.IReorderingProcessor;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -73,51 +73,9 @@ public class MutableStringTextComponent extends StringTextComponent implements I
|
||||
return result;
|
||||
}
|
||||
|
||||
public String formatter(String string, Integer index)
|
||||
public IReorderingProcessor formatter(String string, Integer index)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
if(this.getStyle() != null)
|
||||
{
|
||||
Style style = this.getStyle();
|
||||
|
||||
if(style.func_240711_a_() != null)
|
||||
{
|
||||
TextFormatting color = TextFormatting.getValueByName(style.func_240711_a_().func_240747_b_());
|
||||
|
||||
if(color != null)
|
||||
{
|
||||
builder.append(color);
|
||||
}
|
||||
}
|
||||
|
||||
if(style.getBold())
|
||||
{
|
||||
builder.append(TextFormatting.BOLD);
|
||||
}
|
||||
|
||||
if(style.getItalic())
|
||||
{
|
||||
builder.append(TextFormatting.ITALIC);
|
||||
}
|
||||
|
||||
if(style.getUnderlined())
|
||||
{
|
||||
builder.append(TextFormatting.UNDERLINE);
|
||||
}
|
||||
|
||||
if(style.getObfuscated())
|
||||
{
|
||||
builder.append(TextFormatting.OBFUSCATED);
|
||||
}
|
||||
|
||||
if(style.getStrikethrough())
|
||||
{
|
||||
builder.append(TextFormatting.STRIKETHROUGH);
|
||||
}
|
||||
}
|
||||
|
||||
return builder.toString() + string;
|
||||
return IReorderingProcessor.func_242239_a(string, this.getStyle());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,13 +92,13 @@ public class MutableStringTextComponent extends StringTextComponent implements I
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
MutableStringTextComponent serial = (MutableStringTextComponent) this.func_230532_e_(); //deepCopy
|
||||
MutableStringTextComponent serial = (MutableStringTextComponent) this.deepCopy();
|
||||
serial.setText(MutableStringTextComponent.getSpecialFormattedText(this.getUnformattedComponentText()));
|
||||
return ITextComponent.Serializer.toJson(serial);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MutableStringTextComponent func_230531_f_() //shallowCopy
|
||||
public MutableStringTextComponent copyRaw()
|
||||
{
|
||||
return new MutableStringTextComponent(this.text);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,10 @@ import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.potion.Effect;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.DynamicRegistries;
|
||||
import net.minecraft.util.registry.MutableRegistry;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.text.LanguageMap;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -31,7 +35,14 @@ public class RegistryHelper
|
||||
registerRegistry(ForgeRegistries.BLOCKS, Block::getTranslationKey);
|
||||
registerRegistry(ForgeRegistries.ITEMS, Item::getTranslationKey);
|
||||
registerRegistry(ForgeRegistries.POTIONS, Effect::getName);
|
||||
registerRegistry(ForgeRegistries.BIOMES, Biome::getTranslationKey);
|
||||
registerRegistry(ForgeRegistries.BIOMES, biome ->
|
||||
{
|
||||
MutableRegistry<Biome> registry = DynamicRegistries.func_239770_b_().func_243612_b(Registry.BIOME_KEY);
|
||||
ResourceLocation resource = registry.getKey(biome);
|
||||
String key = "biome." + biome.getRegistryName().getNamespace() + "." + resource.getPath();
|
||||
|
||||
return LanguageMap.getInstance().func_230506_b_(key) ? key : resource.toString();
|
||||
});
|
||||
registerRegistry(ForgeRegistries.ENCHANTMENTS, Enchantment::getName);
|
||||
registerRegistry(ForgeRegistries.ENTITIES, EntityType::getTranslationKey);
|
||||
registerRegistry(ForgeRegistries.STAT_TYPES, stat -> "stat." + stat.toString().replace(':', '.'));
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import exopandora.worldhandler.config.Config;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.AbstractGui;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
@@ -45,11 +44,11 @@ public class RenderUtils
|
||||
matrix.scale(0.25F, 0.25F, 0.25F);
|
||||
|
||||
matrix.rotate(Vector3f.ZP.rotationDegrees(rotationHour));
|
||||
AbstractGui.func_238467_a_(matrix, -1, -1, 1, 11, 0xFF383838);
|
||||
AbstractGui.fill(matrix, -1, -1, 1, 11, 0xFF383838);
|
||||
matrix.rotate(Vector3f.ZN.rotationDegrees(rotationHour));
|
||||
|
||||
matrix.rotate(Vector3f.ZP.rotationDegrees(rotationMinute));
|
||||
AbstractGui.func_238467_a_(matrix, -1, -1, 1, 15, 0xFF6F6F6F);
|
||||
AbstractGui.fill(matrix, -1, -1, 1, 15, 0xFF6F6F6F);
|
||||
matrix.rotate(Vector3f.ZN.rotationDegrees(rotationMinute));
|
||||
|
||||
matrix.pop();
|
||||
@@ -57,11 +56,11 @@ public class RenderUtils
|
||||
RenderUtils.color(Config.getSkin().getButtonRedF(), Config.getSkin().getButtonGreenF(), Config.getSkin().getButtonBlueF(), Config.getSkin().getButtonAlphaF());
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(ResourceHelper.getIconTexture());
|
||||
|
||||
gui.func_238474_b_(matrix, width + 0, height, 48, 0, 10, 10);
|
||||
gui.blit(matrix, width + 0, height, 48, 0, 10, 10);
|
||||
|
||||
matrix.push();
|
||||
matrix.scale(0.5F, 0.5F, 0.5F);
|
||||
Screen.func_238467_a_(matrix, (width + 5) * 2 - 1, (height + 4) * 2 + 1, (width + 6) * 2 - 1, (height + 5) * 2 + 1, 0xFF000000);
|
||||
AbstractGui.fill(matrix, (width + 5) * 2 - 1, (height + 4) * 2 + 1, (width + 6) * 2 - 1, (height + 5) * 2 + 1, 0xFF000000);
|
||||
matrix.pop();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,11 +40,11 @@ public class SignText implements INBTWritable
|
||||
{
|
||||
if(command != null && !command.isEmpty())
|
||||
{
|
||||
this.text.getStyle().func_240715_a_(new ClickEvent(Action.RUN_COMMAND, command));
|
||||
this.text.getStyle().setClickEvent(new ClickEvent(Action.RUN_COMMAND, command));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.text.getStyle().func_240715_a_(null);
|
||||
this.text.getStyle().setClickEvent(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,36 +15,36 @@ 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("<").func_240699_a_(net.minecraft.util.text.TextFormatting.BOLD);
|
||||
public static final IFormattableTextComponent ARROW_RIGHT_BOLD = new StringTextComponent(">").func_240699_a_(net.minecraft.util.text.TextFormatting.BOLD);
|
||||
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 IFormattableTextComponent stripText(IFormattableTextComponent string, int maxWidth, FontRenderer fontRenderer)
|
||||
{
|
||||
return TextUtils.stripText(string, (IFormattableTextComponent) StringTextComponent.field_240750_d_, maxWidth, fontRenderer);
|
||||
return TextUtils.stripText(string, (IFormattableTextComponent) StringTextComponent.EMPTY, maxWidth, fontRenderer);
|
||||
}
|
||||
|
||||
public static IFormattableTextComponent stripText(IFormattableTextComponent string, IFormattableTextComponent prefix, int maxWidth, FontRenderer fontRenderer)
|
||||
{
|
||||
if(fontRenderer.func_238414_a_(prefix) + fontRenderer.func_238414_a_(string) > (maxWidth - fontRenderer.func_238414_a_(prefix)))
|
||||
{
|
||||
IFormattableTextComponent result = new StringTextComponent("").func_240703_c_(string.getStyle());
|
||||
IFormattableTextComponent result = new StringTextComponent("").setStyle(string.getStyle());
|
||||
|
||||
for(char c : string.getString().toCharArray())
|
||||
{
|
||||
IFormattableTextComponent extension = new StringTextComponent(result.getString() + c + "...").func_240703_c_(string.getStyle());
|
||||
IFormattableTextComponent extension = new StringTextComponent(result.getString() + c + "...").setStyle(string.getStyle());
|
||||
|
||||
if(fontRenderer.func_238414_a_(extension) < maxWidth)
|
||||
{
|
||||
result = new StringTextComponent(result.getString() + c).func_240703_c_(string.getStyle());
|
||||
result = new StringTextComponent(result.getString() + c).setStyle(string.getStyle());
|
||||
}
|
||||
else
|
||||
{
|
||||
return new StringTextComponent(result.getString() + "...").func_240703_c_(string.getStyle());
|
||||
return new StringTextComponent(result.getString() + "...").setStyle(string.getStyle());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return prefix.func_230531_f_().func_230529_a_(string);
|
||||
return prefix.copyRaw().append(string);
|
||||
}
|
||||
|
||||
public static String formatTotalTime(long tick)
|
||||
@@ -108,7 +108,7 @@ public class TextUtils
|
||||
{
|
||||
if(text == null)
|
||||
{
|
||||
return (IFormattableTextComponent) StringTextComponent.field_240750_d_;
|
||||
return (IFormattableTextComponent) StringTextComponent.EMPTY;
|
||||
}
|
||||
|
||||
return new TranslationTextComponent(text, parameters);
|
||||
|
||||
Reference in New Issue
Block a user