mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-30 20:03:51 -07:00
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/World.java
|
||||
+++ b/net/minecraft/server/World.java
|
||||
@@ -15,6 +15,23 @@
|
||||
@@ -21,6 +21,23 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
+import org.bukkit.generator.ChunkGenerator;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class World implements GeneratorAccess, IIBlockAccess, AutoCloseable {
|
||||
public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAccess, AutoCloseable {
|
||||
|
||||
protected static final Logger e = LogManager.getLogger();
|
||||
@@ -55,7 +72,52 @@
|
||||
@@ -62,7 +79,52 @@
|
||||
private final WorldBorder K;
|
||||
int[] F;
|
||||
int[] E;
|
||||
|
||||
- protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag) {
|
||||
- protected World(IDataManager idatamanager, @Nullable PersistentCollection persistentcollection, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag) {
|
||||
+ // CraftBukkit start Added the following
|
||||
+ private final CraftWorld world;
|
||||
+ public boolean pvpMode;
|
||||
@@ -66,10 +66,10 @@
|
||||
+ }
|
||||
+
|
||||
+ public Chunk getChunkIfLoaded(int x, int z) {
|
||||
+ return ((ChunkProviderServer) this.chunkProvider).getChunkIfLoaded(x, z);
|
||||
+ return ((ChunkProviderServer) this.chunkProvider).getChunkAt(x, z, false, false);
|
||||
+ }
|
||||
+
|
||||
+ protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) {
|
||||
+ protected World(IDataManager idatamanager, @Nullable PersistentCollection persistentcollection, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) {
|
||||
+ this.generator = gen;
|
||||
+ this.world = new CraftWorld((WorldServer) this, gen, env);
|
||||
+ this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
|
||||
@@ -78,7 +78,7 @@
|
||||
this.v = Lists.newArrayList(new IWorldAccess[] { this.u});
|
||||
this.allowMonsters = true;
|
||||
this.allowAnimals = true;
|
||||
@@ -66,6 +128,36 @@
|
||||
@@ -74,6 +136,36 @@
|
||||
this.worldProvider = worldprovider;
|
||||
this.isClientSide = flag;
|
||||
this.K = worldprovider.getWorldBorder();
|
||||
@@ -114,8 +114,8 @@
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public GeneratorAccess b() {
|
||||
@@ -138,6 +230,26 @@
|
||||
public BiomeBase getBiome(BlockPosition blockposition) {
|
||||
@@ -148,6 +240,26 @@
|
||||
}
|
||||
|
||||
public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) {
|
||||
@@ -142,7 +142,7 @@
|
||||
if (k(blockposition)) {
|
||||
return false;
|
||||
} else if (!this.isClientSide && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
|
||||
@@ -145,9 +257,23 @@
|
||||
@@ -155,9 +267,23 @@
|
||||
} else {
|
||||
Chunk chunk = this.getChunkAtWorldCoords(blockposition);
|
||||
Block block = iblockdata.getBlock();
|
||||
@@ -166,7 +166,7 @@
|
||||
return false;
|
||||
} else {
|
||||
IBlockData iblockdata2 = this.getType(blockposition);
|
||||
@@ -158,6 +284,7 @@
|
||||
@@ -168,6 +294,7 @@
|
||||
this.methodProfiler.e();
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@
|
||||
if (iblockdata2 == iblockdata) {
|
||||
if (iblockdata1 != iblockdata2) {
|
||||
this.a(blockposition, blockposition);
|
||||
@@ -182,12 +309,63 @@
|
||||
@@ -192,12 +319,63 @@
|
||||
iblockdata.b(this, blockposition, j);
|
||||
}
|
||||
}
|
||||
@@ -238,7 +238,7 @@
|
||||
public boolean setAir(BlockPosition blockposition) {
|
||||
Fluid fluid = this.b(blockposition);
|
||||
|
||||
@@ -224,6 +402,11 @@
|
||||
@@ -234,6 +412,11 @@
|
||||
|
||||
public void update(BlockPosition blockposition, Block block) {
|
||||
if (this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) {
|
||||
@@ -250,7 +250,7 @@
|
||||
this.applyPhysics(blockposition, block);
|
||||
}
|
||||
|
||||
@@ -299,6 +482,17 @@
|
||||
@@ -309,6 +492,17 @@
|
||||
IBlockData iblockdata = this.getType(blockposition);
|
||||
|
||||
try {
|
||||
@@ -268,16 +268,16 @@
|
||||
iblockdata.doPhysics(this, blockposition, block, blockposition1);
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours");
|
||||
@@ -307,7 +501,7 @@
|
||||
@@ -317,7 +511,7 @@
|
||||
crashreportsystemdetails.a("Source block type", () -> {
|
||||
try {
|
||||
return String.format("ID #%s (%s // %s)", new Object[] { Block.REGISTRY.b(block), block.m(), block.getClass().getCanonicalName()});
|
||||
return String.format("ID #%s (%s // %s)", new Object[] { IRegistry.BLOCK.getKey(block), block.m(), block.getClass().getCanonicalName()});
|
||||
- } catch (Throwable throwable) {
|
||||
+ } catch (Throwable throwablex) { // CraftBukkit - decompile error
|
||||
return "ID #" + Block.REGISTRY.b(block);
|
||||
return "ID #" + IRegistry.BLOCK.getKey(block);
|
||||
}
|
||||
});
|
||||
@@ -393,6 +587,17 @@
|
||||
@@ -403,6 +597,17 @@
|
||||
}
|
||||
|
||||
public IBlockData getType(BlockPosition blockposition) {
|
||||
@@ -295,7 +295,7 @@
|
||||
if (k(blockposition)) {
|
||||
return Blocks.VOID_AIR.getBlockData();
|
||||
} else {
|
||||
@@ -639,6 +844,42 @@
|
||||
@@ -649,6 +854,42 @@
|
||||
}
|
||||
|
||||
public boolean addEntity(Entity entity) {
|
||||
@@ -338,7 +338,7 @@
|
||||
int i = MathHelper.floor(entity.locX / 16.0D);
|
||||
int j = MathHelper.floor(entity.locZ / 16.0D);
|
||||
boolean flag = entity.attachedToPlayer;
|
||||
@@ -669,6 +910,7 @@
|
||||
@@ -679,6 +920,7 @@
|
||||
((IWorldAccess) this.v.get(i)).a(entity);
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@
|
||||
}
|
||||
|
||||
protected void c(Entity entity) {
|
||||
@@ -676,6 +918,7 @@
|
||||
@@ -686,6 +928,7 @@
|
||||
((IWorldAccess) this.v.get(i)).b(entity);
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@
|
||||
}
|
||||
|
||||
public void kill(Entity entity) {
|
||||
@@ -711,7 +954,15 @@
|
||||
@@ -721,7 +964,15 @@
|
||||
this.getChunkAt(i, j).b(entity);
|
||||
}
|
||||
|
||||
@@ -371,7 +371,7 @@
|
||||
this.c(entity);
|
||||
}
|
||||
|
||||
@@ -746,6 +997,11 @@
|
||||
@@ -756,6 +1007,11 @@
|
||||
|
||||
for (i = 0; i < this.k.size(); ++i) {
|
||||
entity = (Entity) this.k.get(i);
|
||||
@@ -383,7 +383,7 @@
|
||||
|
||||
try {
|
||||
++entity.ticksLived;
|
||||
@@ -794,8 +1050,10 @@
|
||||
@@ -804,8 +1060,10 @@
|
||||
CrashReportSystemDetails crashreportsystemdetails1;
|
||||
CrashReport crashreport1;
|
||||
|
||||
@@ -396,7 +396,7 @@
|
||||
Entity entity1 = entity.getVehicle();
|
||||
|
||||
if (entity1 != null) {
|
||||
@@ -828,7 +1086,7 @@
|
||||
@@ -838,7 +1096,7 @@
|
||||
this.getChunkAt(j, l).b(entity);
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@
|
||||
this.c(entity);
|
||||
}
|
||||
|
||||
@@ -883,9 +1141,11 @@
|
||||
@@ -893,9 +1151,11 @@
|
||||
TileEntity tileentity1 = (TileEntity) this.c.get(i1);
|
||||
|
||||
if (!tileentity1.x()) {
|
||||
@@ -417,7 +417,7 @@
|
||||
|
||||
if (this.isLoaded(tileentity1.getPosition())) {
|
||||
Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition());
|
||||
@@ -893,6 +1153,12 @@
|
||||
@@ -903,6 +1163,12 @@
|
||||
|
||||
chunk.a(tileentity1.getPosition(), tileentity1);
|
||||
this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3);
|
||||
@@ -430,7 +430,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -946,15 +1212,13 @@
|
||||
@@ -956,15 +1222,13 @@
|
||||
int i;
|
||||
int j;
|
||||
|
||||
@@ -452,15 +452,15 @@
|
||||
|
||||
entity.N = entity.locX;
|
||||
entity.O = entity.locY;
|
||||
@@ -970,6 +1234,7 @@
|
||||
return ((MinecraftKey) EntityTypes.REGISTRY.b(entity.P())).toString();
|
||||
@@ -980,6 +1244,7 @@
|
||||
return IRegistry.ENTITY_TYPE.getKey(entity.P()).toString();
|
||||
});
|
||||
entity.tick();
|
||||
+ entity.postTick(); // CraftBukkit
|
||||
this.methodProfiler.e();
|
||||
}
|
||||
}
|
||||
@@ -1300,11 +1565,18 @@
|
||||
@@ -1310,11 +1575,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@
|
||||
TileEntity tileentity = null;
|
||||
|
||||
if (this.J) {
|
||||
@@ -1339,6 +1611,14 @@
|
||||
@@ -1349,6 +1621,14 @@
|
||||
public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) {
|
||||
if (!k(blockposition)) {
|
||||
if (tileentity != null && !tileentity.x()) {
|
||||
@@ -494,7 +494,7 @@
|
||||
if (this.J) {
|
||||
tileentity.setPosition(blockposition);
|
||||
Iterator iterator = this.c.iterator();
|
||||
@@ -1498,6 +1778,14 @@
|
||||
@@ -1509,6 +1789,14 @@
|
||||
}
|
||||
|
||||
this.p = MathHelper.a(this.p, 0.0F, 1.0F);
|
||||
@@ -509,7 +509,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1583,7 +1871,10 @@
|
||||
@@ -1594,7 +1882,10 @@
|
||||
}
|
||||
|
||||
public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) {
|
||||
@@ -521,7 +521,16 @@
|
||||
return false;
|
||||
} else {
|
||||
int i = 0;
|
||||
@@ -1754,7 +2045,7 @@
|
||||
@@ -1737,7 +2028,7 @@
|
||||
}
|
||||
|
||||
public Stream<VoxelShape> a(@Nullable Entity entity, VoxelShape voxelshape, VoxelShape voxelshape1, Set<Entity> set) {
|
||||
- Stream stream = super.a(entity, voxelshape, voxelshape1, set);
|
||||
+ Stream stream = IIBlockAccess.super.a(entity, voxelshape, voxelshape1, set); // CraftBukkit - decompile error
|
||||
|
||||
return entity == null ? stream : Stream.concat(stream, this.a(entity, voxelshape, set));
|
||||
}
|
||||
@@ -1767,7 +2058,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
@@ -530,7 +539,7 @@
|
||||
arraylist.add(entity);
|
||||
}
|
||||
}
|
||||
@@ -1769,7 +2060,7 @@
|
||||
@@ -1782,7 +2073,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
@@ -539,7 +548,7 @@
|
||||
arraylist.add(entity);
|
||||
}
|
||||
}
|
||||
@@ -1818,7 +2109,7 @@
|
||||
@@ -1831,7 +2122,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -548,7 +557,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1839,8 +2130,17 @@
|
||||
@@ -1852,8 +2143,16 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
@@ -560,34 +569,13 @@
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- if ((!(entity instanceof EntityInsentient) || !((EntityInsentient) entity).isPersistent()) && oclass.isAssignableFrom(entity.getClass())) {
|
||||
+ if (oclass.isAssignableFrom(entity.getClass())) {
|
||||
+ // if ((!(entity instanceof EntityInsentient) || !((EntityInsentient) entity).isPersistent()) && oclass.isAssignableFrom(entity.getClass())) {
|
||||
- if (!(entity instanceof EntityInsentient) || !((EntityInsentient) entity).isPersistent()) {
|
||||
+ if (true || !(entity instanceof EntityInsentient) || !((EntityInsentient) entity).isPersistent()) {
|
||||
+ // CraftBukkit end
|
||||
++i;
|
||||
}
|
||||
}
|
||||
@@ -1849,12 +2149,18 @@
|
||||
}
|
||||
|
||||
public void a(Collection<Entity> collection) {
|
||||
- this.entityList.addAll(collection);
|
||||
+ // CraftBukkit start
|
||||
+ // this.entityList.addAll(collection);
|
||||
Iterator iterator = collection.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
+ if (entity == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ this.entityList.add(entity);
|
||||
+ // CraftBukkit end
|
||||
this.b(entity);
|
||||
}
|
||||
|
||||
@@ -1958,6 +2264,11 @@
|
||||
if (oclass.isAssignableFrom(entity.getClass())) {
|
||||
++j;
|
||||
}
|
||||
@@ -1972,6 +2271,11 @@
|
||||
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
|
||||
@@ -599,7 +587,7 @@
|
||||
|
||||
if (predicate.test(entityhuman1)) {
|
||||
double d5 = entityhuman1.d(d0, d1, d2);
|
||||
@@ -2126,6 +2437,16 @@
|
||||
@@ -2164,6 +2468,16 @@
|
||||
|
||||
public void everyoneSleeping() {}
|
||||
|
||||
@@ -616,7 +604,7 @@
|
||||
public float g(float f) {
|
||||
return (this.q + (this.r - this.q) * f) * this.i(f);
|
||||
}
|
||||
@@ -2300,7 +2621,7 @@
|
||||
@@ -2325,7 +2639,7 @@
|
||||
int l = j * 16 + 8 - blockposition.getZ();
|
||||
boolean flag = true;
|
||||
|
||||
@@ -624,4 +612,4 @@
|
||||
+ return k >= -128 && k <= 128 && l >= -128 && l <= 128 && this.keepSpawnInMemory; // CraftBukkit - Added 'this.keepSpawnInMemory'
|
||||
}
|
||||
|
||||
public void a(Packet<?> packet) {
|
||||
public LongSet ag() {
|
||||
|
Reference in New Issue
Block a user