papermc/CraftBukkit-Patches/0020-Faster-UUID-for-entities.patch

24 lines
1 KiB
Diff
Raw Normal View History

2014-04-18 23:15:23 +00:00
From 057734283eef7808469dd78e94ea86d4177b8c82 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 17 Mar 2013 19:02:50 +1100
Subject: [PATCH] Faster UUID for entities
It is overkill to create a new SecureRandom on each entity create and then use it to make a new Entity ID for every entity instance created. Instead we will just use a pseudo random UUID based off the random instance we already have.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
2014-04-18 17:08:19 +00:00
index 0b6e9cf..9179baa 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
2014-04-18 17:08:19 +00:00
@@ -142,7 +142,7 @@ public abstract class Entity {
this.random = new Random();
2013-07-02 03:03:56 +00:00
this.maxFireTicks = 1;
this.justCreated = true;
- this.uniqueID = UUID.randomUUID();
+ this.uniqueID = new UUID(random.nextLong(), random.nextLong()); // Spigot
2014-03-23 00:06:43 +00:00
this.as = EnumEntitySize.SIZE_2;
this.world = world;
this.setPosition(0.0D, 0.0D, 0.0D);
--
2014-04-18 17:08:19 +00:00
1.9.1