From 3cd91115ec12c72a2d8ae22eb7a7dfea882ca78f Mon Sep 17 00:00:00 2001 From: deirn Date: Wed, 18 Nov 2020 15:05:17 +0700 Subject: [PATCH] Update to 1.16.4 and fix config screen crash --- build.gradle | 2 +- gradle.properties | 6 +++--- src/main/java/mcp/mobius/waila/gui/GuiConfigPlugins.java | 3 ++- src/main/java/mcp/mobius/waila/gui/GuiConfigWaila.java | 9 +++++---- .../mcp/mobius/waila/gui/config/OptionsListWidget.java | 4 ++-- src/main/java/mcp/mobius/waila/overlay/RayTracing.java | 8 ++++---- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/build.gradle b/build.gradle index bb0470cd..931bfb0f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id "com.matthewprenger.cursegradle" version "1.3.0" - id 'fabric-loom' version '0.4-SNAPSHOT' + id 'fabric-loom' version '0.5-SNAPSHOT' id "maven-publish" } diff --git a/gradle.properties b/gradle.properties index 1c9081d2..09c3b2e6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,9 +3,9 @@ package_group=mcp.mobius.waila mod_version=1.9.23 curse_id=253449 -mc_version=1.16.2 -mappings_version=1 -loader_version=0.9.1+build.205 +mc_version=1.16.4 +mappings_version=7 +loader_version=0.10.8 api_version=0.1.3+ api_commands_version=1.0.8+ api_keybinding_version=1.0.0+ diff --git a/src/main/java/mcp/mobius/waila/gui/GuiConfigPlugins.java b/src/main/java/mcp/mobius/waila/gui/GuiConfigPlugins.java index e0a4497f..f147e8d9 100644 --- a/src/main/java/mcp/mobius/waila/gui/GuiConfigPlugins.java +++ b/src/main/java/mcp/mobius/waila/gui/GuiConfigPlugins.java @@ -8,6 +8,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; +import net.minecraft.text.LiteralText; import net.minecraft.text.TranslatableText; import net.minecraft.util.Identifier; @@ -25,7 +26,7 @@ public OptionsListWidget getOptions() { PluginConfig.INSTANCE.getNamespaces().forEach(namespace -> { String translationKey = "config.waila.plugin_" + namespace; Set keys = PluginConfig.INSTANCE.getKeys(namespace); - options.add(new OptionsEntryButton(translationKey, new ButtonWidget(0, 0, 100, 20, null, w -> { + options.add(new OptionsEntryButton(translationKey, new ButtonWidget(0, 0, 100, 20, LiteralText.EMPTY, w -> { client.openScreen(new GuiOptions(GuiConfigPlugins.this, new TranslatableText(translationKey)) { @Override public OptionsListWidget getOptions() { diff --git a/src/main/java/mcp/mobius/waila/gui/GuiConfigWaila.java b/src/main/java/mcp/mobius/waila/gui/GuiConfigWaila.java index a0a47372..398cd08a 100644 --- a/src/main/java/mcp/mobius/waila/gui/GuiConfigWaila.java +++ b/src/main/java/mcp/mobius/waila/gui/GuiConfigWaila.java @@ -9,6 +9,7 @@ import mcp.mobius.waila.gui.config.value.OptionsEntryValueInput; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; +import net.minecraft.text.LiteralText; import net.minecraft.text.TranslatableText; import net.minecraft.util.Identifier; import net.minecraft.util.Util; @@ -23,7 +24,7 @@ public GuiConfigWaila(Screen parent) { @Override public OptionsListWidget getOptions() { OptionsListWidget options = new OptionsListWidget(this, client, width + 45, height, 32, height - 32, 30, Waila.CONFIG::save); - options.add(new OptionsEntryButton(Util.createTranslationKey("config", new Identifier(Waila.MODID, "general")), new ButtonWidget(0, 0, 100, 20, null, w -> { + options.add(new OptionsEntryButton(Util.createTranslationKey("config", new Identifier(Waila.MODID, "general")), new ButtonWidget(0, 0, 100, 20, LiteralText.EMPTY, w -> { client.openScreen(new GuiOptions(GuiConfigWaila.this, new TranslatableText(Util.createTranslationKey("config", new Identifier(Waila.MODID, "general")))) { @Override public OptionsListWidget getOptions() { @@ -56,7 +57,7 @@ public OptionsListWidget getOptions() { } }); }))); - options.add(new OptionsEntryButton(Util.createTranslationKey("config", new Identifier(Waila.MODID, "overlay")), new ButtonWidget(0, 0, 100, 20, null, w -> { + options.add(new OptionsEntryButton(Util.createTranslationKey("config", new Identifier(Waila.MODID, "overlay")), new ButtonWidget(0, 0, 100, 20, LiteralText.EMPTY, w -> { client.openScreen(new GuiOptions(GuiConfigWaila.this, new TranslatableText(Util.createTranslationKey("config", new Identifier(Waila.MODID, "overlay")))) { @Override public OptionsListWidget getOptions() { @@ -70,7 +71,7 @@ public OptionsListWidget getOptions() { options.add(new OptionsEntryValueEnum<>(Util.createTranslationKey("config", new Identifier(Waila.MODID, "overlay_size")), WailaConfig.ConfigOverlay.SizeChoice.values(), Waila.CONFIG.get().getOverlay().getOverlaySize(), val -> Waila.CONFIG.get().getOverlay().setOverlaySize(val) )); - options.add(new OptionsEntryButton(Util.createTranslationKey("config", new Identifier(Waila.MODID, "overlay_color")), new ButtonWidget(0, 0, 100, 20, null, w -> { + options.add(new OptionsEntryButton(Util.createTranslationKey("config", new Identifier(Waila.MODID, "overlay_color")), new ButtonWidget(0, 0, 100, 20, LiteralText.EMPTY, w -> { client.openScreen(new GuiOptions(GuiConfigWaila.this, new TranslatableText(Util.createTranslationKey("config", new Identifier(Waila.MODID, "overlay_color")))) { @Override public OptionsListWidget getOptions() { @@ -92,7 +93,7 @@ public OptionsListWidget getOptions() { } }); }))); - options.add(new OptionsEntryButton(Util.createTranslationKey("config", new Identifier(Waila.MODID, "formatting")), new ButtonWidget(0, 0, 100, 20, null, w -> { + options.add(new OptionsEntryButton(Util.createTranslationKey("config", new Identifier(Waila.MODID, "formatting")), new ButtonWidget(0, 0, 100, 20, LiteralText.EMPTY, w -> { client.openScreen(new GuiOptions(GuiConfigWaila.this, new TranslatableText(Util.createTranslationKey("config", new Identifier(Waila.MODID, "overlay")))) { @Override public OptionsListWidget getOptions() { diff --git a/src/main/java/mcp/mobius/waila/gui/config/OptionsListWidget.java b/src/main/java/mcp/mobius/waila/gui/config/OptionsListWidget.java index c87602b0..d777b820 100644 --- a/src/main/java/mcp/mobius/waila/gui/config/OptionsListWidget.java +++ b/src/main/java/mcp/mobius/waila/gui/config/OptionsListWidget.java @@ -45,13 +45,13 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { int j = scrollPosX + 6; Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferBuilder = tessellator.getBuffer(); - this.client.getTextureManager().bindTexture(DrawableHelper.BACKGROUND_TEXTURE); + this.client.getTextureManager().bindTexture(DrawableHelper.OPTIONS_BACKGROUND_TEXTURE); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); int rowLeft = this.getRowLeft(); int scrollJump = this.top + 4 - (int)this.getScrollAmount(); this.renderList(matrices, rowLeft, scrollJump, mouseX, mouseY, delta); - this.client.getTextureManager().bindTexture(DrawableHelper.BACKGROUND_TEXTURE); + this.client.getTextureManager().bindTexture(DrawableHelper.OPTIONS_BACKGROUND_TEXTURE); RenderSystem.enableDepthTest(); RenderSystem.depthFunc(519); bufferBuilder.begin(7, VertexFormats.POSITION_TEXTURE_COLOR); diff --git a/src/main/java/mcp/mobius/waila/overlay/RayTracing.java b/src/main/java/mcp/mobius/waila/overlay/RayTracing.java index f7f25817..b7b6cd8a 100644 --- a/src/main/java/mcp/mobius/waila/overlay/RayTracing.java +++ b/src/main/java/mcp/mobius/waila/overlay/RayTracing.java @@ -18,7 +18,7 @@ import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; -import net.minecraft.world.RayTraceContext; +import net.minecraft.world.RaycastContext; import net.minecraft.world.World; import java.util.Collection; @@ -64,9 +64,9 @@ public HitResult rayTrace(Entity entity, double playerReach, float partialTicks) Vec3d lookVector = entity.getRotationVec(partialTicks); Vec3d traceEnd = eyePosition.add(lookVector.x * playerReach, lookVector.y * playerReach, lookVector.z * playerReach); - RayTraceContext.FluidHandling fluidView = Waila.CONFIG.get().getGeneral().shouldDisplayFluids() ? RayTraceContext.FluidHandling.SOURCE_ONLY : RayTraceContext.FluidHandling.NONE; - RayTraceContext context = new RayTraceContext(eyePosition, traceEnd, RayTraceContext.ShapeType.OUTLINE, fluidView, entity); - return entity.getEntityWorld().rayTrace(context); + RaycastContext.FluidHandling fluidView = Waila.CONFIG.get().getGeneral().shouldDisplayFluids() ? RaycastContext.FluidHandling.SOURCE_ONLY : RaycastContext.FluidHandling.NONE; + RaycastContext context = new RaycastContext(eyePosition, traceEnd, RaycastContext.ShapeType.OUTLINE, fluidView, entity); + return entity.getEntityWorld().raycast(context); } public ItemStack getIdentifierStack() {