2020-08-20 17:04:08 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: JellySquid <jellysquid+atwork@protonmail.com>
|
|
|
|
Date: Thu, 20 Aug 2020 16:37:20 +0300
|
|
|
|
Subject: [PATCH] lithium VoxelShapesMixin
|
|
|
|
|
|
|
|
Original code by JellySquid, licensed under LGPLv3
|
|
|
|
you can find the original code on https://github.com/jellysquid3/lithium-fabric/ (Yarn mappings)
|
|
|
|
|
|
|
|
Co-authored-by: Ivan Pekov <ivan@mrivanplays.com>
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EnumAxisCycle.java b/src/main/java/net/minecraft/server/EnumAxisCycle.java
|
|
|
|
index 92ab79532d29341e8840341ff5ee8f5203cb4aad..bc7b9d0b4d9e3f7519bb013054eeec512e9342d7 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/EnumAxisCycle.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EnumAxisCycle.java
|
|
|
|
@@ -82,6 +82,7 @@ public enum EnumAxisCycle {
|
|
|
|
|
|
|
|
public abstract int a(int i, int j, int k, EnumDirection.EnumAxis enumdirection_enumaxis);
|
|
|
|
|
|
|
|
+ public final EnumDirection.EnumAxis cycle(EnumDirection.EnumAxis axis) { return a(axis); } // Yatopia - OBFHELPER
|
|
|
|
public abstract EnumDirection.EnumAxis a(EnumDirection.EnumAxis enumdirection_enumaxis);
|
|
|
|
|
|
|
|
public abstract EnumAxisCycle a();
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/VoxelShape.java b/src/main/java/net/minecraft/server/VoxelShape.java
|
2020-10-30 08:32:12 +01:00
|
|
|
index 98f9ded42264cb88cff701a85d22d99e203ef7cf..b94f08dcc911cd632a9c4fb93dcbc4d47aceca94 100644
|
2020-08-20 17:04:08 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/VoxelShape.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/VoxelShape.java
|
|
|
|
@@ -148,6 +148,7 @@ public abstract class VoxelShape {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ public final double calculateMaxDistance(EnumDirection.EnumAxis axis, AxisAlignedBB box, double movement) { return a(axis, box, movement); } // Yatopia - OBFHELPER
|
|
|
|
public double a(EnumDirection.EnumAxis enumdirection_enumaxis, AxisAlignedBB axisalignedbb, double d0) {
|
|
|
|
return this.a(EnumAxisCycle.a(enumdirection_enumaxis, EnumDirection.EnumAxis.X), axisalignedbb, d0);
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java
|
2020-11-07 08:02:33 +01:00
|
|
|
index 877ef81bd8285167ce11c116b8ad803fda63c6c9..1bf27c47c8fcc2fb0a712b7d10a8c50cea677926 100644
|
2020-08-20 17:04:08 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/VoxelShapes.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/VoxelShapes.java
|
2020-10-30 08:32:12 +01:00
|
|
|
@@ -279,6 +279,21 @@ public final class VoxelShapes {
|
2020-08-20 17:04:08 +02:00
|
|
|
return 0.0D;
|
|
|
|
} else {
|
|
|
|
EnumAxisCycle enumaxiscycle1 = enumaxiscycle.a();
|
|
|
|
+ // Yatopia start
|
|
|
|
+ if (d0 < 0 || enumaxiscycle1.cycle(EnumDirection.EnumAxis.Z) == EnumDirection.EnumAxis.Y) {
|
|
|
|
+ int x = MathHelper.floor((axisalignedbb.minX + axisalignedbb.maxX) / 2);
|
|
|
|
+ int y = MathHelper.f(axisalignedbb.minY) - 1;
|
|
|
|
+ int z = MathHelper.floor((axisalignedbb.minZ + axisalignedbb.maxZ) / 2);
|
|
|
|
+ BlockPosition pos = new BlockPosition(x, y, z);
|
|
|
|
+ IBlockData data = iworldreader.getTypeIfLoaded(pos);
|
|
|
|
+ if (data != null) {
|
|
|
|
+ d0 = data.getCollisionShape(iworldreader, pos, voxelshapecollision).calculateMaxDistance(EnumDirection.EnumAxis.Y, axisalignedbb.offset(-x, -y, -z), d0);
|
|
|
|
+ if (Math.abs(d0) < 1.0E-7D) {
|
|
|
|
+ return 0.0D;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // Yatopia end
|
|
|
|
EnumDirection.EnumAxis enumdirection_enumaxis = enumaxiscycle1.a(EnumDirection.EnumAxis.X);
|
|
|
|
EnumDirection.EnumAxis enumdirection_enumaxis1 = enumaxiscycle1.a(EnumDirection.EnumAxis.Y);
|
|
|
|
EnumDirection.EnumAxis enumdirection_enumaxis2 = enumaxiscycle1.a(EnumDirection.EnumAxis.Z);
|