geforkt von Mirrors/Paper
even even even more work
Dieser Commit ist enthalten in:
Ursprung
4aa7955818
Commit
e943ece469
6
SHIT_TO_CHECK.md
Normale Datei
6
SHIT_TO_CHECK.md
Normale Datei
@ -0,0 +1,6 @@
|
||||
# Shit to check
|
||||
|
||||
* Mini: "Allow disabling armour stand ticking": Not sure if the equipment update actually works, vanilla shifted a bunch of shit
|
||||
* Mini: "Optimize World Server Map": Figure out how to fill PaperWorldMap, it needs a dim key which doesnt exist anymore?
|
||||
* Mini: "MC-50319": fix if still works
|
||||
* Mini: I definetly dropped a patch I didnt want to drop, we need to go thru in the end and see if all patches are still in, lol
|
@ -23,13 +23,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
} else {
|
||||
PlayerChunkMap.EntityTracker playerchunkmap_entitytracker = new PlayerChunkMap.EntityTracker(entity, i, j, entitytypes.isDeltaTracking());
|
||||
} else {
|
||||
PlayerChunkMap.EntityTracker playerchunkmap_entitytracker = new PlayerChunkMap.EntityTracker(entity, i, j, entitytypes.isDeltaTracking());
|
||||
|
||||
+ entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker
|
||||
this.trackedEntities.put(entity.getId(), playerchunkmap_entitytracker);
|
||||
playerchunkmap_entitytracker.track(this.world.getPlayers());
|
||||
if (entity instanceof EntityPlayer) {
|
||||
+ entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker
|
||||
this.trackedEntities.put(entity.getId(), playerchunkmap_entitytracker);
|
||||
playerchunkmap_entitytracker.track(this.world.getPlayers());
|
||||
if (entity instanceof EntityPlayer) {
|
||||
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
if (playerchunkmap_entitytracker1 != null) {
|
||||
playerchunkmap_entitytracker1.a();
|
||||
@ -55,17 +55,17 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/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 {
|
||||
// CraftBukkit start
|
||||
private int tickPosition;
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
public final UUID uuid;
|
||||
|
||||
boolean hasPhysicsEvent = true; // Paper
|
||||
+ private static Throwable getAddToWorldStackTrace(Entity entity) {
|
||||
+ return new Throwable(entity + " Added to world at " + new java.util.Date());
|
||||
+ }
|
||||
|
||||
// Add env and gen to constructor
|
||||
public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
public Chunk getChunkIfLoaded(int x, int z) {
|
||||
return this.chunkProvider.getChunkAt(x, z, false);
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
// CraftBukkit start
|
||||
private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot
|
||||
@ -95,7 +95,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); // CraftBukkit
|
||||
return false;
|
||||
} else if (this.isUUIDTaken(entity)) {
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
return this.minX < d3 && this.maxX > d0 && this.minY < d4 && this.maxY > d1 && this.minZ < d5 && this.maxZ > d2;
|
||||
}
|
||||
|
||||
+ public final boolean contains(Vec3D vec3d) { return c(vec3d); } // Paper - OBFHELPER
|
||||
public boolean c(Vec3D vec3d) {
|
||||
+ public final boolean contains(Vec3D vec3d) { return d(vec3d); } // Paper - OBFHELPER
|
||||
public boolean d(Vec3D vec3d) {
|
||||
return this.e(vec3d.x, vec3d.y, vec3d.z);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class AxisAlignedBB {
|
||||
@ -61,8 +61,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
return this.getPassengers().size() < 1;
|
||||
}
|
||||
|
||||
+ public final float getCollisionBorderSize() { return aV(); } // Paper - OBFHELPER
|
||||
public float aV() {
|
||||
+ public final float getCollisionBorderSize() { return bc(); } // Paper - OBFHELPER
|
||||
public float bc() {
|
||||
return 0.0F;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@ -117,7 +117,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
};
|
||||
+ public static Predicate<Entity> notSpectator() { return f; } // Paper - OBFHELPER
|
||||
public static final Predicate<Entity> f = (entity) -> {
|
||||
return !entity.isSpectator();
|
||||
return !(entity instanceof EntityHuman) || !entity.isSpectator() && !((EntityHuman) entity).isCreative() && entity.world.getDifficulty() != EnumDifficulty.PEACEFUL;
|
||||
};
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
@ -11,12 +11,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class EntityCreeper extends EntityMonster {
|
||||
private static final DataWatcherObject<Boolean> POWERED = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i);
|
||||
private static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject<Boolean> isIgnitedDW = d; // Paper OBFHELPER
|
||||
private int bw;
|
||||
private int bv;
|
||||
- private int fuseTicks;
|
||||
+ public int fuseTicks; // Paper - public
|
||||
public int maxFuseTicks = 30;
|
||||
public int explosionRadius = 3;
|
||||
private int bA;
|
||||
private int bz;
|
||||
@@ -0,0 +0,0 @@ public class EntityCreeper extends EntityMonster {
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ diff --git a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java b/src/mai
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
|
||||
+++ b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
|
||||
@@ -0,0 +0,0 @@ public class MobSpawnerPhantom {
|
||||
@@ -0,0 +0,0 @@ public class MobSpawnerPhantom implements MobSpawner {
|
||||
int k = 1 + random.nextInt(difficultydamagescaler.a().a() + 1);
|
||||
|
||||
for (int l = 0; l < k; ++l) {
|
||||
|
@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/NetworkManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
|
||||
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
this.i().a(new ChatMessage("multiplayer.disconnect.generic", new Object[0]));
|
||||
this.i().a(new ChatMessage("multiplayer.disconnect.generic"));
|
||||
}
|
||||
this.packetQueue.clear(); // Free up packet queue.
|
||||
+ // Paper start - Add PlayerConnectionCloseEvent
|
||||
|
@ -15,17 +15,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+import com.destroystokyo.paper.event.block.TNTPrimeEvent; // Paper - TNTPrimeEvent
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Map.Entry;
|
||||
@@ -0,0 +0,0 @@ public class BlockFire extends Block {
|
||||
|
||||
world.setTypeAndData(blockposition, (IBlockData) this.a((IBlockAccess) world, blockposition).set(BlockFire.AGE, l), 3);
|
||||
@@ -0,0 +0,0 @@ public class BlockFire extends BlockFireAbstract {
|
||||
|
||||
world.setTypeAndData(blockposition, this.a(world, blockposition, l), 3);
|
||||
} else {
|
||||
- world.a(blockposition, false);
|
||||
+ if(iblockdata.getBlock() != Blocks.TNT) world.a(blockposition, false); // Paper - TNTPrimeEvent - We might be cancelling it below, move the setAir down
|
||||
}
|
||||
|
||||
Block block = iblockdata.getBlock();
|
||||
@@ -0,0 +0,0 @@ public class BlockFire extends Block {
|
||||
@@ -0,0 +0,0 @@ public class BlockFire extends BlockFireAbstract {
|
||||
if (block instanceof BlockTNT) {
|
||||
BlockTNT blocktnt = (BlockTNT) block;
|
||||
|
||||
@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
@@ -0,0 +0,0 @@ public class BlockTNT extends Block {
|
||||
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
|
||||
if (iblockdata1.getBlock() != iblockdata.getBlock()) {
|
||||
if (!iblockdata1.a(iblockdata.getBlock())) {
|
||||
if (world.isBlockIndirectlyPowered(blockposition)) {
|
||||
+ // Paper start - TNTPrimeEvent
|
||||
+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);;
|
||||
@ -80,12 +80,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) {
|
||||
if (!world.isClientSide) {
|
||||
+ // Paper start - TNTPrimeEvent
|
||||
+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);;
|
||||
+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);
|
||||
+ org.bukkit.entity.Entity source = explosion.source != null ? explosion.source.getBukkitEntity() : null;
|
||||
+ if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.EXPLOSION, source).callEvent())
|
||||
+ return;
|
||||
+ // Paper end
|
||||
EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource());
|
||||
EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, explosion.getSource());
|
||||
|
||||
entitytntprimed.setFuseTicks((short) (world.random.nextInt(entitytntprimed.getFuseTicks() / 4) + entitytntprimed.getFuseTicks() / 8));
|
||||
@@ -0,0 +0,0 @@ public class BlockTNT extends Block {
|
||||
@ -106,12 +106,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
+ // Paper start - TNTPrimeEvent
|
||||
+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);
|
||||
+ if (!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.PROJECTILE, entityarrow.getBukkitEntity()).callEvent()) {
|
||||
+ if (!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.PROJECTILE, iprojectile.getBukkitEntity()).callEvent()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
a(world, blockposition, entity1 instanceof EntityLiving ? (EntityLiving) entity1 : null);
|
||||
a(world, blockposition, entity instanceof EntityLiving ? (EntityLiving) entity : null);
|
||||
world.a(blockposition, false);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
@ -128,7 +128,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
||||
});
|
||||
craftBlock.getNMS().dropNaturally(world, blockposition, ItemStack.a);
|
||||
craftBlock.getNMS().dropNaturally(world, blockposition, ItemStack.b);
|
||||
}
|
||||
+ // Paper start - TNTPrimeEvent
|
||||
+ org.bukkit.block.Block tntBlock = world.getWorld().getBlockAt(blockposition.x, blockposition.y, blockposition.z);
|
||||
|
@ -35,8 +35,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
public static int packetInSpamThreshold = 300;
|
||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||
}
|
||||
}
|
||||
tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit);
|
||||
}
|
||||
+
|
||||
+ public static boolean velocitySupport;
|
||||
@ -202,7 +202,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.disconnect(new ChatMessage("multiplayer.disconnect.unexpected_query_response", new Object[0]));
|
||||
this.disconnect(new ChatMessage("multiplayer.disconnect.unexpected_query_response"));
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
|
||||
|
@ -26,23 +26,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
private int h;
|
||||
private int i;
|
||||
private int j;
|
||||
- private boolean k;
|
||||
+ private boolean k; private void setDragonKilled(boolean dragonKilled) { this.k = dragonKilled; } // Paper - OBFHELPER
|
||||
private boolean l;
|
||||
public UUID m; // CraftBukkit PAIL private -> public, rename dragonUUID
|
||||
- private boolean dragonKilled;
|
||||
+ private boolean dragonKilled; private void setDragonKilled(boolean dragonKilled) { this.dragonKilled = dragonKilled; } // Paper - OBFHELPER
|
||||
private boolean previouslyKilled;
|
||||
public UUID dragonUUID;
|
||||
- private boolean n;
|
||||
+ private boolean n; private void setScanForLegacyFight(boolean scanForLegacyFight) { this.n = scanForLegacyFight; } private boolean scanForLegacyFight() { return this.n; } // Paper - OBFHELPER
|
||||
public BlockPosition o; // CraftBukkit PAIL private -> public, rename portalLocation
|
||||
public EnumDragonRespawn p; // CraftBukkit PAIL private -> public, rename respawnPhase
|
||||
public BlockPosition exitPortalLocation;
|
||||
public EnumDragonRespawn respawnPhase;
|
||||
private int q;
|
||||
@@ -0,0 +0,0 @@ public class EnderDragonBattle {
|
||||
this.bossBattle = (BossBattleServer) (new BossBattleServer(new ChatMessage("entity.minecraft.ender_dragon", new Object[0]), BossBattle.BarColor.PINK, BossBattle.BarStyle.PROGRESS)).setPlayMusic(true).c(true);
|
||||
this.e = Lists.newArrayList();
|
||||
this.bossBattle = (BossBattleServer) (new BossBattleServer(new ChatMessage("entity.minecraft.ender_dragon"), BossBattle.BarColor.PINK, BossBattle.BarStyle.PROGRESS)).setPlayMusic(true).c(true);
|
||||
this.gateways = Lists.newArrayList();
|
||||
this.n = true;
|
||||
+ // Paper start
|
||||
+ setScanForLegacyFight(worldserver.paperConfig.scanForLegacyEnderDragon);
|
||||
+ if (!scanForLegacyFight()) setDragonKilled(true);
|
||||
+ // Paper end
|
||||
this.d = worldserver;
|
||||
this.world = worldserver;
|
||||
if (nbttagcompound.hasKeyOfType("DragonKilled", 99)) {
|
||||
if (nbttagcompound.b("DragonUUID")) {
|
||||
if (nbttagcompound.b("Dragon")) {
|
||||
|
@ -10,13 +10,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/net/minecraft/server/EntityCow.java
|
||||
@@ -0,0 +0,0 @@ public class EntityCow extends EntityAnimal {
|
||||
|
||||
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
|
||||
if (itemstack.getItem() == Items.BUCKET && !this.isBaby()) {
|
||||
// CraftBukkit start - Got milk?
|
||||
- org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET);
|
||||
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET, enumhand); // Paper - add enumHand
|
||||
- org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET);
|
||||
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET, enumhand); // Paper - add enumHand
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return false;
|
||||
return EnumInteractionResult.PASS;
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemBucket.java
|
||||
@ -25,8 +25,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (iblockdata.getBlock() instanceof IFluidSource) {
|
||||
// CraftBukkit start
|
||||
FluidType dummyFluid = ((IFluidSource) iblockdata.getBlock()).removeFluid(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata);
|
||||
- PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a());
|
||||
+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a(), enumhand);
|
||||
- PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a());
|
||||
+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a(), enumhand); // Paper - add enumhand
|
||||
|
||||
if (event.isCancelled()) {
|
||||
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-5163 (see PlayerInteractManager)
|
||||
@ -34,14 +34,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
iblockdata = world.getType(blockposition);
|
||||
BlockPosition blockposition2 = iblockdata.getBlock() instanceof IFluidContainer && this.fluidType == FluidTypes.WATER ? blockposition : blockposition1;
|
||||
|
||||
- if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack)) { // CraftBukkit
|
||||
+ if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack, enumhand)) { // CraftBukkit // Paper - add enumhand
|
||||
- if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock1, movingobjectpositionblock1.getDirection(), blockposition, itemstack)) { // CraftBukkit
|
||||
+ if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock1, movingobjectpositionblock1.getDirection(), blockposition, itemstack, enumhand)) { // CraftBukkit // Paper - add enumhand
|
||||
this.a(world, itemstack, blockposition2);
|
||||
if (entityhuman instanceof EntityPlayer) {
|
||||
CriterionTriggers.y.a((EntityPlayer) entityhuman, blockposition2, itemstack);
|
||||
@@ -0,0 +0,0 @@ public class ItemBucket extends Item {
|
||||
public void a(World world, ItemStack itemstack, BlockPosition blockposition) {}
|
||||
|
||||
// CraftBukkit start
|
||||
public boolean a(@Nullable EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock) {
|
||||
- return a(entityhuman, world, blockposition, movingobjectpositionblock, null, null, null);
|
||||
+ // Paper start - add enumHand
|
||||
@ -55,27 +55,84 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (!(this.fluidType instanceof FluidTypeFlowing)) {
|
||||
return false;
|
||||
@@ -0,0 +0,0 @@ public class ItemBucket extends Item {
|
||||
boolean flag = iblockdata.a(this.fluidType);
|
||||
|
||||
if (!iblockdata.isAir() && !flag && (!(iblockdata.getBlock() instanceof IFluidContainer) || !((IFluidContainer) iblockdata.getBlock()).canPlace(world, blockposition, iblockdata, this.fluidType))) {
|
||||
- return movingobjectpositionblock == null ? false : this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack); // CraftBukkit
|
||||
+ return movingobjectpositionblock == null ? false : this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
if (entityhuman != null) {
|
||||
- PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(world, entityhuman, blockposition, clicked, enumdirection, itemstack);
|
||||
+ PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(world, entityhuman, blockposition, clicked, enumdirection, itemstack, enumhand);
|
||||
if (event.isCancelled()) {
|
||||
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-4238: needed when looking through entity
|
||||
((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
|
||||
// CraftBukkit start
|
||||
if (flag1 && entityhuman != null) {
|
||||
- PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((WorldServer) world, entityhuman, blockposition, clicked, enumdirection, itemstack);
|
||||
+ PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((WorldServer) world, entityhuman, blockposition, clicked, enumdirection, itemstack, enumhand); // Paper - add enumhand
|
||||
if (event.isCancelled()) {
|
||||
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-4238: needed when looking through entity
|
||||
((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
+ // Paper start - moved up from WorldServer
|
||||
+ public BlockPosition getSpawn() {
|
||||
+ BlockPosition blockposition = new BlockPosition(this.worldData.a(), this.worldData.b(), this.worldData.c());
|
||||
+
|
||||
+ if (!this.getWorldBorder().a(blockposition)) {
|
||||
+ blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ()));
|
||||
+ }
|
||||
+
|
||||
+ return blockposition;
|
||||
+ }
|
||||
+ // Paper end
|
||||
@Override
|
||||
public boolean s_() {
|
||||
return this.isClientSide;
|
||||
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 {
|
||||
this.getMinecraftServer().getPlayerList().sendAll(new PacketPlayOutSpawnPosition(blockposition));
|
||||
}
|
||||
|
||||
- public BlockPosition getSpawn() {
|
||||
- BlockPosition blockposition = new BlockPosition(this.worldData.a(), this.worldData.b(), this.worldData.c());
|
||||
-
|
||||
- if (!this.getWorldBorder().a(blockposition)) {
|
||||
- blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ()));
|
||||
- }
|
||||
-
|
||||
- return blockposition;
|
||||
- }
|
||||
+ // Paper - moved up to World
|
||||
+ //public BlockPosition getSpawn() {
|
||||
+ // BlockPosition blockposition = new BlockPosition(this.worldData.a(), this.worldData.b(), this.worldData.c());
|
||||
+ //
|
||||
+ // if (!this.getWorldBorder().a(blockposition)) {
|
||||
+ // blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ()));
|
||||
+ // }
|
||||
+ //
|
||||
+ // return blockposition;
|
||||
+ //}
|
||||
+ // Paper end
|
||||
|
||||
public LongSet getForceLoadedChunks() {
|
||||
ForcedChunk forcedchunk = (ForcedChunk) this.getWorldPersistentData().b(ForcedChunk::new, "chunks");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -0,0 +0,0 @@ public class CraftEventFactory {
|
||||
public static Entity entityDamage; // For use in EntityDamageByEntityEvent
|
||||
|
||||
// helper methods
|
||||
- private static boolean canBuild(WorldServer world, Player player, int x, int z) {
|
||||
+ private static boolean canBuild(World world, Player player, int x, int z) {
|
||||
int spawnSize = Bukkit.getServer().getSpawnRadius();
|
||||
|
||||
if (world.getDimensionKey() != World.OVERWORLD) return true;
|
||||
@@ -0,0 +0,0 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
private static PlayerEvent getPlayerBucketEvent(boolean isFilling, World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.server.Item item) {
|
||||
private static PlayerEvent getPlayerBucketEvent(boolean isFilling, WorldServer world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.server.Item item) {
|
||||
+ // Paper start - add enumHand
|
||||
+ return getPlayerBucketEvent(isFilling, world, who, changed, clicked, clickedFace, itemstack, item, null);
|
||||
+ }
|
||||
|
@ -24,26 +24,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public class EntityWitch extends EntityRaider implements IRangedEntity {
|
||||
|
||||
private static final UUID b = UUID.fromString("5CD17E52-A79A-43D3-A529-90FDE04B181E");
|
||||
- private static final AttributeModifier bw = (new AttributeModifier(EntityWitch.b, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION)).a(false);
|
||||
+ private static final AttributeModifier bw = (new AttributeModifier(EntityWitch.b, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION)).a(false); private static final AttributeModifier DRINKING_SPEED = bw; // Paper - OBFHELPER
|
||||
private static final DataWatcherObject<Boolean> bx = DataWatcher.a(EntityWitch.class, DataWatcherRegistry.i);
|
||||
- private int by;
|
||||
+ private int by; public int getPotionUseTimeLeft() { return by; } public void setPotionUseTimeLeft(int timeLeft) { by = timeLeft; } // Paper - OBFHELPER
|
||||
private PathfinderGoalNearestHealableRaider<EntityRaider> bz;
|
||||
private PathfinderGoalNearestAttackableTargetWitch<EntityHuman> bA;
|
||||
- private static final AttributeModifier bv = new AttributeModifier(EntityWitch.b, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION);
|
||||
+ private static final AttributeModifier bv = new AttributeModifier(EntityWitch.b, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION); private static final AttributeModifier DRINKING_SPEED = bv; // Paper - OBFHELPER
|
||||
private static final DataWatcherObject<Boolean> bw = DataWatcher.a(EntityWitch.class, DataWatcherRegistry.i);
|
||||
- private int bx;
|
||||
+ private int bx; public int getPotionUseTimeLeft() { return bx; } public void setPotionUseTimeLeft(int timeLeft) { bx = timeLeft; } // Paper - OBFHELPER
|
||||
private PathfinderGoalNearestHealableRaider<EntityRaider> by;
|
||||
private PathfinderGoalNearestAttackableTargetWitch<EntityHuman> bz;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class EntityWitch extends EntityRaider implements IRangedEntity {
|
||||
return SoundEffects.ENTITY_WITCH_DEATH;
|
||||
}
|
||||
|
||||
+ public void setDrinkingPotion(boolean drinkingPotion) { t(drinkingPotion); } // Paper - OBFHELPER
|
||||
public void t(boolean flag) {
|
||||
this.getDataWatcher().set(EntityWitch.bx, flag);
|
||||
+ public void setDrinkingPotion(boolean drinkingPotion) { v(drinkingPotion); } // Paper - OBFHELPER
|
||||
public void v(boolean flag) {
|
||||
this.getDataWatcher().set(EntityWitch.bw, flag);
|
||||
}
|
||||
|
||||
+ public boolean isDrinkingPotion() { return l(); } // Paper - OBFHELPER
|
||||
public boolean l() {
|
||||
return (Boolean) this.getDataWatcher().get(EntityWitch.bx);
|
||||
+ public boolean isDrinkingPotion() { return m(); } // Paper - OBFHELPER
|
||||
public boolean m() {
|
||||
return (Boolean) this.getDataWatcher().get(EntityWitch.bw);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class EntityWitch extends EntityRaider implements IRangedEntity {
|
||||
}
|
||||
@ -53,27 +53,33 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- ItemStack potion = PotionUtil.a(new ItemStack(Items.POTION), potionregistry);
|
||||
- org.bukkit.inventory.ItemStack bukkitStack = com.destroystokyo.paper.event.entity.WitchReadyPotionEvent.process((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion));
|
||||
- this.setSlot(EnumItemSlot.MAINHAND, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(bukkitStack));
|
||||
+ // Paper start - move all this down into its own method
|
||||
+// ItemStack potion = PotionUtil.a(new ItemStack(Items.POTION), potionregistry);
|
||||
+// org.bukkit.inventory.ItemStack bukkitStack = com.destroystokyo.paper.event.entity.WitchReadyPotionEvent.process((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion));
|
||||
+// this.setSlot(EnumItemSlot.MAINHAND, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(bukkitStack));
|
||||
+// // Paper end
|
||||
+// this.bB = this.getItemInMainHand().k();
|
||||
+// this.s(true);
|
||||
+// this.world.playSound((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
|
||||
+// AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
+//
|
||||
+// attributeinstance.removeModifier(EntityWitch.bz);
|
||||
+// attributeinstance.addModifier(EntityWitch.bz);
|
||||
+ this.setDrinkingPotion(PotionUtil.addPotionToItemStack(new ItemStack(Items.POTION), potionregistry));
|
||||
// Paper end
|
||||
- this.by = this.getItemInMainHand().k();
|
||||
- this.t(true);
|
||||
- this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
|
||||
- AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
- // Paper end
|
||||
- this.bx = this.getItemInMainHand().k();
|
||||
- this.v(true);
|
||||
- if (!this.isSilent()) {
|
||||
- this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
|
||||
- }
|
||||
-
|
||||
- attributeinstance.removeModifier(EntityWitch.bw);
|
||||
- attributeinstance.addModifier(EntityWitch.bw);
|
||||
- AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
-
|
||||
- attributemodifiable.removeModifier(EntityWitch.bv);
|
||||
- attributemodifiable.b(EntityWitch.bv);
|
||||
+ //// Paper start
|
||||
+ //ItemStack potion = PotionUtil.a(new ItemStack(Items.POTION), potionregistry);
|
||||
+ //org.bukkit.inventory.ItemStack bukkitStack = com.destroystokyo.paper.event.entity.WitchReadyPotionEvent.process((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion));
|
||||
+ //this.setSlot(EnumItemSlot.MAINHAND, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(bukkitStack));
|
||||
+ //// Paper end
|
||||
+ //this.bx = this.getItemInMainHand().k();
|
||||
+ //this.v(true);
|
||||
+ //if (!this.isSilent()) {
|
||||
+ // this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
|
||||
+ //}
|
||||
+ //
|
||||
+ //AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
+ //
|
||||
+ //attributemodifiable.removeModifier(EntityWitch.bv);
|
||||
+ //attributemodifiable.b(EntityWitch.bv);
|
||||
+ this.setDrinkingPotion(PotionUtil.addPotionToItemStack(new ItemStack(Items.POTION), potionregistry));
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,20 +87,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
super.movementTick();
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ // Paper start - moved to its own method
|
||||
+ public void setDrinkingPotion(ItemStack potion) {
|
||||
+ setSlot(EnumItemSlot.MAINHAND, CraftItemStack.asNMSCopy(WitchReadyPotionEvent.process((Witch) getBukkitEntity(), CraftItemStack.asCraftMirror(potion))));
|
||||
+ setPotionUseTimeLeft(getItemInMainHand().getItemUseMaxDuration());
|
||||
+ setDrinkingPotion(true);
|
||||
+ world.sendSoundEffect(null, locX(), locY(), locZ(), SoundEffects.ENTITY_WITCH_DRINK, getSoundCategory(), 1.0F, 0.8F + random.nextFloat() * 0.4F);
|
||||
+ AttributeInstance attributeinstance = getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
+ attributeinstance.removeModifier(EntityWitch.DRINKING_SPEED);
|
||||
+ attributeinstance.addModifier(EntityWitch.DRINKING_SPEED);
|
||||
+ if (!this.isSilent()) {
|
||||
+ this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
|
||||
+ }
|
||||
+ AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
+ attributemodifiable.removeModifier(EntityWitch.bv);
|
||||
+ attributemodifiable.b(EntityWitch.bv);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public SoundEffect eq() {
|
||||
public SoundEffect eM() {
|
||||
return SoundEffects.ENTITY_WITCH_CELEBRATE;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
@ -13,8 +13,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
|
||||
+ public boolean isArmsRaisedZombie() { return (this.datawatcher.get(EntityInsentient.b) & 4) != 0; } // Paper - OBFHELPER
|
||||
+ public void setArmsRaisedZombie(boolean flag) { this.q(flag); } // Paper - OBFHELPER
|
||||
public void q(boolean flag) {
|
||||
+ public void setArmsRaisedZombie(boolean flag) { this.setAggressive(flag); } // Paper - OBFHELPER
|
||||
public void setAggressive(boolean flag) {
|
||||
byte b0 = (Byte) this.datawatcher.get(EntityInsentient.b);
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
|
||||
private int bC;
|
||||
private int bA;
|
||||
public int drownedConversionTime;
|
||||
private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
|
||||
+ private boolean shouldBurnInDay = true; // Paper
|
||||
@ -48,15 +48,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
protected void ev() {
|
||||
this.b(EntityTypes.DROWNED);
|
||||
this.world.a((EntityHuman) null, 1040, new BlockPosition(this), 0);
|
||||
protected void eQ() {
|
||||
this.c(EntityTypes.DROWNED);
|
||||
if (!this.isSilent()) {
|
||||
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+ public boolean shouldBurnInDay() { return K_(); } // Paper - OBFHELPER
|
||||
protected boolean K_() {
|
||||
+ public boolean shouldBurnInDay() { return U_(); } // Paper - OBFHELPER
|
||||
protected boolean U_() {
|
||||
- return true;
|
||||
+ return shouldBurnInDay;
|
||||
}
|
||||
@ -71,8 +71,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public boolean damageEntity(DamageSource damagesource, float f) {
|
||||
if (super.damageEntity(damagesource, f)) {
|
||||
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
|
||||
nbttagcompound.setBoolean("CanBreakDoors", this.ey());
|
||||
nbttagcompound.setInt("InWaterTime", this.isInWater() ? this.bC : -1);
|
||||
nbttagcompound.setBoolean("CanBreakDoors", this.eV());
|
||||
nbttagcompound.setInt("InWaterTime", this.isInWater() ? this.bA : -1);
|
||||
nbttagcompound.setInt("DrownedConversionTime", this.isDrownConverting() ? this.drownedConversionTime : -1);
|
||||
+ nbttagcompound.setBoolean("Paper.ShouldBurnInDay", shouldBurnInDay); // Paper
|
||||
}
|
||||
|
@ -9,13 +9,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- 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 {
|
||||
return flag;
|
||||
|
||||
}
|
||||
|
||||
+ public boolean isInDaylight() { return this.en(); } // Paper - OBFHELPER
|
||||
protected boolean en() {
|
||||
+ public boolean isInDaylight() { return this.eH(); } // Paper - OBFHELPER
|
||||
protected boolean eH() {
|
||||
if (this.world.isDay() && !this.world.isClientSide) {
|
||||
float f = this.aI();
|
||||
float f = this.aO();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
|
@ -69,11 +69,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
private final RegionFileBitSet freeSectors;
|
||||
+ public final File file;
|
||||
|
||||
public RegionFile(File file, File file1) throws IOException {
|
||||
this(file.toPath(), file1.toPath(), RegionFileCompression.b);
|
||||
public RegionFile(File file, File file1, boolean flag) throws IOException {
|
||||
this(file.toPath(), file1.toPath(), RegionFileCompression.b, flag);
|
||||
}
|
||||
|
||||
public RegionFile(java.nio.file.Path java_nio_file_path, java.nio.file.Path java_nio_file_path1, RegionFileCompression regionfilecompression) throws IOException {
|
||||
public RegionFile(java.nio.file.Path java_nio_file_path, java.nio.file.Path java_nio_file_path1, RegionFileCompression regionfilecompression, boolean flag) throws IOException {
|
||||
+ this.file = java_nio_file_path.toFile(); // Paper
|
||||
this.f = ByteBuffer.allocateDirect(8192);
|
||||
+ initOversizedState();
|
||||
|
@ -37,11 +37,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public EntityArmorStand(EntityTypes<? extends EntityArmorStand> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
|
||||
this.rightArmPose = EntityArmorStand.bu;
|
||||
this.leftLegPose = EntityArmorStand.bv;
|
||||
this.rightLegPose = EntityArmorStand.bw;
|
||||
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.H = 0.0F;
|
||||
this.G = 0.0F;
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
|
||||
@ -136,125 +136,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
public void setRightLegPose(Vector3f vector3f) {
|
||||
this.rightLegPose = vector3f;
|
||||
this.datawatcher.set(EntityArmorStand.bp, 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/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- 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 {
|
||||
}
|
||||
}
|
||||
|
||||
- EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
|
||||
- int k = aenumitemslot.length;
|
||||
-
|
||||
- for (int l = 0; l < k; ++l) {
|
||||
- EnumItemSlot enumitemslot = aenumitemslot[l];
|
||||
- ItemStack itemstack;
|
||||
-
|
||||
- switch (enumitemslot.a()) {
|
||||
- case HAND:
|
||||
- itemstack = (ItemStack) this.bu.get(enumitemslot.b());
|
||||
- break;
|
||||
- case ARMOR:
|
||||
- itemstack = (ItemStack) this.bv.get(enumitemslot.b());
|
||||
- break;
|
||||
- default:
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
- ItemStack itemstack1 = this.getEquipment(enumitemslot);
|
||||
-
|
||||
- if (!ItemStack.matches(itemstack1, itemstack)) {
|
||||
- // Paper start - PlayerArmorChangeEvent
|
||||
- if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) {
|
||||
- final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack);
|
||||
- final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1);
|
||||
- new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent();
|
||||
- }
|
||||
- // Paper end
|
||||
- ((WorldServer) this.world).getChunkProvider().broadcast(this, new PacketPlayOutEntityEquipment(this.getId(), enumitemslot, itemstack1));
|
||||
- if (!itemstack.isEmpty()) {
|
||||
- this.getAttributeMap().a(itemstack.a(enumitemslot));
|
||||
- }
|
||||
-
|
||||
- if (!itemstack1.isEmpty()) {
|
||||
- this.getAttributeMap().b(itemstack1.a(enumitemslot));
|
||||
- }
|
||||
-
|
||||
- switch (enumitemslot.a()) {
|
||||
- case HAND:
|
||||
- this.bu.set(enumitemslot.b(), itemstack1.cloneItemStack());
|
||||
- break;
|
||||
- case ARMOR:
|
||||
- this.bv.set(enumitemslot.b(), itemstack1.cloneItemStack());
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
+ updateEntityEquipment(); // Paper - split into own method
|
||||
|
||||
if (this.ticksLived % 20 == 0) {
|
||||
this.getCombatTracker().g();
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start - split into own method from above
|
||||
+ public void updateEntityEquipment() {
|
||||
+ EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
|
||||
+ int k = aenumitemslot.length;
|
||||
+ for (int l = 0; l < k; ++l) {
|
||||
+ EnumItemSlot enumitemslot = aenumitemslot[l];
|
||||
+ ItemStack itemstack;
|
||||
+
|
||||
+ switch (enumitemslot.a()) {
|
||||
+ case HAND:
|
||||
+ itemstack = (ItemStack) this.bu.get(enumitemslot.b());
|
||||
+ break;
|
||||
+ case ARMOR:
|
||||
+ itemstack = (ItemStack) this.bv.get(enumitemslot.b());
|
||||
+ break;
|
||||
+ default:
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ ItemStack itemstack1 = this.getEquipment(enumitemslot);
|
||||
+
|
||||
+ if (!ItemStack.matches(itemstack1, itemstack)) {
|
||||
+ // Paper start - PlayerArmorChangeEvent
|
||||
+ if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) {
|
||||
+ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack);
|
||||
+ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1);
|
||||
+ new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+ ((WorldServer) this.world).getChunkProvider().broadcast(this, new PacketPlayOutEntityEquipment(this.getId(), enumitemslot, itemstack1));
|
||||
+ if (!itemstack.isEmpty()) {
|
||||
+ this.getAttributeMap().a(itemstack.a(enumitemslot));
|
||||
+ }
|
||||
+
|
||||
+ if (!itemstack1.isEmpty()) {
|
||||
+ this.getAttributeMap().b(itemstack1.a(enumitemslot));
|
||||
+ }
|
||||
+
|
||||
+ switch (enumitemslot.a()) {
|
||||
+ case HAND:
|
||||
+ this.bu.set(enumitemslot.b(), itemstack1.cloneItemStack());
|
||||
+ break;
|
||||
+ case ARMOR:
|
||||
+ this.bv.set(enumitemslot.b(), itemstack1.cloneItemStack());
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
protected float f(float f, float f1) {
|
||||
float f2 = MathHelper.g(f - this.aI);
|
||||
|
||||
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
|
||||
|
@ -8,20 +8,21 @@ diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/j
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/ContainerAnvil.java
|
||||
+++ b/src/main/java/net/minecraft/server/ContainerAnvil.java
|
||||
@@ -0,0 +0,0 @@ public class ContainerAnvil extends Container {
|
||||
@@ -0,0 +0,0 @@ public class ContainerAnvil extends ContainerAnvilAbstract {
|
||||
|
||||
if (!entityhuman.abilities.canInstantlyBuild && iblockdata.a(TagsBlock.ANVIL) && entityhuman.getRandom().nextFloat() < 0.12F) {
|
||||
IBlockData iblockdata1 = BlockAnvil.e(iblockdata);
|
||||
+ // Paper start
|
||||
+ com.destroystokyo.paper.event.block.AnvilDamagedEvent event = new com.destroystokyo.paper.event.block.AnvilDamagedEvent(getBukkitView(), iblockdata1 != null ? org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(iblockdata1) : null);
|
||||
+ if (!event.callEvent()) {
|
||||
+ return;
|
||||
+ } else if (event.getDamageState() == com.destroystokyo.paper.event.block.AnvilDamagedEvent.DamageState.BROKEN) {
|
||||
+ iblockdata1 = null;
|
||||
+ } else {
|
||||
+ iblockdata1 = ((org.bukkit.craftbukkit.block.data.CraftBlockData) event.getDamageState().getMaterial().createBlockData()).getState().set(BlockAnvil.FACING, iblockdata.get(BlockAnvil.FACING));
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
if (iblockdata1 == null) {
|
||||
world.a(blockposition, false);
|
||||
if (!entityhuman.abilities.canInstantlyBuild && iblockdata.a((Tag) TagsBlock.ANVIL) && entityhuman.getRandom().nextFloat() < 0.12F) {
|
||||
IBlockData iblockdata1 = BlockAnvil.c(iblockdata);
|
||||
-
|
||||
+ // Paper start
|
||||
+ com.destroystokyo.paper.event.block.AnvilDamagedEvent event = new com.destroystokyo.paper.event.block.AnvilDamagedEvent(getBukkitView(), iblockdata1 != null ? org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(iblockdata1) : null);
|
||||
+ if (!event.callEvent()) {
|
||||
+ return;
|
||||
+ } else if (event.getDamageState() == com.destroystokyo.paper.event.block.AnvilDamagedEvent.DamageState.BROKEN) {
|
||||
+ iblockdata1 = null;
|
||||
+ } else {
|
||||
+ iblockdata1 = ((org.bukkit.craftbukkit.block.data.CraftBlockData) event.getDamageState().getMaterial().createBlockData()).getState().set(BlockAnvil.FACING, iblockdata.get(BlockAnvil.FACING));
|
||||
+ }
|
||||
+ // Paper end
|
||||
if (iblockdata1 == null) {
|
||||
world.a(blockposition, false);
|
||||
world.triggerEffect(1029, blockposition, 0);
|
||||
|
@ -1,22 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Brokkonaut <hannos17@gmx.de>
|
||||
Date: Tue, 25 Sep 2018 06:53:43 +0200
|
||||
Subject: [PATCH] Avoid dimension id collisions
|
||||
|
||||
getDimensionId() returns the dimension id - 1. So without this patch
|
||||
we would reuse an existing dimension id, if some other dimension was
|
||||
unloaded before.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
boolean used = false;
|
||||
do {
|
||||
for (WorldServer server : console.getWorlds()) {
|
||||
- used = server.getWorldProvider().getDimensionManager().getDimensionID() == dimension;
|
||||
+ used = server.getWorldProvider().getDimensionManager().getDimensionID() + 1 == dimension; // Paper - getDimensionID returns the dimension - 1, so we have to add 1
|
||||
if (used) {
|
||||
dimension++;
|
||||
break;
|
@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class EntityItem extends Entity {
|
||||
|
||||
private void mergeNearby() {
|
||||
if (this.w()) {
|
||||
if (this.z()) {
|
||||
+ // Paper start - avoid item merge if stack size above max stack size
|
||||
+ ItemStack stack = getItemStack();
|
||||
+ if (stack.getCount() >= stack.getMaxStackSize()) return;
|
||||
|
@ -26,15 +26,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ log("Disable Unloaded Chunk Enderpearl Exploit: " + (disableEnderpearlExploit ? "enabled" : "disabled"));
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
|
||||
diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
|
||||
if (nbttagcompound.hasKeyOfType("owner", 10)) {
|
||||
this.shooterId = GameProfileSerializer.b(nbttagcompound.getCompound("owner"));
|
||||
--- a/src/main/java/net/minecraft/server/IProjectile.java
|
||||
+++ b/src/main/java/net/minecraft/server/IProjectile.java
|
||||
@@ -0,0 +0,0 @@ public abstract class IProjectile extends Entity {
|
||||
protected void loadData(NBTTagCompound nbttagcompound) {
|
||||
if (nbttagcompound.b("Owner")) {
|
||||
this.shooter = nbttagcompound.a("Owner");
|
||||
+ if (this instanceof EntityEnderPearl && this.world != null && this.world.paperConfig.disableEnderpearlExploit) { this.shooter = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit
|
||||
}
|
||||
+ if (this instanceof EntityEnderPearl && this.world != null && this.world.paperConfig.disableEnderpearlExploit) { this.shooterId = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit
|
||||
|
||||
}
|
||||
|
||||
this.d = nbttagcompound.getBoolean("LeftOwner");
|
||||
|
@ -31,8 +31,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
- this.triggerEffect(2001, blockposition, Block.getCombinedId(iblockdata));
|
||||
+ if (playEffect) this.triggerEffect(2001, blockposition, Block.getCombinedId(iblockdata)); // Paper
|
||||
if (flag) {
|
||||
TileEntity tileentity = iblockdata.getBlock().isTileEntity() ? this.getTileEntity(blockposition) : null;
|
||||
- if (!(iblockdata.getBlock() instanceof BlockFireAbstract)) {
|
||||
+ if (playEffect && !(iblockdata.getBlock() instanceof BlockFireAbstract)) { // Paper
|
||||
this.triggerEffect(2001, blockposition, Block.getCombinedId(iblockdata));
|
||||
}
|
||||
|
||||
|
@ -25,9 +25,9 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -0,0 +0,0 @@ import java.util.Iterator;
|
||||
import java.util.Optional;
|
||||
@@ -0,0 +0,0 @@ import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
import javax.annotation.Nullable;
|
||||
+import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -13,6 +13,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
public void setHasWhitelist(boolean flag) {
|
||||
+ new com.destroystokyo.paper.event.server.WhitelistToggleEvent(flag).callEvent();
|
||||
this.whitelist.setEnabled(flag); // Paper
|
||||
this.hasWhitelist = flag;
|
||||
}
|
||||
|
||||
|
@ -25,19 +25,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("TrackOutput", 1)) {
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
this.Z();
|
||||
this.setYawPitch(this.yaw, this.pitch);
|
||||
if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
|
||||
- this.setCustomName(IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName")));
|
||||
+ this.setCustomName(MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound)); // Paper - Catch ParseException
|
||||
}
|
||||
|
||||
this.setCustomNameVisible(nbttagcompound.getBoolean("CustomNameVisible"));
|
||||
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/MCUtil.java
|
||||
@ -67,8 +54,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityBanner.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityBanner.java
|
||||
@@ -0,0 +0,0 @@ public class TileEntityBanner extends TileEntity implements INamableTileEntity {
|
||||
public void load(NBTTagCompound nbttagcompound) {
|
||||
super.load(nbttagcompound);
|
||||
public void load(IBlockData iblockdata, NBTTagCompound nbttagcompound) {
|
||||
super.load(iblockdata, nbttagcompound);
|
||||
if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
|
||||
- this.a = IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName"));
|
||||
+ this.a = MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound); // Paper - Catch ParseException
|
||||
@ -80,7 +67,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityContainer.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityContainer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntityContainer extends TileEntity implements IInvento
|
||||
super.load(nbttagcompound);
|
||||
super.load(iblockdata, nbttagcompound);
|
||||
this.chestLock = ChestLock.b(nbttagcompound);
|
||||
if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
|
||||
- this.customName = IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName"));
|
||||
|
@ -1,19 +0,0 @@
|
||||
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::i));
|
||||
- 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.bw));
|
||||
}
|
@ -189,13 +189,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class ChunkProviderServer extends IChunkProvider {
|
||||
|
||||
private static final int b = (int) Math.pow(17.0D, 2.0D);
|
||||
- private static final List<ChunkStatus> c = ChunkStatus.a();
|
||||
+ private static final List<ChunkStatus> c = ChunkStatus.a(); static final List<ChunkStatus> getPossibleChunkStatuses() { return ChunkProviderServer.c; } // Paper - OBFHELPER
|
||||
- private static final List<ChunkStatus> b = ChunkStatus.a();
|
||||
+ private static final List<ChunkStatus> b = ChunkStatus.a(); static final List<ChunkStatus> getPossibleChunkStatuses() { return ChunkProviderServer.b; } // Paper - OBFHELPER
|
||||
private final ChunkMapDistance chunkMapDistance;
|
||||
public final ChunkGenerator<?> chunkGenerator;
|
||||
public final ChunkGenerator chunkGenerator;
|
||||
private final WorldServer world;
|
||||
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
||||
@@ -0,0 +0,0 @@ public abstract class ChunkMapDistance {
|
||||
private final ChunkMapDistance.a e = new ChunkMapDistance.a();
|
||||
private final ChunkMapDistance.a ticketLevelTracker = new ChunkMapDistance.a();
|
||||
private final ChunkMapDistance.b f = new ChunkMapDistance.b(8);
|
||||
private final ChunkMapDistance.c g = new ChunkMapDistance.c(33);
|
||||
- private final Set<PlayerChunk> pendingChunkUpdates = Sets.newHashSet();
|
||||
|
@ -60,12 +60,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
public abstract class LootSelectorEntry extends LootEntryAbstract {
|
||||
|
||||
- protected final int c;
|
||||
- protected final int e;
|
||||
- protected final int f;
|
||||
+ protected final int e; public int getWeight() { return e; } // Paper - OBFHELPER
|
||||
+ protected final int f; public int getQuality() { return f; } // Paper - OBFHELPER
|
||||
protected final LootItemFunction[] g;
|
||||
private final BiFunction<ItemStack, LootTableInfo, ItemStack> c;
|
||||
+ protected final int c; public int getWeight() { return c; } // Paper - OBFHELPER
|
||||
+ protected final int e; public int getQuality() { return e; } // Paper - OBFHELPER
|
||||
protected final LootItemFunction[] f;
|
||||
private final BiFunction<ItemStack, LootTableInfo, ItemStack> g;
|
||||
private final LootEntry h = new LootSelectorEntry.c() {
|
||||
@@ -0,0 +0,0 @@ public abstract class LootSelectorEntry extends LootEntryAbstract {
|
||||
|
||||
@ -77,7 +77,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
@Override
|
||||
public int a(float f) {
|
||||
- return Math.max(MathHelper.d((float) LootSelectorEntry.this.e + (float) LootSelectorEntry.this.f * f), 0);
|
||||
- return Math.max(MathHelper.d((float) LootSelectorEntry.this.c + (float) LootSelectorEntry.this.e * f), 0);
|
||||
+ // Paper start - Offer an alternative loot formula to refactor how luck bonus applies
|
||||
+ // SEE: https://luckformula.emc.gs for details and data
|
||||
+ if (lastLuck != null && lastLuck == f) {
|
||||
@ -104,7 +104,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ return lastWeight;
|
||||
}
|
||||
}
|
||||
+ private Float lastLuck = null;
|
||||
+ private int lastWeight = 0;
|
||||
+ // Paper end
|
||||
+ private Float lastLuck = null;
|
||||
+ private int lastWeight = 0;
|
||||
+ // Paper end
|
||||
}
|
||||
|
@ -39,7 +39,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
EnumDirection enumdirection = (EnumDirection) iworldreader.getType(blockposition).get(BlockBed.FACING);
|
||||
+ // Paper start - configurable bed search radius
|
||||
+ if (entitytypes == EntityTypes.PLAYER) return findSafePosition(entitytypes, (World) iworldreader, enumdirection, blockposition);
|
||||
+
|
||||
int j = blockposition.getX();
|
||||
int k = blockposition.getY();
|
||||
int l = blockposition.getZ();
|
||||
@ -47,7 +46,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
- protected static Optional<Vec3D> a(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition) {
|
||||
- public static Optional<Vec3D> a(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition) {
|
||||
+ private static Optional<Vec3D> findSafePosition(EntityTypes<?> entitytypes, World world, EnumDirection updirection, BlockPosition blockposition){
|
||||
+ int radius = world.paperConfig.bedSearchRadius;
|
||||
+ double angle = Math.PI / 2;
|
||||
@ -143,15 +142,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end
|
||||
+
|
||||
+ // Paper start -- add maxBelow param
|
||||
+ protected static Optional<Vec3D> a(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition) { return isSafeRespawn(entitytypes, iworldreader, blockposition, 2); }
|
||||
+ protected static Optional<Vec3D> isSafeRespawn(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition, int maxBelow) {
|
||||
+ public static Optional<Vec3D> a(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition) { return isSafeRespawn(entitytypes, iworldreader, blockposition, 2); }
|
||||
+ public static Optional<Vec3D> isSafeRespawn(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition, int maxBelow) {
|
||||
+ // Paper end
|
||||
VoxelShape voxelshape = iworldreader.getType(blockposition).getCollisionShape(iworldreader, blockposition);
|
||||
|
||||
if (voxelshape.c(EnumDirection.EnumAxis.Y) > 0.4375D) {
|
||||
@@ -0,0 +0,0 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity {
|
||||
} else {
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(blockposition);
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.i();
|
||||
|
||||
- while (blockposition_mutableblockposition.getY() >= 0 && blockposition.getY() - blockposition_mutableblockposition.getY() <= 2 && iworldreader.getType(blockposition_mutableblockposition).getCollisionShape(iworldreader, blockposition_mutableblockposition).isEmpty()) {
|
||||
+ while (blockposition_mutableblockposition.getY() >= 0 && blockposition.getY() - blockposition_mutableblockposition.getY() <= maxBelow && iworldreader.getType(blockposition_mutableblockposition).getCollisionShape(iworldreader, blockposition_mutableblockposition).isEmpty()) { // Paper -- configurable max distance to search below
|
||||
|
@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ worldloadlistener.setChunkRadius(radiusBlocks / 16);
|
||||
+ // Paper end
|
||||
+
|
||||
MinecraftServer.LOGGER.info("Preparing start region for dimension '{}'/{}", worldserver.getWorldData().getName(), DimensionManager.a(worldserver.worldProvider.getDimensionManager().getType())); // CraftBukkit
|
||||
MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.getDimensionKey().a());
|
||||
BlockPosition blockposition = worldserver.getSpawn();
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
@ -105,8 +105,8 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/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 {
|
||||
return ((PersistentIdCounts) this.getMinecraftServer().getWorldServer(DimensionManager.OVERWORLD).getWorldPersistentData().a(PersistentIdCounts::new, "idcounts")).a();
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
return ((PersistentIdCounts) this.getMinecraftServer().D().getWorldPersistentData().a(PersistentIdCounts::new, "idcounts")).a();
|
||||
}
|
||||
|
||||
+ // Paper start - helper function for configurable spawn radius
|
||||
@ -180,13 +180,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public void a_(BlockPosition blockposition) {
|
||||
- ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.b(), 0, this.worldData.d()));
|
||||
- ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c()));
|
||||
+ // Paper - configurable spawn radius
|
||||
+ BlockPosition prevSpawn = this.getSpawn();
|
||||
+ //ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c()));
|
||||
|
||||
super.a_(blockposition);
|
||||
this.worldData.setSpawn(blockposition);
|
||||
- this.getChunkProvider().removeTicket(TicketType.START, chunkcoordintpair, 11, Unit.INSTANCE);
|
||||
- this.getChunkProvider().addTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
|
||||
+ if (this.keepSpawnInMemory) {
|
||||
@ -194,10 +194,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ this.removeTicketsForSpawn(this.paperConfig.keepLoadedRange, prevSpawn);
|
||||
+ this.addTicketsForSpawn(this.paperConfig.keepLoadedRange, blockposition);
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.getMinecraftServer().getPlayerList().sendAll(new PacketPlayOutSpawnPosition(blockposition));
|
||||
}
|
||||
|
||||
public LongSet getForceLoadedChunks() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
|
@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) {
|
||||
throttleTracker.put(address, currentTime);
|
||||
- chatmessage = new ChatMessage("Connection throttled! Please wait before reconnecting.");
|
||||
+ chatmessage = new ChatMessage(com.destroystokyo.paper.PaperConfig.connectionThrottleKickMessage); // Paper - Configurable connection throttle kick message
|
||||
this.b.sendPacket(new PacketLoginOutDisconnect(chatmessage));
|
||||
this.b.close(chatmessage);
|
||||
+ chatmessage = new ChatMessage(com.destroystokyo.paper.PaperConfig.connectionThrottleKickMessage); // Paper - Configurable connection throttle kick message
|
||||
this.c.sendPacket(new PacketLoginOutDisconnect(chatmessage));
|
||||
this.c.close(chatmessage);
|
||||
return;
|
||||
|
@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@Override
|
||||
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
|
||||
if (this.a(world, blockposition, iblockdata)) {
|
||||
- world.getFluidTickList().a(blockposition, iblockdata.getFluid().getType(), this.a((IWorldReader) world));
|
||||
- world.getFluidTickList().a(blockposition, iblockdata.getFluid().getType(), this.b.a((IWorldReader) world));
|
||||
+ world.getFluidTickList().a(blockposition, iblockdata.getFluid().getType(), this.getFlowSpeed(world, blockposition)); // Paper
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ return world.paperConfig.waterOverLavaFlowSpeed;
|
||||
+ }
|
||||
+ }
|
||||
+ return this.a(world);
|
||||
+ return this.b.a(world);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@Override
|
||||
public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
||||
if (this.a(world, blockposition, iblockdata)) {
|
||||
- world.getFluidTickList().a(blockposition, iblockdata.getFluid().getType(), this.a((IWorldReader) world));
|
||||
- world.getFluidTickList().a(blockposition, iblockdata.getFluid().getType(), this.b.a((IWorldReader) world));
|
||||
+ world.getFluidTickList().a(blockposition, iblockdata.getFluid().getType(), this.getFlowSpeed(world, blockposition)); // Paper
|
||||
}
|
||||
|
||||
|
@ -27,42 +27,42 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class PlayerInteractManager {
|
||||
IBlockData iblockdata;
|
||||
|
||||
if (this.i) {
|
||||
- iblockdata = this.world.getType(this.j);
|
||||
if (this.j) {
|
||||
- iblockdata = this.world.getType(this.k);
|
||||
- if (iblockdata.isAir()) {
|
||||
+ iblockdata = this.world.getTypeIfLoaded(this.j); // Paper
|
||||
+ iblockdata = this.world.getTypeIfLoaded(this.k); // Paper
|
||||
+ if (iblockdata == null || iblockdata.isAir()) { // Paper
|
||||
this.i = false;
|
||||
this.j = false;
|
||||
} else {
|
||||
float f = this.a(iblockdata, this.j, this.k);
|
||||
float f = this.a(iblockdata, this.k, this.l);
|
||||
@@ -0,0 +0,0 @@ public class PlayerInteractManager {
|
||||
}
|
||||
}
|
||||
} else if (this.e) {
|
||||
- iblockdata = this.world.getType(this.g);
|
||||
} else if (this.f) {
|
||||
- iblockdata = this.world.getType(this.h);
|
||||
+ // Paper start - don't want to do same logic as above, return instead
|
||||
+ iblockdata = this.world.getTypeIfLoaded(this.g);
|
||||
+ iblockdata = this.world.getTypeIfLoaded(this.h);
|
||||
+ if (iblockdata == null) {
|
||||
+ this.e = false;
|
||||
+ this.f = false;
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
if (iblockdata.isAir()) {
|
||||
this.world.a(this.player.getId(), this.g, -1);
|
||||
this.l = -1;
|
||||
this.world.a(this.player.getId(), this.h, -1);
|
||||
this.m = -1;
|
||||
@@ -0,0 +0,0 @@ public class PlayerInteractManager {
|
||||
this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, true, "stopped destroying"));
|
||||
} else if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.ABORT_DESTROY_BLOCK) {
|
||||
this.e = false;
|
||||
- if (!Objects.equals(this.g, blockposition)) {
|
||||
+ if (!Objects.equals(this.g, blockposition) && !BlockPosition.ZERO.equals(this.g)) { // Paper
|
||||
PlayerInteractManager.LOGGER.debug("Mismatch in destroy block pos: " + this.g + " " + blockposition); // CraftBukkit - SPIGOT-5457 sent by client when interact event cancelled
|
||||
- this.world.a(this.player.getId(), this.g, -1);
|
||||
- this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(this.g, this.world.getType(this.g), packetplayinblockdig_enumplayerdigtype, true, "aborted mismatched destroying"));
|
||||
+ IBlockData type = this.world.getTypeIfLoaded(this.g); // Paper - don't load unloaded chunks for stale records here
|
||||
+ if (type != null) this.world.a(this.player.getId(), this.g, -1); // Paper
|
||||
+ if (type != null) this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(this.g, type, packetplayinblockdig_enumplayerdigtype, true, "aborted mismatched destroying")); // Paper
|
||||
+ this.g = BlockPosition.ZERO; // Paper
|
||||
this.f = false;
|
||||
- if (!Objects.equals(this.h, blockposition)) {
|
||||
+ if (!Objects.equals(this.h, blockposition) && !BlockPosition.ZERO.equals(this.h)) {
|
||||
PlayerInteractManager.LOGGER.debug("Mismatch in destroy block pos: " + this.h + " " + blockposition); // CraftBukkit - SPIGOT-5457 sent by client when interact event cancelled
|
||||
- this.world.a(this.player.getId(), this.h, -1);
|
||||
- this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(this.h, this.world.getType(this.h), packetplayinblockdig_enumplayerdigtype, true, "aborted mismatched destroying"));
|
||||
+ IBlockData type = this.world.getTypeIfLoaded(this.h); // Paper - don't load unloaded chunks for stale records here
|
||||
+ if (type != null) this.world.a(this.player.getId(), this.h, -1); // Paper
|
||||
+ if (type != null) this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(this.h, type, packetplayinblockdig_enumplayerdigtype, true, "aborted mismatched destroying")); // Paper
|
||||
+ this.h = BlockPosition.ZERO; // Paper
|
||||
}
|
||||
|
||||
this.world.a(this.player.getId(), blockposition, -1);
|
||||
|
@ -14,6 +14,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
super(entitytypes, world);
|
||||
- this.random.setSeed((long) this.getId());
|
||||
+ //this.random.setSeed((long) this.getId()); // Paper
|
||||
this.bC = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
|
||||
this.bB = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/TileEntitySign.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntitySign.java
|
||||
@@ -0,0 +0,0 @@ public class TileEntitySign extends TileEntity implements ICommandListener { //
|
||||
private final String[] g = new String[4];
|
||||
private final IChatFormatted[] g;
|
||||
private EnumColor color;
|
||||
public java.util.UUID signEditor; // Paper
|
||||
+ private static final boolean CONVERT_LEGACY_SIGNS = Boolean.getBoolean("convertLegacySigns"); // Paper
|
||||
|
@ -37,8 +37,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- 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 {
|
||||
log("Using vanilla redstone algorithm.");
|
||||
}
|
||||
private void preventMovingIntoUnloadedChunks() {
|
||||
preventMovingIntoUnloadedChunks = getBoolean("prevent-moving-into-unloaded-chunks", false);
|
||||
}
|
||||
+
|
||||
+ public enum DuplicateUUIDMode {
|
||||
@ -100,10 +100,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
});
|
||||
}
|
||||
|
||||
+ public void setUUID(UUID uuid) { a(uuid); } // Paper - OBFHELPER
|
||||
public void a(UUID uuid) {
|
||||
+ public void setUUID(UUID uuid) { a_(uuid); } // Paper - OBFHELPER
|
||||
public void a_(UUID uuid) {
|
||||
this.uniqueID = uuid;
|
||||
this.am = this.uniqueID.toString();
|
||||
this.al = this.uniqueID.toString();
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
@ -116,10 +116,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.ComparisonChain; // Paper
|
||||
@@ -0,0 +0,0 @@ import java.io.File;
|
||||
@@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.objects.ObjectIterator;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
+import java.util.HashMap; // Paper
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
@ -200,8 +200,8 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/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 @@ package net.minecraft.server;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
@@ -0,0 +0,0 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import co.aikar.timings.TimingHistory; // Paper
|
||||
import co.aikar.timings.Timings; // Paper
|
||||
+
|
||||
@ -209,7 +209,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Queues;
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
if (entity1 == null) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
|
||||
+ if (new com.destroystokyo.paper.event.entity.EnderDragonFireballHitEvent((org.bukkit.entity.DragonFireball) this.getBukkitEntity(), list.stream().map(EntityLiving::getBukkitLivingEntity).collect(java.util.stream.Collectors.toList()), (org.bukkit.entity.AreaEffectCloud) entityareaeffectcloud.getBukkitEntity()).callEvent()) { // Paper
|
||||
this.world.triggerEffect(2006, new BlockPosition(this), 0);
|
||||
this.world.triggerEffect(2006, this.getChunkCoordinates(), this.isSilent() ? -1 : 1);
|
||||
this.world.addEntity(entityareaeffectcloud);
|
||||
+ } else entityareaeffectcloud.die(); // Paper
|
||||
this.die();
|
||||
|
@ -9,13 +9,13 @@ diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/j
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster {
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
|
||||
super.mobTick();
|
||||
}
|
||||
|
||||
+ public final boolean teleportRandomly() { return this.eq(); } // Paper - OBFHELPER
|
||||
protected boolean eq() {
|
||||
if (!this.world.p_() && this.isAlive()) {
|
||||
+ public final boolean teleportRandomly() { return this.eM(); } // Paper - OBFHELPER
|
||||
protected boolean eM() {
|
||||
if (!this.world.s_() && this.isAlive()) {
|
||||
double d0 = this.locX() + (this.random.nextDouble() - 0.5D) * 64.0D;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
@ -11,18 +11,18 @@ diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/j
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster {
|
||||
this.setCarried(iblockdata);
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
|
||||
this.a((WorldServer) this.world, nbttagcompound);
|
||||
}
|
||||
|
||||
+ // Paper start - OBFHELPER - ok not really, but verify this on updates
|
||||
private boolean f(EntityHuman entityhuman) {
|
||||
+ boolean shouldAttack = f_real(entityhuman);
|
||||
private boolean g(EntityHuman entityhuman) {
|
||||
+ boolean shouldAttack = g_real(entityhuman);
|
||||
+ com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent event = new com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent((org.bukkit.entity.Enderman) getBukkitEntity(), (org.bukkit.entity.Player) entityhuman.getBukkitEntity());
|
||||
+ event.setCancelled(!shouldAttack);
|
||||
+ return event.callEvent();
|
||||
+ }
|
||||
+ private boolean f_real(EntityHuman entityhuman) {
|
||||
+ private boolean g_real(EntityHuman entityhuman) {
|
||||
+ // Paper end
|
||||
ItemStack itemstack = (ItemStack) entityhuman.inventory.armor.get(3);
|
||||
|
||||
|
@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Predicate;
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster {
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
|
||||
setGoalTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.UNKNOWN, true);
|
||||
}
|
||||
|
||||
@ -32,37 +32,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@Override
|
||||
public boolean setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) {
|
||||
if (!super.setGoalTarget(entityliving, reason, fireEvent)) {
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster {
|
||||
if (this.world.isDay() && this.ticksLived >= this.bA + 600) {
|
||||
float f = this.aI();
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
|
||||
if (this.world.isDay() && this.ticksLived >= this.bz + 600) {
|
||||
float f = this.aO();
|
||||
|
||||
- if (f > 0.5F && this.world.f(new BlockPosition(this)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
|
||||
+ if (f > 0.5F && this.world.f(new BlockPosition(this)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper
|
||||
- if (f > 0.5F && this.world.f(this.getChunkCoordinates()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
|
||||
+ if (f > 0.5F && this.world.f(this.getChunkCoordinates()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper
|
||||
this.setGoalTarget((EntityLiving) null);
|
||||
this.eq();
|
||||
this.eM();
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster {
|
||||
} else if (!(damagesource instanceof EntityDamageSourceIndirect) && damagesource != DamageSource.FIREWORKS) {
|
||||
boolean flag = super.damageEntity(damagesource, f);
|
||||
|
||||
- if (!this.world.p_() && damagesource.ignoresArmor() && this.random.nextInt(10) != 0) {
|
||||
+ if (!this.world.p_() && damagesource.ignoresArmor() && this.random.nextInt(10) != 0 && this.tryEscape(damagesource == DamageSource.DROWN ? EndermanEscapeEvent.Reason.DROWN : EndermanEscapeEvent.Reason.CRITICAL_HIT)) { // Paper
|
||||
this.eq();
|
||||
}
|
||||
|
||||
return flag;
|
||||
} else {
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
|
||||
if (this.isInvulnerable(damagesource)) {
|
||||
return false;
|
||||
} else if (damagesource instanceof EntityDamageSourceIndirect) {
|
||||
+ if (this.tryEscape(EndermanEscapeEvent.Reason.INDIRECT)) { // Paper start
|
||||
for (int i = 0; i < 64; ++i) {
|
||||
if (this.eq()) {
|
||||
if (this.eM()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+ } // Paper end
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster {
|
||||
} else {
|
||||
boolean flag = super.damageEntity(damagesource, f);
|
||||
|
||||
- if (!this.world.s_() && this.random.nextInt(10) != 0) {
|
||||
+ if (!this.world.s_() && this.random.nextInt(10) != 0 && this.tryEscape(damagesource == DamageSource.DROWN ? EndermanEscapeEvent.Reason.DROWN : EndermanEscapeEvent.Reason.CRITICAL_HIT)) { // Paper
|
||||
this.eM();
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
|
||||
|
||||
static class PathfinderGoalPlayerWhoLookedAtTarget extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
|
||||
|
||||
@ -71,12 +71,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
private EntityHuman j;
|
||||
private int k;
|
||||
private int l;
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster {
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
|
||||
} else {
|
||||
if (this.c != null && !this.i.isPassenger()) {
|
||||
if (this.i.f((EntityHuman) this.c)) {
|
||||
if (this.i.g((EntityHuman) this.c)) {
|
||||
- if (this.c.h((Entity) this.i) < 16.0D) {
|
||||
+ if (this.c.h((Entity) this.i) < 16.0D && this.getEnderman().tryEscape(EndermanEscapeEvent.Reason.STARE)) {
|
||||
this.i.eq();
|
||||
this.i.eM();
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
// CraftBukkit start
|
||||
WorldServer finalWorldServer = worldserver;
|
||||
WorldServer finalWorldServer = worldserver1;
|
||||
Entity entity = EntityTypes.a(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> {
|
||||
- return !finalWorldServer.addEntitySerialized(entity1) ? null : entity1;
|
||||
+ return !finalWorldServer.addEntitySerialized(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1; // Paper
|
||||
@ -75,7 +75,7 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/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 {
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
// CraftBukkit start
|
||||
private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot
|
||||
|
@ -22,7 +22,7 @@ diff --git a/src/main/java/net/minecraft/server/ItemBow.java b/src/main/java/net
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemBow.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemBow.java
|
||||
@@ -0,0 +0,0 @@ public class ItemBow extends ItemProjectileWeapon {
|
||||
@@ -0,0 +0,0 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable {
|
||||
if ((double) f >= 0.1D) {
|
||||
boolean flag1 = flag && itemstack1.getItem() == Items.ARROW;
|
||||
|
||||
@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (!world.isClientSide) {
|
||||
ItemArrow itemarrow = (ItemArrow) ((ItemArrow) (itemstack1.getItem() instanceof ItemArrow ? itemstack1.getItem() : Items.ARROW));
|
||||
EntityArrow entityarrow = itemarrow.a(world, itemstack1, (EntityLiving) entityhuman);
|
||||
@@ -0,0 +0,0 @@ public class ItemBow extends ItemProjectileWeapon {
|
||||
@@ -0,0 +0,0 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable {
|
||||
entityarrow.setOnFire(100);
|
||||
}
|
||||
// CraftBukkit start
|
||||
@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (event.isCancelled()) {
|
||||
event.getProjectile().remove();
|
||||
return;
|
||||
@@ -0,0 +0,0 @@ public class ItemBow extends ItemProjectileWeapon {
|
||||
@@ -0,0 +0,0 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable {
|
||||
itemstack.damage(1, entityhuman, (entityhuman1) -> {
|
||||
entityhuman1.broadcastItemBreak(entityhuman.getRaisedHand());
|
||||
});
|
||||
@ -49,10 +49,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
entityarrow.fromPlayer = EntityArrow.PickupStatus.CREATIVE_ONLY;
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class ItemBow extends ItemProjectileWeapon {
|
||||
@@ -0,0 +0,0 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable {
|
||||
}
|
||||
|
||||
world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (ItemBow.i.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
|
||||
world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (ItemBow.RANDOM.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
|
||||
- if (!flag1 && !entityhuman.abilities.canInstantlyBuild) {
|
||||
+ if (!flag1 && !entityhuman.abilities.canInstantlyBuild && consumeArrow) { // Paper
|
||||
itemstack1.subtract(1);
|
||||
@ -62,7 +62,7 @@ diff --git a/src/main/java/net/minecraft/server/ItemCrossbow.java b/src/main/jav
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemCrossbow.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemCrossbow.java
|
||||
@@ -0,0 +0,0 @@ public class ItemCrossbow extends ItemProjectileWeapon {
|
||||
@@ -0,0 +0,0 @@ public class ItemCrossbow extends ItemProjectileWeapon implements ItemVanishable
|
||||
((IProjectile) object).shoot((double) vector3fa.a(), (double) vector3fa.b(), (double) vector3fa.c(), f1, f2);
|
||||
}
|
||||
// CraftBukkit start
|
||||
|
@ -4,42 +4,46 @@ Date: Thu, 26 Jul 2018 15:30:03 -0400
|
||||
Subject: [PATCH] EntityTransformedEvent
|
||||
|
||||
|
||||
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 (CraftEventFactory.callEntityTransformEvent(this, t0, EntityTransformEvent.TransformReason.DROWNED).isCancelled()) {
|
||||
return null;
|
||||
}
|
||||
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), t0.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.DROWNED).callEvent()) return null; // Paper
|
||||
this.world.addEntity(t0, CreatureSpawnEvent.SpawnReason.DROWNED);
|
||||
// CraftBukkit end
|
||||
this.die();
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityMushroomCow.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java
|
||||
@@ -0,0 +0,0 @@ public class EntityMushroomCow extends EntityCow {
|
||||
if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entitycow.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.SHEARED).callEvent()) return false; // Paper
|
||||
this.world.addEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
|
||||
@@ -0,0 +0,0 @@ public class EntityMushroomCow extends EntityCow implements IShearable {
|
||||
if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) {
|
||||
return;
|
||||
}
|
||||
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entitycow.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.SHEARED).callEvent()) return; // Paper
|
||||
this.world.addEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
|
||||
|
||||
this.die(); // CraftBukkit - from above
|
||||
this.die(); // CraftBukkit - from above
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
@@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
||||
if (CraftEventFactory.callEntityTransformEvent(this, entitywitch, EntityTransformEvent.TransformReason.LIGHTNING).isCancelled()) {
|
||||
return;
|
||||
}
|
||||
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entitywitch.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.LIGHTNING).callEvent()) return; // Paper
|
||||
this.world.addEntity(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
|
||||
// CraftBukkit end
|
||||
this.die();
|
||||
if (CraftEventFactory.callEntityTransformEvent(this, entitywitch, EntityTransformEvent.TransformReason.LIGHTNING).isCancelled()) {
|
||||
return;
|
||||
}
|
||||
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entitywitch.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.LIGHTNING).callEvent()) return; // Paper
|
||||
this.world.addEntity(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
|
||||
// CraftBukkit end
|
||||
this.die();
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entityzombie.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.DROWNED).callEvent()) return; // Paper
|
||||
this.world.addEntity(entityzombie, CreatureSpawnEvent.SpawnReason.DROWNED); // CraftBukkit - added spawn reason
|
||||
this.die();
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
|
||||
if (CraftEventFactory.callEntityTransformEvent(this, entityzombievillager, EntityTransformEvent.TransformReason.INFECTION).isCancelled()) {
|
||||
return;
|
||||
|
@ -13,16 +13,16 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/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 {
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
public final Int2ObjectMap<Entity> entitiesById = new Int2ObjectLinkedOpenHashMap();
|
||||
private final Map<UUID, Entity> entitiesByUUID = Maps.newHashMap();
|
||||
private final Queue<Entity> entitiesToAdd = Queues.newArrayDeque();
|
||||
- private final List<EntityPlayer> players = Lists.newArrayList();
|
||||
+ public final List<EntityPlayer> players = Lists.newArrayList(); // Paper - private -> public
|
||||
public final ChunkProviderServer chunkProvider; // Paper - public
|
||||
boolean tickingEntities;
|
||||
private final MinecraftServer server;
|
||||
private final WorldNBTStorage dataManager;
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
}
|
||||
|
||||
public <T extends ParticleParam> int sendParticles(EntityPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) {
|
||||
|
@ -289,7 +289,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ entity = new EntityExperienceOrb(world, x, y, z, 0, org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM, null, null); // Paper
|
||||
} else if (LightningStrike.class.isAssignableFrom(clazz)) {
|
||||
entity = EntityTypes.LIGHTNING_BOLT.a(world);
|
||||
} else if (Firework.class.isAssignableFrom(clazz)) {
|
||||
} else if (AreaEffectCloud.class.isAssignableFrom(clazz)) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
||||
|
@ -9,22 +9,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- 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 {
|
||||
this.datawatcher.set(EntityHuman.bt, nbttagcompound);
|
||||
this.datawatcher.set(EntityHuman.bs, nbttagcompound);
|
||||
}
|
||||
|
||||
+ public float getCooldownPeriod() { return this.ex(); } // Paper - OBFHELPER
|
||||
public float ex() {
|
||||
return (float) (1.0D / this.getAttributeInstance(GenericAttributes.ATTACK_SPEED).getValue() * 20.0D);
|
||||
+ public float getCooldownPeriod() { return this.eR(); } // Paper - OBFHELPER
|
||||
public float eR() {
|
||||
return (float) (1.0D / this.b(GenericAttributes.ATTACK_SPEED) * 20.0D);
|
||||
}
|
||||
|
||||
+ public float getCooledAttackStrength(float adjustTicks) { return s(adjustTicks); } // Paper - OBFHELPER
|
||||
public float s(float f) {
|
||||
return MathHelper.a(((float) this.aB + f) / this.ex(), 0.0F, 1.0F);
|
||||
+ public float getCooledAttackStrength(float adjustTicks) { return getAttackCooldown(adjustTicks); } // Paper - OBFHELPER
|
||||
public float getAttackCooldown(float f) {
|
||||
return MathHelper.a(((float) this.aA + f) / this.eR(), 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
+ public void resetCooldown() { this.ey(); } // Paper - OBFHELPER
|
||||
public void ey() {
|
||||
this.aB = 0;
|
||||
public void resetAttackCooldown() {
|
||||
this.aA = 0;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
@ -44,4 +44,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ //} // Paper
|
||||
// PAIL: checkME - what happened to setTypeAndData?
|
||||
// CraftBukkit end
|
||||
world.playBlockAction(blockposition, this, b0, enumdirection.b());
|
||||
world.playBlockAction(blockposition, this, b0, enumdirection.c());
|
||||
|
@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
|
||||
+ this.world.addEntity(entityarrow);
|
||||
+ }
|
||||
this.a(SoundEffects.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
this.playSound(SoundEffects.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
- this.world.addEntity(entityarrow);
|
||||
+ // Paper end
|
||||
}
|
||||
|
@ -1,217 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
|
||||
Date: Sun, 17 Mar 2019 21:46:56 +0200
|
||||
Subject: [PATCH] Fire event on GS4 query
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/RemoteConnectionThread.java b/src/main/java/net/minecraft/server/RemoteConnectionThread.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/RemoteConnectionThread.java
|
||||
+++ b/src/main/java/net/minecraft/server/RemoteConnectionThread.java
|
||||
@@ -0,0 +0,0 @@ public abstract class RemoteConnectionThread implements Runnable {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final AtomicInteger i = new AtomicInteger(0);
|
||||
protected boolean a;
|
||||
- protected final IMinecraftServer b;
|
||||
+ protected final IMinecraftServer b; protected IMinecraftServer getServer() { return this.b; } // Paper - OBFHELPER
|
||||
protected final String c;
|
||||
protected Thread d;
|
||||
protected final int e = 5;
|
||||
@@ -0,0 +0,0 @@ public abstract class RemoteConnectionThread implements Runnable {
|
||||
this.b.g(s);
|
||||
}
|
||||
|
||||
+ protected int getPlayerCount() { return this.d(); } // Paper - OBFHELPER
|
||||
protected int d() {
|
||||
return this.b.getPlayerCount();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/RemoteStatusListener.java b/src/main/java/net/minecraft/server/RemoteStatusListener.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/RemoteStatusListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/RemoteStatusListener.java
|
||||
@@ -0,0 +0,0 @@ public class RemoteStatusListener extends RemoteConnectionThread {
|
||||
|
||||
private long h;
|
||||
private final int i;
|
||||
- private final int j;
|
||||
- private final int k;
|
||||
- private final String l;
|
||||
- private final String m;
|
||||
+ private final int j; private int getServerPort() { return this.j; } // Paper - OBFHELPER
|
||||
+ private final int k; private int getMaxPlayers() { return this.k; } // Paper - OBFHELPER
|
||||
+ private final String l; private String getMotd() { return this.l; } // Paper - OBFHELPER
|
||||
+ private final String m; private String getWorldName() { return this.m; } // Paper - OBFHELPER
|
||||
private DatagramSocket n;
|
||||
private final byte[] o = new byte[1460];
|
||||
private DatagramPacket p;
|
||||
private final Map<SocketAddress, String> q;
|
||||
- private String r;
|
||||
+ private String r; private String getServerHost() { return this.r; } // Paper - OBFHELPER
|
||||
private String s;
|
||||
private final Map<SocketAddress, RemoteStatusListener.RemoteStatusChallenge> t;
|
||||
private final long u;
|
||||
- private final RemoteStatusReply v;
|
||||
+ private final RemoteStatusReply v; private RemoteStatusReply getCachedFullResponse() { return this.v; } // Paper - OBFHELPER
|
||||
private long w;
|
||||
|
||||
public RemoteStatusListener(IMinecraftServer iminecraftserver) {
|
||||
@@ -0,0 +0,0 @@ public class RemoteStatusListener extends RemoteConnectionThread {
|
||||
|
||||
remotestatusreply.a((int) 0);
|
||||
remotestatusreply.a(this.a(datagrampacket.getSocketAddress()));
|
||||
+ /* Paper start - GS4 Query event
|
||||
remotestatusreply.a(this.l);
|
||||
remotestatusreply.a("SMP");
|
||||
remotestatusreply.a(this.m);
|
||||
@@ -0,0 +0,0 @@ public class RemoteStatusListener extends RemoteConnectionThread {
|
||||
remotestatusreply.a(Integer.toString(this.k));
|
||||
remotestatusreply.a((short) this.j);
|
||||
remotestatusreply.a(this.r);
|
||||
+ */
|
||||
+ com.destroystokyo.paper.event.server.GS4QueryEvent.QueryType queryType =
|
||||
+ com.destroystokyo.paper.event.server.GS4QueryEvent.QueryType.BASIC;
|
||||
+ com.destroystokyo.paper.event.server.GS4QueryEvent.QueryResponse queryResponse = com.destroystokyo.paper.event.server.GS4QueryEvent.QueryResponse.builder()
|
||||
+ .motd(this.getMotd())
|
||||
+ .map(this.getWorldName())
|
||||
+ .currentPlayers(this.getPlayerCount())
|
||||
+ .maxPlayers(this.getMaxPlayers())
|
||||
+ .port(this.getServerPort())
|
||||
+ .hostname(this.getServerHost())
|
||||
+ .gameVersion(this.getServer().getVersion())
|
||||
+ .serverVersion(org.bukkit.Bukkit.getServer().getName() + " on " + org.bukkit.Bukkit.getServer().getBukkitVersion())
|
||||
+ .build();
|
||||
+ com.destroystokyo.paper.event.server.GS4QueryEvent queryEvent =
|
||||
+ new com.destroystokyo.paper.event.server.GS4QueryEvent(queryType, datagrampacket.getAddress(), queryResponse);
|
||||
+ queryEvent.callEvent();
|
||||
+ queryResponse = queryEvent.getResponse();
|
||||
+ remotestatusreply.writeString(queryResponse.getMotd());
|
||||
+ remotestatusreply.writeString("SMP");
|
||||
+ remotestatusreply.writeString(queryResponse.getMap());
|
||||
+ remotestatusreply.writeString(Integer.toString(queryResponse.getCurrentPlayers()));
|
||||
+ remotestatusreply.writeString(Integer.toString(queryResponse.getMaxPlayers()));
|
||||
+ remotestatusreply.writeShort((short) queryResponse.getPort());
|
||||
+ remotestatusreply.writeString(queryResponse.getHostname());
|
||||
+ // Paper end
|
||||
this.a(remotestatusreply.a(), datagrampacket);
|
||||
this.a("Status [" + socketaddress + "]");
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class RemoteStatusListener extends RemoteConnectionThread {
|
||||
this.v.a("splitnum");
|
||||
this.v.a((int) 128);
|
||||
this.v.a((int) 0);
|
||||
+ /* Paper start - GS4 Query event
|
||||
this.v.a("hostname");
|
||||
this.v.a(this.l);
|
||||
this.v.a("gametype");
|
||||
@@ -0,0 +0,0 @@ public class RemoteStatusListener extends RemoteConnectionThread {
|
||||
}
|
||||
|
||||
this.v.a((int) 0);
|
||||
+ */
|
||||
+ // Pack plugins
|
||||
+ java.util.List<com.destroystokyo.paper.event.server.GS4QueryEvent.QueryResponse.PluginInformation> plugins = java.util.Collections.emptyList();
|
||||
+ org.bukkit.plugin.Plugin[] bukkitPlugins;
|
||||
+ if(((DedicatedServer) this.getServer()).server.getQueryPlugins() && (bukkitPlugins = org.bukkit.Bukkit.getPluginManager().getPlugins()).length > 0) {
|
||||
+ plugins = java.util.stream.Stream.of(bukkitPlugins)
|
||||
+ .map(plugin -> com.destroystokyo.paper.event.server.GS4QueryEvent.QueryResponse.PluginInformation.of(plugin.getName(), plugin.getDescription().getVersion()))
|
||||
+ .collect(java.util.stream.Collectors.toList());
|
||||
+ }
|
||||
+
|
||||
+ com.destroystokyo.paper.event.server.GS4QueryEvent.QueryResponse queryResponse = com.destroystokyo.paper.event.server.GS4QueryEvent.QueryResponse.builder()
|
||||
+ .motd(this.getMotd())
|
||||
+ .map(this.getWorldName())
|
||||
+ .currentPlayers(this.getPlayerCount())
|
||||
+ .maxPlayers(this.getMaxPlayers())
|
||||
+ .port(this.getServerPort())
|
||||
+ .hostname(this.getServerHost())
|
||||
+ .plugins(plugins)
|
||||
+ .players(this.getServer().getPlayers())
|
||||
+ .gameVersion(this.getServer().getVersion())
|
||||
+ .serverVersion(org.bukkit.Bukkit.getServer().getName() + " on " + org.bukkit.Bukkit.getServer().getBukkitVersion())
|
||||
+ .build();
|
||||
+ com.destroystokyo.paper.event.server.GS4QueryEvent.QueryType queryType =
|
||||
+ com.destroystokyo.paper.event.server.GS4QueryEvent.QueryType.FULL;
|
||||
+ com.destroystokyo.paper.event.server.GS4QueryEvent queryEvent =
|
||||
+ new com.destroystokyo.paper.event.server.GS4QueryEvent(queryType, datagrampacket.getAddress(), queryResponse);
|
||||
+ queryEvent.callEvent();
|
||||
+ queryResponse = queryEvent.getResponse();
|
||||
+ this.getCachedFullResponse().writeString("hostname");
|
||||
+ this.getCachedFullResponse().writeString(queryResponse.getMotd());
|
||||
+ this.getCachedFullResponse().writeString("gametype");
|
||||
+ this.getCachedFullResponse().writeString("SMP");
|
||||
+ this.getCachedFullResponse().writeString("game_id");
|
||||
+ this.getCachedFullResponse().writeString("MINECRAFT");
|
||||
+ this.getCachedFullResponse().writeString("version");
|
||||
+ this.getCachedFullResponse().writeString(queryResponse.getGameVersion());
|
||||
+ this.getCachedFullResponse().writeString("plugins");
|
||||
+ java.lang.StringBuilder pluginsString = new java.lang.StringBuilder();
|
||||
+ pluginsString.append(queryResponse.getServerVersion());
|
||||
+ if(!queryResponse.getPlugins().isEmpty()) {
|
||||
+ pluginsString.append(": ");
|
||||
+ Iterator<com.destroystokyo.paper.event.server.GS4QueryEvent.QueryResponse.PluginInformation> iter = queryResponse.getPlugins().iterator();
|
||||
+ while(iter.hasNext()) {
|
||||
+ com.destroystokyo.paper.event.server.GS4QueryEvent.QueryResponse.PluginInformation info = iter.next();
|
||||
+ pluginsString.append(info.getName());
|
||||
+ if (info.getVersion() != null) {
|
||||
+ pluginsString.append(' ').append(info.getVersion().replaceAll(";", ","));
|
||||
+ }
|
||||
+ if (iter.hasNext()) {
|
||||
+ pluginsString.append(';').append(' ');
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ this.getCachedFullResponse().writeString(pluginsString.toString());
|
||||
+ this.getCachedFullResponse().writeString("map");
|
||||
+ this.getCachedFullResponse().writeString(queryResponse.getMap());
|
||||
+ this.getCachedFullResponse().writeString("numplayers");
|
||||
+ this.getCachedFullResponse().writeString(Integer.toString(queryResponse.getCurrentPlayers()));
|
||||
+ this.getCachedFullResponse().writeString("maxplayers");
|
||||
+ this.getCachedFullResponse().writeString(Integer.toString(queryResponse.getMaxPlayers()));
|
||||
+ this.getCachedFullResponse().writeString("hostport");
|
||||
+ this.getCachedFullResponse().writeString(Integer.toString(queryResponse.getPort()));
|
||||
+ this.getCachedFullResponse().writeString("hostip");
|
||||
+ this.getCachedFullResponse().writeString(queryResponse.getHostname());
|
||||
+ // The "meaningless data" start, copied from above
|
||||
+ this.getCachedFullResponse().writeInt(0);
|
||||
+ this.getCachedFullResponse().writeInt(1);
|
||||
+ this.getCachedFullResponse().writeString("player_");
|
||||
+ this.getCachedFullResponse().writeInt(0);
|
||||
+ // "Meaningless data" end
|
||||
+ queryResponse.getPlayers().forEach(this.getCachedFullResponse()::writeStringUnchecked);
|
||||
+ this.getCachedFullResponse().writeInt(0);
|
||||
+ // Paper end
|
||||
return this.v.a();
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/RemoteStatusReply.java b/src/main/java/net/minecraft/server/RemoteStatusReply.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/RemoteStatusReply.java
|
||||
+++ b/src/main/java/net/minecraft/server/RemoteStatusReply.java
|
||||
@@ -0,0 +0,0 @@ public class RemoteStatusReply {
|
||||
this.b.write(abyte, 0, abyte.length);
|
||||
}
|
||||
|
||||
+ public void writeString(String string) throws IOException { this.a(string); } // Paper - OBFHELPER
|
||||
public void a(String s) throws IOException {
|
||||
this.b.writeBytes(s);
|
||||
this.b.write(0);
|
||||
}
|
||||
+ // Paper start - unchecked exception variant to use in Stream API
|
||||
+ public void writeStringUnchecked(String string) {
|
||||
+ try {
|
||||
+ writeString(string);
|
||||
+ } catch (IOException e) {
|
||||
+ com.destroystokyo.paper.util.SneakyThrow.sneaky(e);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
+ public void writeInt(int i) throws IOException { this.a(i); } // Paper - OBFHELPER
|
||||
public void a(int i) throws IOException {
|
||||
this.b.write(i);
|
||||
}
|
||||
|
||||
+ public void writeShort(short i) throws IOException { this.a(i); } // Paper - OBFHELPER
|
||||
public void a(short short0) throws IOException {
|
||||
this.b.writeShort(Short.reverseBytes(short0));
|
||||
}
|
@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ return super.isMainThread() /*|| this.isStopped()*/; // CraftBukkit - MC-142590 // Paper - causes issues elsewhere
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public boolean isDebugging() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
|
@ -8,8 +8,8 @@ diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/m
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/Block.java
|
||||
+++ b/src/main/java/net/minecraft/server/Block.java
|
||||
@@ -0,0 +0,0 @@ public class Block implements IMaterial {
|
||||
return tag.isTagged(this);
|
||||
@@ -0,0 +0,0 @@ public class Block extends BlockBase implements IMaterial {
|
||||
return this == block;
|
||||
}
|
||||
|
||||
+ public static IBlockData getValidBlockForPosition(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) { return Block.b(iblockdata, generatoraccess, blockposition); } // Paper - OBFHELPER
|
||||
@ -20,8 +20,8 @@ diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/j
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster {
|
||||
if (block.a(TagsBlock.ENDERMAN_HOLDABLE) && flag) {
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
|
||||
if (block.a((Tag) TagsBlock.ENDERMAN_HOLDABLE) && flag) {
|
||||
// CraftBukkit start - Pickup event
|
||||
if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
- this.enderman.setCarried(iblockdata);
|
||||
@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster {
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
|
||||
|
||||
static class PathfinderGoalEndermanPlaceBlock extends PathfinderGoal {
|
||||
|
||||
@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
private final EntityEnderman a;
|
||||
|
||||
public PathfinderGoalEndermanPlaceBlock(EntityEnderman entityenderman) {
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster {
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
|
||||
IBlockData iblockdata = world.getType(blockposition);
|
||||
BlockPosition blockposition1 = blockposition.down();
|
||||
IBlockData iblockdata1 = world.getType(blockposition1);
|
||||
|
@ -9,9 +9,9 @@ diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/m
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/Block.java
|
||||
+++ b/src/main/java/net/minecraft/server/Block.java
|
||||
@@ -0,0 +0,0 @@ public class Block implements IMaterial {
|
||||
@@ -0,0 +0,0 @@ public class Block extends BlockBase implements IMaterial {
|
||||
|
||||
iblockdata.dropNaturally(world, blockposition, ItemStack.a);
|
||||
iblockdata.dropNaturally(world, blockposition, ItemStack.b);
|
||||
}
|
||||
-
|
||||
+ public static void dropNaturally(IBlockData iblockdata, World world, BlockPosition blockposition, @Nullable TileEntity tileentity) { a(iblockdata, world, blockposition, tileentity); }
|
||||
|
@ -16,20 +16,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemStack.java
|
||||
@@ -0,0 +0,0 @@ public final class ItemStack {
|
||||
// Paper end
|
||||
private int g;
|
||||
@Deprecated
|
||||
private Item item;
|
||||
- private NBTTagCompound tag;
|
||||
+ NBTTagCompound tag; // Paper -> package private
|
||||
private boolean h;
|
||||
private EntityItemFrame i;
|
||||
private ShapeDetectorBlock j;
|
||||
private boolean j;
|
||||
private Entity k;
|
||||
private ShapeDetectorBlock l;
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketDataSerializer.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java
|
||||
@@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf {
|
||||
if (item.usesDurability() || item.o()) {
|
||||
if (item.usesDurability() || item.n()) {
|
||||
// Spigot start - filter
|
||||
itemstack = itemstack.cloneItemStack();
|
||||
- CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
|
||||
|
@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
String[] lines = new String[4];
|
||||
|
||||
for (int i = 0; i < astring.length; ++i) {
|
||||
- lines[i] = EnumChatFormat.b(new ChatComponentText(EnumChatFormat.b(astring[i])).getString());
|
||||
- lines[i] = EnumChatFormat.a(new ChatComponentText(EnumChatFormat.a(astring[i])).getString());
|
||||
+ lines[i] = SharedConstants.a(astring[i]); //Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created.
|
||||
}
|
||||
SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines);
|
||||
|
@ -22,25 +22,27 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/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 {
|
||||
int k = MathHelper.floor(entity.locZ() / 16.0D);
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
int k = MathHelper.floor(entity.locZ() / 16.0D);
|
||||
|
||||
if (!entity.inChunk || entity.chunkX != i || entity.chunkY != j || entity.chunkZ != k) {
|
||||
- if (entity.inChunk && this.isChunkLoaded(entity.chunkX, entity.chunkZ)) {
|
||||
- this.getChunkAt(entity.chunkX, entity.chunkZ).a(entity, entity.chunkY);
|
||||
+ // Paper start - remove entity if its in a chunk more correctly.
|
||||
+ Chunk currentChunk = entity.getCurrentChunk();
|
||||
+ if (currentChunk != null) {
|
||||
+ currentChunk.removeEntity(entity);
|
||||
}
|
||||
+ // Paper end
|
||||
if (!entity.inChunk || entity.chunkX != i || entity.chunkY != j || entity.chunkZ != k) {
|
||||
+ // Paper start - remove entity if its in a chunk more correctly.
|
||||
+ Chunk currentChunk = entity.getCurrentChunk();
|
||||
+ if (currentChunk != null) {
|
||||
+ currentChunk.removeEntity(entity);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
if (entity.inChunk && this.isChunkLoaded(entity.chunkX, entity.chunkZ)) {
|
||||
this.getChunkAt(entity.chunkX, entity.chunkZ).a(entity, entity.chunkY);
|
||||
}
|
||||
|
||||
- if (!entity.cc() && !this.isChunkLoaded(i, k)) {
|
||||
+ if (!entity.valid && !entity.cc() && !this.isChunkLoaded(i, k)) { // Paper - always load chunks to register valid entities location
|
||||
entity.inChunk = false;
|
||||
} else {
|
||||
this.getChunkAt(i, k).a(entity);
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
- if (!entity.cj() && !this.isChunkLoaded(i, k)) {
|
||||
+ if (!entity.valid && !entity.cj() && !this.isChunkLoaded(i, k)) { // Paper - always load chunks to register valid entities location
|
||||
if (entity.inChunk) {
|
||||
WorldServer.LOGGER.warn("Entity {} left loaded chunk area", entity);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
- if (!tileentitysign.d() || tileentitysign.f() != this.player) {
|
||||
+ if (!tileentitysign.d() || tileentitysign.signEditor == null || !tileentitysign.signEditor.equals(this.player.getUniqueID())) {
|
||||
this.minecraftServer.warning("Player " + this.player.getDisplayName().getString() + " just tried to change non-editable sign");
|
||||
PlayerConnection.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getDisplayName().getString());
|
||||
this.sendPacket(tileentity.getUpdatePacket()); // CraftBukkit
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java
|
||||
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntitySign.java
|
||||
@@ -0,0 +0,0 @@ public class TileEntitySign extends TileEntity implements ICommandListener { //
|
||||
private EntityHuman c;
|
||||
private final String[] g = new String[4];
|
||||
private final IChatFormatted[] g;
|
||||
private EnumColor color;
|
||||
+ public java.util.UUID signEditor; // Paper
|
||||
|
||||
|
@ -1,223 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shane Freeder <theboyetronic@gmail.com>
|
||||
Date: Fri, 24 May 2019 07:53:16 +0100
|
||||
Subject: [PATCH] Fix some generation concurrency issues
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
private int tileTickPosition;
|
||||
public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
|
||||
public java.util.ArrayDeque<BlockRedstoneTorch.RedstoneUpdateInfo> redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here
|
||||
+ // Paper start - yes this is hacky as shit
|
||||
+ RegionLimitedWorldAccess regionLimited;
|
||||
+ World originalWorld;
|
||||
+ public World regionLimited(RegionLimitedWorldAccess limitedWorldAccess) {
|
||||
+ try {
|
||||
+ World clone = (World) super.clone();
|
||||
+ clone.regionLimited = limitedWorldAccess;
|
||||
+ clone.originalWorld = this;
|
||||
+ return clone;
|
||||
+ } catch (CloneNotSupportedException e1) {
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+ ChunkCoordIntPair[] strongholdCoords;
|
||||
+ List<StructureStart> strongholdStuctures = Lists.newArrayList();
|
||||
+ final java.lang.Object stuctureLock = new Object();
|
||||
+ // Paper end
|
||||
|
||||
public CraftWorld getWorld() {
|
||||
return this.world;
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldGenFeatureStateProviderWeighted.java b/src/main/java/net/minecraft/server/WorldGenFeatureStateProviderWeighted.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldGenFeatureStateProviderWeighted.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldGenFeatureStateProviderWeighted.java
|
||||
@@ -0,0 +0,0 @@ public class WorldGenFeatureStateProviderWeighted extends WorldGenFeatureStatePr
|
||||
this(new WeightedList<>(dynamic.get("entries").orElseEmptyList(), IBlockData::a));
|
||||
}
|
||||
|
||||
- public WorldGenFeatureStateProviderWeighted a(IBlockData iblockdata, int i) {
|
||||
+ public synchronized WorldGenFeatureStateProviderWeighted a(IBlockData iblockdata, int i) { // Paper
|
||||
this.b.a(iblockdata, i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
- public IBlockData a(Random random, BlockPosition blockposition) {
|
||||
+ public synchronized IBlockData a(Random random, BlockPosition blockposition) { // Paper
|
||||
return (IBlockData) this.b.b(random);
|
||||
}
|
||||
|
||||
@Override
|
||||
- public <T> T a(DynamicOps<T> dynamicops) {
|
||||
+ public synchronized <T> T a(DynamicOps<T> dynamicops) { // Paper
|
||||
Builder<T, T> builder = ImmutableMap.builder();
|
||||
|
||||
builder.put(dynamicops.createString("type"), dynamicops.createString(IRegistry.t.getKey(this.a).toString())).put(dynamicops.createString("entries"), this.b.a(dynamicops, (iblockdata) -> {
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldGenStronghold.java b/src/main/java/net/minecraft/server/WorldGenStronghold.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldGenStronghold.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldGenStronghold.java
|
||||
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
|
||||
|
||||
public class WorldGenStronghold extends StructureGenerator<WorldGenFeatureEmptyConfiguration> {
|
||||
|
||||
+ /* // Paper start - no shared state
|
||||
private boolean a;
|
||||
private ChunkCoordIntPair[] aq;
|
||||
private final List<StructureStart> ar = Lists.newArrayList();
|
||||
private long as;
|
||||
+ */
|
||||
|
||||
public WorldGenStronghold(Function<Dynamic<?>, ? extends WorldGenFeatureEmptyConfiguration> function) {
|
||||
super(function);
|
||||
@@ -0,0 +0,0 @@ public class WorldGenStronghold extends StructureGenerator<WorldGenFeatureEmptyC
|
||||
|
||||
@Override
|
||||
public boolean a(BiomeManager biomemanager, ChunkGenerator<?> chunkgenerator, Random random, int i, int j, BiomeBase biomebase) {
|
||||
+ // Paper start
|
||||
+ /*
|
||||
if (this.as != chunkgenerator.getSeed()) {
|
||||
this.d();
|
||||
}
|
||||
+ */
|
||||
+ final World world = chunkgenerator.getWorld();
|
||||
|
||||
- if (!this.a) {
|
||||
+ synchronized (world.stuctureLock) {
|
||||
+ if ( world.strongholdCoords == null) {
|
||||
this.a(chunkgenerator);
|
||||
- this.a = true;
|
||||
- }
|
||||
+ // this.a = true;
|
||||
+ }}
|
||||
+ // Paper end
|
||||
|
||||
- ChunkCoordIntPair[] achunkcoordintpair = this.aq;
|
||||
+ ChunkCoordIntPair[] achunkcoordintpair = world.strongholdCoords; // Paper
|
||||
int k = achunkcoordintpair.length;
|
||||
|
||||
for (int l = 0; l < k; ++l) {
|
||||
@@ -0,0 +0,0 @@ public class WorldGenStronghold extends StructureGenerator<WorldGenFeatureEmptyC
|
||||
}
|
||||
|
||||
private void d() {
|
||||
+ /* // Paper
|
||||
this.a = false;
|
||||
this.aq = null;
|
||||
this.ar.clear();
|
||||
+ */ // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +0,0 @@ public class WorldGenStronghold extends StructureGenerator<WorldGenFeatureEmptyC
|
||||
return 8;
|
||||
}
|
||||
|
||||
+
|
||||
@Nullable
|
||||
@Override
|
||||
public synchronized BlockPosition getNearestGeneratedFeature(World world, ChunkGenerator<? extends GeneratorSettingsDefault> chunkgenerator, BlockPosition blockposition, int i, boolean flag) {
|
||||
if (!chunkgenerator.getWorldChunkManager().a(this)) {
|
||||
return null;
|
||||
} else {
|
||||
+ // Paper start - no shared state
|
||||
+ /*
|
||||
if (this.as != world.getSeed()) {
|
||||
this.d();
|
||||
}
|
||||
+ */
|
||||
|
||||
- if (!this.a) {
|
||||
- this.a(chunkgenerator);
|
||||
- this.a = true;
|
||||
+ synchronized (world.stuctureLock) {
|
||||
+ if ( world.strongholdCoords == null) {
|
||||
+ this.a(chunkgenerator);
|
||||
+ //this.a = true;
|
||||
+ }
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
BlockPosition blockposition1 = null;
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
|
||||
double d0 = Double.MAX_VALUE;
|
||||
- ChunkCoordIntPair[] achunkcoordintpair = this.aq;
|
||||
+ ChunkCoordIntPair[] achunkcoordintpair = world.strongholdCoords; // Paper
|
||||
int j = achunkcoordintpair.length;
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
@@ -0,0 +0,0 @@ public class WorldGenStronghold extends StructureGenerator<WorldGenFeatureEmptyC
|
||||
}
|
||||
|
||||
private void a(ChunkGenerator<?> chunkgenerator) {
|
||||
- this.as = chunkgenerator.getSeed();
|
||||
+ //this.as = chunkgenerator.getSeed(); // Paper
|
||||
List<BiomeBase> list = Lists.newArrayList();
|
||||
Iterator iterator = IRegistry.BIOME.iterator();
|
||||
|
||||
@@ -0,0 +0,0 @@ public class WorldGenStronghold extends StructureGenerator<WorldGenFeatureEmptyC
|
||||
int j = chunkgenerator.getSettings().f();
|
||||
int k = chunkgenerator.getSettings().g();
|
||||
|
||||
- this.aq = new ChunkCoordIntPair[j];
|
||||
+ ChunkCoordIntPair[] strongholdCoords = chunkgenerator.getWorld().strongholdCoords = new ChunkCoordIntPair[j]; // Paper
|
||||
int l = 0;
|
||||
- Iterator iterator1 = this.ar.iterator();
|
||||
+ Iterator iterator1 = chunkgenerator.getWorld().strongholdStuctures.iterator(); // Paper
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
StructureStart structurestart = (StructureStart) iterator1.next();
|
||||
|
||||
- if (l < this.aq.length) {
|
||||
- this.aq[l++] = new ChunkCoordIntPair(structurestart.f(), structurestart.g());
|
||||
+ if (l < strongholdCoords.length) { // Paper
|
||||
+ strongholdCoords[l++] = new ChunkCoordIntPair(structurestart.f(), structurestart.g()); // Paper
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class WorldGenStronghold extends StructureGenerator<WorldGenFeatureEmptyC
|
||||
double d0 = random.nextDouble() * 3.141592653589793D * 2.0D;
|
||||
int i1 = l;
|
||||
|
||||
- if (l < this.aq.length) {
|
||||
+ if (l < strongholdCoords.length) { // Paper
|
||||
int j1 = 0;
|
||||
int k1 = 0;
|
||||
|
||||
- for (int l1 = 0; l1 < this.aq.length; ++l1) {
|
||||
+ for (int l1 = 0; l1 < strongholdCoords.length; ++l1) { // Paper
|
||||
double d1 = (double) (4 * i + i * k1 * 6) + (random.nextDouble() - 0.5D) * (double) i * 2.5D;
|
||||
int i2 = (int) Math.round(Math.cos(d0) * d1);
|
||||
int j2 = (int) Math.round(Math.sin(d0) * d1);
|
||||
@@ -0,0 +0,0 @@ public class WorldGenStronghold extends StructureGenerator<WorldGenFeatureEmptyC
|
||||
}
|
||||
|
||||
if (l1 >= i1) {
|
||||
- this.aq[l1] = new ChunkCoordIntPair(i2, j2);
|
||||
+ strongholdCoords[l1] = new ChunkCoordIntPair(i2, j2); // Paper
|
||||
}
|
||||
|
||||
d0 += 6.283185307179586D / (double) k;
|
||||
@@ -0,0 +0,0 @@ public class WorldGenStronghold extends StructureGenerator<WorldGenFeatureEmptyC
|
||||
++k1;
|
||||
j1 = 0;
|
||||
k += 2 * k / (k1 + 1);
|
||||
- k = Math.min(k, this.aq.length - l1);
|
||||
+ k = Math.min(k, strongholdCoords.length - l1); // Paper
|
||||
d0 += random.nextDouble() * 3.141592653589793D * 2.0D;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class WorldGenStronghold extends StructureGenerator<WorldGenFeatureEmptyC
|
||||
this.a(chunkgenerator.getSeaLevel(), this.d, 10);
|
||||
} while (this.b.isEmpty() || worldgenstrongholdpieces_worldgenstrongholdstart.b == null);
|
||||
|
||||
- ((WorldGenStronghold) this.l()).ar.add(this);
|
||||
+ chunkgenerator.getWorld().strongholdStuctures.add(this); // Paper - this worries me, this is never cleared, even in vanilla (world seed never changes "world", and that appears to be the only relevant world)
|
||||
}
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.getDataWatcher().set(EntityItemFrame.ITEM, itemstack);
|
||||
- if (!itemstack.isEmpty() && playSound) { // CraftBukkit
|
||||
+ if (!itemstack.isEmpty() && flag && playSound) { // CraftBukkit // Paper - only play sound when update flag is set
|
||||
this.a(SoundEffects.ENTITY_ITEM_FRAME_ADD_ITEM, 1.0F, 1.0F);
|
||||
this.playSound(SoundEffects.ENTITY_ITEM_FRAME_ADD_ITEM, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java
|
||||
|
@ -25,11 +25,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ return extraPackets;
|
||||
+ }
|
||||
+ // Paper end
|
||||
public PacketPlayOutMapChunk(Chunk chunk, int i) {
|
||||
public PacketPlayOutMapChunk(Chunk chunk, int i, boolean flag) {
|
||||
ChunkCoordIntPair chunkcoordintpair = chunk.getPos();
|
||||
|
||||
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
|
||||
this.c = this.a(new PacketDataSerializer(this.j()), chunk, i);
|
||||
this.c = this.a(new PacketDataSerializer(this.k()), chunk, i);
|
||||
this.g = Lists.newArrayList();
|
||||
iterator = chunk.getTileEntities().entrySet().iterator();
|
||||
+ int totalTileEntities = 0; // Paper
|
||||
|
@ -1,38 +0,0 @@
|
||||
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 bw;
|
||||
+ private boolean bw; public boolean isJohnny() { return bw; } public void setJohnny(boolean johnny) { bw = 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
|
||||
}
|
@ -7,19 +7,6 @@ Allows us to do fun stuff like rewrite the OBC util fastutil location to
|
||||
our own relocation. Also lets us rewrite NMS calls for when we're
|
||||
debugging in an IDE pre-relocate.
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -0,0 +0,0 @@
|
||||
<dependency>
|
||||
<groupId>org.ow2.asm</groupId>
|
||||
<artifactId>asm</artifactId>
|
||||
- <version>7.3.1</version>
|
||||
+ <version>8.0.1</version> <!-- Paper -->
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
@ -94,11 +81,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
{
|
||||
OptionParser parser = new OptionParser();
|
||||
@@ -0,0 +0,0 @@ public class Commodore
|
||||
ClassReader cr = new ClassReader( b );
|
||||
ClassWriter cw = new ClassWriter( cr, 0 );
|
||||
|
||||
- cr.accept( new ClassVisitor( Opcodes.ASM7, cw )
|
||||
+ cr.accept( new ClassVisitor( Opcodes.ASM8, cw) // Paper
|
||||
cr.accept( new ClassVisitor( Opcodes.ASM8, cw )
|
||||
{
|
||||
+ // Paper start - Rewrite plugins
|
||||
+ @Override
|
||||
@ -160,8 +144,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ super.visitFrame( type, nLocal, local, nStack, stack );
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+
|
||||
+ @Override
|
||||
+ public void visitLocalVariable(String name, String descriptor, String signature, Label start, Label end, int index)
|
||||
+ {
|
||||
@ -170,8 +152,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ super.visitLocalVariable( name, descriptor, signature, start, end, index );
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
+
|
||||
|
||||
@Override
|
||||
public void visitFieldInsn(int opcode, String owner, String name, String desc)
|
||||
@ -184,9 +164,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
if ( modern )
|
||||
if ( owner.equals( "org/bukkit/block/Biome" ) )
|
||||
{
|
||||
if ( owner.equals( "org/bukkit/Material" ) )
|
||||
switch ( name )
|
||||
@@ -0,0 +0,0 @@ public class Commodore
|
||||
return;
|
||||
}
|
||||
|
@ -28,12 +28,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity1 = (Entity) iterator.next();
|
||||
+ if (entity1.shouldBeRemoved) continue; // Paper
|
||||
for (int i1 = 0; i1 < l; ++i1) {
|
||||
Entity entity1 = (Entity) list1.get(i1);
|
||||
+ if (entity1.shouldBeRemoved) continue; // Paper
|
||||
|
||||
if (entity1.getBoundingBox().c(axisalignedbb) && entity1 != entity) {
|
||||
if (predicate == null || predicate.test(entity1)) {
|
||||
if (entity1.getBoundingBox().c(axisalignedbb) && entity1 != entity) {
|
||||
if (predicate == null || predicate.test(entity1)) {
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@ -66,16 +66,7 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/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 {
|
||||
|
||||
while (objectiterator.hasNext()) {
|
||||
Entity entity = (Entity) objectiterator.next();
|
||||
-
|
||||
+ if (entity.shouldBeRemoved) continue; // Paper
|
||||
if (entity instanceof EntityInsentient) {
|
||||
EntityInsentient entityinsentient = (EntityInsentient) entity;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
entity.origin = entity.getBukkitEntity().getLocation();
|
||||
}
|
||||
// Paper end
|
||||
@ -83,7 +74,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
this.removeEntityFromChunk(entity);
|
||||
this.entitiesById.remove(entity.getId());
|
||||
this.unregisterEntity(entity);
|
||||
|
@ -48,52 +48,40 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ return CraftSound.getSoundByEffect(soundEffectType.getFallSound());
|
||||
+ }
|
||||
+}
|
||||
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.getBlock().isTicking(this);
|
||||
}
|
||||
|
||||
+ public final SoundEffectType getStepSound() { return this.r(); } // Paper - OBFHELPER
|
||||
public SoundEffectType r() {
|
||||
return this.getBlock().getStepSound(this);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/SoundEffectType.java b/src/main/java/net/minecraft/server/SoundEffectType.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/SoundEffectType.java
|
||||
+++ b/src/main/java/net/minecraft/server/SoundEffectType.java
|
||||
@@ -0,0 +0,0 @@ public class SoundEffectType {
|
||||
public static final SoundEffectType w = new SoundEffectType(1.0F, 1.0F, SoundEffects.BLOCK_LANTERN_BREAK, SoundEffects.BLOCK_LANTERN_STEP, SoundEffects.BLOCK_LANTERN_PLACE, SoundEffects.BLOCK_LANTERN_HIT, SoundEffects.BLOCK_LANTERN_FALL);
|
||||
public final float x;
|
||||
public final float y;
|
||||
- private final SoundEffect z;
|
||||
+ private final SoundEffect z; public final SoundEffect getBreakSound() { return this.z; } // Paper - OBFHELPER
|
||||
private final SoundEffect A;
|
||||
private final SoundEffect B;
|
||||
- private final SoundEffect C;
|
||||
+ private final SoundEffect C; public final SoundEffect getHitSound() { return this.C; } // Paper - OBFHELPER
|
||||
private final SoundEffect D;
|
||||
public static final SoundEffectType U = new SoundEffectType(1.0F, 1.0F, SoundEffects.BLOCK_GILDED_BLACKSTONE_BREAK, SoundEffects.BLOCK_GILDED_BLACKSTONE_STEP, SoundEffects.BLOCK_GILDED_BLACKSTONE_PLACE, SoundEffects.BLOCK_GILDED_BLACKSTONE_HIT, SoundEffects.BLOCK_GILDED_BLACKSTONE_FALL);
|
||||
public final float V;
|
||||
public final float W;
|
||||
- private final SoundEffect X;
|
||||
+ private final SoundEffect X; public final SoundEffect getBreakSound() { return this.X; } // Paper - OBFHELPER
|
||||
private final SoundEffect Y;
|
||||
private final SoundEffect Z;
|
||||
- private final SoundEffect aa;
|
||||
+ private final SoundEffect aa; public final SoundEffect getHitSound() { return this.aa; } // Paper - OBFHELPER
|
||||
private final SoundEffect ab;
|
||||
|
||||
public SoundEffectType(float f, float f1, SoundEffect soundeffect, SoundEffect soundeffect1, SoundEffect soundeffect2, SoundEffect soundeffect3, SoundEffect soundeffect4) {
|
||||
@@ -0,0 +0,0 @@ public class SoundEffectType {
|
||||
return this.y;
|
||||
return this.W;
|
||||
}
|
||||
|
||||
+ public final SoundEffect getStepSound() { return this.d(); } // Paper - OBFHELPER
|
||||
public SoundEffect d() {
|
||||
return this.A;
|
||||
return this.Y;
|
||||
}
|
||||
|
||||
+ public final SoundEffect getPlaceSound() { return this.e(); } // Paper - OBFHELPER
|
||||
public SoundEffect e() {
|
||||
return this.B;
|
||||
return this.Z;
|
||||
}
|
||||
|
||||
+ public final SoundEffect getFallSound() { return this.g(); } // Paper - OBFHELPER
|
||||
public SoundEffect g() {
|
||||
return this.D;
|
||||
return this.ab;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
- entity.enderTeleportAndLoad((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D);
|
||||
- entity1.enderTeleportAndLoad((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D);
|
||||
+ entity.enderTeleportAndLoad(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
|
||||
+ // Paper end - EntityTeleportEndGatewayEvent
|
||||
}
|
||||
|
@ -14,9 +14,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
|
||||
private final NonNullList<ItemStack> armorItems;
|
||||
private boolean armorStandInvisible;
|
||||
public long bq;
|
||||
- private int bB;
|
||||
+ private int bB; public void setDisabledSlots(int i) { bB = i; } public int getDisabledSlots() { return bB; } // Paper - OBFHELPER
|
||||
public long bp;
|
||||
- private int bA;
|
||||
+ private int bA; public void setDisabledSlots(int i) { bA = i; } public int getDisabledSlots() { return bA; } // Paper - OBFHELPER
|
||||
public Vector3f headPose;
|
||||
public Vector3f bodyPose;
|
||||
public Vector3f leftArmPose;
|
||||
@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
+ public boolean isSlotDisabled(EnumItemSlot slot) { return this.d(slot); } // Paper - OBFHELPER
|
||||
private boolean d(EnumItemSlot enumitemslot) {
|
||||
return (this.bB & 1 << enumitemslot.c()) != 0 || enumitemslot.a() == EnumItemSlot.Function.HAND && !this.hasArms();
|
||||
return (this.bA & 1 << enumitemslot.c()) != 0 || enumitemslot.a() == EnumItemSlot.Function.HAND && !this.hasArms();
|
||||
}
|
||||
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
|
||||
|
@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
|
||||
// this.a(entityplayer1, entityplayer, worldserver); // CraftBukkit - removed
|
||||
// this.a(entityplayer1, entityplayer, worldserver1); // CraftBukkit - removed
|
||||
boolean flag2 = false;
|
||||
|
||||
+ // Paper start
|
||||
+ boolean isBedSpawn = false;
|
||||
@ -20,17 +20,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
// CraftBukkit start - fire PlayerRespawnEvent
|
||||
if (location == null) {
|
||||
- boolean isBedSpawn = false;
|
||||
+ //boolean isBedSpawn = false; Paper - moved up
|
||||
CraftWorld cworld = (CraftWorld) this.server.server.getWorld(entityplayer.spawnWorld);
|
||||
if (cworld != null && blockposition != null) {
|
||||
Optional<Vec3D> optional = EntityHuman.getBed(cworld.getHandle(), blockposition, flag1);
|
||||
+ // boolean isBedSpawn = false; // Paper - moved up
|
||||
WorldServer worldserver1 = this.server.getWorldServer(entityplayer.getSpawnDimension());
|
||||
if (worldserver1 != null) {
|
||||
Optional optional;
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
|
||||
location = respawnEvent.getRespawnLocation();
|
||||
if (!flag) entityplayer.reset(); // SPIGOT-4785
|
||||
+ isRespawn = true; // Paper
|
||||
} else {
|
||||
location.setWorld(server.getWorldServer(dimensionmanager).getWorld());
|
||||
location.setWorld(worldserver.getWorld());
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
if (entityplayer.playerConnection.isDisconnected()) {
|
||||
|
@ -9,8 +9,8 @@ diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/mai
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
|
||||
@@ -0,0 +0,0 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
@@ -0,0 +0,0 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
// CraftBukkit start
|
||||
+import java.util.List;
|
||||
@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public int cookTimeTotal;
|
||||
protected final IContainerProperties b;
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
|
||||
this.n.put(minecraftkey, j);
|
||||
this.n.put(new MinecraftKey(s), nbttagcompound1.getInt(s));
|
||||
}
|
||||
|
||||
+ // Paper start - cook speed API
|
||||
@ -43,8 +43,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
nbttagcompound.setShort("CookTimeTotal", (short) this.cookTimeTotal);
|
||||
+ nbttagcompound.setDouble("Paper.CookSpeedMultiplier", this.cookSpeedMultiplier); // Paper - cook speed multiplier API
|
||||
ContainerUtil.a(nbttagcompound, this.items);
|
||||
nbttagcompound.setShort("RecipesUsedSize", (short) this.n.size());
|
||||
int i = 0;
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
|
||||
}
|
||||
|
||||
|
@ -24,43 +24,7 @@ diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/mai
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
@@ -0,0 +0,0 @@ import javax.annotation.concurrent.Immutable;
|
||||
public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
|
||||
public static final BaseBlockPosition ZERO = new BaseBlockPosition(0, 0, 0);
|
||||
- @Deprecated
|
||||
- private final int a;
|
||||
- @Deprecated
|
||||
- private final int b;
|
||||
- @Deprecated
|
||||
- private final int c;
|
||||
// Paper start
|
||||
- public boolean isValidLocation() {
|
||||
- return a >= -30000000 && c >= -30000000 && a < 30000000 && c < 30000000 && b >= 0 && b < 256;
|
||||
+ protected int x;
|
||||
+ protected int y;
|
||||
+ protected int z;
|
||||
+
|
||||
+ public final boolean isValidLocation() {
|
||||
+ return x >= -30000000 && z >= -30000000 && x < 30000000 && z < 30000000 && y >= 0 && y < 256;
|
||||
}
|
||||
- public boolean isInvalidYLocation() {
|
||||
- return b < 0 || b >= 256;
|
||||
+ public final boolean isInvalidYLocation() {
|
||||
+ return y < 0 || y >= 256;
|
||||
}
|
||||
// Paper end
|
||||
|
||||
public BaseBlockPosition(int i, int j, int k) {
|
||||
- this.a = i;
|
||||
- this.b = j;
|
||||
- this.c = k;
|
||||
+ this.x = i;
|
||||
+ this.y = j;
|
||||
+ this.z = k;
|
||||
}
|
||||
|
||||
public BaseBlockPosition(double d0, double d1, double d2) {
|
||||
@@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
this(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2));
|
||||
}
|
||||
|
||||
@ -70,188 +34,42 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
return true;
|
||||
} else if (!(object instanceof BaseBlockPosition)) {
|
||||
@@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
} else {
|
||||
BaseBlockPosition baseblockposition = (BaseBlockPosition) object;
|
||||
|
||||
- return this.getX() != baseblockposition.getX() ? false : (this.getY() != baseblockposition.getY() ? false : this.getZ() == baseblockposition.getZ());
|
||||
+ return x == baseblockposition.x && z == baseblockposition.z && y == baseblockposition.y; // Paper
|
||||
}
|
||||
}
|
||||
|
||||
- public int hashCode() {
|
||||
- return (this.getY() + this.getZ() * 31) * 31 + this.getX();
|
||||
+ public final int hashCode() { // Paper
|
||||
+ return (this.y + this.z * 31) * 31 + this.x; // Paper
|
||||
return (this.getY() + this.getZ() * 31) * 31 + this.getX();
|
||||
}
|
||||
|
||||
public int compareTo(BaseBlockPosition baseblockposition) {
|
||||
@@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
return this.getY() == baseblockposition.getY() ? (this.getZ() == baseblockposition.getZ() ? this.getX() - baseblockposition.getX() : this.getZ() - baseblockposition.getZ()) : this.getY() - baseblockposition.getY();
|
||||
}
|
||||
|
||||
- public int getX() {
|
||||
- return this.a;
|
||||
+ // Paper start
|
||||
+ public final int getX() {
|
||||
+ return this.x;
|
||||
+ public final int getX() { // Paper
|
||||
return this.a;
|
||||
}
|
||||
|
||||
- public int getY() {
|
||||
- return this.b;
|
||||
+ public final int getY() {
|
||||
+ return this.y;
|
||||
+ public final int getY() { // Paper
|
||||
return this.b;
|
||||
}
|
||||
|
||||
- public int getZ() {
|
||||
- return this.c;
|
||||
+ public final int getZ() {
|
||||
+ return this.z;
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
public BaseBlockPosition down() {
|
||||
return this.down(1);
|
||||
@@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
public BaseBlockPosition shift(EnumDirection enumdirection, int i) {
|
||||
return i == 0 ? this : new BaseBlockPosition(this.getX() + enumdirection.getAdjacentX() * i, this.getY() + enumdirection.getAdjacentY() * i, this.getZ() + enumdirection.getAdjacentZ() * i);
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
public BaseBlockPosition d(BaseBlockPosition baseblockposition) {
|
||||
return new BaseBlockPosition(this.getY() * baseblockposition.getZ() - this.getZ() * baseblockposition.getY(), this.getZ() * baseblockposition.getX() - this.getX() * baseblockposition.getZ(), this.getX() * baseblockposition.getY() - this.getY() * baseblockposition.getX());
|
||||
+ public final int getZ() { // Paper
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public boolean a(BaseBlockPosition baseblockposition, double d0) {
|
||||
- return this.distanceSquared((double) baseblockposition.getX(), (double) baseblockposition.getY(), (double) baseblockposition.getZ(), false) < d0 * d0;
|
||||
+ return this.distanceSquared((double) baseblockposition.x, (double) baseblockposition.y, (double) baseblockposition.z, false) < d0 * d0; // Paper
|
||||
}
|
||||
|
||||
public boolean a(IPosition iposition, double d0) {
|
||||
@@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
}
|
||||
|
||||
public int n(BaseBlockPosition baseblockposition) {
|
||||
- float f = (float) Math.abs(baseblockposition.getX() - this.getX());
|
||||
- float f1 = (float) Math.abs(baseblockposition.getY() - this.getY());
|
||||
- float f2 = (float) Math.abs(baseblockposition.getZ() - this.getZ());
|
||||
+ float f = (float) Math.abs(baseblockposition.getX() - this.x); // Paper
|
||||
+ float f1 = (float) Math.abs(baseblockposition.getY() - this.y); // Paper
|
||||
+ float f2 = (float) Math.abs(baseblockposition.getZ() - this.z); // Paper
|
||||
|
||||
return (int) (f + f1 + f2);
|
||||
}
|
||||
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
|
||||
return new BlockPosition(b(i), c(i), d(i));
|
||||
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
return a(this.getX(), this.getY(), this.getZ());
|
||||
}
|
||||
|
||||
+ public static long asLong(int x, int y, int z) { return a(x, y, z); } // Paper - OBFHELPER
|
||||
public static long a(int i, int j, int k) {
|
||||
long l = 0L;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||
}
|
||||
|
||||
public long asLong() {
|
||||
- return a(this.getX(), this.getY(), this.getZ());
|
||||
+ return a(this.x, this.y, this.z); // Paper
|
||||
}
|
||||
|
||||
public BlockPosition a(double d0, double d1, double d2) {
|
||||
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||
}
|
||||
|
||||
public static class MutableBlockPosition extends BlockPosition {
|
||||
-
|
||||
+ // Paper start - comment out
|
||||
+ /*
|
||||
protected int b;
|
||||
protected int c;
|
||||
protected int d;
|
||||
-
|
||||
+ */
|
||||
+ // Paper end
|
||||
public MutableBlockPosition() {
|
||||
this(0, 0, 0);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||
}
|
||||
|
||||
public MutableBlockPosition(int i, int j, int k) {
|
||||
- super(0, 0, 0);
|
||||
+ // Paper start
|
||||
+ super(i, j, k);
|
||||
+ /*
|
||||
this.b = i;
|
||||
this.c = j;
|
||||
- this.d = k;
|
||||
+ this.d = k;*/
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public MutableBlockPosition(double d0, double d1, double d2) {
|
||||
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||
return super.a(enumblockrotation).immutableCopy();
|
||||
}
|
||||
|
||||
+
|
||||
+ /*
|
||||
+ // Paper start - use parent getters
|
||||
@Override
|
||||
public int getX() {
|
||||
return this.b;
|
||||
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||
@Override
|
||||
public int getZ() {
|
||||
return this.d;
|
||||
- }
|
||||
+ }*/
|
||||
+ // Paper end
|
||||
|
||||
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;
|
||||
- this.d = k;
|
||||
+ // Paper start - use xyz
|
||||
+ this.x = i;
|
||||
+ this.y = j;
|
||||
+ this.z = k;
|
||||
+ // Paper end
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||
}
|
||||
|
||||
public BlockPosition.MutableBlockPosition c(EnumDirection enumdirection, int i) {
|
||||
- return this.d(this.b + enumdirection.getAdjacentX() * i, this.c + enumdirection.getAdjacentY() * i, this.d + enumdirection.getAdjacentZ() * i);
|
||||
+ return this.d(this.x + enumdirection.getAdjacentX() * i, this.y + enumdirection.getAdjacentY() * i, this.z + enumdirection.getAdjacentZ() * i);
|
||||
}
|
||||
|
||||
public BlockPosition.MutableBlockPosition e(int i, int j, int k) {
|
||||
- return this.d(this.b + i, this.c + j, this.d + k);
|
||||
+ return this.d(this.x + i, this.y + j, this.z + k);
|
||||
}
|
||||
|
||||
public final void setX(final int x) { this.o(x); } // Paper - OBFHELPER
|
||||
public void o(int i) {
|
||||
- this.b = i;
|
||||
+ this.x = i; // Paper change to x
|
||||
}
|
||||
|
||||
public final void setY(final int y) { this.p(y); } // Paper - OBFHELPER
|
||||
public void p(int i) {
|
||||
- this.c = i;
|
||||
+ this.y = i; // Paper change to y
|
||||
}
|
||||
|
||||
public final void setZ(final int z) { this.q(z); } // Paper - OBFHELPER
|
||||
public void q(int i) {
|
||||
- this.d = i;
|
||||
+ this.z = i; // Paper change to z
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,13 +16,13 @@ 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
|
||||
dedicatedserver.setEraseCache(true);
|
||||
}
|
||||
S s0 = function.apply(thread); // CraftBukkit - decompile error
|
||||
|
||||
+ dedicatedserver.serverThread.setPriority(Thread.NORM_PRIORITY+2); // Paper - boost priority
|
||||
dedicatedserver.serverThread.start();
|
||||
// CraftBukkit end
|
||||
} catch (Exception exception) {
|
||||
atomicreference.set(s0);
|
||||
+ thread.setPriority(Thread.NORM_PRIORITY+2); // Paper - boost priority
|
||||
thread.start();
|
||||
return s0;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/ServerWorkerThread.java b/src/main/java/net/minecraft/server/ServerWorkerThread.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
@ -60,7 +60,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class SystemUtils {
|
||||
}
|
||||
|
||||
private static ExecutorService k() {
|
||||
private static ExecutorService a(String s) {
|
||||
- int i = MathHelper.clamp(Runtime.getRuntime().availableProcessors() - 1, 1, 7);
|
||||
- Object object;
|
||||
+ // Paper start - use simpler thread pool that allows 1 thread
|
||||
@ -80,10 +80,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (throwable != null) {
|
||||
SystemUtils.LOGGER.warn("{} died", this.getName(), throwable);
|
||||
@@ -0,0 +0,0 @@ public class SystemUtils {
|
||||
|
||||
SystemUtils.LOGGER.error(String.format("Caught exception in thread %s", thread), throwable);
|
||||
}, true);
|
||||
- }
|
||||
return forkjoinworkerthread;
|
||||
}, SystemUtils::a, true);
|
||||
}
|
||||
+ }*/ // Paper end
|
||||
|
||||
return (ExecutorService) object;
|
||||
|
@ -31,8 +31,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
+ public void runKillTrigger(Entity entity, int kills, DamageSource damageSource) { this.a(entity, kills, damageSource); } // Paper - OBFHELPER
|
||||
public void a(Entity entity, int i, DamageSource damagesource) {
|
||||
@ -42,8 +42,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.fallDistance = 0.0F;
|
||||
}
|
||||
|
||||
+ public void onKill(EntityLiving entityLiving) { this.b(entityLiving); } // Paper - OBFHELPER
|
||||
public void b(EntityLiving entityliving) {}
|
||||
+ public void onKill(EntityLiving entityLiving) { this.a_(entityLiving); } // Paper - OBFHELPER
|
||||
public void a_(EntityLiving entityliving) {}
|
||||
|
||||
protected void k(double d0, double d1, double d2) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
|
||||
@ -85,7 +85,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
if (!itemstack.isEmpty()) {
|
||||
this.a(itemstack);
|
||||
this.setSlot(EnumItemSlot.MAINHAND, ItemStack.a);
|
||||
this.setSlot(EnumItemSlot.MAINHAND, ItemStack.b);
|
||||
}
|
||||
|
||||
- super.d(damagesource);
|
||||
@ -116,23 +116,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
public void saveData(NBTTagCompound nbttagcompound) {
|
||||
super.saveData(nbttagcompound);
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- 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 {
|
||||
protected float aS;
|
||||
protected float aT;
|
||||
protected float aU;
|
||||
protected float aV;
|
||||
- protected int aW;
|
||||
+ protected int aW; protected int getKillCount() { return this.aW; } // Paper - OBFHELPER
|
||||
- protected int aV;
|
||||
+ protected int aV; protected int getKillCount() { return this.aV; } // Paper - OBFHELPER
|
||||
public float lastDamage;
|
||||
protected boolean jumping;
|
||||
public float aZ;
|
||||
public float aY;
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
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
|
||||
+ public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event
|
||||
@ -140,18 +140,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@Override
|
||||
public float getBukkitYaw() {
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
|
||||
if (this.getHealth() <= 0.0F) {
|
||||
if (knockbackCancelled) this.world.broadcastEntityEffect(this, (byte) 2); // Paper - Disable explosion knockback
|
||||
if (this.dk()) {
|
||||
if (!this.f(damagesource)) {
|
||||
- SoundEffect soundeffect = this.getSoundDeath();
|
||||
+ // Paper start - moved into CraftEventFactory event caller for cancellable death event
|
||||
+ //SoundEffect soundeffect = this.getSoundDeath();
|
||||
|
||||
- if (flag1 && soundeffect != null) {
|
||||
- this.a(soundeffect, this.getSoundVolume(), this.dn());
|
||||
- this.playSound(soundeffect, this.getSoundVolume(), this.dG());
|
||||
- }
|
||||
+// if (flag1 && soundeffect != null) {
|
||||
+// this.a(soundeffect, this.getSoundVolume(), this.dn());
|
||||
+// this.playSound(soundeffect, this.getSoundVolume(), this.dG());
|
||||
+// }
|
||||
+ this.silentDeath = !flag1; // mark entity as dying silently
|
||||
+ // Paper end
|
||||
@ -166,8 +166,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
EntityLiving entityliving = this.getKillingEntity();
|
||||
|
||||
+ /* // Paper - move down to make death event cancellable
|
||||
if (this.aW >= 0 && entityliving != null) {
|
||||
entityliving.a(this, this.aW, damagesource);
|
||||
if (this.aV >= 0 && entityliving != null) {
|
||||
entityliving.a(this, this.aV, damagesource);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
if (this.isSleeping()) {
|
||||
@ -177,7 +177,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
this.killed = true;
|
||||
- this.getCombatTracker().g();
|
||||
+ //this.getCombatTracker().g();
|
||||
+ //this.getCombatTracker().g(); // Paper
|
||||
if (!this.world.isClientSide) {
|
||||
- this.d(damagesource);
|
||||
+ org.bukkit.event.entity.EntityDeathEvent deathEvent = this.d(damagesource);
|
||||
@ -198,7 +198,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
this.f(entityliving);
|
||||
this.g(entityliving);
|
||||
}
|
||||
|
||||
+ if (this.killed) { // Paper
|
||||
@ -215,7 +215,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- if (entityliving instanceof EntityWither) {
|
||||
+ if (this.killed && entityliving instanceof EntityWither) { // Paper
|
||||
if (this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
|
||||
BlockPosition blockposition = new BlockPosition(this);
|
||||
BlockPosition blockposition = this.getChunkCoordinates();
|
||||
IBlockData iblockdata = Blocks.WITHER_ROSE.getBlockData();
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
@ -232,7 +232,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
this.dropInventory(); // CraftBukkit - from below
|
||||
+ org.bukkit.event.entity.EntityDeathEvent deathEvent; // Paper
|
||||
if (this.isDropExperience() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
|
||||
if (this.cV() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
|
||||
this.a(damagesource, flag);
|
||||
this.dropDeathLoot(damagesource, i, flag);
|
||||
// CraftBukkit start - Call death event
|
||||
@ -274,8 +274,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
+ public float getSoundPitch() { return dn();} // Paper - OBFHELPER
|
||||
protected float dn() {
|
||||
+ public float getSoundPitch() { return dG();} // Paper - OBFHELPER
|
||||
protected float dG() {
|
||||
return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
@ -376,7 +376,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) {
|
||||
public void injectScaledMaxHealth(Collection<AttributeModifiable> collection, boolean force) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
|
@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- 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 {
|
||||
this.dW();
|
||||
this.es();
|
||||
super.tick();
|
||||
if (!this.world.isClientSide && this.activeContainer != null && !this.activeContainer.canUse(this)) {
|
||||
- this.closeInventory();
|
||||
@ -85,7 +85,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ CraftEventFactory.handleInventoryCloseEvent(this, reason); // CraftBukkit
|
||||
+ // Paper end
|
||||
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
|
||||
this.m();
|
||||
this.o();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
@ -98,7 +98,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit
|
||||
+ CraftEventFactory.handleInventoryCloseEvent(this.player, org.bukkit.event.inventory.InventoryCloseEvent.Reason.PLAYER); // CraftBukkit // Paper
|
||||
|
||||
this.player.m();
|
||||
this.player.o();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
@ -117,7 +117,7 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/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 {
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
for (TileEntity tileentity : chunk.getTileEntities().values()) {
|
||||
if (tileentity instanceof IInventory) {
|
||||
for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((IInventory) tileentity).getViewers())) {
|
||||
@ -126,7 +126,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
// Spigot Start
|
||||
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder) {
|
||||
for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) {
|
||||
|
@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
+ public int getItemUseMaxDuration() { return k(); } // Paper - OBFHELPER
|
||||
public int k() {
|
||||
return this.getItem().f_(this);
|
||||
return this.getItem().e_(this);
|
||||
}
|
||||
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
|
||||
|
@ -1,62 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
||||
Date: Tue, 11 Dec 2018 22:25:07 -0500
|
||||
Subject: [PATCH] Lazy init world storage in CraftOfflinePlayer
|
||||
|
||||
Allows access to some offline player properties even when there are no
|
||||
worlds loaded. This is typically a rare occurrence but probably one that
|
||||
should be covered as best we can.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.plugin.Plugin;
|
||||
public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializable {
|
||||
private final GameProfile profile;
|
||||
private final CraftServer server;
|
||||
- private final WorldNBTStorage storage;
|
||||
+ private WorldNBTStorage storage; // Paper - lazy init
|
||||
|
||||
protected CraftOfflinePlayer(CraftServer server, GameProfile profile) {
|
||||
this.server = server;
|
||||
this.profile = profile;
|
||||
- this.storage = (WorldNBTStorage) (server.console.getWorldServer(DimensionManager.OVERWORLD).getDataManager());
|
||||
+ //this.storage = (WorldNBTStorage) (server.console.getWorldServer(DimensionManager.OVERWORLD).getDataManager()); // Paper - lazy init
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
return hash;
|
||||
}
|
||||
|
||||
+ // Paper - lazy
|
||||
+ private WorldNBTStorage getStorageLazy() {
|
||||
+ if (this.storage == null) {
|
||||
+ net.minecraft.server.WorldServer worldServer = server.console.getWorldServer(DimensionManager.OVERWORLD);
|
||||
+ if (worldServer == null) {
|
||||
+ throw new IllegalStateException("Cannot get world storage when there are no worlds loaded!");
|
||||
+ } else {
|
||||
+ this.storage = (WorldNBTStorage) worldServer.getDataManager();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return this.storage;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
private NBTTagCompound getData() {
|
||||
- return storage.getPlayerData(getUniqueId().toString());
|
||||
+ return getStorageLazy().getPlayerData(getUniqueId().toString());
|
||||
}
|
||||
|
||||
private NBTTagCompound getBukkitData() {
|
||||
@@ -0,0 +0,0 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
}
|
||||
|
||||
private File getDataFile() {
|
||||
- return new File(storage.getPlayerDir(), getUniqueId() + ".dat");
|
||||
+ return new File(getStorageLazy().getPlayerDir(), getUniqueId() + ".dat");
|
||||
}
|
||||
|
||||
@Override
|
@ -1,83 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Trigary <trigary0@gmail.com>
|
||||
Date: Fri, 14 Sep 2018 17:42:08 +0200
|
||||
Subject: [PATCH] Limit lightning strike effect distance
|
||||
|
||||
|
||||
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 {
|
||||
}
|
||||
}
|
||||
|
||||
+ public double sqrMaxThunderDistance;
|
||||
+ public double sqrMaxLightningImpactSoundDistance;
|
||||
+ public double maxLightningFlashDistance;
|
||||
+ private void lightningStrikeDistanceLimit() {
|
||||
+ sqrMaxThunderDistance = getInt("lightning-strike-distance-limit.sound", -1);
|
||||
+ if (sqrMaxThunderDistance > 0) {
|
||||
+ sqrMaxThunderDistance *= sqrMaxThunderDistance;
|
||||
+ }
|
||||
+
|
||||
+ sqrMaxLightningImpactSoundDistance = getInt("lightning-strike-distance-limit.impact-sound", -1);
|
||||
+ if (sqrMaxLightningImpactSoundDistance < 0) {
|
||||
+ sqrMaxLightningImpactSoundDistance = 32 * 32; //Vanilla value
|
||||
+ } else {
|
||||
+ sqrMaxLightningImpactSoundDistance *= sqrMaxLightningImpactSoundDistance;
|
||||
+ }
|
||||
+
|
||||
+ maxLightningFlashDistance = getInt("lightning-strike-distance-limit.flash", -1);
|
||||
+ if (maxLightningFlashDistance < 0) {
|
||||
+ maxLightningFlashDistance = 512; // Vanilla value
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public int fixedInhabitedTime;
|
||||
private void fixedInhabitedTime() {
|
||||
if (PaperConfig.version < 16) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLightning.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLightning.java
|
||||
@@ -0,0 +0,0 @@ public class EntityLightning extends Entity {
|
||||
double deltaX = this.locX() - player.locX();
|
||||
double deltaZ = this.locZ() - player.locZ();
|
||||
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
||||
+ // Paper start - Limit lightning strike effect distance
|
||||
+ if (distanceSquared <= this.world.paperConfig.sqrMaxLightningImpactSoundDistance) {
|
||||
+ player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT,
|
||||
+ SoundCategory.WEATHER, this.locX(), this.locY(), this.locZ(), 2.0f, 0.5F + this.random.nextFloat() * 0.2F));
|
||||
+ }
|
||||
+
|
||||
+ if (world.paperConfig.sqrMaxThunderDistance != -1 && distanceSquared >= world.paperConfig.sqrMaxThunderDistance) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ // Paper end
|
||||
if (distanceSquared > viewDistance * viewDistance) {
|
||||
double deltaLength = Math.sqrt(distanceSquared);
|
||||
double relativeX = player.locX() + (deltaX / deltaLength) * viewDistance;
|
||||
@@ -0,0 +0,0 @@ public class EntityLightning extends Entity {
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
- this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F);
|
||||
+ //this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F); // Paper - Limit lightning strike effect distance (the packet is now sent from inside the loop)
|
||||
}
|
||||
|
||||
--this.lifeTicks;
|
||||
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 {
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.globalEntityList.add(entitylightning);
|
||||
- this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX(), entitylightning.locY(), entitylightning.locZ(), 512.0D, this, new PacketPlayOutSpawnEntityWeather(entitylightning)); // Paper - use world instead of dimension
|
||||
+ this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX(), entitylightning.locY(), entitylightning.locZ(), paperConfig.maxLightningFlashDistance, this, new PacketPlayOutSpawnEntityWeather(entitylightning)); // Paper - use world instead of dimension, limit lightning strike effect distance
|
||||
}
|
||||
|
||||
@Override
|
@ -15,21 +15,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
private float bD;
|
||||
- protected ItemStack activeItem;
|
||||
+ public ItemStack activeItem; // Paper - public
|
||||
protected int bk;
|
||||
protected int bl;
|
||||
protected int bm;
|
||||
private BlockPosition bE;
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
return this.activeItem;
|
||||
}
|
||||
|
||||
+ public int getItemUseRemainingTime() { return this.dE(); } // Paper - OBFHELPER
|
||||
public int dE() {
|
||||
return this.bl;
|
||||
+ public int getItemUseRemainingTime() { return this.dY(); } // Paper - OBFHELPER
|
||||
public int dY() {
|
||||
return this.bk;
|
||||
}
|
||||
|
||||
+ public int getHandRaisedTime() { return this.dF(); } // Paper - OBFHELPER
|
||||
public int dF() {
|
||||
return this.isHandRaised() ? this.activeItem.k() - this.dE() : 0;
|
||||
+ public int getHandRaisedTime() { return this.dZ(); } // Paper - OBFHELPER
|
||||
public int dZ() {
|
||||
return this.isHandRaised() ? this.activeItem.k() - this.dY() : 0;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java
|
||||
@@ -0,0 +0,0 @@ public class EntityAreaEffectCloud extends Entity {
|
||||
super.tick();
|
||||
boolean flag = this.l();
|
||||
boolean flag = this.k();
|
||||
float f = this.getRadius();
|
||||
+ // Paper start - fix MC-114618
|
||||
+ if (f < 0.0F) {
|
||||
|
@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
||||
@@ -0,0 +0,0 @@ public class EntityExperienceOrb extends Entity {
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
public void saveData(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setShort("Health", (short) this.e);
|
||||
nbttagcompound.setShort("Age", (short) this.c);
|
||||
- nbttagcompound.setShort("Value", (short) this.value);
|
||||
@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class EntityExperienceOrb extends Entity {
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
public void loadData(NBTTagCompound nbttagcompound) {
|
||||
this.e = nbttagcompound.getShort("Health");
|
||||
this.c = nbttagcompound.getShort("Age");
|
||||
- this.value = nbttagcompound.getShort("Value");
|
||||
|
@ -10,31 +10,10 @@ everything to the Whitelist object.
|
||||
|
||||
https://github.com/PaperMC/Paper/issues/1880
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/JsonList.java
|
||||
+++ b/src/main/java/net/minecraft/server/JsonList.java
|
||||
@@ -0,0 +0,0 @@ public class JsonList<K, V extends JsonListEntry<K>> {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
+ public void setEnabled(boolean flag) { this.a(flag); } // Paper - OBFHeLPER
|
||||
public void a(boolean flag) {
|
||||
this.e = flag;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
// private final Map<UUID, AdvancementDataPlayer> p;
|
||||
// CraftBukkit end
|
||||
public IPlayerFileData playerFileData;
|
||||
- private boolean hasWhitelist;
|
||||
+ //private boolean hasWhitelist;
|
||||
protected final int maxPlayers;
|
||||
private int viewDistance;
|
||||
private EnumGamemode t;
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
}
|
||||
public boolean isWhitelisted(GameProfile gameprofile, org.bukkit.event.player.PlayerLoginEvent loginEvent) {
|
||||
@ -47,17 +26,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
event.callEvent();
|
||||
if (!event.isWhitelisted()) {
|
||||
if (loginEvent != null) {
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
public boolean getHasWhitelist() {
|
||||
- return this.hasWhitelist;
|
||||
+ return this.whitelist.isEnabled(); // Paper
|
||||
}
|
||||
|
||||
public void setHasWhitelist(boolean flag) {
|
||||
- this.hasWhitelist = flag;
|
||||
+ this.whitelist.setEnabled(flag); // Paper
|
||||
}
|
||||
|
||||
public List<EntityPlayer> b(String s) {
|
||||
|
@ -10,24 +10,27 @@ because the entity is in another world.
|
||||
If the projectile fails to find the shooter in the current world, check
|
||||
other worlds.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
|
||||
diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
|
||||
public EntityLiving getShooter() {
|
||||
if ((this.shooter == null || this.shooter.dead) && this.shooterId != null && this.world instanceof WorldServer) {
|
||||
Entity entity = ((WorldServer) this.world).getEntity(this.shooterId);
|
||||
+ // Paper start - MC-50319 - shooter might be in another world (arrows through portals)
|
||||
+ if (entity == null) {
|
||||
+ for (WorldServer world : world.getMinecraftServer().getWorlds()) {
|
||||
+ entity = world.getEntity(this.shooterId);
|
||||
+ if (entity != null) {
|
||||
+ break;
|
||||
+ }
|
||||
--- a/src/main/java/net/minecraft/server/IProjectile.java
|
||||
+++ b/src/main/java/net/minecraft/server/IProjectile.java
|
||||
@@ -0,0 +0,0 @@ public abstract class IProjectile extends Entity {
|
||||
|
||||
@Nullable
|
||||
public Entity getShooter() {
|
||||
- return this.shooter != null && this.world instanceof WorldServer ? ((WorldServer) this.world).getEntity(this.shooter) : (this.c != 0 ? this.world.getEntity(this.c) : null);
|
||||
+ // Paper start - MC-50319 - shooter might be in another world (arrows through portals)
|
||||
+ Entity entity = this.shooter != null && this.world instanceof WorldServer ? ((WorldServer) this.world).getEntity(this.shooter) : (this.c != 0 ? this.world.getEntity(this.c) : null);
|
||||
+ if (entity == null) {
|
||||
+ for (WorldServer world : world.getMinecraftServer().getWorlds()) {
|
||||
+ entity = world.getEntity(this.shooter);
|
||||
+ if (entity != null) {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+ }
|
||||
+ return entity;
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
if (entity instanceof EntityLiving) {
|
||||
this.shooter = (EntityLiving) entity;
|
||||
@Override
|
||||
|
@ -26,11 +26,11 @@ diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||
@@ -0,0 +0,0 @@ public class WorldNBTStorage implements IPlayerFileData {
|
||||
@@ -0,0 +0,0 @@ public class WorldNBTStorage {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(EntityHuman entityhuman) {
|
||||
+ if(!com.destroystokyo.paper.PaperConfig.savePlayerData) return; // Paper - Make player data saving configurable
|
||||
try {
|
||||
NBTTagCompound nbttagcompound = entityhuman.save(new NBTTagCompound());
|
||||
File file = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat.tmp");
|
||||
File file = File.createTempFile(entityhuman.getUniqueIDString() + "-", ".dat", this.playerDir);
|
||||
|
@ -26,8 +26,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (this.isHandRaised() && !this.activeItem.isEmpty()) {
|
||||
Item item = this.activeItem.getItem();
|
||||
|
||||
- return item.e_(this.activeItem) != EnumAnimation.BLOCK ? false : item.f_(this.activeItem) - this.bl >= 5;
|
||||
+ return item.e_(this.activeItem) != EnumAnimation.BLOCK ? false : item.f_(this.activeItem) - this.bl >= getShieldBlockingDelay(); // Paper - shieldBlockingDelay
|
||||
- return item.d_(this.activeItem) != EnumAnimation.BLOCK ? false : item.e_(this.activeItem) - this.bk >= 5;
|
||||
+ return item.d_(this.activeItem) != EnumAnimation.BLOCK ? false : item.e_(this.activeItem) - this.bk >= getShieldBlockingDelay(); // Paper - shieldBlockingDelay
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
import org.bukkit.Bukkit;
|
||||
+import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||
connectionThrottleKickMessage = getString("messages.kick.connection-throttle", connectionThrottleKickMessage);
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@Nullable
|
||||
- public PathEntity a(Entity entity, int i) {
|
||||
+ public final PathEntity calculateDestination(Entity entity) { return a(entity, 0); } public PathEntity a(Entity entity, int i) {
|
||||
return this.a(ImmutableSet.of(new BlockPosition(entity)), entity, 16, true, i); // Paper
|
||||
return this.a(ImmutableSet.of(entity.getChunkCoordinates()), entity, 16, true, i); // Paper
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
|
||||
@ -234,11 +234,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
return this.a(entity, this.e);
|
||||
}
|
||||
|
||||
- public Vec3D g() {
|
||||
+ public Vec3D getNext() { return g(); } public Vec3D g() { // Paper - OBFHELPER
|
||||
PathPoint pathpoint = (PathPoint) this.a.get(this.e);
|
||||
- public BaseBlockPosition g() {
|
||||
+ public BaseBlockPosition getNext() { return g(); } public BaseBlockPosition g() { // Paper - OBFHELPER
|
||||
PathPoint pathpoint = this.h();
|
||||
|
||||
return new Vec3D((double) pathpoint.a, (double) pathpoint.b, (double) pathpoint.c);
|
||||
return new BaseBlockPosition(pathpoint.a, pathpoint.b, pathpoint.c);
|
||||
diff --git a/src/main/java/net/minecraft/server/PathPoint.java b/src/main/java/net/minecraft/server/PathPoint.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathPoint.java
|
||||
|
@ -9,16 +9,16 @@ diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/n
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/BiomeBase.java
|
||||
+++ b/src/main/java/net/minecraft/server/BiomeBase.java
|
||||
@@ -0,0 +0,0 @@ public abstract class BiomeBase {
|
||||
protected final Map<WorldGenStage.Decoration, List<WorldGenFeatureConfigured<?, ?>>> r = Maps.newHashMap();
|
||||
@@ -0,0 +0,0 @@ public class BiomeBase {
|
||||
protected final Map<WorldGenStage.Decoration, List<WorldGenFeatureConfigured<?, ?>>> r;
|
||||
protected final List<WorldGenFeatureConfigured<?, ?>> s = Lists.newArrayList();
|
||||
protected final Map<StructureGenerator<?>, WorldGenFeatureConfiguration> t = Maps.newHashMap();
|
||||
- private final Map<EnumCreatureType, List<BiomeBase.BiomeMeta>> v = Maps.newHashMap();
|
||||
+ private final java.util.EnumMap<EnumCreatureType, List<BiomeBase.BiomeMeta>> v = Maps.newEnumMap(EnumCreatureType.class); // Paper
|
||||
private final ThreadLocal<Long2FloatLinkedOpenHashMap> w = ThreadLocal.withInitial(() -> {
|
||||
return (Long2FloatLinkedOpenHashMap) SystemUtils.a(() -> {
|
||||
Long2FloatLinkedOpenHashMap long2floatlinkedopenhashmap = new Long2FloatLinkedOpenHashMap(1024, 0.25F) {
|
||||
@@ -0,0 +0,0 @@ public abstract class BiomeBase {
|
||||
private final Map<StructureGenerator<?>, StructureFeature<?, ?>> u;
|
||||
- private final Map<EnumCreatureType, List<BiomeBase.BiomeMeta>> v;
|
||||
+ private final Map<EnumCreatureType, List<BiomeBase.BiomeMeta>> v = Maps.newEnumMap(EnumCreatureType.class); // Paper
|
||||
private final Map<EntityTypes<?>, BiomeBase.e> w = Maps.newHashMap();
|
||||
private final List<BiomeBase.d> x;
|
||||
private final ThreadLocal<Long2FloatLinkedOpenHashMap> y = ThreadLocal.withInitial(() -> {
|
||||
@@ -0,0 +0,0 @@ public class BiomeBase {
|
||||
for (j = 0; j < i; ++j) {
|
||||
EnumCreatureType enumcreaturetype = aenumcreaturetype[j];
|
||||
|
||||
@ -27,8 +27,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -0,0 +0,0 @@ public abstract class BiomeBase {
|
||||
return this.m;
|
||||
@@ -0,0 +0,0 @@ public class BiomeBase {
|
||||
return this.l;
|
||||
}
|
||||
|
||||
+ // Paper start - keep track of data in a pair set to give O(1) contains calls - we have to hook removals incase plugins mess with it
|
||||
@ -63,6 +63,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public static class a {
|
||||
public static class d {
|
||||
|
||||
@Nullable
|
||||
public static final Codec<BiomeBase.d> a = RecordCodecBuilder.create((instance) -> {
|
||||
|
@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/ja
|
||||
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 {
|
||||
}
|
||||
|
||||
public BlockPosition up() {
|
||||
|
@ -29,4 +29,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ //TileEntity tileentity = null; // Paper - move up
|
||||
|
||||
if (this.tickingTileEntities) {
|
||||
tileentity = this.e(blockposition);
|
||||
tileentity = this.D(blockposition);
|
||||
|
@ -1,59 +0,0 @@
|
||||
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/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 @@ import com.google.common.collect.ImmutableMap;
|
||||
import com.mojang.datafixers.Dynamic;
|
||||
import com.mojang.datafixers.types.DynamicOps;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||
+
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -0,0 +0,0 @@ public class IBlockData extends BlockDataAbstract<Block, IBlockData> implements
|
||||
return (Block) this.a;
|
||||
}
|
||||
|
||||
+ // Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time
|
||||
+ private CraftBlockData cachedCraftBlockData;
|
||||
+
|
||||
+ public CraftBlockData createCraftBlockData() {
|
||||
+ if(cachedCraftBlockData == null) cachedCraftBlockData = CraftBlockData.createData(this);
|
||||
+ return (CraftBlockData) cachedCraftBlockData.clone();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public Material getMaterial() {
|
||||
return this.getBlock().k(this);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.channel.config().setAutoRead(true);
|
||||
NetworkManager.LOGGER.debug("Enabled auto read");
|
||||
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
NetworkManager.LOGGER.debug("Set listener of {} to {}", this, packetlistener);
|
||||
Validate.notNull(packetlistener, "packetListener", new Object[0]);
|
||||
this.packetListener = packetlistener;
|
||||
}
|
||||
+ // Paper start
|
||||
@ -298,7 +298,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (this.j() != null) {
|
||||
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
} else if (this.i() != null) {
|
||||
this.i().a(new ChatMessage("multiplayer.disconnect.generic", new Object[0]));
|
||||
this.i().a(new ChatMessage("multiplayer.disconnect.generic"));
|
||||
}
|
||||
- this.packetQueue.clear(); // Free up packet queue.
|
||||
+ clearPacketQueue(); // Paper
|
||||
@ -335,11 +335,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
boolean flag1 = gamerules.getBoolean(GameRules.REDUCED_DEBUG_INFO);
|
||||
|
||||
// CraftBukkit - getType()
|
||||
// Spigot - view distance
|
||||
+ networkmanager.queueImmunity = true; // Paper
|
||||
playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), WorldData.c(worlddata.getSeed()), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager().getType(), this.getMaxPlayers(), worlddata.getType(), worldserver.spigotConfig.viewDistance, flag1, !flag));
|
||||
playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), entityplayer.playerInteractManager.c(), BiomeManager.a(worldserver1.getSeed()), worlddata.isHardcore(), this.server.E(), this.s, worldserver1.getTypeKey(), worldserver1.getDimensionKey(), this.getMaxPlayers(), worldserver.spigotConfig.viewDistance, flag1, !flag, worldserver1.isDebugWorld(), worldserver1.isFlatWorld()));
|
||||
entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
|
||||
playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())));
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
|
@ -17,16 +17,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
protected static final Logger LOGGER = LogManager.getLogger();
|
||||
- protected final RegistryID<T> b = new RegistryID<>(256);
|
||||
- protected final BiMap<MinecraftKey, T> c = HashBiMap.create();
|
||||
- private final BiMap<ResourceKey<T>, T> bb = HashBiMap.create();
|
||||
+ protected final RegistryID<T> b = new RegistryID<>(2048); // Paper - use bigger expected size to reduce collisions
|
||||
+ protected final BiMap<MinecraftKey, T> c = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions
|
||||
+ private final BiMap<ResourceKey<T>, T> bb = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions
|
||||
private final Set<ResourceKey<T>> bc = Sets.newIdentityHashSet();
|
||||
protected Object[] d;
|
||||
private int V;
|
||||
|
||||
private int bd;
|
||||
@@ -0,0 +0,0 @@ public class RegistryMaterials<T> extends IRegistryWritable<T> {
|
||||
this.d = collection.toArray(new Object[collection.size()]);
|
||||
}
|
||||
|
||||
- return this.d[random.nextInt(this.d.length)];
|
||||
+ return (T) this.d[random.nextInt(this.d.length)]; // Paper - Decompile fix
|
||||
- return SystemUtils.a(this.d, random);
|
||||
+ return (T) SystemUtils.a(this.d, random); // Paper - Decompile fix
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +0,0 @@ public class RegistryMaterials<T> extends IRegistryWritable<T> {
|
||||
Iterator iterator = registrymaterials.b.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
- T t0 = iterator.next();
|
||||
+ T t0 = (T) iterator.next(); // Paper - Decompile fix
|
||||
|
||||
builder.add(Pair.of(registrymaterials.c(t0).get(), t0));
|
||||
}
|
||||
|
@ -28,6 +28,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+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;
|
||||
@ -40,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+import java.util.Map;
|
||||
+import java.util.Set;
|
||||
+
|
||||
+public class PaperWorldMap extends HashMap<DimensionManager, WorldServer> {
|
||||
+public class PaperWorldMap extends HashMap<ResourceKey<World>, WorldServer> {
|
||||
+ private final List<WorldServer> worlds = new ArrayList<>();
|
||||
+ private final List<WorldServer> worldsIterable = new ArrayList<WorldServer>() {
|
||||
+ @Override
|
||||
@ -80,10 +82,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ @Override
|
||||
+ public WorldServer get(Object key) {
|
||||
+ // Will hit the below method
|
||||
+ return key instanceof DimensionManager ? get((DimensionManager) key) : null;
|
||||
+ return key instanceof ResourceKey ? get((ResourceKey<World>) key) : null;
|
||||
+ }
|
||||
+
|
||||
+ public WorldServer get(DimensionManager key) {
|
||||
+ // 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;
|
||||
+ }
|
||||
@ -98,7 +100,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public WorldServer put(DimensionManager key, WorldServer value) {
|
||||
+ public WorldServer put(ResourceKey<World> key, WorldServer value) {
|
||||
+ while (worlds.size() <= key.getDimensionID()+1) {
|
||||
+ worlds.add(null);
|
||||
+ }
|
||||
@ -111,8 +113,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void putAll(Map<? extends DimensionManager, ? extends WorldServer> m) {
|
||||
+ for (Entry<? extends DimensionManager, ? extends WorldServer> e : m.entrySet()) {
|
||||
+ 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());
|
||||
+ }
|
||||
+ }
|
||||
@ -142,17 +144,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean containsValue(Object value) {
|
||||
+ return value instanceof WorldServer && get(((WorldServer) value).worldProvider.getDimensionManager()) != null;
|
||||
+ return value instanceof WorldServer && get(((WorldServer) value).getDimensionKey()) != null;
|
||||
+ }
|
||||
+
|
||||
+ @Nonnull
|
||||
+ @Override
|
||||
+ public Set<DimensionManager> keySet() {
|
||||
+ return new AbstractSet<DimensionManager>() {
|
||||
+ public Set<ResourceKey<World>> keySet() {
|
||||
+ return new AbstractSet<ResourceKey<World>>() {
|
||||
+ @Override
|
||||
+ public Iterator<DimensionManager> iterator() {
|
||||
+ public Iterator<ResourceKey<World>> iterator() {
|
||||
+ Iterator<WorldServer> iterator = worldsIterable.iterator();
|
||||
+ return new Iterator<DimensionManager>() {
|
||||
+ return new Iterator<ResourceKey<World>>() {
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean hasNext() {
|
||||
@ -160,8 +162,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public DimensionManager next() {
|
||||
+ return iterator.next().worldProvider.getDimensionManager();
|
||||
+ public ResourceKey<World> next() {
|
||||
+ return iterator.next().getDimensionKey();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@ -184,12 +186,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Set<Entry<DimensionManager, WorldServer>> entrySet() {
|
||||
+ return new AbstractSet<Entry<DimensionManager, WorldServer>>() {
|
||||
+ public Set<Entry<ResourceKey<World>, WorldServer>> entrySet() {
|
||||
+ return new AbstractSet<Entry<ResourceKey<World>, WorldServer>>() {
|
||||
+ @Override
|
||||
+ public Iterator<Entry<DimensionManager, WorldServer>> iterator() {
|
||||
+ public Iterator<Entry<ResourceKey<World>, WorldServer>> iterator() {
|
||||
+ Iterator<WorldServer> iterator = worldsIterable.iterator();
|
||||
+ return new Iterator<Entry<DimensionManager, WorldServer>>() {
|
||||
+ return new Iterator<Entry<ResourceKey<World>, WorldServer>>() {
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean hasNext() {
|
||||
@ -197,9 +199,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Entry<DimensionManager, WorldServer> next() {
|
||||
+ public Entry<ResourceKey<World>, WorldServer> next() {
|
||||
+ WorldServer entry = iterator.next();
|
||||
+ return new SimpleEntry<>(entry.worldProvider.getDimensionManager(), entry);
|
||||
+ return new SimpleEntry<>(entry.getDimensionKey(), entry);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@ -221,28 +223,20 @@ 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
|
||||
public final DataFixer dataConverterManager;
|
||||
private String serverIp;
|
||||
private int serverPort = -1;
|
||||
- public final Map<DimensionManager, WorldServer> worldServer = Maps.newLinkedHashMap(); // CraftBukkit - keep order, k+v already use identity methods
|
||||
+ public final Map<DimensionManager, WorldServer> worldServer = new com.destroystokyo.paper.PaperWorldMap(); // Paper;
|
||||
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 = true;
|
||||
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.a(this.getDifficulty(), true);
|
||||
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()));
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
// this.nextTick = SystemUtils.getMonotonicMillis() + 10L;
|
||||
this.executeModerately();
|
||||
// Iterator iterator = DimensionManager.a().iterator();
|
||||
-
|
||||
if (true) {
|
||||
DimensionManager dimensionmanager = worldserver.worldProvider.getDimensionManager();
|
||||
ForcedChunk forcedchunk = (ForcedChunk) worldserver.getWorldPersistentData().b(ForcedChunk::new, "chunks");
|
||||
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -23,9 +23,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
// Paper end
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start - Prevent armor stands from doing entity lookups
|
||||
+ @Override
|
||||
+ public boolean getCubes(@Nullable Entity entity, AxisAlignedBB axisAlignedBB) {
|
||||
@ -33,7 +33,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ return GeneratorAccess.super.getCubes(entity, axisAlignedBB);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public boolean b(AxisAlignedBB axisalignedbb) {
|
||||
int i = MathHelper.floor(axisalignedbb.minX);
|
||||
int j = MathHelper.f(axisalignedbb.maxX);
|
||||
|
||||
public Explosion explode(@Nullable Entity entity, double d0, double d1, double d2, float f, Explosion.Effect explosion_effect) {
|
||||
return this.createExplosion(entity, (DamageSource) null, (ExplosionDamageCalculator) null, d0, d1, d2, f, false, explosion_effect);
|
||||
|
@ -11,33 +11,34 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
||||
if (this.deathAnimationTicks == 1 && !this.isSilent()) {
|
||||
// CraftBukkit start - Use relative location for far away sounds
|
||||
// this.world.b(1028, new BlockPosition(this), 0);
|
||||
// Paper start
|
||||
- //int viewDistance = ((WorldServer) this.world).spigotConfig.viewDistance * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
|
||||
+ int viewDistance = this.world.getWorld().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
|
||||
for (EntityPlayer player : ((WorldServer)world).getPlayers()) {
|
||||
// this.world.b(1028, this.getChunkCoordinates(), 0);
|
||||
- //int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
|
||||
+ int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
|
||||
for (EntityPlayer player : (List<EntityPlayer>) ((WorldServer)world).getPlayers()) {
|
||||
- final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
|
||||
+ //final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
|
||||
// Paper end
|
||||
+ // final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
|
||||
+ // Paper end
|
||||
double deltaX = this.locX() - player.locX();
|
||||
double deltaZ = this.locZ() - player.locZ();
|
||||
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityWither.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityWither.java
|
||||
@@ -0,0 +0,0 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
|
||||
// CraftBukkit start - Use relative location for far away sounds
|
||||
// this.world.b(1023, new BlockPosition(this), 0);
|
||||
// Paper start
|
||||
- //int viewDistance = ((WorldServer) this.world).spigotConfig.viewDistance * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
|
||||
+ int viewDistance = this.world.getWorld().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
|
||||
for (EntityPlayer player : ((WorldServer)world).getPlayers()) {
|
||||
- final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
|
||||
+ //final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
|
||||
// Paper end
|
||||
double deltaX = this.locX() - player.locX();
|
||||
double deltaZ = this.locZ() - player.locZ();
|
||||
if (!this.isSilent()) {
|
||||
// CraftBukkit start - Use relative location for far away sounds
|
||||
// this.world.b(1023, new BlockPosition(this), 0);
|
||||
- //int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
|
||||
+ int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
|
||||
for (EntityPlayer player : (List<EntityPlayer>)this.world.getPlayers()) {
|
||||
- final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
|
||||
+ // final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
|
||||
double deltaX = this.locX() - player.locX();
|
||||
double deltaZ = this.locZ() - player.locZ();
|
||||
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
|
@ -10,13 +10,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- 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 {
|
||||
protected int bO;
|
||||
protected final float bP = 0.02F;
|
||||
private int bS;
|
||||
- private final GameProfile bT;
|
||||
+ private GameProfile bT; public final void setProfile(final GameProfile profile) { this.bT = profile; } // Paper - OBFHELPER
|
||||
private ItemStack bV;
|
||||
private final ItemCooldown bW;
|
||||
protected int bN;
|
||||
protected final float bO = 0.02F;
|
||||
private int g;
|
||||
- private final GameProfile bQ;
|
||||
+ private final GameProfile bQ; public final void setProfile(final GameProfile profile) { this.bQ = profile; } // Paper - OBFHELPER
|
||||
private ItemStack bS;
|
||||
private final ItemCooldown bT;
|
||||
@Nullable
|
||||
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
@ -28,4 +28,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
return InteractionResultWrapper.success(entityhuman.b(enumhand));
|
||||
return InteractionResultWrapper.a(entityhuman.b(enumhand), world.s_());
|
||||
|
@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- 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 {
|
||||
return (EntitySize) EntityHuman.b.getOrDefault(entitypose, EntityHuman.bp);
|
||||
return ImmutableList.of(EntityPose.STANDING, EntityPose.CROUCHING, EntityPose.SWIMMING);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
|
@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/j
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster {
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
|
||||
int j = MathHelper.floor(this.enderman.locY() + random.nextDouble() * 3.0D);
|
||||
int k = MathHelper.floor(this.enderman.locZ() - 2.0D + random.nextDouble() * 4.0D);
|
||||
BlockPosition blockposition = new BlockPosition(i, j, k);
|
||||
@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
Block block = iblockdata.getBlock();
|
||||
Vec3D vec3d = new Vec3D((double) MathHelper.floor(this.enderman.locX()) + 0.5D, (double) j + 0.5D, (double) MathHelper.floor(this.enderman.locZ()) + 0.5D);
|
||||
Vec3D vec3d1 = new Vec3D((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D);
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster {
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
|
||||
int j = MathHelper.floor(this.a.locY() + random.nextDouble() * 2.0D);
|
||||
int k = MathHelper.floor(this.a.locZ() - 1.0D + random.nextDouble() * 2.0D);
|
||||
BlockPosition blockposition = new BlockPosition(i, j, k);
|
||||
|
@ -26,10 +26,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
@Nullable
|
||||
private BlockPosition a(BlockPosition blockposition, IBlockAccess iblockaccess) {
|
||||
- if (iblockaccess.getType(blockposition).getBlock() == this.g) {
|
||||
- if (iblockaccess.getType(blockposition).a(this.g)) {
|
||||
+ Block block = world.getBlockIfLoaded(blockposition); // Paper
|
||||
+ if (block == null) return null; // Paper
|
||||
+ if (block == this.g) { // Paper
|
||||
+ if (block.a(this.g)) { // Paper
|
||||
return blockposition;
|
||||
} else {
|
||||
BlockPosition[] ablockposition = new BlockPosition[]{blockposition.down(), blockposition.west(), blockposition.east(), blockposition.north(), blockposition.south(), blockposition.down().down()};
|
||||
@ -37,8 +37,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
for (int j = 0; j < i; ++j) {
|
||||
BlockPosition blockposition1 = ablockposition1[j];
|
||||
|
||||
- if (iblockaccess.getType(blockposition1).getBlock() == this.g) {
|
||||
+ if (world.getBlockIfLoaded(blockposition1) == this.g) { // Paper
|
||||
- if (iblockaccess.getType(blockposition1).a(this.g)) {
|
||||
+ if (iblockaccess.getBlockIfLoaded(blockposition1).a(this.g)) { // Paper
|
||||
return blockposition1;
|
||||
}
|
||||
}
|
||||
@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- IChunkAccess ichunkaccess = iworldreader.getChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4, ChunkStatus.FULL, false);
|
||||
+ IChunkAccess ichunkaccess = iworldreader.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4); // Paper
|
||||
|
||||
return ichunkaccess == null ? false : ichunkaccess.getType(blockposition).getBlock() == this.g && ichunkaccess.getType(blockposition.up()).isAir() && ichunkaccess.getType(blockposition.up(2)).isAir();
|
||||
return ichunkaccess == null ? false : ichunkaccess.getType(blockposition).a(this.g) && ichunkaccess.getType(blockposition.up()).isAir() && ichunkaccess.getType(blockposition.up(2)).isAir();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/RandomPositionGenerator.java b/src/main/java/net/minecraft/server/RandomPositionGenerator.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
@ -67,9 +67,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
});
|
||||
}
|
||||
|
||||
- if (flag || !entitycreature.world.getFluid(blockposition2).a(TagsFluid.WATER)) {
|
||||
- if (flag || !entitycreature.world.getFluid(blockposition2).a((Tag) TagsFluid.WATER)) {
|
||||
+ Fluid fluid = entitycreature.world.getFluidIfLoaded(blockposition2); // Paper
|
||||
+ if (flag || (fluid != null && !fluid.a(TagsFluid.WATER))) { // Paper
|
||||
PathType pathtype = PathfinderNormal.b(entitycreature.world, blockposition2.getX(), blockposition2.getY(), blockposition2.getZ());
|
||||
+ if (flag || (fluid != null && !fluid.a((Tag) TagsFluid.WATER))) { // Paper
|
||||
PathType pathtype = PathfinderNormal.a((IBlockAccess) entitycreature.world, blockposition2.i());
|
||||
|
||||
if (entitycreature.a(pathtype) == 0.0F) {
|
||||
|
@ -83,7 +83,7 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/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 {
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
List[] aentityslice = chunk.getEntitySlices(); // Spigot
|
||||
int i = aentityslice.length;
|
||||
|
||||
@ -91,7 +91,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
for (int j = 0; j < i; ++j) {
|
||||
List<Entity> entityslice = aentityslice[j]; // Spigot
|
||||
Iterator iterator = entityslice.iterator();
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
throw (IllegalStateException) SystemUtils.c(new IllegalStateException("Removing entity while ticking!"));
|
||||
}
|
||||
|
||||
|
@ -10,23 +10,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
|
||||
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
||||
@@ -0,0 +0,0 @@ public final class SpawnerCreature {
|
||||
int l = blockposition1.getZ();
|
||||
|
||||
if (k >= 1) {
|
||||
- IBlockData iblockdata = chunk.getType(blockposition1);
|
||||
+ IBlockData iblockdata = worldserver.getTypeIfLoadedAndInBounds(blockposition1); // Paper - don't load chunks for mob spawn
|
||||
|
||||
- if (!iblockdata.isOccluding(chunk, blockposition1)) {
|
||||
+ if (iblockdata != null && !iblockdata.isOccluding(chunk, blockposition1)) { // Paper - don't load chunks for mob spawn
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
|
||||
int i1 = 0;
|
||||
StructureManager structuremanager = worldserver.getStructureManager();
|
||||
ChunkGenerator chunkgenerator = worldserver.getChunkProvider().getChunkGenerator();
|
||||
int i = blockposition.getY();
|
||||
- IBlockData iblockdata = ichunkaccess.getType(blockposition);
|
||||
+ IBlockData iblockdata = worldserver.getTypeIfLoadedAndInBounds(blockposition); // Paper - don't load chunks for mob spawn
|
||||
|
||||
- if (!iblockdata.isOccluding(ichunkaccess, blockposition)) {
|
||||
+ if (iblockdata != null && !iblockdata.isOccluding(ichunkaccess, blockposition)) { // Paper - don't load chunks for mob spawn
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
@@ -0,0 +0,0 @@ public final class SpawnerCreature {
|
||||
if (entityhuman != null) {
|
||||
double d0 = entityhuman.g((double) f, (double) k, (double) f1);
|
||||
if (entityhuman != null) {
|
||||
double d2 = entityhuman.g(d0, (double) i, d1);
|
||||
|
||||
- if (d0 > 576.0D && !blockposition.a((IPosition) (new Vec3D((double) f, (double) k, (double) f1)), 24.0D)) {
|
||||
+ if (d0 > 576.0D && !blockposition.a((IPosition) (new Vec3D((double) f, (double) k, (double) f1)), 24.0D) && worldserver.isLoadedAndInBounds(blockposition_mutableblockposition)) { // Paper - don't load chunks for mob spawn
|
||||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(blockposition_mutableblockposition);
|
||||
|
||||
if (Objects.equals(chunkcoordintpair, chunk.getPos()) || worldserver.getChunkProvider().a(chunkcoordintpair)) {
|
||||
- if (a(worldserver, ichunkaccess, blockposition_mutableblockposition, d2)) {
|
||||
+ if (a(worldserver, ichunkaccess, blockposition_mutableblockposition, d2) && worldserver.isLoadedAndInBounds(blockposition_mutableblockposition)) { // Paper - don't load chunks for mob spawn
|
||||
if (biomebase_biomemeta == null) {
|
||||
biomebase_biomemeta = a(worldserver, structuremanager, chunkgenerator, enumcreaturetype, worldserver.random, (BlockPosition) blockposition_mutableblockposition);
|
||||
if (biomebase_biomemeta == null) {
|
||||
|
@ -8,9 +8,9 @@ diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||
@@ -0,0 +0,0 @@ public class WorldNBTStorage implements IPlayerFileData {
|
||||
@@ -0,0 +0,0 @@ public class WorldNBTStorage {
|
||||
|
||||
file.renameTo(file1);
|
||||
SystemUtils.a(file1, file, file2);
|
||||
} catch (Exception exception) {
|
||||
- WorldNBTStorage.LOGGER.warn("Failed to save player data for {}", entityhuman.getDisplayName().getString());
|
||||
+ WorldNBTStorage.LOGGER.error("Failed to save player data for {}", entityhuman.getName(), exception); // Paper
|
||||
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren