Current progress - Leaf, tag your it

This commit is contained in:
Aikar
2020-06-25 05:27:25 -04:00
parent 175f83e9d0
commit 5287c1ba7c
29 changed files with 585 additions and 665 deletions

View File

@@ -2291,8 +2291,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.distanceSquared(iposition.getX(), iposition.getY(), iposition.getZ(), true) < d0 * d0;
}
+ public final double distanceSquared(BaseBlockPosition baseblockposition) { return m(baseblockposition); } // Paper - OBFHELPER
public double m(BaseBlockPosition baseblockposition) {
+ public final double distanceSquared(BaseBlockPosition baseblockposition) { return j(baseblockposition); } // Paper - OBFHELPER
public double j(BaseBlockPosition baseblockposition) {
return this.distanceSquared((double) baseblockposition.getX(), (double) baseblockposition.getY(), (double) baseblockposition.getZ(), true);
}
diff --git a/src/main/java/net/minecraft/server/BlockAccessAir.java b/src/main/java/net/minecraft/server/BlockAccessAir.java
@@ -2318,23 +2318,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
public IBlockData getType(BlockPosition blockposition) {
return Blocks.AIR.getBlockData();
diff --git a/src/main/java/net/minecraft/server/BlockData.java b/src/main/java/net/minecraft/server/BlockData.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockDataAbstract.java
+++ b/src/main/java/net/minecraft/server/BlockDataAbstract.java
@@ -0,0 +0,0 @@ public abstract static class BlockDataAbstract<O, S> implements IBlockDataHolder<S> {
return Collections.unmodifiableCollection(this.d.keySet());
}
+ public final <T extends Comparable<T>> boolean hasProperty(IBlockState<T> iblockstate) { return this.b(iblockstate); } // Paper - OBFHELPER
public <T extends Comparable<T>> boolean b(IBlockState<T> iblockstate) {
return this.d.containsKey(iblockstate);
}
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
return d0 == 0.0D && d1 == 0.0D && d2 == 0.0D ? this : new BlockPosition((double) this.getX() + d0, (double) this.getY() + d1, (double) this.getZ() + d2);
}
@@ -2342,7 +2330,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public BlockPosition b(int i, int j, int k) {
return i == 0 && j == 0 && k == 0 ? this : new BlockPosition(this.getX() + i, this.getY() + j, this.getZ() + k);
}
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
return new BlockPosition(this.getY() * baseblockposition.getZ() - this.getZ() * baseblockposition.getY(), this.getZ() * baseblockposition.getX() - this.getX() * baseblockposition.getZ(), this.getX() * baseblockposition.getY() - this.getY() * baseblockposition.getX());
}
@@ -2351,58 +2339,66 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public BlockPosition immutableCopy() {
return this;
}
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
super(i, j, k);
}
+ public static BlockPosition.PooledBlockPosition acquire() { return r(); } // Paper - OBFHELPER
public static BlockPosition.PooledBlockPosition r() {
return f(0, 0, 0);
}
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
return this.d;
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
return super.a(enumblockrotation).immutableCopy();
}
+ public BlockPosition.MutableBlockPosition setValues(int i, int j, int k) { return d(i, j, k);} // Paper - OBFHELPER
public BlockPosition.MutableBlockPosition d(int i, int j, int k) {
this.b = i;
this.c = j;
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
return this.c(entity.locX(), entity.locY(), entity.locZ());
this.o(i);
this.p(j);
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
return this;
}
+ public BlockPosition.MutableBlockPosition setValues(double d0, double d1, double d2) { return c(d0, d1, d2);} // Paper - OBFHELPER
public BlockPosition.MutableBlockPosition c(double d0, double d1, double d2) {
return this.d(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2));
}
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
return this.d(this.b + i, this.c + j, this.d + k);
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
}
}
+ public final void setX(final int x) { this.o(x); } // Paper - OBFHELPER
+ public final void setX(final int x) { super.o(x); } // Paper - OBFHELPER
@Override
public void o(int i) {
this.b = i;
super.o(i);
}
+ public final void setY(final int y) { this.p(y); } // Paper - OBFHELPER
+ public final void setY(final int y) { super.p(y); } // Paper - OBFHELPER
@Override
public void p(int i) {
this.c = i;
super.p(i);
}
+ public final void setZ(final int z) { this.q(z); } // Paper - OBFHELPER
+ public final void setZ(final int z) { super.q(z); } // Paper - OBFHELPER
@Override
public void q(int i) {
this.d = i;
super.q(i);
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
return new BlockPosition(this);
}
}
+
+ // Paper start
+ public static class PooledBlockPosition extends BlockPosition.MutableBlockPosition implements AutoCloseable {
+ @Deprecated
+ public void close() {}
+ @Deprecated
+ public static BlockPosition.PooledBlockPosition acquire() { return new PooledBlockPosition(); }
+ }
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
public class Chunk implements IChunkAccess {
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
private static final Logger LOGGER = LogManager.getLogger();
@Nullable
- public static final ChunkSection a = null;
+ public static final ChunkSection a = null; public static final ChunkSection EMPTY_CHUNK_SECTION = Chunk.a; // Paper - OBFHELPER
+ public static final ChunkSection a = null; public static final ChunkSection EMPTY_CHUNK_SECTION = a; // Paper - OBFHELPER
private final ChunkSection[] sections;
private BiomeStorage d;
private final Map<BlockPosition, NBTTagCompound> e;
@@ -2418,7 +2414,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
this.n = new ShortList[16];
this.entitySlices = (List[]) (new List[16]); // Spigot
this.world = world;
this.world = (WorldServer) world; // CraftBukkit - type
- this.loc = chunkcoordintpair;
+ this.loc = chunkcoordintpair; this.coordinateKey = MCUtil.getCoordinateKey(chunkcoordintpair); // Paper - cache coordinate key
this.i = chunkconverter;
@@ -2734,7 +2730,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider {
private final ChunkMapDistance chunkMapDistance;
public final ChunkGenerator<?> chunkGenerator;
public final ChunkGenerator chunkGenerator;
private final WorldServer world;
- private final Thread serverThread;
+ public final Thread serverThread; // Paper - private -> public
@@ -2742,9 +2738,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final ChunkProviderServer.a serverThreadQueue;
public final PlayerChunkMap playerChunkMap;
@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider {
private final ChunkStatus[] cacheStatus = new ChunkStatus[4];
private final IChunkAccess[] cacheChunk = new IChunkAccess[4];
@Nullable
private SpawnerCreature.d p;
+ // Paper start
+ final com.destroystokyo.paper.util.concurrent.WeakSeqLock loadedChunkMapSeqLock = new com.destroystokyo.paper.util.concurrent.WeakSeqLock();
+ final it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<Chunk> loadedChunkMap = new it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<>(8192, 0.5f);
@@ -2863,7 +2859,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(x, z);
+ Long identifier = Long.valueOf(this.chunkFutureAwaitCounter++);
+ this.addTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier);
+ this.chunkMapDistance.addTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier);
+ this.tickDistanceManager();
+
+ PlayerChunk chunk = this.playerChunkMap.getUpdatingChunk(chunkPos.pair());
@@ -2900,17 +2896,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ } finally {
+ // due to odd behaviour with CB unload implementation we need to have these AFTER the load callback.
+ ChunkProviderServer.this.addTicketAtLevel(TicketType.UNKNOWN, chunkPos, ticketLevel, chunkPos);
+ ChunkProviderServer.this.removeTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier);
+ ChunkProviderServer.this.chunkMapDistance.addTicketAtLevel(TicketType.UNKNOWN, chunkPos, ticketLevel, chunkPos);
+ ChunkProviderServer.this.chunkMapDistance.removeTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier);
+ }
+ }, this.serverThreadQueue);
+ }
+ // Paper end
+
+
public ChunkProviderServer(WorldServer worldserver, File file, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, ChunkGenerator<?> chunkgenerator, int i, WorldLoadListener worldloadlistener, Supplier<WorldPersistentData> supplier) {
public ChunkProviderServer(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, ChunkGenerator chunkgenerator, int i, boolean flag, WorldLoadListener worldloadlistener, Supplier<WorldPersistentData> supplier) {
this.world = worldserver;
this.serverThreadQueue = new ChunkProviderServer.a(worldserver);
@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider {
this.cacheChunk[0] = ichunkaccess;
}
@@ -2961,6 +2955,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Nullable
@Override
public IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag) {
@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider {
this.p = spawnercreature_d;
this.world.getMethodProfiler().exit();
- List<PlayerChunk> list = Lists.newArrayList(this.playerChunkMap.f());
-
- Collections.shuffle(list);
- list.forEach((playerchunk) -> {
+ //List<PlayerChunk> list = Lists.newArrayList(this.playerChunkMap.f()); // Paper
+ //Collections.shuffle(list); // Paper
+ this.playerChunkMap.f().forEach((playerchunk) -> { // Paper - no... just no...
Optional<Chunk> optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left();
if (optional.isPresent()) {
diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ChunkSection.java
@@ -2978,12 +2986,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/DataBits.java
+++ b/src/main/java/net/minecraft/server/DataBits.java
@@ -0,0 +0,0 @@ public class DataBits {
}
return (int) (k >> l & this.d);
}
+ public long[] getDataBits() { return this.a(); } // Paper - OBFHELPER
public long[] a() {
return this.a;
return this.b;
}
diff --git a/src/main/java/net/minecraft/server/DataPalette.java b/src/main/java/net/minecraft/server/DataPalette.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@@ -2996,7 +3004,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ default int getOrCreateIdFor(T object) { return this.a(object); } // Paper - OBFHELPER
int a(T t0);
boolean b(T t0);
boolean a(Predicate<T> predicate);
+ @Nullable default T getObject(int dataBits) { return this.a(dataBits); } // Paper - OBFHELPER
@Nullable
@@ -3044,18 +3052,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void b(PacketDataSerializer packetdataserializer) {
this.a();
packetdataserializer.writeByte(this.i);
diff --git a/src/main/java/net/minecraft/server/DimensionManager.java b/src/main/java/net/minecraft/server/DimensionManager.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/DimensionManager.java
+++ b/src/main/java/net/minecraft/server/DimensionManager.java
@@ -0,0 +0,0 @@ public class DimensionManager implements MinecraftSerializable {
return this.folder.isEmpty() ? file : new File(file, this.folder);
}
+ public WorldServer world; // Paper - store ref to world this manager is for
public WorldProvider getWorldProvider(World world) {
return (WorldProvider) this.providerFactory.apply(world, this);
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Entity.java
@@ -3064,12 +3060,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ public final AxisAlignedBB getCollisionBox(){return au();} //Paper - OBFHELPER
@Nullable
public AxisAlignedBB au() {
- @Nullable
- public AxisAlignedBB ay() {
+
+ @Nullable public final AxisAlignedBB getCollisionBox(){return ay();} //Paper - OBFHELPER
+ @Nullable public AxisAlignedBB ay() {
return null;
}
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener {
return false;
return EnumInteractionResult.PASS;
}
+ public final AxisAlignedBB getHardCollisionBox(Entity entity){ return j(entity);}//Paper - OBFHELPER
@@ -3106,8 +3106,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
public org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes;
public boolean collides = true;
public Set<UUID> collidableExemptions = new HashSet<>();
public boolean canPickUpLoot;
+ public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper
@@ -3136,11 +3136,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> cachedSingleHashSet; // Paper
+
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {
super((World) worldserver, gameprofile);
playerinteractmanager.player = this;
super(worldserver, worldserver.getSpawn(), gameprofile);
this.spawnDimension = World.OVERWORLD;
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.H = 1.0F;
this.a(worldserver);
this.G = 1.0F;
this.b(worldserver);
+ this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper
+
@@ -3151,8 +3151,8 @@ diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityTypes.java
+++ b/src/main/java/net/minecraft/server/EntityTypes.java
@@ -0,0 +0,0 @@ import com.mojang.datafixers.DataFixUtils;
import java.util.Collections;
@@ -0,0 +0,0 @@ package net.minecraft.server;
import com.google.common.collect.ImmutableSet;
import java.util.Optional;
import java.util.Set; // Paper
+import java.util.Map; // Paper
@@ -3160,14 +3160,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import java.util.function.Function;
import java.util.stream.Stream;
@@ -0,0 +0,0 @@ public class EntityTypes<T extends Entity> {
return this.bj.height;
return this.bq.height;
}
- @Nullable
- public T a(World world) {
+ public T create(World world) { return this.a(world); } // Paper - OBFHELPER
+ @Nullable public T a(World world) { // Paper - OBFHELPER
return this.ba.create(this, world);
return this.be.create(this, world);
}
diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java
@@ -3217,33 +3217,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end
+
default int h(BlockPosition blockposition) {
return this.getType(blockposition).h();
}
diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/IBlockData.java
+++ b/src/main/java/net/minecraft/server/IBlockData.java
@@ -0,0 +0,0 @@ public class IBlockData extends BlockDataAbstract<Block, IBlockData> implements
return this.c != null && this.c.f != null ? this.c.f[enumdirection.ordinal()] : VoxelShapes.a(this.j(iblockaccess, blockposition), enumdirection);
}
+ public final boolean exceedsCube(){ return f();} // Paper - OBFHELPER
public boolean f() {
return this.c == null || this.c.h;
return this.getType(blockposition).f();
}
diff --git a/src/main/java/net/minecraft/server/IOWorker.java b/src/main/java/net/minecraft/server/IOWorker.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/IOWorker.java
+++ b/src/main/java/net/minecraft/server/IOWorker.java
@@ -0,0 +0,0 @@ public class IOWorker implements AutoCloseable {
private final Thread b;
private final AtomicBoolean c = new AtomicBoolean();
private final Queue<Runnable> d = Queues.newConcurrentLinkedQueue();
- private final RegionFileCache e;
+ private final RegionFileCache e; public RegionFileCache getRegionFileCache() { return e; } // Paper - OBFHELPER
private final Map<ChunkCoordIntPair, IOWorker.a> f = Maps.newLinkedHashMap();
private boolean g = true;
private CompletableFuture<Void> h = new CompletableFuture();
private static final Logger LOGGER = LogManager.getLogger();
private final AtomicBoolean b = new AtomicBoolean();
private final ThreadedMailbox<PairedQueue.b> c;
- private final RegionFileCache d;
+ private final RegionFileCache d;public RegionFileCache getRegionFileCache() { return d; } // Paper - OBFHELPER
private final Map<ChunkCoordIntPair, IOWorker.a> e = Maps.newLinkedHashMap();
protected IOWorker(File file, boolean flag, String s) {
diff --git a/src/main/java/net/minecraft/server/IWorldReader.java b/src/main/java/net/minecraft/server/IWorldReader.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/IWorldReader.java
@@ -3260,27 +3248,15 @@ diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/n
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -0,0 +0,0 @@ import org.bukkit.event.world.StructureGrowEvent;
public final class ItemStack {
@@ -0,0 +0,0 @@ public final class ItemStack {
})).apply(instance, ItemStack::new);
});
private static final Logger LOGGER = LogManager.getLogger();
- public static final ItemStack a = new ItemStack((Item) null);
+ public static final ItemStack a = new ItemStack((Item) null);public static final ItemStack NULL_ITEM = a; // Paper - OBFHELPER
public static final DecimalFormat b = H();
private int count;
private int e;
+ // Paper start
+ private org.bukkit.craftbukkit.inventory.CraftItemStack bukkitStack;
+ public org.bukkit.inventory.ItemStack getBukkitStack() {
+ if (bukkitStack == null || bukkitStack.getHandle() != this) {
+ bukkitStack = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(this);
+ }
+ return bukkitStack;
+ }
+ // Paper end
@Deprecated
private Item item;
private NBTTagCompound tag;
- public static final ItemStack b = new ItemStack((Item) null);
+ public static final ItemStack b = new ItemStack((Item) null);public static final ItemStack NULL_ITEM = b; // Paper - OBFHELPER
public static final DecimalFormat c = (DecimalFormat) SystemUtils.a((new DecimalFormat("#.##")), (decimalformat) -> { // CraftBukkit - decompile error
decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT));
});
@@ -0,0 +0,0 @@ public final class ItemStack {
return this.tag != null ? this.tag.getList("Enchantments", 10) : new NBTTagList();
}
@@ -3295,6 +3271,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static ItemStack fromBukkitCopy(org.bukkit.inventory.ItemStack itemstack) {
+ return CraftItemStack.asNMSCopy(itemstack);
+ }
+ private org.bukkit.craftbukkit.inventory.CraftItemStack bukkitStack;
+ public org.bukkit.inventory.ItemStack getBukkitStack() {
+ if (bukkitStack == null || bukkitStack.getHandle() != this) {
+ bukkitStack = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(this);
+ }
+ return bukkitStack;
+ }
+ // Paper end
public void setTag(@Nullable NBTTagCompound nbttagcompound) {
this.tag = nbttagcompound;
@@ -3782,24 +3765,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ asyncExecutor.execute(run);
+ }
+
+ @Nullable
+ public static TileEntityHopper getHopper(World world, BlockPosition pos) {
+ Chunk chunk = world.getChunkIfLoaded(pos.getX() >> 4, pos.getZ() >> 4);
+ if (chunk != null && chunk.getType(new BlockPosition(pos.getX(), pos.getY(), pos.getZ())).getBlock() == Blocks.HOPPER) {
+ TileEntity tileEntity = chunk.getTileEntityImmediately(pos);
+ if (tileEntity instanceof TileEntityHopper) {
+ return (TileEntityHopper) tileEntity;
+ }
+ }
+ return null;
+ }
+
+ @Nonnull
+ public static World getNMSWorld(@Nonnull org.bukkit.World world) {
+ public static WorldServer getNMSWorld(@Nonnull org.bukkit.World world) {
+ return ((CraftWorld) world).getHandle();
+ }
+
+ public static World getNMSWorld(@Nonnull org.bukkit.entity.Entity entity) {
+ public static WorldServer getNMSWorld(@Nonnull org.bukkit.entity.Entity entity) {
+ return getNMSWorld(entity.getWorld());
+ }
+
@@ -3840,8 +3811,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- 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 extends IAsyncTaskHandlerReentrant<TickTas
MinecraftServer.LOGGER.error("Failed to unlock level {}", this.convertable.getLevelName(), ioexception1);
}
// Spigot start
+ MCUtil.asyncExecutor.shutdown(); // Paper
+ try { MCUtil.asyncExecutor.awaitTermination(30, java.util.concurrent.TimeUnit.SECONDS); // Paper
@@ -3860,7 +3831,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- private final Map<String, NBTBase> map;
+ public final Map<String, NBTBase> map; // Paper
private NBTTagCompound(Map<String, NBTBase> map) {
protected NBTTagCompound(Map<String, NBTBase> map) {
this.map = map;
@@ -0,0 +0,0 @@ public class NBTTagCompound implements NBTBase {
this.map.put(s, NBTTagLong.a(i));
@@ -3868,15 +3839,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public void setUUID(String prefix, UUID uuid) { a(prefix, uuid); } // Paper - OBFHELPER
public void a(String s, UUID uuid) {
this.setLong(s + "Most", uuid.getMostSignificantBits());
this.setLong(s + "Least", uuid.getLeastSignificantBits());
this.map.put(s, GameProfileSerializer.a(uuid));
}
+
+ @Nullable public UUID getUUID(String prefix) { return a(prefix); } // Paper - OBFHELPER
+ @Nullable
public UUID a(String s) {
return new UUID(this.getLong(s + "Most"), this.getLong(s + "Least"));
return GameProfileSerializer.a(this.get(s));
}
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@@ -3946,7 +3916,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private byte[] f; private byte[] getData() { return this.f; } // Paper - OBFHELPER
private List<NBTTagCompound> g;
private boolean h;
private boolean i;
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
return bytebuf;
}
@@ -4171,12 +4141,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ int chunkZ = MCUtil.getChunkCoordinate(player.locZ());
+ // Note: players need to be explicitly added to distance maps before they can be updated
+ }
+
+
+ // Paper end
+
public PlayerChunkMap(WorldServer worldserver, File file, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler<Runnable> iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator<?> chunkgenerator, WorldLoadListener worldloadlistener, Supplier<WorldPersistentData> supplier, int i) {
super(new File(worldserver.getWorldProvider().getDimensionManager().a(file), "region"), datafixer);
public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler<Runnable> iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, Supplier<WorldPersistentData> supplier, int i, boolean flag) {
super(new File(convertable_conversionsession.a(worldserver.getDimensionKey()), "region"), datafixer, flag);
this.visibleChunks = this.updatingChunks.clone();
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
};
@@ -4199,7 +4167,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ this.addPlayerToDistanceMaps(entityplayer); // Paper - distance maps
} else {
SectionPosition sectionposition = entityplayer.K();
SectionPosition sectionposition = entityplayer.N();
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
if (!flag2) {
@@ -4299,8 +4267,8 @@ diff --git a/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java b/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java
+++ b/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java
@@ -0,0 +0,0 @@ public class RegionLimitedWorldAccess implements GeneratorAccess {
return i >= ichunkaccess.getPos().x && i <= ichunkaccess1.getPos().x && j >= ichunkaccess.getPos().z && j <= ichunkaccess1.getPos().z;
@@ -0,0 +0,0 @@ public class RegionLimitedWorldAccess implements GeneratorAccessSeed {
return i >= this.n.x && i <= this.o.x && j >= this.n.z && j <= this.o.z;
}
+ // Paper start - if loaded util
@@ -4393,13 +4361,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import org.bukkit.event.block.BlockPhysicsEvent;
// CraftBukkit end
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot
this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper
protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, ResourceKey<DimensionManager> resourcekey1, DimensionManager dimensionmanager, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) {
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((WorldDataServer) worlddatamutable).getName()); // Spigot
- this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper
+ this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig((((WorldDataServer)worlddatamutable).getName()), this.spigotConfig); // Paper
this.generator = gen;
+ if (dimensionmanager.world == null) dimensionmanager.world = (WorldServer) this; // Paper
this.world = new CraftWorld((WorldServer) this, gen, env);
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return (Chunk) this.getChunkAt(i, j, ChunkStatus.FULL);
}
@@ -4408,7 +4377,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Nullable
+ @Override
+ public IChunkAccess getChunkIfLoadedImmediately(int x, int z) {
+ return ((ChunkProviderServer)this.chunkProvider).getChunkAtIfLoadedImmediately(x, z);
+ return ((WorldServer)this).chunkProvider.getChunkAtIfLoadedImmediately(x, z);
+ }
+
+ @Override
@@ -4439,7 +4408,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
@Override
public IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag) {
IChunkAccess ichunkaccess = this.chunkProvider.getChunkAt(i, j, chunkstatus, flag);
IChunkAccess ichunkaccess = this.getChunkProvider().getChunkAt(i, j, chunkstatus, flag);
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public void a(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
@@ -4460,11 +4429,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.b(entity.locX(), entity.locZ());
}
+ public final VoxelShape asVoxelShape(){ return a();} // Paper - OBFHELPER
+
public VoxelShape a() {
return this.i.m();
+ public final VoxelShape asVoxelShape(){ return c();} // Paper - OBFHELPER
public VoxelShape c() {
return this.j.m();
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 GeneratorAccessSeed {
private final Map<UUID, Entity> entitiesByUUID = Maps.newHashMap();
private final Queue<Entity> entitiesToAdd = Queues.newArrayDeque();
private final List<EntityPlayer> players = Lists.newArrayList();
- private final ChunkProviderServer chunkProvider;
+ public final ChunkProviderServer chunkProvider; // Paper - public
boolean tickingEntities;
private final MinecraftServer server;
public final WorldDataServer worldDataServer; // CraftBukkit - type
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -4670,7 +4651,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
@@ -0,0 +0,0 @@ public class DummyGeneratorAccess implements GeneratorAccess {
public boolean a(BlockPosition blockposition, boolean flag, Entity entity) {
public boolean a(BlockPosition blockposition, boolean flag, Entity entity, int i) {
throw new UnsupportedOperationException("Not supported yet.");
}
+