forked from Clones/Controlify
➕ Update to Minecraft 1.20
This commit is contained in:
@ -1,178 +0,0 @@
|
||||
package dev.isxander.controlify.gui.guide;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import dev.isxander.controlify.InputMode;
|
||||
import dev.isxander.controlify.api.ControlifyApi;
|
||||
import dev.isxander.controlify.api.event.ControlifyEvents;
|
||||
import dev.isxander.controlify.bindings.ControllerBindings;
|
||||
import dev.isxander.controlify.compatibility.ControlifyCompat;
|
||||
import dev.isxander.controlify.controller.Controller;
|
||||
import dev.isxander.controlify.gui.layout.AnchorPoint;
|
||||
import dev.isxander.controlify.gui.layout.ColumnLayoutComponent;
|
||||
import dev.isxander.controlify.gui.layout.PositionedComponent;
|
||||
import dev.isxander.controlify.gui.layout.RowLayoutComponent;
|
||||
import dev.isxander.controlify.mixins.feature.guide.screen.AbstractContainerScreenAccessor;
|
||||
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public final class ContainerButtonGuide {
|
||||
private static PositionedComponent<ColumnLayoutComponent<RowLayoutComponent<GuideActionRenderer<ContainerGuideCtx>>>> leftLayout;
|
||||
private static PositionedComponent<ColumnLayoutComponent<RowLayoutComponent<GuideActionRenderer<ContainerGuideCtx>>>> rightLayout;
|
||||
|
||||
public static void setup() {
|
||||
ScreenEvents.BEFORE_INIT.register((minecraft, screen, sw, sh) -> {
|
||||
removeLayout();
|
||||
|
||||
if (isScreenCompatible(screen)) {
|
||||
setupLayout();
|
||||
|
||||
ScreenEvents.afterRender(screen).register((s, stack, mouseX, mouseY, tickDelta) -> {
|
||||
// Fabric API provides the wrong matrixstack (which is translated -2000), behind
|
||||
// the ortho near plane, so we need to translate it back to the front.
|
||||
// https://github.com/FabricMC/fabric/pull/3061
|
||||
stack.pushPose();
|
||||
stack.translate(0, 0, 2000);
|
||||
|
||||
renderGuide((AbstractContainerScreen<?>) s, stack, tickDelta, mouseX, mouseY, sw, sh);
|
||||
|
||||
stack.popPose();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
ControlifyEvents.INPUT_MODE_CHANGED.register(mode -> {
|
||||
if (isScreenCompatible(Minecraft.getInstance().screen)) {
|
||||
if (mode == InputMode.CONTROLLER) {
|
||||
setupLayout();
|
||||
} else {
|
||||
removeLayout();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void setupLayout() {
|
||||
ControllerBindings<?> bindings = ControlifyApi.get().getCurrentController()
|
||||
.map(Controller::bindings)
|
||||
.orElseThrow();
|
||||
|
||||
leftLayout = new PositionedComponent<>(
|
||||
ColumnLayoutComponent.<RowLayoutComponent<GuideActionRenderer<ContainerGuideCtx>>>builder()
|
||||
.spacing(2)
|
||||
.colPadding(2, 2)
|
||||
.elementPosition(ColumnLayoutComponent.ElementPosition.LEFT)
|
||||
.element(RowLayoutComponent.<GuideActionRenderer<ContainerGuideCtx>>builder()
|
||||
.spacing(5)
|
||||
.rowPadding(0)
|
||||
.elementPosition(RowLayoutComponent.ElementPosition.MIDDLE)
|
||||
.element(new GuideActionRenderer<>(
|
||||
new GuideAction<>(bindings.VMOUSE_LCLICK, ctx -> {
|
||||
if (!ctx.holdingItem().isEmpty())
|
||||
if (ctx.hoveredSlot() != null && ctx.hoveredSlot().hasItem())
|
||||
if (ctx.hoveredSlot().mayPlace(ctx.holdingItem()))
|
||||
if (ctx.holdingItem().getCount() > 1)
|
||||
return Optional.of(Component.translatable("controlify.guide.container.place_all"));
|
||||
else
|
||||
return Optional.of(Component.translatable("controlify.guide.container.place_one"));
|
||||
else
|
||||
return Optional.of(Component.translatable("controlify.guide.container.swap"));
|
||||
else if (ctx.cursorOutsideContainer())
|
||||
return Optional.of(Component.translatable("controlify.guide.container.drop"));
|
||||
if (ctx.hoveredSlot() != null && ctx.hoveredSlot().hasItem())
|
||||
return Optional.of(Component.translatable("controlify.guide.container.take"));
|
||||
return Optional.empty();
|
||||
}),
|
||||
false, false
|
||||
))
|
||||
.element(new GuideActionRenderer<>(
|
||||
new GuideAction<>(bindings.GUI_BACK, ctx -> {
|
||||
return Optional.of(Component.translatable("controlify.guide.container.exit"));
|
||||
}),
|
||||
false, false
|
||||
))
|
||||
.build())
|
||||
.build(),
|
||||
AnchorPoint.BOTTOM_LEFT,
|
||||
0, 0,
|
||||
AnchorPoint.BOTTOM_LEFT
|
||||
);
|
||||
|
||||
rightLayout = new PositionedComponent<>(
|
||||
ColumnLayoutComponent.<RowLayoutComponent<GuideActionRenderer<ContainerGuideCtx>>>builder()
|
||||
.spacing(2)
|
||||
.elementPosition(ColumnLayoutComponent.ElementPosition.RIGHT)
|
||||
.colPadding(2, 2)
|
||||
.element(RowLayoutComponent.<GuideActionRenderer<ContainerGuideCtx>>builder()
|
||||
.spacing(5)
|
||||
.rowPadding(0)
|
||||
.elementPosition(RowLayoutComponent.ElementPosition.MIDDLE)
|
||||
.element(new GuideActionRenderer<>(
|
||||
new GuideAction<>(bindings.VMOUSE_RCLICK, ctx -> {
|
||||
if (ctx.hoveredSlot() != null && ctx.hoveredSlot().getItem().getCount() > 1 && ctx.holdingItem().isEmpty())
|
||||
return Optional.of(Component.translatable("controlify.guide.container.take_half"));
|
||||
if (ctx.hoveredSlot() != null && !ctx.holdingItem().isEmpty() && ctx.hoveredSlot().mayPlace(ctx.holdingItem()))
|
||||
return Optional.of(Component.translatable("controlify.guide.container.take_one"));
|
||||
return Optional.empty();
|
||||
}),
|
||||
true, false
|
||||
))
|
||||
.element(new GuideActionRenderer<>(
|
||||
new GuideAction<>(bindings.VMOUSE_SHIFT_CLICK, ctx -> {
|
||||
return Optional.of(Component.translatable("controlify.guide.container.quick_move"));
|
||||
}),
|
||||
true, false
|
||||
))
|
||||
.build())
|
||||
.build(),
|
||||
AnchorPoint.BOTTOM_RIGHT,
|
||||
0, 0,
|
||||
AnchorPoint.BOTTOM_RIGHT
|
||||
);
|
||||
}
|
||||
|
||||
private static void removeLayout() {
|
||||
leftLayout = null;
|
||||
rightLayout = null;
|
||||
}
|
||||
|
||||
private static void renderGuide(AbstractContainerScreen<?> screen, PoseStack stack, float tickDelta, int mouseX, int mouseY, int screenWidth, int screenHeight) {
|
||||
if (leftLayout == null || rightLayout == null)
|
||||
return;
|
||||
|
||||
if (!ControlifyApi.get().getCurrentController().map(controller -> controller.config().showScreenGuide).orElse(false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var accessor = (AbstractContainerScreenAccessor) screen;
|
||||
|
||||
ContainerGuideCtx ctx = new ContainerGuideCtx(accessor.getHoveredSlot(), screen.getMenu().getCarried(), accessor.invokeHasClickedOutside(mouseX, mouseY, accessor.getLeftPos(), accessor.getTopPos(), 0));
|
||||
|
||||
for (var row : leftLayout.getComponent().getChildComponents()) {
|
||||
for (var element : row.getChildComponents()) {
|
||||
element.updateName(ctx);
|
||||
}
|
||||
}
|
||||
for (var row : rightLayout.getComponent().getChildComponents()) {
|
||||
for (var element : row.getChildComponents()) {
|
||||
element.updateName(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
leftLayout.updatePosition();
|
||||
rightLayout.updatePosition();
|
||||
|
||||
ControlifyCompat.ifBeginHudBatching();
|
||||
leftLayout.renderComponent(stack, tickDelta);
|
||||
rightLayout.renderComponent(stack, tickDelta);
|
||||
ControlifyCompat.ifEndHudBatching();
|
||||
}
|
||||
|
||||
private static boolean isScreenCompatible(Screen screen) {
|
||||
return screen instanceof AbstractContainerScreen<?>;
|
||||
}
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
package dev.isxander.controlify.gui.guide;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import dev.isxander.controlify.api.bind.BindRenderer;
|
||||
import dev.isxander.controlify.gui.DrawSize;
|
||||
import dev.isxander.controlify.gui.layout.RenderComponent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import org.joml.Vector2i;
|
||||
import org.joml.Vector2ic;
|
||||
@ -27,7 +26,7 @@ public class GuideActionRenderer<T> implements RenderComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack stack, int x, int y, float deltaTime) {
|
||||
public void render(GuiGraphics graphics, int x, int y, float deltaTime) {
|
||||
if (!isVisible())
|
||||
return;
|
||||
|
||||
@ -37,14 +36,14 @@ public class GuideActionRenderer<T> implements RenderComponent {
|
||||
DrawSize drawSize = renderer.size();
|
||||
int textWidth = font.width(name.get());
|
||||
|
||||
renderer.render(stack, x + (!rtl ? 0 : textWidth + 2), y + drawSize.height() / 2);
|
||||
renderer.render(graphics, x + (!rtl ? 0 : textWidth + 2), y + drawSize.height() / 2);
|
||||
|
||||
int textX = x + (rtl ? 0 : drawSize.width() + 2);
|
||||
int textY = y + drawSize.height() / 2 - font.lineHeight / 2;
|
||||
|
||||
if (textContrast)
|
||||
GuiComponent.fill(stack, textX - 1, textY - 1, textX + textWidth + 1, textY + font.lineHeight + 1, 0x80000000);
|
||||
font.draw(stack, name.get(), textX, textY, 0xFFFFFF);
|
||||
graphics.fill(textX - 1, textY - 1, textX + textWidth + 1, textY + font.lineHeight + 1, 0x80000000);
|
||||
graphics.drawString(font, name.get(), textX, textY, 0xFFFFFF, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,5 @@
|
||||
package dev.isxander.controlify.gui.guide;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import dev.isxander.controlify.api.bind.ControllerBinding;
|
||||
import dev.isxander.controlify.api.guide.ActionPriority;
|
||||
import dev.isxander.controlify.api.guide.GuideActionNameSupplier;
|
||||
@ -12,6 +11,7 @@ import dev.isxander.controlify.gui.layout.AnchorPoint;
|
||||
import dev.isxander.controlify.gui.layout.ColumnLayoutComponent;
|
||||
import dev.isxander.controlify.gui.layout.PositionedComponent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
@ -69,14 +69,14 @@ public class InGameButtonGuide implements IngameGuideRegistry {
|
||||
);
|
||||
}
|
||||
|
||||
public void renderHud(PoseStack poseStack, float tickDelta, int width, int height) {
|
||||
public void renderHud(GuiGraphics graphics, float tickDelta, int width, int height) {
|
||||
if (!controller.config().showIngameGuide || minecraft.screen != null || minecraft.options.renderDebug)
|
||||
return;
|
||||
|
||||
ControlifyCompat.ifBeginHudBatching();
|
||||
|
||||
leftLayout.renderComponent(poseStack, tickDelta);
|
||||
rightLayout.renderComponent(poseStack, tickDelta);
|
||||
leftLayout.renderComponent(graphics, tickDelta);
|
||||
rightLayout.renderComponent(graphics, tickDelta);
|
||||
|
||||
ControlifyCompat.ifEndHudBatching();
|
||||
}
|
||||
@ -111,13 +111,13 @@ public class InGameButtonGuide implements IngameGuideRegistry {
|
||||
if (player.getAbilities().flying)
|
||||
return Optional.of(Component.translatable("controlify.guide.ingame.fly_up"));
|
||||
|
||||
if (player.isOnGround())
|
||||
if (player.onGround())
|
||||
return Optional.of(Component.translatable("key.jump"));
|
||||
|
||||
if (player.isInWater())
|
||||
return Optional.of(Component.translatable("controlify.guide.ingame.swim_up"));
|
||||
|
||||
if (!player.isOnGround() && !player.isFallFlying() && !player.isInWater() && !player.hasEffect(MobEffects.LEVITATION)) {
|
||||
if (!player.onGround() && !player.isFallFlying() && !player.isInWater() && !player.hasEffect(MobEffects.LEVITATION)) {
|
||||
var chestStack = player.getItemBySlot(EquipmentSlot.CHEST);
|
||||
if (chestStack.is(Items.ELYTRA) && ElytraItem.isFlyEnabled(chestStack))
|
||||
return Optional.of(Component.translatable("controlify.guide.ingame.start_elytra"));
|
||||
@ -131,7 +131,7 @@ public class InGameButtonGuide implements IngameGuideRegistry {
|
||||
return Optional.of(Component.translatable("controlify.guide.ingame.dismount"));
|
||||
if (player.getAbilities().flying)
|
||||
return Optional.of(Component.translatable("controlify.guide.ingame.fly_down"));
|
||||
if (player.isInWater() && !player.isOnGround())
|
||||
if (player.isInWater() && !player.onGround())
|
||||
return Optional.of(Component.translatable("controlify.guide.ingame.swim_down"));
|
||||
if (ctx.controller().config().toggleSneak) {
|
||||
return Optional.of(Component.translatable(player.input.shiftKeyDown ? "controlify.guide.ingame.stop_sneaking" : "controlify.guide.ingame.start_sneaking"));
|
||||
@ -182,8 +182,8 @@ public class InGameButtonGuide implements IngameGuideRegistry {
|
||||
return Optional.empty();
|
||||
});
|
||||
registerGuideAction(controller.bindings().DROP, ActionLocation.RIGHT, (ctx) -> {
|
||||
var player = ctx.player();
|
||||
if (player.hasItemInSlot(EquipmentSlot.MAINHAND) || player.hasItemInSlot(EquipmentSlot.OFFHAND))
|
||||
var holdingItem = ctx.player().getInventory().getSelected();
|
||||
if (!holdingItem.isEmpty())
|
||||
return Optional.of(Component.translatable("controlify.guide.ingame.drop"));
|
||||
return Optional.empty();
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
package dev.isxander.controlify.gui.layout;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.joml.Vector2i;
|
||||
import org.joml.Vector2ic;
|
||||
@ -35,7 +35,7 @@ public class ColumnLayoutComponent<T extends RenderComponent> extends AbstractLa
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack stack, int x, int y, float deltaTime) {
|
||||
public void render(GuiGraphics graphics, int x, int y, float deltaTime) {
|
||||
int width = getMaxChildWidth();
|
||||
|
||||
if (width == -1)
|
||||
@ -47,7 +47,7 @@ public class ColumnLayoutComponent<T extends RenderComponent> extends AbstractLa
|
||||
continue;
|
||||
|
||||
element.render(
|
||||
stack,
|
||||
graphics,
|
||||
x + colPaddingLeft + elementPosition.positionFunction.apply(width, element.size().x()),
|
||||
y + colPaddingTop + yOffset,
|
||||
deltaTime
|
||||
|
@ -1,7 +1,7 @@
|
||||
package dev.isxander.controlify.gui.layout;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.Renderable;
|
||||
import org.joml.Vector2ic;
|
||||
|
||||
@ -33,12 +33,12 @@ public class PositionedComponent<T extends RenderComponent> implements Renderabl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack matrices, int mouseX, int mouseY, float delta) {
|
||||
this.renderComponent(matrices, delta);
|
||||
public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
|
||||
this.renderComponent(graphics, delta);
|
||||
}
|
||||
|
||||
public void renderComponent(PoseStack stack, float deltaTime) {
|
||||
component.render(stack, x, y, deltaTime);
|
||||
public void renderComponent(GuiGraphics graphics, float deltaTime) {
|
||||
component.render(graphics, x, y, deltaTime);
|
||||
}
|
||||
|
||||
public int x() {
|
||||
|
@ -1,9 +1,9 @@
|
||||
package dev.isxander.controlify.gui.layout;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import org.joml.Vector2ic;
|
||||
|
||||
public interface RenderComponent {
|
||||
void render(PoseStack stack, int x, int y, float deltaTime);
|
||||
void render(GuiGraphics graphics, int x, int y, float deltaTime);
|
||||
|
||||
Vector2ic size();
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package dev.isxander.controlify.gui.layout;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.joml.Vector2i;
|
||||
import org.joml.Vector2ic;
|
||||
@ -32,7 +32,7 @@ public class RowLayoutComponent<T extends RenderComponent> extends AbstractLayou
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack stack, int x, int y, float deltaTime) {
|
||||
public void render(GuiGraphics graphics, int x, int y, float deltaTime) {
|
||||
int height = getMaxChildHeight();
|
||||
|
||||
if (height == -1)
|
||||
@ -44,7 +44,7 @@ public class RowLayoutComponent<T extends RenderComponent> extends AbstractLayou
|
||||
continue;
|
||||
|
||||
element.render(
|
||||
stack,
|
||||
graphics,
|
||||
x + rowPaddingLeft + xOffset,
|
||||
y + rowPaddingTop + elementPosition.positionFunction.apply(height, element.size().y()),
|
||||
deltaTime
|
||||
|
@ -1,13 +1,11 @@
|
||||
package dev.isxander.controlify.gui.screen;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.AccessibilityOnboardingTextWidget;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.components.MultiLineTextWidget;
|
||||
import net.minecraft.client.gui.layouts.FrameLayout;
|
||||
import net.minecraft.client.gui.layouts.GridLayout;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.screens.TitleScreen;
|
||||
import net.minecraft.network.chat.CommonComponents;
|
||||
@ -55,8 +53,8 @@ public class BetaNoticeScreen extends Screen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack matrices, int mouseX, int mouseY, float delta) {
|
||||
renderBackground(matrices);
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
|
||||
renderBackground(graphics);
|
||||
super.render(graphics, mouseX, mouseY, delta);
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import dev.isxander.controlify.Controlify;
|
||||
import dev.isxander.controlify.controller.Controller;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.components.MultiLineLabel;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
@ -57,36 +58,34 @@ public class ControllerDeadzoneCalibrationScreen extends Screen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack matrices, int mouseX, int mouseY, float delta) {
|
||||
renderBackground(matrices);
|
||||
public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
|
||||
renderBackground(graphics);
|
||||
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
super.render(graphics, mouseX, mouseY, delta);
|
||||
|
||||
drawCenteredString(matrices, font, Component.translatable("controlify.calibration.title", controller.name()).withStyle(ChatFormatting.BOLD), width / 2, 8, -1);
|
||||
graphics.drawCenteredString(font, Component.translatable("controlify.calibration.title", controller.name()).withStyle(ChatFormatting.BOLD), width / 2, 8, -1);
|
||||
|
||||
RenderSystem.setShaderTexture(0, GUI_BARS_LOCATION);
|
||||
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
|
||||
matrices.pushPose();
|
||||
matrices.scale(2f, 2f, 1f);
|
||||
drawBar(matrices, width / 2 / 2, 30 / 2, 1f, 0);
|
||||
graphics.pose().pushPose();
|
||||
graphics.pose().scale(2f, 2f, 1f);
|
||||
drawBar(graphics, width / 2 / 2, 30 / 2, 1f, 0);
|
||||
var progress = (calibrationTicks - 1 + delta) / 100f;
|
||||
if (progress > 0)
|
||||
drawBar(matrices, width / 2 / 2, 30 / 2, progress, 5);
|
||||
matrices.popPose();
|
||||
drawBar(graphics, width / 2 / 2, 30 / 2, progress, 5);
|
||||
graphics.pose().popPose();
|
||||
|
||||
MultiLineLabel label;
|
||||
if (calibrating) label = waitLabel;
|
||||
else if (calibrated) label = completeLabel;
|
||||
else label = infoLabel;
|
||||
|
||||
label.renderCentered(matrices, width / 2, 55);
|
||||
label.renderCentered(graphics, width / 2, 55);
|
||||
}
|
||||
|
||||
private void drawBar(PoseStack matrices, int centerX, int y, float progress, int vOffset) {
|
||||
private void drawBar(GuiGraphics graphics, int centerX, int y, float progress, int vOffset) {
|
||||
progress = 1 - (float)Math.pow(1 - progress, 3);
|
||||
|
||||
int x = centerX - 182 / 2;
|
||||
this.blit(matrices, x, y, 0, 30 + vOffset, (int)(progress * 182), 5);
|
||||
graphics.blit(GUI_BARS_LOCATION, x, y, 0, 30 + vOffset, (int)(progress * 182), 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user