mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Don't fire sync events during worldgen
Fixes EntityPotionEffectEvent Fixes EntityPoseChangeEvent Asynchronous chunk generation provides an opportunity for things to happen async that previously fired synchronous-only events. This patch is for mitigating those issues by various methods. Also fixes correctly marking/clearing the entity generation flag. This patch sets the generation flag anytime an entity is created via StructureTemplate before loading from NBT to catch uses of the flag during the loading logic. This patch clears the generation flag from an entity when added to a ServerLevel for the situation where generation happened directly to a ServerLevel and the entity still has the flag set.
This commit is contained in:
parent
5f134afc4b
commit
fff5d44a12
8 changed files with 252 additions and 218 deletions
|
@ -80,7 +80,7 @@
|
||||||
+ public final UUID uuid;
|
+ public final UUID uuid;
|
||||||
+ public boolean hasPhysicsEvent = true; // Paper - BlockPhysicsEvent
|
+ public boolean hasPhysicsEvent = true; // Paper - BlockPhysicsEvent
|
||||||
+ public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent
|
+ public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent
|
||||||
|
+
|
||||||
+ public LevelChunk getChunkIfLoaded(int x, int z) {
|
+ public LevelChunk getChunkIfLoaded(int x, int z) {
|
||||||
+ return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
|
+ return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
|
||||||
+ }
|
+ }
|
||||||
|
@ -142,7 +142,7 @@
|
||||||
+
|
+
|
||||||
+ this.loadChunks(minChunkX, minChunkZ, maxChunkX, maxChunkZ, priority, onLoad);
|
+ this.loadChunks(minChunkX, minChunkZ, maxChunkX, maxChunkZ, priority, onLoad);
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
+ public final void loadChunks(int minChunkX, int minChunkZ, int maxChunkX, int maxChunkZ,
|
+ public final void loadChunks(int minChunkX, int minChunkZ, int maxChunkX, int maxChunkZ,
|
||||||
+ ca.spottedleaf.concurrentutil.util.Priority priority,
|
+ ca.spottedleaf.concurrentutil.util.Priority priority,
|
||||||
+ java.util.function.Consumer<List<net.minecraft.world.level.chunk.ChunkAccess>> onLoad) {
|
+ java.util.function.Consumer<List<net.minecraft.world.level.chunk.ChunkAccess>> onLoad) {
|
||||||
|
@ -638,7 +638,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -939,41 +1192,104 @@
|
@@ -939,41 +1192,105 @@
|
||||||
this.entityManager.addNewEntity(player);
|
this.entityManager.addNewEntity(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -646,6 +646,7 @@
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ private boolean addEntity(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
|
+ private boolean addEntity(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||||
+ org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot
|
+ org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot
|
||||||
|
+ entity.generation = false; // Paper - Don't fire sync event during generation; Reset flag if it was added during a ServerLevel generation process
|
||||||
+ // Paper start - extra debug info
|
+ // Paper start - extra debug info
|
||||||
+ if (entity.valid) {
|
+ if (entity.valid) {
|
||||||
+ MinecraftServer.LOGGER.error("Attempted Double World add on {}", entity, new Throwable());
|
+ MinecraftServer.LOGGER.error("Attempted Double World add on {}", entity, new Throwable());
|
||||||
|
@ -748,7 +749,7 @@
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
|
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
|
||||||
|
|
||||||
@@ -982,6 +1298,12 @@
|
@@ -982,6 +1299,12 @@
|
||||||
double d1 = (double) pos.getY() - entityplayer.getY();
|
double d1 = (double) pos.getY() - entityplayer.getY();
|
||||||
double d2 = (double) pos.getZ() - entityplayer.getZ();
|
double d2 = (double) pos.getZ() - entityplayer.getZ();
|
||||||
|
|
||||||
|
@ -761,7 +762,7 @@
|
||||||
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
|
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
|
||||||
entityplayer.connection.send(new ClientboundBlockDestructionPacket(entityId, pos, progress));
|
entityplayer.connection.send(new ClientboundBlockDestructionPacket(entityId, pos, progress));
|
||||||
}
|
}
|
||||||
@@ -1030,7 +1352,7 @@
|
@@ -1030,7 +1353,7 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void levelEvent(@Nullable Player player, int eventId, BlockPos pos, int data) {
|
public void levelEvent(@Nullable Player player, int eventId, BlockPos pos, int data) {
|
||||||
|
@ -770,7 +771,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLogicalHeight() {
|
public int getLogicalHeight() {
|
||||||
@@ -1039,6 +1361,11 @@
|
@@ -1039,6 +1362,11 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void gameEvent(Holder<GameEvent> event, Vec3 emitterPos, GameEvent.Context emitter) {
|
public void gameEvent(Holder<GameEvent> event, Vec3 emitterPos, GameEvent.Context emitter) {
|
||||||
|
@ -782,7 +783,7 @@
|
||||||
this.gameEventDispatcher.post(event, emitterPos, emitter);
|
this.gameEventDispatcher.post(event, emitterPos, emitter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1052,6 +1379,7 @@
|
@@ -1052,6 +1380,7 @@
|
||||||
|
|
||||||
this.getChunkSource().blockChanged(pos);
|
this.getChunkSource().blockChanged(pos);
|
||||||
this.pathTypesByPosCache.invalidate(pos);
|
this.pathTypesByPosCache.invalidate(pos);
|
||||||
|
@ -790,7 +791,7 @@
|
||||||
VoxelShape voxelshape = oldState.getCollisionShape(this, pos);
|
VoxelShape voxelshape = oldState.getCollisionShape(this, pos);
|
||||||
VoxelShape voxelshape1 = newState.getCollisionShape(this, pos);
|
VoxelShape voxelshape1 = newState.getCollisionShape(this, pos);
|
||||||
|
|
||||||
@@ -1060,7 +1388,18 @@
|
@@ -1060,7 +1389,18 @@
|
||||||
Iterator iterator = this.navigatingMobs.iterator();
|
Iterator iterator = this.navigatingMobs.iterator();
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
|
@ -810,7 +811,7 @@
|
||||||
PathNavigation navigationabstract = entityinsentient.getNavigation();
|
PathNavigation navigationabstract = entityinsentient.getNavigation();
|
||||||
|
|
||||||
if (navigationabstract.shouldRecomputePath(pos)) {
|
if (navigationabstract.shouldRecomputePath(pos)) {
|
||||||
@@ -1082,15 +1421,18 @@
|
@@ -1082,15 +1422,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -829,7 +830,7 @@
|
||||||
this.neighborUpdater.updateNeighborsAtExceptFromFacing(pos, sourceBlock, (Direction) null, orientation);
|
this.neighborUpdater.updateNeighborsAtExceptFromFacing(pos, sourceBlock, (Direction) null, orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1126,9 +1468,20 @@
|
@@ -1126,9 +1469,20 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explode(@Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator behavior, double x, double y, double z, float power, boolean createFire, Level.ExplosionInteraction explosionSourceType, ParticleOptions smallParticle, ParticleOptions largeParticle, Holder<SoundEvent> soundEvent) {
|
public void explode(@Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator behavior, double x, double y, double z, float power, boolean createFire, Level.ExplosionInteraction explosionSourceType, ParticleOptions smallParticle, ParticleOptions largeParticle, Holder<SoundEvent> soundEvent) {
|
||||||
|
@ -851,7 +852,7 @@
|
||||||
case NONE:
|
case NONE:
|
||||||
explosion_effect = Explosion.BlockInteraction.KEEP;
|
explosion_effect = Explosion.BlockInteraction.KEEP;
|
||||||
break;
|
break;
|
||||||
@@ -1144,16 +1497,27 @@
|
@@ -1144,16 +1498,27 @@
|
||||||
case TRIGGER:
|
case TRIGGER:
|
||||||
explosion_effect = Explosion.BlockInteraction.TRIGGER_BLOCK;
|
explosion_effect = Explosion.BlockInteraction.TRIGGER_BLOCK;
|
||||||
break;
|
break;
|
||||||
|
@ -882,7 +883,7 @@
|
||||||
Iterator iterator = this.players.iterator();
|
Iterator iterator = this.players.iterator();
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
@@ -1162,10 +1526,11 @@
|
@@ -1162,10 +1527,11 @@
|
||||||
if (entityplayer.distanceToSqr(vec3d) < 4096.0D) {
|
if (entityplayer.distanceToSqr(vec3d) < 4096.0D) {
|
||||||
Optional<Vec3> optional = Optional.ofNullable((Vec3) serverexplosion.getHitPlayers().get(entityplayer));
|
Optional<Vec3> optional = Optional.ofNullable((Vec3) serverexplosion.getHitPlayers().get(entityplayer));
|
||||||
|
|
||||||
|
@ -895,7 +896,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private Explosion.BlockInteraction getDestroyType(GameRules.Key<GameRules.BooleanValue> decayRule) {
|
private Explosion.BlockInteraction getDestroyType(GameRules.Key<GameRules.BooleanValue> decayRule) {
|
||||||
@@ -1226,17 +1591,29 @@
|
@@ -1226,17 +1592,29 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends ParticleOptions> int sendParticles(T parameters, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double speed) {
|
public <T extends ParticleOptions> int sendParticles(T parameters, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double speed) {
|
||||||
|
@ -930,7 +931,7 @@
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1292,7 +1669,7 @@
|
@@ -1292,7 +1670,7 @@
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public BlockPos findNearestMapStructure(TagKey<Structure> structureTag, BlockPos pos, int radius, boolean skipReferencedStructures) {
|
public BlockPos findNearestMapStructure(TagKey<Structure> structureTag, BlockPos pos, int radius, boolean skipReferencedStructures) {
|
||||||
|
@ -939,7 +940,7 @@
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().lookupOrThrow(Registries.STRUCTURE).get(structureTag);
|
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().lookupOrThrow(Registries.STRUCTURE).get(structureTag);
|
||||||
@@ -1334,11 +1711,38 @@
|
@@ -1334,11 +1712,38 @@
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public MapItemSavedData getMapData(MapId id) {
|
public MapItemSavedData getMapData(MapId id) {
|
||||||
|
@ -979,7 +980,7 @@
|
||||||
this.getServer().overworld().getDataStorage().set(id.key(), state);
|
this.getServer().overworld().getDataStorage().set(id.key(), state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1352,7 +1756,9 @@
|
@@ -1352,7 +1757,9 @@
|
||||||
float f1 = this.levelData.getSpawnAngle();
|
float f1 = this.levelData.getSpawnAngle();
|
||||||
|
|
||||||
if (!blockposition1.equals(pos) || f1 != angle) {
|
if (!blockposition1.equals(pos) || f1 != angle) {
|
||||||
|
@ -989,7 +990,7 @@
|
||||||
this.getServer().getPlayerList().broadcastAll(new ClientboundSetDefaultSpawnPositionPacket(pos, angle));
|
this.getServer().getPlayerList().broadcastAll(new ClientboundSetDefaultSpawnPositionPacket(pos, angle));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1419,6 +1825,11 @@
|
@@ -1419,6 +1826,11 @@
|
||||||
});
|
});
|
||||||
optional1.ifPresent((holder) -> {
|
optional1.ifPresent((holder) -> {
|
||||||
this.getServer().execute(() -> {
|
this.getServer().execute(() -> {
|
||||||
|
@ -1001,7 +1002,7 @@
|
||||||
this.getPoiManager().add(blockposition1, holder);
|
this.getPoiManager().add(blockposition1, holder);
|
||||||
DebugPackets.sendPoiAddedPacket(this, blockposition1);
|
DebugPackets.sendPoiAddedPacket(this, blockposition1);
|
||||||
});
|
});
|
||||||
@@ -1649,6 +2060,11 @@
|
@@ -1649,6 +2061,11 @@
|
||||||
@Override
|
@Override
|
||||||
public void blockUpdated(BlockPos pos, Block block) {
|
public void blockUpdated(BlockPos pos, Block block) {
|
||||||
if (!this.isDebug()) {
|
if (!this.isDebug()) {
|
||||||
|
@ -1013,7 +1014,7 @@
|
||||||
this.updateNeighborsAt(pos, block);
|
this.updateNeighborsAt(pos, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1668,12 +2084,12 @@
|
@@ -1668,12 +2085,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFlat() {
|
public boolean isFlat() {
|
||||||
|
@ -1028,7 +1029,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -1696,7 +2112,7 @@
|
@@ -1696,7 +2113,7 @@
|
||||||
private static <T> String getTypeCount(Iterable<T> items, Function<T, String> classifier) {
|
private static <T> String getTypeCount(Iterable<T> items, Function<T, String> classifier) {
|
||||||
try {
|
try {
|
||||||
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
|
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
|
||||||
|
@ -1037,7 +1038,7 @@
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
T t0 = iterator.next();
|
T t0 = iterator.next();
|
||||||
@@ -1705,7 +2121,7 @@
|
@@ -1705,7 +2122,7 @@
|
||||||
object2intopenhashmap.addTo(s, 1);
|
object2intopenhashmap.addTo(s, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1046,7 +1047,7 @@
|
||||||
String s1 = (String) entry.getKey();
|
String s1 = (String) entry.getKey();
|
||||||
|
|
||||||
return s1 + ":" + entry.getIntValue();
|
return s1 + ":" + entry.getIntValue();
|
||||||
@@ -1717,6 +2133,7 @@
|
@@ -1717,6 +2134,7 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LevelEntityGetter<Entity> getEntities() {
|
public LevelEntityGetter<Entity> getEntities() {
|
||||||
|
@ -1054,10 +1055,12 @@
|
||||||
return this.entityManager.getEntityGetter();
|
return this.entityManager.getEntityGetter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1802,6 +2219,27 @@
|
@@ -1800,7 +2218,28 @@
|
||||||
return this.serverLevelData.getGameRules();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public GameRules getGameRules() {
|
||||||
|
return this.serverLevelData.getGameRules();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ // Paper start - respect global sound events gamerule
|
+ // Paper start - respect global sound events gamerule
|
||||||
+ public List<net.minecraft.server.level.ServerPlayer> getPlayersForGlobalSoundGamerule() {
|
+ public List<net.minecraft.server.level.ServerPlayer> getPlayersForGlobalSoundGamerule() {
|
||||||
+ return this.getGameRules().getBoolean(GameRules.RULE_GLOBAL_SOUND_EVENTS) ? ((ServerLevel) this).getServer().getPlayerList().players : ((ServerLevel) this).players();
|
+ return this.getGameRules().getBoolean(GameRules.RULE_GLOBAL_SOUND_EVENTS) ? ((ServerLevel) this).getServer().getPlayerList().players : ((ServerLevel) this).players();
|
||||||
|
@ -1076,13 +1079,12 @@
|
||||||
+ if (craftBlockState.getPosition().getY() == pos.getY() && this.getBlockState(craftBlockState.getPosition()) == craftBlockState.getHandle()) {
|
+ if (craftBlockState.getPosition().getY() == pos.getY() && this.getBlockState(craftBlockState.getPosition()) == craftBlockState.getHandle()) {
|
||||||
+ this.notifyAndUpdatePhysics(craftBlockState.getPosition(), null, craftBlockState.getHandle(), craftBlockState.getHandle(), craftBlockState.getHandle(), craftBlockState.getFlag(), 512);
|
+ this.notifyAndUpdatePhysics(craftBlockState.getPosition(), null, craftBlockState.getHandle(), craftBlockState.getHandle(), craftBlockState.getHandle(), craftBlockState.getFlag(), 512);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
}
|
||||||
+ // Paper end - notify observers even if grow failed
|
+ // Paper end - notify observers even if grow failed
|
||||||
+
|
|
||||||
@Override
|
@Override
|
||||||
public CrashReportCategory fillReportDetails(CrashReport report) {
|
public CrashReportCategory fillReportDetails(CrashReport report) {
|
||||||
CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report);
|
@@ -1828,6 +2267,7 @@
|
||||||
@@ -1828,6 +2266,7 @@
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTickingStart(Entity entity) {
|
public void onTickingStart(Entity entity) {
|
||||||
|
@ -1090,7 +1092,7 @@
|
||||||
ServerLevel.this.entityTickList.add(entity);
|
ServerLevel.this.entityTickList.add(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1836,14 +2275,15 @@
|
@@ -1836,14 +2276,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTrackingStart(Entity entity) {
|
public void onTrackingStart(Entity entity) {
|
||||||
|
@ -1108,7 +1110,7 @@
|
||||||
String s = "onTrackingStart called during navigation iteration";
|
String s = "onTrackingStart called during navigation iteration";
|
||||||
|
|
||||||
Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration"));
|
Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration"));
|
||||||
@@ -1864,9 +2304,58 @@
|
@@ -1864,9 +2305,58 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
|
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
|
||||||
|
@ -1167,7 +1169,7 @@
|
||||||
ServerLevel.this.getChunkSource().removeEntity(entity);
|
ServerLevel.this.getChunkSource().removeEntity(entity);
|
||||||
if (entity instanceof ServerPlayer entityplayer) {
|
if (entity instanceof ServerPlayer entityplayer) {
|
||||||
ServerLevel.this.players.remove(entityplayer);
|
ServerLevel.this.players.remove(entityplayer);
|
||||||
@@ -1874,7 +2363,7 @@
|
@@ -1874,7 +2364,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity instanceof Mob entityinsentient) {
|
if (entity instanceof Mob entityinsentient) {
|
||||||
|
@ -1176,7 +1178,7 @@
|
||||||
String s = "onTrackingStart called during navigation iteration";
|
String s = "onTrackingStart called during navigation iteration";
|
||||||
|
|
||||||
Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration"));
|
Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration"));
|
||||||
@@ -1895,10 +2384,27 @@
|
@@ -1895,10 +2385,27 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);
|
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);
|
||||||
|
|
|
@ -320,7 +320,7 @@
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
return object instanceof Entity ? ((Entity) object).id == this.id : false;
|
return object instanceof Entity ? ((Entity) object).id == this.id : false;
|
||||||
}
|
}
|
||||||
@@ -385,22 +613,35 @@
|
@@ -385,22 +613,39 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(Entity.RemovalReason reason) {
|
public void remove(Entity.RemovalReason reason) {
|
||||||
|
@ -345,7 +345,11 @@
|
||||||
+ if (pose == this.getPose()) {
|
+ if (pose == this.getPose()) {
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ this.level.getCraftServer().getPluginManager().callEvent(new EntityPoseChangeEvent(this.getBukkitEntity(), Pose.values()[pose.ordinal()]));
|
+ // Paper start - Don't fire sync event during generation
|
||||||
|
+ if (!this.generation) {
|
||||||
|
+ this.level.getCraftServer().getPluginManager().callEvent(new EntityPoseChangeEvent(this.getBukkitEntity(), Pose.values()[pose.ordinal()]));
|
||||||
|
+ }
|
||||||
|
+ // Paper end - Don't fire sync event during generation
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
this.entityData.set(Entity.DATA_POSE, pose);
|
this.entityData.set(Entity.DATA_POSE, pose);
|
||||||
}
|
}
|
||||||
|
@ -361,7 +365,7 @@
|
||||||
return this.getPose() == pose;
|
return this.getPose() == pose;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -417,6 +658,33 @@
|
@@ -417,6 +662,33 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRot(float yaw, float pitch) {
|
public void setRot(float yaw, float pitch) {
|
||||||
|
@ -395,7 +399,7 @@
|
||||||
this.setYRot(yaw % 360.0F);
|
this.setYRot(yaw % 360.0F);
|
||||||
this.setXRot(pitch % 360.0F);
|
this.setXRot(pitch % 360.0F);
|
||||||
}
|
}
|
||||||
@@ -426,8 +694,8 @@
|
@@ -426,8 +698,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPos(double x, double y, double z) {
|
public void setPos(double x, double y, double z) {
|
||||||
|
@ -406,7 +410,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final AABB makeBoundingBox() {
|
protected final AABB makeBoundingBox() {
|
||||||
@@ -462,10 +730,20 @@
|
@@ -462,10 +734,20 @@
|
||||||
this.baseTick();
|
this.baseTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,7 +431,7 @@
|
||||||
this.inBlockState = null;
|
this.inBlockState = null;
|
||||||
if (this.isPassenger() && this.getVehicle().isRemoved()) {
|
if (this.isPassenger() && this.getVehicle().isRemoved()) {
|
||||||
this.stopRiding();
|
this.stopRiding();
|
||||||
@@ -475,7 +753,7 @@
|
@@ -475,7 +757,7 @@
|
||||||
--this.boardingCooldown;
|
--this.boardingCooldown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,7 +440,7 @@
|
||||||
if (this.canSpawnSprintParticle()) {
|
if (this.canSpawnSprintParticle()) {
|
||||||
this.spawnSprintParticle();
|
this.spawnSprintParticle();
|
||||||
}
|
}
|
||||||
@@ -502,7 +780,7 @@
|
@@ -502,7 +784,7 @@
|
||||||
this.setRemainingFireTicks(this.remainingFireTicks - 1);
|
this.setRemainingFireTicks(this.remainingFireTicks - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,7 +449,7 @@
|
||||||
this.setTicksFrozen(0);
|
this.setTicksFrozen(0);
|
||||||
this.level().levelEvent((Player) null, 1009, this.blockPosition, 1);
|
this.level().levelEvent((Player) null, 1009, this.blockPosition, 1);
|
||||||
}
|
}
|
||||||
@@ -514,6 +792,10 @@
|
@@ -514,6 +796,10 @@
|
||||||
if (this.isInLava()) {
|
if (this.isInLava()) {
|
||||||
this.lavaHurt();
|
this.lavaHurt();
|
||||||
this.fallDistance *= 0.5F;
|
this.fallDistance *= 0.5F;
|
||||||
|
@ -456,7 +460,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.checkBelowWorld();
|
this.checkBelowWorld();
|
||||||
@@ -525,7 +807,7 @@
|
@@ -525,7 +811,7 @@
|
||||||
world = this.level();
|
world = this.level();
|
||||||
if (world instanceof ServerLevel worldserver) {
|
if (world instanceof ServerLevel worldserver) {
|
||||||
if (this instanceof Leashable) {
|
if (this instanceof Leashable) {
|
||||||
|
@ -465,7 +469,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,7 +819,11 @@
|
@@ -537,7 +823,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkBelowWorld() {
|
public void checkBelowWorld() {
|
||||||
|
@ -478,7 +482,7 @@
|
||||||
this.onBelowWorld();
|
this.onBelowWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,15 +854,32 @@
|
@@ -568,15 +858,32 @@
|
||||||
|
|
||||||
public void lavaHurt() {
|
public void lavaHurt() {
|
||||||
if (!this.fireImmune()) {
|
if (!this.fireImmune()) {
|
||||||
|
@ -513,7 +517,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -587,9 +890,25 @@
|
@@ -587,9 +894,25 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void igniteForSeconds(float seconds) {
|
public final void igniteForSeconds(float seconds) {
|
||||||
|
@ -540,7 +544,7 @@
|
||||||
public void igniteForTicks(int ticks) {
|
public void igniteForTicks(int ticks) {
|
||||||
if (this.remainingFireTicks < ticks) {
|
if (this.remainingFireTicks < ticks) {
|
||||||
this.setRemainingFireTicks(ticks);
|
this.setRemainingFireTicks(ticks);
|
||||||
@@ -610,7 +929,7 @@
|
@@ -610,7 +933,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onBelowWorld() {
|
protected void onBelowWorld() {
|
||||||
|
@ -549,7 +553,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFree(double offsetX, double offsetY, double offsetZ) {
|
public boolean isFree(double offsetX, double offsetY, double offsetZ) {
|
||||||
@@ -672,6 +991,7 @@
|
@@ -672,6 +995,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void move(MoverType type, Vec3 movement) {
|
public void move(MoverType type, Vec3 movement) {
|
||||||
|
@ -557,7 +561,7 @@
|
||||||
if (this.noPhysics) {
|
if (this.noPhysics) {
|
||||||
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
|
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
|
||||||
} else {
|
} else {
|
||||||
@@ -747,8 +1067,30 @@
|
@@ -747,8 +1071,30 @@
|
||||||
|
|
||||||
if (movement.y != vec3d1.y) {
|
if (movement.y != vec3d1.y) {
|
||||||
block.updateEntityMovementAfterFallOn(this.level(), this);
|
block.updateEntityMovementAfterFallOn(this.level(), this);
|
||||||
|
@ -577,18 +581,18 @@
|
||||||
+ bl = bl.getRelative(BlockFace.SOUTH);
|
+ bl = bl.getRelative(BlockFace.SOUTH);
|
||||||
+ } else if (movement.z < vec3d1.z) {
|
+ } else if (movement.z < vec3d1.z) {
|
||||||
+ bl = bl.getRelative(BlockFace.NORTH);
|
+ bl = bl.getRelative(BlockFace.NORTH);
|
||||||
+ }
|
}
|
||||||
+
|
+
|
||||||
+ if (!bl.getType().isAir()) {
|
+ if (!bl.getType().isAir()) {
|
||||||
+ VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, bl, org.bukkit.craftbukkit.util.CraftVector.toBukkit(originalMovement)); // Paper - Expose pre-collision velocity
|
+ VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, bl, org.bukkit.craftbukkit.util.CraftVector.toBukkit(originalMovement)); // Paper - Expose pre-collision velocity
|
||||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||||
}
|
+ }
|
||||||
}
|
}
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
|
|
||||||
if (!this.level().isClientSide() || this.isControlledByLocalInstance()) {
|
if (!this.level().isClientSide() || this.isControlledByLocalInstance()) {
|
||||||
Entity.MovementEmission entity_movementemission = this.getMovementEmission();
|
Entity.MovementEmission entity_movementemission = this.getMovementEmission();
|
||||||
@@ -913,7 +1255,7 @@
|
@@ -913,7 +1259,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BlockPos getOnPos(float offset) {
|
protected BlockPos getOnPos(float offset) {
|
||||||
|
@ -597,7 +601,7 @@
|
||||||
BlockPos blockposition = (BlockPos) this.mainSupportingBlockPos.get();
|
BlockPos blockposition = (BlockPos) this.mainSupportingBlockPos.get();
|
||||||
|
|
||||||
if (offset <= 1.0E-5F) {
|
if (offset <= 1.0E-5F) {
|
||||||
@@ -1131,8 +1473,22 @@
|
@@ -1131,7 +1477,21 @@
|
||||||
|
|
||||||
protected SoundEvent getSwimHighSpeedSplashSound() {
|
protected SoundEvent getSwimHighSpeedSplashSound() {
|
||||||
return SoundEvents.GENERIC_SPLASH;
|
return SoundEvents.GENERIC_SPLASH;
|
||||||
|
@ -606,21 +610,20 @@
|
||||||
+ // CraftBukkit start - Add delegate methods
|
+ // CraftBukkit start - Add delegate methods
|
||||||
+ public SoundEvent getSwimSound0() {
|
+ public SoundEvent getSwimSound0() {
|
||||||
+ return this.getSwimSound();
|
+ return this.getSwimSound();
|
||||||
}
|
+ }
|
||||||
|
+
|
||||||
+ public SoundEvent getSwimSplashSound0() {
|
+ public SoundEvent getSwimSplashSound0() {
|
||||||
+ return this.getSwimSplashSound();
|
+ return this.getSwimSplashSound();
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public SoundEvent getSwimHighSpeedSplashSound0() {
|
+ public SoundEvent getSwimHighSpeedSplashSound0() {
|
||||||
+ return this.getSwimHighSpeedSplashSound();
|
+ return this.getSwimHighSpeedSplashSound();
|
||||||
+ }
|
}
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
|
||||||
public void recordMovementThroughBlocks(Vec3 oldPos, Vec3 newPos) {
|
public void recordMovementThroughBlocks(Vec3 oldPos, Vec3 newPos) {
|
||||||
this.movementThisTick.add(new Entity.Movement(oldPos, newPos));
|
this.movementThisTick.add(new Entity.Movement(oldPos, newPos));
|
||||||
}
|
@@ -1599,6 +1959,7 @@
|
||||||
@@ -1599,6 +1955,7 @@
|
|
||||||
this.setXRot(Mth.clamp(pitch, -90.0F, 90.0F) % 360.0F);
|
this.setXRot(Mth.clamp(pitch, -90.0F, 90.0F) % 360.0F);
|
||||||
this.yRotO = this.getYRot();
|
this.yRotO = this.getYRot();
|
||||||
this.xRotO = this.getXRot();
|
this.xRotO = this.getXRot();
|
||||||
|
@ -628,7 +631,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void absMoveTo(double x, double y, double z) {
|
public void absMoveTo(double x, double y, double z) {
|
||||||
@@ -1609,6 +1966,7 @@
|
@@ -1609,6 +1970,7 @@
|
||||||
this.yo = y;
|
this.yo = y;
|
||||||
this.zo = d4;
|
this.zo = d4;
|
||||||
this.setPos(d3, y, d4);
|
this.setPos(d3, y, d4);
|
||||||
|
@ -636,7 +639,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void moveTo(Vec3 pos) {
|
public void moveTo(Vec3 pos) {
|
||||||
@@ -1628,11 +1986,19 @@
|
@@ -1628,11 +1990,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void moveTo(double x, double y, double z, float yaw, float pitch) {
|
public void moveTo(double x, double y, double z, float yaw, float pitch) {
|
||||||
|
@ -656,7 +659,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setOldPosAndRot() {
|
public final void setOldPosAndRot() {
|
||||||
@@ -1701,6 +2067,7 @@
|
@@ -1701,6 +2071,7 @@
|
||||||
public void push(Entity entity) {
|
public void push(Entity entity) {
|
||||||
if (!this.isPassengerOfSameVehicle(entity)) {
|
if (!this.isPassengerOfSameVehicle(entity)) {
|
||||||
if (!entity.noPhysics && !this.noPhysics) {
|
if (!entity.noPhysics && !this.noPhysics) {
|
||||||
|
@ -664,7 +667,7 @@
|
||||||
double d0 = entity.getX() - this.getX();
|
double d0 = entity.getX() - this.getX();
|
||||||
double d1 = entity.getZ() - this.getZ();
|
double d1 = entity.getZ() - this.getZ();
|
||||||
double d2 = Mth.absMax(d0, d1);
|
double d2 = Mth.absMax(d0, d1);
|
||||||
@@ -1737,7 +2104,21 @@
|
@@ -1737,7 +2108,21 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void push(double deltaX, double deltaY, double deltaZ) {
|
public void push(double deltaX, double deltaY, double deltaZ) {
|
||||||
|
@ -687,7 +690,7 @@
|
||||||
this.hasImpulse = true;
|
this.hasImpulse = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1858,9 +2239,21 @@
|
@@ -1858,8 +2243,20 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPushable() {
|
public boolean isPushable() {
|
||||||
|
@ -699,17 +702,16 @@
|
||||||
+ // Paper end - Climbing should not bypass cramming gamerule
|
+ // Paper end - Climbing should not bypass cramming gamerule
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
+
|
||||||
+ // CraftBukkit start - collidable API
|
+ // CraftBukkit start - collidable API
|
||||||
+ public boolean canCollideWithBukkit(Entity entity) {
|
+ public boolean canCollideWithBukkit(Entity entity) {
|
||||||
+ return this.isPushable();
|
+ return this.isPushable();
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
|
||||||
public void awardKillScore(Entity entityKilled, DamageSource damageSource) {
|
public void awardKillScore(Entity entityKilled, DamageSource damageSource) {
|
||||||
if (entityKilled instanceof ServerPlayer) {
|
if (entityKilled instanceof ServerPlayer) {
|
||||||
CriteriaTriggers.ENTITY_KILLED_PLAYER.trigger((ServerPlayer) entityKilled, this, damageSource);
|
@@ -1889,74 +2286,133 @@
|
||||||
@@ -1889,74 +2282,133 @@
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean saveAsPassenger(CompoundTag nbt) {
|
public boolean saveAsPassenger(CompoundTag nbt) {
|
||||||
|
@ -866,7 +868,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
ListTag nbttaglist;
|
ListTag nbttaglist;
|
||||||
@@ -1972,10 +2424,10 @@
|
@@ -1972,10 +2428,10 @@
|
||||||
nbttaglist.add(StringTag.valueOf(s));
|
nbttaglist.add(StringTag.valueOf(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -879,7 +881,7 @@
|
||||||
if (this.isVehicle()) {
|
if (this.isVehicle()) {
|
||||||
nbttaglist = new ListTag();
|
nbttaglist = new ListTag();
|
||||||
iterator = this.getPassengers().iterator();
|
iterator = this.getPassengers().iterator();
|
||||||
@@ -1984,17 +2436,44 @@
|
@@ -1984,17 +2440,44 @@
|
||||||
Entity entity = (Entity) iterator.next();
|
Entity entity = (Entity) iterator.next();
|
||||||
CompoundTag nbttagcompound1 = new CompoundTag();
|
CompoundTag nbttagcompound1 = new CompoundTag();
|
||||||
|
|
||||||
|
@ -927,7 +929,7 @@
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||||
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being saved");
|
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being saved");
|
||||||
@@ -2080,6 +2559,71 @@
|
@@ -2080,6 +2563,71 @@
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException("Entity has invalid position");
|
throw new IllegalStateException("Entity has invalid position");
|
||||||
}
|
}
|
||||||
|
@ -999,7 +1001,7 @@
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||||
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
|
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
|
||||||
@@ -2101,6 +2645,12 @@
|
@@ -2101,6 +2649,12 @@
|
||||||
return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null;
|
return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1012,7 +1014,7 @@
|
||||||
protected abstract void readAdditionalSaveData(CompoundTag nbt);
|
protected abstract void readAdditionalSaveData(CompoundTag nbt);
|
||||||
|
|
||||||
protected abstract void addAdditionalSaveData(CompoundTag nbt);
|
protected abstract void addAdditionalSaveData(CompoundTag nbt);
|
||||||
@@ -2153,9 +2703,31 @@
|
@@ -2153,9 +2707,31 @@
|
||||||
if (stack.isEmpty()) {
|
if (stack.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1045,7 +1047,7 @@
|
||||||
world.addFreshEntity(entityitem);
|
world.addFreshEntity(entityitem);
|
||||||
return entityitem;
|
return entityitem;
|
||||||
}
|
}
|
||||||
@@ -2184,7 +2756,16 @@
|
@@ -2184,7 +2760,16 @@
|
||||||
if (this.isAlive() && this instanceof Leashable leashable) {
|
if (this.isAlive() && this instanceof Leashable leashable) {
|
||||||
if (leashable.getLeashHolder() == player) {
|
if (leashable.getLeashHolder() == player) {
|
||||||
if (!this.level().isClientSide()) {
|
if (!this.level().isClientSide()) {
|
||||||
|
@ -1063,7 +1065,7 @@
|
||||||
leashable.removeLeash();
|
leashable.removeLeash();
|
||||||
} else {
|
} else {
|
||||||
leashable.dropLeash();
|
leashable.dropLeash();
|
||||||
@@ -2200,6 +2781,14 @@
|
@@ -2200,6 +2785,14 @@
|
||||||
|
|
||||||
if (itemstack.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) {
|
if (itemstack.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) {
|
||||||
if (!this.level().isClientSide()) {
|
if (!this.level().isClientSide()) {
|
||||||
|
@ -1078,7 +1080,7 @@
|
||||||
leashable.setLeashedTo(player, true);
|
leashable.setLeashedTo(player, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2265,15 +2854,15 @@
|
@@ -2265,15 +2858,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean showVehicleHealth() {
|
public boolean showVehicleHealth() {
|
||||||
|
@ -1097,7 +1099,7 @@
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
for (Entity entity1 = entity; entity1.vehicle != null; entity1 = entity1.vehicle) {
|
for (Entity entity1 = entity; entity1.vehicle != null; entity1 = entity1.vehicle) {
|
||||||
@@ -2285,11 +2874,32 @@
|
@@ -2285,11 +2878,32 @@
|
||||||
if (!force && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
|
if (!force && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1131,7 +1133,7 @@
|
||||||
this.vehicle = entity;
|
this.vehicle = entity;
|
||||||
this.vehicle.addPassenger(this);
|
this.vehicle.addPassenger(this);
|
||||||
entity.getIndirectPassengersStream().filter((entity2) -> {
|
entity.getIndirectPassengersStream().filter((entity2) -> {
|
||||||
@@ -2314,19 +2924,30 @@
|
@@ -2314,19 +2928,30 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeVehicle() {
|
public void removeVehicle() {
|
||||||
|
@ -1164,7 +1166,7 @@
|
||||||
protected void addPassenger(Entity passenger) {
|
protected void addPassenger(Entity passenger) {
|
||||||
if (passenger.getVehicle() != this) {
|
if (passenger.getVehicle() != this) {
|
||||||
throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
|
throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
|
||||||
@@ -2349,21 +2970,53 @@
|
@@ -2349,21 +2974,53 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1224,7 +1226,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canAddPassenger(Entity passenger) {
|
protected boolean canAddPassenger(Entity passenger) {
|
||||||
@@ -2464,7 +3117,7 @@
|
@@ -2464,7 +3121,7 @@
|
||||||
if (teleporttransition != null) {
|
if (teleporttransition != null) {
|
||||||
ServerLevel worldserver1 = teleporttransition.newLevel();
|
ServerLevel worldserver1 = teleporttransition.newLevel();
|
||||||
|
|
||||||
|
@ -1233,7 +1235,7 @@
|
||||||
this.teleport(teleporttransition);
|
this.teleport(teleporttransition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2547,7 +3200,7 @@
|
@@ -2547,7 +3204,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCrouching() {
|
public boolean isCrouching() {
|
||||||
|
@ -1242,7 +1244,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSprinting() {
|
public boolean isSprinting() {
|
||||||
@@ -2563,7 +3216,7 @@
|
@@ -2563,7 +3220,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVisuallySwimming() {
|
public boolean isVisuallySwimming() {
|
||||||
|
@ -1251,7 +1253,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVisuallyCrawling() {
|
public boolean isVisuallyCrawling() {
|
||||||
@@ -2571,6 +3224,13 @@
|
@@ -2571,6 +3228,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSwimming(boolean swimming) {
|
public void setSwimming(boolean swimming) {
|
||||||
|
@ -1265,7 +1267,7 @@
|
||||||
this.setSharedFlag(4, swimming);
|
this.setSharedFlag(4, swimming);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2609,6 +3269,7 @@
|
@@ -2609,6 +3273,7 @@
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public PlayerTeam getTeam() {
|
public PlayerTeam getTeam() {
|
||||||
|
@ -1273,7 +1275,7 @@
|
||||||
return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName());
|
return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2624,8 +3285,12 @@
|
@@ -2624,8 +3289,12 @@
|
||||||
return this.getTeam() != null ? this.getTeam().isAlliedTo(team) : false;
|
return this.getTeam() != null ? this.getTeam().isAlliedTo(team) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1287,7 +1289,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getSharedFlag(int index) {
|
public boolean getSharedFlag(int index) {
|
||||||
@@ -2644,7 +3309,7 @@
|
@@ -2644,7 +3313,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxAirSupply() {
|
public int getMaxAirSupply() {
|
||||||
|
@ -1296,7 +1298,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAirSupply() {
|
public int getAirSupply() {
|
||||||
@@ -2652,7 +3317,18 @@
|
@@ -2652,7 +3321,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAirSupply(int air) {
|
public void setAirSupply(int air) {
|
||||||
|
@ -1316,7 +1318,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTicksFrozen() {
|
public int getTicksFrozen() {
|
||||||
@@ -2679,11 +3355,44 @@
|
@@ -2679,11 +3359,44 @@
|
||||||
|
|
||||||
public void thunderHit(ServerLevel world, LightningBolt lightning) {
|
public void thunderHit(ServerLevel world, LightningBolt lightning) {
|
||||||
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
||||||
|
@ -1363,7 +1365,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onAboveBubbleCol(boolean drag) {
|
public void onAboveBubbleCol(boolean drag) {
|
||||||
@@ -2713,7 +3422,7 @@
|
@@ -2713,7 +3426,7 @@
|
||||||
this.resetFallDistance();
|
this.resetFallDistance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1372,7 +1374,7 @@
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2818,7 +3527,7 @@
|
@@ -2818,7 +3531,7 @@
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String s = this.level() == null ? "~NULL~" : this.level().toString();
|
String s = this.level() == null ? "~NULL~" : this.level().toString();
|
||||||
|
|
||||||
|
@ -1381,7 +1383,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean isInvulnerableToBase(DamageSource damageSource) {
|
public final boolean isInvulnerableToBase(DamageSource damageSource) {
|
||||||
@@ -2838,6 +3547,13 @@
|
@@ -2838,6 +3551,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void restoreFrom(Entity original) {
|
public void restoreFrom(Entity original) {
|
||||||
|
@ -1395,7 +1397,7 @@
|
||||||
CompoundTag nbttagcompound = original.saveWithoutId(new CompoundTag());
|
CompoundTag nbttagcompound = original.saveWithoutId(new CompoundTag());
|
||||||
|
|
||||||
nbttagcompound.remove("Dimension");
|
nbttagcompound.remove("Dimension");
|
||||||
@@ -2850,8 +3566,57 @@
|
@@ -2850,8 +3570,57 @@
|
||||||
public Entity teleport(TeleportTransition teleportTarget) {
|
public Entity teleport(TeleportTransition teleportTarget) {
|
||||||
Level world = this.level();
|
Level world = this.level();
|
||||||
|
|
||||||
|
@ -1453,7 +1455,7 @@
|
||||||
ServerLevel worldserver1 = teleportTarget.newLevel();
|
ServerLevel worldserver1 = teleportTarget.newLevel();
|
||||||
boolean flag = worldserver1.dimension() != worldserver.dimension();
|
boolean flag = worldserver1.dimension() != worldserver.dimension();
|
||||||
|
|
||||||
@@ -2918,10 +3683,19 @@
|
@@ -2918,10 +3687,19 @@
|
||||||
gameprofilerfiller.pop();
|
gameprofilerfiller.pop();
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1474,7 +1476,7 @@
|
||||||
Iterator iterator1 = list1.iterator();
|
Iterator iterator1 = list1.iterator();
|
||||||
|
|
||||||
while (iterator1.hasNext()) {
|
while (iterator1.hasNext()) {
|
||||||
@@ -2947,7 +3721,7 @@
|
@@ -2947,7 +3725,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendTeleportTransitionToRidingPlayers(TeleportTransition teleportTarget) {
|
private void sendTeleportTransitionToRidingPlayers(TeleportTransition teleportTarget) {
|
||||||
|
@ -1483,7 +1485,7 @@
|
||||||
Iterator iterator = this.getIndirectPassengers().iterator();
|
Iterator iterator = this.getIndirectPassengers().iterator();
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
@@ -2995,9 +3769,17 @@
|
@@ -2995,9 +3773,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void removeAfterChangingDimensions() {
|
protected void removeAfterChangingDimensions() {
|
||||||
|
@ -1504,7 +1506,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3006,11 +3788,34 @@
|
@@ -3006,11 +3792,34 @@
|
||||||
return PortalShape.getRelativePosition(portalRect, portalAxis, this.position(), this.getDimensions(this.getPose()));
|
return PortalShape.getRelativePosition(portalRect, portalAxis, this.position(), this.getDimensions(this.getPose()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1539,7 +1541,7 @@
|
||||||
if (from.dimension() == Level.END && to.dimension() == Level.OVERWORLD) {
|
if (from.dimension() == Level.END && to.dimension() == Level.OVERWORLD) {
|
||||||
Iterator iterator = this.getPassengers().iterator();
|
Iterator iterator = this.getPassengers().iterator();
|
||||||
|
|
||||||
@@ -3134,10 +3939,16 @@
|
@@ -3134,10 +3943,16 @@
|
||||||
return (Boolean) this.entityData.get(Entity.DATA_CUSTOM_NAME_VISIBLE);
|
return (Boolean) this.entityData.get(Entity.DATA_CUSTOM_NAME_VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1559,7 +1561,7 @@
|
||||||
return entity != null;
|
return entity != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3187,7 +3998,7 @@
|
@@ -3187,7 +4002,7 @@
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
@Deprecated
|
@Deprecated
|
||||||
protected void fixupDimensions() {
|
protected void fixupDimensions() {
|
||||||
|
@ -1568,7 +1570,7 @@
|
||||||
EntityDimensions entitysize = this.getDimensions(entitypose);
|
EntityDimensions entitysize = this.getDimensions(entitypose);
|
||||||
|
|
||||||
this.dimensions = entitysize;
|
this.dimensions = entitysize;
|
||||||
@@ -3196,7 +4007,7 @@
|
@@ -3196,7 +4011,7 @@
|
||||||
|
|
||||||
public void refreshDimensions() {
|
public void refreshDimensions() {
|
||||||
EntityDimensions entitysize = this.dimensions;
|
EntityDimensions entitysize = this.dimensions;
|
||||||
|
@ -1577,7 +1579,7 @@
|
||||||
EntityDimensions entitysize1 = this.getDimensions(entitypose);
|
EntityDimensions entitysize1 = this.getDimensions(entitypose);
|
||||||
|
|
||||||
this.dimensions = entitysize1;
|
this.dimensions = entitysize1;
|
||||||
@@ -3258,10 +4069,29 @@
|
@@ -3258,10 +4073,29 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setBoundingBox(AABB boundingBox) {
|
public final void setBoundingBox(AABB boundingBox) {
|
||||||
|
@ -1609,7 +1611,7 @@
|
||||||
return this.getDimensions(pose).eyeHeight();
|
return this.getDimensions(pose).eyeHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3300,7 +4130,14 @@
|
@@ -3300,7 +4134,14 @@
|
||||||
|
|
||||||
public void startSeenByPlayer(ServerPlayer player) {}
|
public void startSeenByPlayer(ServerPlayer player) {}
|
||||||
|
|
||||||
|
@ -1625,7 +1627,7 @@
|
||||||
|
|
||||||
public float rotate(Rotation rotation) {
|
public float rotate(Rotation rotation) {
|
||||||
float f = Mth.wrapDegrees(this.getYRot());
|
float f = Mth.wrapDegrees(this.getYRot());
|
||||||
@@ -3335,7 +4172,7 @@
|
@@ -3335,7 +4176,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -1634,7 +1636,7 @@
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3373,20 +4210,34 @@
|
@@ -3373,20 +4214,34 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private Stream<Entity> getIndirectPassengersStream() {
|
private Stream<Entity> getIndirectPassengersStream() {
|
||||||
|
@ -1669,7 +1671,7 @@
|
||||||
return () -> {
|
return () -> {
|
||||||
return this.getIndirectPassengersStream().iterator();
|
return this.getIndirectPassengersStream().iterator();
|
||||||
};
|
};
|
||||||
@@ -3399,6 +4250,7 @@
|
@@ -3399,6 +4254,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasExactlyOnePlayerPassenger() {
|
public boolean hasExactlyOnePlayerPassenger() {
|
||||||
|
@ -1677,7 +1679,7 @@
|
||||||
return this.countPlayerPassengers() == 1;
|
return this.countPlayerPassengers() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3435,7 +4287,7 @@
|
@@ -3435,7 +4291,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isControlledByLocalInstance() {
|
public boolean isControlledByLocalInstance() {
|
||||||
|
@ -1686,7 +1688,7 @@
|
||||||
|
|
||||||
if (entityliving instanceof Player entityhuman) {
|
if (entityliving instanceof Player entityhuman) {
|
||||||
return entityhuman.isLocalPlayer();
|
return entityhuman.isLocalPlayer();
|
||||||
@@ -3445,7 +4297,7 @@
|
@@ -3445,7 +4301,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isControlledByClient() {
|
public boolean isControlledByClient() {
|
||||||
|
@ -1695,7 +1697,7 @@
|
||||||
|
|
||||||
return entityliving != null && entityliving.isControlledByClient();
|
return entityliving != null && entityliving.isControlledByClient();
|
||||||
}
|
}
|
||||||
@@ -3463,7 +4315,7 @@
|
@@ -3463,7 +4319,7 @@
|
||||||
return new Vec3((double) f1 * d2 / (double) f3, 0.0D, (double) f2 * d2 / (double) f3);
|
return new Vec3((double) f1 * d2 / (double) f3, 0.0D, (double) f2 * d2 / (double) f3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1704,7 +1706,7 @@
|
||||||
return new Vec3(this.getX(), this.getBoundingBox().maxY, this.getZ());
|
return new Vec3(this.getX(), this.getBoundingBox().maxY, this.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3489,8 +4341,37 @@
|
@@ -3489,8 +4345,37 @@
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1743,7 +1745,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void lookAt(EntityAnchorArgument.Anchor anchorPoint, Vec3 target) {
|
public void lookAt(EntityAnchorArgument.Anchor anchorPoint, Vec3 target) {
|
||||||
@@ -3551,6 +4432,11 @@
|
@@ -3551,6 +4436,11 @@
|
||||||
vec3d = vec3d.add(vec3d1);
|
vec3d = vec3d.add(vec3d1);
|
||||||
++k1;
|
++k1;
|
||||||
}
|
}
|
||||||
|
@ -1755,7 +1757,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3613,7 +4499,7 @@
|
@@ -3613,7 +4503,7 @@
|
||||||
return new ClientboundAddEntityPacket(this, entityTrackerEntry);
|
return new ClientboundAddEntityPacket(this, entityTrackerEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1764,7 +1766,7 @@
|
||||||
return this.type.getDimensions();
|
return this.type.getDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3714,7 +4600,39 @@
|
@@ -3714,7 +4604,39 @@
|
||||||
return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale);
|
return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1804,7 +1806,7 @@
|
||||||
if (this.position.x != x || this.position.y != y || this.position.z != z) {
|
if (this.position.x != x || this.position.y != y || this.position.z != z) {
|
||||||
this.position = new Vec3(x, y, z);
|
this.position = new Vec3(x, y, z);
|
||||||
int i = Mth.floor(x);
|
int i = Mth.floor(x);
|
||||||
@@ -3732,6 +4650,12 @@
|
@@ -3732,6 +4654,12 @@
|
||||||
this.levelCallback.onMove();
|
this.levelCallback.onMove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1817,7 +1819,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkDespawn() {}
|
public void checkDespawn() {}
|
||||||
@@ -3818,8 +4742,17 @@
|
@@ -3818,8 +4746,17 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void setRemoved(Entity.RemovalReason reason) {
|
public final void setRemoved(Entity.RemovalReason reason) {
|
||||||
|
@ -1836,7 +1838,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.removalReason.shouldDestroy()) {
|
if (this.removalReason.shouldDestroy()) {
|
||||||
@@ -3827,14 +4760,30 @@
|
@@ -3827,14 +4764,30 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getPassengers().forEach(Entity::stopRiding);
|
this.getPassengers().forEach(Entity::stopRiding);
|
||||||
|
@ -1869,7 +1871,7 @@
|
||||||
@Override
|
@Override
|
||||||
public void setLevelCallback(EntityInLevelCallback changeListener) {
|
public void setLevelCallback(EntityInLevelCallback changeListener) {
|
||||||
this.levelCallback = changeListener;
|
this.levelCallback = changeListener;
|
||||||
@@ -3887,7 +4836,7 @@
|
@@ -3887,7 +4840,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vec3 getKnownMovement() {
|
public Vec3 getKnownMovement() {
|
||||||
|
@ -1878,7 +1880,7 @@
|
||||||
|
|
||||||
if (entityliving instanceof Player entityhuman) {
|
if (entityliving instanceof Player entityhuman) {
|
||||||
if (this.isAlive()) {
|
if (this.isAlive()) {
|
||||||
@@ -3962,4 +4911,14 @@
|
@@ -3962,4 +4915,14 @@
|
||||||
|
|
||||||
void accept(Entity entity, double x, double y, double z);
|
void accept(Entity entity, double x, double y, double z);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,14 +34,14 @@
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ return this.spawn(world, stack, player, pos, spawnReason, alignPosition, invertY, spawnReason == EntitySpawnReason.DISPENSER ? org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DISPENSE_EGG : org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // Paper - use correct spawn reason for dispenser spawn eggs
|
+ return this.spawn(world, stack, player, pos, spawnReason, alignPosition, invertY, spawnReason == EntitySpawnReason.DISPENSER ? org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DISPENSE_EGG : org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // Paper - use correct spawn reason for dispenser spawn eggs
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
|
- if (stack != null) {
|
||||||
|
- consumer = EntityType.createDefaultStackConfig(world, stack, player);
|
||||||
+ @Nullable
|
+ @Nullable
|
||||||
+ public T spawn(ServerLevel worldserver, @Nullable ItemStack itemstack, @Nullable Player entityhuman, BlockPos blockposition, EntitySpawnReason entityspawnreason, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
+ public T spawn(ServerLevel worldserver, @Nullable ItemStack itemstack, @Nullable Player entityhuman, BlockPos blockposition, EntitySpawnReason entityspawnreason, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+ Consumer<T> consumer; // CraftBukkit - decompile error
|
+ Consumer<T> consumer; // CraftBukkit - decompile error
|
||||||
|
+
|
||||||
- if (stack != null) {
|
|
||||||
- consumer = EntityType.createDefaultStackConfig(world, stack, player);
|
|
||||||
+ if (itemstack != null) {
|
+ if (itemstack != null) {
|
||||||
+ consumer = EntityType.createDefaultStackConfig(worldserver, itemstack, entityhuman);
|
+ consumer = EntityType.createDefaultStackConfig(worldserver, itemstack, entityhuman);
|
||||||
} else {
|
} else {
|
||||||
|
@ -125,7 +125,23 @@
|
||||||
nbt.loadInto(entity);
|
nbt.loadInto(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -657,7 +703,7 @@
|
@@ -613,9 +659,15 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Optional<Entity> create(CompoundTag nbt, Level world, EntitySpawnReason reason) {
|
||||||
|
+ // Paper start - Don't fire sync event during generation
|
||||||
|
+ return create(nbt, world, reason, false);
|
||||||
|
+ }
|
||||||
|
+ public static Optional<Entity> create(CompoundTag nbt, Level world, EntitySpawnReason reason, boolean generation) {
|
||||||
|
+ // Paper end - Don't fire sync event during generation
|
||||||
|
return Util.ifElse(EntityType.by(nbt).map((entitytypes) -> {
|
||||||
|
return entitytypes.create(world, reason);
|
||||||
|
}), (entity) -> {
|
||||||
|
+ if (generation) entity.generation = true; // Paper - Don't fire sync event during generation
|
||||||
|
entity.load(nbt);
|
||||||
|
}, () -> {
|
||||||
|
EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));
|
||||||
|
@@ -657,7 +709,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
return entity;
|
return entity;
|
||||||
|
@ -134,7 +150,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Stream<Entity> loadEntitiesRecursive(final List<? extends Tag> entityNbtList, final Level world, final EntitySpawnReason reason) {
|
public static Stream<Entity> loadEntitiesRecursive(final List<? extends Tag> entityNbtList, final Level world, final EntitySpawnReason reason) {
|
||||||
@@ -718,7 +764,7 @@
|
@@ -718,7 +770,7 @@
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public T tryCast(Entity obj) {
|
public T tryCast(Entity obj) {
|
||||||
|
@ -143,7 +159,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -791,7 +837,7 @@
|
@@ -791,7 +843,7 @@
|
||||||
this.canSpawnFarFromPlayer = spawnGroup == MobCategory.CREATURE || spawnGroup == MobCategory.MISC;
|
this.canSpawnFarFromPlayer = spawnGroup == MobCategory.CREATURE || spawnGroup == MobCategory.MISC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -409,7 +409,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -987,24 +1149,55 @@
|
@@ -987,24 +1149,63 @@
|
||||||
return this.addEffect(effect, (Entity) null);
|
return this.addEffect(effect, (Entity) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,6 +424,11 @@
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public boolean addEffect(MobEffectInstance mobeffect, @Nullable Entity entity, EntityPotionEffectEvent.Cause cause) {
|
+ public boolean addEffect(MobEffectInstance mobeffect, @Nullable Entity entity, EntityPotionEffectEvent.Cause cause) {
|
||||||
|
+ // Paper start - Don't fire sync event during generation
|
||||||
|
+ return this.addEffect(mobeffect, entity, cause, true);
|
||||||
|
+ }
|
||||||
|
+ public boolean addEffect(MobEffectInstance mobeffect, @Nullable Entity entity, EntityPotionEffectEvent.Cause cause, boolean fireEvent) {
|
||||||
|
+ // Paper end - Don't fire sync event during generation
|
||||||
+ // org.spigotmc.AsyncCatcher.catchOp("effect add"); // Spigot // Paper - move to API
|
+ // org.spigotmc.AsyncCatcher.catchOp("effect add"); // Spigot // Paper - move to API
|
||||||
+ if (this.isTickingEffects) {
|
+ if (this.isTickingEffects) {
|
||||||
+ this.effectsToProcess.add(new ProcessableEffect(mobeffect, cause));
|
+ this.effectsToProcess.add(new ProcessableEffect(mobeffect, cause));
|
||||||
|
@ -444,10 +449,13 @@
|
||||||
+ override = new MobEffectInstance(mobeffect1).update(mobeffect);
|
+ override = new MobEffectInstance(mobeffect1).update(mobeffect);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ if (fireEvent) { // Paper - Don't fire sync event during generation
|
||||||
+ EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, mobeffect1, mobeffect, cause, override);
|
+ EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, mobeffect1, mobeffect, cause, override);
|
||||||
|
+ override = event.isOverride(); // Paper - Don't fire sync event during generation
|
||||||
+ if (event.isCancelled()) {
|
+ if (event.isCancelled()) {
|
||||||
+ return false;
|
+ return false;
|
||||||
+ }
|
+ }
|
||||||
|
+ } // Paper - Don't fire sync event during generation
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
+
|
||||||
if (mobeffect1 == null) {
|
if (mobeffect1 == null) {
|
||||||
|
@ -461,7 +469,7 @@
|
||||||
- this.onEffectUpdated(mobeffect1, true, source);
|
- this.onEffectUpdated(mobeffect1, true, source);
|
||||||
+ mobeffect.onEffectAdded(this);
|
+ mobeffect.onEffectAdded(this);
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ } else if (event.isOverride()) {
|
+ } else if (override) { // Paper - Don't fire sync event during generation
|
||||||
+ mobeffect1.update(mobeffect);
|
+ mobeffect1.update(mobeffect);
|
||||||
+ this.onEffectUpdated(mobeffect1, true, entity);
|
+ this.onEffectUpdated(mobeffect1, true, entity);
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
|
@ -473,7 +481,7 @@
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1031,14 +1224,40 @@
|
@@ -1031,14 +1232,40 @@
|
||||||
return this.getType().is(EntityTypeTags.INVERTED_HEALING_AND_HARM);
|
return this.getType().is(EntityTypeTags.INVERTED_HEALING_AND_HARM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,7 +524,7 @@
|
||||||
if (mobeffect != null) {
|
if (mobeffect != null) {
|
||||||
this.onEffectsRemoved(List.of(mobeffect));
|
this.onEffectsRemoved(List.of(mobeffect));
|
||||||
return true;
|
return true;
|
||||||
@@ -1142,20 +1361,65 @@
|
@@ -1142,20 +1369,65 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -583,7 +591,7 @@
|
||||||
this.entityData.set(LivingEntity.DATA_HEALTH_ID, Mth.clamp(health, 0.0F, this.getMaxHealth()));
|
this.entityData.set(LivingEntity.DATA_HEALTH_ID, Mth.clamp(health, 0.0F, this.getMaxHealth()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1167,7 +1431,7 @@
|
@@ -1167,7 +1439,7 @@
|
||||||
public boolean hurtServer(ServerLevel world, DamageSource source, float amount) {
|
public boolean hurtServer(ServerLevel world, DamageSource source, float amount) {
|
||||||
if (this.isInvulnerableTo(world, source)) {
|
if (this.isInvulnerableTo(world, source)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -592,7 +600,7 @@
|
||||||
return false;
|
return false;
|
||||||
} else if (source.is(DamageTypeTags.IS_FIRE) && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
|
} else if (source.is(DamageTypeTags.IS_FIRE) && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -1182,10 +1446,11 @@
|
@@ -1182,10 +1454,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
float f1 = amount;
|
float f1 = amount;
|
||||||
|
@ -606,7 +614,7 @@
|
||||||
this.hurtCurrentlyUsedShield(amount);
|
this.hurtCurrentlyUsedShield(amount);
|
||||||
f2 = amount;
|
f2 = amount;
|
||||||
amount = 0.0F;
|
amount = 0.0F;
|
||||||
@@ -1202,15 +1467,26 @@
|
@@ -1202,15 +1475,26 @@
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -635,7 +643,7 @@
|
||||||
this.walkAnimation.setSpeed(1.5F);
|
this.walkAnimation.setSpeed(1.5F);
|
||||||
if (Float.isNaN(amount) || Float.isInfinite(amount)) {
|
if (Float.isNaN(amount) || Float.isInfinite(amount)) {
|
||||||
amount = Float.MAX_VALUE;
|
amount = Float.MAX_VALUE;
|
||||||
@@ -1218,18 +1494,27 @@
|
@@ -1218,18 +1502,27 @@
|
||||||
|
|
||||||
boolean flag1 = true;
|
boolean flag1 = true;
|
||||||
|
|
||||||
|
@ -667,7 +675,7 @@
|
||||||
this.hurtDuration = 10;
|
this.hurtDuration = 10;
|
||||||
this.hurtTime = this.hurtDuration;
|
this.hurtTime = this.hurtDuration;
|
||||||
}
|
}
|
||||||
@@ -1243,7 +1528,7 @@
|
@@ -1243,7 +1536,7 @@
|
||||||
world.broadcastDamageEvent(this, source);
|
world.broadcastDamageEvent(this, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -676,7 +684,7 @@
|
||||||
this.markHurt();
|
this.markHurt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1263,7 +1548,7 @@
|
@@ -1263,7 +1556,7 @@
|
||||||
d1 = source.getSourcePosition().z() - this.getZ();
|
d1 = source.getSourcePosition().z() - this.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -685,7 +693,7 @@
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
this.indicateDamage(d0, d1);
|
this.indicateDamage(d0, d1);
|
||||||
}
|
}
|
||||||
@@ -1272,17 +1557,18 @@
|
@@ -1272,17 +1565,18 @@
|
||||||
|
|
||||||
if (this.isDeadOrDying()) {
|
if (this.isDeadOrDying()) {
|
||||||
if (!this.checkTotemDeathProtection(source)) {
|
if (!this.checkTotemDeathProtection(source)) {
|
||||||
|
@ -708,7 +716,7 @@
|
||||||
|
|
||||||
if (flag2) {
|
if (flag2) {
|
||||||
this.lastDamageSource = source;
|
this.lastDamageSource = source;
|
||||||
@@ -1329,10 +1615,10 @@
|
@@ -1329,10 +1623,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -721,7 +729,7 @@
|
||||||
this.lastHurtByPlayerTime = 100;
|
this.lastHurtByPlayerTime = 100;
|
||||||
this.lastHurtByPlayer = entityhuman;
|
this.lastHurtByPlayer = entityhuman;
|
||||||
return entityhuman;
|
return entityhuman;
|
||||||
@@ -1342,8 +1628,8 @@
|
@@ -1342,8 +1636,8 @@
|
||||||
this.lastHurtByPlayerTime = 100;
|
this.lastHurtByPlayerTime = 100;
|
||||||
LivingEntity entityliving = entitywolf.getOwner();
|
LivingEntity entityliving = entitywolf.getOwner();
|
||||||
|
|
||||||
|
@ -732,7 +740,7 @@
|
||||||
|
|
||||||
this.lastHurtByPlayer = entityhuman1;
|
this.lastHurtByPlayer = entityhuman1;
|
||||||
} else {
|
} else {
|
||||||
@@ -1363,7 +1649,7 @@
|
@@ -1363,7 +1657,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void blockedByShield(LivingEntity target) {
|
protected void blockedByShield(LivingEntity target) {
|
||||||
|
@ -741,7 +749,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkTotemDeathProtection(DamageSource source) {
|
private boolean checkTotemDeathProtection(DamageSource source) {
|
||||||
@@ -1375,20 +1661,33 @@
|
@@ -1375,20 +1669,33 @@
|
||||||
InteractionHand[] aenumhand = InteractionHand.values();
|
InteractionHand[] aenumhand = InteractionHand.values();
|
||||||
int i = aenumhand.length;
|
int i = aenumhand.length;
|
||||||
|
|
||||||
|
@ -779,7 +787,7 @@
|
||||||
ServerPlayer entityplayer = (ServerPlayer) this;
|
ServerPlayer entityplayer = (ServerPlayer) this;
|
||||||
|
|
||||||
entityplayer.awardStat(Stats.ITEM_USED.get(itemstack.getItem()));
|
entityplayer.awardStat(Stats.ITEM_USED.get(itemstack.getItem()));
|
||||||
@@ -1468,6 +1767,7 @@
|
@@ -1468,6 +1775,7 @@
|
||||||
Entity entity = damageSource.getEntity();
|
Entity entity = damageSource.getEntity();
|
||||||
LivingEntity entityliving = this.getKillCredit();
|
LivingEntity entityliving = this.getKillCredit();
|
||||||
|
|
||||||
|
@ -787,7 +795,7 @@
|
||||||
if (entityliving != null) {
|
if (entityliving != null) {
|
||||||
entityliving.awardKillScore(this, damageSource);
|
entityliving.awardKillScore(this, damageSource);
|
||||||
}
|
}
|
||||||
@@ -1477,26 +1777,61 @@
|
@@ -1477,26 +1785,61 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.level().isClientSide && this.hasCustomName()) {
|
if (!this.level().isClientSide && this.hasCustomName()) {
|
||||||
|
@ -854,7 +862,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1506,20 +1841,28 @@
|
@@ -1506,20 +1849,28 @@
|
||||||
if (world instanceof ServerLevel worldserver) {
|
if (world instanceof ServerLevel worldserver) {
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
|
|
||||||
|
@ -886,7 +894,7 @@
|
||||||
this.level().addFreshEntity(entityitem);
|
this.level().addFreshEntity(entityitem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1527,27 +1870,60 @@
|
@@ -1527,27 +1878,60 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -909,6 +917,8 @@
|
||||||
this.dropCustomDeathLoot(world, damageSource, flag);
|
this.dropCustomDeathLoot(world, damageSource, flag);
|
||||||
+ this.clearEquipmentSlots = prev; // Paper
|
+ this.clearEquipmentSlots = prev; // Paper
|
||||||
}
|
}
|
||||||
|
-
|
||||||
|
- this.dropEquipment(world);
|
||||||
+ // CraftBukkit start - Call death event // Paper start - call advancement triggers with correct entity equipment
|
+ // CraftBukkit start - Call death event // Paper start - call advancement triggers with correct entity equipment
|
||||||
+ org.bukkit.event.entity.EntityDeathEvent deathEvent = CraftEventFactory.callEntityDeathEvent(this, damageSource, this.drops, () -> {
|
+ org.bukkit.event.entity.EntityDeathEvent deathEvent = CraftEventFactory.callEntityDeathEvent(this, damageSource, this.drops, () -> {
|
||||||
+ final LivingEntity entityliving = this.getKillCredit();
|
+ final LivingEntity entityliving = this.getKillCredit();
|
||||||
|
@ -919,8 +929,7 @@
|
||||||
+ this.postDeathDropItems(deathEvent); // Paper
|
+ this.postDeathDropItems(deathEvent); // Paper
|
||||||
+ this.drops = new ArrayList<>();
|
+ this.drops = new ArrayList<>();
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
|
+
|
||||||
- this.dropEquipment(world);
|
|
||||||
+ // this.dropEquipment(worldserver);// CraftBukkit - moved up
|
+ // this.dropEquipment(worldserver);// CraftBukkit - moved up
|
||||||
this.dropExperience(world, damageSource.getEntity());
|
this.dropExperience(world, damageSource.getEntity());
|
||||||
+ return deathEvent; // Paper
|
+ return deathEvent; // Paper
|
||||||
|
@ -952,7 +961,7 @@
|
||||||
protected void dropCustomDeathLoot(ServerLevel world, DamageSource source, boolean causedByPlayer) {}
|
protected void dropCustomDeathLoot(ServerLevel world, DamageSource source, boolean causedByPlayer) {}
|
||||||
|
|
||||||
public long getLootTableSeed() {
|
public long getLootTableSeed() {
|
||||||
@@ -1612,19 +1988,35 @@
|
@@ -1612,19 +1996,35 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void knockback(double strength, double x, double z) {
|
public void knockback(double strength, double x, double z) {
|
||||||
|
@ -995,7 +1004,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1683,6 +2075,20 @@
|
@@ -1683,6 +2083,20 @@
|
||||||
return new LivingEntity.Fallsounds(SoundEvents.GENERIC_SMALL_FALL, SoundEvents.GENERIC_BIG_FALL);
|
return new LivingEntity.Fallsounds(SoundEvents.GENERIC_SMALL_FALL, SoundEvents.GENERIC_BIG_FALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1016,7 +1025,7 @@
|
||||||
public Optional<BlockPos> getLastClimbablePos() {
|
public Optional<BlockPos> getLastClimbablePos() {
|
||||||
return this.lastClimbablePos;
|
return this.lastClimbablePos;
|
||||||
}
|
}
|
||||||
@@ -1757,9 +2163,14 @@
|
@@ -1757,9 +2171,14 @@
|
||||||
int i = this.calculateFallDamage(fallDistance, damageMultiplier);
|
int i = this.calculateFallDamage(fallDistance, damageMultiplier);
|
||||||
|
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
|
@ -1032,7 +1041,7 @@
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return flag;
|
return flag;
|
||||||
@@ -1830,7 +2241,7 @@
|
@@ -1830,7 +2249,7 @@
|
||||||
|
|
||||||
protected float getDamageAfterArmorAbsorb(DamageSource source, float amount) {
|
protected float getDamageAfterArmorAbsorb(DamageSource source, float amount) {
|
||||||
if (!source.is(DamageTypeTags.BYPASSES_ARMOR)) {
|
if (!source.is(DamageTypeTags.BYPASSES_ARMOR)) {
|
||||||
|
@ -1041,7 +1050,7 @@
|
||||||
amount = CombatRules.getDamageAfterAbsorb(this, amount, source, (float) this.getArmorValue(), (float) this.getAttributeValue(Attributes.ARMOR_TOUGHNESS));
|
amount = CombatRules.getDamageAfterAbsorb(this, amount, source, (float) this.getArmorValue(), (float) this.getAttributeValue(Attributes.ARMOR_TOUGHNESS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1841,7 +2252,8 @@
|
@@ -1841,7 +2260,8 @@
|
||||||
if (source.is(DamageTypeTags.BYPASSES_EFFECTS)) {
|
if (source.is(DamageTypeTags.BYPASSES_EFFECTS)) {
|
||||||
return amount;
|
return amount;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1051,7 +1060,7 @@
|
||||||
int i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
|
int i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
|
||||||
int j = 25 - i;
|
int j = 25 - i;
|
||||||
float f1 = amount * (float) j;
|
float f1 = amount * (float) j;
|
||||||
@@ -1884,18 +2296,154 @@
|
@@ -1884,18 +2304,154 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1215,7 +1224,7 @@
|
||||||
|
|
||||||
if (entity instanceof ServerPlayer) {
|
if (entity instanceof ServerPlayer) {
|
||||||
ServerPlayer entityplayer = (ServerPlayer) entity;
|
ServerPlayer entityplayer = (ServerPlayer) entity;
|
||||||
@@ -1904,13 +2452,48 @@
|
@@ -1904,13 +2460,48 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1268,7 +1277,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public CombatTracker getCombatTracker() {
|
public CombatTracker getCombatTracker() {
|
||||||
@@ -1935,9 +2518,19 @@
|
@@ -1935,9 +2526,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setArrowCount(int stuckArrowCount) {
|
public final void setArrowCount(int stuckArrowCount) {
|
||||||
|
@ -1289,7 +1298,7 @@
|
||||||
public final int getStingerCount() {
|
public final int getStingerCount() {
|
||||||
return (Integer) this.entityData.get(LivingEntity.DATA_STINGER_COUNT_ID);
|
return (Integer) this.entityData.get(LivingEntity.DATA_STINGER_COUNT_ID);
|
||||||
}
|
}
|
||||||
@@ -1999,7 +2592,7 @@
|
@@ -1999,7 +2600,7 @@
|
||||||
this.playSound(soundeffect, this.getSoundVolume(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
this.playSound(soundeffect, this.getSoundVolume(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1298,7 +1307,7 @@
|
||||||
this.setHealth(0.0F);
|
this.setHealth(0.0F);
|
||||||
this.die(this.damageSources().generic());
|
this.die(this.damageSources().generic());
|
||||||
}
|
}
|
||||||
@@ -2182,6 +2775,12 @@
|
@@ -2182,6 +2783,12 @@
|
||||||
|
|
||||||
public abstract ItemStack getItemBySlot(EquipmentSlot slot);
|
public abstract ItemStack getItemBySlot(EquipmentSlot slot);
|
||||||
|
|
||||||
|
@ -1311,7 +1320,7 @@
|
||||||
public abstract void setItemSlot(EquipmentSlot slot, ItemStack stack);
|
public abstract void setItemSlot(EquipmentSlot slot, ItemStack stack);
|
||||||
|
|
||||||
public Iterable<ItemStack> getHandSlots() {
|
public Iterable<ItemStack> getHandSlots() {
|
||||||
@@ -2292,17 +2891,29 @@
|
@@ -2292,17 +2899,29 @@
|
||||||
return this.hasEffect(MobEffects.JUMP) ? 0.1F * ((float) this.getEffect(MobEffects.JUMP).getAmplifier() + 1.0F) : 0.0F;
|
return this.hasEffect(MobEffects.JUMP) ? 0.1F * ((float) this.getEffect(MobEffects.JUMP).getAmplifier() + 1.0F) : 0.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1342,7 +1351,7 @@
|
||||||
this.addDeltaMovement(new Vec3((double) (-Mth.sin(f1)) * 0.2D, 0.0D, (double) Mth.cos(f1) * 0.2D));
|
this.addDeltaMovement(new Vec3((double) (-Mth.sin(f1)) * 0.2D, 0.0D, (double) Mth.cos(f1) * 0.2D));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2494,7 +3105,7 @@
|
@@ -2494,7 +3113,7 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1351,7 +1360,7 @@
|
||||||
Vec3 vec3d1 = this.getRiddenInput(controllingPlayer, movementInput);
|
Vec3 vec3d1 = this.getRiddenInput(controllingPlayer, movementInput);
|
||||||
|
|
||||||
this.tickRidden(controllingPlayer, vec3d1);
|
this.tickRidden(controllingPlayer, vec3d1);
|
||||||
@@ -2507,13 +3118,13 @@
|
@@ -2507,13 +3126,13 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1368,7 +1377,7 @@
|
||||||
return this.getSpeed();
|
return this.getSpeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2571,7 +3182,7 @@
|
@@ -2571,7 +3190,7 @@
|
||||||
double d1 = Mth.clamp(motion.z, -0.15000000596046448D, 0.15000000596046448D);
|
double d1 = Mth.clamp(motion.z, -0.15000000596046448D, 0.15000000596046448D);
|
||||||
double d2 = Math.max(motion.y, -0.15000000596046448D);
|
double d2 = Math.max(motion.y, -0.15000000596046448D);
|
||||||
|
|
||||||
|
@ -1377,7 +1386,7 @@
|
||||||
d2 = 0.0D;
|
d2 = 0.0D;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2586,7 +3197,7 @@
|
@@ -2586,7 +3205,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected float getFlyingSpeed() {
|
protected float getFlyingSpeed() {
|
||||||
|
@ -1386,7 +1395,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getSpeed() {
|
public float getSpeed() {
|
||||||
@@ -2634,7 +3245,7 @@
|
@@ -2634,7 +3253,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1395,7 +1404,7 @@
|
||||||
if (this.tickCount % 20 == 0) {
|
if (this.tickCount % 20 == 0) {
|
||||||
this.getCombatTracker().recheckStatus();
|
this.getCombatTracker().recheckStatus();
|
||||||
}
|
}
|
||||||
@@ -2687,37 +3298,15 @@
|
@@ -2687,37 +3306,15 @@
|
||||||
gameprofilerfiller.pop();
|
gameprofilerfiller.pop();
|
||||||
gameprofilerfiller.push("rangeChecks");
|
gameprofilerfiller.push("rangeChecks");
|
||||||
|
|
||||||
|
@ -1439,7 +1448,7 @@
|
||||||
|
|
||||||
gameprofilerfiller.pop();
|
gameprofilerfiller.pop();
|
||||||
this.animStep += f2;
|
this.animStep += f2;
|
||||||
@@ -2741,7 +3330,7 @@
|
@@ -2741,7 +3338,7 @@
|
||||||
this.elytraAnimationState.tick();
|
this.elytraAnimationState.tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1448,7 +1457,7 @@
|
||||||
Map<EquipmentSlot, ItemStack> map = this.collectEquipmentChanges();
|
Map<EquipmentSlot, ItemStack> map = this.collectEquipmentChanges();
|
||||||
|
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
@@ -2778,10 +3367,17 @@
|
@@ -2778,10 +3375,17 @@
|
||||||
throw new MatchException((String) null, (Throwable) null);
|
throw new MatchException((String) null, (Throwable) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1468,7 +1477,7 @@
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
map = Maps.newEnumMap(EquipmentSlot.class);
|
map = Maps.newEnumMap(EquipmentSlot.class);
|
||||||
}
|
}
|
||||||
@@ -2974,8 +3570,10 @@
|
@@ -2974,8 +3578,10 @@
|
||||||
} else if (this.isInLava() && (!this.onGround() || d3 > d4)) {
|
} else if (this.isInLava() && (!this.onGround() || d3 > d4)) {
|
||||||
this.jumpInLiquid(FluidTags.LAVA);
|
this.jumpInLiquid(FluidTags.LAVA);
|
||||||
} else if ((this.onGround() || flag && d3 <= d4) && this.noJumpDelay == 0) {
|
} else if ((this.onGround() || flag && d3 <= d4) && this.noJumpDelay == 0) {
|
||||||
|
@ -1479,7 +1488,7 @@
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.noJumpDelay = 0;
|
this.noJumpDelay = 0;
|
||||||
@@ -3000,7 +3598,7 @@
|
@@ -3000,7 +3606,7 @@
|
||||||
{
|
{
|
||||||
LivingEntity entityliving = this.getControllingPassenger();
|
LivingEntity entityliving = this.getControllingPassenger();
|
||||||
|
|
||||||
|
@ -1488,7 +1497,7 @@
|
||||||
if (this.isAlive()) {
|
if (this.isAlive()) {
|
||||||
this.travelRidden(entityhuman, vec3d1);
|
this.travelRidden(entityhuman, vec3d1);
|
||||||
break label112;
|
break label112;
|
||||||
@@ -3017,7 +3615,7 @@
|
@@ -3017,7 +3623,7 @@
|
||||||
this.calculateEntityAnimation(this instanceof FlyingAnimal);
|
this.calculateEntityAnimation(this instanceof FlyingAnimal);
|
||||||
gameprofilerfiller.pop();
|
gameprofilerfiller.pop();
|
||||||
gameprofilerfiller.push("freezing");
|
gameprofilerfiller.push("freezing");
|
||||||
|
@ -1497,7 +1506,7 @@
|
||||||
int i = this.getTicksFrozen();
|
int i = this.getTicksFrozen();
|
||||||
|
|
||||||
if (this.isInPowderSnow && this.canFreeze()) {
|
if (this.isInPowderSnow && this.canFreeze()) {
|
||||||
@@ -3046,6 +3644,20 @@
|
@@ -3046,6 +3652,20 @@
|
||||||
|
|
||||||
this.pushEntities();
|
this.pushEntities();
|
||||||
gameprofilerfiller.pop();
|
gameprofilerfiller.pop();
|
||||||
|
@ -1518,7 +1527,7 @@
|
||||||
world = this.level();
|
world = this.level();
|
||||||
if (world instanceof ServerLevel worldserver) {
|
if (world instanceof ServerLevel worldserver) {
|
||||||
if (this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
|
if (this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
|
||||||
@@ -3063,6 +3675,7 @@
|
@@ -3063,6 +3683,7 @@
|
||||||
this.checkSlowFallDistance();
|
this.checkSlowFallDistance();
|
||||||
if (!this.level().isClientSide) {
|
if (!this.level().isClientSide) {
|
||||||
if (!this.canGlide()) {
|
if (!this.canGlide()) {
|
||||||
|
@ -1526,7 +1535,7 @@
|
||||||
this.setSharedFlag(7, false);
|
this.setSharedFlag(7, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -3113,12 +3726,26 @@
|
@@ -3113,12 +3734,26 @@
|
||||||
Level world = this.level();
|
Level world = this.level();
|
||||||
|
|
||||||
if (!(world instanceof ServerLevel worldserver)) {
|
if (!(world instanceof ServerLevel worldserver)) {
|
||||||
|
@ -1556,7 +1565,7 @@
|
||||||
|
|
||||||
if (i > 0 && list.size() > i - 1 && this.random.nextInt(4) == 0) {
|
if (i > 0 && list.size() > i - 1 && this.random.nextInt(4) == 0) {
|
||||||
int j = 0;
|
int j = 0;
|
||||||
@@ -3138,10 +3765,12 @@
|
@@ -3138,10 +3773,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator iterator1 = list.iterator();
|
Iterator iterator1 = list.iterator();
|
||||||
|
@ -1571,7 +1580,7 @@
|
||||||
this.doPush(entity1);
|
this.doPush(entity1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3190,10 +3819,16 @@
|
@@ -3190,10 +3827,16 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stopRiding() {
|
public void stopRiding() {
|
||||||
|
@ -1590,7 +1599,7 @@
|
||||||
this.dismountVehicle(entity);
|
this.dismountVehicle(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3258,7 +3893,7 @@
|
@@ -3258,7 +3901,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onItemPickup(ItemEntity item) {
|
public void onItemPickup(ItemEntity item) {
|
||||||
|
@ -1599,7 +1608,7 @@
|
||||||
|
|
||||||
if (entity instanceof ServerPlayer) {
|
if (entity instanceof ServerPlayer) {
|
||||||
CriteriaTriggers.THROWN_ITEM_PICKED_UP_BY_ENTITY.trigger((ServerPlayer) entity, item.getItem(), this);
|
CriteriaTriggers.THROWN_ITEM_PICKED_UP_BY_ENTITY.trigger((ServerPlayer) entity, item.getItem(), this);
|
||||||
@@ -3268,7 +3903,7 @@
|
@@ -3268,7 +3911,7 @@
|
||||||
|
|
||||||
public void take(Entity item, int count) {
|
public void take(Entity item, int count) {
|
||||||
if (!item.isRemoved() && !this.level().isClientSide && (item instanceof ItemEntity || item instanceof AbstractArrow || item instanceof ExperienceOrb)) {
|
if (!item.isRemoved() && !this.level().isClientSide && (item instanceof ItemEntity || item instanceof AbstractArrow || item instanceof ExperienceOrb)) {
|
||||||
|
@ -1608,7 +1617,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3284,7 +3919,8 @@
|
@@ -3284,7 +3927,8 @@
|
||||||
Vec3 vec3d = new Vec3(this.getX(), this.getEyeY(), this.getZ());
|
Vec3 vec3d = new Vec3(this.getX(), this.getEyeY(), this.getZ());
|
||||||
Vec3 vec3d1 = new Vec3(entity.getX(), entityY, entity.getZ());
|
Vec3 vec3d1 = new Vec3(entity.getX(), entityY, entity.getZ());
|
||||||
|
|
||||||
|
@ -1618,7 +1627,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3305,15 +3941,29 @@
|
@@ -3305,15 +3949,29 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPickable() {
|
public boolean isPickable() {
|
||||||
|
@ -1650,7 +1659,7 @@
|
||||||
public float getYHeadRot() {
|
public float getYHeadRot() {
|
||||||
return this.yHeadRot;
|
return this.yHeadRot;
|
||||||
}
|
}
|
||||||
@@ -3342,7 +3992,7 @@
|
@@ -3342,7 +4000,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setAbsorptionAmount(float absorptionAmount) {
|
public final void setAbsorptionAmount(float absorptionAmount) {
|
||||||
|
@ -1659,7 +1668,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void internalSetAbsorptionAmount(float absorptionAmount) {
|
protected void internalSetAbsorptionAmount(float absorptionAmount) {
|
||||||
@@ -3410,9 +4060,14 @@
|
@@ -3410,9 +4068,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startUsingItem(InteractionHand hand) {
|
public void startUsingItem(InteractionHand hand) {
|
||||||
|
@ -1675,7 +1684,7 @@
|
||||||
this.useItem = itemstack;
|
this.useItem = itemstack;
|
||||||
this.useItemRemaining = itemstack.getUseDuration(this);
|
this.useItemRemaining = itemstack.getUseDuration(this);
|
||||||
if (!this.level().isClientSide) {
|
if (!this.level().isClientSide) {
|
||||||
@@ -3483,13 +4138,50 @@
|
@@ -3483,13 +4146,50 @@
|
||||||
this.releaseUsingItem();
|
this.releaseUsingItem();
|
||||||
} else {
|
} else {
|
||||||
if (!this.useItem.isEmpty() && this.isUsingItem()) {
|
if (!this.useItem.isEmpty() && this.isUsingItem()) {
|
||||||
|
@ -1727,7 +1736,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3512,6 +4204,7 @@
|
@@ -3512,6 +4212,7 @@
|
||||||
|
|
||||||
public void releaseUsingItem() {
|
public void releaseUsingItem() {
|
||||||
if (!this.useItem.isEmpty()) {
|
if (!this.useItem.isEmpty()) {
|
||||||
|
@ -1735,7 +1744,7 @@
|
||||||
this.useItem.releaseUsing(this.level(), this, this.getUseItemRemainingTicks());
|
this.useItem.releaseUsing(this.level(), this, this.getUseItemRemainingTicks());
|
||||||
if (this.useItem.useOnRelease()) {
|
if (this.useItem.useOnRelease()) {
|
||||||
this.updatingUsingItem();
|
this.updatingUsingItem();
|
||||||
@@ -3544,12 +4237,69 @@
|
@@ -3544,12 +4245,69 @@
|
||||||
if (this.isUsingItem() && !this.useItem.isEmpty()) {
|
if (this.isUsingItem() && !this.useItem.isEmpty()) {
|
||||||
Item item = this.useItem.getItem();
|
Item item = this.useItem.getItem();
|
||||||
|
|
||||||
|
@ -1744,8 +1753,8 @@
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
+ }
|
||||||
|
+
|
||||||
+ // Paper start - Make shield blocking delay configurable
|
+ // Paper start - Make shield blocking delay configurable
|
||||||
+ public HitResult getRayTrace(int maxDistance, ClipContext.Fluid fluidCollisionOption) {
|
+ public HitResult getRayTrace(int maxDistance, ClipContext.Fluid fluidCollisionOption) {
|
||||||
+ if (maxDistance < 1 || maxDistance > 120) {
|
+ if (maxDistance < 1 || maxDistance > 120) {
|
||||||
|
@ -1796,8 +1805,8 @@
|
||||||
+
|
+
|
||||||
+ public int getShieldBlockingDelay() {
|
+ public int getShieldBlockingDelay() {
|
||||||
+ return shieldBlockingDelay;
|
+ return shieldBlockingDelay;
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
+ public void setShieldBlockingDelay(int shieldBlockingDelay) {
|
+ public void setShieldBlockingDelay(int shieldBlockingDelay) {
|
||||||
+ this.shieldBlockingDelay = shieldBlockingDelay;
|
+ this.shieldBlockingDelay = shieldBlockingDelay;
|
||||||
+ }
|
+ }
|
||||||
|
@ -1806,7 +1815,7 @@
|
||||||
public boolean isSuppressingSlidingDownLadder() {
|
public boolean isSuppressingSlidingDownLadder() {
|
||||||
return this.isShiftKeyDown();
|
return this.isShiftKeyDown();
|
||||||
}
|
}
|
||||||
@@ -3568,12 +4318,18 @@
|
@@ -3568,12 +4326,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean randomTeleport(double x, double y, double z, boolean particleEffects) {
|
public boolean randomTeleport(double x, double y, double z, boolean particleEffects) {
|
||||||
|
@ -1827,7 +1836,7 @@
|
||||||
Level world = this.level();
|
Level world = this.level();
|
||||||
|
|
||||||
if (world.hasChunkAt(blockposition)) {
|
if (world.hasChunkAt(blockposition)) {
|
||||||
@@ -3592,18 +4348,43 @@
|
@@ -3592,18 +4356,43 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag2) {
|
if (flag2) {
|
||||||
|
@ -1875,7 +1884,7 @@
|
||||||
world.broadcastEntityEvent(this, (byte) 46);
|
world.broadcastEntityEvent(this, (byte) 46);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3613,7 +4394,7 @@
|
@@ -3613,7 +4402,7 @@
|
||||||
entitycreature.getNavigation().stop();
|
entitycreature.getNavigation().stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1884,7 +1893,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3706,7 +4487,7 @@
|
@@ -3706,7 +4495,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopSleeping() {
|
public void stopSleeping() {
|
||||||
|
@ -1893,7 +1902,7 @@
|
||||||
Level world = this.level();
|
Level world = this.level();
|
||||||
|
|
||||||
java.util.Objects.requireNonNull(world);
|
java.util.Objects.requireNonNull(world);
|
||||||
@@ -3718,9 +4499,9 @@
|
@@ -3718,9 +4507,9 @@
|
||||||
|
|
||||||
this.level().setBlock(blockposition, (BlockState) iblockdata.setValue(BedBlock.OCCUPIED, false), 3);
|
this.level().setBlock(blockposition, (BlockState) iblockdata.setValue(BedBlock.OCCUPIED, false), 3);
|
||||||
Vec3 vec3d = (Vec3) BedBlock.findStandUpPosition(this.getType(), this.level(), blockposition, enumdirection, this.getYRot()).orElseGet(() -> {
|
Vec3 vec3d = (Vec3) BedBlock.findStandUpPosition(this.getType(), this.level(), blockposition, enumdirection, this.getYRot()).orElseGet(() -> {
|
||||||
|
@ -1905,7 +1914,7 @@
|
||||||
});
|
});
|
||||||
Vec3 vec3d1 = Vec3.atBottomCenterOf(blockposition).subtract(vec3d).normalize();
|
Vec3 vec3d1 = Vec3.atBottomCenterOf(blockposition).subtract(vec3d).normalize();
|
||||||
float f = (float) Mth.wrapDegrees(Mth.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
float f = (float) Mth.wrapDegrees(Mth.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||||
@@ -3740,7 +4521,7 @@
|
@@ -3740,7 +4529,7 @@
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Direction getBedOrientation() {
|
public Direction getBedOrientation() {
|
||||||
|
@ -1914,7 +1923,7 @@
|
||||||
|
|
||||||
return blockposition != null ? BedBlock.getBedOrientation(this.level(), blockposition) : null;
|
return blockposition != null ? BedBlock.getBedOrientation(this.level(), blockposition) : null;
|
||||||
}
|
}
|
||||||
@@ -3905,7 +4686,7 @@
|
@@ -3905,7 +4694,7 @@
|
||||||
public float maxUpStep() {
|
public float maxUpStep() {
|
||||||
float f = (float) this.getAttributeValue(Attributes.STEP_HEIGHT);
|
float f = (float) this.getAttributeValue(Attributes.STEP_HEIGHT);
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
if (holder != null) {
|
if (holder != null) {
|
||||||
- this.addEffect(new MobEffectInstance(holder, -1));
|
- this.addEffect(new MobEffectInstance(holder, -1));
|
||||||
+ this.addEffect(new MobEffectInstance(holder, -1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN); // CraftBukkit
|
+ this.addEffect(new MobEffectInstance(holder, -1), null, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN, world instanceof net.minecraft.server.level.ServerLevel); // CraftBukkit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,12 +123,13 @@
|
||||||
|
|
||||||
private static Optional<Entity> createEntityIgnoreException(ServerLevelAccessor world, CompoundTag nbt) {
|
private static Optional<Entity> createEntityIgnoreException(ServerLevelAccessor world, CompoundTag nbt) {
|
||||||
- try {
|
- try {
|
||||||
+ // CraftBukkit start
|
- return EntityType.create(nbt, world.getLevel(), EntitySpawnReason.STRUCTURE);
|
||||||
+ // try {
|
|
||||||
return EntityType.create(nbt, world.getLevel(), EntitySpawnReason.STRUCTURE);
|
|
||||||
- } catch (Exception exception) {
|
- } catch (Exception exception) {
|
||||||
- return Optional.empty();
|
- return Optional.empty();
|
||||||
- }
|
- }
|
||||||
|
+ // CraftBukkit start
|
||||||
|
+ // try {
|
||||||
|
+ return EntityType.create(nbt, world.getLevel(), EntitySpawnReason.STRUCTURE, true); // Paper - Don't fire sync event during generation
|
||||||
+ // } catch (Exception exception) {
|
+ // } catch (Exception exception) {
|
||||||
+ // return Optional.empty();
|
+ // return Optional.empty();
|
||||||
+ // }
|
+ // }
|
||||||
|
|
|
@ -90,15 +90,17 @@ public abstract class DelegatedGeneratorAccess implements WorldGenLevel {
|
||||||
return this.handle.getLevel();
|
return this.handle.getLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// Paper start - Don't fire sync event during generation; don't override these methods so all entities are run through addFreshEntity
|
||||||
public void addFreshEntityWithPassengers(Entity entity) {
|
// @Override
|
||||||
this.handle.addFreshEntityWithPassengers(entity);
|
// public void addFreshEntityWithPassengers(Entity entity) {
|
||||||
}
|
// this.handle.addFreshEntityWithPassengers(entity);
|
||||||
|
// }
|
||||||
@Override
|
//
|
||||||
public void addFreshEntityWithPassengers(Entity entity, CreatureSpawnEvent.SpawnReason reason) {
|
// @Override
|
||||||
this.handle.addFreshEntityWithPassengers(entity, reason);
|
// public void addFreshEntityWithPassengers(Entity entity, CreatureSpawnEvent.SpawnReason reason) {
|
||||||
}
|
// this.handle.addFreshEntityWithPassengers(entity, reason);
|
||||||
|
// }
|
||||||
|
// Paper end - Don't fire sync event during generation; don't override these methods so all entities are run through addFreshEntity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServerLevel getMinecraftWorld() {
|
public ServerLevel getMinecraftWorld() {
|
||||||
|
|
|
@ -39,21 +39,23 @@ public class TransformerGeneratorAccess extends DelegatedGeneratorAccess {
|
||||||
return super.addFreshEntity(arg0, arg1);
|
return super.addFreshEntity(arg0, arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// Paper start - Don't fire sync event during generation; don't override these methods so all entities are run through addFreshEntity
|
||||||
public void addFreshEntityWithPassengers(Entity entity) {
|
// @Override
|
||||||
if (this.structureTransformer != null && !this.structureTransformer.transformEntity(entity)) {
|
// public void addFreshEntityWithPassengers(Entity entity) {
|
||||||
return;
|
// if (this.structureTransformer != null && !this.structureTransformer.transformEntity(entity)) {
|
||||||
}
|
// return;
|
||||||
super.addFreshEntityWithPassengers(entity);
|
// }
|
||||||
}
|
// super.addFreshEntityWithPassengers(entity);
|
||||||
|
// }
|
||||||
@Override
|
//
|
||||||
public void addFreshEntityWithPassengers(Entity arg0, SpawnReason arg1) {
|
// @Override
|
||||||
if (this.structureTransformer != null && !this.structureTransformer.transformEntity(arg0)) {
|
// public void addFreshEntityWithPassengers(Entity arg0, SpawnReason arg1) {
|
||||||
return;
|
// if (this.structureTransformer != null && !this.structureTransformer.transformEntity(arg0)) {
|
||||||
}
|
// return;
|
||||||
super.addFreshEntityWithPassengers(arg0, arg1);
|
// }
|
||||||
}
|
// super.addFreshEntityWithPassengers(arg0, arg1);
|
||||||
|
// }
|
||||||
|
// Paper end - Don't fire sync event during generation; don't override these methods
|
||||||
|
|
||||||
public boolean setCraftBlock(BlockPos position, CraftBlockState craftBlockState, int i, int j) {
|
public boolean setCraftBlock(BlockPos position, CraftBlockState craftBlockState, int i, int j) {
|
||||||
if (this.structureTransformer != null) {
|
if (this.structureTransformer != null) {
|
||||||
|
|
Loading…
Reference in a new issue