Use a Shared Random for Entities

Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created.
This commit is contained in:
Aikar
2016-03-22 00:33:47 -04:00
parent becb30e9e6
commit d989bc5d17
2 changed files with 196 additions and 104 deletions

View File

@@ -0,0 +1,11 @@
--- a/net/minecraft/world/entity/animal/Squid.java
+++ b/net/minecraft/world/entity/animal/Squid.java
@@ -46,7 +46,7 @@
public Squid(EntityType<? extends Squid> type, Level world) {
super(type, world);
- this.random.setSeed((long)this.getId());
+ //this.random.setSeed((long)this.getId()); // Paper - Share random for entities to make them more random
this.tentacleSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
}