From 7a6b1c694901c4803041588b23b89a7d592385e9 Mon Sep 17 00:00:00 2001 From: zelophed Date: Sat, 3 Apr 2021 00:54:28 +0200 Subject: [PATCH] 0.3.1 hotfixes, part I --- .../create/foundation/config/CClient.java | 10 +++++-- .../utility/placement/PlacementHelpers.java | 30 +++++++++++-------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/simibubi/create/foundation/config/CClient.java b/src/main/java/com/simibubi/create/foundation/config/CClient.java index bdaf48de0..3c5bfc2e2 100644 --- a/src/main/java/com/simibubi/create/foundation/config/CClient.java +++ b/src/main/java/com/simibubi/create/foundation/config/CClient.java @@ -18,8 +18,10 @@ public class CClient extends ConfigBase { "Offset the overlay from goggle- and hover- information by this many pixels on the X axis; Use /create overlay"); public ConfigInt overlayOffsetY = i(0, Integer.MIN_VALUE, Integer.MAX_VALUE, "overlayOffsetY", "Offset the overlay from goggle- and hover- information by this many pixels on the Y axis; Use /create overlay"); - public ConfigBool smoothPlacementIndicator = b(false, "smoothPlacementIndicator", - "Use an alternative indicator when showing where the assisted placement ends up relative to your crosshair"); + + public ConfigGroup placementAssist = group(1, "placementAssist", "Settings for the Placement Assist"); + public ConfigEnum placementIndicator = e(PlacementIndicatorSetting.TEXTURE, "indicatorType", "What indicator should be used when showing where the assisted placement ends up relative to your crosshair", "Choose 'NONE' to disable the Indicator altogether"); + public ConfigFloat indicatorScale = f(1.0f, 0f, "indicatorScale", "Change the size of the Indicator by this multiplier"); public ConfigGroup ponder = group(1, "ponder", "Ponder settings"); public ConfigBool comfyReading = @@ -29,4 +31,8 @@ public class CClient extends ConfigBase { public String getName() { return "client"; } + + public enum PlacementIndicatorSetting { + TEXTURE, TRIANGLE, NONE + } } diff --git a/src/main/java/com/simibubi/create/foundation/utility/placement/PlacementHelpers.java b/src/main/java/com/simibubi/create/foundation/utility/placement/PlacementHelpers.java index 48b2185d0..3e0a88cc5 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/placement/PlacementHelpers.java +++ b/src/main/java/com/simibubi/create/foundation/utility/placement/PlacementHelpers.java @@ -1,12 +1,5 @@ package com.simibubi.create.foundation.utility.placement; -import com.mojang.blaze3d.systems.RenderSystem; -import com.simibubi.create.foundation.config.AllConfigs; -import com.simibubi.create.foundation.gui.AllGuiTextures; -import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingAngle; -import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue; -import com.simibubi.create.foundation.utility.AngleHelper; -import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.block.BlockState; import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; @@ -25,11 +18,19 @@ import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -import org.lwjgl.opengl.GL11; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; +import org.lwjgl.opengl.GL11; +import com.mojang.blaze3d.systems.RenderSystem; +import com.simibubi.create.foundation.config.AllConfigs; +import com.simibubi.create.foundation.config.CClient; +import com.simibubi.create.foundation.gui.AllGuiTextures; +import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingAngle; +import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue; +import com.simibubi.create.foundation.utility.AngleHelper; +import com.simibubi.create.foundation.utility.VecHelper; @Mod.EventBusSubscriber public class PlacementHelpers { @@ -205,11 +206,10 @@ public class PlacementHelpers { float length = 10; //TOD O if the target is off screen, use length to show a meaningful distance - boolean flag = AllConfigs.CLIENT.smoothPlacementIndicator.get(); - if (flag) + CClient.PlacementIndicatorSetting mode = AllConfigs.CLIENT.placementIndicator.get(); + if (mode == CClient.PlacementIndicatorSetting.TRIANGLE) fadedArrow(centerX, centerY, r, g, b, a, length, snappedAngle); - - else + else if (mode == CClient.PlacementIndicatorSetting.TEXTURE) textured(centerX, centerY, a, snappedAngle); } @@ -224,6 +224,8 @@ public class PlacementHelpers { RenderSystem.translated(centerX, centerY, 0); RenderSystem.rotatef(angle.get(0), 0, 0, 1); //RenderSystem.rotatef(snappedAngle, 0, 0, 1); + double scale = AllConfigs.CLIENT.indicatorScale.get(); + RenderSystem.scaled(scale, scale, 1); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); @@ -263,7 +265,9 @@ public class PlacementHelpers { //RenderSystem.rotatef(angle.get(0.1f), 0, 0, -1); //RenderSystem.translated(0, 10, 0); //RenderSystem.rotatef(angle.get(0.1f), 0, 0, 1); - RenderSystem.scaled(12, 12, 0); + double scale = AllConfigs.CLIENT.indicatorScale.get(); + RenderSystem.scaled(scale, scale, 1); + RenderSystem.scaled(12, 12, 1); float index = snappedAngle / 22.5f; float tex_size = 16f/256f;