77 lines
3.1 KiB
Diff
77 lines
3.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?=
|
|
<tsao-chi@the-lingo.org>
|
|
Date: Fri, 10 Apr 2020 15:47:15 +0800
|
|
Subject: [PATCH] Swaps the predicate order of collision
|
|
|
|
Original code by Akarin-project, licensed under GNU General Public License v3.0
|
|
You can find the original code on https://github.com/Akarin-project/Akarin
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index e0c91bc518168441fffa32f4c611a74800a8d2e2..05e521c01a62e800f177cb586609d7a3a51dacc6 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -1857,37 +1857,35 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
|
public void playerTouch(Player player) {}
|
|
|
|
public void push(Entity entity) {
|
|
- if (!this.isPassengerOfSameVehicle(entity)) {
|
|
- if (!entity.noPhysics && !this.noPhysics) {
|
|
- if (this.level.paperConfig.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper
|
|
- double d0 = entity.getX() - this.getX();
|
|
- double d1 = entity.getZ() - this.getZ();
|
|
- double d2 = Mth.absMax(d0, d1);
|
|
-
|
|
- if (d2 >= 0.009999999776482582D) {
|
|
- d2 = Math.sqrt(d2);
|
|
- d0 /= d2;
|
|
- d1 /= d2;
|
|
- double d3 = 1.0D / d2;
|
|
-
|
|
- if (d3 > 1.0D) {
|
|
- d3 = 1.0D;
|
|
- }
|
|
-
|
|
- d0 *= d3;
|
|
- d1 *= d3;
|
|
- d0 *= 0.05000000074505806D;
|
|
- d1 *= 0.05000000074505806D;
|
|
- if (!this.isVehicle()) {
|
|
- this.push(-d0, 0.0D, -d1);
|
|
- }
|
|
+ if (!entity.noPhysics && !this.noPhysics && !this.isPassengerOfSameVehicle(entity)) { // Akarin - Swap the predicate order of collision
|
|
+ if (this.level.paperConfig.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper
|
|
+ double d0 = entity.getX() - this.getX();
|
|
+ double d1 = entity.getZ() - this.getZ();
|
|
+ double d2 = Mth.absMax(d0, d1);
|
|
+
|
|
+ if (d2 >= 0.009999999776482582D) {
|
|
+ d2 = Math.sqrt(d2);
|
|
+ d0 /= d2;
|
|
+ d1 /= d2;
|
|
+ double d3 = 1.0D / d2;
|
|
+
|
|
+ if (d3 > 1.0D) {
|
|
+ d3 = 1.0D;
|
|
+ }
|
|
|
|
- if (!entity.isVehicle()) {
|
|
- entity.push(d0, 0.0D, d1);
|
|
- }
|
|
+ d0 *= d3;
|
|
+ d1 *= d3;
|
|
+ d0 *= 0.05000000074505806D;
|
|
+ d1 *= 0.05000000074505806D;
|
|
+ if (!this.isVehicle()) {
|
|
+ this.push(-d0, 0.0D, -d1);
|
|
}
|
|
|
|
+ if (!entity.isVehicle()) {
|
|
+ entity.push(d0, 0.0D, d1);
|
|
+ }
|
|
}
|
|
+
|
|
}
|
|
}
|
|
|