More more more more more more work
This commit is contained in:
		
					parent
					
						
							
								7409d8fed7
							
						
					
				
			
			
				commit
				
					
						f51c531b94
					
				
			
		
					 42 changed files with 58 additions and 57 deletions
				
			
		| 
						 | 
				
			
			@ -69,7 +69,7 @@ diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/
 | 
			
		|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/org/spigotmc/WatchdogThread.java
 | 
			
		||||
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
 | 
			
		||||
@@ -0,0 +0,0 @@ public class WatchdogThread extends Thread
 | 
			
		||||
     private static WatchdogThread instance;
 | 
			
		||||
     private long timeoutTime;
 | 
			
		||||
     private boolean restart;
 | 
			
		||||
| 
						 | 
				
			
			@ -80,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
     private volatile long lastTick;
 | 
			
		||||
     private volatile boolean stopping;
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +0,0 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
 | 
			
		||||
@@ -0,0 +0,0 @@ public class WatchdogThread extends Thread
 | 
			
		||||
         super( "Paper Watchdog Thread" );
 | 
			
		||||
         this.timeoutTime = timeoutTime;
 | 
			
		||||
         this.restart = restart;
 | 
			
		||||
| 
						 | 
				
			
			@ -89,7 +89,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
     }
 | 
			
		||||
 
 | 
			
		||||
     private static long monotonicMillis()
 | 
			
		||||
@@ -0,0 +0,0 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
 | 
			
		||||
@@ -0,0 +0,0 @@ public class WatchdogThread extends Thread
 | 
			
		||||
         while ( !this.stopping )
 | 
			
		||||
         {
 | 
			
		||||
             //
 | 
			
		||||
| 
						 | 
				
			
			@ -110,7 +110,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
                 log.log( Level.SEVERE, "------------------------------" );
 | 
			
		||||
                 log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Paper bug." ); // Paper
 | 
			
		||||
                 log.log( Level.SEVERE, "If you see a plugin in the Server thread dump below, then please report it to that author" );
 | 
			
		||||
@@ -0,0 +0,0 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
 | 
			
		||||
@@ -0,0 +0,0 @@ public class WatchdogThread extends Thread
 | 
			
		||||
                     }
 | 
			
		||||
                 }
 | 
			
		||||
                 // Paper end
 | 
			
		||||
| 
						 | 
				
			
			@ -122,7 +122,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
+                // Paper end - Different message for short timeout
 | 
			
		||||
                 log.log( Level.SEVERE, "------------------------------" );
 | 
			
		||||
                 log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper
 | 
			
		||||
                 io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.dumpAllChunkLoadInfo(isLongTimeout); // Paper // Paper - rewrite chunk system
 | 
			
		||||
                 WatchdogThread.dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log );
 | 
			
		||||
                 log.log( Level.SEVERE, "------------------------------" );
 | 
			
		||||
                 //
 | 
			
		||||
| 
						 | 
				
			
			@ -10,16 +10,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class EnderDragon extends Mob implements Enemy {
 | 
			
		||||
                     });
 | 
			
		||||
                     craftBlock.getNMS().spawnAfterBreak((ServerLevel) level, blockposition, ItemStack.EMPTY, false);
 | 
			
		||||
                     craftBlock.getNMS().spawnAfterBreak((ServerLevel) this.level(), blockposition, ItemStack.EMPTY, false);
 | 
			
		||||
                 }
 | 
			
		||||
+                // Paper start - TNTPrimeEvent
 | 
			
		||||
+                org.bukkit.block.Block tntBlock = level.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
 | 
			
		||||
+                if(!new com.destroystokyo.paper.event.block.TNTPrimeEvent(tntBlock, com.destroystokyo.paper.event.block.TNTPrimeEvent.PrimeReason.EXPLOSION, explosionSource.getIndirectSourceEntity().getBukkitEntity()).callEvent())
 | 
			
		||||
+                    continue;
 | 
			
		||||
+                // Paper end
 | 
			
		||||
                 nmsBlock.wasExploded(level, blockposition, explosionSource);
 | 
			
		||||
                 nmsBlock.wasExploded(this.level(), blockposition, explosionSource);
 | 
			
		||||
 
 | 
			
		||||
                 this.level.removeBlock(blockposition, false);
 | 
			
		||||
                 this.level().removeBlock(blockposition, false);
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/level/block/FireBlock.java
 | 
			
		||||
| 
						 | 
				
			
			@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
                 this.player.setShiftKeyDown(true);
 | 
			
		||||
+
 | 
			
		||||
+                // Paper start - Hang on!
 | 
			
		||||
+                if (this.player.level.paperConfig().entities.behavior.parrotsAreUnaffectedByPlayerMovement) {
 | 
			
		||||
+                if (this.player.level().paperConfig().entities.behavior.parrotsAreUnaffectedByPlayerMovement) {
 | 
			
		||||
+                    this.player.removeEntitiesOnShoulder();
 | 
			
		||||
+                }
 | 
			
		||||
+                // Paper end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,7 +43,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
             --this.chatSpamTickCount;
 | 
			
		||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
 | 
			
		||||
     public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) {
 | 
			
		||||
         // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // Paper - run this async
 | 
			
		||||
         // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - run this async
 | 
			
		||||
         // CraftBukkit start
 | 
			
		||||
-        if (this.chatSpamTickCount.addAndGet(1) > 500 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
 | 
			
		||||
+        if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
                             this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
 | 
			
		||||
-                            this.setSprinting(false);
 | 
			
		||||
+                            // Paper start - Configuration option to disable automatic sprint interruption
 | 
			
		||||
+                            if (!level.paperConfig().misc.disableSprintInterruptionOnAttack) {
 | 
			
		||||
+                            if (!this.level().paperConfig().misc.disableSprintInterruptionOnAttack) {
 | 
			
		||||
+                                this.setSprinting(false);
 | 
			
		||||
+                            }
 | 
			
		||||
+                            // Paper end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
             this.flame.setParticle(ParticleTypes.DRAGON_BREATH);
 | 
			
		||||
             this.flame.addEffect(new MobEffectInstance(MobEffects.HARM));
 | 
			
		||||
+            if (new com.destroystokyo.paper.event.entity.EnderDragonFlameEvent((org.bukkit.entity.EnderDragon) this.dragon.getBukkitEntity(), (org.bukkit.entity.AreaEffectCloud) this.flame.getBukkitEntity()).callEvent()) { // Paper
 | 
			
		||||
             this.dragon.level.addFreshEntity(this.flame);
 | 
			
		||||
             this.dragon.level().addFreshEntity(this.flame);
 | 
			
		||||
+            // Paper start
 | 
			
		||||
+            } else {
 | 
			
		||||
+                this.end();
 | 
			
		||||
| 
						 | 
				
			
			@ -28,10 +28,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance {
 | 
			
		||||
 
 | 
			
		||||
                         DragonFireball dragonFireball = new DragonFireball(this.dragon.level, this.dragon, r, s, t);
 | 
			
		||||
                         DragonFireball dragonFireball = new DragonFireball(this.dragon.level(), this.dragon, r, s, t);
 | 
			
		||||
                         dragonFireball.moveTo(o, p, q, 0.0F, 0.0F);
 | 
			
		||||
+                        if (new com.destroystokyo.paper.event.entity.EnderDragonShootFireballEvent((org.bukkit.entity.EnderDragon) dragon.getBukkitEntity(), (org.bukkit.entity.DragonFireball) dragonFireball.getBukkitEntity()).callEvent()) // Paper
 | 
			
		||||
                         this.dragon.level.addFreshEntity(dragonFireball);
 | 
			
		||||
                         this.dragon.level().addFreshEntity(dragonFireball);
 | 
			
		||||
+                        else dragonFireball.discard(); // Paper
 | 
			
		||||
                         this.fireballCharge = 0;
 | 
			
		||||
                         if (this.currentPath != null) {
 | 
			
		||||
| 
						 | 
				
			
			@ -45,8 +45,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
                 }
 | 
			
		||||
 
 | 
			
		||||
+                if (new com.destroystokyo.paper.event.entity.EnderDragonFireballHitEvent((org.bukkit.entity.DragonFireball) this.getBukkitEntity(), list.stream().map(LivingEntity::getBukkitLivingEntity).collect(java.util.stream.Collectors.toList()), (org.bukkit.entity.AreaEffectCloud) areaEffectCloud.getBukkitEntity()).callEvent()) { // Paper
 | 
			
		||||
                 this.level.levelEvent(2006, this.blockPosition(), this.isSilent() ? -1 : 1);
 | 
			
		||||
                 this.level.addFreshEntity(areaEffectCloud);
 | 
			
		||||
                 this.level().levelEvent(2006, this.blockPosition(), this.isSilent() ? -1 : 1);
 | 
			
		||||
                 this.level().addFreshEntity(areaEffectCloud);
 | 
			
		||||
+                } else areaEffectCloud.discard(); // Paper
 | 
			
		||||
                 this.discard();
 | 
			
		||||
             }
 | 
			
		||||
| 
						 | 
				
			
			@ -33,7 +33,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/
 | 
			
		|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class Allay extends PathfinderMob implements InventoryCarrier {
 | 
			
		||||
@@ -0,0 +0,0 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
 | 
			
		||||
             });
 | 
			
		||||
         }
 | 
			
		||||
 
 | 
			
		||||
| 
						 | 
				
			
			@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
             // CraftBukkit end
 | 
			
		||||
+            // Paper start - remove player from map on drop
 | 
			
		||||
+            if (itemstack.getItem() == Items.FILLED_MAP) {
 | 
			
		||||
+                net.minecraft.world.level.saveddata.maps.MapItemSavedData worldmap = net.minecraft.world.item.MapItem.getSavedData(itemstack, this.level);
 | 
			
		||||
+                net.minecraft.world.level.saveddata.maps.MapItemSavedData worldmap = net.minecraft.world.item.MapItem.getSavedData(itemstack, this.level());
 | 
			
		||||
+                if (worldmap != null) {
 | 
			
		||||
+                    worldmap.tickCarriedBy(this, itemstack);
 | 
			
		||||
+                }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -109,7 +109,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
                 entityliving.awardKillScore(this, this.deathScore, damageSource);
 | 
			
		||||
             }
 | 
			
		||||
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
 | 
			
		||||
             if (!this.level.isClientSide && this.hasCustomName()) {
 | 
			
		||||
             if (!this.level().isClientSide && this.hasCustomName()) {
 | 
			
		||||
                 if (org.spigotmc.SpigotConfig.logNamedDeaths) LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString()); // Spigot
 | 
			
		||||
             }
 | 
			
		||||
+             */ // Paper - move down to make death event cancellable - this is the awardKillScore below
 | 
			
		||||
| 
						 | 
				
			
			@ -117,8 +117,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
             this.dead = true;
 | 
			
		||||
-            this.getCombatTracker().recheckStatus();
 | 
			
		||||
+            // Paper - moved into if below
 | 
			
		||||
             if (this.level instanceof ServerLevel) {
 | 
			
		||||
-                if (entity == null || entity.wasKilled((ServerLevel) this.level, this)) {
 | 
			
		||||
             Level world = this.level();
 | 
			
		||||
 
 | 
			
		||||
             if (world instanceof ServerLevel) {
 | 
			
		||||
                 ServerLevel worldserver = (ServerLevel) world;
 | 
			
		||||
+                // Paper - move below into if for onKill
 | 
			
		||||
+
 | 
			
		||||
+                // Paper start
 | 
			
		||||
| 
						 | 
				
			
			@ -139,42 +141,42 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
+                    if (this.isSleeping()) {
 | 
			
		||||
+                        this.stopSleeping();
 | 
			
		||||
+                    }
 | 
			
		||||
+
 | 
			
		||||
+                    if (!this.level.isClientSide && this.hasCustomName()) {
 | 
			
		||||
 
 | 
			
		||||
-                if (entity == null || entity.killedEntity(worldserver, this)) {
 | 
			
		||||
+                    if (!this.level().isClientSide && this.hasCustomName()) {
 | 
			
		||||
+                        if (org.spigotmc.SpigotConfig.logNamedDeaths) LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString()); // Spigot
 | 
			
		||||
+                    }
 | 
			
		||||
+
 | 
			
		||||
+                    this.getCombatTracker().recheckStatus();
 | 
			
		||||
+                    if (entity != null) {
 | 
			
		||||
+                        entity.wasKilled((ServerLevel) this.level, this);
 | 
			
		||||
+                        entity.wasKilled((ServerLevel) this.level(), this);
 | 
			
		||||
+                    }
 | 
			
		||||
                     this.gameEvent(GameEvent.ENTITY_DIE);
 | 
			
		||||
-                    this.dropAllDeathLoot(damageSource);
 | 
			
		||||
-                    this.createWitherRose(entityliving);
 | 
			
		||||
+                } else {
 | 
			
		||||
+                    this.dead = false;
 | 
			
		||||
+                    this.setHealth((float) deathEvent.getReviveHealth());
 | 
			
		||||
                 }
 | 
			
		||||
-
 | 
			
		||||
-                this.level.broadcastEntityEvent(this, (byte) 3);
 | 
			
		||||
 
 | 
			
		||||
-                this.level().broadcastEntityEvent(this, (byte) 3);
 | 
			
		||||
+                // Paper end
 | 
			
		||||
+                this.createWitherRose(entityliving);
 | 
			
		||||
             }
 | 
			
		||||
 
 | 
			
		||||
+            // Paper start
 | 
			
		||||
+            if (this.dead) { // Paper
 | 
			
		||||
+            this.level.broadcastEntityEvent(this, (byte) 3);
 | 
			
		||||
+                this.level().broadcastEntityEvent(this, (byte) 3);
 | 
			
		||||
             this.setPose(Pose.DYING);
 | 
			
		||||
+            } // Paper
 | 
			
		||||
+            }
 | 
			
		||||
+            // Paper end
 | 
			
		||||
         }
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
 | 
			
		||||
         if (!this.level.isClientSide) {
 | 
			
		||||
         if (!this.level().isClientSide) {
 | 
			
		||||
             boolean flag = false;
 | 
			
		||||
 
 | 
			
		||||
-            if (adversary instanceof WitherBoss) {
 | 
			
		||||
+            if (this.dead && adversary instanceof WitherBoss) { // Paper
 | 
			
		||||
                 if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
 | 
			
		||||
                 if (this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
 | 
			
		||||
                     BlockPos blockposition = this.blockPosition();
 | 
			
		||||
                     BlockState iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
 | 
			
		||||
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
 | 
			
		||||
| 
						 | 
				
			
			@ -192,7 +194,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
 
 | 
			
		||||
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
 | 
			
		||||
         this.dropEquipment(); // CraftBukkit - from below
 | 
			
		||||
         if (this.shouldDropLoot() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
 | 
			
		||||
         if (this.shouldDropLoot() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
 | 
			
		||||
             this.dropFromLootTable(source, flag);
 | 
			
		||||
+            // Paper start
 | 
			
		||||
+            final boolean prev = this.clearEquipmentSlots;
 | 
			
		||||
| 
						 | 
				
			
			@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public abstract class BlockBehaviour implements FeatureElement {
 | 
			
		||||
             this.spawnParticlesOnBreak = blockbase_info.spawnParticlesOnBreak;
 | 
			
		||||
             this.replaceable = blockbase_info.replaceable;
 | 
			
		||||
             this.conditionallyFullOpaque = this.isOpaque() & this.isTransparentOnSomeFaces(); // Paper
 | 
			
		||||
         }
 | 
			
		||||
+        // Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time
 | 
			
		||||
| 
						 | 
				
			
			@ -23,8 +23,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
+        }
 | 
			
		||||
+        // Paper end
 | 
			
		||||
 
 | 
			
		||||
         // Paper start
 | 
			
		||||
         protected boolean shapeExceedsCube = true;
 | 
			
		||||
         private boolean calculateSolid() {
 | 
			
		||||
             if (((Block) this.owner).properties.forceSolidOn) {
 | 
			
		||||
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
 | 
			
		||||
| 
						 | 
				
			
			@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
 
 | 
			
		||||
     @Override
 | 
			
		||||
     protected void pushEntities() {
 | 
			
		||||
+        if (!level.paperConfig().entities.armorStands.doCollisionEntityLookups) return; // Paper
 | 
			
		||||
         List<Entity> list = this.level.getEntities((Entity) this, this.getBoundingBox(), ArmorStand.RIDABLE_MINECARTS);
 | 
			
		||||
+        if (!this.level().paperConfig().entities.armorStands.doCollisionEntityLookups) return; // Paper
 | 
			
		||||
         List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox(), ArmorStand.RIDABLE_MINECARTS);
 | 
			
		||||
 
 | 
			
		||||
         for (int i = 0; i < list.size(); ++i) {
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
 | 
			
		||||
| 
						 | 
				
			
			@ -61,7 +61,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
     }
 | 
			
		||||
+    // Paper start - send SoundEffect to everyone who can see fromEntity
 | 
			
		||||
+    private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) {
 | 
			
		||||
+        fromEntity.level.playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity himself
 | 
			
		||||
+        fromEntity.level().playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity himself
 | 
			
		||||
+        if (fromEntity instanceof ServerPlayer) {
 | 
			
		||||
+            ((ServerPlayer) fromEntity).connection.send(new net.minecraft.network.protocol.game.ClientboundSoundPacket(net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(soundEffect), soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong()));
 | 
			
		||||
+        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
 
 | 
			
		||||
+    // Paper start
 | 
			
		||||
+    public Entity releaseLeftShoulderEntity() {
 | 
			
		||||
+        Entity entity = this.spawnEntityFromShoulder0(this.getShoulderEntityLeft());
 | 
			
		||||
+        Entity entity = this.respawnEntityOnShoulder0(this.getShoulderEntityLeft());
 | 
			
		||||
+        if (entity != null) {
 | 
			
		||||
+            this.setShoulderEntityLeft(new CompoundTag());
 | 
			
		||||
+        }
 | 
			
		||||
| 
						 | 
				
			
			@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
+    }
 | 
			
		||||
+
 | 
			
		||||
+    public Entity releaseRightShoulderEntity() {
 | 
			
		||||
+        Entity entity = this.spawnEntityFromShoulder0(this.getShoulderEntityRight());
 | 
			
		||||
+        Entity entity = this.respawnEntityOnShoulder0(this.getShoulderEntityRight());
 | 
			
		||||
+        if (entity != null) {
 | 
			
		||||
+            this.setShoulderEntityRight(new CompoundTag());
 | 
			
		||||
+        }
 | 
			
		||||
| 
						 | 
				
			
			@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
+
 | 
			
		||||
     private boolean respawnEntityOnShoulder(CompoundTag nbttagcompound) { // CraftBukkit void->boolean
 | 
			
		||||
-        if (!this.level().isClientSide && !nbttagcompound.isEmpty()) {
 | 
			
		||||
+        return this.spawnEntityFromShoulder0(nbttagcompound) != null;
 | 
			
		||||
+        return this.respawnEntityOnShoulder0(nbttagcompound) != null;
 | 
			
		||||
+    }
 | 
			
		||||
+
 | 
			
		||||
+    // Paper - return entity
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,13 +20,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
 
 | 
			
		||||
     @Override
 | 
			
		||||
     public boolean canUse() {
 | 
			
		||||
-        return this.horse.level.hasNearbyAlivePlayerThatAffectsSpawning(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0D); // Paper - Affects Spawning API
 | 
			
		||||
+        return !(eligiblePlayers = this.horse.level.findNearbyBukkitPlayers(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0D, net.minecraft.world.entity.EntitySelector.PLAYER_AFFECTS_SPAWNING)).isEmpty(); // Paper - Affects Spawning API & SkeletonHorseTrapEvent
 | 
			
		||||
-        return this.horse.level().hasNearbyAlivePlayerThatAffectsSpawning(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0D); // Paper - Affects Spawning API
 | 
			
		||||
+        return !(eligiblePlayers = this.horse.level().findNearbyBukkitPlayers(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0D, net.minecraft.world.entity.EntitySelector.PLAYER_AFFECTS_SPAWNING)).isEmpty(); // Paper - Affects Spawning API & SkeletonHorseTrapEvent
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
     @Override
 | 
			
		||||
     public void tick() {
 | 
			
		||||
         ServerLevel worldserver = (ServerLevel) this.horse.level;
 | 
			
		||||
         ServerLevel worldserver = (ServerLevel) this.horse.level();
 | 
			
		||||
+        if (!new com.destroystokyo.paper.event.entity.SkeletonHorseTrapEvent((org.bukkit.entity.SkeletonHorse) this.horse.getBukkitEntity(), eligiblePlayers).callEvent()) return; // Paper
 | 
			
		||||
         DifficultyInstance difficultydamagescaler = worldserver.getCurrentDifficultyAt(this.horse.blockPosition());
 | 
			
		||||
 
 | 
			
		||||
| 
						 | 
				
			
			@ -102,8 +102,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
 
 | 
			
		||||
         @Override
 | 
			
		||||
         public boolean canUse() {
 | 
			
		||||
-            return this.slime.getTarget() == null && (this.slime.onGround || this.slime.isInWater() || this.slime.isInLava() || this.slime.hasEffect(MobEffects.LEVITATION)) && this.slime.getMoveControl() instanceof Slime.SlimeMoveControl;
 | 
			
		||||
+            return this.slime.getTarget() == null && (this.slime.onGround || this.slime.isInWater() || this.slime.isInLava() || this.slime.hasEffect(MobEffects.LEVITATION)) && this.slime.getMoveControl() instanceof Slime.SlimeMoveControl && this.slime.canWander; // Paper - add canWander
 | 
			
		||||
-            return this.slime.getTarget() == null && (this.slime.onGround() || this.slime.isInWater() || this.slime.isInLava() || this.slime.hasEffect(MobEffects.LEVITATION)) && this.slime.getMoveControl() instanceof Slime.SlimeMoveControl;
 | 
			
		||||
+            return this.slime.getTarget() == null && (this.slime.onGround() || this.slime.isInWater() || this.slime.isInLava() || this.slime.hasEffect(MobEffects.LEVITATION)) && this.slime.getMoveControl() instanceof Slime.SlimeMoveControl && this.slime.canWander; // Paper - add canWander
 | 
			
		||||
         }
 | 
			
		||||
 
 | 
			
		||||
         @Override
 | 
			
		||||
| 
						 | 
				
			
			@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
 
 | 
			
		||||
                     boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity;
 | 
			
		||||
 
 | 
			
		||||
+                    flag2 = flag2 && !level.paperConfig().entities.behavior.disablePlayerCrits; // Paper
 | 
			
		||||
+                    flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper
 | 
			
		||||
                     flag2 = flag2 && !this.isSprinting();
 | 
			
		||||
                     if (flag2) {
 | 
			
		||||
                         f *= 1.5F;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,12 +10,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
+++ b/build.gradle.kts
 | 
			
		||||
@@ -0,0 +0,0 @@ dependencies {
 | 
			
		||||
     implementation("commons-lang:commons-lang:2.6")
 | 
			
		||||
     runtimeOnly("org.xerial:sqlite-jdbc:3.41.2.2")
 | 
			
		||||
     runtimeOnly("com.mysql:mysql-connector-j:8.0.32")
 | 
			
		||||
     runtimeOnly("org.xerial:sqlite-jdbc:3.42.0.0")
 | 
			
		||||
     runtimeOnly("com.mysql:mysql-connector-j:8.0.33")
 | 
			
		||||
+    runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
 | 
			
		||||
 
 | 
			
		||||
     runtimeOnly("org.apache.maven:maven-resolver-provider:3.8.5")
 | 
			
		||||
     runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
 | 
			
		||||
     runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.2")
 | 
			
		||||
     runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.10")
 | 
			
		||||
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/resources/log4j2.xml
 | 
			
		||||
| 
						 | 
				
			
			@ -19,9 +19,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
     private QueryThreadGs4 queryThreadGs4;
 | 
			
		||||
     public final RconConsoleSource rconConsoleSource;
 | 
			
		||||
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
 | 
			
		||||
             return;
 | 
			
		||||
     }
 | 
			
		||||
         // Paper end - rewrite chunk system
 | 
			
		||||
 
 | 
			
		||||
     public void handleConsoleInput(String command, CommandSourceStack commandSource) {
 | 
			
		||||
-        this.consoleInput.add(new ConsoleInput(command, commandSource));
 | 
			
		||||
+        this.serverCommandQueue.add(new ConsoleInput(command, commandSource)); // Paper - use proper queue
 | 
			
		||||
     }
 | 
			
		||||
| 
						 | 
				
			
			@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
 | 
			
		||||
     public String toString() {
 | 
			
		||||
         String s = this.level == null ? "~NULL~" : this.level.toString();
 | 
			
		||||
         String s = this.level() == null ? "~NULL~" : this.level().toString();
 | 
			
		||||
 
 | 
			
		||||
-        return this.removalReason != null ? String.format(Locale.ROOT, "%s['%s'/%d, l='%s', x=%.2f, y=%.2f, z=%.2f, removed=%s]", this.getClass().getSimpleName(), this.getName().getString(), this.id, s, this.getX(), this.getY(), this.getZ(), this.removalReason) : String.format(Locale.ROOT, "%s['%s'/%d, l='%s', x=%.2f, y=%.2f, z=%.2f]", this.getClass().getSimpleName(), this.getName().getString(), this.id, s, this.getX(), this.getY(), this.getZ());
 | 
			
		||||
+        return this.removalReason != null ? String.format(Locale.ROOT, "%s['%s'/%d, uuid='%s', l='%s', x=%.2f, y=%.2f, z=%.2f, cpos=%s, tl=%d, v=%b, removed=%s]", this.getClass().getSimpleName(), this.getName().getString(), this.id, this.uuid, s, this.getX(), this.getY(), this.getZ(), this.chunkPosition(), this.tickCount, this.valid, this.removalReason) : String.format(Locale.ROOT, "%s['%s'/%d, uuid='%s', l='%s', x=%.2f, y=%.2f, z=%.2f, cpos=%s, tl=%d, v=%b]", this.getClass().getSimpleName(), this.getName().getString(), this.id, this.uuid, s, this.getX(), this.getY(), this.getZ(), this.chunkPosition(), this.tickCount, this.valid);
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue