Skip to content

Commit

Permalink
update to 1.20.5
Browse files Browse the repository at this point in the history
  • Loading branch information
fayer3 committed Apr 27, 2024
1 parent d9687fa commit b4e427a
Show file tree
Hide file tree
Showing 78 changed files with 846 additions and 1,381 deletions.
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.5-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false
id 'io.github.juuxel.loom-quiltflower' version '1.8.0' apply false
}

Expand All @@ -27,15 +27,15 @@ subprojects {
mappings loom.officialMojangMappings()
// The following line declares the yarn mappings you may select this one as well.
// mappings "net.fabricmc:yarn:1.18.2+build.4:v2"
implementation("org.lwjgl:lwjgl-openvr:3.3.2")
implementation("org.lwjgl:lwjgl-openvr:3.3.2:natives-linux")
implementation("org.lwjgl:lwjgl-openvr:3.3.2:natives-macos")
implementation("org.lwjgl:lwjgl-openvr:3.3.2:natives-windows")
implementation("org.lwjgl:lwjgl-openvr:3.3.3")
implementation("org.lwjgl:lwjgl-openvr:3.3.3:natives-linux")
implementation("org.lwjgl:lwjgl-openvr:3.3.3:natives-macos")
implementation("org.lwjgl:lwjgl-openvr:3.3.3:natives-windows")
}

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.release = 17
options.release = 21
}

java {
Expand Down
6 changes: 3 additions & 3 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ dependencies {
modApi("dev.architectury:architectury-fabric:${rootProject.architectury_version}") { exclude group: "net.fabricmc" exclude group: "net.fabricmc.fabric-api" }

// for sodium compat
modCompileOnly "maven.modrinth:sodium:mc1.20.4-0.5.8"
modCompileOnly "maven.modrinth:sodium:mc1.20.5-0.5.8"

// for iris compat
modCompileOnly "maven.modrinth:iris:1.7.0+1.20.4"
modCompileOnly "maven.modrinth:iris:1.7.0+1.20.5"

// for REI compat
modCompileOnly("me.shedaniel:RoughlyEnoughItems-fabric:14.0.688") { exclude group: "net.fabricmc" exclude group: "net.fabricmc.fabric-api" exclude group: "dev.architectury" }
Expand All @@ -27,7 +27,7 @@ dependencies {
modApi("com.github.Virtuoel:Pehkui:3.7.12") { exclude group: "net.fabricmc" exclude group: "net.fabricmc.fabric-api" }

// other mods
modCompileOnly "maven.modrinth:dynamic-fps:3.4.1"
modCompileOnly "maven.modrinth:dynamic-fps:3.4.3"
// modCompileOnly("com.simibubi.create:create-fabric-1.19.2:0.5.0.i-969+1.19.2")
// modCompileOnly "maven.modrinth:lithium:mc1.20.4-0.12.1"
// modCompileOnly "maven.modrinth:indium:1.0.30+mc1.20.4"
Expand Down
6 changes: 1 addition & 5 deletions common/src/main/java/org/vivecraft/MixinConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import org.spongepowered.asm.service.MixinService;
import org.vivecraft.client.Xplat;
import org.vivecraft.client_vr.settings.VRSettings;
import org.vivecraft.mod_compat_vr.iris.mixin.coderbot.IrisChunkProgramOverridesMixinSodium_0_4_11;
import org.vivecraft.mod_compat_vr.iris.mixin.coderbot.IrisChunkProgramOverridesMixinSodium_0_4_9;
import org.vivecraft.mod_compat_vr.iris.mixin.irisshaders.IrisChunkProgramOverridesMixin;
import org.vivecraft.mod_compat_vr.iris.mixin.irisshaders.IrisChunkProgramOverridesMixinSodium_0_5_8;
import org.vivecraft.mod_compat_vr.iris.mixin.irisshaders.IrisChunkProgramOverridesMixinSodium_0_6;
Expand Down Expand Up @@ -74,9 +72,7 @@ public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {

String neededClass = "";
// apply iris sodium version specific mixins only when the right class is there
if (mixinClassName.equals(IrisChunkProgramOverridesMixinSodium_0_4_9.class.getName())) {
neededClass = "me.jellysquid.mods.sodium.client.render.vertex.type.ChunkVertexType";
} else if (mixinClassName.equals(IrisChunkProgramOverridesMixinSodium_0_4_11.class.getName()) || mixinClassName.equals(IrisChunkProgramOverridesMixinSodium_0_5_8.class.getName())
if (mixinClassName.equals(IrisChunkProgramOverridesMixinSodium_0_5_8.class.getName())
) {
neededClass = "me.jellysquid.mods.sodium.client.render.chunk.vertex.format.ChunkVertexType";
} else if (mixinClassName.equals(IrisChunkProgramOverridesMixinSodium_0_6.class.getName())) {
Expand Down
7 changes: 0 additions & 7 deletions common/src/main/java/org/vivecraft/client/Xplat.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeSpecialEffects;
Expand Down Expand Up @@ -89,11 +87,6 @@ static BiomeSpecialEffects getBiomeEffects(Biome biome) {
return null;
}

@ExpectPlatform
static double getItemEntityReach(double baseRange, ItemStack itemStack, EquipmentSlot slot) {
return 0;
}

@ExpectPlatform
static void addNetworkChannel(ClientPacketListener listener, ResourceLocation resourceLocation) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void onClose() {

@Override
public void renderBackground(GuiGraphics guiGraphics, int i, int j, float f) {
this.renderDirtBackground(guiGraphics);
this.renderMenuBackground(guiGraphics);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ public void setModelProperties(AbstractClientPlayer pClientPlayer) {
}

@Override
protected void setupRotations(AbstractClientPlayer pEntityLiving, PoseStack pMatrixStack, float pAgeInTicks, float pRotationYaw, float pPartialTicks) {
protected void setupRotations(AbstractClientPlayer pEntityLiving, PoseStack pMatrixStack, float pAgeInTicks, float pRotationYaw, float pPartialTicks, float entityScale) {
UUID uuid = pEntityLiving.getUUID();
if (ClientDataHolderVR.getInstance().currentPass != RenderPass.GUI && VRPlayersClient.getInstance().isTracked(uuid)) {
VRPlayersClient.RotInfo playermodelcontroller$rotinfo = VRPlayersClient.getInstance().getRotationsForPlayer(uuid);
pRotationYaw = (float) Math.toDegrees(playermodelcontroller$rotinfo.getBodyYawRadians());
}

//vanilla below here
super.setupRotations(pEntityLiving, pMatrixStack, pAgeInTicks, pRotationYaw, pPartialTicks);
super.setupRotations(pEntityLiving, pMatrixStack, pAgeInTicks, pRotationYaw, pPartialTicks, entityScale);
}
}
3 changes: 3 additions & 0 deletions common/src/main/java/org/vivecraft/client_vr/ItemTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public class ItemTags {

public final static TagKey<Item> VIVECRAFT_HOES = tag("hoes");

public final static TagKey<Item> VIVECRAFT_MACES = tag("maces");


public final static TagKey<Item> VIVECRAFT_MAPS = tag("maps");

public final static TagKey<Item> VIVECRAFT_SCYTHES = tag("scythes");
Expand Down
21 changes: 19 additions & 2 deletions common/src/main/java/org/vivecraft/client_vr/MethodHolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.*;
import org.joml.AxisAngle4f;
import org.joml.Matrix4f;
import org.joml.Quaternionf;
import org.lwjgl.glfw.GLFW;
import org.spongepowered.asm.mixin.Unique;
import org.vivecraft.client_vr.provider.InputSimulator;

public abstract class MethodHolder {
Expand All @@ -22,11 +25,25 @@ public static void notifyMirror(String text, boolean clear, int lengthMs) {
clientDataHolderVR.mirrorNotifyClear = clear;
}

public static void rotateDeg(PoseStack pose, float angle, float x, float y, float z) {
pose.mulPose(new Quaternionf(new AxisAngle4f(angle * 0.017453292F, x, y, z)));
public static void rotateDeg(Matrix4f pose, float angle, float x, float y, float z) {
pose.rotate(new Quaternionf(new AxisAngle4f(angle * 0.017453292F, x, y, z)));
}

public static void rotateDegXp(PoseStack matrix, int i) {
matrix.mulPose(Axis.XP.rotationDegrees(i));
}

public static boolean isInMenuRoom() {
return willBeInMenuRoom(Minecraft.getInstance().screen);
}

public static boolean willBeInMenuRoom(Screen newScreen) {
return Minecraft.getInstance().level == null ||
newScreen instanceof WinScreen ||
newScreen instanceof ReceivingLevelScreen ||
newScreen instanceof ProgressScreen ||
newScreen instanceof GenericMessageScreen ||
ClientDataHolderVR.getInstance().integratedServerLaunchInProgress ||
Minecraft.getInstance().getOverlay() != null;
}
}
2 changes: 1 addition & 1 deletion common/src/main/java/org/vivecraft/client_vr/VRState.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static void initializeVR() {
// make sure the lwjgl version is the right one
// TODO: move this into the init, does mean all callocs need to be done later
// check that the right lwjgl version is loaded that we ship the openvr part of
if (!Version.getVersion().startsWith("3.3.2")) {
if (!Version.getVersion().startsWith("3.3.3")) {
throw new RenderConfigException("VR Init Error", Component.translatable("vivecraft.messages.rendersetupfailed", I18n.get("vivecraft.messages.invalidlwjgl", Version.getVersion(), "3.3.2"), "OpenVR_LWJGL"));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.vivecraft.client_vr.extensions;

import net.minecraft.client.gui.screens.Screen;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.phys.Vec3;
import org.joml.Matrix4f;
Expand Down Expand Up @@ -29,10 +28,6 @@ public interface GameRendererExtension {

Vec3 vivecraft$getRvePos(float partialTicks);

boolean vivecraft$isInMenuRoom();

boolean vivecraft$willBeInMenuRoom(Screen newScreen);

Vec3 vivecraft$getCrossVec();

void vivecraft$resetProjectionMatrix(float partialTicks);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.vivecraft.client.network.ClientNetworking;
import org.vivecraft.client_vr.ClientDataHolderVR;
import org.vivecraft.client_vr.ItemTags;
import org.vivecraft.client_vr.MethodHolder;
import org.vivecraft.client_vr.VRData;
import org.vivecraft.client_vr.extensions.GameRendererExtension;
import org.vivecraft.client_vr.extensions.PlayerExtension;
Expand Down Expand Up @@ -112,7 +113,7 @@ public void preTick() {

float f = worldScaleOverride.getFloat();

if (((GameRendererExtension) this.mc.gameRenderer).vivecraft$isInMenuRoom()) {
if (MethodHolder.isInMenuRoom()) {
this.worldScale = 1.0F;
} else {
if (this.wfCount > 0 && !this.mc.isPaused()) {
Expand Down Expand Up @@ -182,7 +183,7 @@ public void preTick() {
}
}

if (this.dh.vrSettings.seated && !((GameRendererExtension) this.mc.gameRenderer).vivecraft$isInMenuRoom()) {
if (this.dh.vrSettings.seated && !MethodHolder.isInMenuRoom()) {
this.dh.vrSettings.worldRotation = this.dh.vr.seatedRot;
}
}
Expand Down Expand Up @@ -392,7 +393,7 @@ public void doPlayerMoveInRoom(LocalPlayer player) {
|| (dataholder.climbTracker.isGrabbingLadder() && dataholder.vrSettings.realisticClimbEnabled)) && player.fallDistance == 0.0F) {

// is the player significantly inside a block?
float climbShrink = player.getDimensions(player.getPose()).width * 0.45F;
float climbShrink = player.getDimensions(player.getPose()).width() * 0.45F;
double shrunkClimbHalfWidth = playerHalfWidth - climbShrink;

AABB bbClimb = new AABB(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.joml.Vector2f;
import org.vivecraft.client.utils.Utils;
import org.vivecraft.client_vr.ClientDataHolderVR;
import org.vivecraft.client_vr.MethodHolder;
import org.vivecraft.client_vr.VRData;
import org.vivecraft.client_vr.VRState;
import org.vivecraft.client_vr.extensions.GameRendererExtension;
Expand Down Expand Up @@ -347,7 +348,7 @@ public static void onScreenChanged(Screen previousGuiScreen, Screen newScreen, b
}

// check if the new screen is meant to show the MenuRoom, instead of the current screen
boolean staticScreen = mc.gameRenderer == null || (((GameRendererExtension) mc.gameRenderer).vivecraft$willBeInMenuRoom(newScreen));
boolean staticScreen = MethodHolder.willBeInMenuRoom(newScreen);
staticScreen = staticScreen & (!dh.vrSettings.seated && !dh.vrSettings.menuAlwaysFollowFace);

if (staticScreen) {
Expand Down Expand Up @@ -427,7 +428,7 @@ public static void onScreenChanged(Screen previousGuiScreen, Screen newScreen, b
}
}

public static Vec3 applyGUIModelView(RenderPass currentPass, PoseStack pMatrixStack) {
public static Vec3 applyGUIModelView(RenderPass currentPass, org.joml.Matrix4f pMatrixStack) {
mc.getProfiler().push("applyGUIModelView");
Vec3 vec3 = RenderHelper.getSmoothCameraPosition(currentPass, dh.vrPlayer.vrdata_world_render);

Expand Down Expand Up @@ -510,7 +511,7 @@ public static Vec3 applyGUIModelView(RenderPass currentPass, PoseStack pMatrixSt
guirot = Matrix4f.multiply(matrix4f4, guirot);
}

if ((dh.vrSettings.seated || dh.vrSettings.menuAlwaysFollowFace) && ((GameRendererExtension) mc.gameRenderer).vivecraft$isInMenuRoom()) {
if ((dh.vrSettings.seated || dh.vrSettings.menuAlwaysFollowFace) && MethodHolder.isInMenuRoom()) {
scale = 2.0F;
Vec3 vec35 = new Vec3(0.0D, 0.0D, 0.0D);

Expand All @@ -528,7 +529,7 @@ public static Vec3 applyGUIModelView(RenderPass currentPass, PoseStack pMatrixSt
f1 = f1 / (float) dh.vr.hmdYawSamples.size();
f1 = (float) Math.toRadians(f1);
Vec3 vec38 = new Vec3(-Math.sin(f1), 0.0D, Math.cos(f1));
float f4 = ((GameRendererExtension) mc.gameRenderer).vivecraft$isInMenuRoom() ? 2.5F * dh.vrPlayer.vrdata_world_render.worldScale : dh.vrSettings.hudDistance;
float f4 = MethodHolder.isInMenuRoom() ? 2.5F * dh.vrPlayer.vrdata_world_render.worldScale : dh.vrSettings.hudDistance;
Vec3 vec39 = vec35.add(new Vec3(vec38.x * (double) f4, vec38.y * (double) f4, vec38.z * (double) f4));
Vec3 vec310 = new Vec3(vec39.x, vec39.y, vec39.z);
Matrix4f matrix4f3 = Matrix4f.rotationY((float) Math.PI - f1);
Expand All @@ -553,9 +554,9 @@ public static Vec3 applyGUIModelView(RenderPass currentPass, PoseStack pMatrixSt
}

Vec3 vec36 = guipos.subtract(vec3);
pMatrixStack.translate(vec36.x, vec36.y, vec36.z);
pMatrixStack.mulPoseMatrix(guirot.toMCMatrix());
pMatrixStack.translate(guilocal.x, guilocal.y, guilocal.z);
pMatrixStack.translate((float) vec36.x, (float) vec36.y, (float) vec36.z);
pMatrixStack.mul(guirot.toMCMatrix());
pMatrixStack.translate((float) guilocal.x, (float) guilocal.y, (float) guilocal.z);
float f2 = scale * dh.vrPlayer.vrdata_world_render.worldScale;
pMatrixStack.scale(f2, f2, f2);
guiScaleApplied = f2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.core.BlockPos;
import net.minecraft.core.component.DataComponents;
import net.minecraft.network.chat.contents.TranslatableContents;
import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket;
import net.minecraft.server.level.ServerPlayer;
Expand Down Expand Up @@ -79,11 +80,11 @@ public boolean wasGrabbingLadder(int controller) {
public boolean isClaws(ItemStack i) {
if (i.isEmpty()) {
return false;
} else if (!i.hasCustomHoverName()) {
} else if (!i.has(DataComponents.CUSTOM_NAME)) {
return false;
} else if (i.getItem() != Items.SHEARS) {
return false;
} else if (!i.hasTag() || !i.getTag().getBoolean("Unbreakable")) {
} else if (!i.has(DataComponents.UNBREAKABLE)) {
return false;
} else {
return i.getHoverName().getContents() instanceof TranslatableContents && ((TranslatableContents) i.getHoverName().getContents()).getKey().equals("vivecraft.item.climbclaws") || i.getHoverName().getString().equals("Climb Claws");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.core.component.DataComponents;
import net.minecraft.network.chat.contents.TranslatableContents;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.ItemStack;
Expand Down Expand Up @@ -166,11 +167,11 @@ public void doProcess(LocalPlayer player) {
public boolean isBoots(ItemStack i) {
if (i.isEmpty()) {
return false;
} else if (!i.hasCustomHoverName()) {
} else if (!i.has(DataComponents.CUSTOM_NAME)) {
return false;
} else if (i.getItem() != Items.LEATHER_BOOTS) {
return false;
} else if (!i.hasTag() || !i.getTag().getBoolean("Unbreakable")) {
} else if (!i.has(DataComponents.UNBREAKABLE)) {
return false;
} else {
return i.getHoverName().getContents() instanceof TranslatableContents && ((TranslatableContents) i.getHoverName().getContents()).getKey().equals("vivecraft.item.jumpboots") || i.getHoverName().getString().equals("Jump Boots");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ public void doProcess(LocalPlayer player) {
float weaponLength;
float entityReachAdd;

double playerEntityReach = Xplat.getItemEntityReach(3.0, itemstack, c == 0 ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND);
// TODO 1.20.5 check
double playerEntityReach = player.entityInteractionRange();
if (Xplat.isModLoaded("bettercombat")) {
// better combat overrides the player reach
playerEntityReach = BetterCombatHelper.getItemRange(playerEntityReach, itemstack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.core.component.DataComponents;
import net.minecraft.network.chat.contents.TranslatableContents;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
Expand Down Expand Up @@ -39,11 +40,11 @@ public static boolean isTelescope(ItemStack i) {
public static boolean isLegacyTelescope(ItemStack i) {
if (i.isEmpty()) {
return false;
} else if (!i.hasCustomHoverName()) {
} else if (!i.has(DataComponents.CUSTOM_NAME)) {
return false;
} else if (i.getItem() != Items.ENDER_EYE) {
return false;
} else if (!i.hasTag() || !i.getTag().getBoolean("Unbreakable")) {
} else if (!i.has(DataComponents.UNBREAKABLE)) {
return false;
} else {
return i.getHoverName().getContents() instanceof TranslatableContents && ((TranslatableContents) i.getHoverName().getContents()).getKey().equals("vivecraft.item.telescope") || i.getHoverName().getString().equals("Eye of the Farseer");
Expand Down
Loading

0 comments on commit b4e427a

Please sign in to comment.