Add EntityMoveEvent

This commit is contained in:
William Blake Galbreath
2020-02-11 21:56:48 -06:00
parent 6f6ed7acb9
commit 48c492c4d1
3 changed files with 128 additions and 103 deletions

View File

@@ -555,10 +555,12 @@
if (!iworlddataserver.isInitialized()) { if (!iworlddataserver.isInitialized()) {
try { try {
@@ -427,30 +717,8 @@ @@ -425,32 +715,10 @@
iworlddataserver.setInitialized(true);
} }
iworlddataserver.setInitialized(true);
- }
-
- this.getPlayerList().addWorldborderListener(worldserver); - this.getPlayerList().addWorldborderListener(worldserver);
- if (this.worldData.getCustomBossEvents() != null) { - if (this.worldData.getCustomBossEvents() != null) {
- this.getCustomBossEvents().load(this.worldData.getCustomBossEvents(), this.registryAccess()); - this.getCustomBossEvents().load(this.worldData.getCustomBossEvents(), this.registryAccess());
@@ -579,8 +581,8 @@
- worldborder.addListener(new BorderChangeListener.DelegateBorderChangeListener(worldserver1.getWorldBorder())); - worldborder.addListener(new BorderChangeListener.DelegateBorderChangeListener(worldserver1.getWorldBorder()));
- this.levels.put(resourcekey1, worldserver1); - this.levels.put(resourcekey1, worldserver1);
- } - }
- } }
-
- worldborder.applySettings(iworlddataserver.getWorldBorder()); - worldborder.applySettings(iworlddataserver.getWorldBorder());
} }
+ // CraftBukkit end + // CraftBukkit end
@@ -1029,7 +1031,7 @@
ObjectArrayList<GameProfile> objectarraylist = new ObjectArrayList(j); ObjectArrayList<GameProfile> objectarraylist = new ObjectArrayList(j);
int k = Mth.nextInt(this.random, 0, list.size() - j); int k = Mth.nextInt(this.random, 0, list.size() - j);
@@ -1154,24 +1611,55 @@ @@ -1154,24 +1611,56 @@
this.getPlayerList().getPlayers().forEach((entityplayer) -> { this.getPlayerList().getPlayers().forEach((entityplayer) -> {
entityplayer.connection.suspendFlushing(); entityplayer.connection.suspendFlushing();
}); });
@@ -1069,6 +1071,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next(); ServerLevel worldserver = (ServerLevel) iterator.next();
+ worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent + worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent
+ worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
gameprofilerfiller.push(() -> { gameprofilerfiller.push(() -> {
String s = String.valueOf(worldserver); String s = String.valueOf(worldserver);
@@ -1085,7 +1088,7 @@
gameprofilerfiller.push("tick"); gameprofilerfiller.push("tick");
@@ -1186,6 +1674,7 @@ @@ -1186,6 +1675,7 @@
gameprofilerfiller.pop(); gameprofilerfiller.pop();
gameprofilerfiller.pop(); gameprofilerfiller.pop();
@@ -1093,7 +1096,7 @@
} }
gameprofilerfiller.popPush("connection"); gameprofilerfiller.popPush("connection");
@@ -1267,6 +1756,22 @@ @@ -1267,6 +1757,22 @@
return (ServerLevel) this.levels.get(key); return (ServerLevel) this.levels.get(key);
} }
@@ -1116,7 +1119,7 @@
public Set<ResourceKey<Level>> levelKeys() { public Set<ResourceKey<Level>> levelKeys() {
return this.levels.keySet(); return this.levels.keySet();
} }
@@ -1296,7 +1801,7 @@ @@ -1296,7 +1802,7 @@
@DontObfuscate @DontObfuscate
public String getServerModName() { public String getServerModName() {
@@ -1125,7 +1128,7 @@
} }
public SystemReport fillSystemReport(SystemReport details) { public SystemReport fillSystemReport(SystemReport details) {
@@ -1347,7 +1852,7 @@ @@ -1347,7 +1853,7 @@
@Override @Override
public void sendSystemMessage(Component message) { public void sendSystemMessage(Component message) {
@@ -1134,7 +1137,7 @@
} }
public KeyPair getKeyPair() { public KeyPair getKeyPair() {
@@ -1385,11 +1890,14 @@ @@ -1385,11 +1891,14 @@
} }
} }
@@ -1154,7 +1157,7 @@
} }
} }
@@ -1403,7 +1911,7 @@ @@ -1403,7 +1912,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next(); ServerLevel worldserver = (ServerLevel) iterator.next();
@@ -1163,7 +1166,7 @@
} }
} }
@@ -1481,10 +1989,20 @@ @@ -1481,10 +1990,20 @@
@Override @Override
public String getMotd() { public String getMotd() {
@@ -1185,7 +1188,7 @@
this.motd = motd; this.motd = motd;
} }
@@ -1507,7 +2025,7 @@ @@ -1507,7 +2026,7 @@
} }
public ServerConnectionListener getConnection() { public ServerConnectionListener getConnection() {
@@ -1194,7 +1197,7 @@
} }
public boolean isReady() { public boolean isReady() {
@@ -1632,13 +2150,19 @@ @@ -1632,13 +2151,19 @@
return this.functionManager; return this.functionManager;
} }
@@ -1216,7 +1219,7 @@
}, this).thenCompose((immutablelist) -> { }, this).thenCompose((immutablelist) -> {
MultiPackResourceManager resourcemanager = new MultiPackResourceManager(PackType.SERVER_DATA, immutablelist); MultiPackResourceManager resourcemanager = new MultiPackResourceManager(PackType.SERVER_DATA, immutablelist);
List<Registry.PendingTags<?>> list = TagLoader.loadTagsForExistingRegistries(resourcemanager, this.registries.compositeAccess()); List<Registry.PendingTags<?>> list = TagLoader.loadTagsForExistingRegistries(resourcemanager, this.registries.compositeAccess());
@@ -1654,6 +2178,7 @@ @@ -1654,6 +2179,7 @@
}).thenAcceptAsync((minecraftserver_reloadableresources) -> { }).thenAcceptAsync((minecraftserver_reloadableresources) -> {
this.resources.close(); this.resources.close();
this.resources = minecraftserver_reloadableresources; this.resources = minecraftserver_reloadableresources;
@@ -1224,7 +1227,7 @@
this.packRepository.setSelected(dataPacks); this.packRepository.setSelected(dataPacks);
WorldDataConfiguration worlddataconfiguration = new WorldDataConfiguration(MinecraftServer.getSelectedPacks(this.packRepository, true), this.worldData.enabledFeatures()); WorldDataConfiguration worlddataconfiguration = new WorldDataConfiguration(MinecraftServer.getSelectedPacks(this.packRepository, true), this.worldData.enabledFeatures());
@@ -1665,6 +2190,8 @@ @@ -1665,6 +2191,8 @@
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary()); this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager); this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager);
this.fuelValues = FuelValues.vanillaBurnTimes(this.registries.compositeAccess(), this.worldData.enabledFeatures()); this.fuelValues = FuelValues.vanillaBurnTimes(this.registries.compositeAccess(), this.worldData.enabledFeatures());
@@ -1233,7 +1236,7 @@
}, this); }, this);
if (this.isSameThread()) { if (this.isSameThread()) {
@@ -1789,13 +2316,14 @@ @@ -1789,13 +2317,14 @@
if (this.isEnforceWhitelist()) { if (this.isEnforceWhitelist()) {
PlayerList playerlist = source.getServer().getPlayerList(); PlayerList playerlist = source.getServer().getPlayerList();
UserWhiteList whitelist = playerlist.getWhiteList(); UserWhiteList whitelist = playerlist.getWhiteList();
@@ -1249,7 +1252,7 @@
entityplayer.connection.disconnect((Component) Component.translatable("multiplayer.disconnect.not_whitelisted")); entityplayer.connection.disconnect((Component) Component.translatable("multiplayer.disconnect.not_whitelisted"));
} }
} }
@@ -1952,7 +2480,7 @@ @@ -1952,7 +2481,7 @@
final List<String> list = Lists.newArrayList(); final List<String> list = Lists.newArrayList();
final GameRules gamerules = this.getGameRules(); final GameRules gamerules = this.getGameRules();
@@ -1258,7 +1261,7 @@
@Override @Override
public <T extends GameRules.Value<T>> void visit(GameRules.Key<T> key, GameRules.Type<T> type) { public <T extends GameRules.Value<T>> void visit(GameRules.Key<T> key, GameRules.Type<T> type) {
list.add(String.format(Locale.ROOT, "%s=%s\n", key.getId(), gamerules.getRule(key))); list.add(String.format(Locale.ROOT, "%s=%s\n", key.getId(), gamerules.getRule(key)));
@@ -2058,7 +2586,7 @@ @@ -2058,7 +2587,7 @@
try { try {
label51: label51:
{ {
@@ -1267,7 +1270,7 @@
try { try {
arraylist = Lists.newArrayList(NativeModuleLister.listModules()); arraylist = Lists.newArrayList(NativeModuleLister.listModules());
@@ -2105,9 +2633,24 @@ @@ -2105,9 +2634,24 @@
if (bufferedwriter != null) { if (bufferedwriter != null) {
bufferedwriter.close(); bufferedwriter.close();
} }
@@ -1292,7 +1295,7 @@
private ProfilerFiller createProfiler() { private ProfilerFiller createProfiler() {
if (this.willStartRecordingMetrics) { if (this.willStartRecordingMetrics) {
this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(Util.timeSource, this.isDedicatedServer()), Util.timeSource, Util.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> { this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(Util.timeSource, this.isDedicatedServer()), Util.timeSource, Util.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> {
@@ -2225,18 +2768,24 @@ @@ -2225,18 +2769,24 @@
} }
public void logChatMessage(Component message, ChatType.Bound params, @Nullable String prefix) { public void logChatMessage(Component message, ChatType.Bound params, @Nullable String prefix) {
@@ -1321,7 +1324,7 @@
} }
public boolean logIPs() { public boolean logIPs() {
@@ -2377,6 +2926,32 @@ @@ -2377,6 +2927,32 @@
} }
public static record ServerResourcePackInfo(UUID id, String url, String hash, boolean isRequired, @Nullable Component prompt) { public static record ServerResourcePackInfo(UUID id, String url, String hash, boolean isRequired, @Nullable Component prompt) {

View File

@@ -61,7 +61,7 @@
private int lastSpawnChunkRadius; private int lastSpawnChunkRadius;
final EntityTickList entityTickList = new EntityTickList(); final EntityTickList entityTickList = new EntityTickList();
public final PersistentEntitySectionManager<Entity> entityManager; public final PersistentEntitySectionManager<Entity> entityManager;
@@ -214,54 +226,203 @@ @@ -214,54 +226,204 @@
private final boolean tickTime; private final boolean tickTime;
private final RandomSequences randomSequences; private final RandomSequences randomSequences;
@@ -79,6 +79,7 @@
+ public final LevelStorageSource.LevelStorageAccess convertable; + public final LevelStorageSource.LevelStorageAccess convertable;
+ 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 LevelChunk getChunkIfLoaded(int x, int z) { + public LevelChunk getChunkIfLoaded(int x, int z) {
+ return this.chunkSource.getChunk(x, z, false); + return this.chunkSource.getChunk(x, z, false);
@@ -132,7 +133,7 @@
+ +
+ int maxBlockX = Mth.floor(axisalignedbb.maxX + 1.0E-7D) + 3; + int maxBlockX = Mth.floor(axisalignedbb.maxX + 1.0E-7D) + 3;
+ int maxBlockZ = Mth.floor(axisalignedbb.maxZ + 1.0E-7D) + 3; + int maxBlockZ = Mth.floor(axisalignedbb.maxZ + 1.0E-7D) + 3;
+
+ int minChunkX = minBlockX >> 4; + int minChunkX = minBlockX >> 4;
+ int minChunkZ = minBlockZ >> 4; + int minChunkZ = minBlockZ >> 4;
+ +
@@ -218,7 +219,7 @@
+ chunkgenerator = new FlatLevelSource(cpf.settings(), worldChunkManager); + chunkgenerator = new FlatLevelSource(cpf.settings(), worldChunkManager);
+ } + }
+ } + }
+
+ if (gen != null) { + if (gen != null) {
+ chunkgenerator = new org.bukkit.craftbukkit.generator.CustomChunkGenerator(this, chunkgenerator, gen); + chunkgenerator = new org.bukkit.craftbukkit.generator.CustomChunkGenerator(this, chunkgenerator, gen);
+ } + }
@@ -289,7 +290,7 @@
/** @deprecated */ /** @deprecated */
@Deprecated @Deprecated
@VisibleForTesting @VisibleForTesting
@@ -305,12 +466,20 @@ @@ -305,12 +467,20 @@
long j; long j;
if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) { if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
@@ -313,7 +314,7 @@
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) { if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
this.resetWeatherCycle(); this.resetWeatherCycle();
} }
@@ -345,7 +514,7 @@ @@ -345,7 +515,7 @@
this.handlingTick = false; this.handlingTick = false;
gameprofilerfiller.pop(); gameprofilerfiller.pop();
@@ -322,7 +323,7 @@
if (flag1) { if (flag1) {
this.resetEmptyTime(); this.resetEmptyTime();
@@ -359,6 +528,7 @@ @@ -359,6 +529,7 @@
gameprofilerfiller.pop(); gameprofilerfiller.pop();
} }
@@ -330,7 +331,7 @@
this.entityTickList.forEach((entity) -> { this.entityTickList.forEach((entity) -> {
if (!entity.isRemoved()) { if (!entity.isRemoved()) {
if (!tickratemanager.isEntityFrozen(entity)) { if (!tickratemanager.isEntityFrozen(entity)) {
@@ -429,7 +599,7 @@ @@ -429,7 +600,7 @@
private void wakeUpAllPlayers() { private void wakeUpAllPlayers() {
this.sleepStatus.removeAllSleepers(); this.sleepStatus.removeAllSleepers();
@@ -339,7 +340,7 @@
entityplayer.stopSleepInBed(false, false); entityplayer.stopSleepInBed(false, false);
}); });
} }
@@ -442,12 +612,12 @@ @@ -442,12 +613,12 @@
ProfilerFiller gameprofilerfiller = Profiler.get(); ProfilerFiller gameprofilerfiller = Profiler.get();
gameprofilerfiller.push("thunder"); gameprofilerfiller.push("thunder");
@@ -354,7 +355,7 @@
if (flag1) { if (flag1) {
SkeletonHorse entityhorseskeleton = (SkeletonHorse) EntityType.SKELETON_HORSE.create(this, EntitySpawnReason.EVENT); SkeletonHorse entityhorseskeleton = (SkeletonHorse) EntityType.SKELETON_HORSE.create(this, EntitySpawnReason.EVENT);
@@ -456,7 +626,7 @@ @@ -456,7 +627,7 @@
entityhorseskeleton.setTrap(true); entityhorseskeleton.setTrap(true);
entityhorseskeleton.setAge(0); entityhorseskeleton.setAge(0);
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ()); entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
@@ -363,7 +364,7 @@
} }
} }
@@ -465,18 +635,20 @@ @@ -465,18 +636,20 @@
if (entitylightning != null) { if (entitylightning != null) {
entitylightning.moveTo(Vec3.atBottomCenterOf(blockposition)); entitylightning.moveTo(Vec3.atBottomCenterOf(blockposition));
entitylightning.setVisualOnly(flag1); entitylightning.setVisualOnly(flag1);
@@ -385,7 +386,7 @@
gameprofilerfiller.popPush("tickBlocks"); gameprofilerfiller.popPush("tickBlocks");
if (randomTickSpeed > 0) { if (randomTickSpeed > 0) {
@@ -521,7 +693,7 @@ @@ -521,7 +694,7 @@
Biome biomebase = (Biome) this.getBiome(blockposition1).value(); Biome biomebase = (Biome) this.getBiome(blockposition1).value();
if (biomebase.shouldFreeze(this, blockposition2)) { if (biomebase.shouldFreeze(this, blockposition2)) {
@@ -394,7 +395,7 @@
} }
if (this.isRaining()) { if (this.isRaining()) {
@@ -537,10 +709,10 @@ @@ -537,10 +710,10 @@
BlockState iblockdata1 = (BlockState) iblockdata.setValue(SnowLayerBlock.LAYERS, j + 1); BlockState iblockdata1 = (BlockState) iblockdata.setValue(SnowLayerBlock.LAYERS, j + 1);
Block.pushEntitiesUp(iblockdata, iblockdata1, this, blockposition1); Block.pushEntitiesUp(iblockdata, iblockdata1, this, blockposition1);
@@ -407,7 +408,7 @@
} }
} }
@@ -701,33 +873,67 @@ @@ -701,33 +874,67 @@
this.rainLevel = Mth.clamp(this.rainLevel, 0.0F, 1.0F); this.rainLevel = Mth.clamp(this.rainLevel, 0.0F, 1.0F);
} }
@@ -483,7 +484,7 @@
} }
public void resetEmptyTime() { public void resetEmptyTime() {
@@ -754,6 +960,13 @@ @@ -754,6 +961,13 @@
} }
public void tickNonPassenger(Entity entity) { public void tickNonPassenger(Entity entity) {
@@ -497,7 +498,7 @@
entity.setOldPosAndRot(); entity.setOldPosAndRot();
ProfilerFiller gameprofilerfiller = Profiler.get(); ProfilerFiller gameprofilerfiller = Profiler.get();
@@ -763,6 +976,7 @@ @@ -763,6 +977,7 @@
}); });
gameprofilerfiller.incrementCounter("tickNonPassenger"); gameprofilerfiller.incrementCounter("tickNonPassenger");
entity.tick(); entity.tick();
@@ -505,7 +506,7 @@
gameprofilerfiller.pop(); gameprofilerfiller.pop();
Iterator iterator = entity.getPassengers().iterator(); Iterator iterator = entity.getPassengers().iterator();
@@ -786,6 +1000,7 @@ @@ -786,6 +1001,7 @@
}); });
gameprofilerfiller.incrementCounter("tickPassenger"); gameprofilerfiller.incrementCounter("tickPassenger");
passenger.rideTick(); passenger.rideTick();
@@ -513,7 +514,7 @@
gameprofilerfiller.pop(); gameprofilerfiller.pop();
Iterator iterator = passenger.getPassengers().iterator(); Iterator iterator = passenger.getPassengers().iterator();
@@ -810,6 +1025,7 @@ @@ -810,6 +1026,7 @@
ServerChunkCache chunkproviderserver = this.getChunkSource(); ServerChunkCache chunkproviderserver = this.getChunkSource();
if (!savingDisabled) { if (!savingDisabled) {
@@ -521,7 +522,7 @@
if (progressListener != null) { if (progressListener != null) {
progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel")); progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel"));
} }
@@ -827,11 +1043,19 @@ @@ -827,11 +1044,19 @@
} }
} }
@@ -542,7 +543,7 @@
} }
DimensionDataStorage worldpersistentdata = this.getChunkSource().getDataStorage(); DimensionDataStorage worldpersistentdata = this.getChunkSource().getDataStorage();
@@ -903,18 +1127,40 @@ @@ -903,18 +1128,40 @@
@Override @Override
public boolean addFreshEntity(Entity entity) { public boolean addFreshEntity(Entity entity) {
@@ -586,7 +587,7 @@
} }
} }
@@ -939,41 +1185,99 @@ @@ -939,41 +1186,99 @@
this.entityManager.addNewEntity(player); this.entityManager.addNewEntity(player);
} }
@@ -691,7 +692,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
ServerPlayer entityplayer = (ServerPlayer) iterator.next(); ServerPlayer entityplayer = (ServerPlayer) iterator.next();
@@ -982,6 +1286,12 @@ @@ -982,6 +1287,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();
@@ -704,7 +705,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 +1340,7 @@ @@ -1030,7 +1341,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) {
@@ -713,7 +714,7 @@
} }
public int getLogicalHeight() { public int getLogicalHeight() {
@@ -1060,7 +1370,18 @@ @@ -1060,7 +1371,18 @@
Iterator iterator = this.navigatingMobs.iterator(); Iterator iterator = this.navigatingMobs.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -733,7 +734,7 @@
PathNavigation navigationabstract = entityinsentient.getNavigation(); PathNavigation navigationabstract = entityinsentient.getNavigation();
if (navigationabstract.shouldRecomputePath(pos)) { if (navigationabstract.shouldRecomputePath(pos)) {
@@ -1086,11 +1407,13 @@ @@ -1086,11 +1408,13 @@
@Override @Override
public void updateNeighborsAt(BlockPos pos, Block block) { public void updateNeighborsAt(BlockPos pos, Block block) {
@@ -747,7 +748,7 @@
this.neighborUpdater.updateNeighborsAtExceptFromFacing(pos, sourceBlock, (Direction) null, orientation); this.neighborUpdater.updateNeighborsAtExceptFromFacing(pos, sourceBlock, (Direction) null, orientation);
} }
@@ -1126,9 +1449,20 @@ @@ -1126,9 +1450,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) {
@@ -769,7 +770,7 @@
case NONE: case NONE:
explosion_effect = Explosion.BlockInteraction.KEEP; explosion_effect = Explosion.BlockInteraction.KEEP;
break; break;
@@ -1144,16 +1478,27 @@ @@ -1144,16 +1479,27 @@
case TRIGGER: case TRIGGER:
explosion_effect = Explosion.BlockInteraction.TRIGGER_BLOCK; explosion_effect = Explosion.BlockInteraction.TRIGGER_BLOCK;
break; break;
@@ -800,7 +801,7 @@
Iterator iterator = this.players.iterator(); Iterator iterator = this.players.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -1162,10 +1507,11 @@ @@ -1162,10 +1508,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));
@@ -813,7 +814,7 @@
} }
private Explosion.BlockInteraction getDestroyType(GameRules.Key<GameRules.BooleanValue> decayRule) { private Explosion.BlockInteraction getDestroyType(GameRules.Key<GameRules.BooleanValue> decayRule) {
@@ -1226,17 +1572,29 @@ @@ -1226,17 +1573,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) {
@@ -848,7 +849,7 @@
++j; ++j;
} }
} }
@@ -1292,7 +1650,7 @@ @@ -1292,7 +1651,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) {
@@ -857,7 +858,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 +1692,22 @@ @@ -1334,11 +1693,22 @@
@Nullable @Nullable
@Override @Override
public MapItemSavedData getMapData(MapId id) { public MapItemSavedData getMapData(MapId id) {
@@ -881,7 +882,7 @@
this.getServer().overworld().getDataStorage().set(id.key(), state); this.getServer().overworld().getDataStorage().set(id.key(), state);
} }
@@ -1352,7 +1721,9 @@ @@ -1352,7 +1722,9 @@
float f1 = this.levelData.getSpawnAngle(); float f1 = this.levelData.getSpawnAngle();
if (!blockposition1.equals(pos) || f1 != angle) { if (!blockposition1.equals(pos) || f1 != angle) {
@@ -891,7 +892,7 @@
this.getServer().getPlayerList().broadcastAll(new ClientboundSetDefaultSpawnPositionPacket(pos, angle)); this.getServer().getPlayerList().broadcastAll(new ClientboundSetDefaultSpawnPositionPacket(pos, angle));
} }
@@ -1419,6 +1790,11 @@ @@ -1419,6 +1791,11 @@
}); });
optional1.ifPresent((holder) -> { optional1.ifPresent((holder) -> {
this.getServer().execute(() -> { this.getServer().execute(() -> {
@@ -903,7 +904,7 @@
this.getPoiManager().add(blockposition1, holder); this.getPoiManager().add(blockposition1, holder);
DebugPackets.sendPoiAddedPacket(this, blockposition1); DebugPackets.sendPoiAddedPacket(this, blockposition1);
}); });
@@ -1649,6 +2025,11 @@ @@ -1649,6 +2026,11 @@
@Override @Override
public void blockUpdated(BlockPos pos, Block block) { public void blockUpdated(BlockPos pos, Block block) {
if (!this.isDebug()) { if (!this.isDebug()) {
@@ -915,7 +916,7 @@
this.updateNeighborsAt(pos, block); this.updateNeighborsAt(pos, block);
} }
@@ -1668,12 +2049,12 @@ @@ -1668,12 +2050,12 @@
} }
public boolean isFlat() { public boolean isFlat() {
@@ -930,7 +931,7 @@
} }
@Nullable @Nullable
@@ -1696,7 +2077,7 @@ @@ -1696,7 +2078,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();
@@ -939,7 +940,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
T t0 = iterator.next(); T t0 = iterator.next();
@@ -1705,7 +2086,7 @@ @@ -1705,7 +2087,7 @@
object2intopenhashmap.addTo(s, 1); object2intopenhashmap.addTo(s, 1);
} }
@@ -948,7 +949,7 @@
String s1 = (String) entry.getKey(); String s1 = (String) entry.getKey();
return s1 + ":" + entry.getIntValue(); return s1 + ":" + entry.getIntValue();
@@ -1717,6 +2098,7 @@ @@ -1717,6 +2099,7 @@
@Override @Override
public LevelEntityGetter<Entity> getEntities() { public LevelEntityGetter<Entity> getEntities() {
@@ -956,7 +957,7 @@
return this.entityManager.getEntityGetter(); return this.entityManager.getEntityGetter();
} }
@@ -1802,6 +2184,17 @@ @@ -1802,6 +2185,17 @@
return this.serverLevelData.getGameRules(); return this.serverLevelData.getGameRules();
} }
@@ -974,7 +975,7 @@
@Override @Override
public CrashReportCategory fillReportDetails(CrashReport report) { public CrashReportCategory fillReportDetails(CrashReport report) {
CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report); CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report);
@@ -1836,7 +2229,8 @@ @@ -1836,7 +2230,8 @@
} }
public void onTrackingStart(Entity entity) { public void onTrackingStart(Entity entity) {
@@ -984,7 +985,7 @@
if (entity instanceof ServerPlayer entityplayer) { if (entity instanceof ServerPlayer entityplayer) {
ServerLevel.this.players.add(entityplayer); ServerLevel.this.players.add(entityplayer);
ServerLevel.this.updateSleepingPlayerList(); ServerLevel.this.updateSleepingPlayerList();
@@ -1864,9 +2258,53 @@ @@ -1864,9 +2259,53 @@
} }
entity.updateDynamicGameEventListener(DynamicGameEventListener::add); entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
@@ -1038,7 +1039,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);
@@ -1895,6 +2333,15 @@ @@ -1895,6 +2334,15 @@
} }
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove); entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);

View File

@@ -66,7 +66,7 @@
public int lastHurtByPlayerTime; public int lastHurtByPlayerTime;
protected boolean dead; protected boolean dead;
protected int noActionTime; protected int noActionTime;
@@ -260,6 +285,28 @@ @@ -260,7 +285,29 @@
protected boolean skipDropExperience; protected boolean skipDropExperience;
private final EnumMap<EquipmentSlot, Reference2ObjectMap<Enchantment, Set<EnchantmentLocationBasedEffect>>> activeLocationDependentEnchantments; private final EnumMap<EquipmentSlot, Reference2ObjectMap<Enchantment, Set<EnchantmentLocationBasedEffect>>> activeLocationDependentEnchantments;
protected float appliedScale; protected float appliedScale;
@@ -79,7 +79,7 @@
+ public boolean bukkitPickUpLoot; + public boolean bukkitPickUpLoot;
+ public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper + public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper
+ public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event + public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event
+
+ @Override + @Override
+ public float getBukkitYaw() { + public float getBukkitYaw() {
+ return this.getYHeadRot(); + return this.getYHeadRot();
@@ -92,9 +92,10 @@
+ ++this.noActionTime; // Above all the floats + ++this.noActionTime; // Above all the floats
+ } + }
+ // Spigot end + // Spigot end
+
protected LivingEntity(EntityType<? extends LivingEntity> type, Level world) { protected LivingEntity(EntityType<? extends LivingEntity> type, Level world) {
super(type, world); super(type, world);
this.lastHandItemStacks = NonNullList.withSize(2, ItemStack.EMPTY);
@@ -276,7 +323,9 @@ @@ -276,7 +323,9 @@
this.activeLocationDependentEnchantments = new EnumMap(EquipmentSlot.class); this.activeLocationDependentEnchantments = new EnumMap(EquipmentSlot.class);
this.appliedScale = 1.0F; this.appliedScale = 1.0F;
@@ -442,7 +443,7 @@
return flag; return flag;
} }
} }
@@ -1031,14 +1208,40 @@ @@ -1031,13 +1208,39 @@
return this.getType().is(EntityTypeTags.INVERTED_HEALING_AND_HARM); return this.getType().is(EntityTypeTags.INVERTED_HEALING_AND_HARM);
} }
@@ -477,14 +478,13 @@
- MobEffectInstance mobeffect = this.removeEffectNoUpdate(effect); - MobEffectInstance mobeffect = this.removeEffectNoUpdate(effect);
+ return this.removeEffect(effect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.UNKNOWN); + return this.removeEffect(effect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.UNKNOWN);
+ } + }
+
+ public boolean removeEffect(Holder<MobEffect> holder, EntityPotionEffectEvent.Cause cause) { + public boolean removeEffect(Holder<MobEffect> holder, EntityPotionEffectEvent.Cause cause) {
+ MobEffectInstance mobeffect = this.removeEffectNoUpdate(holder, cause); + MobEffectInstance mobeffect = this.removeEffectNoUpdate(holder, cause);
+ // CraftBukkit end + // CraftBukkit end
+
if (mobeffect != null) { if (mobeffect != null) {
this.onEffectsRemoved(List.of(mobeffect)); this.onEffectsRemoved(List.of(mobeffect));
return true;
@@ -1142,20 +1345,65 @@ @@ -1142,20 +1345,65 @@
} }
@@ -1236,27 +1236,26 @@
} }
public CombatTracker getCombatTracker() { public CombatTracker getCombatTracker() {
@@ -1935,9 +2502,19 @@ @@ -1935,8 +2502,18 @@
} }
public final void setArrowCount(int stuckArrowCount) { public final void setArrowCount(int stuckArrowCount) {
- this.entityData.set(LivingEntity.DATA_ARROW_COUNT_ID, stuckArrowCount); - this.entityData.set(LivingEntity.DATA_ARROW_COUNT_ID, stuckArrowCount);
+ // CraftBukkit start + // CraftBukkit start
+ this.setArrowCount(stuckArrowCount, false); + this.setArrowCount(stuckArrowCount, false);
} + }
+
+ public final void setArrowCount(int i, boolean flag) { + public final void setArrowCount(int i, boolean flag) {
+ ArrowBodyCountChangeEvent event = CraftEventFactory.callArrowBodyCountChangeEvent(this, this.getArrowCount(), i, flag); + ArrowBodyCountChangeEvent event = CraftEventFactory.callArrowBodyCountChangeEvent(this, this.getArrowCount(), i, flag);
+ if (event.isCancelled()) { + if (event.isCancelled()) {
+ return; + return;
+ } + }
+ this.entityData.set(LivingEntity.DATA_ARROW_COUNT_ID, event.getNewAmount()); + this.entityData.set(LivingEntity.DATA_ARROW_COUNT_ID, event.getNewAmount());
+ } }
+ // CraftBukkit end + // CraftBukkit end
+
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 +2576,7 @@ @@ -1999,7 +2576,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);
} }
@@ -1266,19 +1265,19 @@
this.setHealth(0.0F); this.setHealth(0.0F);
this.die(this.damageSources().generic()); this.die(this.damageSources().generic());
} }
@@ -2181,6 +2758,12 @@ @@ -2182,6 +2759,12 @@
public abstract Iterable<ItemStack> getArmorSlots();
public abstract ItemStack getItemBySlot(EquipmentSlot slot); public abstract ItemStack getItemBySlot(EquipmentSlot slot);
+
+ // CraftBukkit start + // CraftBukkit start
+ public void setItemSlot(EquipmentSlot enumitemslot, ItemStack itemstack, boolean silent) { + public void setItemSlot(EquipmentSlot enumitemslot, ItemStack itemstack, boolean silent) {
+ this.setItemSlot(enumitemslot, itemstack); + this.setItemSlot(enumitemslot, itemstack);
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+
public abstract void setItemSlot(EquipmentSlot slot, ItemStack stack); public abstract void setItemSlot(EquipmentSlot slot, ItemStack stack);
public Iterable<ItemStack> getHandSlots() {
@@ -2494,7 +3077,7 @@ @@ -2494,7 +3077,7 @@
} }
@@ -1381,7 +1380,28 @@
if (this.isAlive()) { if (this.isAlive()) {
this.travelRidden(entityhuman, vec3d1); this.travelRidden(entityhuman, vec3d1);
break label112; break label112;
@@ -3063,6 +3655,7 @@ @@ -3046,6 +3638,20 @@
this.pushEntities();
gameprofilerfiller.pop();
+ // Paper start - Add EntityMoveEvent
+ if (((ServerLevel) this.level()).hasEntityMoveEvent && !(this instanceof net.minecraft.world.entity.player.Player)) {
+ if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) {
+ Location from = new Location(this.level().getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO);
+ Location to = new Location(this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
+ io.papermc.paper.event.entity.EntityMoveEvent event = new io.papermc.paper.event.entity.EntityMoveEvent(this.getBukkitLivingEntity(), from, to.clone());
+ if (!event.callEvent()) {
+ this.absMoveTo(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch());
+ } else if (!to.equals(event.getTo())) {
+ this.absMoveTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch());
+ }
+ }
+ }
+ // Paper end - Add EntityMoveEvent
world = this.level();
if (world instanceof ServerLevel worldserver) {
if (this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
@@ -3063,6 +3669,7 @@
this.checkSlowFallDistance(); this.checkSlowFallDistance();
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
if (!this.canGlide()) { if (!this.canGlide()) {
@@ -1389,7 +1409,7 @@
this.setSharedFlag(7, false); this.setSharedFlag(7, false);
return; return;
} }
@@ -3113,12 +3706,26 @@ @@ -3113,12 +3720,26 @@
Level world = this.level(); Level world = this.level();
if (!(world instanceof ServerLevel worldserver)) { if (!(world instanceof ServerLevel worldserver)) {
@@ -1419,7 +1439,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 +3745,12 @@ @@ -3138,10 +3759,12 @@
} }
Iterator iterator1 = list.iterator(); Iterator iterator1 = list.iterator();
@@ -1434,7 +1454,7 @@
this.doPush(entity1); this.doPush(entity1);
} }
} }
@@ -3190,10 +3799,16 @@ @@ -3190,10 +3813,16 @@
@Override @Override
public void stopRiding() { public void stopRiding() {
@@ -1453,7 +1473,7 @@
this.dismountVehicle(entity); this.dismountVehicle(entity);
} }
@@ -3305,15 +3920,29 @@ @@ -3305,15 +3934,29 @@
@Override @Override
public boolean isPickable() { public boolean isPickable() {
@@ -1485,7 +1505,7 @@
public float getYHeadRot() { public float getYHeadRot() {
return this.yHeadRot; return this.yHeadRot;
} }
@@ -3342,7 +3971,7 @@ @@ -3342,7 +3985,7 @@
} }
public final void setAbsorptionAmount(float absorptionAmount) { public final void setAbsorptionAmount(float absorptionAmount) {
@@ -1494,7 +1514,7 @@
} }
protected void internalSetAbsorptionAmount(float absorptionAmount) { protected void internalSetAbsorptionAmount(float absorptionAmount) {
@@ -3410,9 +4039,14 @@ @@ -3410,9 +4053,14 @@
} }
public void startUsingItem(InteractionHand hand) { public void startUsingItem(InteractionHand hand) {
@@ -1510,7 +1530,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 +4117,49 @@ @@ -3483,13 +4131,49 @@
this.releaseUsingItem(); this.releaseUsingItem();
} else { } else {
if (!this.useItem.isEmpty() && this.isUsingItem()) { if (!this.useItem.isEmpty() && this.isUsingItem()) {
@@ -1524,7 +1544,7 @@
+ org.bukkit.inventory.EquipmentSlot hand = org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(enumhand); + org.bukkit.inventory.EquipmentSlot hand = org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(enumhand);
+ event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem, hand); // Paper + event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem, hand); // Paper
+ this.level().getCraftServer().getPluginManager().callEvent(event); + this.level().getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) { + if (event.isCancelled()) {
+ // Update client + // Update client
+ Consumable consumable = this.useItem.get(DataComponents.CONSUMABLE); + Consumable consumable = this.useItem.get(DataComponents.CONSUMABLE);
@@ -1547,7 +1567,7 @@
+ } + }
+ // Paper end + // Paper end
+ // CraftBukkit end + // CraftBukkit end
+
if (itemstack != this.useItem) { if (itemstack != this.useItem) {
this.setItemInHand(enumhand, itemstack); this.setItemInHand(enumhand, itemstack);
} }
@@ -1561,7 +1581,7 @@
} }
} }
@@ -3544,11 +4214,68 @@ @@ -3544,12 +4228,69 @@
if (this.isUsingItem() && !this.useItem.isEmpty()) { if (this.isUsingItem() && !this.useItem.isEmpty()) {
Item item = this.useItem.getItem(); Item item = this.useItem.getItem();
@@ -1571,7 +1591,7 @@
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) {
@@ -1628,10 +1648,11 @@
+ this.shieldBlockingDelay = shieldBlockingDelay; + this.shieldBlockingDelay = shieldBlockingDelay;
+ } + }
+ // Paper end - Make shield blocking delay configurable + // Paper end - Make shield blocking delay configurable
+
public boolean isSuppressingSlidingDownLadder() { public boolean isSuppressingSlidingDownLadder() {
return this.isShiftKeyDown(); return this.isShiftKeyDown();
@@ -3568,12 +4295,18 @@ }
@@ -3568,12 +4309,18 @@
} }
public boolean randomTeleport(double x, double y, double z, boolean particleEffects) { public boolean randomTeleport(double x, double y, double z, boolean particleEffects) {
@@ -1652,7 +1673,7 @@
Level world = this.level(); Level world = this.level();
if (world.hasChunkAt(blockposition)) { if (world.hasChunkAt(blockposition)) {
@@ -3592,18 +4325,43 @@ @@ -3592,18 +4339,43 @@
} }
if (flag2) { if (flag2) {
@@ -1664,7 +1685,7 @@
+ this.setPos(d0, d6, d2); + this.setPos(d0, d6, d2);
if (world.noCollision((Entity) this) && !world.containsAnyLiquid(this.getBoundingBox())) { if (world.noCollision((Entity) this) && !world.containsAnyLiquid(this.getBoundingBox())) {
flag1 = true; flag1 = true;
} + }
+ // now revert and call event if the teleport place is valid + // now revert and call event if the teleport place is valid
+ this.setPos(d3, d4, d5); + this.setPos(d3, d4, d5);
+ +
@@ -1684,7 +1705,7 @@
+ return Optional.empty(); + return Optional.empty();
+ } + }
+ } + }
+ } }
+ // CraftBukkit end + // CraftBukkit end
} }
} }
@@ -1700,7 +1721,7 @@
world.broadcastEntityEvent(this, (byte) 46); world.broadcastEntityEvent(this, (byte) 46);
} }
@@ -3613,7 +4371,7 @@ @@ -3613,7 +4385,7 @@
entitycreature.getNavigation().stop(); entitycreature.getNavigation().stop();
} }
@@ -1709,7 +1730,7 @@
} }
} }
@@ -3706,7 +4464,7 @@ @@ -3706,7 +4478,7 @@
} }
public void stopSleeping() { public void stopSleeping() {
@@ -1718,7 +1739,7 @@
Level world = this.level(); Level world = this.level();
java.util.Objects.requireNonNull(world); java.util.Objects.requireNonNull(world);
@@ -3718,9 +4476,9 @@ @@ -3718,9 +4490,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(() -> {
@@ -1730,7 +1751,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 +4498,7 @@ @@ -3740,7 +4512,7 @@
@Nullable @Nullable
public Direction getBedOrientation() { public Direction getBedOrientation() {
@@ -1739,7 +1760,7 @@
return blockposition != null ? BedBlock.getBedOrientation(this.level(), blockposition) : null; return blockposition != null ? BedBlock.getBedOrientation(this.level(), blockposition) : null;
} }
@@ -3905,7 +4663,7 @@ @@ -3905,7 +4677,7 @@
public float maxUpStep() { public float maxUpStep() {
float f = (float) this.getAttributeValue(Attributes.STEP_HEIGHT); float f = (float) this.getAttributeValue(Attributes.STEP_HEIGHT);