mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-12-22 16:48:25 +01:00
fixed compile errors
This commit is contained in:
parent
ba330ec1a2
commit
e034f928f9
@ -19,8 +19,8 @@ raknet_transport_version=1.0.0.CR1-SNAPSHOT
|
||||
classic4j_version=1.2.0
|
||||
|
||||
# viaversion (and required) libs
|
||||
viaversion_version=4.7.0-23w16a-SNAPSHOT
|
||||
viabackwards_version=4.7.0-23w16a-SNAPSHOT
|
||||
viaversion_version=4.7.0-23w17a-SNAPSHOT
|
||||
viabackwards_version=4.7.0-23w17a-SNAPSHOT
|
||||
snake_yml_version=2.0
|
||||
|
||||
# raphimc libs
|
||||
|
@ -40,6 +40,23 @@ import org.apache.logging.log4j.Logger;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* TODO | Port
|
||||
* - 23w12a:
|
||||
* - Wolf interactions
|
||||
* - Camel interactions
|
||||
* - Boat Passengers Riding Offset
|
||||
* - Note Block
|
||||
* - 23w13a:
|
||||
* - ApplyBrushTransform im ItemRenderer
|
||||
* - AbstractHorse sounds
|
||||
* - BrushItem use Duration von 225 -> 200
|
||||
* - DoorBlock don't had Nether Wood
|
||||
* - 23w14a:
|
||||
* - Sign interactions
|
||||
* - TakeItemEntityPacket isEmpty case
|
||||
* - Entity#move has changed
|
||||
* - SwordItem destroy speed
|
||||
* <p>
|
||||
* TODO | Protocol translation
|
||||
* - BucketItem#use canPlaceOn in <= 1.13 is missing
|
||||
* - Cobwebs in <= b1.7.3 are broken
|
||||
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(DrawContext.class)
|
||||
public class MixinDrawContext {
|
||||
|
||||
@Redirect(method = "drawItemInSlot(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawText(Lnet/minecraft/client/font/TextRenderer;Ljava/lang/String;IIIZ)I"))
|
||||
public int recolor(DrawContext instance, TextRenderer textRenderer, String text, int x, int y, int color, boolean shadow) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_10) && text.startsWith("-")) color = -43213;
|
||||
|
||||
return instance.drawText(textRenderer, text, x, y, color, shadow);
|
||||
}
|
||||
}
|
@ -18,6 +18,7 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
|
||||
|
||||
import de.florianmichael.viafabricplus.settings.groups.VisualSettings;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.hud.InGameHud;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.JumpingMount;
|
||||
@ -40,17 +41,17 @@ public abstract class MixinInGameHud {
|
||||
// Removing newer elements
|
||||
|
||||
@Inject(method = "renderExperienceBar", at = @At("HEAD"), cancellable = true)
|
||||
public void removeExperienceBar(MatrixStack matrices, int x, CallbackInfo ci) {
|
||||
public void removeExperienceBar(DrawContext context, int x, CallbackInfo ci) {
|
||||
if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) ci.cancel();
|
||||
}
|
||||
|
||||
@Inject(method = "renderMountJumpBar", at = @At("HEAD"), cancellable = true)
|
||||
public void removeMountJumpBar(JumpingMount mount, MatrixStack matrices, int x, CallbackInfo ci) {
|
||||
public void removeMountJumpBar(JumpingMount mount, DrawContext context, int x, CallbackInfo ci) {
|
||||
if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) ci.cancel();
|
||||
}
|
||||
|
||||
@Inject(method = "renderMountHealth", at = @At("HEAD"), cancellable = true)
|
||||
public void removeMountHealth(MatrixStack matrices, CallbackInfo ci) {
|
||||
public void removeMountHealth(DrawContext context, CallbackInfo ci) {
|
||||
if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) ci.cancel();
|
||||
}
|
||||
|
||||
@ -69,7 +70,7 @@ public abstract class MixinInGameHud {
|
||||
return scaledHeight;
|
||||
}
|
||||
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;drawTexture(Lnet/minecraft/client/util/math/MatrixStack;IIIIII)V"), slice = @Slice(
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIIIII)V"), slice = @Slice(
|
||||
from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V"),
|
||||
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 0)), index = 1)
|
||||
private int moveArmor(int old) {
|
||||
@ -77,7 +78,7 @@ public abstract class MixinInGameHud {
|
||||
return old;
|
||||
}
|
||||
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;drawTexture(Lnet/minecraft/client/util/math/MatrixStack;IIIIII)V"), slice = @Slice(
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIIIII)V"), slice = @Slice(
|
||||
from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V"),
|
||||
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 0)), index = 2)
|
||||
private int moveArmorDown(int old) {
|
||||
@ -85,7 +86,7 @@ public abstract class MixinInGameHud {
|
||||
return old;
|
||||
}
|
||||
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;drawTexture(Lnet/minecraft/client/util/math/MatrixStack;IIIIII)V"), slice = @Slice(
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIIIII)V"), slice = @Slice(
|
||||
from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 2),
|
||||
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;pop()V")), index = 1)
|
||||
private int moveAir(int old) {
|
||||
|
@ -17,11 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import de.florianmichael.viafabricplus.settings.groups.VisualSettings;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.item.ItemModels;
|
||||
import net.minecraft.client.render.item.ItemRenderer;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
@ -29,13 +25,11 @@ import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.world.World;
|
||||
import org.joml.Matrix4f;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(ItemRenderer.class)
|
||||
@ -49,11 +43,4 @@ public class MixinItemRenderer {
|
||||
cir.setReturnValue(this.models.getModelManager().getMissingModel());
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "renderGuiItemOverlay(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer;draw(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;II)I"))
|
||||
public int recolor(TextRenderer instance, String text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_10) && text.startsWith("-")) color = -43213;
|
||||
return instance.draw(text, x, y, color, shadow, matrix, vertexConsumers, layerType, backgroundColor, light);
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ import net.minecraft.entity.attribute.EntityAttributeModifier;
|
||||
import net.minecraft.entity.attribute.EntityAttributes;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.*;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.*;
|
||||
import org.spongepowered.asm.mixin.injection.*;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@ -35,7 +36,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.OptionalDouble;
|
||||
|
||||
@SuppressWarnings("ConstantValue")
|
||||
@Mixin(value = ItemStack.class, priority = 1)
|
||||
public abstract class MixinItemStack {
|
||||
|
||||
@ -46,22 +46,14 @@ public abstract class MixinItemStack {
|
||||
|
||||
@Shadow private int count;
|
||||
|
||||
@Shadow private boolean empty;
|
||||
|
||||
@Inject(method = "updateEmptyState", at = @At("HEAD"), cancellable = true)
|
||||
public void allowNegativeItems(CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_10)) {
|
||||
this.empty = false;
|
||||
final ItemStack self = (ItemStack) (Object) this;
|
||||
this.empty = self == EMPTY || this.getItem() == null || self.isOf(Items.AIR) || count == 0;
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
@Shadow @Final @Deprecated private @Nullable Item item;
|
||||
|
||||
@Inject(method = "isEmpty", at = @At("HEAD"), cancellable = true)
|
||||
public void dontRecalculateState(CallbackInfoReturnable<Boolean> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_10)) {
|
||||
cir.setReturnValue(this.empty);
|
||||
final ItemStack self = (ItemStack) (Object) this;
|
||||
|
||||
cir.setReturnValue(self == EMPTY || this.item == null || this.item == Items.AIR || count == 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen;
|
||||
|
||||
import de.florianmichael.viafabricplus.settings.groups.VisualSettings;
|
||||
import net.minecraft.block.entity.JigsawBlockEntity;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.ingame.JigsawBlockScreen;
|
||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
@ -61,7 +62,7 @@ public class MixinJigsawBlockScreen extends Screen {
|
||||
}
|
||||
|
||||
@Inject(method = "render", at = @At("HEAD"))
|
||||
public void injectRender(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
public void injectRender(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
if (VisualSettings.INSTANCE.removeNewerFeaturesFromJigsawScreen.getValue()) {
|
||||
nameField.setText(targetField.getText());
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ public class PackFormatsMappings {
|
||||
private final static Map<Integer, GameVersion> protocolMap = new HashMap<>();
|
||||
|
||||
public static void load() {
|
||||
registerVersion(ProtocolVersion.v1_20, 15, "23w17a");
|
||||
registerVersion(ProtocolVersion.v1_19_4, 13, "1.19.4");
|
||||
registerVersion(ProtocolVersion.v1_19_3, 12, "1.19.3");
|
||||
registerVersion(ProtocolVersion.v1_19_1, 9, "1.19.2");
|
||||
@ -95,7 +96,7 @@ public class PackFormatsMappings {
|
||||
}
|
||||
|
||||
private static void registerVersion(final ProtocolVersion version, final int packFormat, final String name, final String id) {
|
||||
protocolMap.put(version.getVersion(), new GameVersion() {
|
||||
protocolMap.put(version.getOriginalVersion(), new GameVersion() {
|
||||
@Override
|
||||
public SaveVersion getSaveVersion() {
|
||||
return null;
|
||||
@ -113,7 +114,7 @@ public class PackFormatsMappings {
|
||||
|
||||
@Override
|
||||
public int getProtocolVersion() {
|
||||
return version.getVersion();
|
||||
return version.getOriginalVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,6 +26,7 @@ import de.florianmichael.viafabricplus.screen.settings.settingrenderer.meta.Titl
|
||||
import de.florianmichael.viafabricplus.util.ScreenUtil;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ConnectScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget;
|
||||
@ -67,15 +68,17 @@ public class BetaCraftScreen extends Screen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(matrices);
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(context);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
|
||||
final MatrixStack matrices = context.getMatrices();
|
||||
|
||||
matrices.push();
|
||||
matrices.scale(2F, 2F, 2F);
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
|
||||
context.drawCenteredTextWithShadow(textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
|
||||
matrices.pop();
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, "https://github.com/FlorianMichael/ViaFabricPlus", width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
|
||||
context.drawCenteredTextWithShadow(textRenderer, "https://github.com/FlorianMichael/ViaFabricPlus", width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -126,21 +129,21 @@ public class BetaCraftScreen extends Screen {
|
||||
final ServerAddress serverAddress = LegacyServerAddress.parse(null, server.host() + ":" + server.port());
|
||||
final ServerInfo entry = new ServerInfo(server.name(), serverAddress.getAddress(), false);
|
||||
|
||||
ConnectScreen.connect(MinecraftClient.getInstance().currentScreen, MinecraftClient.getInstance(), serverAddress, entry);
|
||||
ConnectScreen.connect(MinecraftClient.getInstance().currentScreen, MinecraftClient.getInstance(), serverAddress, entry, false);
|
||||
ScreenUtil.playClickSound();
|
||||
return super.mouseClicked(mouseX, mouseY, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mappedRenderer(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
public void mappedRenderer(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, server.name() + Formatting.DARK_GRAY + " [" + server.gameVersion() + "]", entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||
context.drawCenteredTextWithShadow(textRenderer, server.name() + Formatting.DARK_GRAY + " [" + server.gameVersion() + "]", entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||
|
||||
if (server.onlineMode()) {
|
||||
drawTextWithShadow(matrices, textRenderer, Text.translatable("words.viafabricplus.online").formatted(Formatting.GREEN), 1, 1, -1);
|
||||
context.drawTextWithShadow(textRenderer, Text.translatable("words.viafabricplus.online").formatted(Formatting.GREEN), 1, 1, -1);
|
||||
}
|
||||
final String playerText = server.playerCount() + "/" + server.playerLimit();
|
||||
drawTextWithShadow(matrices, textRenderer, playerText, entryWidth - textRenderer.getWidth(playerText) - 4 /* magic value from line 132 */ - 1, 1, -1);
|
||||
context.drawTextWithShadow(textRenderer, playerText, entryWidth - textRenderer.getWidth(playerText) - 4 /* magic value from line 152 */ - 1, 1, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ package de.florianmichael.viafabricplus.screen;
|
||||
import de.florianmichael.viafabricplus.event.ChangeProtocolVersionCallback;
|
||||
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.sound.PositionedSoundInstance;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
@ -151,7 +152,7 @@ public class ClassicItemSelectionScreen extends Screen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
final int halfWidth = this.width / 2;
|
||||
final int halfHeight = this.height / 2;
|
||||
|
||||
@ -161,8 +162,8 @@ public class ClassicItemSelectionScreen extends Screen {
|
||||
final int renderX = halfWidth - boxWidth / 2;
|
||||
final int renderY = halfHeight - boxHeight / 2;
|
||||
|
||||
fill(matrices, renderX, renderY, renderX + boxWidth, renderY + boxHeight, Integer.MIN_VALUE);
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, "Select block", renderX + boxWidth / 2, renderY + SIDE_OFFSET, -1);
|
||||
context.fill(renderX, renderY, renderX + boxWidth, renderY + boxHeight, Integer.MIN_VALUE);
|
||||
context.drawCenteredTextWithShadow(textRenderer, "Select block", renderX + boxWidth / 2, renderY + SIDE_OFFSET, -1);
|
||||
selectedItem = null;
|
||||
|
||||
int y = SIDE_OFFSET + SIDE_OFFSET;
|
||||
@ -172,14 +173,14 @@ public class ClassicItemSelectionScreen extends Screen {
|
||||
if (item == null) continue;
|
||||
|
||||
if (mouseX > renderX + x && mouseY > renderY + y && mouseX < renderX + x + ITEM_XY_BOX_DIMENSION_CLASSIC && mouseY < renderY + y + ITEM_XY_BOX_DIMENSION_CLASSIC) {
|
||||
fill(matrices, renderX + x, renderY + y, renderX + x + ITEM_XY_BOX_DIMENSION_CLASSIC, renderY + y + ITEM_XY_BOX_DIMENSION_CLASSIC, Integer.MAX_VALUE);
|
||||
context.fill(renderX + x, renderY + y, renderX + x + ITEM_XY_BOX_DIMENSION_CLASSIC, renderY + y + ITEM_XY_BOX_DIMENSION_CLASSIC, Integer.MAX_VALUE);
|
||||
selectedItem = item.getDefaultStack();
|
||||
}
|
||||
MinecraftClient.getInstance().getItemRenderer().renderGuiItemIcon(matrices, item.getDefaultStack(), renderX + x + ITEM_XY_BOX_DIMENSION_MODERN / 4, renderY + y + ITEM_XY_BOX_DIMENSION_MODERN / 4);
|
||||
context.drawItem(item.getDefaultStack(), renderX + x + ITEM_XY_BOX_DIMENSION_MODERN / 4, renderY + y + ITEM_XY_BOX_DIMENSION_MODERN / 4);
|
||||
x += ITEM_XY_BOX_DIMENSION_CLASSIC;
|
||||
}
|
||||
y += ITEM_XY_BOX_DIMENSION_CLASSIC;
|
||||
}
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget;
|
||||
import net.minecraft.client.sound.PositionedSoundInstance;
|
||||
@ -54,15 +55,17 @@ public class ForceVersionScreen extends Screen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(matrices);
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(context);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
|
||||
final MatrixStack matrices = context.getMatrices();
|
||||
|
||||
matrices.push();
|
||||
matrices.scale(2F, 2F, 2F);
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
|
||||
context.drawCenteredTextWithShadow(textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
|
||||
matrices.pop();
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, Text.translatable("forceversion.viafabricplus.title"), width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
|
||||
context.drawCenteredTextWithShadow(textRenderer, Text.translatable("forceversion.viafabricplus.title"), width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -101,9 +104,9 @@ public class ForceVersionScreen extends Screen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
public void render(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, ((MutableText) getNarration()).formatted(Formatting.GOLD), x + entryWidth / 2, y + entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||
context.drawCenteredTextWithShadow(textRenderer, ((MutableText) getNarration()).formatted(Formatting.GOLD), x + entryWidth / 2, y + entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,9 +131,9 @@ public class ForceVersionScreen extends Screen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
public void render(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, this.protocolVersion.getName(), x + entryWidth / 2, y - 1 + entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||
context.drawCenteredTextWithShadow(textRenderer, this.protocolVersion.getName(), x + entryWidth / 2, y - 1 + entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ import de.florianmichael.viafabricplus.util.ScreenUtil;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.NoticeScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.tooltip.Tooltip;
|
||||
@ -93,15 +94,17 @@ public class ProtocolSelectionScreen extends Screen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(matrices);
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(context);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
|
||||
final MatrixStack matrices = context.getMatrices();
|
||||
|
||||
matrices.push();
|
||||
matrices.scale(2F, 2F, 2F);
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
|
||||
context.drawCenteredTextWithShadow(textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
|
||||
matrices.pop();
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, "https://github.com/FlorianMichael/ViaFabricPlus", width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
|
||||
context.drawCenteredTextWithShadow(textRenderer, "https://github.com/FlorianMichael/ViaFabricPlus", width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -138,14 +141,16 @@ public class ProtocolSelectionScreen extends Screen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
public void render(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
final boolean isSelected = ProtocolHack.getTargetVersion().getVersion() == protocolVersion.getVersion();
|
||||
|
||||
final MatrixStack matrices = context.getMatrices();
|
||||
|
||||
matrices.push();
|
||||
matrices.translate(x, y - 1, 0);
|
||||
|
||||
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, this.protocolVersion.getName(), entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, isSelected ? Color.GREEN.getRGB() : Color.RED.getRGB());
|
||||
context.drawCenteredTextWithShadow(textRenderer, this.protocolVersion.getName(), entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, isSelected ? Color.GREEN.getRGB() : Color.RED.getRGB());
|
||||
matrices.pop();
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import de.florianmichael.classic4j.model.classicube.highlevel.CCAccount;
|
||||
import de.florianmichael.viafabricplus.definition.c0_30.ClassiCubeAccountHandler;
|
||||
import de.florianmichael.viafabricplus.integration.Classic4JImpl;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
@ -107,10 +108,11 @@ public class ClassiCubeLoginScreen extends Screen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(matrices);
|
||||
drawCenteredTextWithShadow(matrices, this.textRenderer, this.title, this.width / 2, 70, 16777215);
|
||||
drawCenteredTextWithShadow(matrices, this.textRenderer, this.status, this.width / 2, 1, 16777215);
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(context);
|
||||
context.drawCenteredTextWithShadow(this.textRenderer, this.title, this.width / 2, 70, 16777215);
|
||||
context.drawCenteredTextWithShadow(this.textRenderer, this.status, this.width / 2, 1, 16777215);
|
||||
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import de.florianmichael.viafabricplus.definition.c0_30.ClassiCubeAccountHandler
|
||||
import de.florianmichael.viafabricplus.integration.Classic4JImpl;
|
||||
import de.florianmichael.viafabricplus.screen.ProtocolSelectionScreen;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.TitleScreen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
||||
@ -97,10 +98,11 @@ public class ClassiCubeMFAScreen extends Screen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(matrices);
|
||||
drawCenteredTextWithShadow(matrices, this.textRenderer, this.title, this.width / 2, 70, 16777215);
|
||||
drawCenteredTextWithShadow(matrices, this.textRenderer, this.status, this.width / 2, 1, 16777215);
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(context);
|
||||
context.drawCenteredTextWithShadow(this.textRenderer, this.title, this.width / 2, 70, 16777215);
|
||||
context.drawCenteredTextWithShadow(this.textRenderer, this.status, this.width / 2, 1, 16777215);
|
||||
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ import de.florianmichael.viafabricplus.util.ScreenUtil;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ConnectScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.TitleScreen;
|
||||
@ -90,15 +91,17 @@ public class ClassiCubeServerListScreen extends Screen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(matrices);
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(context);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
|
||||
final MatrixStack matrices = context.getMatrices();
|
||||
|
||||
matrices.push();
|
||||
matrices.scale(2F, 2F, 2F);
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
|
||||
context.drawCenteredTextWithShadow(textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
|
||||
matrices.pop();
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, Text.literal("ClassiCube Profile: " + ClassiCubeAccountHandler.INSTANCE.getAccount().username()), width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
|
||||
context.drawCenteredTextWithShadow(textRenderer, Text.literal("ClassiCube Profile: " + ClassiCubeAccountHandler.INSTANCE.getAccount().username()), width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
|
||||
}
|
||||
|
||||
public static class SlotList extends AlwaysSelectedEntryListWidget<MappedSlotEntry> {
|
||||
@ -143,19 +146,19 @@ public class ClassiCubeServerListScreen extends Screen {
|
||||
((IServerInfo) entry).viafabricplus_forceVersion(ViaLoadingBase.fromProtocolVersion(LegacyProtocolVersion.c0_30cpe));
|
||||
}
|
||||
|
||||
ConnectScreen.connect(MinecraftClient.getInstance().currentScreen, MinecraftClient.getInstance(), serverAddress, entry);
|
||||
ConnectScreen.connect(MinecraftClient.getInstance().currentScreen, MinecraftClient.getInstance(), serverAddress, entry, false);
|
||||
ScreenUtil.playClickSound();
|
||||
return super.mouseClicked(mouseX, mouseY, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mappedRenderer(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
public void mappedRenderer(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, classiCubeServerInfo.name(), entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||
context.drawCenteredTextWithShadow(textRenderer, classiCubeServerInfo.name(), entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||
|
||||
drawTextWithShadow(matrices, textRenderer, classiCubeServerInfo.software().replace('&', Formatting.FORMATTING_CODE_PREFIX), 1, 1, -1);
|
||||
context.drawTextWithShadow(textRenderer, classiCubeServerInfo.software().replace('&', Formatting.FORMATTING_CODE_PREFIX), 1, 1, -1);
|
||||
final String playerText = classiCubeServerInfo.players() + "/" + classiCubeServerInfo.maxPlayers();
|
||||
drawTextWithShadow(matrices, textRenderer, playerText, entryWidth - textRenderer.getWidth(playerText) - 4 /* magic value from line 132 */ - 1, 1, -1);
|
||||
context.drawTextWithShadow(textRenderer, playerText, entryWidth - textRenderer.getWidth(playerText) - 4 /* magic value from line 132 */ - 1, 1, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import de.florianmichael.viafabricplus.screen.settings.settingrenderer.meta.Titl
|
||||
import de.florianmichael.viafabricplus.settings.base.AbstractSetting;
|
||||
import de.florianmichael.viafabricplus.settings.base.SettingGroup;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
@ -54,15 +55,17 @@ public class SettingsScreen extends Screen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(matrices);
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(context);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
|
||||
final MatrixStack matrices = context.getMatrices();
|
||||
|
||||
matrices.push();
|
||||
matrices.scale(2F, 2F, 2F);
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
|
||||
context.drawCenteredTextWithShadow(textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
|
||||
matrices.pop();
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, "https://github.com/FlorianMichael/ViaFabricPlus", width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
|
||||
context.drawCenteredTextWithShadow(textRenderer, "https://github.com/FlorianMichael/ViaFabricPlus", width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,6 +22,7 @@ import de.florianmichael.viafabricplus.settings.type_impl.BooleanSetting;
|
||||
import de.florianmichael.viafabricplus.util.ScreenUtil;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
@ -48,12 +49,12 @@ public class BooleanSettingRenderer extends MappedSlotEntry {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mappedRenderer(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
public void mappedRenderer(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
||||
|
||||
final Text text = this.value.getValue() ? Text.translatable("words.viafabricplus.on") : Text.translatable("words.viafabricplus.off");
|
||||
|
||||
textRenderer.drawWithShadow(matrices, this.value.getName().formatted(Formatting.GRAY), 3, entryHeight / 2F - textRenderer.fontHeight / 2F, -1);
|
||||
textRenderer.drawWithShadow(matrices, text, entryWidth - textRenderer.getWidth(text) - 3 - 3, entryHeight / 2F - textRenderer.fontHeight / 2F, this.value.getValue() ? Color.GREEN.getRGB() : Color.RED.getRGB());
|
||||
context.drawTextWithShadow(textRenderer, this.value.getName().formatted(Formatting.GRAY), 3, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||
context.drawTextWithShadow(textRenderer, text, entryWidth - textRenderer.getWidth(text) - 3 - 3, entryHeight / 2 - textRenderer.fontHeight / 2, this.value.getValue() ? Color.GREEN.getRGB() : Color.RED.getRGB());
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import de.florianmichael.viafabricplus.settings.type_impl.ModeSetting;
|
||||
import de.florianmichael.viafabricplus.util.ScreenUtil;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
@ -49,10 +50,10 @@ public class ModeSettingRenderer extends MappedSlotEntry {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mappedRenderer(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
public void mappedRenderer(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
||||
|
||||
textRenderer.drawWithShadow(matrices, this.value.getName().formatted(Formatting.GRAY), 3, entryHeight / 2F - textRenderer.fontHeight / 2F, -1);
|
||||
textRenderer.drawWithShadow(matrices, this.value.getValue(), entryWidth - textRenderer.getWidth(this.value.getValue()) - 3 - 3, entryHeight / 2F - textRenderer.fontHeight / 2F, -1);
|
||||
context.drawTextWithShadow(textRenderer, this.value.getName().formatted(Formatting.GRAY), 3, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||
context.drawTextWithShadow(textRenderer, this.value.getValue(), entryWidth - textRenderer.getWidth(this.value.getValue()) - 3 - 3, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import de.florianmichael.viafabricplus.settings.type_impl.ProtocolSyncBooleanSet
|
||||
import de.florianmichael.viafabricplus.util.ScreenUtil;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
@ -49,16 +50,16 @@ public class ProtocolSyncBooleanSettingRenderer extends MappedSlotEntry {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mappedRenderer(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
public void mappedRenderer(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
||||
|
||||
final Text text = this.value.getValue() ? Text.translatable("words.viafabricplus.on") : Text.translatable("words.viafabricplus.off");
|
||||
Color color = this.value.getValue() ? Color.GREEN : Color.RED;
|
||||
|
||||
final int length = textRenderer.drawWithShadow(matrices, this.value.getName().formatted(Formatting.GRAY), 3, entryHeight / 2F - textRenderer.fontHeight / 2F, -1);
|
||||
final int length = context.drawTextWithShadow(textRenderer, this.value.getName().formatted(Formatting.GRAY), 3, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||
|
||||
textRenderer.drawWithShadow(matrices, "(" + this.value.getProtocolRange().toString() + ")", length + 2, entryHeight / 2F - textRenderer.fontHeight / 2F, -1);
|
||||
context.drawTextWithShadow(textRenderer, "(" + this.value.getProtocolRange().toString() + ")", length + 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||
if (GeneralSettings.INSTANCE.automaticallyChangeValuesBasedOnTheCurrentVersion.getValue()) color = color.darker().darker();
|
||||
textRenderer.drawWithShadow(matrices, text, entryWidth - textRenderer.getWidth(text) - 3 - 3, entryHeight / 2F - textRenderer.fontHeight / 2F, color.getRGB());
|
||||
context.drawTextWithShadow(textRenderer, text, entryWidth - textRenderer.getWidth(text) - 3 - 3, entryHeight / 2 - textRenderer.fontHeight / 2, color.getRGB());
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ package de.florianmichael.viafabricplus.screen.settings.settingrenderer.meta;
|
||||
import de.florianmichael.viafabricplus.screen.base.MappedSlotEntry;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
@ -37,17 +38,18 @@ public class TitleRenderer extends MappedSlotEntry {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
public void render(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
final MatrixStack matrices = context.getMatrices();
|
||||
matrices.push();
|
||||
matrices.translate(x, y, 0);
|
||||
mappedRenderer(matrices, index, y, x, entryWidth, entryHeight, mouseX, mouseY, hovered, tickDelta);
|
||||
mappedRenderer(context, index, y, x, entryWidth, entryHeight, mouseX, mouseY, hovered, tickDelta);
|
||||
matrices.pop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mappedRenderer(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
public void mappedRenderer(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
||||
|
||||
textRenderer.drawWithShadow(matrices, Formatting.BOLD + this.name, 3, entryHeight / 2F - textRenderer.fontHeight / 2F, -1);
|
||||
context.drawTextWithShadow(textRenderer, Formatting.BOLD + this.name, 3, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||
}
|
||||
}
|
||||
|
@ -29,11 +29,10 @@
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14.11",
|
||||
"fabric-api": "*",
|
||||
"minecraft": "~1.19.4",
|
||||
"minecraft": ">=1.20- <1.20.1-",
|
||||
"java": ">=17"
|
||||
},
|
||||
"breaks": {
|
||||
"viafabric": "*",
|
||||
"multiconnect": "*"
|
||||
"viafabric": "*"
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
"fixes.minecraft.MixinCamera",
|
||||
"fixes.minecraft.MixinClientPlayerInteractionManager",
|
||||
"fixes.minecraft.MixinClientPlayNetworkHandler",
|
||||
"fixes.minecraft.MixinDrawContext",
|
||||
"fixes.minecraft.MixinInGameHud",
|
||||
"fixes.minecraft.MixinItemRenderer",
|
||||
"fixes.minecraft.MixinMinecraftClient",
|
||||
@ -149,6 +150,7 @@
|
||||
"fixes.viaversion.protocol1_18_2to1_18.MixinProtocol1_18_2To1_18",
|
||||
"fixes.viaversion.protocol1_19_1to1_19.MixinProtocol1_19_1To1_19",
|
||||
"fixes.viaversion.protocol1_19_3to1_19_1.MixinProtocol1_19_3To1_19_1",
|
||||
"fixes.viaversion.protocol1_9_1to1_9.MixinProtocol1_9_1To1_9",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinChunk1_8Type",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinCommandBlockProvider",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinEntityPackets_6_1",
|
||||
@ -158,8 +160,7 @@
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinViaIdleThread",
|
||||
"jsonwebtoken.MixinClasses",
|
||||
"jsonwebtoken.MixinDefaultCompressionCodecResolver",
|
||||
"jsonwebtoken.MixinDefaultJwtParserBuilder",
|
||||
"fixes.viaversion.protocol1_9_1to1_9.MixinProtocol1_9_1To1_9"
|
||||
"jsonwebtoken.MixinDefaultJwtParserBuilder"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
Loading…
Reference in New Issue
Block a user