mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
Latest progress - restored patches, some issues resolved
This commit is contained in:
parent
bc5acdddad
commit
fe2a0ea500
34 changed files with 338 additions and 478 deletions
|
@ -56,14 +56,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||||
+++ b/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 {
|
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||||
|
public final Convertable.ConversionSession convertable;
|
||||||
public final UUID uuid;
|
public final UUID uuid;
|
||||||
|
|
||||||
boolean hasPhysicsEvent = true; // Paper
|
boolean hasPhysicsEvent = true; // Paper
|
||||||
+ private static Throwable getAddToWorldStackTrace(Entity entity) {
|
+ private static Throwable getAddToWorldStackTrace(Entity entity) {
|
||||||
+ return new Throwable(entity + " Added to world at " + new java.util.Date());
|
+ return new Throwable(entity + " Added to world at " + new java.util.Date());
|
||||||
+ }
|
+ }
|
||||||
|
|
||||||
public Chunk getChunkIfLoaded(int x, int z) {
|
@Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
|
||||||
return this.chunkProvider.getChunkAt(x, z, false);
|
return this.chunkProvider.getChunkAt(x, z, false);
|
||||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
|
|
|
@ -17,8 +17,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ public boolean isLoadedAndInBounds(BlockPosition blockposition) {
|
+ public boolean isLoadedAndInBounds(BlockPosition blockposition) {
|
||||||
+ return getWorldBorder().isInBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null;
|
+ return getWorldBorder().isInBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null;
|
||||||
+ }
|
+ }
|
||||||
+ public Chunk getChunkIfLoaded(BlockPosition blockposition) {
|
+
|
||||||
+ return getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
+ public Chunk getChunkIfLoaded(int x, int z) {
|
||||||
|
+ return ((WorldServer) this).getChunkProvider().getChunkAtIfLoadedImmediately(x, z);
|
||||||
|
+ }
|
||||||
|
+ public final Chunk getChunkIfLoaded(BlockPosition blockposition) {
|
||||||
|
+ return ((WorldServer) this).getChunkProvider().getChunkAtIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ // reduces need to do isLoaded before getType
|
+ // reduces need to do isLoaded before getType
|
||||||
|
@ -40,3 +44,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
public boolean a(BlockPosition blockposition) {
|
public boolean a(BlockPosition blockposition) {
|
||||||
return (double) (blockposition.getX() + 1) > this.e() && (double) blockposition.getX() < this.g() && (double) (blockposition.getZ() + 1) > this.f() && (double) blockposition.getZ() < this.h();
|
return (double) (blockposition.getX() + 1) > this.e() && (double) blockposition.getX() < this.g() && (double) (blockposition.getZ() + 1) > this.f() && (double) blockposition.getZ() < this.h();
|
||||||
}
|
}
|
||||||
|
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 {
|
||||||
|
public final Convertable.ConversionSession convertable;
|
||||||
|
public final UUID uuid;
|
||||||
|
|
||||||
|
- public Chunk getChunkIfLoaded(int x, int z) {
|
||||||
|
+ @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
|
||||||
|
return this.chunkProvider.getChunkAt(x, z, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,3 +46,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
this.world = worldserver;
|
this.world = worldserver;
|
||||||
if (nbttagcompound.hasKeyOfType("DragonKilled", 99)) {
|
if (nbttagcompound.hasKeyOfType("DragonKilled", 99)) {
|
||||||
if (nbttagcompound.b("Dragon")) {
|
if (nbttagcompound.b("Dragon")) {
|
||||||
|
@@ -0,0 +0,0 @@ public class EnderDragonBattle {
|
||||||
|
|
||||||
|
private void a(BlockPosition blockposition) {
|
||||||
|
this.world.triggerEffect(3000, blockposition, 0);
|
||||||
|
- WorldGenerator.END_GATEWAY.b((WorldGenFeatureConfiguration) WorldGenEndGatewayConfiguration.a()).a(this.world, this.world.getStructureManager(), this.world.getChunkProvider().getChunkGenerator(), new Random(), blockposition);
|
||||||
|
+ WorldGenerator.END_GATEWAY.b(WorldGenEndGatewayConfiguration.a()).a(this.world, this.world.getStructureManager(), this.world.getChunkProvider().getChunkGenerator(), new Random(), blockposition); // Paper - decompile error
|
||||||
|
}
|
||||||
|
|
||||||
|
private void a(boolean flag) {
|
||||||
|
@@ -0,0 +0,0 @@ public class EnderDragonBattle {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- worldgenendtrophy.b((WorldGenFeatureConfiguration) WorldGenFeatureConfiguration.k).a(this.world, this.world.getStructureManager(), this.world.getChunkProvider().getChunkGenerator(), new Random(), this.exitPortalLocation);
|
||||||
|
+ worldgenendtrophy.b(WorldGenFeatureConfiguration.k).a(this.world, this.world.getStructureManager(), this.world.getChunkProvider().getChunkGenerator(), new Random(), this.exitPortalLocation); // Paper - decompile error
|
||||||
|
}
|
||||||
|
|
||||||
|
private EntityEnderDragon o() {
|
||||||
|
|
|
@ -1,164 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Riley Park <rileysebastianpark@gmail.com>
|
|
||||||
Date: Wed, 15 Aug 2018 01:26:09 -0700
|
|
||||||
Subject: [PATCH] Allow disabling armour stand ticking
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
||||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
|
||||||
private void armorStandEntityLookups() {
|
|
||||||
armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true);
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ public boolean armorStandTick = true;
|
|
||||||
+ private void armorStandTick() {
|
|
||||||
+ this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick);
|
|
||||||
+ log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default");
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
|
|
||||||
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
|
|
||||||
public Vector3f leftLegPose;
|
|
||||||
public Vector3f rightLegPose;
|
|
||||||
public boolean canMove = true; // Paper
|
|
||||||
+ // Paper start - Allow ArmorStands not to tick
|
|
||||||
+ public boolean canTick = true;
|
|
||||||
+ public boolean canTickSetByAPI = false;
|
|
||||||
+ private boolean noTickPoseDirty = false;
|
|
||||||
+ private boolean noTickEquipmentDirty = false;
|
|
||||||
+ // Paper end
|
|
||||||
|
|
||||||
public EntityArmorStand(EntityTypes<? extends EntityArmorStand> entitytypes, World world) {
|
|
||||||
super(entitytypes, world);
|
|
||||||
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
|
|
||||||
this.rightArmPose = EntityArmorStand.bt;
|
|
||||||
this.leftLegPose = EntityArmorStand.bu;
|
|
||||||
this.rightLegPose = EntityArmorStand.bv;
|
|
||||||
+ if (world != null) this.canTick = world.paperConfig.armorStandTick; // Paper - armour stand ticking
|
|
||||||
this.G = 0.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
|
|
||||||
this.armorItems.set(enumitemslot.b(), itemstack);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ this.noTickEquipmentDirty = true; // Paper - Allow equipment to be updated even when tick disabled
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
|
|
||||||
}
|
|
||||||
|
|
||||||
nbttagcompound.set("Pose", this.B());
|
|
||||||
+ if (this.canTickSetByAPI) nbttagcompound.setBoolean("Paper.CanTickOverride", this.canTick); // Paper - persist no tick setting
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
|
|
||||||
this.setBasePlate(nbttagcompound.getBoolean("NoBasePlate"));
|
|
||||||
this.setMarker(nbttagcompound.getBoolean("Marker"));
|
|
||||||
this.noclip = !this.A();
|
|
||||||
+ // Paper start - persist no tick
|
|
||||||
+ if (nbttagcompound.hasKey("Paper.CanTickOverride")) {
|
|
||||||
+ this.canTick = nbttagcompound.getBoolean("Paper.CanTickOverride");
|
|
||||||
+ this.canTickSetByAPI = true;
|
|
||||||
+ }
|
|
||||||
+ // Paper end
|
|
||||||
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Pose");
|
|
||||||
|
|
||||||
this.g(nbttagcompound1);
|
|
||||||
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void tick() {
|
|
||||||
+ // Paper start
|
|
||||||
+ if (!this.canTick) {
|
|
||||||
+ if (this.noTickPoseDirty) {
|
|
||||||
+ this.noTickPoseDirty = false;
|
|
||||||
+ this.updatePose();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (this.noTickEquipmentDirty) {
|
|
||||||
+ this.noTickEquipmentDirty = false;
|
|
||||||
+ this.updateEntityEquipment();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ // Paper end
|
|
||||||
+
|
|
||||||
super.tick();
|
|
||||||
+ // Paper start - Split into separate method
|
|
||||||
+ updatePose();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public void updatePose() {
|
|
||||||
+ // Paper end
|
|
||||||
Vector3f vector3f = (Vector3f) this.datawatcher.get(EntityArmorStand.c);
|
|
||||||
|
|
||||||
if (!this.headPose.equals(vector3f)) {
|
|
||||||
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
|
|
||||||
public void setHeadPose(Vector3f vector3f) {
|
|
||||||
this.headPose = vector3f;
|
|
||||||
this.datawatcher.set(EntityArmorStand.c, vector3f);
|
|
||||||
+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBodyPose(Vector3f vector3f) {
|
|
||||||
this.bodyPose = vector3f;
|
|
||||||
this.datawatcher.set(EntityArmorStand.d, vector3f);
|
|
||||||
+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLeftArmPose(Vector3f vector3f) {
|
|
||||||
this.leftArmPose = vector3f;
|
|
||||||
this.datawatcher.set(EntityArmorStand.e, vector3f);
|
|
||||||
+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRightArmPose(Vector3f vector3f) {
|
|
||||||
this.rightArmPose = vector3f;
|
|
||||||
this.datawatcher.set(EntityArmorStand.f, vector3f);
|
|
||||||
+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLeftLegPose(Vector3f vector3f) {
|
|
||||||
this.leftLegPose = vector3f;
|
|
||||||
this.datawatcher.set(EntityArmorStand.g, vector3f);
|
|
||||||
+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRightLegPose(Vector3f vector3f) {
|
|
||||||
this.rightLegPose = vector3f;
|
|
||||||
this.datawatcher.set(EntityArmorStand.bo, vector3f);
|
|
||||||
+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vector3f r() {
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
|
|
||||||
@@ -0,0 +0,0 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
|
|
||||||
public boolean isSlotDisabled(org.bukkit.inventory.EquipmentSlot slot) {
|
|
||||||
return getHandle().isSlotDisabled(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot));
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public boolean canTick() {
|
|
||||||
+ return this.getHandle().canTick;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public void setCanTick(final boolean tick) {
|
|
||||||
+ this.getHandle().canTick = tick;
|
|
||||||
+ this.getHandle().canTickSetByAPI = true;
|
|
||||||
+ }
|
|
||||||
// Paper end
|
|
||||||
}
|
|
|
@ -197,7 +197,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ IBlockData blockData = ChunkSection.GLOBAL_PALETTE.getObject(i);
|
+ IBlockData blockData = ChunkSection.GLOBAL_PALETTE.getObject(i);
|
||||||
+
|
+
|
||||||
+ if (blockData != null) {
|
+ if (blockData != null) {
|
||||||
+ solidGlobal[i] = blockData.getBlock().isOccluding(blockData, emptyChunk, zeroPos)
|
+ solidGlobal[i] = blockData.isOccluding(emptyChunk, zeroPos)
|
||||||
+ && blockData.getBlock() != Blocks.SPAWNER && blockData.getBlock() != Blocks.BARRIER && blockData.getBlock() != Blocks.SHULKER_BOX;
|
+ && blockData.getBlock() != Blocks.SPAWNER && blockData.getBlock() != Blocks.BARRIER && blockData.getBlock() != Blocks.SHULKER_BOX;
|
||||||
+ // shulker box checks TE.
|
+ // shulker box checks TE.
|
||||||
+ }
|
+ }
|
||||||
|
|
|
@ -140,7 +140,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ public final Timing chunkUnloadDataSave;
|
+ public final Timing chunkUnloadDataSave;
|
||||||
+
|
+
|
||||||
public WorldTimingsHandler(World server) {
|
public WorldTimingsHandler(World server) {
|
||||||
String name = server.worldData.getName() +" - ";
|
String name = server.getWorld().getName() +" - ";
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class WorldTimingsHandler {
|
@@ -0,0 +0,0 @@ public class WorldTimingsHandler {
|
||||||
|
|
||||||
|
@ -341,7 +341,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+package com.destroystokyo.paper.io;
|
+package com.destroystokyo.paper.io;
|
||||||
+
|
+
|
||||||
+import net.minecraft.server.ChunkCoordIntPair;
|
+import net.minecraft.server.ChunkCoordIntPair;
|
||||||
+import net.minecraft.server.ExceptionWorldConflict;
|
|
||||||
+import net.minecraft.server.MinecraftServer;
|
+import net.minecraft.server.MinecraftServer;
|
||||||
+import net.minecraft.server.NBTTagCompound;
|
+import net.minecraft.server.NBTTagCompound;
|
||||||
+import net.minecraft.server.RegionFile;
|
+import net.minecraft.server.RegionFile;
|
||||||
|
@ -882,15 +881,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ // check if another process is writing
|
+ // check if another process is writing
|
||||||
+ try {
|
+ /*try { TODO: Can we restore this?
|
||||||
+ this.world.checkSession();
|
+ ((WorldServer)this.world).checkSession();
|
||||||
+ } catch (final ExceptionWorldConflict ex) {
|
+ } catch (final Exception ex) {
|
||||||
+ LOGGER.fatal("Couldn't save chunk; already in use by another instance of Minecraft?", ex);
|
+ LOGGER.fatal("Couldn't save chunk; already in use by another instance of Minecraft?", ex);
|
||||||
+ // we don't need to set the write counter to -1 as we know at this stage there's no point in re-scheduling
|
+ // we don't need to set the write counter to -1 as we know at this stage there's no point in re-scheduling
|
||||||
+ // writes since they'll fail anyways.
|
+ // writes since they'll fail anyways.
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+
|
+*/
|
||||||
+ for (;;) {
|
+ for (;;) {
|
||||||
+ final long writeCounter;
|
+ final long writeCounter;
|
||||||
+ final NBTTagCompound data;
|
+ final NBTTagCompound data;
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||||
|
Date: Wed, 10 Oct 2018 21:22:44 -0500
|
||||||
|
Subject: [PATCH] Check Drowned for Villager Aggression Config
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/EntityDrowned.java b/src/main/java/net/minecraft/server/EntityDrowned.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/EntityDrowned.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/EntityDrowned.java
|
||||||
|
@@ -0,0 +0,0 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity {
|
||||||
|
this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D));
|
||||||
|
this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityDrowned.class})).a(EntityPigZombie.class));
|
||||||
|
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::j));
|
||||||
|
- this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false));
|
||||||
|
+ if ( world.spigotConfig.zombieAggressiveTowardsVillager ) this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)); // Paper
|
||||||
|
this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, true));
|
||||||
|
this.targetSelector.a(5, new PathfinderGoalNearestAttackableTarget<>(this, EntityTurtle.class, 10, true, false, EntityTurtle.bv));
|
||||||
|
}
|
|
@ -320,7 +320,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ return Integer.compare(v1.location.z, v2.location.z);
|
+ return Integer.compare(v1.location.z, v2.location.z);
|
||||||
+ });
|
+ });
|
||||||
+
|
+
|
||||||
+ worldData.addProperty("name", world.getWorldData().getName());
|
+ worldData.addProperty("name", world.getWorld().getName());
|
||||||
+ worldData.addProperty("view-distance", world.spigotConfig.viewDistance);
|
+ worldData.addProperty("view-distance", world.spigotConfig.viewDistance);
|
||||||
+ worldData.addProperty("keep-spawn-loaded", world.keepSpawnInMemory);
|
+ worldData.addProperty("keep-spawn-loaded", world.keepSpawnInMemory);
|
||||||
+ worldData.addProperty("keep-spawn-loaded-range", world.paperConfig.keepLoadedRange);
|
+ worldData.addProperty("keep-spawn-loaded-range", world.paperConfig.keepLoadedRange);
|
||||||
|
|
|
@ -55,7 +55,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ worldserver.addTicketsForSpawn(radiusBlocks, blockposition);
|
+ worldserver.addTicketsForSpawn(radiusBlocks, blockposition);
|
||||||
}
|
}
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
+ LOGGER.info("Loaded " + chunkproviderserver.b() + " spawn chunks for world " + worldserver.getWorldData().getName()); // Paper
|
+ LOGGER.info("Loaded " + chunkproviderserver.b() + " spawn chunks for world " + worldserver.getWorld().getName()); // Paper
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
// this.nextTick = SystemUtils.getMonotonicMillis() + 10L;
|
// this.nextTick = SystemUtils.getMonotonicMillis() + 10L;
|
||||||
|
|
|
@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||||
this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick);
|
private void armorStandEntityLookups() {
|
||||||
log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default");
|
armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true);
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ public int waterOverLavaFlowSpeed;
|
+ public int waterOverLavaFlowSpeed;
|
||||||
|
|
|
@ -13,18 +13,6 @@ Adds water Mobs to activation range config and nerfs fish
|
||||||
Adds flying monsters to control ghast and phantoms
|
Adds flying monsters to control ghast and phantoms
|
||||||
Adds villagers as separate config
|
Adds villagers as separate config
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/BehaviorController.java b/src/main/java/net/minecraft/server/BehaviorController.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/BehaviorController.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/BehaviorController.java
|
|
||||||
@@ -0,0 +0,0 @@ public class BehaviorController<E extends EntityLiving> {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
+ public boolean hasActivity(Activity activity) { return c(activity); } // Paper - OBFHELPER
|
|
||||||
public boolean c(Activity activity) {
|
|
||||||
return this.j.contains(activity);
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||||
|
@ -636,14 +624,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
+ if (config.villagersActiveForPanic) {
|
+ if (config.villagersActiveForPanic) {
|
||||||
+ for (Activity activity : VILLAGER_PANIC_IMMUNITIES) {
|
+ for (Activity activity : VILLAGER_PANIC_IMMUNITIES) {
|
||||||
+ if (behaviorController.hasActivity(activity)) {
|
+ if (behaviorController.c(activity)) {
|
||||||
+ return 20*5;
|
+ return 20*5;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (config.villagersWorkImmunityAfter > 0 && inactiveFor >= config.villagersWorkImmunityAfter) {
|
+ if (config.villagersWorkImmunityAfter > 0 && inactiveFor >= config.villagersWorkImmunityAfter) {
|
||||||
+ if (behaviorController.hasActivity(Activity.WORK)) {
|
+ if (behaviorController.c(Activity.WORK)) {
|
||||||
+ return config.villagersWorkImmunityFor;
|
+ return config.villagersWorkImmunityFor;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
|
|
@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only
|
public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only
|
||||||
public boolean forceExplosionKnockback; // SPIGOT-949
|
public boolean forceExplosionKnockback; // SPIGOT-949
|
||||||
public Timing tickTimer = MinecraftTimings.getEntityTimings(this); // Paper
|
public Timing tickTimer = MinecraftTimings.getEntityTimings(this); // Paper
|
||||||
+ public Location origin; // Paper
|
+ public org.bukkit.Location origin; // Paper
|
||||||
// Spigot start
|
// Spigot start
|
||||||
public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
|
public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
|
||||||
public final boolean defaultActivationState;
|
public final boolean defaultActivationState;
|
||||||
|
@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ // Paper start - Restore the entity's origin location
|
+ // Paper start - Restore the entity's origin location
|
||||||
+ NBTTagList originTag = nbttagcompound.getList("Paper.Origin", 6);
|
+ NBTTagList originTag = nbttagcompound.getList("Paper.Origin", 6);
|
||||||
+ if (!originTag.isEmpty()) {
|
+ if (!originTag.isEmpty()) {
|
||||||
+ origin = new Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2));
|
+ origin = new org.bukkit.Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2));
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
+
|
+
|
||||||
|
|
|
@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||||
if (!originTag.isEmpty()) {
|
if (!originTag.isEmpty()) {
|
||||||
origin = new Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2));
|
origin = new org.bukkit.Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2));
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ spawnedViaMobSpawner = nbttagcompound.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
|
+ spawnedViaMobSpawner = nbttagcompound.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
|
||||||
|
|
|
@ -94,10 +94,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ }
|
+ }
|
||||||
+ lightengine.a(world.paperConfig.lightQueueSize + 16 * 256); // ensure full chunk can fit into queue
|
+ lightengine.a(world.paperConfig.lightQueueSize + 16 * 256); // ensure full chunk can fit into queue
|
||||||
+ sender.sendMessage("Updating Light " + coord);
|
+ sender.sendMessage("Updating Light " + coord);
|
||||||
|
+ int cx = chunk.getPos().x << 4;
|
||||||
|
+ int cz = chunk.getPos().z << 4;
|
||||||
+ for (int y = 0; y < world.getHeight(); y++) {
|
+ for (int y = 0; y < world.getHeight(); y++) {
|
||||||
+ for (int x = 0; x < 16; x++) {
|
+ for (int x = 0; x < 16; x++) {
|
||||||
+ for (int z = 0; z < 16; z++) {
|
+ for (int z = 0; z < 16; z++) {
|
||||||
+ BlockPosition pos = new BlockPosition(chunk.getPos().getBlockX() + x, y, chunk.getPos().getBlockZ() + z);
|
+ BlockPosition pos = new BlockPosition(cx + x, y, cz + z);
|
||||||
+ lightengine.a(pos);
|
+ lightengine.a(pos);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
@ -107,7 +109,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ if (visibleChunk != null) {
|
+ if (visibleChunk != null) {
|
||||||
+ world.getChunkProvider().playerChunkMap.addLightTask(visibleChunk, () -> {
|
+ world.getChunkProvider().playerChunkMap.addLightTask(visibleChunk, () -> {
|
||||||
+ MinecraftServer.getServer().processQueue.add(() -> {
|
+ MinecraftServer.getServer().processQueue.add(() -> {
|
||||||
+ visibleChunk.sendPacketToTrackedPlayers(new PacketPlayOutLightUpdate(chunk.getPos(), lightengine), false);
|
+ visibleChunk.sendPacketToTrackedPlayers(new PacketPlayOutLightUpdate(chunk.getPos(), lightengine, true), false);
|
||||||
+ updateLight(sender, world, lightengine, queue);
|
+ updateLight(sender, world, lightengine, queue);
|
||||||
+ });
|
+ });
|
||||||
+ });
|
+ });
|
||||||
|
|
38
Spigot-Server-Patches/Here-s-Johnny.patch
Normal file
38
Spigot-Server-Patches/Here-s-Johnny.patch
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||||
|
Date: Fri, 12 Oct 2018 01:37:22 -0500
|
||||||
|
Subject: [PATCH] Here's Johnny!
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/EntityVindicator.java b/src/main/java/net/minecraft/server/EntityVindicator.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/EntityVindicator.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/EntityVindicator.java
|
||||||
|
@@ -0,0 +0,0 @@ public class EntityVindicator extends EntityIllagerAbstract {
|
||||||
|
private static final Predicate<EnumDifficulty> b = (enumdifficulty) -> {
|
||||||
|
return enumdifficulty == EnumDifficulty.NORMAL || enumdifficulty == EnumDifficulty.HARD;
|
||||||
|
};
|
||||||
|
- private boolean bv;
|
||||||
|
+ private boolean bv; public boolean isJohnny() { return bv; } public void setJohnny(boolean johnny) { bv = johnny; } // Paper - OBFHELPER
|
||||||
|
|
||||||
|
public EntityVindicator(EntityTypes<? extends EntityVindicator> entitytypes, World world) {
|
||||||
|
super(entitytypes, world);
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java
|
||||||
|
@@ -0,0 +0,0 @@ public class CraftVindicator extends CraftIllager implements Vindicator {
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.VINDICATOR;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // Paper start
|
||||||
|
+ public boolean isJohnny() {
|
||||||
|
+ return getHandle().isJohnny();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setJohnny(boolean johnny) {
|
||||||
|
+ getHandle().setJohnny(johnny);
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
}
|
|
@ -5,10 +5,68 @@ Subject: [PATCH] Implement EntityKnockbackByEntityEvent
|
||||||
|
|
||||||
This event is called when an entity receives knockback by another entity.
|
This event is called when an entity receives knockback by another entity.
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||||
|
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
|
||||||
|
if (flag5) {
|
||||||
|
if (i > 0) {
|
||||||
|
if (entity instanceof EntityLiving) {
|
||||||
|
+ ((EntityLiving) entity).knockingBackEntity = this; // Paper
|
||||||
|
((EntityLiving) entity).a((float) i * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)));
|
||||||
|
+ ((EntityLiving) entity).knockingBackEntity = null; // Paper
|
||||||
|
} else {
|
||||||
|
entity.h((double) (-MathHelper.sin(this.yaw * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 0.017453292F) * (float) i * 0.5F));
|
||||||
|
}
|
||||||
|
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
|
||||||
|
if (entityliving != this && entityliving != entity && !this.r(entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.h((Entity) entityliving) < 9.0D) {
|
||||||
|
// CraftBukkit start - Only apply knockback if the damage hits
|
||||||
|
if (entityliving.damageEntity(DamageSource.playerAttack(this).sweep(), f4)) {
|
||||||
|
+ ((EntityLiving) entity).knockingBackEntity = this; // Paper
|
||||||
|
entityliving.a(0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)));
|
||||||
|
+ ((EntityLiving) entity).knockingBackEntity = null; // Paper
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||||
|
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||||
|
|
||||||
|
if (flag) {
|
||||||
|
if (f1 > 0.0F && entity instanceof EntityLiving) {
|
||||||
|
+ ((EntityLiving) entity).knockingBackEntity = this; // Paper
|
||||||
|
((EntityLiving) entity).a(f1 * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)));
|
||||||
|
+ ((EntityLiving) entity).knockingBackEntity = null; // Paper
|
||||||
|
this.setMot(this.getMot().d(0.6D, 1.0D, 0.6D));
|
||||||
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||||
+++ b/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 {
|
||||||
|
}
|
||||||
|
|
||||||
|
this.aw = (float) (MathHelper.d(d1, d0) * 57.2957763671875D - (double) this.yaw);
|
||||||
|
+ this.knockingBackEntity = entity1 instanceof EntityLiving ? ((EntityLiving) entity1) : null; // Paper
|
||||||
|
this.a(0.4F, d0, d1);
|
||||||
|
+ this.knockingBackEntity = null; // Paper
|
||||||
|
} else {
|
||||||
|
this.aw = (float) ((int) (Math.random() * 2.0D) * 180);
|
||||||
|
}
|
||||||
|
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void f(EntityLiving entityliving) {
|
||||||
|
+ ((EntityLiving) entityliving).knockingBackEntity = this; // Paper
|
||||||
|
entityliving.a(0.5F, entityliving.locX() - this.locX(), entityliving.locZ() - this.locZ());
|
||||||
|
+ ((EntityLiving) entityliving).knockingBackEntity = null; // Paper
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean f(DamageSource damagesource) {
|
||||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||||
Vec3D vec3d1 = (new Vec3D(d0, 0.0D, d1)).d().a((double) f);
|
Vec3D vec3d1 = (new Vec3D(d0, 0.0D, d1)).d().a((double) f);
|
||||||
|
|
||||||
|
@ -19,10 +77,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ org.bukkit.util.Vector delta = new org.bukkit.util.Vector(currentMot.x - vec3d.x, currentMot.y - vec3d.y, currentMot.z - vec3d.z);
|
+ org.bukkit.util.Vector delta = new org.bukkit.util.Vector(currentMot.x - vec3d.x, currentMot.y - vec3d.y, currentMot.z - vec3d.z);
|
||||||
+ // Restore old velocity to be able to access it in the event
|
+ // Restore old velocity to be able to access it in the event
|
||||||
+ this.setMot(vec3d);
|
+ this.setMot(vec3d);
|
||||||
+ if (entity == null || new com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent((LivingEntity) getBukkitEntity(), entity.getBukkitEntity(), f, delta).callEvent()) {
|
+ if (knockingBackEntity == null || new com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent((LivingEntity) getBukkitEntity(), knockingBackEntity.getBukkitEntity(), f, delta).callEvent()) {
|
||||||
+ this.setMot(vec3d.x + delta.getX(), vec3d.y + delta.getY(), vec3d.z + delta.getZ());
|
+ this.setMot(vec3d.x + delta.getX(), vec3d.y + delta.getY(), vec3d.z + delta.getZ());
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
+ EntityLiving knockingBackEntity; // Paper
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
protected SoundEffect getSoundHurt(DamageSource damagesource) {
|
||||||
|
|
|
@ -279,6 +279,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/IBlockState.java b/src/main/java/net/minecraft/server/IBlockState.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/IBlockState.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/IBlockState.java
|
||||||
|
@@ -0,0 +0,0 @@ public abstract class IBlockState<T extends Comparable<T>> {
|
||||||
|
private final Codec<IBlockState.a<T>> e;
|
||||||
|
|
||||||
|
protected IBlockState(String s, Class<T> oclass) {
|
||||||
|
- this.d = Codec.STRING.comapFlatMap((s1) -> {
|
||||||
|
- return (DataResult) this.b(s1).map(DataResult::success).orElseGet(() -> {
|
||||||
|
- return DataResult.error("Unable to read property: " + this + " with value: " + s1);
|
||||||
|
- });
|
||||||
|
- }, this::a);
|
||||||
|
- this.e = this.d.xmap(this::b, IBlockState.a::b);
|
||||||
|
+ this.d = Codec.STRING.comapFlatMap((s1) -> this.b(s1).map(DataResult::success).orElseGet(() -> { // Paper - decompile error
|
||||||
|
+ return DataResult.error("Unable to read property: " + this + " with value: " + s1);
|
||||||
|
+ }), this::a);
|
||||||
|
+ this.e = this.d.xmap(this::b, (IBlockState.a<T> param) -> param.b()); // Paper - decompile fix
|
||||||
|
this.a = oclass;
|
||||||
|
this.b = s;
|
||||||
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java
|
diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/IEntityAccess.java
|
--- a/src/main/java/net/minecraft/server/IEntityAccess.java
|
||||||
|
@ -423,6 +444,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 extends IAsyncTaskHandlerReentrant<TickTas
|
||||||
|
ResourcePackRepository resourcepackrepository = this.resourcePackRepository;
|
||||||
|
|
||||||
|
this.resourcePackRepository.getClass();
|
||||||
|
- return stream.map(resourcepackrepository::a).filter(Objects::nonNull).map(ResourcePackLoader::d).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error
|
||||||
|
+ return stream.<ResourcePackLoader>map(resourcepackrepository::a).filter(Objects::nonNull).map(ResourcePackLoader::d).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error // Paper - decompile error
|
||||||
|
}, this).thenCompose((immutablelist) -> {
|
||||||
|
- return DataPackResources.a(immutablelist, this.j() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.h(), this.executorService, this);
|
||||||
|
+ return DataPackResources.a((List<IResourcePack>) immutablelist, this.j() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.h(), this.executorService, this); // Paper - decompile error
|
||||||
|
}).thenAcceptAsync((datapackresources) -> {
|
||||||
|
this.dataPackResources.close();
|
||||||
|
this.dataPackResources = datapackresources;
|
||||||
diff --git a/src/main/java/net/minecraft/server/NBTBase.java b/src/main/java/net/minecraft/server/NBTBase.java
|
diff --git a/src/main/java/net/minecraft/server/NBTBase.java b/src/main/java/net/minecraft/server/NBTBase.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/NBTBase.java
|
--- a/src/main/java/net/minecraft/server/NBTBase.java
|
||||||
|
|
|
@ -2318,6 +2318,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@Override
|
@Override
|
||||||
public IBlockData getType(BlockPosition blockposition) {
|
public IBlockData getType(BlockPosition blockposition) {
|
||||||
return Blocks.AIR.getBlockData();
|
return Blocks.AIR.getBlockData();
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/BlockBase.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/BlockBase.java
|
||||||
|
@@ -0,0 +0,0 @@ public abstract class BlockBase {
|
||||||
|
return this.a != null ? this.a.e : Block.a(this.getCollisionShape(iblockaccess, blockposition));
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public IBlockData getBlockData() { return p(); } // Paper - OBFHELPER
|
||||||
|
protected abstract IBlockData p();
|
||||||
|
|
||||||
|
public boolean isAlwaysDestroyable() {
|
||||||
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
||||||
|
|
|
@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
+import org.bukkit.ChatColor;
|
+import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||||
connectionThrottleKickMessage = getString("messages.kick.connection-throttle", connectionThrottleKickMessage);
|
connectionThrottleKickMessage = getString("messages.kick.connection-throttle", connectionThrottleKickMessage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,11 +70,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||||
+++ b/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 {
|
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||||
|
private int tickPosition;
|
||||||
public final Convertable.ConversionSession convertable;
|
public final Convertable.ConversionSession convertable;
|
||||||
public final UUID uuid;
|
public final UUID uuid;
|
||||||
|
|
||||||
+ boolean hasPhysicsEvent = true; // Paper
|
+ boolean hasPhysicsEvent = true; // Paper
|
||||||
+
|
|
||||||
public Chunk getChunkIfLoaded(int x, int z) {
|
@Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
|
||||||
return this.chunkProvider.getChunkAt(x, z, false);
|
return this.chunkProvider.getChunkAt(x, z, false);
|
||||||
}
|
|
||||||
|
|
|
@ -54,15 +54,6 @@ diff --git a/src/main/java/net/minecraft/server/IBlockState.java b/src/main/java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/IBlockState.java
|
--- a/src/main/java/net/minecraft/server/IBlockState.java
|
||||||
+++ b/src/main/java/net/minecraft/server/IBlockState.java
|
+++ b/src/main/java/net/minecraft/server/IBlockState.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class IBlockState<T extends Comparable<T>> {
|
|
||||||
return DataResult.error("Unable to read property: " + this + " with value: " + s1);
|
|
||||||
});
|
|
||||||
}, this::a);
|
|
||||||
- this.e = this.d.xmap(this::b, IBlockState.a::b);
|
|
||||||
+ this.e = this.d.xmap(this::b, (IBlockState.a<T> param) -> { return param.b(); }); // Paper - decompile fix
|
|
||||||
this.a = oclass;
|
|
||||||
this.b = s;
|
|
||||||
}
|
|
||||||
@@ -0,0 +0,0 @@ public abstract class IBlockState<T extends Comparable<T>> {
|
@@ -0,0 +0,0 @@ public abstract class IBlockState<T extends Comparable<T>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/net/minecraft/server/BiomeBase.java
|
--- a/src/main/java/net/minecraft/server/BiomeBase.java
|
||||||
+++ b/src/main/java/net/minecraft/server/BiomeBase.java
|
+++ b/src/main/java/net/minecraft/server/BiomeBase.java
|
||||||
@@ -0,0 +0,0 @@ public class BiomeBase {
|
@@ -0,0 +0,0 @@ public class BiomeBase {
|
||||||
protected final Map<WorldGenStage.Decoration, List<WorldGenFeatureConfigured<?, ?>>> r;
|
this.r.put(worldgenstage_decoration, Lists.newArrayList());
|
||||||
protected final List<WorldGenFeatureConfigured<?, ?>> s = Lists.newArrayList();
|
}
|
||||||
private final Map<StructureGenerator<?>, StructureFeature<?, ?>> u;
|
|
||||||
- private final Map<EnumCreatureType, List<BiomeBase.BiomeMeta>> v;
|
- this.v = Maps.newHashMap();
|
||||||
+ private final Map<EnumCreatureType, List<BiomeBase.BiomeMeta>> v = Maps.newEnumMap(EnumCreatureType.class); // Paper
|
+ this.v = Maps.newEnumMap(EnumCreatureType.class); // Paper
|
||||||
private final Map<EntityTypes<?>, BiomeBase.e> w = Maps.newHashMap();
|
EnumCreatureType[] aenumcreaturetype = EnumCreatureType.values();
|
||||||
private final List<BiomeBase.d> x;
|
|
||||||
private final ThreadLocal<Long2FloatLinkedOpenHashMap> y = ThreadLocal.withInitial(() -> {
|
i = aenumcreaturetype.length;
|
||||||
@@ -0,0 +0,0 @@ public class BiomeBase {
|
@@ -0,0 +0,0 @@ public class BiomeBase {
|
||||||
for (j = 0; j < i; ++j) {
|
for (j = 0; j < i; ++j) {
|
||||||
EnumCreatureType enumcreaturetype = aenumcreaturetype[j];
|
EnumCreatureType enumcreaturetype = aenumcreaturetype[j];
|
||||||
|
@ -27,6 +27,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@@ -0,0 +0,0 @@ public class BiomeBase {
|
||||||
|
this.u = (Map) list.stream().collect(Collectors.toMap((structurefeature) -> {
|
||||||
|
return structurefeature.b;
|
||||||
|
}, Function.identity()));
|
||||||
|
- this.v = map2;
|
||||||
|
+ this.v = Maps.newEnumMap(EnumCreatureType.class); this.v.putAll(map2); // Paper
|
||||||
|
this.x = list1;
|
||||||
|
this.l = (String) optional.orElse(null); // Paper - decompile fix
|
||||||
|
Stream stream = map1.values().stream().flatMap(Collection::stream).filter((worldgenfeatureconfigured) -> {
|
||||||
@@ -0,0 +0,0 @@ public class BiomeBase {
|
@@ -0,0 +0,0 @@ public class BiomeBase {
|
||||||
return this.l;
|
return this.l;
|
||||||
}
|
}
|
||||||
|
|
49
Spigot-Server-Patches/Optimize-CraftBlockData-Creation.patch
Normal file
49
Spigot-Server-Patches/Optimize-CraftBlockData-Creation.patch
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: miclebrick <miclebrick@outlook.com>
|
||||||
|
Date: Thu, 23 Aug 2018 11:45:32 -0400
|
||||||
|
Subject: [PATCH] Optimize CraftBlockData Creation
|
||||||
|
|
||||||
|
Avoids a hashmap lookup by cacheing a reference to the CraftBlockData
|
||||||
|
and cloning it when one is needed.
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/BlockBase.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/BlockBase.java
|
||||||
|
@@ -0,0 +0,0 @@ public abstract class BlockBase {
|
||||||
|
this.o = blockbase_info.t;
|
||||||
|
this.p = blockbase_info.u;
|
||||||
|
}
|
||||||
|
+ // Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time
|
||||||
|
+ private org.bukkit.craftbukkit.block.data.CraftBlockData cachedCraftBlockData;
|
||||||
|
+
|
||||||
|
+ public org.bukkit.craftbukkit.block.data.CraftBlockData createCraftBlockData() {
|
||||||
|
+ if (cachedCraftBlockData == null) cachedCraftBlockData = org.bukkit.craftbukkit.block.data.CraftBlockData.createData(getBlockData());
|
||||||
|
+ return (org.bukkit.craftbukkit.block.data.CraftBlockData) cachedCraftBlockData.clone();
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
|
||||||
|
public void a() {
|
||||||
|
if (!this.getBlock().o()) {
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
||||||
|
@@ -0,0 +0,0 @@ public class CraftBlockData implements BlockData {
|
||||||
|
return craft;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Paper start - optimize creating BlockData to not need a map lookup
|
||||||
|
+ static {
|
||||||
|
+ // Initialize cached data for all IBlockData instances after registration
|
||||||
|
+ Block.REGISTRY_ID.iterator().forEachRemaining(IBlockData::createCraftBlockData);
|
||||||
|
+ }
|
||||||
|
public static CraftBlockData fromData(IBlockData data) {
|
||||||
|
+ return data.createCraftBlockData();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static CraftBlockData createData(IBlockData data) {
|
||||||
|
+ // Paper end
|
||||||
|
return MAP.getOrDefault(data.getBlock().getClass(), CraftBlockData::new).apply(data);
|
||||||
|
}
|
||||||
|
}
|
|
@ -309,6 +309,13 @@ diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Packet.java
|
--- a/src/main/java/net/minecraft/server/Packet.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Packet.java
|
+++ b/src/main/java/net/minecraft/server/Packet.java
|
||||||
|
@@ -0,0 +0,0 @@
|
||||||
|
package net.minecraft.server;
|
||||||
|
|
||||||
|
+import io.netty.channel.ChannelFuture; // Paper
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public interface Packet<T extends PacketListener> {
|
||||||
@@ -0,0 +0,0 @@ public interface Packet<T extends PacketListener> {
|
@@ -0,0 +0,0 @@ public interface Packet<T extends PacketListener> {
|
||||||
void a(T t0);
|
void a(T t0);
|
||||||
|
|
||||||
|
@ -323,7 +330,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param player Null if not at PLAY stage yet
|
+ * @param player Null if not at PLAY stage yet
|
||||||
+ * @param future Can be null if packet was cancelled
|
+ * @param future Can be null if packet was cancelled
|
||||||
+ */
|
+ */
|
||||||
+ default void onPacketDispatchFinish(@javax.annotation.Nullable EntityPlayer player, @javax.annotation.Nullable io.netty.channel.ChannelFuture future) {}
|
+ default void onPacketDispatchFinish(@javax.annotation.Nullable EntityPlayer player, @javax.annotation.Nullable ChannelFuture future) {}
|
||||||
+ default boolean hasFinishListener() { return false; }
|
+ default boolean hasFinishListener() { return false; }
|
||||||
+ default boolean isReady() { return true; }
|
+ default boolean isReady() { return true; }
|
||||||
+ default java.util.List<Packet> getExtraPackets() { return null; }
|
+ default java.util.List<Packet> getExtraPackets() { return null; }
|
||||||
|
|
|
@ -250,6 +250,15 @@ diff --git a/src/main/java/net/minecraft/server/PacketPlayOutLightUpdate.java b/
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutLightUpdate.java
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutLightUpdate.java
|
||||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutLightUpdate.java
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutLightUpdate.java
|
||||||
|
@@ -0,0 +0,0 @@
|
||||||
|
package net.minecraft.server;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
+import io.netty.channel.ChannelFuture; // Paper
|
||||||
|
+
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
@@ -0,0 +0,0 @@ public class PacketPlayOutLightUpdate implements Packet<PacketListenerPlayOut> {
|
@@ -0,0 +0,0 @@ public class PacketPlayOutLightUpdate implements Packet<PacketListenerPlayOut> {
|
||||||
private List<byte[]> h;
|
private List<byte[]> h;
|
||||||
private boolean i;
|
private boolean i;
|
||||||
|
@ -265,7 +274,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void onPacketDispatchFinish(EntityPlayer player, io.netty.channel.ChannelFuture future) {
|
+ public void onPacketDispatchFinish(EntityPlayer player, ChannelFuture future) {
|
||||||
+ if (remainingSends.decrementAndGet() <= 0) {
|
+ if (remainingSends.decrementAndGet() <= 0) {
|
||||||
+ // incase of any race conditions, schedule this delayed
|
+ // incase of any race conditions, schedule this delayed
|
||||||
+ MCUtil.scheduleTask(5, () -> {
|
+ MCUtil.scheduleTask(5, () -> {
|
||||||
|
|
|
@ -1,242 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Aikar <aikar@aikar.co>
|
|
||||||
Date: Mon, 17 Sep 2018 23:37:31 -0400
|
|
||||||
Subject: [PATCH] Optimize Server World Map
|
|
||||||
|
|
||||||
Minecraft moved worlds to a hashmap in 1.13.1.
|
|
||||||
This creates inconsistent order for iteration of the map.
|
|
||||||
|
|
||||||
This patch restores World management to be back as an Array.
|
|
||||||
|
|
||||||
.values() will allow us to iterate as it was pre 1.13.1 by
|
|
||||||
ArrayList, giving consistent ordering and effecient iteration performance.
|
|
||||||
|
|
||||||
KeySet and EntrySet iteration is proxied to the List iterator,
|
|
||||||
and should retain manipulation behavior but nothing should be doing that.
|
|
||||||
|
|
||||||
Getting a World by dimension ID is now back a constant time operation.
|
|
||||||
|
|
||||||
Hopefully no other plugins try to mess with this map, as we are only handling
|
|
||||||
known NMS used methods, but we can add more if naughty plugins are found later.
|
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldMap.java b/src/main/java/com/destroystokyo/paper/PaperWorldMap.java
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldMap.java
|
|
||||||
@@ -0,0 +0,0 @@
|
|
||||||
+package com.destroystokyo.paper;
|
|
||||||
+
|
|
||||||
+import net.minecraft.server.DimensionManager;
|
|
||||||
+import net.minecraft.server.ResourceKey;
|
|
||||||
+import net.minecraft.server.World;
|
|
||||||
+import net.minecraft.server.WorldServer;
|
|
||||||
+
|
|
||||||
+import javax.annotation.Nonnull;
|
|
||||||
+import java.util.AbstractSet;
|
|
||||||
+import java.util.ArrayList;
|
|
||||||
+import java.util.Collection;
|
|
||||||
+import java.util.HashMap;
|
|
||||||
+import java.util.Iterator;
|
|
||||||
+import java.util.List;
|
|
||||||
+import java.util.Map;
|
|
||||||
+import java.util.Set;
|
|
||||||
+
|
|
||||||
+public class PaperWorldMap extends HashMap<ResourceKey<World>, WorldServer> {
|
|
||||||
+ private final List<WorldServer> worlds = new ArrayList<>();
|
|
||||||
+ private final List<WorldServer> worldsIterable = new ArrayList<WorldServer>() {
|
|
||||||
+ @Override
|
|
||||||
+ public Iterator<WorldServer> iterator() {
|
|
||||||
+ Iterator<WorldServer> iterator = super.iterator();
|
|
||||||
+ return new Iterator<WorldServer>() {
|
|
||||||
+ private WorldServer last;
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public boolean hasNext() {
|
|
||||||
+ return iterator.hasNext();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public WorldServer next() {
|
|
||||||
+ this.last = iterator.next();
|
|
||||||
+ return last;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public void remove() {
|
|
||||||
+ worlds.set(last.worldProvider.getDimensionManager().getDimensionID() + 1, null);
|
|
||||||
+ }
|
|
||||||
+ };
|
|
||||||
+ }
|
|
||||||
+ };
|
|
||||||
+ @Override
|
|
||||||
+ public int size() {
|
|
||||||
+ return worldsIterable.size();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public boolean isEmpty() {
|
|
||||||
+ return worldsIterable.isEmpty();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public WorldServer get(Object key) {
|
|
||||||
+ // Will hit the below method
|
|
||||||
+ return key instanceof ResourceKey ? get((ResourceKey<World>) key) : null;
|
|
||||||
+ }
|
|
||||||
+ // TODO figure out what to do with dimension ids
|
|
||||||
+ public WorldServer get(ResourceKey<World> key) {
|
|
||||||
+ int id = key.getDimensionID()+1;
|
|
||||||
+ return worlds.size() > id ? worlds.get(id) : null;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public boolean containsKey(Object key) {
|
|
||||||
+ // will hit below method
|
|
||||||
+ return key instanceof DimensionManager && containsKey((DimensionManager) key);
|
|
||||||
+ }
|
|
||||||
+ public boolean containsKey(DimensionManager key) {
|
|
||||||
+ return get(key) != null;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public WorldServer put(ResourceKey<World> key, WorldServer value) {
|
|
||||||
+ while (worlds.size() <= key.getDimensionID()+1) {
|
|
||||||
+ worlds.add(null);
|
|
||||||
+ }
|
|
||||||
+ WorldServer old = worlds.set(key.getDimensionID()+1, value);
|
|
||||||
+ if (old != null) {
|
|
||||||
+ worldsIterable.remove(old);
|
|
||||||
+ }
|
|
||||||
+ worldsIterable.add(value);
|
|
||||||
+ return old;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public void putAll(Map<? extends ResourceKey<World>, ? extends WorldServer> m) {
|
|
||||||
+ for (Entry<? extends ResourceKey<World>, ? extends WorldServer> e : m.entrySet()) {
|
|
||||||
+ put(e.getKey(), e.getValue());
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public WorldServer remove(Object key) {
|
|
||||||
+ return key instanceof DimensionManager ? remove((DimensionManager) key) : null;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public WorldServer remove(DimensionManager key) {
|
|
||||||
+ WorldServer old;
|
|
||||||
+ if (key.getDimensionID()+1 == worlds.size() - 1) {
|
|
||||||
+ old = worlds.remove(key.getDimensionID()+1);
|
|
||||||
+ } else {
|
|
||||||
+ old = worlds.set(key.getDimensionID() + 1, null);
|
|
||||||
+ }
|
|
||||||
+ if (old != null) {
|
|
||||||
+ worldsIterable.remove(old);
|
|
||||||
+ }
|
|
||||||
+ return old;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public void clear() {
|
|
||||||
+ throw new RuntimeException("What the hell are you doing?");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public boolean containsValue(Object value) {
|
|
||||||
+ return value instanceof WorldServer && get(((WorldServer) value).getDimensionKey()) != null;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Nonnull
|
|
||||||
+ @Override
|
|
||||||
+ public Set<ResourceKey<World>> keySet() {
|
|
||||||
+ return new AbstractSet<ResourceKey<World>>() {
|
|
||||||
+ @Override
|
|
||||||
+ public Iterator<ResourceKey<World>> iterator() {
|
|
||||||
+ Iterator<WorldServer> iterator = worldsIterable.iterator();
|
|
||||||
+ return new Iterator<ResourceKey<World>>() {
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public boolean hasNext() {
|
|
||||||
+ return iterator.hasNext();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public ResourceKey<World> next() {
|
|
||||||
+ return iterator.next().getDimensionKey();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public void remove() {
|
|
||||||
+ iterator.remove();
|
|
||||||
+ }
|
|
||||||
+ };
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public int size() {
|
|
||||||
+ return worlds.size();
|
|
||||||
+ }
|
|
||||||
+ };
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public Collection<WorldServer> values() {
|
|
||||||
+ return worldsIterable;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public Set<Entry<ResourceKey<World>, WorldServer>> entrySet() {
|
|
||||||
+ return new AbstractSet<Entry<ResourceKey<World>, WorldServer>>() {
|
|
||||||
+ @Override
|
|
||||||
+ public Iterator<Entry<ResourceKey<World>, WorldServer>> iterator() {
|
|
||||||
+ Iterator<WorldServer> iterator = worldsIterable.iterator();
|
|
||||||
+ return new Iterator<Entry<ResourceKey<World>, WorldServer>>() {
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public boolean hasNext() {
|
|
||||||
+ return iterator.hasNext();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public Entry<ResourceKey<World>, WorldServer> next() {
|
|
||||||
+ WorldServer entry = iterator.next();
|
|
||||||
+ return new SimpleEntry<>(entry.getDimensionKey(), entry);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public void remove() {
|
|
||||||
+ iterator.remove();
|
|
||||||
+ }
|
|
||||||
+ };
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public int size() {
|
|
||||||
+ return worldsIterable.size();
|
|
||||||
+ }
|
|
||||||
+ };
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 extends IAsyncTaskHandlerReentrant<TickTas
|
|
||||||
private String serverIp;
|
|
||||||
private int serverPort;
|
|
||||||
public final IRegistryCustom.Dimension f;
|
|
||||||
- public final Map<ResourceKey<World>, WorldServer> worldServer;
|
|
||||||
+ public final Map<ResourceKey<World>, WorldServer> worldServer = new com.destroystokyo.paper.PaperWorldMap(); // Paper;
|
|
||||||
private PlayerList playerList;
|
|
||||||
private volatile boolean isRunning;
|
|
||||||
private volatile boolean isRestarting = false; // Paper - flag to signify we're attempting to restart
|
|
||||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.updateWorldSettings();
|
|
||||||
- for (WorldServer worldserver : this.getWorlds()) {
|
|
||||||
+ for (WorldServer worldserver : com.google.common.collect.Lists.newArrayList(this.getWorlds())) { // Paper - avoid como if 1 world triggers another world
|
|
||||||
this.loadSpawn(worldserver.getChunkProvider().playerChunkMap.worldLoadListener, worldserver);
|
|
||||||
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
|
|
||||||
}
|
|
|
@ -291,6 +291,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+import net.minecraft.server.MinecraftServer;
|
+import net.minecraft.server.MinecraftServer;
|
||||||
+import org.bukkit.Bukkit;
|
+import org.bukkit.Bukkit;
|
||||||
+import org.bukkit.command.Command;
|
+import org.bukkit.command.Command;
|
||||||
|
+import org.bukkit.configuration.ConfigurationSection;
|
||||||
+import org.bukkit.configuration.InvalidConfigurationException;
|
+import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
+import org.bukkit.configuration.file.YamlConfiguration;
|
+import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
+
|
+
|
||||||
|
|
|
@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
protected final float bO = 0.02F;
|
protected final float bO = 0.02F;
|
||||||
private int g;
|
private int g;
|
||||||
- private final GameProfile bQ;
|
- private final GameProfile bQ;
|
||||||
+ private final GameProfile bQ; public final void setProfile(final GameProfile profile) { this.bQ = profile; } // Paper - OBFHELPER
|
+ private GameProfile bQ; public final void setProfile(final GameProfile profile) { this.bQ = profile; } // Paper - OBFHELPER
|
||||||
private ItemStack bS;
|
private ItemStack bS;
|
||||||
private final ItemCooldown bT;
|
private final ItemCooldown bT;
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -60,6 +60,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.io.BaseEncoding;
|
import com.google.common.io.BaseEncoding;
|
||||||
|
@@ -0,0 +0,0 @@ import net.minecraft.server.EnumColor;
|
||||||
|
import net.minecraft.server.EnumGamemode;
|
||||||
|
import net.minecraft.server.GenericAttributes;
|
||||||
|
import net.minecraft.server.IChatBaseComponent;
|
||||||
|
+import net.minecraft.server.MCUtil;
|
||||||
|
import net.minecraft.server.MapIcon;
|
||||||
|
import net.minecraft.server.MinecraftKey;
|
||||||
|
import net.minecraft.server.NBTTagCompound;
|
||||||
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
hiddenPlayers.put(player.getUniqueId(), hidingPlugins);
|
hiddenPlayers.put(player.getUniqueId(), hidingPlugins);
|
||||||
|
|
||||||
|
@ -126,7 +134,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ reregisterPlayer(handle);
|
+ reregisterPlayer(handle);
|
||||||
+
|
+
|
||||||
+ //Respawn the player then update their position and selected slot
|
+ //Respawn the player then update their position and selected slot
|
||||||
+ connection.sendPacket(new net.minecraft.server.PacketPlayOutRespawn(handle.dimension, net.minecraft.server.WorldData.c(handle.world.getWorldData().getSeed()), handle.world.getWorldData().getType(), handle.playerInteractManager.getGameMode()));
|
+ //connection.sendPacket(new net.minecraft.server.PacketPlayOutRespawn(handle.dimension, net.minecraft.server.WorldData.c(handle.world.getWorldData().getSeed()), handle.world.getWorldData().getType(), handle.playerInteractManager.getGameMode())); // TODO: Fix this if you care to make it work
|
||||||
+ handle.updateAbilities();
|
+ handle.updateAbilities();
|
||||||
+ connection.sendPacket(new net.minecraft.server.PacketPlayOutPosition(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), new HashSet<>(), 0));
|
+ connection.sendPacket(new net.minecraft.server.PacketPlayOutPosition(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), new HashSet<>(), 0));
|
||||||
+ net.minecraft.server.MinecraftServer.getServer().getPlayerList().updateClient(handle);
|
+ net.minecraft.server.MinecraftServer.getServer().getPlayerList().updateClient(handle);
|
||||||
|
|
|
@ -128,7 +128,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ private java.lang.ref.WeakReference<Chunk> currentChunk = null;
|
+ private java.lang.ref.WeakReference<Chunk> currentChunk = null;
|
||||||
+ public Chunk getCurrentChunk() {
|
+ public Chunk getCurrentChunk() {
|
||||||
+ final Chunk chunk = currentChunk != null ? currentChunk.get() : null;
|
+ final Chunk chunk = currentChunk != null ? currentChunk.get() : null;
|
||||||
+ return chunk != null && chunk.isLoaded() ? chunk : null;
|
+ return chunk != null && chunk.loaded ? chunk : null;
|
||||||
+ }
|
+ }
|
||||||
+ public void setCurrentChunk(Chunk chunk) {
|
+ public void setCurrentChunk(Chunk chunk) {
|
||||||
+ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null;
|
+ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null;
|
||||||
|
|
|
@ -608,7 +608,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ public final Timing miscMobSpawning;
|
+ public final Timing miscMobSpawning;
|
||||||
+
|
+
|
||||||
+ public WorldTimingsHandler(World server) {
|
+ public WorldTimingsHandler(World server) {
|
||||||
+ String name = server.worldData.getName() +" - ";
|
+ String name = server.getWorld().getName() +" - ";
|
||||||
+
|
+
|
||||||
+ mobSpawn = Timings.ofSafe(name + "mobSpawn");
|
+ mobSpawn = Timings.ofSafe(name + "mobSpawn");
|
||||||
+ doChunkUnload = Timings.ofSafe(name + "doChunkUnload");
|
+ doChunkUnload = Timings.ofSafe(name + "doChunkUnload");
|
||||||
|
@ -663,7 +663,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public static Timing getTickList(WorldServer worldserver, String timingsType) {
|
+ public static Timing getTickList(WorldServer worldserver, String timingsType) {
|
||||||
+ return Timings.ofSafe(worldserver.getWorldData().getName() + " - Scheduled " + timingsType);
|
+ return Timings.ofSafe(worldserver.getWorld().getName() + " - Scheduled " + timingsType);
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||||
|
@ -678,6 +678,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
+import co.aikar.timings.Timings;
|
+import co.aikar.timings.Timings;
|
||||||
|
@ -1687,7 +1688,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
|
|
||||||
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
|
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
|
||||||
timings.entityTick.startTiming(); // Spigot
|
timings.entityTick.startTiming(); // Spigot
|
||||||
+ TimingHistory.entityTicks += this.globalEntityList.size(); // Paper
|
+ TimingHistory.entityTicks += this.entitiesById.size(); // Paper
|
||||||
while (objectiterator.hasNext()) {
|
while (objectiterator.hasNext()) {
|
||||||
Entry<Entity> entry = (Entry) objectiterator.next();
|
Entry<Entity> entry = (Entry) objectiterator.next();
|
||||||
Entity entity = (Entity) entry.getValue();
|
Entity entity = (Entity) entry.getValue();
|
||||||
|
|
|
@ -23,6 +23,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
return (BlockPosition) this.datawatcher.get(EntityTurtle.bw);
|
return (BlockPosition) this.datawatcher.get(EntityTurtle.bw);
|
||||||
}
|
}
|
||||||
@@ -0,0 +0,0 @@ public class EntityTurtle extends EntityAnimal {
|
@@ -0,0 +0,0 @@ public class EntityTurtle extends EntityAnimal {
|
||||||
|
return (Boolean) this.datawatcher.get(EntityTurtle.bx);
|
||||||
|
}
|
||||||
|
|
||||||
|
- private void setHasEgg(boolean flag) {
|
||||||
|
+ public void setHasEgg(boolean flag) { // Paper
|
||||||
this.datawatcher.set(EntityTurtle.bx, flag);
|
this.datawatcher.set(EntityTurtle.bx, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+ public final int applyTrackingRangeScale(int value) { return this.b(i); } // Paper - OBFHELPER
|
+ public final int applyTrackingRangeScale(int value) { return this.b(value); } // Paper - OBFHELPER
|
||||||
public int b(int i) {
|
public int b(int i) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Chunk getChunkIfLoaded(int x, int z) {
|
@Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
|
||||||
- return this.chunkProvider.getChunkAt(x, z, false);
|
- return this.chunkProvider.getChunkAt(x, z, false);
|
||||||
+ return this.chunkProvider.getChunkAtIfLoadedImmediately(x, z); // Paper
|
+ return this.chunkProvider.getChunkAtIfLoadedImmediately(x, z); // Paper
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,11 +90,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ for (WorldServer world : getWorlds()) {
|
+ for (WorldServer world : getWorlds()) {
|
||||||
+ if (world.paperConfig.autoSavePeriod > 0) {
|
+ if (world.paperConfig.autoSavePeriod > 0) {
|
||||||
+ try {
|
+ world.saveIncrementally(serverAutoSave);
|
||||||
+ world.saveIncrementally(serverAutoSave);
|
|
||||||
+ } catch (ExceptionWorldConflict exceptionWorldConflict) {
|
|
||||||
+ MinecraftServer.LOGGER.warn(exceptionWorldConflict.getMessage());
|
|
||||||
+ }
|
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
|
Loading…
Reference in a new issue