Moar 1.19 fixes (#7884)

This commit is contained in:
Noah van der Aa 2022-06-08 15:38:56 +02:00 committed by GitHub
parent 55d7f562b8
commit b1f5e70075
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
61 changed files with 182 additions and 224 deletions

View file

@ -6,18 +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..3b998ca5230dc03a7faf2b0d1d1731b442337346 100644
index e6917848029b1686e4e3a1a0eadac85eda92518d..91a5b46e5a7459494a49a85ba93dc0ced146b717 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -105,6 +105,7 @@ import net.minecraft.world.level.entity.EntityInLevelCallback;
import net.minecraft.world.level.gameevent.DynamicGameEventListener;
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.level.levelgen.Heightmap;
+import net.minecraft.world.level.levelgen.PositionalRandomFactory;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.PushReaction;
@@ -158,6 +159,38 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -158,6 +158,38 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return tag.contains("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
}
@ -42,7 +34,7 @@ index e6917848029b1686e4e3a1a0eadac85eda92518d..3b998ca5230dc03a7faf2b0d1d1731b4
+ }
+
+ @Override
+ public PositionalRandomFactory forkPositional() {
+ public net.minecraft.world.level.levelgen.PositionalRandomFactory forkPositional() {
+ return new net.minecraft.world.level.levelgen.LegacyRandomSource.LegacyPositionalRandomFactory(this.nextLong());
+ }
+
@ -56,7 +48,7 @@ index e6917848029b1686e4e3a1a0eadac85eda92518d..3b998ca5230dc03a7faf2b0d1d1731b4
private CraftEntity bukkitEntity;
public CraftEntity getBukkitEntity() {
@@ -345,7 +378,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -345,7 +377,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.bb = Entity.INITIAL_AABB;
this.stuckSpeedMultiplier = Vec3.ZERO;
this.nextStep = 1.0F;