diff options
author | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2024-05-29 14:53:18 -0400 |
---|---|---|
committer | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2024-07-10 15:42:29 -0400 |
commit | 41b575e41545fbea3b38deb516ba580251a9cd0b (patch) | |
tree | 4b2b879486937ac055857ea0130573d805ddba14 /src/main/java/de/hysky/skyblocker | |
parent | e1b951f6124c28a5cc1ec9d9ca3416f5104b27b3 (diff) | |
download | Skyblocker-41b575e41545fbea3b38deb516ba580251a9cd0b.tar.gz Skyblocker-41b575e41545fbea3b38deb516ba580251a9cd0b.tar.bz2 Skyblocker-41b575e41545fbea3b38deb516ba580251a9cd0b.zip |
Move block bounding box into RenderHelper
Diffstat (limited to 'src/main/java/de/hysky/skyblocker')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/skyblock/dungeon/device/SimonSays.java | 2 | ||||
-rw-r--r-- | src/main/java/de/hysky/skyblocker/utils/render/RenderHelper.java | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/device/SimonSays.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/device/SimonSays.java index 341c6025..20bd9ebc 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/device/SimonSays.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/device/SimonSays.java @@ -100,7 +100,7 @@ public class SimonSays { //If the button hasn't been clicked yet //Also don't do anything if the button isn't there which means the device is showing the sequence if (!CLICKED_BUTTONS.contains(buttonPos) && state.getBlock().equals(Blocks.STONE_BUTTON)) { - Box outline = state.getOutlineShape(world, buttonPos).asCuboid().getBoundingBox().offset(buttonPos); + Box outline = RenderHelper.getBlockBoundingBox(world, state, buttonPos); float[] colour = buttonsRendered == 0 ? GREEN : YELLOW; RenderHelper.renderFilled(context, Boxes.getMinVec(outline), Boxes.getLengthVec(outline), colour, 0.5f, true); diff --git a/src/main/java/de/hysky/skyblocker/utils/render/RenderHelper.java b/src/main/java/de/hysky/skyblocker/utils/render/RenderHelper.java index 6a53e4c4..1b16b138 100644 --- a/src/main/java/de/hysky/skyblocker/utils/render/RenderHelper.java +++ b/src/main/java/de/hysky/skyblocker/utils/render/RenderHelper.java @@ -11,6 +11,7 @@ import de.hysky.skyblocker.utils.render.title.TitleContainer; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents; import net.fabricmc.fabric.api.event.Event; +import net.minecraft.block.BlockState; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; @@ -20,6 +21,7 @@ import net.minecraft.client.texture.Scaling; import net.minecraft.client.texture.Sprite; import net.minecraft.client.util.BufferAllocator; import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.world.ClientWorld; import net.minecraft.sound.SoundEvents; import net.minecraft.text.OrderedText; import net.minecraft.text.Text; @@ -334,6 +336,14 @@ public class RenderHelper { } } + public static Box getBlockBoundingBox(ClientWorld world, BlockPos pos) { + return getBlockBoundingBox(world, world.getBlockState(pos), pos); + } + + public static Box getBlockBoundingBox(ClientWorld world, BlockState state, BlockPos pos) { + return state.getOutlineShape(world, pos).asCuboid().getBoundingBox().offset(pos); + } + /** * Adds the title to {@link TitleContainer} and {@link #playNotificationSound() plays the notification sound} if the title is not in the {@link TitleContainer} already. * No checking needs to be done on whether the title is in the {@link TitleContainer} already by the caller. |