patches up to anti x ray
Dieser Commit ist enthalten in:
Ursprung
9d9fcf7e62
Commit
7a59fd38d4
@ -7,10 +7,10 @@ The problem was we were checking isExpired() on the entry, but if it
|
||||
was expired at that point, then it would be null.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 7321e5b9905cf5afb684a9d2d39048f43c245504..c5287f08c675550c897d72fd7eff3331d0640800 100644
|
||||
index ee1b40ef92e343e829040b8df5a2db67846f2982..29f1182026dade5b846ac411ff11260dbc9b5bc9 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -629,8 +629,10 @@ public abstract class PlayerList {
|
||||
@@ -627,8 +627,10 @@ public abstract class PlayerList {
|
||||
Player player = entity.getBukkitEntity();
|
||||
PlayerLoginEvent event = new PlayerLoginEvent(player, loginlistener.connection.hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.connection.channel.remoteAddress()).getAddress());
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Prevent consuming the wrong itemstack
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 072f1f4e342141a02e6f94849432f116ba2e0e5c..c95c7619820d1dbabc52ae8ccef88e03a2f1d9a3 100644
|
||||
index d0482485b13346ac84bb52db30879519f7129091..cde3525320bd7f42c0664e2087d54fa75b7bfb70 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3707,9 +3707,14 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3709,9 +3709,14 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
public void startUsingItem(InteractionHand hand) {
|
||||
@ -24,7 +24,7 @@ index 072f1f4e342141a02e6f94849432f116ba2e0e5c..c95c7619820d1dbabc52ae8ccef88e03
|
||||
this.useItem = itemstack;
|
||||
this.useItemRemaining = itemstack.getUseDuration();
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -3789,6 +3794,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3791,6 +3796,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
this.releaseUsingItem();
|
||||
} else {
|
||||
if (!this.useItem.isEmpty() && this.isUsingItem()) {
|
||||
@ -32,7 +32,7 @@ index 072f1f4e342141a02e6f94849432f116ba2e0e5c..c95c7619820d1dbabc52ae8ccef88e03
|
||||
this.triggerItemUseEffects(this.useItem, 16);
|
||||
// CraftBukkit start - fire PlayerItemConsumeEvent
|
||||
ItemStack itemstack;
|
||||
@@ -3823,8 +3829,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3825,8 +3831,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
this.stopUsingItem();
|
@ -5,10 +5,10 @@ Subject: [PATCH] Dont send unnecessary sign update
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||
index 148ea4089c4f67894b28e21e961a661a2d291925..7e4fbf3cd57c74b61cec75c02eb35756a243de17 100644
|
||||
index 2d230e1f56be70f6373421c0649b0b9d3f2702e8..725a921c7c8ce458d073333d6a9e8e316dbd6ea8 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||
@@ -186,6 +186,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
|
||||
@@ -184,6 +184,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
|
||||
this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3);
|
||||
} else {
|
||||
SignBlockEntity.LOGGER.warn("Player {} just tried to change non-editable sign", player.getName().getString());
|
@ -5,10 +5,10 @@ Subject: [PATCH] PlayerDeathEvent#shouldDropExperience
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 151f1918392e26163323ddf1cfd6cd52abaea9c3..b0065a0e9494e0ebbd212874997839f04cda5fd7 100644
|
||||
index c65b5054728418a62923eb4192d55ba30fd8f4fb..05c658b988fd970eeba8117d06c5a5d93b8fd75d 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -970,7 +970,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -977,7 +977,7 @@ public class ServerPlayer extends Player {
|
||||
this.tellNeutralMobsThatIDied();
|
||||
}
|
||||
// SPIGOT-5478 must be called manually now
|
@ -5,10 +5,10 @@ Subject: [PATCH] Prevent bees loading chunks checking hive position
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
index 010d7b910a55875f4059bbf014535653b027b0a5..98b0b91a8033ae297fee3fe655ee641e9ab08154 100644
|
||||
index d3ef1bf0be4584dbe41576fa7036b11ff405b9d8..0f7b02d39b5dc781e65537c1b6d924e6c51e5dc7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
@@ -502,6 +502,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
@@ -509,6 +509,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
} else if (this.isTooFarAway(this.hivePos)) {
|
||||
return false;
|
||||
} else {
|
@ -13,13 +13,13 @@ This of course is undesirable, so just return the loaded side as "primary"
|
||||
and treat it as a single chest if the other sides are unloaded
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java b/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java
|
||||
index ff2a7b08fe70adaecdaa508baadcfe40416519e0..6c334703c816d2a04f97006c5796c658f34a12a4 100644
|
||||
index 0a40d9b7e394fa10d6bfb0057440e1b0e55d1fc4..67da7795caebc882f14814217efccd139fc8f1e3 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java
|
||||
@@ -25,7 +25,12 @@ public class DoubleBlockCombiner {
|
||||
return new DoubleBlockCombiner.NeighborCombineResult.Single<>(blockEntity);
|
||||
} else {
|
||||
BlockPos blockPos = pos.relative(function.apply(state));
|
||||
BlockPos blockPos = pos.relative(directionMapper.apply(state));
|
||||
- BlockState blockState = world.getBlockState(blockPos);
|
||||
+ // Paper start
|
||||
+ BlockState blockState = world.getBlockStateIfLoaded(blockPos);
|
@ -6,10 +6,10 @@ Subject: [PATCH] Optimise EntityGetter#getPlayerByUUID
|
||||
Use the PlayerList map instead of iterating over all players
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index dc0a02f08d1c211443f35a10270110791b6fbbcc..0f039eae0ca81f80bf2e644b64a356427ce611bb 100644
|
||||
index 9d269ba80056eec6658501aa8217ee1eadf0aaf3..5e40d1570af4fb59647e9e2facf4229fe6df7887 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -552,6 +552,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -554,6 +554,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
});
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ This patch resolves the conflict by offsetting checking Spigot's entity
|
||||
activation range check from an item's move method.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
index 2edc55f09b79ac75788a0ded8b3d2a6800674470..9b9d491c7c41590c93d606414902329b6636419f 100644
|
||||
index 314ba941c72a50b479cb634f3337ded3e63a7622..bbd0d161f27d0e061c14ad87990e44492bb7fe3d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -150,7 +150,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -168,7 +168,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
}
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Optimize call to getFluid for explosions
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index aea135503da20b7c4e2c6cd2dba81998f101b0c4..c0227cda09b9ca508c1de1fbe1e57afd743a9426 100644
|
||||
index e59348b849a71ff5eba5bd74a9e2819a560787db..120151da61398ea8afcd658a8407efcf738b9476 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -169,7 +169,7 @@ public class Explosion {
|
||||
@@ -191,7 +191,7 @@ public class Explosion {
|
||||
for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) {
|
||||
BlockPos blockposition = BlockPos.containing(d4, d5, d6);
|
||||
BlockState iblockdata = this.level.getBlockState(blockposition);
|
@ -9,7 +9,7 @@ dispensed. The resulting item would have size == 0 and therefore
|
||||
be convertered to air, hence why the effects disappeared.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
index b1256306601969c05a833b22ab1f16b5b6b4ed15..d500de41d0a61d67aff523fe436da06e625687dd 100644
|
||||
index 42f541c609c3d94bee9b40b8e5307ad41a39c619..8c8d2e81f0866dc1441e181f2580852d87263bcc 100644
|
||||
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
@@ -516,7 +516,7 @@ public interface DispenseItemBehavior {
|
@ -18,7 +18,7 @@ public net.minecraft.world.entity.Entity isInsidePortal
|
||||
public net.minecraft.world.entity.LivingEntity jumping
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 0f039eae0ca81f80bf2e644b64a356427ce611bb..88cde9de26d3da3d863a9d44f5c127eed0a1f4b6 100644
|
||||
index 5e40d1570af4fb59647e9e2facf4229fe6df7887..84a3f0d2b9c3ad2c1ad1cb68a154155c065a2a32 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2,7 +2,6 @@ package net.minecraft.server.level;
|
||||
@ -29,7 +29,7 @@ index 0f039eae0ca81f80bf2e644b64a356427ce611bb..88cde9de26d3da3d863a9d44f5c127ee
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.datafixers.DataFixer;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
@@ -1188,17 +1187,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1207,17 +1206,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
++TimingHistory.entityTicks; // Paper - timings
|
||||
// Spigot start
|
||||
co.aikar.timings.Timing timer; // Paper
|
||||
@ -51,7 +51,7 @@ index 0f039eae0ca81f80bf2e644b64a356427ce611bb..88cde9de26d3da3d863a9d44f5c127ee
|
||||
try {
|
||||
// Paper end - timings
|
||||
entity.setOldPosAndRot();
|
||||
@@ -1209,9 +1208,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1228,9 +1227,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickNonPassenger");
|
||||
@ -65,7 +65,7 @@ index 0f039eae0ca81f80bf2e644b64a356427ce611bb..88cde9de26d3da3d863a9d44f5c127ee
|
||||
Iterator iterator = entity.getPassengers().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -1219,13 +1222,18 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1238,13 +1241,18 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
this.tickPassenger(entity, entity1);
|
||||
}
|
||||
@ -85,7 +85,7 @@ index 0f039eae0ca81f80bf2e644b64a356427ce611bb..88cde9de26d3da3d863a9d44f5c127ee
|
||||
passenger.setOldPosAndRot();
|
||||
++passenger.tickCount;
|
||||
ProfilerFiller gameprofilerfiller = this.getProfiler();
|
||||
@@ -1234,8 +1242,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1253,8 +1261,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString();
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickPassenger");
|
||||
@ -103,7 +103,7 @@ index 0f039eae0ca81f80bf2e644b64a356427ce611bb..88cde9de26d3da3d863a9d44f5c127ee
|
||||
gameprofilerfiller.pop();
|
||||
Iterator iterator = passenger.getPassengers().iterator();
|
||||
|
||||
@@ -1245,6 +1262,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1264,6 +1281,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
this.tickPassenger(passenger, entity2);
|
||||
}
|
||||
|
||||
@ -112,10 +112,10 @@ index 0f039eae0ca81f80bf2e644b64a356427ce611bb..88cde9de26d3da3d863a9d44f5c127ee
|
||||
} else {
|
||||
passenger.stopRiding();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index bf046bea5fdff67f362c401f1ddbfa9d2863a9d7..0cb02541e7671281ed910793495c3268238726a5 100644
|
||||
index 75effaa34f06d85ee4e26d9a598acc85c94e9767..17471b840456e80a6a10947b2cf1e6daad05ea19 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -390,6 +390,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -395,6 +395,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
public void inactiveTick() { }
|
||||
// Spigot end
|
||||
// Paper start
|
||||
@ -124,7 +124,7 @@ index bf046bea5fdff67f362c401f1ddbfa9d2863a9d7..0cb02541e7671281ed910793495c3268
|
||||
protected int numCollisions = 0; // Paper
|
||||
public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one
|
||||
@javax.annotation.Nullable
|
||||
@@ -962,6 +964,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -967,6 +969,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
} else {
|
||||
this.wasOnFire = this.isOnFire();
|
||||
if (movementType == MoverType.PISTON) {
|
||||
@ -133,7 +133,7 @@ index bf046bea5fdff67f362c401f1ddbfa9d2863a9d7..0cb02541e7671281ed910793495c3268
|
||||
movement = this.limitPistonMovement(movement);
|
||||
if (movement.equals(Vec3.ZERO)) {
|
||||
return;
|
||||
@@ -974,6 +978,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -979,6 +983,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
this.stuckSpeedMultiplier = Vec3.ZERO;
|
||||
this.setDeltaMovement(Vec3.ZERO);
|
||||
}
|
||||
@ -148,10 +148,10 @@ index bf046bea5fdff67f362c401f1ddbfa9d2863a9d7..0cb02541e7671281ed910793495c3268
|
||||
movement = this.maybeBackOffFromEdge(movement, movementType);
|
||||
Vec3 vec3d1 = this.collide(movement);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 3d754bcfc7ab44fe833b6a68794cbcf8da5f4792..20007742739eb57fd36865526aa79ccebfca0b99 100644
|
||||
index efef5df4cf720058c0b07ef795cfa6a567113811..d330b6d291cd2967358e892ccbc480bb3bd8022d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -220,6 +220,19 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||
@@ -221,6 +221,19 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||
return this.lookControl;
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ index 07c1ca01c38d5d7d0a95ad5004b5df9f4a222935..e5995d0db5dcfba59a873ff439601894
|
||||
this.availableGoals.stream().filter((wrappedGoal) -> {
|
||||
return wrappedGoal.getGoal() == goal;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
|
||||
index d27e5f9dac4703b839ab8444f6b54bf54d58af86..34f319ad09276c6f68dde449c79351de0d7d86f5 100644
|
||||
index 7153e00a640abfeb134ff1dcb93f363b972a4233..4bbc36404b396500df0d9db380cf223b5897662e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
|
||||
@@ -14,7 +14,7 @@ public abstract class MoveToBlockGoal extends Goal {
|
||||
@ -252,7 +252,7 @@ index d27e5f9dac4703b839ab8444f6b54bf54d58af86..34f319ad09276c6f68dde449c79351de
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
index 7d7390dc76f683178fc332ea3c2c945ba8e9b84b..cc829161404c0f98a403c5219d5c535de1d5c5ba 100644
|
||||
index 0429b927e63ec12f53a6ce1ebe1e64d99bf7e129..c0aa370367856a159412dd141f683b7d51e11c8b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
@@ -227,17 +227,34 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
@ -348,10 +348,10 @@ index b149e8bcac034bb3fc118a9adcb0de45e18ed5e9..fc35cfc9d045f3e5b6a50af1d0ba83b6
|
||||
+
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 0c64e65af843034b26147f62c49c6ab12ac5ddd2..addaa87d68591dced30e304dc3880588a45234d6 100644
|
||||
index 53fd518e164ac774aab4484268abc836ccbbf60a..c9c7c9934a672adb1529aabc26f7f8bb5829b931 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -160,6 +160,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -163,6 +163,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public Map<BlockPos, BlockEntity> capturedTileEntities = new HashMap<>();
|
||||
public List<ItemEntity> captureDrops;
|
||||
public final it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<SpawnCategory> ticksPerSpawnCategory = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>();
|
@ -6,10 +6,10 @@ Subject: [PATCH] Implement alternative item-despawn-rate
|
||||
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
index 9b9d491c7c41590c93d606414902329b6636419f..a7eccb2f364ed633cb6d4914491eb686ff02e647 100644
|
||||
index bbd0d161f27d0e061c14ad87990e44492bb7fe3d..36ccb7701cc5f6648940256b62321034eff964c6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -54,6 +54,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -56,6 +56,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
public final float bobOffs;
|
||||
private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit
|
||||
public boolean canMobPickup = true; // Paper
|
||||
@ -17,7 +17,7 @@ index 9b9d491c7c41590c93d606414902329b6636419f..a7eccb2f364ed633cb6d4914491eb686
|
||||
|
||||
public ItemEntity(EntityType<? extends ItemEntity> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -190,7 +191,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -208,7 +209,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ index 9b9d491c7c41590c93d606414902329b6636419f..a7eccb2f364ed633cb6d4914491eb686
|
||||
// CraftBukkit start - fire ItemDespawnEvent
|
||||
if (CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
|
||||
this.age = 0;
|
||||
@@ -214,7 +215,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -232,7 +233,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
this.lastTick = MinecraftServer.currentTick;
|
||||
// CraftBukkit end
|
||||
|
||||
@ -35,7 +35,7 @@ index 9b9d491c7c41590c93d606414902329b6636419f..a7eccb2f364ed633cb6d4914491eb686
|
||||
// CraftBukkit start - fire ItemDespawnEvent
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
|
||||
this.age = 0;
|
||||
@@ -270,7 +271,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -288,7 +289,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
private boolean isMergable() {
|
||||
ItemStack itemstack = this.getItem();
|
||||
|
||||
@ -44,7 +44,7 @@ index 9b9d491c7c41590c93d606414902329b6636419f..a7eccb2f364ed633cb6d4914491eb686
|
||||
}
|
||||
|
||||
private void tryToMerge(ItemEntity other) {
|
||||
@@ -512,6 +513,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -531,6 +532,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
|
||||
public void setItem(ItemStack stack) {
|
||||
this.getEntityData().set(ItemEntity.DATA_ITEM, stack);
|
||||
@ -52,7 +52,7 @@ index 9b9d491c7c41590c93d606414902329b6636419f..a7eccb2f364ed633cb6d4914491eb686
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -565,7 +567,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -585,7 +587,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
|
||||
public void makeFakeItem() {
|
||||
this.setNeverPickUp();
|
@ -13,10 +13,10 @@ Quickly loading the exact world spawn chunk before searching the
|
||||
heightmap resolves the issue without having to load all spawn chunks.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 0cb02541e7671281ed910793495c3268238726a5..7ba9b07c4f3335fabc3aeb28cdcd331b0c5ada86 100644
|
||||
index 17471b840456e80a6a10947b2cf1e6daad05ea19..2e6b700b3648d716f63dca46019f425d2919e912 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -3378,6 +3378,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -3411,6 +3411,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
if (flag1) {
|
||||
blockposition1 = ServerLevel.END_SPAWN_POINT;
|
||||
} else {
|
@ -39,34 +39,35 @@ index 9b16464c4edf334093c9aa0bd164348197b96455..bd15131b7506e965bcf64be203307312
|
||||
double d0 = (double) SectionPos.sectionToBlockCoord(pos.x, 8);
|
||||
double d1 = (double) SectionPos.sectionToBlockCoord(pos.z, 8);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 821b2c8860c1328e2ecc009deeb533648ce16540..ce8afee7d1db99de43c9ec47edcbc929e025b159 100644
|
||||
index d30373d369049827b5b7611d35c8b7fc8fc08d23..9478b18839932af463181311586c7f590c497356 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -543,7 +543,18 @@ public class ServerChunkCache extends ChunkSource {
|
||||
gameprofilerfiller.push("naturalSpawnCount");
|
||||
this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
|
||||
int l = this.distanceManager.getNaturalSpawnChunkCount();
|
||||
- NaturalSpawner.SpawnState spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, new LocalMobCapCalculator(this.chunkMap));
|
||||
+ // Paper start - per player mob spawning
|
||||
+ NaturalSpawner.SpawnState spawnercreature_d; // moved down
|
||||
+ if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled
|
||||
+ // re-set mob counts
|
||||
+ for (ServerPlayer player : this.level.players) {
|
||||
+ Arrays.fill(player.mobCounts, 0);
|
||||
@@ -549,7 +549,19 @@ public class ServerChunkCache extends ChunkSource {
|
||||
gameprofilerfiller.popPush("naturalSpawnCount");
|
||||
this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
|
||||
int k = this.distanceManager.getNaturalSpawnChunkCount();
|
||||
- NaturalSpawner.SpawnState spawnercreature_d = NaturalSpawner.createState(k, this.level.getAllEntities(), this::getFullChunk, new LocalMobCapCalculator(this.chunkMap));
|
||||
+ // Paper start - per player mob spawning
|
||||
+ int naturalSpawnChunkCount = k;
|
||||
+ NaturalSpawner.SpawnState spawnercreature_d; // moved down
|
||||
+ if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled
|
||||
+ // re-set mob counts
|
||||
+ for (ServerPlayer player : this.level.players) {
|
||||
+ Arrays.fill(player.mobCounts, 0);
|
||||
+ }
|
||||
+ spawnercreature_d = NaturalSpawner.createState(naturalSpawnChunkCount, this.level.getAllEntities(), this::getFullChunk, null, true);
|
||||
+ } else {
|
||||
+ spawnercreature_d = NaturalSpawner.createState(naturalSpawnChunkCount, this.level.getAllEntities(), this::getFullChunk, !this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new LocalMobCapCalculator(this.chunkMap) : null, false);
|
||||
+ }
|
||||
+ spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, null, true);
|
||||
+ } else {
|
||||
+ spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, !this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new LocalMobCapCalculator(this.chunkMap) : null, false);
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
|
||||
+ // Paper end
|
||||
this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
|
||||
|
||||
this.lastSpawnState = spawnercreature_d;
|
||||
this.lastSpawnState = spawnercreature_d;
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index b0065a0e9494e0ebbd212874997839f04cda5fd7..0952769c94519f9fb300bc14c498f19107364643 100644
|
||||
index 05c658b988fd970eeba8117d06c5a5d93b8fd75d..ad167cd343ec38f0263e634124036e741246c6b6 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -246,6 +246,10 @@ public class ServerPlayer extends Player {
|
||||
@@ -253,6 +253,10 @@ public class ServerPlayer extends Player {
|
||||
public boolean queueHealthUpdatePacket = false;
|
||||
public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket;
|
||||
// Paper end
|
In neuem Issue referenzieren
Einen Benutzer sperren