From dc353aa386ade995285701136a94c3c25a3a3fe1 Mon Sep 17 00:00:00 2001 From: fayer3 Date: Thu, 29 Feb 2024 00:04:44 +0100 Subject: [PATCH] backport to 1.18.2 --- common/build.gradle | 14 +++++----- .../gui/framework/GuiVROptionSlider.java | 4 +-- .../client/gui/screens/ErrorScreen.java | 2 +- .../gui/screens/GarbageCollectorScreen.java | 28 +++++++++---------- .../client/gui/screens/UpdateScreen.java | 6 ++-- .../client/gui/widgets/SettingsList.java | 10 ++++--- .../client/gui/widgets/TextScrollWidget.java | 2 +- .../java/org/vivecraft/client_vr/VRState.java | 2 ++ .../gameplay/trackers/SwingTracker.java | 4 +-- .../provider/openvr_lwjgl/MCOpenVR.java | 4 +-- .../client/gui/screens/TitleScreenMixin.java | 2 +- .../mixin/client_vr/MinecraftVRMixin.java | 10 ++----- .../CreativeModeInventoryScreenVRMixin.java | 4 +-- .../renderer/ItemPropertiesVRMixin.java | 23 --------------- .../item/crafting/ShapedRecipeMixin.java | 4 +-- .../vivecraft/server/ServerNetworking.java | 2 +- .../main/resources/vivecraft.accesswidener | 3 ++ fabric/build.gradle | 18 ++++++------ forge/build.gradle | 4 +-- .../vivecraft/forge/event/ClientEvents.java | 14 +++++----- gradle.properties | 6 ++-- 21 files changed, 72 insertions(+), 94 deletions(-) delete mode 100644 common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemPropertiesVRMixin.java diff --git a/common/build.gradle b/common/build.gradle index a1f6b2662..4018d9d87 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -20,10 +20,10 @@ dependencies { // for iris compat - modCompileOnly "maven.modrinth:iris:1.6.11+1.19.2" + modCompileOnly "maven.modrinth:iris:1.6.11+1.18.2" // for REI compat - modCompileOnly("me.shedaniel:RoughlyEnoughItems-fabric:9.1.682") { exclude group: "net.fabricmc" exclude group: "net.fabricmc.fabric-api" exclude group: "dev.architectury" } + modCompileOnly("me.shedaniel:RoughlyEnoughItems-fabric:8.3.681") { exclude group: "net.fabricmc" exclude group: "net.fabricmc.fabric-api" exclude group: "dev.architectury" } // for Pehkui compat modApi("com.github.Virtuoel:Pehkui:3.7.12") { exclude group: "net.fabricmc" exclude group: "net.fabricmc.fabric-api" } @@ -31,16 +31,16 @@ dependencies { // other mods modCompileOnly "maven.modrinth:dynamic-fps:3.4.2" // modCompileOnly("com.simibubi.create:create-fabric-1.19.2:0.5.0.i-969+1.19.2") - // modCompileOnly "maven.modrinth:lithium:mc1.19.2-0.11.1" - // modCompileOnly "maven.modrinth:indium:1.0.9+mc1.19.2" + // modCompileOnly "maven.modrinth:lithium:mc1.18.2-0.10.3" + // modCompileOnly "maven.modrinth:indium:1.0.7+mc1.18.2" modCompileOnly "maven.modrinth:resolution-control-plus:1.19.4-3.0.0" - modCompileOnly "maven.modrinth:better-combat:1.7.1+1.19-fabric" + modCompileOnly "maven.modrinth:better-combat:1.6.2+1.18.2-fabric" // for immersive portals compat - modCompileOnly('com.github.iPortalTeam.ImmersivePortalsMod:imm_ptl_core:v2.3.1-1.19') { transitive false } + modCompileOnly('com.github.iPortalTeam.ImmersivePortalsMod:imm_ptl_core:v1.4.11-1.18') { transitive false } //for epic fight compat - modCompileOnly("maven.modrinth:epic-fight:19.5.22") + modCompileOnly("maven.modrinth:epic-fight:18.5.22") // needed dependencies compileOnly("com.google.code.findbugs:jsr305:3.0.2") diff --git a/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionSlider.java b/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionSlider.java index d3f1eb5a7..ed08ab1e0 100644 --- a/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionSlider.java +++ b/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionSlider.java @@ -15,7 +15,7 @@ public class GuiVROptionSlider extends AbstractSliderButton implements GuiVROpti public GuiVROptionSlider(int id, int x, int y, int width, int height, VRSettings.VrOptions option, boolean valueOnly) { super(x, y, width, height, - Component.literal(ClientDataHolderVR.getInstance().vrSettings.getButtonDisplayString(option, valueOnly)), + new TextComponent(ClientDataHolderVR.getInstance().vrSettings.getButtonDisplayString(option, valueOnly)), option.normalizeValue(ClientDataHolderVR.getInstance().vrSettings.getOptionFloatValue(option))); this.id = id; @@ -34,7 +34,7 @@ public GuiVROptionSlider(int id, int x, int y, VRSettings.VrOptions option) { @Override protected void updateMessage() { - this.setMessage(Component.literal(ClientDataHolderVR.getInstance().vrSettings.getButtonDisplayString(this.enumOptions, valueOnly))); + this.setMessage(new TextComponent(ClientDataHolderVR.getInstance().vrSettings.getButtonDisplayString(this.enumOptions, valueOnly))); } @Override diff --git a/common/src/main/java/org/vivecraft/client/gui/screens/ErrorScreen.java b/common/src/main/java/org/vivecraft/client/gui/screens/ErrorScreen.java index c3b445109..f6c25d126 100644 --- a/common/src/main/java/org/vivecraft/client/gui/screens/ErrorScreen.java +++ b/common/src/main/java/org/vivecraft/client/gui/screens/ErrorScreen.java @@ -35,7 +35,7 @@ protected void init() { this.addRenderableWidget(new Button( this.width / 2 - 155, this.height - 32, 150, 20, - Component.translatable("chat.copy.click"), + new TranslatableComponent("chat.copy.click"), (p) -> Minecraft.getInstance().keyboardHandler.setClipboard(this.title.getString() + "\n" + error.getString()))); } diff --git a/common/src/main/java/org/vivecraft/client/gui/screens/GarbageCollectorScreen.java b/common/src/main/java/org/vivecraft/client/gui/screens/GarbageCollectorScreen.java index 7be8d086a..2408968ad 100644 --- a/common/src/main/java/org/vivecraft/client/gui/screens/GarbageCollectorScreen.java +++ b/common/src/main/java/org/vivecraft/client/gui/screens/GarbageCollectorScreen.java @@ -7,9 +7,7 @@ import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.ConfirmLinkScreen; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.network.chat.ClickEvent; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.HoverEvent; +import net.minecraft.network.chat.*; import org.jetbrains.annotations.NotNull; import org.vivecraft.client.gui.widgets.TextScrollWidget; import org.vivecraft.client_vr.ClientDataHolderVR; @@ -22,31 +20,31 @@ public class GarbageCollectorScreen extends Screen { private final static String guideURL = "https://github.com/Vivecraft/VivecraftMod/wiki/Memory-and-GC-Setup"; public GarbageCollectorScreen(String currentGarbageCollector) { - super(Component.translatable("vivecraft.messages.gctitle")); + super(new TranslatableComponent("vivecraft.messages.gctitle")); this.lastScreen = Minecraft.getInstance().screen; this.currentGarbageCollector = currentGarbageCollector; } protected void init() { - Component message = Component.translatable("vivecraft.messages.gcinfo", - Component.literal(currentGarbageCollector).withStyle(s -> s.withColor(ChatFormatting.RED)), - Component.literal("ZGC"), - Component.literal(Integer.toString(6)), - Component.literal("-XX:+UseZGC").withStyle(s -> s + Component message = new TranslatableComponent("vivecraft.messages.gcinfo", + new TextComponent(currentGarbageCollector).withStyle(s -> s.withColor(ChatFormatting.RED)), + new TextComponent("ZGC"), + new TextComponent(Integer.toString(6)), + new TextComponent("-XX:+UseZGC").withStyle(s -> s .withColor(ChatFormatting.GOLD) .withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, "-XX:+UseZGC")) - .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("chat.copy.click")))), - Component.translatable("vivecraft.gui.openguide").withStyle(style -> style + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TranslatableComponent("chat.copy.click")))), + new TranslatableComponent("vivecraft.gui.openguide").withStyle(style -> style .withUnderlined(true) .withColor(ChatFormatting.GREEN) - .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("chat.link.open"))) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TranslatableComponent("chat.link.open"))) .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, guideURL)))); this.addRenderableWidget(new TextScrollWidget(this.width / 2 - 155, 30, 310, this.height - 30 - 60, message)); this.addRenderableWidget(new Button( this.width / 2 - 155, this.height - 56, 150, 20, - Component.translatable("vivecraft.gui.dontshowagain"), + new TranslatableComponent("vivecraft.gui.dontshowagain"), (p) -> { ClientDataHolderVR.getInstance().vrSettings.disableGarbageCollectorMessage = true; ClientDataHolderVR.getInstance().vrSettings.saveOptions(); @@ -56,13 +54,13 @@ protected void init() { this.addRenderableWidget(new Button( this.width / 2 + 5, this.height - 56, 150, 20, - Component.translatable("vivecraft.gui.ok"), + new TranslatableComponent("vivecraft.gui.ok"), (p) -> onClose())); this.addRenderableWidget(new Button( this.width / 2 - 75, this.height - 32, 150, 20, - Component.translatable("vivecraft.gui.openguide"), + new TranslatableComponent("vivecraft.gui.openguide"), (p) -> { this.minecraft.setScreen(new ConfirmLinkScreen(bl -> { if (bl) { diff --git a/common/src/main/java/org/vivecraft/client/gui/screens/UpdateScreen.java b/common/src/main/java/org/vivecraft/client/gui/screens/UpdateScreen.java index fca5954a1..4b1686f3d 100644 --- a/common/src/main/java/org/vivecraft/client/gui/screens/UpdateScreen.java +++ b/common/src/main/java/org/vivecraft/client/gui/screens/UpdateScreen.java @@ -20,7 +20,7 @@ public class UpdateScreen extends Screen { private TextScrollWidget text; public UpdateScreen() { - super(Component.translatable("vivecraft.messages.updateTitle")); + super(new TranslatableComponent("vivecraft.messages.updateTitle")); lastScreen = Minecraft.getInstance().screen; } @@ -30,7 +30,7 @@ protected void init() { this.addRenderableWidget(new Button( this.width / 2 - 155, this.height - 56, 150, 20, - Component.translatable("vivecraft.gui.downloadfrom", Component.literal("Modrinth")), + new TranslatableComponent("vivecraft.gui.downloadfrom", new TextComponent("Modrinth")), button -> this.minecraft.setScreen(new ConfirmLinkScreen(bl -> { if (bl) { @@ -42,7 +42,7 @@ protected void init() { this.addRenderableWidget(new Button( this.width / 2 + 5, this.height - 56, 150, 20, - Component.translatable("vivecraft.gui.downloadfrom", Component.literal("CurseForge")), + new TranslatableComponent("vivecraft.gui.downloadfrom", new TextComponent("CurseForge")), button -> this.minecraft.setScreen(new ConfirmLinkScreen(bl -> { if (bl) { diff --git a/common/src/main/java/org/vivecraft/client/gui/widgets/SettingsList.java b/common/src/main/java/org/vivecraft/client/gui/widgets/SettingsList.java index ce4389e65..9416bef96 100644 --- a/common/src/main/java/org/vivecraft/client/gui/widgets/SettingsList.java +++ b/common/src/main/java/org/vivecraft/client/gui/widgets/SettingsList.java @@ -13,6 +13,8 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.resources.language.I18n; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.TranslatableComponent; import org.vivecraft.client.gui.framework.GuiVROptionSlider; import org.vivecraft.client_vr.ClientDataHolderVR; import org.vivecraft.client_vr.settings.VRSettings; @@ -70,7 +72,7 @@ public static BaseEntry vrOptionToEntry(VRSettings.VrOptions option) { tooltipPrefix = I18n.get("vivecraft.message.limitedbyserver", setting.getValueMin(), setting.getValueMax()); } } - tooltip = Component.literal(tooltipPrefix + I18n.get(tooltipString, (Object) null)); + tooltip = new TextComponent(tooltipPrefix + I18n.get(tooltipString, (Object) null)); } else { tooltip = null; } @@ -95,10 +97,10 @@ public void renderButton(PoseStack poseStack, int x, int y, float f) { // regular button widget = new Button( 0, 0, WidgetEntry.valueButtonWidth, 20, - Component.literal(dh.vrSettings.getButtonDisplayString(option, true)), + new TextComponent(dh.vrSettings.getButtonDisplayString(option, true)), button -> { dh.vrSettings.setOptionValue(option); - button.setMessage(Component.literal(dh.vrSettings.getButtonDisplayString(option, true))); + button.setMessage(new TextComponent(dh.vrSettings.getButtonDisplayString(option, true))); }, (button, poseStack, x, y) -> { if (tooltip != null) { @@ -107,7 +109,7 @@ public void renderButton(PoseStack poseStack, int x, int y, float f) { }); } - BaseEntry entry = new WidgetEntry(Component.translatable(optionString), widget); + BaseEntry entry = new WidgetEntry(new TranslatableComponent(optionString), widget); if (dh.vrSettings.overrides.hasSetting(option) && dh.vrSettings.overrides.getSetting(option).isValueOverridden()) { entry.setActive(false); } diff --git a/common/src/main/java/org/vivecraft/client/gui/widgets/TextScrollWidget.java b/common/src/main/java/org/vivecraft/client/gui/widgets/TextScrollWidget.java index 1f9ede451..c83cd416c 100644 --- a/common/src/main/java/org/vivecraft/client/gui/widgets/TextScrollWidget.java +++ b/common/src/main/java/org/vivecraft/client/gui/widgets/TextScrollWidget.java @@ -30,7 +30,7 @@ public class TextScrollWidget extends AbstractWidget { public TextScrollWidget(int x, int y, int width, int height, String text) { super(x, y, width, height, new TextComponent("")); - formattedChars = Minecraft.getInstance().font.split(Component.literal(text), width - scrollBarWidth * 2); + formattedChars = Minecraft.getInstance().font.split(new TextComponent(text), width - scrollBarWidth * 2); initScroll(); } diff --git a/common/src/main/java/org/vivecraft/client_vr/VRState.java b/common/src/main/java/org/vivecraft/client_vr/VRState.java index b6721b855..a5d9bb666 100644 --- a/common/src/main/java/org/vivecraft/client_vr/VRState.java +++ b/common/src/main/java/org/vivecraft/client_vr/VRState.java @@ -2,6 +2,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.TranslatableComponent; import org.apache.commons.lang3.StringUtils; import org.lwjgl.glfw.GLFW; import org.vivecraft.client.gui.screens.ErrorScreen; diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SwingTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SwingTracker.java index a954203df..bb463abe2 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SwingTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SwingTracker.java @@ -257,10 +257,10 @@ public void doProcess(LocalPlayer player) { || item.useOn(new UseOnContext(player, c == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND, blockHit)).shouldSwing())) { // don't try to break crops with hoes // actually use the item on the block - boolean useSuccessful = this.mc.gameMode.useItemOn(player, c == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND, blockHit).shouldSwing(); + boolean useSuccessful = this.mc.gameMode.useItemOn(player, (ClientLevel) player.level, c == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND, blockHit).shouldSwing(); if (itemstack.is(ItemTags.VIVECRAFT_SCYTHES) && !useSuccessful) { // some scythes just need to be used - this.mc.gameMode.useItem(player, c == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND); + this.mc.gameMode.useItem(player, player.level, c == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND); } } // roomscale noteblocks diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java index eca10c017..a086d58ce 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java @@ -873,7 +873,7 @@ private void checkPathValid(String path, String knownError, boolean alwaysThrow) if (hasInvalidChars || alwaysThrow) { String error = knownError + (hasInvalidChars ? "\nInvalid characters in path: \n" : "\n"); System.out.println(error + path); - throw new RenderConfigException(knownError, Component.empty().append(error).append(pathFormatted)); + throw new RenderConfigException(knownError, new TextComponent(error).append(pathFormatted)); } } @@ -980,7 +980,7 @@ private void loadActionManifest() throws RenderConfigException { int i = VRInput_SetActionManifestPath(actionsPath); if (i != 0) { - throw new RenderConfigException("Failed to load action manifest", Component.literal(getInputErrorName(i))); + throw new RenderConfigException("Failed to load action manifest", new TextComponent(getInputErrorName(i))); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client/gui/screens/TitleScreenMixin.java b/common/src/main/java/org/vivecraft/mixin/client/gui/screens/TitleScreenMixin.java index fd19a3d24..0c7a87338 100644 --- a/common/src/main/java/org/vivecraft/mixin/client/gui/screens/TitleScreenMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client/gui/screens/TitleScreenMixin.java @@ -74,7 +74,7 @@ protected TitleScreenMixin(Component component) { vivecraft$updateButton.visible = UpdateChecker.hasUpdate; if (vivecraft$vrModeButton.visible && vivecraft$vrModeButton.isMouseOver(i, j)) { - renderTooltip(poseStack, font.split(Component.translatable("vivecraft.options.VR_ENABLED.tooltip"), Math.max(width / 2 - 43, 170)), i, j); + renderTooltip(poseStack, font.split(new TranslatableComponent("vivecraft.options.VR_ENABLED.tooltip"), Math.max(width / 2 - 43, 170)), i, j); } if (VRState.vrInitialized && !VRState.vrRunning) { Component hotswitchMessage = new TranslatableComponent("vivecraft.messages.vrhotswitchinginfo"); diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java index 0302a6c97..9e170545c 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java @@ -271,7 +271,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { } } - @Inject(at = @At("TAIL"), method = "lambda$new$2", remap = false, require = 0, expect = 0) + @Inject(at = @At("TAIL"), method = "lambda$new$1", remap = false, require = 0, expect = 0) private void vivecraft$showGarbageCollectorScreenForge(CallbackInfo ci) { if ("forge".equals(Xplat.getModloader())) { vivecraft$showGarbageCollectorScreen(); @@ -777,11 +777,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { for (int i = 0; i < VivecraftVRMod.INSTANCE.keyQuickCommands.length; i++) { if (VivecraftVRMod.INSTANCE.keyQuickCommands[i].consumeClick()) { String command = ClientDataHolderVR.getInstance().vrSettings.vrQuickCommands[i]; - if (command.startsWith("/")) { - this.player.commandSigned(command.substring(1), Component.empty()); - } else { - this.player.chatSigned(command, Component.empty()); - } + this.player.chat(command); } } } @@ -958,7 +954,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { Minecraft.getInstance().getSoundManager().reload(); } resizeDisplay(); - window.updateVsync(options.enableVsync().get()); + window.updateVsync(options.enableVsync); } @Unique diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/inventory/CreativeModeInventoryScreenVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/inventory/CreativeModeInventoryScreenVRMixin.java index 35e46f7ef..7afa3a60f 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/inventory/CreativeModeInventoryScreenVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/inventory/CreativeModeInventoryScreenVRMixin.java @@ -52,13 +52,13 @@ public CreativeModeInventoryScreenVRMixin(CreativeModeInventoryScreen.ItemPicker if (tab == CreativeModeTab.TAB_TOOLS || tab == null) { ItemStack boots = new ItemStack(Items.LEATHER_BOOTS); - boots.setHoverName(Component.translatable("vivecraft.item.jumpboots")); + boots.setHoverName(new TranslatableComponent("vivecraft.item.jumpboots")); boots.getTag().putBoolean("Unbreakable", true); boots.getTag().putInt("HideFlags", 4); boots.getOrCreateTagElement(ItemStack.TAG_DISPLAY).putInt(ItemStack.TAG_COLOR, 9233775); ItemStack claws = new ItemStack(Items.SHEARS); - claws.setHoverName(Component.translatable("vivecraft.item.climbclaws")); + claws.setHoverName(new TranslatableComponent("vivecraft.item.climbclaws")); claws.getTag().putBoolean("Unbreakable", true); claws.getTag().putInt("HideFlags", 4); diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemPropertiesVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemPropertiesVRMixin.java deleted file mode 100644 index 29d662b44..000000000 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemPropertiesVRMixin.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.vivecraft.mixin.client_vr.renderer; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.renderer.item.ItemProperties; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.item.ItemStack; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.vivecraft.client_vr.VRState; - -@Mixin(ItemProperties.class) -public class ItemPropertiesVRMixin { - - @Inject(at = @At("HEAD"), method = "method_43611", cancellable = true) - private static void vivecraft$noHornUseAnimFabric(ItemStack itemStack, ClientLevel clientLevel, LivingEntity livingEntity, int i, CallbackInfoReturnable cir) { - if (VRState.vrRunning && livingEntity == Minecraft.getInstance().player) { - cir.setReturnValue(0.0F); - } - } -} diff --git a/common/src/main/java/org/vivecraft/mixin/world/item/crafting/ShapedRecipeMixin.java b/common/src/main/java/org/vivecraft/mixin/world/item/crafting/ShapedRecipeMixin.java index 15aa564bb..1da8ed790 100644 --- a/common/src/main/java/org/vivecraft/mixin/world/item/crafting/ShapedRecipeMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/world/item/crafting/ShapedRecipeMixin.java @@ -51,10 +51,10 @@ public class ShapedRecipeMixin { } else { ItemStack itemStack = new ItemStack(vanillaItem, i); if (jsonObject.has("fallbackname")) { - itemStack.setHoverName(Component.translatable( + itemStack.setHoverName(new TranslatableComponent( jsonObject.get("name").getAsString())); } else { - itemStack.setHoverName(Component.translatable(jsonObject.get("name").getAsString())); + itemStack.setHoverName(new TranslatableComponent(jsonObject.get("name").getAsString())); } itemStack.getOrCreateTag().putBoolean("Unbreakable", GsonHelper.getAsBoolean(jsonObject, "unbreakable", false)); itemStack.getOrCreateTag().putInt("HideFlags", GsonHelper.getAsInt(jsonObject, "hideflags", 0)); diff --git a/common/src/main/java/org/vivecraft/server/ServerNetworking.java b/common/src/main/java/org/vivecraft/server/ServerNetworking.java index 99ac31f20..a25ab13b1 100644 --- a/common/src/main/java/org/vivecraft/server/ServerNetworking.java +++ b/common/src/main/java/org/vivecraft/server/ServerNetworking.java @@ -65,7 +65,7 @@ public static void handlePacket(CommonNetworkHelper.PacketDiscriminators packetI } } else { // unsupported version, send notification, and disregard - player.sendSystemMessage(Component.literal("Unsupported vivecraft version, VR features will not work")); + player.sendMessage(new TextComponent("Unsupported vivecraft version, VR features will not work"), Util.NIL_UUID); if (ServerConfig.debug.get()) { LOGGER.info("{} networking not supported. client range [{},{}], server range [{},{}]", player.getName().getString(), diff --git a/common/src/main/resources/vivecraft.accesswidener b/common/src/main/resources/vivecraft.accesswidener index 595c5ab97..e547a9e75 100644 --- a/common/src/main/resources/vivecraft.accesswidener +++ b/common/src/main/resources/vivecraft.accesswidener @@ -98,10 +98,13 @@ accessible field com/mojang/math/Matrix4f m33 F accessible field net/minecraft/client/multiplayer/ClientLevel$ClientLevelData isFlat Z accessible field net/minecraft/world/level/biome/BiomeManager biomeZoomSeed J accessible class net/minecraft/world/level/biome/Biome$ClimateSettings +accessible field net/minecraft/world/level/biome/Biome$ClimateSettings temperatureModifier Lnet/minecraft/world/level/biome/Biome$TemperatureModifier; accessible field net/minecraft/world/level/biome/AmbientParticleSettings probability F accessible field net/minecraft/world/level/biome/Biome$ClimateSettings temperatureModifier Lnet/minecraft/world/level/biome/Biome$TemperatureModifier; extendable class net/minecraft/world/level/material/FluidState accessible field net/minecraft/world/level/block/state/StateHolder propertiesCodec Lcom/mojang/serialization/MapCodec; +accessible field net/minecraft/world/level/dimension/DimensionType ambientLight F +accessible field net/minecraft/world/level/dimension/DimensionType fixedTime Ljava/util/OptionalLong; # to init VR accessible class net/minecraft/client/ResourceLoadStateTracker$ReloadState diff --git a/fabric/build.gradle b/fabric/build.gradle index 7c39a1d56..122af568a 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -33,7 +33,7 @@ dependencies { modRuntimeOnly 'org.joml:joml:1.10.2' //temp sodium // for iris compat - modRuntimeOnly "maven.modrinth:iris:1.6.11+1.19.2" + modRuntimeOnly "maven.modrinth:iris:1.6.11+1.18.2" modRuntimeOnly 'org.anarres:jcpp:1.4.14' //temp iris modRuntimeOnly 'io.github.douira:glsl-transformer:2.0.0-pre13' //temp iris @@ -42,23 +42,23 @@ dependencies { //modRuntimeOnly 'io.github.douira:glsl-transformer:1.0.1' //temp iris // for REI compat - modRuntimeOnly("me.shedaniel:RoughlyEnoughItems-fabric:9.1.682") { exclude group: "net.fabricmc" exclude group: "net.fabricmc.fabric-api" exclude group: "dev.architectury" } + modRuntimeOnly("me.shedaniel:RoughlyEnoughItems-fabric:8.3.681") { exclude group: "net.fabricmc" exclude group: "net.fabricmc.fabric-api" exclude group: "dev.architectury" } // for Pehkui compat modCompileOnly("com.github.Virtuoel:Pehkui:3.7.12") { exclude group: "net.fabricmc" exclude group: "net.fabricmc.fabric-api" } // other mods - // modRuntimeOnly("com.simibubi.create:create-fabric-1.19.2:0.5.0.i-969+1.19.2") - // modCompileOnly "maven.modrinth:lithium:mc1.19.2-0.11.1" - // modCompileOnly "maven.modrinth:indium:1.0.9+mc1.19.2" + // modRuntimeOnly("com.simibubi.create:create-fabric-1.18.2:0.5.1.c-1159+1.18.2") + // modCompileOnly "maven.modrinth:lithium:mc1.18.2-0.10.3" + // modCompileOnly "maven.modrinth:indium:1.0.7+mc1.18.2" //mod menu - modApi("com.terraformersmc:modmenu:4.1.2") { exclude group: "net.fabricmc" exclude group: "net.fabricmc.fabric-api" } + modApi("com.terraformersmc:modmenu:3.2.5") { exclude group: "net.fabricmc" exclude group: "net.fabricmc.fabric-api" } // for immersive portals compat - modCompileOnly('com.github.iPortalTeam.ImmersivePortalsMod:imm_ptl_core:v2.3.1-1.19') { transitive false } - modCompileOnly('com.github.iPortalTeam.ImmersivePortalsMod:q_misc_util:v2.3.1-1.19') { transitive false } - modCompileOnly('com.github.iPortalTeam.ImmersivePortalsMod:build:v2.3.1-1.19') { transitive false } + modCompileOnly('com.github.iPortalTeam.ImmersivePortalsMod:imm_ptl_core:v1.4.11-1.18') { transitive false } + modCompileOnly('com.github.iPortalTeam.ImmersivePortalsMod:q_misc_util:v1.4.11-1.18') { transitive false } + modCompileOnly('com.github.iPortalTeam.ImmersivePortalsMod:build:v1.4.11-1.18') { transitive false } // needed for resource loading include(modImplementation(fabricApi.module("fabric-resource-loader-v0", rootProject.fabric_api_version))) diff --git a/forge/build.gradle b/forge/build.gradle index cbb7c0a00..87b83d73a 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -52,8 +52,8 @@ dependencies { common(project(path: ":common", configuration: "namedElements")) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false } - // modCompileOnly("maven.modrinth:rubidium:0.6.2c") - // modCompileOnly("maven.modrinth:oculus:1.19.2-1.6.9") + // modCompileOnly("maven.modrinth:rubidium:0.5.6") + // modCompileOnly("maven.modrinth:oculus:1.18.2-1.6.4") forgeRuntimeLibrary("org.lwjgl:lwjgl-openvr:3.2.2") forgeRuntimeLibrary("org.lwjgl:lwjgl-openvr:3.2.2:natives-linux") diff --git a/forge/src/main/java/org/vivecraft/forge/event/ClientEvents.java b/forge/src/main/java/org/vivecraft/forge/event/ClientEvents.java index 4a2d85c5b..142121cd4 100644 --- a/forge/src/main/java/org/vivecraft/forge/event/ClientEvents.java +++ b/forge/src/main/java/org/vivecraft/forge/event/ClientEvents.java @@ -18,13 +18,13 @@ @Mod.EventBusSubscriber(value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD, modid = Vivecraft.MODID) public class ClientEvents { @SubscribeEvent - public static void registerModels(ModelEvent.RegisterAdditional event) { - event.register(TelescopeTracker.scopeModel); - event.register(ClimbTracker.clawsModel); - event.register(ClientDataHolderVR.thirdPersonCameraModel); - event.register(ClientDataHolderVR.thirdPersonCameraDisplayModel); - event.register(CameraTracker.cameraModel); - event.register(CameraTracker.cameraDisplayModel); + public static void registerModels(ModelRegistryEvent event) { + ForgeModelBakery.addSpecialModel(TelescopeTracker.scopeModel); + ForgeModelBakery.addSpecialModel(ClimbTracker.clawsModel); + ForgeModelBakery.addSpecialModel(ClientDataHolderVR.thirdPersonCameraModel); + ForgeModelBakery.addSpecialModel(ClientDataHolderVR.thirdPersonCameraDisplayModel); + ForgeModelBakery.addSpecialModel(CameraTracker.cameraModel); + ForgeModelBakery.addSpecialModel(CameraTracker.cameraDisplayModel); } @SubscribeEvent diff --git a/gradle.properties b/gradle.properties index 8eebec4c7..c4755287c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,12 +7,12 @@ archives_base_name=vivecraft mod_version=1.1.7 maven_group=org.vivecraft -architectury_version=6.5.90 +architectury_version=4.11.93 fabric_loader_version=0.15.7 -fabric_api_version=0.77.0+1.19.2 +fabric_api_version=0.77.0+1.18.2 -forge_version=1.19.2-43.3.8 +forge_version=1.18.2-40.2.17