fix reobf issues around randomsource impls

prolly should be fixed in a mapping patch instead but I don't wanna
This commit is contained in:
MiniDigger | Martin 2022-06-08 17:43:25 +02:00
parent 02804a49a2
commit 8399e10c43
39 changed files with 177 additions and 110 deletions

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Use a Shared Random for Entities
Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index e6917848029b1686e4e3a1a0eadac85eda92518d..91a5b46e5a7459494a49a85ba93dc0ced146b717 100644
index e6917848029b1686e4e3a1a0eadac85eda92518d..3e0f58a928931fd1b3ee32f9dadf65288d8798d6 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -158,6 +158,38 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -158,6 +158,74 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return tag.contains("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
}
@ -42,13 +42,49 @@ index e6917848029b1686e4e3a1a0eadac85eda92518d..91a5b46e5a7459494a49a85ba93dc0ce
+ public int nextInt(int origin, int bound) {
+ return RandomSource.super.nextInt(origin, bound);
+ }
+
+ // these below are added to fix reobf issues that I don't wanna deal with right now
+ @Override
+ public long nextLong() {
+ return super.nextInt();
+ }
+
+ @Override
+ public int nextInt() {
+ return super.nextInt();
+ }
+
+ @Override
+ public int nextInt(int bound) {
+ return super.nextInt(bound);
+ }
+
+ @Override
+ public boolean nextBoolean() {
+ return super.nextBoolean();
+ }
+
+ @Override
+ public float nextFloat() {
+ return super.nextFloat();
+ }
+
+ @Override
+ public double nextDouble() {
+ return super.nextDouble();
+ }
+
+ @Override
+ public double nextGaussian() {
+ return super.nextGaussian();
+ }
+ }
+ // Paper end
+
private CraftEntity bukkitEntity;
public CraftEntity getBukkitEntity() {
@@ -345,7 +377,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -345,7 +413,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.bb = Entity.INITIAL_AABB;
this.stuckSpeedMultiplier = Vec3.ZERO;
this.nextStep = 1.0F;