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

@@ -52,7 +52,7 @@ public class WorldHandler
public void run()
{
SimpleReloadableResourceManager manager = (SimpleReloadableResourceManager) Minecraft.getInstance().getResourceManager();
manager.addReloadListener(AdvancementHelper.getInstance());
manager.registerReloadListener(AdvancementHelper.getInstance());
Config.setupDirectories(WorldHandler.USERCONTENT_PATH);
modLoadingContext.registerConfig(Type.CLIENT, Config.CLIENT_SPEC, Main.MODID + "/" + Main.MODID + ".toml");
UsercontentLoader.load(WorldHandler.USERCONTENT_PATH);

View File

@@ -16,7 +16,7 @@ import net.minecraftforge.registries.ForgeRegistries;
@OnlyIn(Dist.CLIENT)
public abstract class ComponentAttribute implements IBuilderComponent
{
public static final List<Attribute> ATTRIBUTES = ForgeRegistries.ATTRIBUTES.getValues().stream().filter(attribute -> !attribute.getAttributeName().equals(I18n.format(attribute.getAttributeName()))).collect(Collectors.toList());
public static final List<Attribute> ATTRIBUTES = ForgeRegistries.ATTRIBUTES.getValues().stream().filter(attribute -> !attribute.getDescriptionId().equals(I18n.get(attribute.getDescriptionId()))).collect(Collectors.toList());
protected Map<Attribute, Double> attributes = new HashMap<Attribute, Double>();

View File

@@ -31,7 +31,7 @@ public class ComponentAttributeItem extends ComponentAttribute
attribute.putString("AttributeName", id);
attribute.putDouble("Amount", entry.getValue() / 100);
attribute.putInt("Operation", 1); // 0 = additive, 1 = percentage
attribute.putUniqueId("UUID", UUID.nameUUIDFromBytes(id.getBytes()));
attribute.putUUID("UUID", UUID.nameUUIDFromBytes(id.getBytes()));
attributes.add(attribute);
}

View File

@@ -399,7 +399,7 @@ public class EntityNBT implements IBuilderComponent
{
try
{
this.nbt = JsonToNBT.getTagFromJson("{" + nbt + "}");
this.nbt = JsonToNBT.parseTag("{" + nbt + "}");
}
catch(CommandSyntaxException e)
{

View File

@@ -24,7 +24,7 @@ public class BuilderDifficulty extends CommandBuilder
{
if(difficulty != null)
{
this.setNode(0, difficulty.getTranslationKey());
this.setNode(0, difficulty.getKey());
}
}

View File

@@ -423,7 +423,7 @@ public abstract class BuilderEntity extends CommandBuilderNBT
for(EntityType<?> type : ForgeRegistries.ENTITIES.getValues())
{
if(type.isSummonable() && entityName.equalsIgnoreCase(I18n.format(type.getTranslationKey())))
if(type.canSummon() && entityName.equalsIgnoreCase(I18n.get(type.getDescriptionId())))
{
return type.getRegistryName();
}

View File

@@ -27,12 +27,12 @@ public class BuilderNoteEditor extends BuilderSetBlock
{
this(note);
this.setPosition(pos);
this.setState(BlockStateProperties.NOTE_BLOCK_INSTRUMENT, NoteBlockInstrument.byState(Minecraft.getInstance().world.getBlockState(pos.down())));
this.setState(BlockStateProperties.NOTEBLOCK_INSTRUMENT, NoteBlockInstrument.byState(Minecraft.getInstance().level.getBlockState(pos.below())));
}
public void setNote(int note)
{
this.setState(BlockStateProperties.NOTE_0_24, note);
this.setState(BlockStateProperties.NOTE, note);
}
public BuilderNoteEditor build(int note)

View File

@@ -72,7 +72,7 @@ public enum ArgumentType
{
try
{
return JsonToNBT.getTagFromJson(value);
return JsonToNBT.parseTag(value);
}
catch(CommandSyntaxException e)
{

View File

@@ -52,7 +52,7 @@ public class BlockResourceLocation extends ItemResourceLocation
if(resource != null && ForgeRegistries.BLOCKS.containsKey(resource))
{
return ForgeRegistries.BLOCKS.getValue(resource).getDefaultState();
return ForgeRegistries.BLOCKS.getValue(resource).defaultBlockState();
}
return null;
@@ -75,7 +75,7 @@ public class BlockResourceLocation extends ItemResourceLocation
{
if(this.state != null && this.state.hasProperty(property))
{
this.state = this.state.with(property, value);
this.state = this.state.setValue(property, value);
}
}

View File

@@ -63,7 +63,7 @@ public class ItemResourceLocation
{
try
{
nbt = JsonToNBT.getTagFromJson(input.substring(start, input.lastIndexOf("}") + 1));
nbt = JsonToNBT.parseTag(input.substring(start, input.lastIndexOf("}") + 1));
}
catch(CommandSyntaxException e)
{

View File

@@ -41,16 +41,16 @@ public class CommandWH
.then(Commands.literal("pos2")
.executes(context -> pos2(context.getSource())))
.then(Commands.literal("fill")
.requires(source -> source.hasPermissionLevel(2))
.then(Commands.argument("block", BlockStateArgument.blockState())
.executes(context -> fill(context.getSource(), BlockStateArgument.getBlockState(context, "block")))))
.requires(source -> source.hasPermission(2))
.then(Commands.argument("block", BlockStateArgument.block())
.executes(context -> fill(context.getSource(), BlockStateArgument.getBlock(context, "block")))))
.then(Commands.literal("replace")
.requires(source -> source.hasPermissionLevel(2))
.then(Commands.argument("block", BlockStateArgument.blockState())
.then(Commands.argument("replace", BlockStateArgument.blockState())
.executes(context -> replace(context.getSource(), BlockStateArgument.getBlockState(context, "block"), BlockStateArgument.getBlockState(context, "replace"))))))
.requires(source -> source.hasPermission(2))
.then(Commands.argument("block", BlockStateArgument.block())
.then(Commands.argument("replace", BlockStateArgument.block())
.executes(context -> replace(context.getSource(), BlockStateArgument.getBlock(context, "block"), BlockStateArgument.getBlock(context, "replace"))))))
.then(Commands.literal("clone")
.requires(source -> source.hasPermissionLevel(2))
.requires(source -> source.hasPermission(2))
.executes(context -> clone(context.getSource(), "masked"))
.then(Commands.literal("filtered")
.then(Commands.argument("filter", StringBlockPredicateArgument.blockPredicate())
@@ -110,7 +110,7 @@ public class CommandWH
{
BuilderFill builder = new BuilderFill();
builder.setBlock1(new BlockResourceLocation(block.getState().getBlock().getRegistryName(), block.getState(), block.tag));
CommandHelper.sendCommand(source.getName(), builder);
CommandHelper.sendCommand(source.getTextName(), builder);
}
});
@@ -132,7 +132,7 @@ public class CommandWH
builder.setBlockHandling(EnumBlockFilter.REPLACE);
builder.setBlock1(new BlockResourceLocation(replace.getState().getBlock().getRegistryName(), replace.getState(), replace.tag));
builder.setBlock2(new BlockResourceLocation(block.getState().getBlock().getRegistryName(), block.getState(), block.tag));
CommandHelper.sendCommand(source.getName(), builder);
CommandHelper.sendCommand(source.getTextName(), builder);
}
});
@@ -153,7 +153,7 @@ public class CommandWH
builder.setPosition2(BlockHelper.getPos2());
builder.setMask(EnumHelper.valueOf(mask, EnumMask.class));
builder.setFilter(filter);
CommandHelper.sendCommand(source.getName(), builder);
CommandHelper.sendCommand(source.getTextName(), builder);
}
});
@@ -173,7 +173,7 @@ public class CommandWH
builder.setPosition1(BlockHelper.getPos1());
builder.setPosition2(BlockHelper.getPos2());
builder.setMask(EnumHelper.valueOf(mask, EnumMask.class));
CommandHelper.sendCommand(source.getName(), builder);
CommandHelper.sendCommand(source.getTextName(), builder);
}
});

View File

@@ -29,7 +29,7 @@ public class ConfigCategoryButcher
public List<ResourceLocation> getEntities()
{
return this.entities.get().stream().map(ResourceLocation::tryCreate).filter(Predicates.notNull()).collect(Collectors.toList());
return this.entities.get().stream().map(ResourceLocation::tryParse).filter(Predicates.notNull()).collect(Collectors.toList());
}
public boolean containsEntity(ResourceLocation entity)
@@ -66,7 +66,7 @@ public class ConfigCategoryButcher
{
if(string != null)
{
return ForgeRegistries.ENTITIES.containsKey(ResourceLocation.tryCreate(string.toString()));
return ForgeRegistries.ENTITIES.containsKey(ResourceLocation.tryParse(string.toString()));
}
return false;

View File

@@ -29,9 +29,9 @@ public class ClientEventHandler
@SubscribeEvent
public static void renderWorldLastEvent(RenderWorldLastEvent event)
{
if(Config.getSettings().highlightBlocks() && Minecraft.getInstance().world != null && Minecraft.getInstance().getRenderManager().info != null)
if(Config.getSettings().highlightBlocks() && Minecraft.getInstance().level != null && Minecraft.getInstance().getEntityRenderDispatcher().camera != null)
{
Vector3d projected = Minecraft.getInstance().getRenderManager().info.getProjectedView();
Vector3d projected = Minecraft.getInstance().getEntityRenderDispatcher().camera.getPosition();
double minX = Math.min(BlockHelper.getPos1().getX(), BlockHelper.getPos2().getX());
double minY = Math.min(BlockHelper.getPos1().getY(), BlockHelper.getPos2().getY());
@@ -46,31 +46,31 @@ public class ClientEventHandler
if(aabb.getCenter().distanceTo(projected) < 96)
{
MatrixStack matrix = event.getMatrixStack();
matrix.push();
matrix.translate(-projected.getX(), -projected.getY(), -projected.getZ());
matrix.pushPose();
matrix.translate(-projected.x(), -projected.y(), -projected.z());
IRenderTypeBuffer.Impl buffer = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();
IVertexBuilder builder = buffer.getBuffer(RenderType.getLines());
IRenderTypeBuffer.Impl buffer = Minecraft.getInstance().renderBuffers().bufferSource();
IVertexBuilder builder = buffer.getBuffer(RenderType.lines());
WorldRenderer.drawBoundingBox(matrix, builder, minX, minY, minZ, maxX, maxY, maxZ, 0.9F, 0.9F, 0.9F, 1.0F, 0.5F, 0.5F, 0.5F);
WorldRenderer.renderLineBox(matrix, builder, minX, minY, minZ, maxX, maxY, maxZ, 0.9F, 0.9F, 0.9F, 1.0F, 0.5F, 0.5F, 0.5F);
buffer.finish(RenderType.getLines());
buffer.finish();
buffer.endBatch(RenderType.lines());
buffer.endBatch();
// try
// {
// Field field_239227_K_ = WorldRenderer.class.getDeclaredField("field_239227_K_");
// field_239227_K_.setAccessible(true);
// ShaderGroup shader = (ShaderGroup) field_239227_K_.get(event.getContext());
// Field transparencyChain = WorldRenderer.class.getDeclaredField("transparencyChain");
// transparencyChain.setAccessible(true);
// ShaderGroup shader = (ShaderGroup) transparencyChain.get(event.getContext());
//
// if(shader != null)
// {
// Field field_241712_U_ = RenderState.class.getDeclaredField("field_241712_U_");
// field_241712_U_.setAccessible(true);
// RenderState.TargetState target = (RenderState.TargetState) field_241712_U_.get(null);
// Field ITEM_ENTITY_TARGET = RenderState.class.getDeclaredField("ITEM_ENTITY_TARGET");
// ITEM_ENTITY_TARGET.setAccessible(true);
// RenderState.TargetState target = (RenderState.TargetState) ITEM_ENTITY_TARGET.get(null);
// target.setupRenderState();
// event.getContext().func_239229_r_().framebufferClear(Minecraft.IS_RUNNING_ON_MAC);
// event.getContext().func_239229_r_().func_237506_a_(Minecraft.getInstance().getFramebuffer());
// event.getContext().getItemEntityTarget().framebufferClear(Minecraft.IS_RUNNING_ON_MAC);
// event.getContext().getItemEntityTarget().copyDepthFrom(Minecraft.getInstance().getFramebuffer());
// Minecraft.getInstance().getFramebuffer().bindFramebuffer(false);
// target.clearRenderState();
// }
@@ -80,7 +80,7 @@ public class ClientEventHandler
// e.printStackTrace();
// }
matrix.pop();
matrix.popPose();
}
}
}
@@ -88,7 +88,7 @@ public class ClientEventHandler
@SubscribeEvent
public static void clientChatEvent(ClientChatEvent event)
{
if(!Minecraft.getInstance().isSingleplayer() && Minecraft.getInstance().player != null)
if(!Minecraft.getInstance().hasSingleplayerServer() && Minecraft.getInstance().player != null)
{
CommandDispatcher<CommandSource> dispatcher = new CommandDispatcher<CommandSource>();
CommandHelper.registerCommands(dispatcher);
@@ -96,14 +96,14 @@ public class ClientEventHandler
StringReader command = new StringReader(event.getMessage());
command.skip();
ParseResults<CommandSource> result = dispatcher.parse(command, Minecraft.getInstance().player.getCommandSource());
ParseResults<CommandSource> result = dispatcher.parse(command, Minecraft.getInstance().player.createCommandSourceStack());
if(result.getContext().getCommand() != null)
{
try
{
dispatcher.execute(result);
Minecraft.getInstance().ingameGUI.getChatGUI().addToSentMessages(event.getMessage());
Minecraft.getInstance().gui.getChat().addRecentChat(event.getMessage());
}
catch(CommandSyntaxException e)
{

View File

@@ -24,17 +24,17 @@ public class KeyHandler
@SubscribeEvent
public static void keyInputEvent(KeyInputEvent event)
{
if(Minecraft.getInstance() != null && Minecraft.getInstance().currentScreen == null)
if(Minecraft.getInstance() != null && Minecraft.getInstance().screen == null)
{
if(KEY_WORLD_HANDLER.isKeyDown())
if(KEY_WORLD_HANDLER.isDown())
{
ActionHelper.displayGui();
}
else if(KEY_WORLD_HANDLER_POS1.isKeyDown() && Config.getSettings().shortcutKeys())
else if(KEY_WORLD_HANDLER_POS1.isDown() && Config.getSettings().shortcutKeys())
{
BlockHelper.setPos1(BlockHelper.getFocusedBlockPos());
}
else if(KEY_WORLD_HANDLER_POS2.isKeyDown() && Config.getSettings().shortcutKeys())
else if(KEY_WORLD_HANDLER_POS2.isDown() && Config.getSettings().shortcutKeys())
{
BlockHelper.setPos2(BlockHelper.getFocusedBlockPos());
}
@@ -58,11 +58,11 @@ public class KeyHandler
public static boolean arePosKeysRegistered()
{
return ArrayUtils.contains(Minecraft.getInstance().gameSettings.keyBindings, KEY_WORLD_HANDLER_POS1) || ArrayUtils.contains(Minecraft.getInstance().gameSettings.keyBindings, KEY_WORLD_HANDLER_POS2);
return ArrayUtils.contains(Minecraft.getInstance().options.keyMappings, KEY_WORLD_HANDLER_POS1) || ArrayUtils.contains(Minecraft.getInstance().options.keyMappings, KEY_WORLD_HANDLER_POS2);
}
public static void removePosKeys()
{
Minecraft.getInstance().gameSettings.keyBindings = ArrayUtils.removeElements(Minecraft.getInstance().gameSettings.keyBindings, KEY_WORLD_HANDLER_POS1, KEY_WORLD_HANDLER_POS2);
Minecraft.getInstance().options.keyMappings = ArrayUtils.removeElements(Minecraft.getInstance().options.keyMappings, KEY_WORLD_HANDLER_POS1, KEY_WORLD_HANDLER_POS2);
}
}

View File

@@ -37,7 +37,7 @@ public abstract class Container extends Screen implements IContainer
public <T extends TextFieldWidget> T add(T textfield)
{
return super.addListener(textfield);
return super.addWidget(textfield);
}
@Override

View File

@@ -34,7 +34,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class GuiWorldHandler extends Container
{
private static String player = Minecraft.getInstance().getSession().getUsername();
private static String player = Minecraft.getInstance().getUser().getName();
private final static List<IContainerWidget> WIDGETS = Util.make(Lists.newArrayList(), widgets ->
{
widgets.add(new WidgetTabRenderer());
@@ -169,9 +169,9 @@ public class GuiWorldHandler extends Container
this.blit(matrix, backgroundX, backgroundY, 0, 0, this.getBackgroundWidth(), this.getBackgroundHeight());
final String label = Main.MC_VERSION + "-" + Main.MOD_VERSION;
final int versionWidth = this.width - this.font.getStringWidth(label) - 2;
final int versionWidth = this.width - this.font.width(label) - 2;
final int versionHeight = this.height - 10;
this.font.drawString(matrix, label, versionWidth, versionHeight, Config.getSkin().getLabelColor() + 0x33000000);
this.font.draw(matrix, label, versionWidth, versionHeight, Config.getSkin().getLabelColor() + 0x33000000);
int x = this.getContentX();
int y = this.getContentY();
@@ -184,8 +184,8 @@ public class GuiWorldHandler extends Container
}
}
final int maxWidth = this.getBackgroundWidth() - 18 - this.font.getStringWidth(this.getPlayer()) - (Config.getSettings().watch() ? 9 : 0);
this.font.func_243248_b(matrix, TextUtils.stripText(this.content.getTitle(), maxWidth, this.font), backgroundX + 7, backgroundY + 7, Config.getSkin().getLabelColor());
final int maxWidth = this.getBackgroundWidth() - 18 - this.font.width(this.getPlayer()) - (Config.getSettings().watch() ? 9 : 0);
this.font.draw(matrix, TextUtils.stripText(this.content.getTitle(), maxWidth, this.font), backgroundX + 7, backgroundY + 7, Config.getSkin().getLabelColor());
for(int i = 0; i < this.buttons.size(); i++)
{
@@ -220,12 +220,12 @@ public class GuiWorldHandler extends Container
if(mouseX >= versionWidth && mouseY >= versionHeight)
{
matrix.push();
matrix.pushPose();
matrix.translate(versionWidth - 12, versionHeight + 12, 0);
this.renderTooltip(matrix, new StringTextComponent(label), 0, 0);
matrix.pop();
matrix.popPose();
}
RenderSystem.disableBlend();
@@ -325,16 +325,16 @@ public class GuiWorldHandler extends Container
@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers)
{
boolean focused = this.getListener() != null;
boolean focused = this.getFocused() != null;
if(focused && this.getListener() instanceof Widget)
if(focused && this.getFocused() instanceof Widget)
{
focused = ((Widget) this.getListener()).isFocused();
focused = ((Widget) this.getFocused()).isFocused();
}
if(!focused && KeyHandler.KEY_WORLD_HANDLER.matchesKey(keyCode, scanCode) && KeyHandler.KEY_WORLD_HANDLER.getKeyModifier().isActive(null))
if(!focused && KeyHandler.KEY_WORLD_HANDLER.matches(keyCode, scanCode) && KeyHandler.KEY_WORLD_HANDLER.getKeyModifier().isActive(null))
{
Minecraft.getInstance().displayGuiScreen(null);
Minecraft.getInstance().setScreen(null);
return true;
}
@@ -470,11 +470,11 @@ public class GuiWorldHandler extends Container
return this.content;
}
@Override
public boolean shouldCloseOnEsc()
{
return true;
}
// @Override
// public boolean shouldCloseOnEsc()
// {
// return true;
// }
@Override
public int getBackgroundWidth()
@@ -491,6 +491,6 @@ public class GuiWorldHandler extends Container
@Override
public void bindBackground()
{
Minecraft.getInstance().getTextureManager().bindTexture(ResourceHelper.backgroundTexture());
Minecraft.getInstance().getTextureManager().bind(ResourceHelper.backgroundTexture());
}
}

View File

@@ -128,7 +128,7 @@ public class ContentAdvancements extends Content
{
CommandHelper.sendCommand(container.getPlayer(), this.builderAdvancement.build(EnumActionType.REVOKE));
}));
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.reset").mergeStyle(TextFormatting.RED), () ->
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.reset").withStyle(TextFormatting.RED), () ->
{
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderAdvancement.build(EnumActionType.REVOKE, EnumMode.EVERYTHING)));
}));

View File

@@ -48,7 +48,7 @@ public class ContentButcher extends Content
public void initGui(Container container, int x, int y)
{
this.radiusField = new GuiTextFieldTooltip(x + 58, y, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.radius"));
this.radiusField.setValidator(string ->
this.radiusField.setFilter(string ->
{
if(string == null)
{
@@ -69,7 +69,7 @@ public class ContentButcher extends Content
return true;
});
this.radiusField.setText(this.radius);
this.radiusField.setValue(this.radius);
this.radiusField.setResponder(text ->
{
this.radius = text;
@@ -119,15 +119,15 @@ public class ContentButcher extends Content
public static void slaughter(String username, Collection<EntityType<?>> entities, int radius)
{
PlayerEntity player = Minecraft.getInstance().player;
World world = Minecraft.getInstance().world;
World world = Minecraft.getInstance().level;
if(player != null && world != null)
{
AxisAlignedBB aabb = new AxisAlignedBB(player.getPosition()).grow(radius);
AxisAlignedBB aabb = new AxisAlignedBB(player.blockPosition()).inflate(radius);
for(EntityType<?> entity : entities)
{
List<? extends Entity> targets = world.getEntitiesWithinAABB(entity, aabb, Predicates.alwaysTrue());
List<? extends Entity> targets = world.getEntities(entity, aabb, Predicates.alwaysTrue());
targets.removeIf(target -> player.equals(target));
if(!targets.isEmpty())

View File

@@ -45,12 +45,12 @@ public class ContentButcherPresets extends ContentChild
container.add(new GuiButtonBase(x + 58, y, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.presets.passive_mobs"), () ->
{
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITIES.getValues().stream().filter(entity -> !EntityClassification.MONSTER.equals(entity.getClassification()) && !EntityClassification.MISC.equals(entity.getClassification())).collect(Collectors.toList()), this.radius);
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITIES.getValues().stream().filter(entity -> !EntityClassification.MONSTER.equals(entity.getCategory()) && !EntityClassification.MISC.equals(entity.getCategory())).collect(Collectors.toList()), this.radius);
ActionHelper.open(this.getParentContent());
}));
container.add(new GuiButtonBase(x + 58, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.presets.hostile_mobs"), () ->
{
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITIES.getValues().stream().filter(entity -> EntityClassification.MONSTER.equals(entity.getClassification())).collect(Collectors.toList()), this.radius);
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITIES.getValues().stream().filter(entity -> EntityClassification.MONSTER.equals(entity.getCategory())).collect(Collectors.toList()), this.radius);
ActionHelper.open(this.getParentContent());
}));
container.add(new GuiButtonBase(x + 58, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.presets.players"), () ->
@@ -60,7 +60,7 @@ public class ContentButcherPresets extends ContentChild
}));
container.add(new GuiButtonBase(x + 58, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.presets.entities"), () ->
{
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITIES.getValues().stream().filter(entity -> EntityClassification.MISC.equals(entity.getClassification()) && !EntityType.PLAYER.equals(entity)).collect(Collectors.toList()), this.radius);
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITIES.getValues().stream().filter(entity -> EntityClassification.MISC.equals(entity.getCategory()) && !EntityType.PLAYER.equals(entity)).collect(Collectors.toList()), this.radius);
ActionHelper.open(this.getParentContent());
}));
}

View File

@@ -28,14 +28,14 @@ public class ContentButcherSettings extends ContentChild
@Override
public void initGui(Container container, int x, int y)
{
List<EntityType<?>> list = ForgeRegistries.ENTITIES.getValues().stream().filter(EntityType::isSummonable).collect(Collectors.toList());
List<EntityType<?>> list = ForgeRegistries.ENTITIES.getValues().stream().filter(EntityType::canSummon).collect(Collectors.toList());
MenuPageList<EntityType<?>> entities = new MenuPageList<EntityType<?>>(x, y, list, 114, 20, 3, container, new ILogicPageList<EntityType<?>>()
{
@Override
public IFormattableTextComponent translate(EntityType<?> item)
{
return new TranslationTextComponent(item.getTranslationKey());
return new TranslationTextComponent(item.getDescriptionId());
}
@Override

View File

@@ -37,7 +37,7 @@ public class ContentChangeWorld extends ContentChild
container.add(new GuiButtonBase(x + 116 / 2, y + 24, 232 / 2, 20, new TranslationTextComponent("gui.worldhandler.change_world.singleplayer"), () ->
{
IConnection connection = ContentChangeWorld.disconnect();
Minecraft.getInstance().displayGuiScreen(new WorldSelectionScreen(new DummyScreen(() -> ContentChangeWorld.reconnect(connection))));
Minecraft.getInstance().setScreen(new WorldSelectionScreen(new DummyScreen(() -> ContentChangeWorld.reconnect(connection))));
}));
container.add(new GuiButtonBase(x + 116 / 2, y + 48, 232 / 2, 20, new TranslationTextComponent("gui.worldhandler.change_world.multiplayer"), () ->
@@ -45,40 +45,40 @@ public class ContentChangeWorld extends ContentChild
IConnection connection = ContentChangeWorld.disconnect();
DummyScreen dummy = new DummyScreen(() -> ContentChangeWorld.reconnect(connection));
if(Minecraft.getInstance().gameSettings.skipMultiplayerWarning)
if(Minecraft.getInstance().options.skipMultiplayerWarning)
{
Minecraft.getInstance().displayGuiScreen(new MultiplayerScreen(dummy));
Minecraft.getInstance().setScreen(new MultiplayerScreen(dummy));
}
else
{
Minecraft.getInstance().displayGuiScreen(new MultiplayerWarningScreen(dummy));
Minecraft.getInstance().setScreen(new MultiplayerWarningScreen(dummy));
}
}));
}
private static IConnection disconnect()
{
boolean isIntegrated = Minecraft.getInstance().isIntegratedServerRunning();
boolean isIntegrated = Minecraft.getInstance().isLocalServer();
boolean isRealms = Minecraft.getInstance().isConnectedToRealms();
ServerData data = Minecraft.getInstance().getCurrentServerData();
ServerData data = Minecraft.getInstance().getCurrentServer();
if(isIntegrated)
{
IntegratedServer integrated = Minecraft.getInstance().getIntegratedServer();
String folder = integrated.anvilConverterForAnvilFile.getSaveName();
DimensionGeneratorSettings dimensionGeneratorSettings = integrated.getServerConfiguration().getDimensionGeneratorSettings();
WorldSettings worldSettings = integrated.getServerConfiguration().getWorldSettings();
IntegratedServer integrated = Minecraft.getInstance().getSingleplayerServer();
String folder = integrated.storageSource.getLevelId();
DimensionGeneratorSettings dimensionGeneratorSettings = integrated.getWorldData().worldGenSettings();
WorldSettings worldSettings = integrated.getWorldData().getLevelSettings();
Minecraft.getInstance().world.sendQuittingDisconnectingPacket();
Minecraft.getInstance().unloadWorld(new DirtMessageScreen(new TranslationTextComponent("menu.savingLevel")));
Minecraft.getInstance().level.disconnect();
Minecraft.getInstance().clearLevel(new DirtMessageScreen(new TranslationTextComponent("menu.savingLevel")));
return new IntegratedConnection(folder, worldSettings, dimensionGeneratorSettings);
}
if(Minecraft.getInstance().world != null)
if(Minecraft.getInstance().level != null)
{
Minecraft.getInstance().world.sendQuittingDisconnectingPacket();
Minecraft.getInstance().unloadWorld();
Minecraft.getInstance().level.disconnect();
Minecraft.getInstance().clearLevel();
}
if(isRealms)
@@ -94,19 +94,19 @@ public class ContentChangeWorld extends ContentChild
if(connection == null)
{
RealmsBridgeScreen realmsbridge = new RealmsBridgeScreen();
realmsbridge.func_231394_a_(new MainMenuScreen());
realmsbridge.switchToRealms(new MainMenuScreen());
}
else if(connection instanceof IntegratedConnection)
{
IntegratedConnection integrated = (IntegratedConnection) connection;
Minecraft.getInstance().createWorld(integrated.getFolder(), integrated.getWorldSettings(), DynamicRegistries.func_239770_b_(), integrated.getDimensionGeneratorSettings());
Minecraft.getInstance().mouseHelper.grabMouse();
Minecraft.getInstance().createLevel(integrated.getFolder(), integrated.getWorldSettings(), DynamicRegistries.builtin(), integrated.getDimensionGeneratorSettings());
Minecraft.getInstance().mouseHandler.grabMouse();
}
else if(connection instanceof DedicatedConnection)
{
DedicatedConnection dedicated = (DedicatedConnection) connection;
Minecraft.getInstance().displayGuiScreen(new ConnectingScreen(new MainMenuScreen(), Minecraft.getInstance(), dedicated.getData()));
Minecraft.getInstance().mouseHelper.grabMouse();
Minecraft.getInstance().setScreen(new ConnectingScreen(new MainMenuScreen(), Minecraft.getInstance(), dedicated.getData()));
Minecraft.getInstance().mouseHandler.grabMouse();
}
}

View File

@@ -61,11 +61,11 @@ public class ContentCommandStack extends ContentChild
this.builderCommandStack.setZ(new CoordinateDouble(0.0D, EnumType.GLOBAL));
this.builderCommandStack.setMotion(0.0D, 0.315D, 0.0D);
this.builderCommandStack.setTime(1);
this.builderCommandStack.setBlockState(Blocks.ACTIVATOR_RAIL.getDefaultState());
this.builderCommandStack.setBlockState(Blocks.ACTIVATOR_RAIL.defaultBlockState());
EntityNBT redstoneBlock = new EntityNBT(EntityType.FALLING_BLOCK.getRegistryName());
redstoneBlock.setTime(1);
redstoneBlock.setBlockState(Blocks.REDSTONE_BLOCK.getDefaultState());
redstoneBlock.setBlockState(Blocks.REDSTONE_BLOCK.defaultBlockState());
this.builderCommandStack.addPassenger(redstoneBlock);
this.addCommand(0);
@@ -100,8 +100,8 @@ public class ContentCommandStack extends ContentChild
int command = index + this.scroll;
GuiTextFieldTooltip textfield = new GuiTextFieldTooltip(x, y + 24 * index, 232 - 48, 20, new TranslationTextComponent("gui.worldhandler.command_stack.command_n", command + 1));
textfield.setValidator(Predicates.notNull());
textfield.setText(command < this.getCommandCount() ? this.getCommand(command) : null);
textfield.setFilter(Predicates.notNull());
textfield.setValue(command < this.getCommandCount() ? this.getCommand(command) : null);
textfield.setResponder(text ->
{
this.setCommand(command, text);
@@ -169,7 +169,7 @@ public class ContentCommandStack extends ContentChild
container.add(this.buttonCopy = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.command_stack.copy_command"), () ->
{
Minecraft.getInstance().keyboardListener.setClipboardString(this.builderCommandStack.toActualCommand());
Minecraft.getInstance().keyboardHandler.setClipboard(this.builderCommandStack.toActualCommand());
}));
container.add(buttonScrollUp = new GuiButtonIcon(x + 118, y + 72, 56, 20, EnumIcon.ARROW_UP, new TranslationTextComponent("gui.worldhandler.actions.move_up"), () ->
{

View File

@@ -32,24 +32,24 @@ public class ContentContainers extends Content
{
container.add(new GuiButtonBase(x, y + 96, 232, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
container.add(new GuiButtonBase(x + 24, y, 208, 20, Blocks.CRAFTING_TABLE.getTranslatedName(), () ->
container.add(new GuiButtonBase(x + 24, y, 208, 20, Blocks.CRAFTING_TABLE.getName(), () ->
{
BlockHelper.setBlockNearPlayer(container.getPlayer(), Blocks.CRAFTING_TABLE);
ActionHelper.backToGame();
}));
container.add(new GuiButtonBase(x + 24, y + 24, 208, 20, Blocks.ENDER_CHEST.getTranslatedName(), () ->
container.add(new GuiButtonBase(x + 24, y + 24, 208, 20, Blocks.ENDER_CHEST.getName(), () ->
{
BlockHelper.setBlockNearPlayer(container.getPlayer(), Blocks.ENDER_CHEST);
ActionHelper.backToGame();
}));
container.add(new GuiButtonBase(x + 24, y + 48, 208, 20, Blocks.ANVIL.getTranslatedName(), () ->
container.add(new GuiButtonBase(x + 24, y + 48, 208, 20, Blocks.ANVIL.getName(), () ->
{
BlockHelper.setBlockNearPlayer(container.getPlayer(), Blocks.ANVIL);
ActionHelper.backToGame();
}));
container.add(new GuiButtonBase(x + 24, y + 72, 208, 20, Blocks.ENCHANTING_TABLE.getTranslatedName(), () ->
container.add(new GuiButtonBase(x + 24, y + 72, 208, 20, Blocks.ENCHANTING_TABLE.getName(), () ->
{
double angle = Minecraft.getInstance().player.getHorizontalFacing().getHorizontalIndex() * Math.PI / 2;
double angle = Minecraft.getInstance().player.getDirection().get2DDataValue() * Math.PI / 2;
double sin = Math.sin(angle);
double cos = Math.cos(angle);

View File

@@ -43,19 +43,19 @@ public class ContentContinue extends ContentChild
public void initGui(Container container, int x, int y)
{
this.commandField = new GuiTextFieldTooltip(x + 116 / 2, y + 12, 116, 20);
this.commandField.setFocused2(false);
this.commandField.setFocus(false);
if(this.builder instanceof ICommandBuilderSyntax)
{
this.commandField.setText(((ICommandBuilderSyntax) this.builder).toActualCommand());
this.commandField.setValue(((ICommandBuilderSyntax) this.builder).toActualCommand());
}
else
{
this.commandField.setText(this.builder.toCommand());
this.commandField.setValue(this.builder.toCommand());
}
this.commandField.setCursorPositionZero();
this.commandField.setValidator(text -> text.equals(this.commandField.getText()));
this.commandField.moveCursorToStart();
this.commandField.setFilter(text -> text.equals(this.commandField.getValue()));
}
@Override
@@ -65,7 +65,7 @@ public class ContentContinue extends ContentChild
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
container.add(this.commandField);
container.add(new GuiButtonBase(x + 116 / 2, y + 36, 116, 20, new TranslationTextComponent("gui.worldhandler.generic.yes").mergeStyle(TextFormatting.RED), () ->
container.add(new GuiButtonBase(x + 116 / 2, y + 36, 116, 20, new TranslationTextComponent("gui.worldhandler.generic.yes").withStyle(TextFormatting.RED), () ->
{
CommandHelper.sendCommand(container.getPlayer(), this.builder, this.special);
ActionHelper.open(this.getParentContent());

View File

@@ -84,8 +84,8 @@ public class ContentCustomItem extends Content
public void initGui(Container container, int x, int y)
{
this.itemField = new GuiTextFieldTooltip(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.items.custom_item.start.item_id"));
this.itemField.setValidator(Predicates.<String>notNull());
this.itemField.setText(this.item);
this.itemField.setFilter(Predicates.<String>notNull());
this.itemField.setValue(this.item);
this.itemField.setResponder(text ->
{
this.item = text;
@@ -94,7 +94,7 @@ public class ContentCustomItem extends Content
});
this.itemLore1Field = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.items.custom_item.start.lore_1"));
this.itemLore1Field.setValidator(Predicates.<String>notNull());
this.itemLore1Field.setFilter(Predicates.<String>notNull());
this.itemLore1Field.setText(this.builderCutomItem.getLore1());
this.itemLore1Field.setResponder(text ->
{
@@ -103,7 +103,7 @@ public class ContentCustomItem extends Content
});
this.itemLore2Field = new GuiTextFieldTooltip(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.items.custom_item.start.lore_2"));
this.itemLore2Field.setValidator(Predicates.<String>notNull());
this.itemLore2Field.setFilter(Predicates.<String>notNull());
this.itemLore2Field.setText(this.builderCutomItem.getLore2());
this.itemLore2Field.setResponder(text ->
{
@@ -125,7 +125,7 @@ public class ContentCustomItem extends Content
@Override
public IFormattableTextComponent translate(Enchantment item)
{
return new TranslationTextComponent(item.getName());
return new TranslationTextComponent(item.getDescriptionId());
}
@Override
@@ -170,7 +170,7 @@ public class ContentCustomItem extends Content
@Override
public IFormattableTextComponent translate(Attribute item)
{
return new TranslationTextComponent(item.getAttributeName());
return new TranslationTextComponent(item.getDescriptionId());
}
@Override

View File

@@ -82,56 +82,56 @@ public class ContentEditBlocks extends Content
public void initGui(Container container, int x, int y)
{
this.x1Field = new GuiTextFieldTooltip(x + 118, y, 55, 20);
this.x1Field.setValidator(this.getCoordinatePredicate("X1"));
this.x1Field.setText("X1: " + BlockHelper.getPos1().getX());
this.x1Field.setFilter(this.getCoordinatePredicate("X1"));
this.x1Field.setValue("X1: " + BlockHelper.getPos1().getX());
this.x1Field.setResponder(text ->
{
BlockHelper.setPos1(BlockHelper.setX(BlockHelper.getPos1(), this.parseCoordinate(text)));
});
this.y1Field = new GuiTextFieldTooltip(x + 118, y + 24, 55, 20);
this.y1Field.setValidator(this.getCoordinatePredicate("Y1"));
this.y1Field.setText("Y1: " + BlockHelper.getPos1().getY());
this.y1Field.setFilter(this.getCoordinatePredicate("Y1"));
this.y1Field.setValue("Y1: " + BlockHelper.getPos1().getY());
this.y1Field.setResponder(text ->
{
BlockHelper.setPos1(BlockHelper.setY(BlockHelper.getPos1(), this.parseCoordinate(text)));
});
this.z1Field = new GuiTextFieldTooltip(x + 118, y + 48, 55, 20);
this.z1Field.setValidator(this.getCoordinatePredicate("Z1"));
this.z1Field.setText("Z1: " + BlockHelper.getPos1().getZ());
this.z1Field.setFilter(this.getCoordinatePredicate("Z1"));
this.z1Field.setValue("Z1: " + BlockHelper.getPos1().getZ());
this.z1Field.setResponder(text ->
{
BlockHelper.setPos1(BlockHelper.setZ(BlockHelper.getPos1(), this.parseCoordinate(text)));
});
this.x2Field = new GuiTextFieldTooltip(x + 118 + 59, y, 55, 20);
this.x2Field.setValidator(this.getCoordinatePredicate("X2"));
this.x2Field.setText("X2: " + BlockHelper.getPos2().getX());
this.x2Field.setFilter(this.getCoordinatePredicate("X2"));
this.x2Field.setValue("X2: " + BlockHelper.getPos2().getX());
this.x2Field.setResponder(text ->
{
BlockHelper.setPos2(BlockHelper.setX(BlockHelper.getPos2(), this.parseCoordinate(text)));
});
this.y2Field = new GuiTextFieldTooltip(x + 118 + 59, y + 24, 55, 20);
this.y2Field.setValidator(this.getCoordinatePredicate("Y2"));
this.y2Field.setText("Y2: " + BlockHelper.getPos2().getY());
this.y2Field.setFilter(this.getCoordinatePredicate("Y2"));
this.y2Field.setValue("Y2: " + BlockHelper.getPos2().getY());
this.y2Field.setResponder(text ->
{
BlockHelper.setPos2(BlockHelper.setY(BlockHelper.getPos2(), this.parseCoordinate(text)));
});
this.z2Field = new GuiTextFieldTooltip(x + 118 + 59, y + 48, 55, 20);
this.z2Field.setValidator(this.getCoordinatePredicate("Z2"));
this.z2Field.setText("Z2: " + BlockHelper.getPos2().getZ());
this.z2Field.setFilter(this.getCoordinatePredicate("Z2"));
this.z2Field.setValue("Z2: " + BlockHelper.getPos2().getZ());
this.z2Field.setResponder(text ->
{
BlockHelper.setPos2(BlockHelper.setZ(BlockHelper.getPos2(), this.parseCoordinate(text)));
});
this.block1Field = new GuiTextFieldTooltip(x + 118, y, 114, 20, Page.FILL.equals(this.page) ? new TranslationTextComponent("gui.worldhandler.edit_blocks.fill.block_id_to_fill") : new TranslationTextComponent("gui.worldhandler.edit_blocks.replace.block_id_replace"));
this.block1Field.setValidator(Predicates.notNull());
this.block1Field.setText(this.block1);
this.block1Field.setFilter(Predicates.notNull());
this.block1Field.setValue(this.block1);
this.block1Field.setResponder(text ->
{
this.block1 = text;
@@ -140,8 +140,8 @@ public class ContentEditBlocks extends Content
});
this.block2Field = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.replace.block_id_place"));
this.block2Field.setValidator(Predicates.notNull());
this.block2Field.setText(this.block2);
this.block2Field.setFilter(Predicates.notNull());
this.block2Field.setValue(this.block2);
this.block2Field.setResponder(text ->
{
this.block2 = text;
@@ -150,8 +150,8 @@ public class ContentEditBlocks extends Content
});
this.filterField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.clone.filter"));
this.filterField.setValidator(Predicates.notNull());
this.filterField.setText(this.filter);
this.filterField.setFilter(Predicates.notNull());
this.filterField.setValue(this.filter);
this.filterField.setResponder(text ->
{
this.filter = text;

View File

@@ -45,7 +45,7 @@ public class ContentEnchantment extends Content
@Override
public IFormattableTextComponent translate(Enchantment item)
{
return new TranslationTextComponent(item.getName());
return new TranslationTextComponent(item.getDescriptionId());
}
@Override

View File

@@ -55,9 +55,9 @@ public class ContentGamerules extends Content
public void initGui(Container container, int x, int y)
{
this.valueField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.value"));
this.valueField.setValidator(Predicates.notNull());
this.valueField.setText(this.value);
this.valueField.setCursorPositionEnd();
this.valueField.setFilter(Predicates.notNull());
this.valueField.setValue(this.value);
this.valueField.moveCursorToEnd();
this.valueField.setResponder(text ->
{
this.value = text;
@@ -66,12 +66,12 @@ public class ContentGamerules extends Content
Map<String, ArgumentType<?>> map = new HashMap<String, ArgumentType<?>>();
GameRules.visitAll(new IRuleEntryVisitor()
GameRules.visitGameRuleTypes(new IRuleEntryVisitor()
{
@Override
public <T extends RuleValue<T>> void visit(RuleKey<T> rule, RuleType<T> type)
{
map.put(rule.getName(), type.createArgument(null).getType());
map.put(rule.getId(), type.createArgument(null).getType());
}
});

View File

@@ -57,13 +57,13 @@ public class ContentMain extends Content
container.add(new GuiButtonBase(x, y + 96, 74, 20, new TranslationTextComponent("gui.worldhandler.change_world"), () -> ActionHelper.open(Contents.CHANGE_WORLD)));
container.add(new GuiButtonBase(x + 78, y + 96, 76, 20, new TranslationTextComponent("gui.worldhandler.resourcepack"), () ->
{
Minecraft.getInstance().gameSettings.saveOptions();
Minecraft.getInstance().displayGuiScreen(new PackScreen(container, Minecraft.getInstance().getResourcePackList(), resourcePackList ->
Minecraft.getInstance().options.save();
Minecraft.getInstance().setScreen(new PackScreen(container, Minecraft.getInstance().getResourcePackRepository(), resourcePackList ->
{
OptionsScreen optionsScreen = new OptionsScreen(container, Minecraft.getInstance().gameSettings);
OptionsScreen optionsScreen = new OptionsScreen(container, Minecraft.getInstance().options);
optionsScreen.init(Minecraft.getInstance(), 0, 0);
optionsScreen.func_241584_a_(resourcePackList);
}, Minecraft.getInstance().getFileResourcePacks(), new TranslationTextComponent("resourcePack.title")));
optionsScreen.updatePackList(resourcePackList);
}, Minecraft.getInstance().getResourcePackDirectory(), new TranslationTextComponent("resourcePack.title")));
}));
container.add(new GuiButtonBase(x + 158, y + 96, 74, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
}

View File

@@ -84,23 +84,23 @@ public class ContentMultiplayer extends Content
public void initGui(Container container, int x, int y)
{
this.playerField = new GuiTextFieldTooltip(x + 118, y + this.page.getShift(), 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.username"));
this.playerField.setValidator(Predicates.notNull());
this.playerField.setFocused2(false);
this.playerField.setText(this.builderKick.getPlayer());
this.playerField.setMaxStringLength(16);
this.playerField.setFilter(Predicates.notNull());
this.playerField.setFocus(false);
this.playerField.setValue(this.builderKick.getPlayer());
this.playerField.setMaxLength(16);
this.playerField.setResponder(text ->
{
this.setPlayer(this.playerField.getText());
this.setPlayer(this.playerField.getValue());
container.initButtons();
});
this.reasonField = new GuiTextFieldTooltip(x + 118, y + 24 + this.page.getShift(), 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.kick_ban.reason"));
this.reasonField.setValidator(Predicates.notNull());
this.reasonField.setFocused2(false);
this.reasonField.setText(this.builderKick.getReason());
this.reasonField.setFilter(Predicates.notNull());
this.reasonField.setFocus(false);
this.reasonField.setValue(this.builderKick.getReason());
this.reasonField.setResponder(text ->
{
this.setReason(this.reasonField.getText());
this.setReason(this.reasonField.getValue());
container.initButtons();
});
}
@@ -118,7 +118,7 @@ public class ContentMultiplayer extends Content
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new StringTextComponent(I18n.format("gui.worldhandler.multiplayer.kick") + " / " + I18n.format("gui.worldhandler.multiplayer.ban")), () ->
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new StringTextComponent(I18n.get("gui.worldhandler.multiplayer.kick") + " / " + I18n.get("gui.worldhandler.multiplayer.ban")), () ->
{
this.page = Page.KICK_AND_BAN;
container.init();
@@ -157,7 +157,7 @@ public class ContentMultiplayer extends Content
CommandHelper.sendCommand(container.getPlayer(), this.builderBan);
}));
if(this.playerField.getText().isEmpty())
if(this.playerField.getValue().isEmpty())
{
button6.active = false;
button7.active = false;
@@ -173,7 +173,7 @@ public class ContentMultiplayer extends Content
CommandHelper.sendCommand(container.getPlayer(), this.builderPardon);
}));
if(this.playerField.getText().isEmpty())
if(this.playerField.getValue().isEmpty())
{
button6.active = false;
}
@@ -192,7 +192,7 @@ public class ContentMultiplayer extends Content
CommandHelper.sendCommand(container.getPlayer(), this.builderDeop);
}));
if(this.playerField.getText().isEmpty())
if(this.playerField.getValue().isEmpty())
{
button6.active = false;
button7.active = false;
@@ -210,11 +210,11 @@ public class ContentMultiplayer extends Content
{
CommandHelper.sendCommand(container.getPlayer(), this.builderSaveOn);
}));
container.add(new GuiButtonTooltip(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime.autosave", new TranslationTextComponent("gui.worldhandler.generic.off")).mergeStyle(TextFormatting.RED), new StringTextComponent(this.builderSaveOff.toActualCommand()), () ->
container.add(new GuiButtonTooltip(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime.autosave", new TranslationTextComponent("gui.worldhandler.generic.off")).withStyle(TextFormatting.RED), new StringTextComponent(this.builderSaveOff.toActualCommand()), () ->
{
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderSaveOff));
}));
container.add(new GuiButtonTooltip(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime.stop_server").mergeStyle(TextFormatting.RED), new StringTextComponent(this.builderStop.toActualCommand()), () ->
container.add(new GuiButtonTooltip(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime.stop_server").withStyle(TextFormatting.RED), new StringTextComponent(this.builderStop.toActualCommand()), () ->
{
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderStop));
}));
@@ -247,7 +247,7 @@ public class ContentMultiplayer extends Content
CommandHelper.sendCommand(container.getPlayer(), this.builderWhitelist.build(EnumMode.RELOAD));
}));
if(this.playerField.getText().isEmpty())
if(this.playerField.getValue().isEmpty())
{
button6.active = false;
button7.active = false;

View File

@@ -65,7 +65,7 @@ public class ContentNoteEditor extends Content
if(this.isActive)
{
BlockPos pos = this.builderNoteEditor.getBlockPos();
SoundEvent sound = this.getSoundEvent(pos.down());
SoundEvent sound = this.getSoundEvent(pos.below());
container.add(new GuiButtonPiano(x - 3 + 15, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.g"), sound, 0.53F, Type.NORMAL, () ->
{
@@ -182,7 +182,7 @@ public class ContentNoteEditor extends Content
if(this.isActive)
{
RenderUtils.color(1.0F, 1.0F, 1.0F);
Minecraft.getInstance().getTextureManager().bindTexture(NOTE);
Minecraft.getInstance().getTextureManager().bind(NOTE);
container.blit(matrix, x - 1, y - 1, 0, 0, 8, 59);
container.blit(matrix, x - 1, y - 1 + 59, 0, 59, 13, 35);
@@ -197,26 +197,26 @@ public class ContentNoteEditor extends Content
{
float scale = 4;
matrix.push();
matrix.pushPose();
matrix.translate(container.width / 2 - 8 * scale, container.height / 2 - 15 - 8 * scale, 0);
matrix.scale(scale, scale, scale);
RenderUtils.renderItemIntoGUI(matrix, new ItemStack(Blocks.NOTE_BLOCK), 0, 0);
matrix.pop();
matrix.popPose();
TranslationTextComponent text = new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.look_at_note_block", KeyHandler.KEY_WORLD_HANDLER.func_238171_j_());
FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer;
fontRenderer.func_243248_b(matrix, text, x + 116 - fontRenderer.getStringPropertyWidth(text) / 2, y + 70, Config.getSkin().getLabelColor());
TranslationTextComponent text = new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.look_at_note_block", KeyHandler.KEY_WORLD_HANDLER.getTranslatedKeyMessage());
FontRenderer fontRenderer = Minecraft.getInstance().font;
fontRenderer.draw(matrix, text, x + 116 - fontRenderer.width(text) / 2, y + 70, Config.getSkin().getLabelColor());
}
}
private SoundEvent getSoundEvent(BlockPos blockPos)
{
World world = Minecraft.getInstance().world;
World world = Minecraft.getInstance().level;
if(world != null)
{
return NoteBlockInstrument.byState(world.getBlockState(blockPos)).getSound();
return NoteBlockInstrument.byState(world.getBlockState(blockPos)).getSoundEvent();
}
return null;

View File

@@ -123,8 +123,8 @@ public class ContentPlayer extends Content
if(player != null)
{
BlockPos position = player.getPosition();
Minecraft.getInstance().keyboardListener.setClipboardString(position.getX() + " " + position.getY() + " " + position.getZ());
BlockPos position = player.blockPosition();
Minecraft.getInstance().keyboardHandler.setClipboard(position.getX() + " " + position.getY() + " " + position.getZ());
}
}));
}
@@ -132,19 +132,19 @@ public class ContentPlayer extends Content
{
button4.active = false;
container.add(new GuiButtonBase(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous.set_spawn").mergeStyle(TextFormatting.RED), () ->
container.add(new GuiButtonBase(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous.set_spawn").withStyle(TextFormatting.RED), () ->
{
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderSpawnpoint));
}));
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous.set_global_spawn").mergeStyle(TextFormatting.RED), () ->
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous.set_global_spawn").withStyle(TextFormatting.RED), () ->
{
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderSetworldspawn));
}));
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous.kill").mergeStyle(TextFormatting.RED), () ->
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous.kill").withStyle(TextFormatting.RED), () ->
{
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderKill));
}));
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous.clear_inventory").mergeStyle(TextFormatting.RED), () ->
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous.clear_inventory").withStyle(TextFormatting.RED), () ->
{
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderClear));
}));
@@ -158,14 +158,14 @@ public class ContentPlayer extends Content
if(player != null)
{
BlockPos position = player.getPosition();
BlockPos position = player.blockPosition();
this.posXField.setText("X: " + position.getX());
this.posYField.setText("Y: " + position.getY());
this.posZField.setText("Z: " + position.getZ());
this.scoreField.setText(I18n.format("gui.worldhandler.entities.player.score") + ": " + player.getScore());
this.coinsField.setText(I18n.format("gui.worldhandler.entities.player.score.experience") + ": " + player.experienceLevel + "L");
this.xpField.setText(I18n.format("gui.worldhandler.entities.player.score.experience_coins") + ": " + player.experienceTotal);
this.posXField.setValue("X: " + position.getX());
this.posYField.setValue("Y: " + position.getY());
this.posZField.setValue("Z: " + position.getZ());
this.scoreField.setValue(I18n.get("gui.worldhandler.entities.player.score") + ": " + player.getScore());
this.coinsField.setValue(I18n.get("gui.worldhandler.entities.player.score.experience") + ": " + player.experienceLevel + "L");
this.xpField.setValue(I18n.get("gui.worldhandler.entities.player.score.experience_coins") + ": " + player.totalExperience);
}
}
@@ -176,13 +176,13 @@ public class ContentPlayer extends Content
{
int xPos = x + 175;
int yPos = y + 82;
int playerNameWidth = Minecraft.getInstance().fontRenderer.getStringPropertyWidth(Minecraft.getInstance().player.getName()) / 2;
int playerNameWidth = Minecraft.getInstance().font.width(Minecraft.getInstance().player.getName()) / 2;
AbstractGui.fill(matrix, container.width / 2 - playerNameWidth - 1 + 59, yPos - 74, container.width / 2 + playerNameWidth + 1 + 59, yPos - 65, 0x3F000000);
Minecraft.getInstance().fontRenderer.func_243248_b(matrix, Minecraft.getInstance().player.getName(), container.width / 2 - playerNameWidth + 59, yPos - 73, 0xE0E0E0);
Minecraft.getInstance().font.draw(matrix, Minecraft.getInstance().player.getName(), container.width / 2 - playerNameWidth + 59, yPos - 73, 0xE0E0E0);
RenderUtils.color(1.0F, 1.0F, 1.0F, 1.0F);
InventoryScreen.drawEntityOnScreen(xPos, yPos, 30, xPos - mouseX, yPos - mouseY - 44, Minecraft.getInstance().player);
InventoryScreen.renderEntityInInventory(xPos, yPos, 30, xPos - mouseX, yPos - mouseY - 44, Minecraft.getInstance().player);
RenderSystem.defaultBlendFunc();
}
else if(Page.SCORE.equals(this.page))

View File

@@ -68,7 +68,7 @@ public class ContentPotions extends ContentChild
@Override
public IFormattableTextComponent translate(Effect item)
{
return new TranslationTextComponent(item.getName());
return new TranslationTextComponent(item.getDescriptionId());
}
@Override

View File

@@ -41,9 +41,9 @@ public class ContentRecipes extends Content
@Override
public void initGui(Container container, int x, int y)
{
List<IRecipe<?>> recipes = Minecraft.getInstance().player.getRecipeBook().getRecipes().stream()
List<IRecipe<?>> recipes = Minecraft.getInstance().player.getRecipeBook().getCollections().stream()
.flatMap(recipe -> recipe.getRecipes().stream())
.filter(recipe -> !recipe.isDynamic())
.filter(recipe -> !recipe.isSpecial())
.collect(Collectors.toList());
MenuPageList<IRecipe<?>> list = new MenuPageList<IRecipe<?>>(x, y, recipes, 114, 20, 3, container, new ILogicPageList<IRecipe<?>>()
@@ -51,9 +51,9 @@ public class ContentRecipes extends Content
@Override
public IFormattableTextComponent translate(IRecipe<?> item)
{
if(!item.getRecipeOutput().equals(ItemStack.EMPTY))
if(!item.getResultItem().equals(ItemStack.EMPTY))
{
return (IFormattableTextComponent) item.getRecipeOutput().getDisplayName();
return (IFormattableTextComponent) item.getResultItem().getHoverName();
}
return new StringTextComponent(item.getId().toString());

View File

@@ -52,8 +52,8 @@ public class ContentScoreboardObjectives extends ContentScoreboard
public void initGui(Container container, int x, int y)
{
this.objectField = new GuiTextFieldTooltip(x + 118, y + this.page.getShift(), 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.objective"));
this.objectField.setValidator(Predicates.notNull());
this.objectField.setText(ContentScoreboard.getObjective());
this.objectField.setFilter(Predicates.notNull());
this.objectField.setValue(ContentScoreboard.getObjective());
this.objectField.setResponder(text ->
{
ContentScoreboard.setObjective(text);
@@ -102,12 +102,12 @@ public class ContentScoreboardObjectives extends ContentScoreboard
String translation = "stat." + key;
if(!translation.equals(I18n.format(translation)))
if(!translation.equals(I18n.get(translation)))
{
return new TranslationTextComponent(translation);
}
if(Arrays.stream(TextFormatting.values()).map(TextFormatting::getFriendlyName).anyMatch(Predicates.equalTo(key)))
if(Arrays.stream(TextFormatting.values()).map(TextFormatting::getName).anyMatch(Predicates.equalTo(key)))
{
return new TranslationTextComponent("gui.worldhandler.color." + key);
}
@@ -141,7 +141,7 @@ public class ContentScoreboardObjectives extends ContentScoreboard
@Nullable
private ResourceLocation makeResourceLocation(String key)
{
return ResourceLocation.tryCreate(key.replace(".", ":"));
return ResourceLocation.tryParse(key.replace(".", ":"));
}
@Nullable

View File

@@ -80,8 +80,8 @@ public class ContentScoreboardPlayers extends ContentScoreboard
public void initGui(Container container, int x, int y)
{
this.objectField = new GuiTextFieldTooltip(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.objective"));
this.objectField.setValidator(Predicates.notNull());
this.objectField.setText(ContentScoreboard.getObjective());
this.objectField.setFilter(Predicates.notNull());
this.objectField.setValue(ContentScoreboard.getObjective());
this.objectField.setResponder(text ->
{
ContentScoreboard.setObjective(text);
@@ -91,8 +91,8 @@ public class ContentScoreboardPlayers extends ContentScoreboard
});
this.tagField = new GuiTextFieldTooltip(x + 118, y + 12, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.players.tag"));
this.tagField.setValidator(string -> string != null && !string.contains(" "));
this.tagField.setText(this.tag);
this.tagField.setFilter(string -> string != null && !string.contains(" "));
this.tagField.setValue(this.tag);
this.tagField.setResponder(text ->
{
this.tag = text;

View File

@@ -46,8 +46,8 @@ public class ContentScoreboardTeams extends ContentScoreboard
public void initGui(Container container, int x, int y)
{
this.teamField = new GuiTextFieldTooltip(x + 118, y + this.page.getShift(), 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.team"));
this.teamField.setValidator(Predicates.notNull());
this.teamField.setText(this.team);
this.teamField.setFilter(Predicates.notNull());
this.teamField.setValue(this.team);
this.teamField.setResponder(text ->
{
this.team = text;
@@ -68,7 +68,7 @@ public class ContentScoreboardTeams extends ContentScoreboard
}
else if(depth == 1)
{
if(Arrays.stream(TextFormatting.values()).map(TextFormatting::getFriendlyName).anyMatch(Predicates.equalTo(key)))
if(Arrays.stream(TextFormatting.values()).map(TextFormatting::getName).anyMatch(Predicates.equalTo(key)))
{
return new TranslationTextComponent("gui.worldhandler.color." + key);
}
@@ -125,12 +125,12 @@ public class ContentScoreboardTeams extends ContentScoreboard
this.page = Page.ADD;
container.init();
}));
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new StringTextComponent(I18n.format("gui.worldhandler.scoreboard.team.join") + " / " + I18n.format("gui.worldhandler.scoreboard.team.leave")), () ->
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new StringTextComponent(I18n.get("gui.worldhandler.scoreboard.team.join") + " / " + I18n.get("gui.worldhandler.scoreboard.team.leave")), () ->
{
this.page = Page.JOIN_OR_LEAVE;
container.init();
}));
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new StringTextComponent(I18n.format("gui.worldhandler.scoreboard.team.remove") + " / " + I18n.format("gui.worldhandler.scoreboard.team.empty")), () ->
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new StringTextComponent(I18n.get("gui.worldhandler.scoreboard.team.remove") + " / " + I18n.get("gui.worldhandler.scoreboard.team.empty")), () ->
{
this.page = Page.REMOVE_OR_EMPTY;
container.init();

View File

@@ -89,7 +89,7 @@ public class ContentSettings extends ContentChild
container.add(settings);
this.valueField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.value"));
this.valueField.setValidator(string ->
this.valueField.setFilter(string ->
{
if(string == null)
{
@@ -144,12 +144,12 @@ public class ContentSettings extends ContentChild
else if(this.setting instanceof IntegerSetting)
{
IntegerSetting setting = (IntegerSetting) this.setting;
this.valueField.setText(String.valueOf(setting.get()));
this.valueField.setValue(String.valueOf(setting.get()));
container.add(this.valueField);
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.set"), () ->
{
String text = this.valueField.getText();
String text = this.valueField.getValue();
if(text.isEmpty())
{

View File

@@ -62,9 +62,9 @@ public class ContentSignEditor extends Content
if(this.isActive)
{
this.commandField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.blocks.sign_editor.commmand"));
this.commandField.setValidator(Predicates.notNull());
this.commandField.setText(this.builderSignEditor.getCommand(this.selectedLine));
this.commandField.setCursorPositionEnd();
this.commandField.setFilter(Predicates.notNull());
this.commandField.setValue(this.builderSignEditor.getCommand(this.selectedLine));
this.commandField.moveCursorToEnd();
this.commandField.setResponder(text ->
{
this.builderSignEditor.setCommand(this.selectedLine, text);
@@ -76,7 +76,7 @@ public class ContentSignEditor extends Content
@Override
public boolean validate(String text)
{
return Minecraft.getInstance().fontRenderer.getStringWidth(text) <= 90;
return Minecraft.getInstance().font.width(text) <= 90;
}
@Override
@@ -180,16 +180,16 @@ public class ContentSignEditor extends Content
{
float scale = 4;
matrix.push();
matrix.pushPose();
matrix.translate(container.width / 2 - 8.5F * scale, container.height / 2 - 15 - 8.5F * scale, 0);
matrix.scale(scale, scale, scale);
RenderUtils.renderItemIntoGUI(matrix, new ItemStack(Items.OAK_SIGN), 0, 0);
matrix.pop();
matrix.popPose();
TranslationTextComponent text = new TranslationTextComponent("gui.worldhandler.blocks.sign_editor.look_at_sign", KeyHandler.KEY_WORLD_HANDLER.func_238171_j_());
FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer;
fontRenderer.func_243248_b(matrix, text, x + 116 - fontRenderer.getStringPropertyWidth(text) / 2, y + 70, Config.getSkin().getLabelColor());
TranslationTextComponent text = new TranslationTextComponent("gui.worldhandler.blocks.sign_editor.look_at_sign", KeyHandler.KEY_WORLD_HANDLER.getTranslatedKeyMessage());
FontRenderer fontRenderer = Minecraft.getInstance().font;
fontRenderer.draw(matrix, text, x + 116 - fontRenderer.width(text) / 2, y + 70, Config.getSkin().getLabelColor());
}
}

View File

@@ -158,8 +158,8 @@ public class ContentSummon extends Content
public void initGui(Container container, int x, int y)
{
this.mobField = new GuiTextFieldTooltip(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.summon.start.mob_id"));
this.mobField.setValidator(Predicates.notNull());
this.mobField.setText(this.mob);
this.mobField.setFilter(Predicates.notNull());
this.mobField.setValue(this.mob);
this.mobField.setResponder(text ->
{
this.mob = text;
@@ -168,8 +168,8 @@ public class ContentSummon extends Content
});
this.nbtField = new GuiTextFieldTooltip(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.summon.start.custom_nbt"));
this.nbtField.setValidator(Predicates.notNull());
this.nbtField.setText(this.nbt);
this.nbtField.setFilter(Predicates.notNull());
this.nbtField.setValue(this.nbt);
this.nbtField.setResponder(text ->
{
this.nbt = text;
@@ -209,7 +209,7 @@ public class ContentSummon extends Content
@Override
public IFormattableTextComponent translate(Attribute item)
{
return new TranslationTextComponent(item.getAttributeName());
return new TranslationTextComponent(item.getDescriptionId());
}
@Override
@@ -316,7 +316,7 @@ public class ContentSummon extends Content
{
Effect potion = ForgeRegistries.POTIONS.getValue(location);
if(!potion.equals(Effects.INSTANT_DAMAGE) && !potion.equals(Effects.INSTANT_HEALTH))
if(!potion.equals(Effects.HARM) && !potion.equals(Effects.HEAL))
{
if(this.potionPage == 0)
{
@@ -330,7 +330,7 @@ public class ContentSummon extends Content
if(count == this.potionPage)
{
container.add(new GuiSlider(x + 118, y, 114, 20, 0, Config.getSliders().getMaxSummonPotionAmplifier(), 0, container, new LogicSliderSimple("amplifier" + potion.getRegistryName(), new TranslationTextComponent(potion.getName()), value ->
container.add(new GuiSlider(x + 118, y, 114, 20, 0, Config.getSliders().getMaxSummonPotionAmplifier(), 0, container, new LogicSliderSimple("amplifier" + potion.getRegistryName(), new TranslationTextComponent(potion.getDescriptionId()), value ->
{
this.builderSummon.setAmplifier(potion, value.byteValue());
})));
@@ -429,12 +429,12 @@ public class ContentSummon extends Content
}
else if(Page.POTIONS.equals(this.page))
{
Minecraft.getInstance().fontRenderer.drawString(matrix, (this.potionPage + 1) + "/" + (ForgeRegistries.POTIONS.getKeys().size() - 2), x + 118, y - 11, Config.getSkin().getHeadlineColor());
Minecraft.getInstance().font.draw(matrix, (this.potionPage + 1) + "/" + (ForgeRegistries.POTIONS.getKeys().size() - 2), x + 118, y - 11, Config.getSkin().getHeadlineColor());
}
else if(Page.EQUIPMENT.equals(this.page))
{
RenderUtils.color(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getInstance().getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/beacon.png"));
Minecraft.getInstance().getTextureManager().bind(new ResourceLocation("textures/gui/container/beacon.png"));
container.setBlitOffset(0);
for(int i = 0; i < 4; i++)
@@ -458,7 +458,7 @@ public class ContentSummon extends Content
private List<ResourceLocation> sortedPotions()
{
return ForgeRegistries.POTIONS.getKeys().stream()
.sorted((a, b) -> I18n.format(ForgeRegistries.POTIONS.getValue(a).getName()).compareTo(I18n.format(ForgeRegistries.POTIONS.getValue(b).getName())))
.sorted((a, b) -> I18n.get(ForgeRegistries.POTIONS.getValue(a).getDescriptionId()).compareTo(I18n.get(ForgeRegistries.POTIONS.getValue(b).getDescriptionId())))
.collect(Collectors.toList());
}

View File

@@ -153,7 +153,7 @@ public class ContentUsercontent extends Content
{
if(label.getVisible() == null || label.getVisible().eval(this.engineAdapter))
{
container.getMinecraft().fontRenderer.func_243248_b(matrix, TextUtils.formatNonnull(label.getText()), label.getX() + x, label.getY() + y, label.getColor());
container.getMinecraft().font.draw(matrix, TextUtils.formatNonnull(label.getText()), label.getX() + x, label.getY() + y, label.getColor());
}
}
}
@@ -257,14 +257,14 @@ public class ContentUsercontent extends Content
private void printError(String type, int index, Throwable e)
{
ITextComponent message = new StringTextComponent(TextFormatting.RED + "<" + Main.NAME + ":" + this.id + ":" + type + ":" + index + "> " + e.getMessage());
Minecraft.getInstance().ingameGUI.func_238450_a_(ChatType.CHAT, message, Util.DUMMY_UUID);
Minecraft.getInstance().gui.handleChat(ChatType.CHAT, message, Util.NIL_UUID);
}
private void updateTextfields()
{
for(VisibleActiveObject<TextFieldWidget> visObj : this.textfields.values())
{
visObj.getObject().setEnabled(visObj.isEnabled(this.engineAdapter));
visObj.getObject().setEditable(visObj.isEnabled(this.engineAdapter));
visObj.getObject().setVisible(visObj.isVisible(this.engineAdapter));
}
}

View File

@@ -41,24 +41,24 @@ public class ContentWorldInfo extends Content
public void initGui(Container container, int x, int y)
{
World world = ContentWorldInfo.getSidedWorld();
IntegratedServer server = Minecraft.getInstance().getIntegratedServer();
IntegratedServer server = Minecraft.getInstance().getSingleplayerServer();
this.posXField = new GuiTextFieldTooltip(x + 118, y + 12, 114, 20);
this.posXField.setText(I18n.format("gui.worldhandler.world_info.start.spawn") + " X: " + ContentWorldInfo.format(world, object -> object.getWorldInfo().getSpawnX()));
this.posXField.setValue(I18n.get("gui.worldhandler.world_info.start.spawn") + " X: " + ContentWorldInfo.format(world, object -> object.getLevelData().getXSpawn()));
this.posYField = new GuiTextFieldTooltip(x + 118, y + 36, 114, 20);
this.posYField.setText(I18n.format("gui.worldhandler.world_info.start.spawn") + " Y: " + ContentWorldInfo.format(world, object -> object.getWorldInfo().getSpawnY()));
this.posYField.setValue(I18n.get("gui.worldhandler.world_info.start.spawn") + " Y: " + ContentWorldInfo.format(world, object -> object.getLevelData().getYSpawn()));
this.posZField = new GuiTextFieldTooltip(x + 118, y + 60, 114, 20);
this.posZField.setText(I18n.format("gui.worldhandler.world_info.start.spawn") + " Z: " + ContentWorldInfo.format(world, object -> object.getWorldInfo().getSpawnZ()));
this.posZField.setValue(I18n.get("gui.worldhandler.world_info.start.spawn") + " Z: " + ContentWorldInfo.format(world, object -> object.getLevelData().getZSpawn()));
this.worldField = new GuiTextFieldTooltip(x + 118, y + 12, 114, 20);
this.worldField.setText(I18n.format("gui.worldhandler.world_info.world.name") + ": " + ContentWorldInfo.format(server, object -> object.getServerConfiguration().getWorldName()));
this.worldField.setValue(I18n.get("gui.worldhandler.world_info.world.name") + ": " + ContentWorldInfo.format(server, object -> object.getWorldData().getLevelName()));
this.seedField = new GuiTextFieldTooltip(x + 118, y + 36, 114, 20);
this.seedField.setText(I18n.format("gui.worldhandler.world_info.world.seed") + ": " + ContentWorldInfo.format(server, object -> object.func_241755_D_().getSeed()));
this.seedField.setValidator(string -> string.equals(this.seedField.getText()));
this.seedField.setCursorPositionZero();
this.seedField.setValue(I18n.get("gui.worldhandler.world_info.world.seed") + ": " + ContentWorldInfo.format(server, object -> object.overworld().getSeed()));
this.seedField.setFilter(string -> string.equals(this.seedField.getValue()));
this.seedField.moveCursorToStart();
this.currentTimeField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20);
this.updateCurrentTime();
@@ -100,12 +100,12 @@ public class ContentWorldInfo extends Content
else if(Page.WORLD.equals(this.page))
{
GuiButtonBase seed;
IntegratedServer server = Minecraft.getInstance().getIntegratedServer();
IntegratedServer server = Minecraft.getInstance().getSingleplayerServer();
world.active = false;
container.add(seed = new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.world_info.world.copy_seed"), () ->
{
Minecraft.getInstance().keyboardListener.setClipboardString(String.valueOf(server.func_241755_D_().getSeed()));
Minecraft.getInstance().keyboardHandler.setClipboard(String.valueOf(server.overworld().getSeed()));
}));
seed.active = server != null;
@@ -147,21 +147,21 @@ public class ContentWorldInfo extends Content
private void updateCurrentTime()
{
World world = Minecraft.getInstance().world;
World world = Minecraft.getInstance().level;
if(world != null)
{
this.currentTimeField.setText(I18n.format("gui.worldhandler.world_info.statistics.world_time") + ": " + TextUtils.formatWorldTime(world.getWorldInfo().getDayTime()));
this.currentTimeField.setValue(I18n.get("gui.worldhandler.world_info.statistics.world_time") + ": " + TextUtils.formatWorldTime(world.getLevelData().getDayTime()));
}
}
private void updateTotalTime()
{
World world = Minecraft.getInstance().world;
World world = Minecraft.getInstance().level;
if(world != null)
{
this.totalTimeField.setText(I18n.format("gui.worldhandler.world_info.statistics.played") + ": " + TextUtils.formatTotalTime(world.getWorldInfo().getGameTime()));
this.totalTimeField.setValue(I18n.get("gui.worldhandler.world_info.statistics.played") + ": " + TextUtils.formatTotalTime(world.getLevelData().getGameTime()));
}
}
@@ -172,17 +172,17 @@ public class ContentWorldInfo extends Content
return String.valueOf(function.apply(object));
}
return I18n.format("gui.worldhandler.world_info.n_a");
return I18n.get("gui.worldhandler.world_info.n_a");
}
private static World getSidedWorld()
{
if(Minecraft.getInstance().isSingleplayer())
if(Minecraft.getInstance().isLocalServer())
{
return Minecraft.getInstance().getIntegratedServer().func_241755_D_();
return Minecraft.getInstance().getSingleplayerServer().overworld();
}
return Minecraft.getInstance().world;
return Minecraft.getInstance().level;
}
@Override

View File

@@ -18,7 +18,7 @@ public interface ILogicMapped<T> extends ILogic
if(tooltip != null)
{
return tooltip.appendString(String.format(" (%d/%d)", index, max));
return tooltip.append(String.format(" (%d/%d)", index, max));
}
return (IFormattableTextComponent) StringTextComponent.EMPTY;

View File

@@ -67,9 +67,9 @@ public class MenuColorField extends Menu
public void initGui(Container container)
{
this.textField = new GuiTextFieldTooltip(this.x + 118, this.y, 114, 20, new TranslationTextComponent(this.translationKey));
this.textField.setValidator(this.logic::validate);
this.textField.setTextFormatter(this.string::formatter);
this.textField.setText(this.string.getUnformattedComponentText());
this.textField.setFilter(this.logic::validate);
this.textField.setFormatter(this.string::formatter);
this.textField.setValue(this.string.getContents());
this.textField.setResponder(text ->
{
this.string.setText(text);
@@ -91,7 +91,7 @@ public class MenuColorField extends Menu
@Override
public IFormattableTextComponent translate(TextFormatting item)
{
return new TranslationTextComponent("gui.worldhandler.color").mergeStyle(item).appendString(": ").append(new TranslationTextComponent("gui.worldhandler.color." + item.getFriendlyName()));
return new TranslationTextComponent("gui.worldhandler.color").withStyle(item).append(": ").append(new TranslationTextComponent("gui.worldhandler.color." + item.getName()));
}
@Override
@@ -109,7 +109,7 @@ public class MenuColorField extends Menu
@Override
public void onClick(TextFormatting item)
{
MenuColorField.this.string.mergeStyle(item);
MenuColorField.this.string.withStyle(item);
}
@Override
@@ -119,29 +119,29 @@ public class MenuColorField extends Menu
}
}));
container.add(new GuiButtonBase(this.x + 118, this.y + 48, 20, 20, new StringTextComponent("I").setStyle(Style.EMPTY.setItalic(this.string.getStyle().getItalic())), () ->
container.add(new GuiButtonBase(this.x + 118, this.y + 48, 20, 20, new StringTextComponent("I").setStyle(Style.EMPTY.withItalic(this.string.getStyle().isItalic())), () ->
{
this.string.setStyle(this.string.getStyle().setItalic(!this.string.getStyle().getItalic()));
this.string.setStyle(this.string.getStyle().withItalic(!this.string.getStyle().isItalic()));
container.init();
}));
container.add(new GuiButtonBase(this.x + 118 + 24 - 1, this.y + 48, 20, 20, new StringTextComponent("B").setStyle(Style.EMPTY.setBold(this.string.getStyle().getBold())), () ->
container.add(new GuiButtonBase(this.x + 118 + 24 - 1, this.y + 48, 20, 20, new StringTextComponent("B").setStyle(Style.EMPTY.withBold(this.string.getStyle().isBold())), () ->
{
this.string.setStyle(this.string.getStyle().setItalic(!this.string.getStyle().getBold()));
this.string.setStyle(this.string.getStyle().withItalic(!this.string.getStyle().isBold()));
container.init();
}));
container.add(new GuiButtonBase(this.x + 118 + 24 * 2 - 1, this.y + 48, 20, 20, new StringTextComponent("U").setStyle(Style.EMPTY.setUnderlined(this.string.getStyle().getUnderlined())), () ->
container.add(new GuiButtonBase(this.x + 118 + 24 * 2 - 1, this.y + 48, 20, 20, new StringTextComponent("U").setStyle(Style.EMPTY.setUnderlined(this.string.getStyle().isUnderlined())), () ->
{
this.string.setStyle(this.string.getStyle().setUnderlined(!this.string.getStyle().getUnderlined()));
this.string.setStyle(this.string.getStyle().setUnderlined(!this.string.getStyle().isUnderlined()));
container.init();
}));
container.add(new GuiButtonBase(this.x + 118 + 24 * 3 - 1, this.y + 48, 20, 20, new StringTextComponent("S").setStyle(Style.EMPTY.setStrikethrough(this.string.getStyle().getStrikethrough())), () ->
container.add(new GuiButtonBase(this.x + 118 + 24 * 3 - 1, this.y + 48, 20, 20, new StringTextComponent("S").setStyle(Style.EMPTY.setStrikethrough(this.string.getStyle().isStrikethrough())), () ->
{
this.string.setStyle(this.string.getStyle().setStrikethrough(!this.string.getStyle().getStrikethrough()));
this.string.setStyle(this.string.getStyle().setStrikethrough(!this.string.getStyle().isStrikethrough()));
container.init();
}));
container.add(new GuiButtonBase(this.x + 118 + 24 * 4 - 2, this.y + 48, 20, 20, new StringTextComponent("O").setStyle(Style.EMPTY.setObfuscated(this.string.getStyle().getObfuscated())), () ->
container.add(new GuiButtonBase(this.x + 118 + 24 * 4 - 2, this.y + 48, 20, 20, new StringTextComponent("O").setStyle(Style.EMPTY.setObfuscated(this.string.getStyle().isObfuscated())), () ->
{
this.string.setStyle(this.string.getStyle().setObfuscated(!this.string.getStyle().getObfuscated()));
this.string.setStyle(this.string.getStyle().setObfuscated(!this.string.getStyle().isObfuscated()));
container.init();
}));
}

View File

@@ -78,7 +78,7 @@ public class MenuPageList<T> extends Menu
if(index < this.items.size())
{
T item = this.items.get(index);
IFormattableTextComponent text = TextUtils.stripText(this.logic.translate(item), this.width, Minecraft.getInstance().fontRenderer);
IFormattableTextComponent text = TextUtils.stripText(this.logic.translate(item), this.width, Minecraft.getInstance().font);
button = this.logic.onRegister(this.x, this.y + (this.height + 4) * x, this.width, this.height, text, item, () ->
{
this.persistence.setSelectedIndex(index);
@@ -109,7 +109,7 @@ public class MenuPageList<T> extends Menu
@Override
public void draw(MatrixStack matrix, int mouseX, int mouseY, float partialTicks)
{
Minecraft.getInstance().fontRenderer.drawString(matrix, String.format("%d/%d", this.persistence.getPage() + 1, this.getTotalPages()), this.x, this.y - 11, Config.getSkin().getHeadlineColor());
Minecraft.getInstance().font.draw(matrix, String.format("%d/%d", this.persistence.getPage() + 1, this.getTotalPages()), this.x, this.y - 11, Config.getSkin().getHeadlineColor());
}
private void goLeft(Container container)

View File

@@ -54,19 +54,19 @@ public class WidgetCommandSyntax implements IContainerWidget
{
if(this.syntaxField != null && !this.syntaxField.isFocused())
{
this.syntaxField.setValidator(Predicates.alwaysTrue());
this.syntaxField.setFilter(Predicates.alwaysTrue());
if(container.getContent().getCommandBuilder() != null)
{
this.syntaxField.setText(container.getContent().getCommandBuilder().toCommand());
this.syntaxField.setValue(container.getContent().getCommandBuilder().toCommand());
}
else
{
this.syntaxField.setText(BUILDER_WORLD_HANDLER.toCommand());
this.syntaxField.setValue(BUILDER_WORLD_HANDLER.toCommand());
}
this.syntaxField.setValidator(string -> string.equals(this.syntaxField.getText()));
this.syntaxField.setCursorPositionZero();
this.syntaxField.setFilter(string -> string.equals(this.syntaxField.getValue()));
this.syntaxField.moveCursorToStart();
}
}

View File

@@ -15,12 +15,12 @@ import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class WidgetNameField implements IContainerWidget
{
private final GuiTextFieldTooltip nameField = Util.make(new GuiTextFieldTooltip(0, 0, 0, 11), textfield -> textfield.setMaxStringLength(16));
private final GuiTextFieldTooltip nameField = Util.make(new GuiTextFieldTooltip(0, 0, 0, 11), textfield -> textfield.setMaxLength(16));
@Override
public void initGui(Container container, int x, int y)
{
this.nameField.setText(container.getPlayer());
this.nameField.setValue(container.getPlayer());
this.nameField.setResponder(text ->
{
container.setPlayer(text);
@@ -38,12 +38,12 @@ public class WidgetNameField implements IContainerWidget
@Override
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
{
String username = container.getPlayer().isEmpty() && !this.nameField.isFocused() ? I18n.format("gui.worldhandler.generic.edit_username") : container.getPlayer();
String username = container.getPlayer().isEmpty() && !this.nameField.isFocused() ? I18n.get("gui.worldhandler.generic.edit_username") : container.getPlayer();
int xPos = container.getBackgroundX() + container.getBackgroundWidth() - this.watchOffset() - 7 - Minecraft.getInstance().fontRenderer.getStringWidth(username);
int xPos = container.getBackgroundX() + container.getBackgroundWidth() - this.watchOffset() - 7 - Minecraft.getInstance().font.width(username);
int yPos = container.getBackgroundY() + 7;
Minecraft.getInstance().fontRenderer.drawString(matrix, username, xPos, yPos, Config.getSkin().getLabelColor());
Minecraft.getInstance().font.draw(matrix, username, xPos, yPos, Config.getSkin().getLabelColor());
}
@Override
@@ -51,7 +51,7 @@ public class WidgetNameField implements IContainerWidget
{
if(this.nameField.isFocused())
{
this.nameField.setCursorPositionEnd();
this.nameField.moveCursorToEnd();
}
return false;
@@ -62,7 +62,7 @@ public class WidgetNameField implements IContainerWidget
{
if(this.nameField.isFocused())
{
this.nameField.setCursorPositionEnd();
this.nameField.moveCursorToEnd();
}
return false;
@@ -81,20 +81,20 @@ public class WidgetNameField implements IContainerWidget
private void updateNameField(Container container)
{
final FontRenderer font = Minecraft.getInstance().fontRenderer;
final FontRenderer font = Minecraft.getInstance().font;
int x = container.getBackgroundX() + container.getBackgroundWidth() - this.watchOffset() - 7;
int y = container.getBackgroundY() + 6;
if(container.getPlayer().isEmpty())
{
int width = font.getStringWidth(I18n.format("gui.worldhandler.generic.edit_username")) + 2;
int width = font.width(I18n.get("gui.worldhandler.generic.edit_username")) + 2;
this.nameField.setWidth(width);
this.nameField.setPosition(x - (font.getStringPropertyWidth(container.getContent().getTitle()) + 2), y);
this.nameField.setPosition(x - (font.width(container.getContent().getTitle()) + 2), y);
}
else
{
int width = font.getStringWidth(container.getPlayer()) + 2;
int width = font.width(container.getPlayer()) + 2;
this.nameField.setWidth(width);
this.nameField.setPosition(x - width, y);
}

View File

@@ -69,7 +69,7 @@ public class WidgetTabRenderer implements IContainerWidget
int offset = WidgetTabRenderer.offset(container, index, size);
Content tab = category.getContent(index);
ITextComponent title = TextUtils.stripText(tab.getTabTitle().mergeStyle(TextFormatting.UNDERLINE), width, Minecraft.getInstance().fontRenderer);
ITextComponent title = TextUtils.stripText(tab.getTabTitle().withStyle(TextFormatting.UNDERLINE), width, Minecraft.getInstance().font);
if(content.getActiveContent().equals(tab))
{
@@ -174,7 +174,7 @@ public class WidgetTabRenderer implements IContainerWidget
private void drawTabTitle(MatrixStack matrix, AbstractGui gui, ITextComponent title, int x, int y, int color)
{
gui.setBlitOffset(0);
AbstractGui.drawCenteredString(matrix, Minecraft.getInstance().fontRenderer, title, x, y, color);
AbstractGui.drawCenteredString(matrix, Minecraft.getInstance().font, title, x, y, color);
}
@Override

View File

@@ -22,9 +22,9 @@ public class WidgetWatch implements IContainerWidget
long time = 0;
if(Minecraft.getInstance().world != null)
if(Minecraft.getInstance().level != null)
{
time = Minecraft.getInstance().world.getWorldInfo().getDayTime();
time = Minecraft.getInstance().level.getLevelData().getDayTime();
}
RenderUtils.drawWatchIntoGui(matrix, container, watchX, watchY, time, Config.getSettings().smoothWatch());

View File

@@ -33,7 +33,7 @@ public class GuiButtonBase extends Button
public void renderButton(MatrixStack matrix, int mouseX, int mouseY, float partialTicks)
{
this.renderBg(matrix, Minecraft.getInstance(), mouseX, mouseY);
AbstractGui.drawCenteredString(matrix, Minecraft.getInstance().fontRenderer, this.getMessage(), this.x + this.width / 2, this.y + (this.height - 8) / 2, this.getFGColor());
AbstractGui.drawCenteredString(matrix, Minecraft.getInstance().font, this.getMessage(), this.x + this.width / 2, this.y + (this.height - 8) / 2, this.getFGColor());
}
@Override
@@ -43,7 +43,7 @@ public class GuiButtonBase extends Button
RenderUtils.colorDefaultButton();
int hovered = this.getYImage(this.isHovered());
Minecraft.getInstance().getTextureManager().bindTexture(ResourceHelper.buttonTexture());
Minecraft.getInstance().getTextureManager().bind(ResourceHelper.buttonTexture());
int hWidth = this.width / 2;
int hHeight = this.height / 2;

View File

@@ -34,7 +34,7 @@ public class GuiButtonIcon extends GuiButtonTooltip
private void renderIcon(MatrixStack matrix)
{
Minecraft.getInstance().getTextureManager().bindTexture(ResourceHelper.iconTexture());
Minecraft.getInstance().getTextureManager().bind(ResourceHelper.iconTexture());
if(this.active)
{

View File

@@ -21,7 +21,7 @@ public class GuiButtonItem extends GuiButtonBase
public GuiButtonItem(int x, int y, int width, int height, ItemStack stack, ActionHandler actionHandler)
{
super(x, y, width, height, stack.getTextComponent(), actionHandler);
super(x, y, width, height, stack.getHoverName(), actionHandler);
this.stack = stack;
}
@@ -29,6 +29,6 @@ public class GuiButtonItem extends GuiButtonBase
public void renderButton(MatrixStack matrix, int mouseX, int mouseY, float partialTicks)
{
super.renderBg(matrix, Minecraft.getInstance(), mouseX, mouseY);
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(this.stack, this.x + this.width / 2 - 8, this.y + 2);
Minecraft.getInstance().getItemRenderer().renderGuiItem(this.stack, this.x + this.width / 2 - 8, this.y + 2);
}
}

View File

@@ -45,15 +45,15 @@ public class GuiButtonList<T> extends GuiButtonTooltip
this.renderBg(matrix, Minecraft.getInstance(), mouseX, mouseY);
this.updateMessage();
FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer;
FontRenderer fontRenderer = Minecraft.getInstance().font;
if(this.getMessage() != null && !this.getMessage().getString().isEmpty())
{
ITextComponent leftArrow = this.isHoveringLeft(mouseX, mouseY) ? TextUtils.ARROW_LEFT_BOLD : TextUtils.ARROW_LEFT;
ITextComponent rightArrow = this.isHoveringRight(mouseX, mouseY) ? TextUtils.ARROW_RIGHT_BOLD : TextUtils.ARROW_RIGHT;
int maxWidth = Math.max(0, this.width - fontRenderer.getStringWidth("< >"));
int spaceWidth = fontRenderer.getStringWidth(" ");
int maxWidth = Math.max(0, this.width - fontRenderer.width("< >"));
int spaceWidth = fontRenderer.width(" ");
ITextComponent display = TextUtils.stripText((IFormattableTextComponent) this.getMessage(), maxWidth, fontRenderer);
int yPos = this.y + (this.height - 8) / 2;

View File

@@ -55,7 +55,7 @@ public class GuiButtonPiano extends GuiButtonBase
int hovered = this.getYImage(this.isHovered());
RenderUtils.color(1.0F, 1.0F, 1.0F, Config.getSkin().getButtonAlpha());
Minecraft.getInstance().getTextureManager().bindTexture(NOTE);
Minecraft.getInstance().getTextureManager().bind(NOTE);
switch(this.type)
{
@@ -75,10 +75,10 @@ public class GuiButtonPiano extends GuiButtonBase
protected void drawWhiteKey(MatrixStack matrix, int hoverstate)
{
int textColor = this.getFGColor();
FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer;
FontRenderer fontRenderer = Minecraft.getInstance().font;
this.blit(matrix, this.x, this.y, 25 + hoverstate * 15 - 15, 0, 15, 92);
fontRenderer.func_243248_b(matrix, this.getMessage(), (float) (this.x + this.width / 2 - fontRenderer.getStringPropertyWidth(this.getMessage()) / 2), (float) (this.y + (this.height - 8) / 2 + 36), textColor); //drawString
fontRenderer.draw(matrix, this.getMessage(), (float) (this.x + this.width / 2 - fontRenderer.width(this.getMessage()) / 2), (float) (this.y + (this.height - 8) / 2 + 36), textColor); //drawString
}
protected void drawBlackKey(MatrixStack matrix, int hoverstate)
@@ -108,7 +108,7 @@ public class GuiButtonPiano extends GuiButtonBase
{
if(this.sound != null)
{
soundHandler.play(SimpleSound.master(this.sound, this.pitch));
soundHandler.play(SimpleSound.forUI(this.sound, this.pitch));
}
}

View File

@@ -93,8 +93,8 @@ public class GuiSlider extends GuiButtonBase
{
int value = this.persistence.getValueInt();
IFormattableTextComponent suffix = this.logic.formatValue(value).append(this.logic.formatSuffix(value));
FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer;
IFormattableTextComponent text = TextUtils.stripText(this.logic.formatPrefix(value), this.width - fontRenderer.getStringPropertyWidth(suffix), fontRenderer).append(suffix);
FontRenderer fontRenderer = Minecraft.getInstance().font;
IFormattableTextComponent text = TextUtils.stripText(this.logic.formatPrefix(value), this.width - fontRenderer.width(suffix), fontRenderer).append(suffix);
this.setMessage(text);
}

View File

@@ -21,8 +21,8 @@ public class GuiTextFieldTooltip extends TextFieldWidget
public GuiTextFieldTooltip(int x, int y, int width, int height, ITextComponent tooltip)
{
super(Minecraft.getInstance().fontRenderer, x, y, width, height, null);
this.setMaxStringLength(Integer.MAX_VALUE);
super(Minecraft.getInstance().font, x, y, width, height, null);
this.setMaxLength(Integer.MAX_VALUE);
this.tooltip = tooltip;
}
@@ -31,18 +31,18 @@ public class GuiTextFieldTooltip extends TextFieldWidget
{
super.renderButton(matrix, mouseX, mouseY, partialTicks);
if(this.getVisible() && !this.isFocused() && this.tooltip != null && TextFormatting.getTextWithoutFormattingCodes(this.getText()).isEmpty())
if(this.isVisible() && !this.isFocused() && this.tooltip != null && TextFormatting.stripFormatting(this.getValue()).isEmpty())
{
int x = this.x;
int y = this.y;
if(this.getAdjustedWidth() != this.width)
if(this.getInnerWidth() != this.width)
{
x += 4;
y += (this.height - 8) / 2;
}
Minecraft.getInstance().fontRenderer.func_243246_a(matrix, this.tooltip, (float) x, (float) y, 0x7F7F7F); //drawStringWithShadow
Minecraft.getInstance().font.drawShadow(matrix, this.tooltip, (float) x, (float) y, 0x7F7F7F); //drawStringWithShadow
}
}
@@ -66,11 +66,11 @@ public class GuiTextFieldTooltip extends TextFieldWidget
{
if(text != null)
{
this.setText(text.getString());
this.setValue(text.getString());
}
else
{
this.setText((String) null);
this.setValue((String) null);
}
}
}

View File

@@ -40,7 +40,7 @@ public class UsercontentAPI
{
if(object != null)
{
Minecraft.getInstance().ingameGUI.func_238450_a_(ChatType.CHAT, new StringTextComponent(object.toString()), Util.DUMMY_UUID);
Minecraft.getInstance().gui.handleChat(ChatType.CHAT, new StringTextComponent(object.toString()), Util.NIL_UUID);
}
}

View File

@@ -154,7 +154,7 @@ public class UsercontentLoader
private static boolean isValidPathName(Path path)
{
String name = path.getFileName().toString();
boolean valid = ResourceLocation.isResouceNameValid(name);
boolean valid = ResourceLocation.isValidResourceLocation(name);
if(!valid)
{

View File

@@ -113,9 +113,9 @@ public class WidgetFactory extends AbstractWidgetFactory
widget.getLayout().getHeight(),
TextUtils.formatNonnull(widget.getText())
);
textfield.setValidator(Predicates.notNull());
textfield.setText(this.getApi().getValue(widget.getAttributes().getId()));
textfield.setResponder(this.getActionHandlerFactory().createResponder(string -> textfield.getText(), widget.getAttributes().getId(), widget.getAction()));
textfield.setFilter(Predicates.notNull());
textfield.setValue(this.getApi().getValue(widget.getAttributes().getId()));
textfield.setResponder(this.getActionHandlerFactory().createResponder(string -> textfield.getValue(), widget.getAttributes().getId(), widget.getAction()));
return textfield;
}

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)