Skip to content

Commit

Permalink
Use ObjectArrayList for collisions
Browse files Browse the repository at this point in the history
  • Loading branch information
Samsuik committed Oct 24, 2023
1 parent d115dff commit ae0a0c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 66ceff11a03fb562ce78511f3ca5f8203284c60d Mon Sep 17 00:00:00 2001
From 825e5830ed1deae7609afa687322c4be18b054b2 Mon Sep 17 00:00:00 2001
From: Samsuik <40902469+Samsuik@users.noreply.github.com>
Date: Sat, 17 Jun 2023 15:47:14 +0100
Subject: [PATCH] Rewrite and Optimise Block Collisions
Expand Down Expand Up @@ -102,7 +102,7 @@ index 431097ec3..ab5fe46dc 100644
if (axisalignedbb.e > this.b && axisalignedbb.b < this.e && axisalignedbb.f > this.c && axisalignedbb.c < this.f) {
double d1;
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index 7233a4939..e784aa551 100644
index 6b371c677..8cc17378e 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -297,6 +297,23 @@ public class Block {
Expand Down Expand Up @@ -755,7 +755,7 @@ index 88131b507..5deed1646 100644
}

diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 2f7ccceef..83e8eb1fa 100644
index 2f7ccceef..0baab1f19 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -663,6 +663,116 @@ public abstract class Entity implements ICommandListener {
Expand Down Expand Up @@ -792,7 +792,7 @@ index 2f7ccceef..83e8eb1fa 100644
+ boolean patchedEastWest = world.tacoSpigotConfig.fixEastWest && Math.abs(moveX) > Math.abs(moveZ);
+
+ AxisAlignedBB boundingBox = getBoundingBox();
+ List<AxisAlignedBB> shapes = new java.util.ArrayList<>(4);
+ List<AxisAlignedBB> shapes = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>(2);
+
+ if (moveY != 0.0) {
+ world.testShapesOnY(shapes, boundingBox, boundingBox.a(0.0, moveY, 0.0), this, moveY);
Expand Down
6 changes: 3 additions & 3 deletions patches/server/0090-Add-EastWestPatchEvent.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
From 29e8730501f2ed96909951814ca512bbba6e7a3d Mon Sep 17 00:00:00 2001
From bb3fc2b63ccfef6e353747144a8a972c15a7a47a Mon Sep 17 00:00:00 2001
From: Samsuik <40902469+Samsuik@users.noreply.github.com>
Date: Sat, 8 Jul 2023 21:58:24 +0100
Subject: [PATCH] Add EastWestPatchEvent


diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 12899a603..c894ffbb2 100644
index 6599c0142..574de6c75 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -283,6 +283,7 @@ public abstract class Entity implements ICommandListener {
Expand Down Expand Up @@ -39,7 +39,7 @@ index 12899a603..c894ffbb2 100644
+ boolean patchedEastWest = eastWestPatched && Math.abs(moveX) > Math.abs(moveZ); // Blossom

AxisAlignedBB boundingBox = getBoundingBox();
List<AxisAlignedBB> shapes = new java.util.ArrayList<>(4);
List<AxisAlignedBB> shapes = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>(2);
@@ -888,7 +897,7 @@ public abstract class Entity implements ICommandListener {
AxisAlignedBB axisalignedbb2;
Iterator iterator1;
Expand Down

0 comments on commit ae0a0c4

Please sign in to comment.