13
0
geforkt von Mirrors/Paper

Correct patches

Dieser Commit ist enthalten in:
Spottedleaf 2019-05-05 04:32:20 -07:00
Ursprung 8cfdd708e9
Commit 70e4947867
17 geänderte Dateien mit 7 neuen und 5841 gelöschten Zeilen

Datei anzeigen

@ -1,182 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sat, 22 Sep 2018 00:33:08 -0500
Subject: [PATCH] Add LivingEntity#getTargetEntity
diff --git a/src/main/java/net/minecraft/server/AxisAlignedBB.java b/src/main/java/net/minecraft/server/AxisAlignedBB.java
index 1c0b783e8e..dad1ff7372 100644
--- a/src/main/java/net/minecraft/server/AxisAlignedBB.java
+++ b/src/main/java/net/minecraft/server/AxisAlignedBB.java
@@ -0,0 +0,0 @@ public class AxisAlignedBB {
return new AxisAlignedBB(d3, d4, d5, d6, d7, d8);
}
+ public AxisAlignedBB expand(double x, double y, double z) { return b(x, y, z); } // Paper - OBFHELPER
public AxisAlignedBB b(double d0, double d1, double d2) {
double d3 = this.minX;
double d4 = this.minY;
@@ -0,0 +0,0 @@ public class AxisAlignedBB {
return new AxisAlignedBB(d3, d4, d5, d6, d7, d8);
}
+ // Paper start
+ public AxisAlignedBB grow(double d0) {
+ return grow(d0, d0, d0);
+ }
+ // Paper end
+
public AxisAlignedBB grow(double d0, double d1, double d2) {
double d3 = this.minX - d0;
double d4 = this.minY - d1;
@@ -0,0 +0,0 @@ public class AxisAlignedBB {
return this.minX < d3 && this.maxX > d0 && this.minY < d4 && this.maxY > d1 && this.minZ < d5 && this.maxZ > d2;
}
+ public boolean contains(Vec3D vec3d) { return b(vec3d); } // Paper - OBFHELPER
public boolean b(Vec3D vec3d) {
return this.e(vec3d.x, vec3d.y, vec3d.z);
}
@@ -0,0 +0,0 @@ public class AxisAlignedBB {
return this.g(-d0);
}
+ public MovingObjectPosition calculateIntercept(Vec3D vec3d, Vec3D vec3d1) { return b(vec3d, vec3d1); } // Paper - OBFHELPER
@Nullable
public MovingObjectPosition b(Vec3D vec3d, Vec3D vec3d1) {
return this.a(vec3d, vec3d1, (BlockPosition) null);
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 3db1b6bb1b..de45e3c7a8 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return new Vec3D((double) (f5 * f6), (double) (-f7), (double) (f4 * f6));
}
+ public Vec3D getEyePosition(float partialTicks) { return i(partialTicks); } // Paper - OBFHELPER
public Vec3D i(float f) {
if (f == 1.0F) {
return new Vec3D(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ);
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return this.bP().size() < 1;
}
+ public float getCollisionBorderSize() { return aM(); } // Paper - OBFHELPER
public float aM() {
return 0.0F;
}
+ public Vec3D getLookVec() { return aN(); } // Paper - OBFHELPER
public Vec3D aN() {
return this.d(this.pitch, this.yaw);
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 3d1cdd6271..14f1029687 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -0,0 +0,0 @@ package net.minecraft.server;
import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent;
import com.google.common.base.Objects;
import com.google.common.collect.Maps;
+
+import java.util.Arrays;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
// CraftBukkit start
import java.util.ArrayList;
+import java.util.stream.Collectors;
+
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import org.bukkit.Location;
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
return world.rayTrace(start, end, fluidCollisionOption);
}
+ public MovingObjectPosition getTargetEntity(int maxDistance) {
+ if (maxDistance < 1 || maxDistance > 120) {
+ throw new IllegalArgumentException("maxDistance must be between 1-120");
+ }
+
+ Vec3D start = getEyePosition(1.0F);
+ Vec3D direction = getLookVec();
+ Vec3D end = start.add(direction.x * maxDistance, direction.y * maxDistance, direction.z * maxDistance);
+
+ List<Entity> entityList = world.getEntities(this, getBoundingBox().expand(direction.x * maxDistance, direction.y * maxDistance, direction.z * maxDistance).grow(1.0D, 1.0D, 1.0D), IEntitySelector.notSpectator().and(Entity::isInteractable));
+
+ double distance = 0.0D;
+ MovingObjectPosition rayTraceResult = null;
+
+ for (Entity entity : entityList) {
+ AxisAlignedBB aabb = entity.getBoundingBox().grow((double) entity.getCollisionBorderSize());
+ MovingObjectPosition rayTrace = aabb.calculateIntercept(start, end);
+
+ if (rayTrace != null) {
+ double distanceTo = start.distanceSquared(rayTrace.pos);
+ if (distanceTo < distance || distance == 0.0D) {
+ rayTraceResult = new MovingObjectPosition(entity, rayTrace.pos);
+ distance = distanceTo;
+ }
+ }
+ }
+
+ return rayTraceResult;
+ }
+
public int shieldBlockingDelay = world.paperConfig.shieldBlockingDelay;
public int getShieldBlockingDelay() {
diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java
index f6916fd455..71f08d53c7 100644
--- a/src/main/java/net/minecraft/server/IEntitySelector.java
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java
@@ -0,0 +0,0 @@ public final class IEntitySelector {
public static final Predicate<Entity> e = (entity) -> {
return !(entity instanceof EntityHuman) || !((EntityHuman) entity).isSpectator() && !((EntityHuman) entity).u();
};
+ public static Predicate<Entity> notSpectator() { return f; } // Paper - OBFHELPER
public static final Predicate<Entity> f = (entity) -> {
return !(entity instanceof EntityHuman) || !((EntityHuman) entity).isSpectator();
};
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index eeab59379a..d6a4bc64ae 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
net.minecraft.server.MovingObjectPosition rayTrace = getHandle().getRayTrace(maxDistance, net.minecraft.server.MCUtil.getNMSFluidCollisionOption(fluidMode));
return rayTrace == null ? null : new com.destroystokyo.paper.block.TargetBlockInfo(org.bukkit.craftbukkit.block.CraftBlock.at(getHandle().world, rayTrace.getBlockPosition()), net.minecraft.server.MCUtil.toBukkitBlockFace(rayTrace.direction));
}
+
+ public Entity getTargetEntity(int maxDistance, boolean ignoreBlocks) {
+ net.minecraft.server.MovingObjectPosition rayTrace = rayTraceEntity(maxDistance, ignoreBlocks);
+ return rayTrace == null ? null : rayTrace.entity.getBukkitEntity();
+ }
+
+ public com.destroystokyo.paper.entity.TargetEntityInfo getTargetEntityInfo(int maxDistance, boolean ignoreBlocks) {
+ net.minecraft.server.MovingObjectPosition rayTrace = rayTraceEntity(maxDistance, ignoreBlocks);
+ return rayTrace == null ? null : new com.destroystokyo.paper.entity.TargetEntityInfo(rayTrace.entity.getBukkitEntity(), new org.bukkit.util.Vector(rayTrace.pos.x, rayTrace.pos.y, rayTrace.pos.z));
+ }
+
+ public net.minecraft.server.MovingObjectPosition rayTraceEntity(int maxDistance, boolean ignoreBlocks) {
+ net.minecraft.server.MovingObjectPosition rayTrace = getHandle().getTargetEntity(maxDistance);
+ if (rayTrace == null) {
+ return null;
+ }
+ if (!ignoreBlocks) {
+ net.minecraft.server.MovingObjectPosition rayTraceBlocks = getHandle().getRayTrace(maxDistance, net.minecraft.server.FluidCollisionOption.NEVER);
+ if (rayTraceBlocks != null) {
+ net.minecraft.server.Vec3D eye = getHandle().getEyePosition(1.0F);
+ if (eye.distanceSquared(rayTraceBlocks.pos) <= eye.distanceSquared(rayTrace.pos)) {
+ return null;
+ }
+ }
+ }
+ return rayTrace;
+ }
// Paper end
public List<Block> getLastTwoTargetBlocks(Set<Material> transparent, int maxDistance) {
--

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -26,7 +26,7 @@ index 4b7aefb7a..9e568d5d1 100644
if (nbttagcompound.hasKeyOfType("TrackOutput", 1)) {
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 03e0e9e26..c9aa5ae16 100644
index ef7f0213b..b4fd3f0dc 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke

Datei anzeigen

@ -1,33 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Wed, 3 Oct 2018 19:04:53 +0100
Subject: [PATCH] Fix FileIOThread concurrency issues
FileIOThread was using two volatile counters in order to track if
any pending work was in the queue, this causes potential concurrency
issues when this counter is updated from multiple threads, potentially
causing these counters to desync due to the unsafe volatile update
diff --git a/src/main/java/net/minecraft/server/FileIOThread.java b/src/main/java/net/minecraft/server/FileIOThread.java
index 3c688f546c..570624600d 100644
--- a/src/main/java/net/minecraft/server/FileIOThread.java
+++ b/src/main/java/net/minecraft/server/FileIOThread.java
@@ -0,0 +0,0 @@ public class FileIOThread implements Runnable {
private static final Logger a = LogManager.getLogger();
private static final FileIOThread b = new FileIOThread();
- private final List<IAsyncChunkSaver> c = Collections.synchronizedList(Lists.newArrayList());
+ private final List<IAsyncChunkSaver> c = Collections.synchronizedList(Lists.newArrayList()); private List<IAsyncChunkSaver> getThreadedIOQueue() { return c; } // Paper - OBFHELPER
private volatile long d;
private volatile long e;
private volatile boolean f;
@@ -0,0 +0,0 @@ public class FileIOThread implements Runnable {
public void b() throws InterruptedException {
this.f = true;
- while (this.d != this.e) {
+ while(!this.getThreadedIOQueue().isEmpty()) { // Paper - check actual list size
Thread.sleep(10L);
}
--

Datei anzeigen

@ -1,64 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 29 Sep 2018 01:18:16 -0400
Subject: [PATCH] Fix Sending Chunks to Client
Vanilla has some screwy logic that doesn't send a chunk until
it has been post processed. This is an issue as post processing
doesn't occur until all neighbor chunks have been loaded.
This can reduce view distance while generating terrain, but also
cause bugs where chunks are never sent to the client.
This fix always sends chunks to the client, and simply updates
the client anytime post processing is triggered with the new chunk data.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 0d51c1baeb..46804203fe 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
}
public boolean isReady() {
- return this.C.a(ChunkStatus.POSTPROCESSED);
+ return true; // Paper - Always send chunks
}
public boolean v() {
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
this.h.clear();
this.a(ChunkStatus.POSTPROCESSED);
this.m.a(this);
+ // Paper start - resend chunk after post process
+ PlayerChunk playerChunk = ((WorldServer) world).getPlayerChunkMap().getChunk(locX, locZ);
+ if (playerChunk != null) {
+ playerChunk.done = false;
+ playerChunk.sendAll();
+ }
+ // Paper end
}
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index e4cf8548d3..ac5d158093 100644
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
@@ -0,0 +0,0 @@ public class PlayerChunk {
private int dirtyCount;
private int h;
private long i;
- private boolean done;
+ boolean done; // Paper - package-private
boolean chunkExists; // Paper
// Paper start
PaperAsyncChunkProvider.CancellableChunkRequest chunkRequest;
@@ -0,0 +0,0 @@ public class PlayerChunk {
}
}
+ public boolean sendAll() { return b(); } // Paper - OBFHELPER
public boolean b() {
if (this.done) {
return true;
--

Datei anzeigen

@ -1,42 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 28 Sep 2018 21:49:53 -0400
Subject: [PATCH] Fix issues with entity loss due to unloaded chunks
Vanilla has risk of losing entities by causing them to be
removed from all chunks if they try to move into an unloaded chunk.
This pretty much means high chance this entity will be lost in this scenario.
There is another case that adding an entity to the world can fail if
the chunk isn't loaded.
Lots of the server is designed around addEntity never expecting to fail for these reasons,
nor is it really logical.
This change ensures the chunks are always loaded when entities are
added to the world, or a valid entity moves between chunks.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index fb71879ac0..728319968b 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
int i = MathHelper.floor(entity.locX / 16.0D);
int j = MathHelper.floor(entity.locZ / 16.0D);
- boolean flag = entity.attachedToPlayer;
+ boolean flag = true; // Paper - always load chunks for entity adds
// Paper start - Set origin location when the entity is being added to the world
if (entity.origin == null) {
@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
this.getChunkAt(entity.chunkX, entity.chunkZ).a(entity, entity.chunkY);
}
- if (!entity.bN() && !this.isChunkLoaded(i, k, true)) {
+ if (!entity.valid && !entity.bN() && !this.isChunkLoaded(i, k, true)) { // Paper - always load chunks to register valid entities location
entity.inChunk = false;
} else {
this.getChunkAt(i, k).a(entity);
--

Datei anzeigen

@ -51,14 +51,13 @@ index 0c8a2ac90..21fae98c1 100644
if (oclass.isInstance(t0) && t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) { // Spigot - instance check
list.add(t0);
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 4648a93b0..99abf7f9c 100644
index 4648a93b0..33b2dd3ff 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public boolean dead;
public float D;
public float E;
- public float F;
public float F;
+ public boolean shouldBeRemoved; // Paper
public float fallDistance;
private float av;

Datei anzeigen

@ -14,7 +14,7 @@ DimensionManager set to the world it is being placed into.
This fixes corrupt entities breaking chunk saving in custom worlds.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index c9aa5ae16..464e1d2d9 100644
index b4fd3f0dc..57bc805cf 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke

Datei anzeigen

@ -1,80 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sat, 6 Oct 2018 20:54:23 -0500
Subject: [PATCH] Implement getters and setters for EntityItem owner and
thrower
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index c9473087ad..e723bd339e 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -0,0 +0,0 @@ public class EntityItem extends Entity {
this.getDataWatcher().markDirty(EntityItem.b); // CraftBukkit - SPIGOT-4591, must mark dirty
}
- @Nullable
- public UUID k() {
+ @Nullable public UUID getOwner() { return k(); } // Paper - OBFHELPER
+ @Nullable public UUID k() { // Paper
return this.g;
}
+ public void setOwner(@Nullable UUID owner) { b(owner); } // Paper - OBFHELPER
public void b(@Nullable UUID uuid) {
this.g = uuid;
}
- @Nullable
- public UUID l() {
+ @Nullable public UUID getThrower() { return l(); } // Paper - OBFHELPER
+ @Nullable public UUID l() { // Paper
return this.f;
}
+ public void setThrower(@Nullable UUID thrower) { c(thrower); } // Paper - OBFHELPER
public void c(@Nullable UUID uuid) {
this.f = uuid;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
index 6036592f76..4128ba4c06 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
@@ -0,0 +0,0 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.CraftServer;
+// Paper start
+import javax.annotation.Nullable;
+import java.util.UUID;
+// Paper end
+
public class CraftItem extends CraftEntity implements Item {
private final EntityItem item;
@@ -0,0 +0,0 @@ public class CraftItem extends CraftEntity implements Item {
public void setCanMobPickup(boolean canMobPickup) {
item.canMobPickup = canMobPickup;
}
+
+ @Nullable
+ public UUID getOwner() {
+ return item.getOwner();
+ }
+
+ public void setOwner(@Nullable UUID owner) {
+ item.setOwner(owner);
+ }
+
+ @Nullable
+ public UUID getThrower() {
+ return item.getThrower();
+ }
+
+ public void setThrower(@Nullable UUID thrower) {
+ item.setThrower(thrower);
+ }
// Paper End
@Override
--

Datei anzeigen

@ -27,7 +27,7 @@ index 20db76abd..a148cd437 100644
int i = this.f ? 300 : 100;
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 2dfa7d251..03e0e9e26 100644
index 784520342..ef7f0213b 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke

Datei anzeigen

@ -1,50 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 28 Sep 2018 20:46:29 -0400
Subject: [PATCH] Optimize Light Recalculations
Optimizes to not repeatedly look up the same chunk for
light lookups.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 4f64072a7b..966879a894 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
private void a(int i, int j, int k, int l) {
if (l > k && this.areNeighborsLoaded(1)) { // Paper
for (int i1 = k; i1 < l; ++i1) {
- this.world.c(EnumSkyBlock.SKY, new BlockPosition(i, i1, j));
+ this.world.updateBrightness(EnumSkyBlock.SKY, new BlockPosition(i, i1, j), this); // Paper
}
this.x = true;
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 97a0fbd55c..fb71879ac0 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
if (this.worldProvider.g()) {
- for (i1 = k; i1 <= l; ++i1) {
- this.c(EnumSkyBlock.SKY, new BlockPosition(i, i1, j));
+ Chunk chunk = getChunkIfLoaded(i >> 4, j >> 4); // Paper
+ for (i1 = k; chunk != null && i1 <= l; ++i1) { // Paper
+ this.updateBrightness(EnumSkyBlock.SKY, new BlockPosition(i, i1, j), chunk); // Paper
}
}
@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) {
// CraftBukkit start - Use neighbor cache instead of looking up
Chunk chunk = this.getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4);
+ // Paper start - optimize light updates where chunk is known
+ return updateBrightness(enumskyblock, blockposition, chunk);
+ }
+ public boolean updateBrightness(EnumSkyBlock enumskyblock, BlockPosition blockposition, Chunk chunk) {
+ // Paper end
if (chunk == null || !chunk.areNeighborsLoaded(1) /*!this.areChunksLoaded(blockposition, 17, false)*/) {
// CraftBukkit end
return false;
--

Datei anzeigen

@ -1,334 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 16 Sep 2018 00:00:16 -0400
Subject: [PATCH] Optimize and Fix ExpiringMap Issues
computeIfAbsent would leak as the entry was never
registered into the ttl map, as well as some other
methods were at risk, so they were added.
This also synchronizes all access make the map thread safe.
This also redesigns cleaning to not run on every
manipulation, and instead to run clean
once per tick per active expiring map.
diff --git a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java
index a237684410..835a2aae40 100644
--- a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java
+++ b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java
@@ -0,0 +0,0 @@ public abstract class ChunkGeneratorAbstract<C extends GeneratorSettings> implem
public Long2ObjectMap<StructureStart> getStructureStartCache(StructureGenerator<? extends WorldGenFeatureConfiguration> structuregenerator) {
return (Long2ObjectMap) this.d.computeIfAbsent(structuregenerator, (structuregenerator1) -> {
- return Long2ObjectMaps.synchronize(new ExpiringMap<>(8192, 10000));
+ return new ExpiringMap<>(8192, 10000); // Paper - already synchronized
});
}
public Long2ObjectMap<LongSet> getStructureCache(StructureGenerator<? extends WorldGenFeatureConfiguration> structuregenerator) {
return (Long2ObjectMap) this.e.computeIfAbsent(structuregenerator, (structuregenerator1) -> {
- return Long2ObjectMaps.synchronize(new ExpiringMap<>(8192, 10000));
+ return new ExpiringMap<>(8192, 10000); // Paper - already synchronized
});
}
diff --git a/src/main/java/net/minecraft/server/ExpiringMap.java b/src/main/java/net/minecraft/server/ExpiringMap.java
index bd36364796..bf6095137a 100644
--- a/src/main/java/net/minecraft/server/ExpiringMap.java
+++ b/src/main/java/net/minecraft/server/ExpiringMap.java
@@ -0,0 +0,0 @@ package net.minecraft.server;
import it.unimi.dsi.fastutil.longs.Long2LongLinkedOpenHashMap;
import it.unimi.dsi.fastutil.longs.Long2LongMap;
+import it.unimi.dsi.fastutil.longs.Long2ObjectMaps;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
-import it.unimi.dsi.fastutil.longs.Long2LongMap.Entry;
import it.unimi.dsi.fastutil.objects.ObjectCollection;
import it.unimi.dsi.fastutil.objects.ObjectIterator;
import java.util.Map;
+import java.util.function.BiFunction;
+import java.util.function.Function;
import java.util.function.LongFunction;
-public class ExpiringMap<T> extends Long2ObjectOpenHashMap<T> {
-
+public class ExpiringMap<T> extends Long2ObjectMaps.SynchronizedMap<T> { // paper - synchronize accesss
private final int a;
- private final Long2LongMap b = new Long2LongLinkedOpenHashMap();
+ private final Long2LongMap ttl = new Long2LongLinkedOpenHashMap(); // Paper
+ private static final boolean DEBUG_EXPIRING_MAP = Boolean.getBoolean("debug.expiringmap");
public ExpiringMap(int i, int j) {
- super(i);
+ super(new Long2ObjectOpenHashMap<>(i)); // Paper
this.a = j;
}
+ // Paper start
+ private void setAccess(long i) { a(i); } // Paper - OBFHELPER
private void a(long i) {
- long j = SystemUtils.getMonotonicMillis();
+ synchronized (this.sync) {
+ long j = System.currentTimeMillis(); // Paper
+ this.ttl.put(i, j);
+ if (!registered) {
+ registered = true;
+ MinecraftServer.getServer().expiringMaps.add(this);
+ }
+ }
+ }
- this.b.put(i, j);
- // CraftBukkit start
- cleanup();
+ @Override
+ public T compute(long l, BiFunction<? super Long, ? super T, ? extends T> biFunction) {
+ setAccess(l);
+ return super.compute(l, biFunction);
}
- public void cleanup() {
- long j = SystemUtils.getMonotonicMillis();
- // CraftBukkit end
- ObjectIterator objectiterator = this.b.long2LongEntrySet().iterator();
+ @Override
+ public T putIfAbsent(long l, T t) {
+ setAccess(l);
+ return super.putIfAbsent(l, t);
+ }
- while (objectiterator.hasNext()) {
- Long2LongMap.Entry entry = (Long2LongMap.Entry) objectiterator.next(); // CraftBukkit - decompile error
- T t0 = super.get(entry.getLongKey());
+ @Override
+ public T computeIfPresent(long l, BiFunction<? super Long, ? super T, ? extends T> biFunction) {
+ setAccess(l);
+ return super.computeIfPresent(l, biFunction);
+ }
- if (j - entry.getLongValue() <= (long) this.a) {
- break;
- }
+ @Override
+ public T computeIfAbsent(long l, LongFunction<? extends T> longFunction) {
+ setAccess(l);
+ return super.computeIfAbsent(l, longFunction);
+ }
- if (t0 != null && this.a(t0)) {
- super.remove(entry.getLongKey());
- objectiterator.remove();
- }
+
+ @Override
+ public boolean replace(long l, T t, T v1) {
+ setAccess(l);
+ return super.replace(l, t, v1);
+ }
+
+ @Override
+ public T replace(long l, T t) {
+ setAccess(l);
+ return super.replace(l, t);
+ }
+
+ @Override
+ public T putIfAbsent(Long aLong, T t) {
+ setAccess(aLong);
+ return super.putIfAbsent(aLong, t);
+ }
+
+ @Override
+ public boolean replace(Long aLong, T t, T v1) {
+ setAccess(aLong);
+ return super.replace(aLong, t, v1);
+ }
+
+ @Override
+ public T replace(Long aLong, T t) {
+ setAccess(aLong);
+ return super.replace(aLong, t);
+ }
+
+ @Override
+ public T computeIfAbsent(Long aLong, Function<? super Long, ? extends T> function) {
+ setAccess(aLong);
+ return super.computeIfAbsent(aLong, function);
+ }
+
+ @Override
+ public T computeIfPresent(Long aLong, BiFunction<? super Long, ? super T, ? extends T> biFunction) {
+ setAccess(aLong);
+ return super.computeIfPresent(aLong, biFunction);
+ }
+
+ @Override
+ public T compute(Long aLong, BiFunction<? super Long, ? super T, ? extends T> biFunction) {
+ setAccess(aLong);
+ return super.compute(aLong, biFunction);
+ }
+
+ @Override
+ public void clear() {
+ synchronized (this.sync) {
+ ttl.clear();
+ super.clear();
}
+ }
+ private boolean registered = false;
+
+ // Break clean to its own method to be ticked
+ boolean clean() {
+ synchronized (this.sync) {
+ long now = System.currentTimeMillis();
+ ObjectIterator<Long2LongMap.Entry> objectiterator = this.ttl.long2LongEntrySet().iterator(); // Paper
+
+ while (objectiterator.hasNext()) {
+ Long2LongMap.Entry entry = objectiterator.next(); // Paper
+ T object = super.get(entry.getLongKey()); // Paper
+ if (now - entry.getLongValue() <= (long) this.a) {
+ break;
+ }
+
+ if (object != null && this.a(object)) {
+ super.remove(entry.getLongKey());
+ objectiterator.remove();
+ }
+ }
+ int ttlSize = this.ttl.size();
+ int thisSize = this.size();
+ if (ttlSize < thisSize) {
+ if (DEBUG_EXPIRING_MAP) {
+ MinecraftServer.LOGGER.warn("WARNING: ExpiringMap desync (ttl:" + ttlSize + " < actual:" + thisSize + ")");
+ }
+ try {
+ for (Entry<T> entry : this.long2ObjectEntrySet()) {
+ ttl.putIfAbsent(entry.getLongKey(), now);
+ }
+ } catch (Exception ignored) {
+ } // Ignore any como's
+ } else if (ttlSize > this.size()) {
+ if (DEBUG_EXPIRING_MAP) {
+ MinecraftServer.LOGGER.warn("WARNING: ExpiringMap desync (ttl:" + ttlSize + " > actual:" + thisSize + ")");
+ }
+ try {
+ this.ttl.long2LongEntrySet().removeIf(entry -> !this.containsKey(entry.getLongKey()));
+ } catch (Exception ignored) {
+ } // Ignore any como's
+ }
+ if (isEmpty()) {
+ registered = false;
+ return true;
+ }
+ return false;
+ }
+ // Paper end
}
- protected boolean a(T t0) {
+ protected boolean a(T var1) {
return true;
}
- public T put(long i, T t0) {
+ public T put(long i, T object) {
this.a(i);
- return super.put(i, t0);
+ return (T)super.put(i, object);
}
- public T put(Long olong, T t0) {
+ public T put(Long olong, T object) {
this.a(olong);
- return super.put(olong, t0);
+ return (T)super.put(olong, object);
}
public T get(long i) {
- this.a(i);
- return super.get(i);
+ // Paper start - don't setAccess unless a hit
+ T t = super.get(i);
+ if (t != null) {
+ this.setAccess(i);
+ }
+ return t;
+ // Paper end
}
- public void putAll(Map<? extends Long, ? extends T> map) {
+ public void putAll(Map<? extends Long, ? extends T> var1) {
throw new RuntimeException("Not implemented");
}
- public T remove(long i) {
+ public T remove(long var1) {
throw new RuntimeException("Not implemented");
}
- public T remove(Object object) {
+ public T remove(Object var1) {
throw new RuntimeException("Not implemented");
}
+ // Paper start
+ /*
// CraftBukkit start
@Override
public T computeIfAbsent(long l, LongFunction<? extends T> lf) {
- this.b.put(l, SystemUtils.getMonotonicMillis());
+ this.ttl.put(l, SystemUtils.getMonotonicMillis()); // Paper
return super.computeIfAbsent(l, lf);
}
@@ -0,0 +0,0 @@ public class ExpiringMap<T> extends Long2ObjectOpenHashMap<T> {
return super.values();
}
// CraftBukkit end
+ */ // Paper end
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 38c0201acb..ae271a57fc 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
public int autosavePeriod;
public File bukkitDataPackFolder;
public CommandDispatcher vanillaCommandDispatcher;
+ public List<ExpiringMap> expiringMaps = java.util.Collections.synchronizedList(new java.util.ArrayList<>()); // Paper
// CraftBukkit end
// Spigot start
public static final int TPS = 20;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
this.methodProfiler.exit();
org.spigotmc.WatchdogThread.tick(); // Spigot
PaperLightingQueue.processQueue(startTime); // Paper
+ expiringMaps.removeIf(ExpiringMap::clean); // Paper
this.slackActivityAccountant.tickEnded(l); // Spigot
co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
}
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
index 23f4e24cea..9e553866eb 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
@@ -0,0 +0,0 @@ public class CustomChunkGenerator extends InternalChunkGenerator<GeneratorSettin
@Override
public Long2ObjectMap<StructureStart> getStructureStartCache(StructureGenerator<? extends WorldGenFeatureConfiguration> structuregenerator) {
return (Long2ObjectMap) this.structureStartCache.computeIfAbsent(structuregenerator, (s) -> {
- return Long2ObjectMaps.synchronize(new ExpiringMap(8192, 10000));
+ return new ExpiringMap(8192, 10000); // Paper - already synchronized
});
}
@@ -0,0 +0,0 @@ public class CustomChunkGenerator extends InternalChunkGenerator<GeneratorSettin
@Override
public Long2ObjectMap<LongSet> getStructureCache(StructureGenerator<? extends WorldGenFeatureConfiguration> structuregenerator) {
return (Long2ObjectMap) this.structureCache.computeIfAbsent(structuregenerator, (s) -> {
- return Long2ObjectMaps.synchronize(new ExpiringMap(8192, 10000));
+ return new ExpiringMap(8192, 10000); // Paper - already synchronized
});
}
--

Datei anzeigen

@ -1,79 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 29 Aug 2018 21:59:22 -0400
Subject: [PATCH] Optimize getChunkIfLoaded type calls
Uses optimized check to avoid major locks and large method.
Will improve inlining across many hot methods.
Improve getBrightness to not do double chunk map lookups.
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 41926a361b..186cfda7e4 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
continue;
}
- Chunk neighbor = this.getChunkAt(chunk.locX + x, chunk.locZ + z, false, false);
+ Chunk neighbor = this.chunks.get(chunk.chunkKey); // Paper
if (neighbor != null) {
neighbor.setNeighborUnloaded(-x, -z);
chunk.setNeighborUnloaded(x, z);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 14f419deb8..630ebfb37c 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
public Chunk getChunkIfLoaded(int x, int z) {
- return ((ChunkProviderServer) this.chunkProvider).getChunkAt(x, z, false, false);
+ return ((ChunkProviderServer) this.chunkProvider).chunks.get(ChunkCoordIntPair.a(x, z)); // Paper - optimize getChunkIfLoaded
}
protected World(IDataManager idatamanager, @Nullable PersistentCollection persistentcollection, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) {
@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
blockposition = new BlockPosition(blockposition.getX(), 0, blockposition.getZ());
}
- return !blockposition.isValidLocation() ? enumskyblock.c : (!this.isLoaded(blockposition) ? enumskyblock.c : this.getChunkAtWorldCoords(blockposition).getBrightness(enumskyblock, blockposition)); // Paper
+ Chunk chunk; // Paper
+ return !blockposition.isValidLocation() ? enumskyblock.c : ((chunk = this.getChunkIfLoaded(blockposition)) == null ? enumskyblock.c : chunk.getBrightness(enumskyblock, blockposition)); // Paper - optimize ifChunkLoaded
}
public void a(EnumSkyBlock enumskyblock, BlockPosition blockposition, int i) {
@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
if (blockposition.isInvalidYLocation()) { // Paper
return false;
} else {
- Chunk chunk = this.chunkProvider.getChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4, false, false);
+ Chunk chunk = this.getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4); // Paper - optimize ifLoaded
return chunk != null && !chunk.isEmpty();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 72eb8ed4f4..7e52859c1d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
return false;
}
- net.minecraft.server.Chunk chunk = world.getChunkProvider().getChunkAt(x, z, false, false);
+ net.minecraft.server.Chunk chunk = world.getChunkIfLoaded(x, z); // Paper - optimize ifLaoded
if (chunk != null) {
world.getChunkProvider().unload(chunk);
}
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
private boolean unloadChunk0(int x, int z, boolean save) {
Boolean result = MCUtil.ensureMain("Unload Chunk", () -> { // Paper - Ensure never async
- net.minecraft.server.Chunk chunk = world.getChunkProvider().getChunkAt(x, z, false, false);
+ net.minecraft.server.Chunk chunk = world.getChunkIfLoaded(x, z); // Paper - optimize ifLoaded
if (chunk == null) {
return true;
}
--

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Reset players airTicks on respawn
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 464e1d2d9..4bdeba399 100644
index 57bc805cf..0871e185e 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke

Datei anzeigen

@ -1,870 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Thu, 4 Oct 2018 10:08:02 -0500
Subject: [PATCH] Use EntityTypes for living entities
diff --git a/src/main/java/net/minecraft/server/BlockMonsterEggs.java b/src/main/java/net/minecraft/server/BlockMonsterEggs.java
index 5a0cc6d058..d385f647e7 100644
--- a/src/main/java/net/minecraft/server/BlockMonsterEggs.java
+++ b/src/main/java/net/minecraft/server/BlockMonsterEggs.java
@@ -0,0 +0,0 @@ public class BlockMonsterEggs extends Block {
public void dropNaturally(IBlockData iblockdata, World world, BlockPosition blockposition, float f, int i) {
if (!world.isClientSide && world.getGameRules().getBoolean("doTileDrops")) {
- EntitySilverfish entitysilverfish = new EntitySilverfish(world);
+ EntitySilverfish entitysilverfish = EntityTypes.SILVERFISH.create(world); // Paper
entitysilverfish.setPositionRotation((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, 0.0F, 0.0F);
world.addEntity(entitysilverfish, SpawnReason.SILVERFISH_BLOCK); // CraftBukkit - add SpawnReason
diff --git a/src/main/java/net/minecraft/server/BlockPumpkinCarved.java b/src/main/java/net/minecraft/server/BlockPumpkinCarved.java
index 75622fbdf8..2653699840 100644
--- a/src/main/java/net/minecraft/server/BlockPumpkinCarved.java
+++ b/src/main/java/net/minecraft/server/BlockPumpkinCarved.java
@@ -0,0 +0,0 @@ public class BlockPumpkinCarved extends BlockFacingHorizontal {
blockList.setTypeAndData(shapedetectorblock1.getPosition(), Blocks.AIR.getBlockData(), 2); // CraftBukkit
}
- EntitySnowman entitysnowman = new EntitySnowman(world);
+ EntitySnowman entitysnowman = EntityTypes.SNOW_GOLEM.create(world); // Paper
BlockPosition blockposition1 = shapedetector_shapedetectorcollection.a(0, 2, 0).getPosition();
entitysnowman.setPositionRotation((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.05D, (double) blockposition1.getZ() + 0.5D, 0.0F, 0.0F);
@@ -0,0 +0,0 @@ public class BlockPumpkinCarved extends BlockFacingHorizontal {
}
BlockPosition blockposition2 = shapedetector_shapedetectorcollection.a(1, 2, 0).getPosition();
- EntityIronGolem entityirongolem = new EntityIronGolem(world);
+ EntityIronGolem entityirongolem = EntityTypes.IRON_GOLEM.create(world); // Paper
entityirongolem.setPlayerCreated(true);
entityirongolem.setPositionRotation((double) blockposition2.getX() + 0.5D, (double) blockposition2.getY() + 0.05D, (double) blockposition2.getZ() + 0.5D, 0.0F, 0.0F);
diff --git a/src/main/java/net/minecraft/server/BlockTurtleEgg.java b/src/main/java/net/minecraft/server/BlockTurtleEgg.java
index 0f0872c1e0..1c1bf85a0e 100644
--- a/src/main/java/net/minecraft/server/BlockTurtleEgg.java
+++ b/src/main/java/net/minecraft/server/BlockTurtleEgg.java
@@ -0,0 +0,0 @@ public class BlockTurtleEgg extends Block {
if (!world.isClientSide) {
for (int j = 0; j < (Integer) iblockdata.get(BlockTurtleEgg.b); ++j) {
world.triggerEffect(2001, blockposition, Block.getCombinedId(iblockdata));
- EntityTurtle entityturtle = new EntityTurtle(world);
+ EntityTurtle entityturtle = EntityTypes.TURTLE.create(world); // Paper
entityturtle.setAgeRaw(-24000);
entityturtle.g(blockposition);
diff --git a/src/main/java/net/minecraft/server/BlockWitherSkull.java b/src/main/java/net/minecraft/server/BlockWitherSkull.java
index 93bf32dc1a..e6063bb462 100644
--- a/src/main/java/net/minecraft/server/BlockWitherSkull.java
+++ b/src/main/java/net/minecraft/server/BlockWitherSkull.java
@@ -0,0 +0,0 @@ public class BlockWitherSkull extends BlockSkull {
}
BlockPosition blockposition1 = shapedetector_shapedetectorcollection.a(1, 0, 0).getPosition();
- EntityWither entitywither = new EntityWither(world);
+ EntityWither entitywither = EntityTypes.WITHER.create(world); // Paper
BlockPosition blockposition2 = shapedetector_shapedetectorcollection.a(1, 2, 0).getPosition();
entitywither.setPositionRotation((double) blockposition2.getX() + 0.5D, (double) blockposition2.getY() + 0.55D, (double) blockposition2.getZ() + 0.5D, shapedetector_shapedetectorcollection.getFacing().k() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F, 0.0F);
diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java
index aad7ce93f6..09eabf1235 100644
--- a/src/main/java/net/minecraft/server/EnderDragonBattle.java
+++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java
@@ -0,0 +0,0 @@ public class EnderDragonBattle {
private EntityEnderDragon n() {
this.d.getChunkAtWorldCoords(new BlockPosition(0, 128, 0));
- EntityEnderDragon entityenderdragon = new EntityEnderDragon(this.d);
+ EntityEnderDragon entityenderdragon = EntityTypes.ENDER_DRAGON.create(this.d); // Paper
entityenderdragon.getDragonControllerManager().setControllerPhase(DragonControllerPhase.HOLDING_PATTERN);
entityenderdragon.setPositionRotation(0.0D, 128.0D, 0.0D, this.d.random.nextFloat() * 360.0F, 0.0F);
diff --git a/src/main/java/net/minecraft/server/EntityChicken.java b/src/main/java/net/minecraft/server/EntityChicken.java
index ee159e0a81..070a9e7b14 100644
--- a/src/main/java/net/minecraft/server/EntityChicken.java
+++ b/src/main/java/net/minecraft/server/EntityChicken.java
@@ -0,0 +0,0 @@ public class EntityChicken extends EntityAnimal {
}
public EntityChicken createChild(EntityAgeable entityageable) {
- return new EntityChicken(this.world);
+ return EntityTypes.CHICKEN.create(world); // Paper
}
public boolean f(ItemStack itemstack) {
diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java
index 5874d2993c..cc53e915d7 100644
--- a/src/main/java/net/minecraft/server/EntityCow.java
+++ b/src/main/java/net/minecraft/server/EntityCow.java
@@ -0,0 +0,0 @@ public class EntityCow extends EntityAnimal {
}
public EntityCow createChild(EntityAgeable entityageable) {
- return new EntityCow(this.world);
+ return EntityTypes.COW.create(world); // Paper
}
public float getHeadHeight() {
diff --git a/src/main/java/net/minecraft/server/EntityEnderPearl.java b/src/main/java/net/minecraft/server/EntityEnderPearl.java
index 961afa5c42..a372f6508f 100644
--- a/src/main/java/net/minecraft/server/EntityEnderPearl.java
+++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java
@@ -0,0 +0,0 @@ public class EntityEnderPearl extends EntityProjectile {
if (!teleEvent.isCancelled() && !entityplayer.playerConnection.isDisconnected()) {
if (this.random.nextFloat() < 0.05F && this.world.getGameRules().getBoolean("doMobSpawning")) {
- EntityEndermite entityendermite = new EntityEndermite(this.world);
+ EntityEndermite entityendermite = EntityTypes.ENDERMITE.create(world); // Paper
entityendermite.setPlayerSpawned(true);
entityendermite.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch);
diff --git a/src/main/java/net/minecraft/server/EntityEvoker.java b/src/main/java/net/minecraft/server/EntityEvoker.java
index 963b6fbb9c..fc20bbe272 100644
--- a/src/main/java/net/minecraft/server/EntityEvoker.java
+++ b/src/main/java/net/minecraft/server/EntityEvoker.java
@@ -0,0 +0,0 @@ public class EntityEvoker extends EntityIllagerWizard {
protected void j() {
for (int i = 0; i < 3; ++i) {
BlockPosition blockposition = (new BlockPosition(EntityEvoker.this)).a(-2 + EntityEvoker.this.random.nextInt(5), 1, -2 + EntityEvoker.this.random.nextInt(5));
- EntityVex entityvex = new EntityVex(EntityEvoker.this.world);
-
+ EntityVex entityvex = EntityTypes.VEX.create(EntityEvoker.this.world); // Paper
entityvex.setPositionRotation(blockposition, 0.0F, 0.0F);
entityvex.prepare(EntityEvoker.this.world.getDamageScaler(blockposition), (GroupDataEntity) null, (NBTTagCompound) null);
entityvex.a((EntityInsentient) EntityEvoker.this);
diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java
index 4e8a97c557..1b9425f3e6 100644
--- a/src/main/java/net/minecraft/server/EntityHorse.java
+++ b/src/main/java/net/minecraft/server/EntityHorse.java
@@ -0,0 +0,0 @@ public class EntityHorse extends EntityHorseAbstract {
Object object;
if (entityageable instanceof EntityHorseDonkey) {
- object = new EntityHorseMule(this.world);
+ object = EntityTypes.MULE.create(world); // Paper
} else {
EntityHorse entityhorse = (EntityHorse) entityageable;
- object = new EntityHorse(this.world);
+ object = EntityTypes.HORSE.create(world); // Paper
int i = this.random.nextInt(9);
int j;
diff --git a/src/main/java/net/minecraft/server/EntityHorseDonkey.java b/src/main/java/net/minecraft/server/EntityHorseDonkey.java
index 72eed22eb9..65c40e72bf 100644
--- a/src/main/java/net/minecraft/server/EntityHorseDonkey.java
+++ b/src/main/java/net/minecraft/server/EntityHorseDonkey.java
@@ -0,0 +0,0 @@ public class EntityHorseDonkey extends EntityHorseChestedAbstract {
}
public EntityAgeable createChild(EntityAgeable entityageable) {
- Object object = entityageable instanceof EntityHorse ? new EntityHorseMule(this.world) : new EntityHorseDonkey(this.world);
+ Object object = entityageable instanceof EntityHorse ? EntityTypes.MULE.create(world) : EntityTypes.DONKEY.create(world); // Paper
this.a(entityageable, (EntityHorseAbstract) object);
return (EntityAgeable) object;
diff --git a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java
index eae2b26655..0a092acdfe 100644
--- a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java
+++ b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java
@@ -0,0 +0,0 @@ public class EntityHorseSkeleton extends EntityHorseAbstract {
@Nullable
public EntityAgeable createChild(EntityAgeable entityageable) {
- return new EntityHorseSkeleton(this.world);
+ return EntityTypes.SKELETON_HORSE.create(world); // Paper
}
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
diff --git a/src/main/java/net/minecraft/server/EntityHorseZombie.java b/src/main/java/net/minecraft/server/EntityHorseZombie.java
index c23bc72fc8..a1873f557c 100644
--- a/src/main/java/net/minecraft/server/EntityHorseZombie.java
+++ b/src/main/java/net/minecraft/server/EntityHorseZombie.java
@@ -0,0 +0,0 @@ public class EntityHorseZombie extends EntityHorseAbstract {
@Nullable
public EntityAgeable createChild(EntityAgeable entityageable) {
- return new EntityHorseZombie(this.world);
+ return EntityTypes.ZOMBIE_HORSE.create(world); // Paper
}
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
diff --git a/src/main/java/net/minecraft/server/EntityLlama.java b/src/main/java/net/minecraft/server/EntityLlama.java
index 5e19768710..82a32c61ed 100644
--- a/src/main/java/net/minecraft/server/EntityLlama.java
+++ b/src/main/java/net/minecraft/server/EntityLlama.java
@@ -0,0 +0,0 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn
}
public EntityLlama createChild(EntityAgeable entityageable) {
- EntityLlama entityllama = new EntityLlama(this.world);
+ EntityLlama entityllama = EntityTypes.LLAMA.create(world); // Paper
this.a(entityageable, (EntityHorseAbstract) entityllama);
EntityLlama entityllama1 = (EntityLlama) entityageable;
diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java
index dde9f1e61e..638dbe978d 100644
--- a/src/main/java/net/minecraft/server/EntityMushroomCow.java
+++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java
@@ -0,0 +0,0 @@ public class EntityMushroomCow extends EntityCow {
this.world.addParticle(Particles.u, this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, 0.0D, 0.0D, 0.0D);
if (!this.world.isClientSide) {
// this.die(); // CraftBukkit - moved down
- EntityCow entitycow = new EntityCow(this.world);
+ EntityCow entitycow = EntityTypes.COW.create(world); // Paper
entitycow.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
entitycow.setHealth(this.getHealth());
@@ -0,0 +0,0 @@ public class EntityMushroomCow extends EntityCow {
}
public EntityMushroomCow createChild(EntityAgeable entityageable) {
- return new EntityMushroomCow(this.world);
+ return EntityTypes.MOOSHROOM.create(world); // Paper
}
@Nullable
diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java
index ba074c10c6..13c84bda84 100644
--- a/src/main/java/net/minecraft/server/EntityOcelot.java
+++ b/src/main/java/net/minecraft/server/EntityOcelot.java
@@ -0,0 +0,0 @@ public class EntityOcelot extends EntityTameableAnimal {
}
public EntityOcelot createChild(EntityAgeable entityageable) {
- EntityOcelot entityocelot = new EntityOcelot(this.world);
+ EntityOcelot entityocelot = EntityTypes.OCELOT.create(world); // Paper
if (this.isTamed()) {
entityocelot.setOwnerUUID(this.getOwnerUUID());
@@ -0,0 +0,0 @@ public class EntityOcelot extends EntityTameableAnimal {
groupdataentity = super.prepare(difficultydamagescaler, groupdataentity, nbttagcompound);
if (spawnBonus && this.getCatType() == 0 && this.world.random.nextInt(7) == 0) { // Spigot
for (int i = 0; i < 2; ++i) {
- EntityOcelot entityocelot = new EntityOcelot(this.world);
+ EntityOcelot entityocelot = EntityTypes.OCELOT.create(world); // Paper
entityocelot.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entityocelot.setAgeRaw(-24000);
diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java
index 9dc2d8be27..d1689dc33a 100644
--- a/src/main/java/net/minecraft/server/EntityPig.java
+++ b/src/main/java/net/minecraft/server/EntityPig.java
@@ -0,0 +0,0 @@ public class EntityPig extends EntityAnimal {
public void onLightningStrike(EntityLightning entitylightning) {
if (!this.world.isClientSide && !this.dead) {
- EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);
+ EntityPigZombie entitypigzombie = EntityTypes.ZOMBIE_PIGMAN.create(world); // Paper
entitypigzombie.setSlot(EnumItemSlot.MAINHAND, new ItemStack(Items.GOLDEN_SWORD));
entitypigzombie.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
@@ -0,0 +0,0 @@ public class EntityPig extends EntityAnimal {
}
public EntityPig createChild(EntityAgeable entityageable) {
- return new EntityPig(this.world);
+ return EntityTypes.PIG.create(world); // Paper
}
public boolean f(ItemStack itemstack) {
diff --git a/src/main/java/net/minecraft/server/EntityPolarBear.java b/src/main/java/net/minecraft/server/EntityPolarBear.java
index a02020d5fc..dbb534c9cd 100644
--- a/src/main/java/net/minecraft/server/EntityPolarBear.java
+++ b/src/main/java/net/minecraft/server/EntityPolarBear.java
@@ -0,0 +0,0 @@ public class EntityPolarBear extends EntityAnimal {
}
public EntityAgeable createChild(EntityAgeable entityageable) {
- return new EntityPolarBear(this.world);
+ return EntityTypes.POLAR_BEAR.create(world); // Paper
}
public boolean f(ItemStack itemstack) {
diff --git a/src/main/java/net/minecraft/server/EntityRabbit.java b/src/main/java/net/minecraft/server/EntityRabbit.java
index e545b1c9b3..d6bac06a7a 100644
--- a/src/main/java/net/minecraft/server/EntityRabbit.java
+++ b/src/main/java/net/minecraft/server/EntityRabbit.java
@@ -0,0 +0,0 @@ public class EntityRabbit extends EntityAnimal {
}
public EntityRabbit createChild(EntityAgeable entityageable) {
- EntityRabbit entityrabbit = new EntityRabbit(this.world);
+ EntityRabbit entityrabbit = EntityTypes.RABBIT.create(world); // Paper
int i = this.dJ();
if (this.random.nextInt(20) != 0) {
diff --git a/src/main/java/net/minecraft/server/EntitySheep.java b/src/main/java/net/minecraft/server/EntitySheep.java
index f7a25c1483..c35d1eef43 100644
--- a/src/main/java/net/minecraft/server/EntitySheep.java
+++ b/src/main/java/net/minecraft/server/EntitySheep.java
@@ -0,0 +0,0 @@ public class EntitySheep extends EntityAnimal {
public EntitySheep createChild(EntityAgeable entityageable) {
EntitySheep entitysheep = (EntitySheep) entityageable;
- EntitySheep entitysheep1 = new EntitySheep(this.world);
+ EntitySheep entitysheep1 = EntityTypes.SHEEP.create(world); // Paper
entitysheep1.setColor(this.a((EntityAnimal) this, (EntityAnimal) entitysheep));
return entitysheep1;
diff --git a/src/main/java/net/minecraft/server/EntitySpider.java b/src/main/java/net/minecraft/server/EntitySpider.java
index a42b8d554f..9ef1c9baf2 100644
--- a/src/main/java/net/minecraft/server/EntitySpider.java
+++ b/src/main/java/net/minecraft/server/EntitySpider.java
@@ -0,0 +0,0 @@ public class EntitySpider extends EntityMonster {
Object object = super.prepare(difficultydamagescaler, groupdataentity, nbttagcompound);
if (this.world.random.nextInt(100) == 0) {
- EntitySkeleton entityskeleton = new EntitySkeleton(this.world);
+ EntitySkeleton entityskeleton = EntityTypes.SKELETON.create(world); // Paper
entityskeleton.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entityskeleton.prepare(difficultydamagescaler, (GroupDataEntity) null, (NBTTagCompound) null);
diff --git a/src/main/java/net/minecraft/server/EntityTurtle.java b/src/main/java/net/minecraft/server/EntityTurtle.java
index a533e0eb5b..270b950820 100644
--- a/src/main/java/net/minecraft/server/EntityTurtle.java
+++ b/src/main/java/net/minecraft/server/EntityTurtle.java
@@ -0,0 +0,0 @@ public class EntityTurtle extends EntityAnimal {
@Nullable
public EntityAgeable createChild(EntityAgeable entityageable) {
- return new EntityTurtle(this.world);
+ return EntityTypes.TURTLE.create(world); // Paper
}
public boolean f(ItemStack itemstack) {
diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
index d74bfa1201..24ca351194 100644
--- a/src/main/java/net/minecraft/server/EntityTypes.java
+++ b/src/main/java/net/minecraft/server/EntityTypes.java
@@ -0,0 +0,0 @@ public class EntityTypes<T extends Entity> {
return this.aX;
}
+ @Nullable public T create(World world) { return a(world); } // Paper - OBFHELPER
@Nullable
public T a(World world) {
return this.aT.apply(world); // CraftBukkit - decompile error
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index f01e776fe5..40b3ffd8ca 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -0,0 +0,0 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
}
public EntityVillager createChild(EntityAgeable entityageable) {
- EntityVillager entityvillager = new EntityVillager(this.world);
+ EntityVillager entityvillager = EntityTypes.VILLAGER.create(world); // Paper
entityvillager.prepare(this.world.getDamageScaler(new BlockPosition(entityvillager)), (GroupDataEntity) null, (NBTTagCompound) null);
return entityvillager;
@@ -0,0 +0,0 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
public void onLightningStrike(EntityLightning entitylightning) {
if (!this.world.isClientSide && !this.dead) {
- EntityWitch entitywitch = new EntityWitch(this.world);
+ EntityWitch entitywitch = EntityTypes.WITCH.create(world); // Paper
// Paper start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, entitylightning, entitywitch).isCancelled()) {
diff --git a/src/main/java/net/minecraft/server/EntityWolf.java b/src/main/java/net/minecraft/server/EntityWolf.java
index 4f1696d018..46d8e0a1f4 100644
--- a/src/main/java/net/minecraft/server/EntityWolf.java
+++ b/src/main/java/net/minecraft/server/EntityWolf.java
@@ -0,0 +0,0 @@ public class EntityWolf extends EntityTameableAnimal {
}
public EntityWolf createChild(EntityAgeable entityageable) {
- EntityWolf entitywolf = new EntityWolf(this.world);
+ EntityWolf entitywolf = EntityTypes.WOLF.create(world); // Paper
UUID uuid = this.getOwnerUUID();
if (uuid != null) {
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index 7998b80c17..81cc0c3b33 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
}
protected void dE() {
- this.a((EntityZombie) (new EntityDrowned(this.world)));
+ this.a((EntityZombie) EntityTypes.DROWNED.create(world)); // Paper
this.world.a((EntityHuman) null, 1040, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0);
}
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ);
- EntityZombie entityzombie = new EntityZombie(this.world);
+ EntityZombie entityzombie = EntityTypes.ZOMBIE.create(world); // Paper
for (int l = 0; l < 50; ++l) {
int i1 = i + MathHelper.nextInt(this.random, 7, 40) * MathHelper.nextInt(this.random, -1, 1);
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
}
EntityVillager entityvillager = (EntityVillager) entityliving;
- EntityZombieVillager entityzombievillager = new EntityZombieVillager(this.world);
+ EntityZombieVillager entityzombievillager = EntityTypes.ZOMBIE_VILLAGER.create(world); // Paper
entityzombievillager.u(entityvillager);
// this.world.kill(entityvillager); // CraftBukkit - moved down
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
this.startRiding(entitychicken);
}
} else if ((double) this.world.random.nextFloat() < 0.05D) {
- EntityChicken entitychicken1 = new EntityChicken(this.world);
+ EntityChicken entitychicken1 = EntityTypes.CHICKEN.create(world); // Paper
entitychicken1.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entitychicken1.prepare(difficultydamagescaler, (GroupDataEntity) null, (NBTTagCompound) null);
diff --git a/src/main/java/net/minecraft/server/EntityZombieHusk.java b/src/main/java/net/minecraft/server/EntityZombieHusk.java
index 85d402965b..0cca7b6d51 100644
--- a/src/main/java/net/minecraft/server/EntityZombieHusk.java
+++ b/src/main/java/net/minecraft/server/EntityZombieHusk.java
@@ -0,0 +0,0 @@ public class EntityZombieHusk extends EntityZombie {
}
protected void dE() {
- this.a(new EntityZombie(this.world));
+ this.a(EntityTypes.ZOMBIE.create(world)); // Paper
this.world.a((EntityHuman) null, 1041, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0);
}
diff --git a/src/main/java/net/minecraft/server/EntityZombieVillager.java b/src/main/java/net/minecraft/server/EntityZombieVillager.java
index 359ac8b88c..96a1b1d3f2 100644
--- a/src/main/java/net/minecraft/server/EntityZombieVillager.java
+++ b/src/main/java/net/minecraft/server/EntityZombieVillager.java
@@ -0,0 +0,0 @@ public class EntityZombieVillager extends EntityZombie {
}
protected void dJ() {
- EntityVillager entityvillager = new EntityVillager(this.world);
+ EntityVillager entityvillager = EntityTypes.VILLAGER.create(world); // Paper
entityvillager.u(this);
entityvillager.setProfession(this.getProfession());
diff --git a/src/main/java/net/minecraft/server/ItemArmorStand.java b/src/main/java/net/minecraft/server/ItemArmorStand.java
index 576b3c5650..4dd0e39ec3 100644
--- a/src/main/java/net/minecraft/server/ItemArmorStand.java
+++ b/src/main/java/net/minecraft/server/ItemArmorStand.java
@@ -0,0 +0,0 @@ public class ItemArmorStand extends Item {
if (!world.isClientSide) {
world.setAir(blockposition);
world.setAir(blockposition1);
- EntityArmorStand entityarmorstand = new EntityArmorStand(world, d0 + 0.5D, d1, d2 + 0.5D);
+ EntityArmorStand entityarmorstand = EntityTypes.ARMOR_STAND.create(world); // Paper
float f = (float) MathHelper.d((MathHelper.g(itemactioncontext.h() - 180.0F) + 22.5F) / 45.0F) * 45.0F;
entityarmorstand.setPositionRotation(d0 + 0.5D, d1, d2 + 0.5D, f, 0.0F);
diff --git a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
index 5ddf66eef5..bb7e072ee1 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
@@ -0,0 +0,0 @@ public class MobSpawnerPhantom {
continue;
}
// Paper end
- EntityPhantom entityphantom = new EntityPhantom(world);
+ EntityPhantom entityphantom = EntityTypes.PHANTOM.create(world); // Paper
entityphantom.spawningEntity = entityhuman.uniqueID; // Paper
entityphantom.setPositionRotation(blockposition1, 0.0F, 0.0F);
groupdataentity = entityphantom.prepare(difficultydamagescaler, groupdataentity, (NBTTagCompound) null);
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java
index d4fdcbdfd6..887e4461f3 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java
@@ -0,0 +0,0 @@ public class PathfinderGoalHorseTrap extends PathfinderGoal {
}
private EntityHorseAbstract a(DifficultyDamageScaler difficultydamagescaler) {
- EntityHorseSkeleton entityhorseskeleton = new EntityHorseSkeleton(this.a.world);
+ EntityHorseSkeleton entityhorseskeleton = EntityTypes.SKELETON_HORSE.create(a.world); // Paper
entityhorseskeleton.prepare(difficultydamagescaler, (GroupDataEntity) null, (NBTTagCompound) null);
entityhorseskeleton.setPosition(this.a.locX, this.a.locY, this.a.locZ);
@@ -0,0 +0,0 @@ public class PathfinderGoalHorseTrap extends PathfinderGoal {
}
private EntitySkeleton a(DifficultyDamageScaler difficultydamagescaler, EntityHorseAbstract entityhorseabstract) {
- EntitySkeleton entityskeleton = new EntitySkeleton(entityhorseabstract.world);
+ EntitySkeleton entityskeleton = EntityTypes.SKELETON.create(entityhorseabstract.world); // Paper
entityskeleton.prepare(difficultydamagescaler, (GroupDataEntity) null, (NBTTagCompound) null);
entityskeleton.setPosition(entityhorseabstract.locX, entityhorseabstract.locY, entityhorseabstract.locZ);
diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java
index 0ac1fb53a4..509d62f6b6 100644
--- a/src/main/java/net/minecraft/server/VillageSiege.java
+++ b/src/main/java/net/minecraft/server/VillageSiege.java
@@ -0,0 +0,0 @@ public class VillageSiege {
EntityZombie entityzombie;
try {
- entityzombie = new EntityZombie(this.a);
+ entityzombie = EntityTypes.ZOMBIE.create(this.a); // Paper
entityzombie.prepare(this.a.getDamageScaler(new BlockPosition(entityzombie)), (GroupDataEntity) null, (NBTTagCompound) null);
} catch (Exception exception) {
exception.printStackTrace();
diff --git a/src/main/java/net/minecraft/server/WorldGenEndCityPieces.java b/src/main/java/net/minecraft/server/WorldGenEndCityPieces.java
index 94b21693e2..0a223cfe5a 100644
--- a/src/main/java/net/minecraft/server/WorldGenEndCityPieces.java
+++ b/src/main/java/net/minecraft/server/WorldGenEndCityPieces.java
@@ -0,0 +0,0 @@ public class WorldGenEndCityPieces {
TileEntityLootable.a(generatoraccess, random, blockposition1, LootTables.c);
}
} else if (s.startsWith("Sentry")) {
- EntityShulker entityshulker = new EntityShulker(generatoraccess.getMinecraftWorld());
+ EntityShulker entityshulker = EntityTypes.SHULKER.create(generatoraccess.getMinecraftWorld()); // Paper
entityshulker.setPosition((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D);
entityshulker.g(blockposition);
diff --git a/src/main/java/net/minecraft/server/WorldGenFeatureOceanRuinPieces.java b/src/main/java/net/minecraft/server/WorldGenFeatureOceanRuinPieces.java
index 2def56b067..abeb4aa025 100644
--- a/src/main/java/net/minecraft/server/WorldGenFeatureOceanRuinPieces.java
+++ b/src/main/java/net/minecraft/server/WorldGenFeatureOceanRuinPieces.java
@@ -0,0 +0,0 @@ public class WorldGenFeatureOceanRuinPieces {
((TileEntityChest) tileentity).setLootTable(this.h ? LootTables.q : LootTables.p, random.nextLong());
}
} else if ("drowned".equals(s)) {
- EntityDrowned entitydrowned = new EntityDrowned(generatoraccess.getMinecraftWorld());
-
+ EntityDrowned entitydrowned = EntityTypes.DROWNED.create(generatoraccess.getMinecraftWorld()); // Paper
entitydrowned.di();
entitydrowned.setPositionRotation(blockposition, 0.0F, 0.0F);
entitydrowned.prepare(generatoraccess.getDamageScaler(blockposition), (GroupDataEntity) null, (NBTTagCompound) null);
diff --git a/src/main/java/net/minecraft/server/WorldGenMonumentPieces.java b/src/main/java/net/minecraft/server/WorldGenMonumentPieces.java
index 0e7aed09d1..493a86e1bf 100644
--- a/src/main/java/net/minecraft/server/WorldGenMonumentPieces.java
+++ b/src/main/java/net/minecraft/server/WorldGenMonumentPieces.java
@@ -0,0 +0,0 @@ public class WorldGenMonumentPieces {
protected static final IBlockData d = WorldGenMonumentPieces.WorldGenMonumentPiece.b;
protected static final IBlockData e = Blocks.SEA_LANTERN.getBlockData();
protected static final IBlockData f = Blocks.WATER.getBlockData();
- protected static final Set<Block> g = ImmutableSet.builder().add(Blocks.ICE).add(Blocks.PACKED_ICE).add(Blocks.BLUE_ICE).add(WorldGenMonumentPieces.WorldGenMonumentPiece.f.getBlock()).build();
+ protected static final Set<Block> g = ImmutableSet.<Block>builder().add(Blocks.ICE).add(Blocks.PACKED_ICE).add(Blocks.BLUE_ICE).add(WorldGenMonumentPieces.WorldGenMonumentPiece.f.getBlock()).build(); // Paper - decompile fix
protected static final int h = b(2, 0, 0);
protected static final int i = b(2, 2, 0);
protected static final int j = b(0, 1, 0);
@@ -0,0 +0,0 @@ public class WorldGenMonumentPieces {
int j1 = this.b(i, k);
if (structureboundingbox.b((BaseBlockPosition) (new BlockPosition(l, i1, j1)))) {
- EntityGuardianElder entityguardianelder = new EntityGuardianElder(generatoraccess.getMinecraftWorld());
+ EntityGuardianElder entityguardianelder = EntityTypes.ELDER_GUARDIAN.create(generatoraccess.getMinecraftWorld()); // Paper
entityguardianelder.heal(entityguardianelder.getMaxHealth());
entityguardianelder.setPositionRotation((double) l + 0.5D, (double) i1, (double) j1 + 0.5D, 0.0F, 0.0F);
diff --git a/src/main/java/net/minecraft/server/WorldGenVillagePieces.java b/src/main/java/net/minecraft/server/WorldGenVillagePieces.java
index 5fa2987d2a..967e33b3d7 100644
--- a/src/main/java/net/minecraft/server/WorldGenVillagePieces.java
+++ b/src/main/java/net/minecraft/server/WorldGenVillagePieces.java
@@ -0,0 +0,0 @@ public class WorldGenVillagePieces {
++this.a;
if (this.h) {
- EntityZombieVillager entityzombievillager = new EntityZombieVillager(generatoraccess.getMinecraftWorld());
+ EntityZombieVillager entityzombievillager = EntityTypes.ZOMBIE_VILLAGER.create(generatoraccess.getMinecraftWorld()); // Paper
entityzombievillager.setPositionRotation((double) j1 + 0.5D, (double) k1, (double) l1 + 0.5D, 0.0F, 0.0F);
entityzombievillager.prepare(generatoraccess.getDamageScaler(new BlockPosition(entityzombievillager)), (GroupDataEntity) null, (NBTTagCompound) null);
@@ -0,0 +0,0 @@ public class WorldGenVillagePieces {
entityzombievillager.di();
generatoraccess.addEntity(entityzombievillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
} else {
- EntityVillager entityvillager = new EntityVillager(generatoraccess.getMinecraftWorld());
+ EntityVillager entityvillager = EntityTypes.VILLAGER.create(generatoraccess.getMinecraftWorld()); // Paper
entityvillager.setPositionRotation((double) j1 + 0.5D, (double) k1, (double) l1 + 0.5D, 0.0F, 0.0F);
entityvillager.setProfession(this.c(i1, generatoraccess.m().nextInt(6)));
diff --git a/src/main/java/net/minecraft/server/WorldGenWitchHut.java b/src/main/java/net/minecraft/server/WorldGenWitchHut.java
index efb0379ce3..3d8193c477 100644
--- a/src/main/java/net/minecraft/server/WorldGenWitchHut.java
+++ b/src/main/java/net/minecraft/server/WorldGenWitchHut.java
@@ -0,0 +0,0 @@ public class WorldGenWitchHut extends WorldGenScatteredPiece {
if (structureboundingbox.b((BaseBlockPosition) (new BlockPosition(j, i, k)))) {
this.e = true;
- EntityWitch entitywitch = new EntityWitch(generatoraccess.getMinecraftWorld());
+ EntityWitch entitywitch = EntityTypes.WITCH.create(generatoraccess.getMinecraftWorld()); // Paper
entitywitch.di();
entitywitch.setPositionRotation((double) j + 0.5D, (double) i, (double) k + 0.5D, 0.0F, 0.0F);
diff --git a/src/main/java/net/minecraft/server/WorldGenWoodlandMansionPieces.java b/src/main/java/net/minecraft/server/WorldGenWoodlandMansionPieces.java
index 11010d8e12..4eb746ebb0 100644
--- a/src/main/java/net/minecraft/server/WorldGenWoodlandMansionPieces.java
+++ b/src/main/java/net/minecraft/server/WorldGenWoodlandMansionPieces.java
@@ -0,0 +0,0 @@ public class WorldGenWoodlandMansionPieces {
static class h extends WorldGenWoodlandMansionPieces.f {
private h() {
- super(null);
+ super(); // Paper - decompile fix
}
}
static class f extends WorldGenWoodlandMansionPieces.b {
private f() {
- super(null);
+ super(); // Paper - decompile fix
}
public String a(Random random) {
@@ -0,0 +0,0 @@ public class WorldGenWoodlandMansionPieces {
static class a extends WorldGenWoodlandMansionPieces.b {
private a() {
- super(null);
+ super(); // Paper - decompile fix
}
public String a(Random random) {
@@ -0,0 +0,0 @@ public class WorldGenWoodlandMansionPieces {
this.a(generatoraccess, structureboundingbox, random, blockposition, LootTables.o, iblockdata);
} else if ("Mage".equals(s)) {
- EntityEvoker entityevoker = new EntityEvoker(generatoraccess.getMinecraftWorld());
-
+ EntityEvoker entityevoker = EntityTypes.EVOKER.create(generatoraccess.getMinecraftWorld()); // Paper
entityevoker.di();
entityevoker.setPositionRotation(blockposition, 0.0F, 0.0F);
generatoraccess.addEntity(entityevoker);
generatoraccess.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 2);
} else if ("Warrior".equals(s)) {
- EntityVindicator entityvindicator = new EntityVindicator(generatoraccess.getMinecraftWorld());
-
+ EntityVindicator entityvindicator = EntityTypes.VINDICATOR.create(generatoraccess.getMinecraftWorld()); // Paper
entityvindicator.di();
entityvindicator.setPositionRotation(blockposition, 0.0F, 0.0F);
entityvindicator.prepare(generatoraccess.getDamageScaler(new BlockPosition(entityvindicator)), (GroupDataEntity) null, (NBTTagCompound) null);
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 53e7834cca..5c2421ac38 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
boolean flag2 = this.getGameRules().getBoolean("doMobSpawning") && this.random.nextDouble() < (double) difficultydamagescaler.b() * paperConfig.skeleHorseSpawnChance; // Paper
if (flag2) {
- EntityHorseSkeleton entityhorseskeleton = new EntityHorseSkeleton(this);
+ EntityHorseSkeleton entityhorseskeleton = EntityTypes.SKELETON_HORSE.create(this); // Paper
entityhorseskeleton.s(true);
entityhorseskeleton.setAgeRaw(0);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 7c0a530533..40ee34675c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
entity.setPositionRotation(x, y, z, 0, 0);
} else if (LivingEntity.class.isAssignableFrom(clazz)) {
if (Chicken.class.isAssignableFrom(clazz)) {
- entity = new EntityChicken(world);
+ entity = EntityTypes.CHICKEN.create(world); // Paper
} else if (Cow.class.isAssignableFrom(clazz)) {
if (MushroomCow.class.isAssignableFrom(clazz)) {
- entity = new EntityMushroomCow(world);
+ entity = EntityTypes.MOOSHROOM.create(world); // Paper
} else {
- entity = new EntityCow(world);
+ entity = EntityTypes.COW.create(world); // Paper
}
} else if (Golem.class.isAssignableFrom(clazz)) {
if (Snowman.class.isAssignableFrom(clazz)) {
- entity = new EntitySnowman(world);
+ entity = EntityTypes.SNOW_GOLEM.create(world); // Paper
} else if (IronGolem.class.isAssignableFrom(clazz)) {
- entity = new EntityIronGolem(world);
+ entity = EntityTypes.IRON_GOLEM.create(world); // Paper
} else if (Shulker.class.isAssignableFrom(clazz)) {
- entity = new EntityShulker(world);
+ entity = EntityTypes.SHULKER.create(world); // Paper
}
} else if (Creeper.class.isAssignableFrom(clazz)) {
- entity = new EntityCreeper(world);
+ entity = EntityTypes.CREEPER.create(world); // Paper
} else if (Ghast.class.isAssignableFrom(clazz)) {
- entity = new EntityGhast(world);
+ entity = EntityTypes.GHAST.create(world); // Paper
} else if (Pig.class.isAssignableFrom(clazz)) {
- entity = new EntityPig(world);
+ entity = EntityTypes.PIG.create(world); // Paper
} else if (Player.class.isAssignableFrom(clazz)) {
// need a net server handler for this one
} else if (Sheep.class.isAssignableFrom(clazz)) {
- entity = new EntitySheep(world);
+ entity = EntityTypes.SHEEP.create(world); // Paper
} else if (AbstractHorse.class.isAssignableFrom(clazz)) {
if (ChestedHorse.class.isAssignableFrom(clazz)) {
if (Donkey.class.isAssignableFrom(clazz)) {
- entity = new EntityHorseDonkey(world);
+ entity = EntityTypes.DONKEY.create(world); // Paper
} else if (Mule.class.isAssignableFrom(clazz)) {
- entity = new EntityHorseMule(world);
+ entity = EntityTypes.MULE.create(world); // Paper
} else if (Llama.class.isAssignableFrom(clazz)) {
- entity = new EntityLlama(world);
+ entity = EntityTypes.LLAMA.create(world); // Paper
}
} else if (SkeletonHorse.class.isAssignableFrom(clazz)) {
- entity = new EntityHorseSkeleton(world);
+ entity = EntityTypes.SKELETON_HORSE.create(world); // Paper
} else if (ZombieHorse.class.isAssignableFrom(clazz)) {
- entity = new EntityHorseZombie(world);
+ entity = EntityTypes.ZOMBIE_HORSE.create(world); // Paper
} else {
- entity = new EntityHorse(world);
+ entity = EntityTypes.HORSE.create(world); // Paper
}
} else if (Skeleton.class.isAssignableFrom(clazz)) {
if (Stray.class.isAssignableFrom(clazz)){
- entity = new EntitySkeletonStray(world);
+ entity = EntityTypes.STRAY.create(world); // Paper
} else if (WitherSkeleton.class.isAssignableFrom(clazz)) {
- entity = new EntitySkeletonWither(world);
+ entity = EntityTypes.WITHER_SKELETON.create(world); // Paper
} else {
- entity = new EntitySkeleton(world);
+ entity = EntityTypes.SKELETON.create(world); // Paper
}
} else if (Slime.class.isAssignableFrom(clazz)) {
if (MagmaCube.class.isAssignableFrom(clazz)) {
- entity = new EntityMagmaCube(world);
+ entity = EntityTypes.MAGMA_CUBE.create(world); // Paper
} else {
- entity = new EntitySlime(world);
+ entity = EntityTypes.SLIME.create(world); // Paper
}
} else if (Spider.class.isAssignableFrom(clazz)) {
if (CaveSpider.class.isAssignableFrom(clazz)) {
- entity = new EntityCaveSpider(world);
+ entity = EntityTypes.CAVE_SPIDER.create(world); // Paper
} else {
- entity = new EntitySpider(world);
+ entity = EntityTypes.SPIDER.create(world); // Paper
}
} else if (Squid.class.isAssignableFrom(clazz)) {
- entity = new EntitySquid(world);
+ entity = EntityTypes.SQUID.create(world); // Paper
} else if (Tameable.class.isAssignableFrom(clazz)) {
if (Wolf.class.isAssignableFrom(clazz)) {
- entity = new EntityWolf(world);
+ entity = EntityTypes.WOLF.create(world); // Paper
} else if (Ocelot.class.isAssignableFrom(clazz)) {
- entity = new EntityOcelot(world);
+ entity = EntityTypes.OCELOT.create(world); // Paper
} else if (Parrot.class.isAssignableFrom(clazz)) {
- entity = new EntityParrot(world);
+ entity = EntityTypes.PARROT.create(world); // Paper
}
} else if (PigZombie.class.isAssignableFrom(clazz)) {
- entity = new EntityPigZombie(world);
+ entity = EntityTypes.ZOMBIE_PIGMAN.create(world); // Paper
} else if (Zombie.class.isAssignableFrom(clazz)) {
if (Husk.class.isAssignableFrom(clazz)) {
- entity = new EntityZombieHusk(world);
+ entity = EntityTypes.HUSK.create(world); // Paper
} else if (ZombieVillager.class.isAssignableFrom(clazz)) {
- entity = new EntityZombieVillager(world);
+ entity = EntityTypes.ZOMBIE_VILLAGER.create(world); // Paper
} else if (Drowned.class.isAssignableFrom(clazz)) {
- entity = new EntityDrowned(world);
+ entity = EntityTypes.DROWNED.create(world); // Paper
} else {
- entity = new EntityZombie(world);
+ entity = EntityTypes.ZOMBIE.create(world); // Paper
}
} else if (Giant.class.isAssignableFrom(clazz)) {
- entity = new EntityGiantZombie(world);
+ entity = EntityTypes.GIANT.create(world); // Paper
} else if (Silverfish.class.isAssignableFrom(clazz)) {
- entity = new EntitySilverfish(world);
+ entity = EntityTypes.SILVERFISH.create(world); // Paper
} else if (Enderman.class.isAssignableFrom(clazz)) {
- entity = new EntityEnderman(world);
+ entity = EntityTypes.ENDERMAN.create(world); // Paper
} else if (Blaze.class.isAssignableFrom(clazz)) {
- entity = new EntityBlaze(world);
+ entity = EntityTypes.BLAZE.create(world); // Paper
} else if (Villager.class.isAssignableFrom(clazz)) {
- entity = new EntityVillager(world);
+ entity = EntityTypes.VILLAGER.create(world); // Paper
} else if (Witch.class.isAssignableFrom(clazz)) {
- entity = new EntityWitch(world);
+ entity = EntityTypes.WITCH.create(world); // Paper
} else if (Wither.class.isAssignableFrom(clazz)) {
- entity = new EntityWither(world);
+ entity = EntityTypes.WITHER.create(world); // Paper
} else if (ComplexLivingEntity.class.isAssignableFrom(clazz)) {
if (EnderDragon.class.isAssignableFrom(clazz)) {
- entity = new EntityEnderDragon(world);
+ entity = EntityTypes.ENDER_DRAGON.create(world); // Paper
}
} else if (Ambient.class.isAssignableFrom(clazz)) {
if (Bat.class.isAssignableFrom(clazz)) {
- entity = new EntityBat(world);
+ entity = EntityTypes.BAT.create(world); // Paper
}
} else if (Rabbit.class.isAssignableFrom(clazz)) {
- entity = new EntityRabbit(world);
+ entity = EntityTypes.RABBIT.create(world); // Paper
} else if (Endermite.class.isAssignableFrom(clazz)) {
- entity = new EntityEndermite(world);
+ entity = EntityTypes.ENDERMITE.create(world); // Paper
} else if (Guardian.class.isAssignableFrom(clazz)) {
if (ElderGuardian.class.isAssignableFrom(clazz)){
- entity = new EntityGuardianElder(world);
+ entity = EntityTypes.ELDER_GUARDIAN.create(world); // Paper
} else {
- entity = new EntityGuardian(world);
+ entity = EntityTypes.GUARDIAN.create(world); // Paper
}
} else if (ArmorStand.class.isAssignableFrom(clazz)) {
- entity = new EntityArmorStand(world, x, y, z);
+ entity = EntityTypes.ARMOR_STAND.create(world); // Paper
} else if (PolarBear.class.isAssignableFrom(clazz)) {
- entity = new EntityPolarBear(world);
+ entity = EntityTypes.POLAR_BEAR.create(world); // Paper
} else if (Vex.class.isAssignableFrom(clazz)) {
- entity = new EntityVex(world);
+ entity = EntityTypes.VEX.create(world); // Paper
} else if (Illager.class.isAssignableFrom(clazz)) {
if (Spellcaster.class.isAssignableFrom(clazz)) {
if (Evoker.class.isAssignableFrom(clazz)) {
- entity = new EntityEvoker(world);
+ entity = EntityTypes.EVOKER.create(world); // Paper
} else if (Illusioner.class.isAssignableFrom(clazz)) {
- entity = new EntityIllagerIllusioner(world);
+ entity = EntityTypes.ILLUSIONER.create(world); // Paper
}
} else if (Vindicator.class.isAssignableFrom(clazz)) {
- entity = new EntityVindicator(world);
+ entity = EntityTypes.VINDICATOR.create(world); // Paper
}
} else if (Turtle.class.isAssignableFrom(clazz)) {
- entity = new EntityTurtle(world);
+ entity = EntityTypes.TURTLE.create(world); // Paper
} else if (Phantom.class.isAssignableFrom(clazz)) {
- entity = new EntityPhantom(world);
+ entity = EntityTypes.PHANTOM.create(world); // Paper
} else if (Fish.class.isAssignableFrom(clazz)) {
if (Cod.class.isAssignableFrom(clazz)) {
- entity = new EntityCod(world);
+ entity = EntityTypes.COD.create(world); // Paper
} else if (PufferFish.class.isAssignableFrom(clazz)) {
- entity = new EntityPufferFish(world);
+ entity = EntityTypes.PUFFERFISH.create(world); // Paper
} else if (Salmon.class.isAssignableFrom(clazz)) {
- entity = new EntitySalmon(world);
+ entity = EntityTypes.SALMON.create(world); // Paper
} else if (TropicalFish.class.isAssignableFrom(clazz)) {
- entity = new EntityTropicalFish(world);
+ entity = EntityTypes.TROPICAL_FISH.create(world); // Paper
}
} else if (Dolphin.class.isAssignableFrom(clazz)) {
- entity = new EntityDolphin(world);
+ entity = EntityTypes.DOLPHIN.create(world); // Paper
}
if (entity != null) {
--

Datei anzeigen

@ -20,7 +20,7 @@ this is going to be the best soultion all around.
Improvements/suggestions welcome!
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 4bdeba399..dec531ab7 100644
index 0871e185e..f945a2df4 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke