mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
788/1053
This commit is contained in:
parent
4ff15b38e5
commit
a0f4d303eb
141 changed files with 180 additions and 322 deletions
|
@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||||
+
|
+
|
||||||
+ private final PortalType portalType;
|
+ private final PortalType portalType;
|
||||||
+ private World targetWorld;
|
+ private final World targetWorld;
|
||||||
+
|
+
|
||||||
+ private boolean cancelled;
|
+ private boolean cancelled;
|
||||||
+
|
+
|
||||||
|
@ -71,9 +71,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * or {@link EntityPortalEvent}.
|
+ * or {@link EntityPortalEvent}.
|
||||||
+ *
|
+ *
|
||||||
+ * @param targetWorld the world
|
+ * @param targetWorld the world
|
||||||
|
+ * @deprecated changing the target world has no effect
|
||||||
+ */
|
+ */
|
||||||
|
+ @Deprecated(forRemoval = true, since = "1.21")
|
||||||
+ public void setTargetWorld(final @Nullable World targetWorld) {
|
+ public void setTargetWorld(final @Nullable World targetWorld) {
|
||||||
+ this.targetWorld = targetWorld;
|
+ // this.targetWorld = targetWorld;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
|
28
patches/server/Add-EntityPortalReadyEvent.patch
Normal file
28
patches/server/Add-EntityPortalReadyEvent.patch
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||||
|
Date: Wed, 12 May 2021 04:30:42 -0700
|
||||||
|
Subject: [PATCH] Add EntityPortalReadyEvent
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
|
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
|
if (this.portalProcess != null) {
|
||||||
|
if (this.portalProcess.processPortalTeleportation(worldserver, this, this.canUsePortal(false))) {
|
||||||
|
worldserver.getProfiler().push("portal");
|
||||||
|
+ // Paper start - Add EntityPortalReadyEvent
|
||||||
|
+ ServerLevel changedTarget = worldserver.getServer().getLevel(worldserver.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER ? Level.OVERWORLD : Level.NETHER);
|
||||||
|
+ if (this.portalProcess.isSamePortal(((net.minecraft.world.level.block.NetherPortalBlock) net.minecraft.world.level.block.Blocks.NETHER_PORTAL))) {
|
||||||
|
+ io.papermc.paper.event.entity.EntityPortalReadyEvent event = new io.papermc.paper.event.entity.EntityPortalReadyEvent(this.getBukkitEntity(), changedTarget == null ? null : changedTarget.getWorld(), org.bukkit.PortalType.NETHER);
|
||||||
|
+ if (!event.callEvent()) {
|
||||||
|
+ this.portalProcess = null;
|
||||||
|
+ worldserver.getProfiler().pop();
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ // Paper end - Add EntityPortalReadyEvent
|
||||||
|
this.setPortalCooldown();
|
||||||
|
DimensionTransition dimensiontransition = this.portalProcess.getPortalDestination(worldserver, this);
|
||||||
|
|
|
@ -27,9 +27,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ public void setInSittingPose(boolean inSittingPose, boolean callEvent) {
|
+ public void setInSittingPose(boolean inSittingPose, boolean callEvent) {
|
||||||
+ if (callEvent && !new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), inSittingPose).callEvent()) return;
|
+ if (callEvent && !new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), inSittingPose).callEvent()) return;
|
||||||
+ // Paper end - Add EntityToggleSitEvent
|
+ // Paper end - Add EntityToggleSitEvent
|
||||||
byte b = this.entityData.get(DATA_FLAGS_ID);
|
byte b0 = (Byte) this.entityData.get(TamableAnimal.DATA_FLAGS_ID);
|
||||||
|
|
||||||
if (inSittingPose) {
|
if (inSittingPose) {
|
||||||
this.entityData.set(DATA_FLAGS_ID, (byte)(b | 1));
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
|
@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -25,6 +25,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ if (playerAttackEntityEvent.callEvent() && willAttack) { // Logic moved to willAttack local variable.
|
+ if (playerAttackEntityEvent.callEvent() && willAttack) { // Logic moved to willAttack local variable.
|
||||||
+ {
|
+ {
|
||||||
+ // Paper end - PlayerAttackEntityEvent
|
+ // Paper end - PlayerAttackEntityEvent
|
||||||
float f = (float) this.getAttributeValue(Attributes.ATTACK_DAMAGE);
|
float f = this.isAutoSpinAttack() ? this.autoSpinAttackDmg : (float) this.getAttributeValue(Attributes.ATTACK_DAMAGE);
|
||||||
float f1 = EnchantmentHelper.getDamageBonus(this.getMainHandItem(), target.getType());
|
ItemStack itemstack = this.getWeaponItem();
|
||||||
float f2 = this.getAttackStrengthScale(0.5F);
|
DamageSource damagesource = this.damageSources().playerAttack(this);
|
|
@ -27,7 +27,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||||
ResourceKey<Level> maindimensionkey = CraftDimensionUtil.getMainDimensionKey(origin);
|
ResourceKey<Level> maindimensionkey = CraftDimensionUtil.getMainDimensionKey(origin);
|
||||||
ResourceKey<Level> maindimensionkey1 = CraftDimensionUtil.getMainDimensionKey(this.level());
|
ResourceKey<Level> maindimensionkey1 = CraftDimensionUtil.getMainDimensionKey(this.level());
|
||||||
|
|
|
@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
} else {
|
} else {
|
||||||
+ // Paper start - Buffer OOB setBlock calls
|
+ // Paper start - Buffer OOB setBlock calls
|
||||||
+ if (!hasSetFarWarned) {
|
+ if (!hasSetFarWarned) {
|
||||||
Util.logAndPauseIfInIde("Detected setBlock in a far chunk [" + i + ", " + j + "], pos: " + String.valueOf(pos) + ", status: " + String.valueOf(this.generatingStatus) + (this.currentlyGenerating == null ? "" : ", currently generating: " + (String) this.currentlyGenerating.get()));
|
Util.logAndPauseIfInIde("Detected setBlock in a far chunk [" + i + ", " + j + "], pos: " + String.valueOf(pos) + ", status: " + String.valueOf(this.generatingStep.targetStatus()) + (this.currentlyGenerating == null ? "" : ", currently generating: " + (String) this.currentlyGenerating.get()));
|
||||||
+ hasSetFarWarned = true;
|
+ hasSetFarWarned = true;
|
||||||
+ if (this.getServer() != null && this.getServer().isDebugging()) {
|
+ if (this.getServer() != null && this.getServer().isDebugging()) {
|
||||||
+ io.papermc.paper.util.TraceUtil.dumpTraceForThread("far setBlock call");
|
+ io.papermc.paper.util.TraceUtil.dumpTraceForThread("far setBlock call");
|
|
@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
protected SculkSensorBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
protected SculkSensorBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||||
super(type, pos, state);
|
super(type, pos, state);
|
||||||
@@ -0,0 +0,0 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList
|
@@ -0,0 +0,0 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList
|
||||||
.resultOrPartial(LOGGER::error)
|
.resultOrPartial(string -> LOGGER.error("Failed to parse vibration listener for Sculk Sensor: '{}'", string))
|
||||||
.ifPresent(listener -> this.vibrationData = listener);
|
.ifPresent(listener -> this.vibrationData = listener);
|
||||||
}
|
}
|
||||||
+ // Paper start - Configurable sculk sensor listener range
|
+ // Paper start - Configurable sculk sensor listener range
|
||||||
|
@ -61,8 +61,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
protected void saveAdditional(CompoundTag nbt, HolderLookup.Provider registryLookup) {
|
protected void saveAdditional(CompoundTag nbt, HolderLookup.Provider registryLookup) {
|
||||||
super.saveAdditional(nbt, registryLookup);
|
super.saveAdditional(nbt, registryLookup);
|
||||||
@@ -0,0 +0,0 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList
|
@@ -0,0 +0,0 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList
|
||||||
.encodeStart(NbtOps.INSTANCE, this.vibrationData)
|
.encodeStart(registryOps, this.vibrationData)
|
||||||
.resultOrPartial(LOGGER::error)
|
.resultOrPartial(string -> LOGGER.error("Failed to encode vibration listener for Sculk Sensor: '{}'", string))
|
||||||
.ifPresent(listenerNbt -> nbt.put("listener", listenerNbt));
|
.ifPresent(listenerNbt -> nbt.put("listener", listenerNbt));
|
||||||
+ this.saveRangeOverride(nbt); // Paper - Configurable sculk sensor listener range
|
+ this.saveRangeOverride(nbt); // Paper - Configurable sculk sensor listener range
|
||||||
+ }
|
+ }
|
|
@ -11,8 +11,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
this.disconnect(Component.translatable("multiplayer.disconnect.invalid_vehicle_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_VEHICLE_MOVEMENT); // Paper - kick event cause
|
this.disconnect((Component) Component.translatable("multiplayer.disconnect.invalid_vehicle_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_VEHICLE_MOVEMENT); // Paper - kick event cause
|
||||||
} else {
|
} else if (!this.updateAwaitingTeleport()) {
|
||||||
Entity entity = this.player.getRootVehicle();
|
Entity entity = this.player.getRootVehicle();
|
||||||
+ // Paper start - Don't allow vehicle movement from players while teleporting
|
+ // Paper start - Don't allow vehicle movement from players while teleporting
|
||||||
+ if (this.awaitingPositionFromClient != null || this.player.isImmobile() || entity.isRemoved()) {
|
+ if (this.awaitingPositionFromClient != null || this.player.isImmobile() || entity.isRemoved()) {
|
|
@ -17,8 +17,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||||
@@ -0,0 +0,0 @@ public class FallingBlockEntity extends Entity {
|
@@ -0,0 +0,0 @@ public class FallingBlockEntity extends Entity {
|
||||||
@Nullable
|
|
||||||
public CompoundTag blockData;
|
public CompoundTag blockData;
|
||||||
|
public boolean forceTickAfterTeleportToDuplicate;
|
||||||
protected static final EntityDataAccessor<BlockPos> DATA_START_POS = SynchedEntityData.defineId(FallingBlockEntity.class, EntityDataSerializers.BLOCK_POS);
|
protected static final EntityDataAccessor<BlockPos> DATA_START_POS = SynchedEntityData.defineId(FallingBlockEntity.class, EntityDataSerializers.BLOCK_POS);
|
||||||
+ public boolean autoExpire = true; // Paper - Expand FallingBlock API
|
+ public boolean autoExpire = true; // Paper - Expand FallingBlock API
|
||||||
|
|
23
patches/server/Expand-PlayerItemDamageEvent.patch
Normal file
23
patches/server/Expand-PlayerItemDamageEvent.patch
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: HexedHero <6012891+HexedHero@users.noreply.github.com>
|
||||||
|
Date: Sun, 10 Apr 2022 06:26:32 +0100
|
||||||
|
Subject: [PATCH] Expand PlayerItemDamageEvent
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||||
|
@@ -0,0 +0,0 @@ public final class ItemStack implements DataComponentHolder {
|
||||||
|
if (this.isDamageableItem()) {
|
||||||
|
if (player == null || !player.hasInfiniteMaterials()) {
|
||||||
|
if (amount > 0) {
|
||||||
|
+ int originalDamage = amount; // Paper - Expand PlayerItemDamageEvent
|
||||||
|
amount = EnchantmentHelper.processDurabilityChange(world, this, amount);
|
||||||
|
// CraftBukkit start
|
||||||
|
if (player instanceof ServerPlayer serverPlayer) { // Paper - Add EntityDamageItemEvent
|
||||||
|
- PlayerItemDamageEvent event = new PlayerItemDamageEvent(serverPlayer.getBukkitEntity(), CraftItemStack.asCraftMirror(this), amount); // Paper - Add EntityDamageItemEvent
|
||||||
|
+ PlayerItemDamageEvent event = new PlayerItemDamageEvent(serverPlayer.getBukkitEntity(), CraftItemStack.asCraftMirror(this), amount, originalDamage); // Paper - Add EntityDamageItemEvent & Expand PlayerItemDamageEvent
|
||||||
|
event.getPlayer().getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (amount != event.getDamage() || event.isCancelled()) {
|
|
@ -187,19 +187,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/CakeBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/CakeBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/CakeBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/CakeBlock.java
|
||||||
@@ -0,0 +0,0 @@ public class CakeBlock extends Block {
|
@@ -0,0 +0,0 @@ public class CakeBlock extends Block {
|
||||||
|
|
||||||
if (block instanceof CandleBlock) {
|
if (block instanceof CandleBlock) {
|
||||||
CandleBlock candleblock = (CandleBlock) block;
|
CandleBlock candleblock = (CandleBlock) block;
|
||||||
-
|
|
||||||
+ // Paper start - call change block event
|
+ // Paper start - call change block event
|
||||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, pos, CandleCakeBlock.byCandle(candleblock))) {
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, pos, CandleCakeBlock.byCandle(candleblock))) {
|
||||||
+ player.containerMenu.sendAllDataToRemote(); // update inv because candle could decrease
|
+ player.containerMenu.sendAllDataToRemote(); // update inv because candle could decrease
|
||||||
+ return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
+ return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - call change block event
|
+ // Paper end - call change block event
|
||||||
if (!player.isCreative()) {
|
stack.consume(1, player);
|
||||||
stack.shrink(1);
|
world.playSound((Player) null, pos, SoundEvents.CAKE_ADD_CANDLE, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||||
}
|
world.setBlockAndUpdate(pos, CandleCakeBlock.byCandle(candleblock));
|
||||||
@@ -0,0 +0,0 @@ public class CakeBlock extends Block {
|
@@ -0,0 +0,0 @@ public class CakeBlock extends Block {
|
||||||
if (!player.canEat(false)) {
|
if (!player.canEat(false)) {
|
||||||
return InteractionResult.PASS;
|
return InteractionResult.PASS;
|
|
@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
}
|
}
|
||||||
// Spigot end
|
// Spigot end
|
||||||
// this.chatSpamTickCount += 20;
|
// this.chatSpamTickCount += 20;
|
||||||
- if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
|
- if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) {
|
||||||
+ if (counted && this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper - exclude from SpigotConfig.spamExclusions
|
+ if (counted && this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) { // Paper - exclude from SpigotConfig.spamExclusions
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause
|
this.disconnect((Component) Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause
|
||||||
}
|
}
|
|
@ -22,9 +22,6 @@ https://bugs.mojang.com/browse/MC-147659
|
||||||
https://bugs.mojang.com/browse/MC-179072
|
https://bugs.mojang.com/browse/MC-179072
|
||||||
Creepers do not defuse when switching from Survival to Creative/Spectator
|
Creepers do not defuse when switching from Survival to Creative/Spectator
|
||||||
|
|
||||||
https://bugs.mojang.com/browse/MC-191591
|
|
||||||
Fix items equipped on AbstractHorse losing NBT
|
|
||||||
|
|
||||||
https://bugs.mojang.com/browse/MC-259571
|
https://bugs.mojang.com/browse/MC-259571
|
||||||
Fix changeGameModeForPlayer to use gameModeForPlayer
|
Fix changeGameModeForPlayer to use gameModeForPlayer
|
||||||
|
|
||||||
|
@ -43,9 +40,6 @@ https://bugs.mojang.com/browse/MC-210802
|
||||||
https://bugs.mojang.com/browse/MC-123848
|
https://bugs.mojang.com/browse/MC-123848
|
||||||
Fixes item frames dropping items above when pointing down
|
Fixes item frames dropping items above when pointing down
|
||||||
|
|
||||||
https://bugs.mojang.com/browse/MC-84789
|
|
||||||
Fix wild wolves not considering bones interesting
|
|
||||||
|
|
||||||
https://bugs.mojang.com/browse/MC-174630
|
https://bugs.mojang.com/browse/MC-174630
|
||||||
Fix secondary beacon effect remaining after switching effect
|
Fix secondary beacon effect remaining after switching effect
|
||||||
|
|
||||||
|
@ -64,19 +58,6 @@ public net/minecraft/world/entity/Mob leashInfoTag
|
||||||
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
|
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||||
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
|
||||||
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
|
||||||
@@ -0,0 +0,0 @@ public interface DispenseItemBehavior {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
|
||||||
- ((Saddleable) list.get(0)).equipSaddle(SoundSource.BLOCKS);
|
|
||||||
+ ((Saddleable) list.get(0)).equipSaddle(SoundSource.BLOCKS, CraftItemStack.asNMSCopy(event.getItem())); // Paper - Fix saddles losing nbt data - MC-191591
|
|
||||||
// itemstack.shrink(1); // CraftBukkit - handled above
|
|
||||||
this.setSuccess(true);
|
|
||||||
return stack;
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/commands/DeOpCommands.java b/src/main/java/net/minecraft/server/commands/DeOpCommands.java
|
diff --git a/src/main/java/net/minecraft/server/commands/DeOpCommands.java b/src/main/java/net/minecraft/server/commands/DeOpCommands.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/commands/DeOpCommands.java
|
--- a/src/main/java/net/minecraft/server/commands/DeOpCommands.java
|
||||||
|
@ -129,27 +110,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
||||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
|
||||||
BlockPos blockposition1 = PlayerRespawnLogic.getOverworldRespawnPos(world, blockposition.getX() + j2 - i, blockposition.getZ() + k2 - i);
|
|
||||||
|
|
||||||
if (blockposition1 != null) {
|
|
||||||
- this.moveTo(blockposition1, 0.0F, 0.0F);
|
|
||||||
+ this.moveTo(blockposition1, world.getSharedSpawnAngle(), 0.0F); // Paper - MC-200092 - fix first spawn pos yaw being ignored
|
|
||||||
if (world.noCollision((Entity) this)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
- this.moveTo(blockposition, 0.0F, 0.0F);
|
|
||||||
+ this.moveTo(blockposition, world.getSharedSpawnAngle(), 0.0F); // Paper - MC-200092 - fix first spawn pos yaw being ignored
|
|
||||||
|
|
||||||
while (!world.noCollision((Entity) this) && this.getY() < (double) (world.getMaxBuildHeight() - 1)) {
|
|
||||||
this.setPos(this.getX(), this.getY() + 1.0D, this.getZ());
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||||
|
@ -167,6 +127,15 @@ diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/ma
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
|
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||||
|
}
|
||||||
|
if (optional.isEmpty() || invalidPlayerWorld[0]) {
|
||||||
|
// Paper end - reset to main world spawn if first spawn or invalid world
|
||||||
|
- player.moveTo(player.adjustSpawnLocation(worldserver1, worldserver1.getSharedSpawnPos()).getBottomCenter(), 0.0F, 0.0F);
|
||||||
|
+ player.moveTo(player.adjustSpawnLocation(worldserver1, worldserver1.getSharedSpawnPos()).getBottomCenter(), worldserver1.getSharedSpawnAngle(), 0.0F); // Paper - MC-200092 - fix first spawn pos yaw being ignored
|
||||||
|
}
|
||||||
|
// Paper end - Entity#getEntitySpawnReason
|
||||||
|
player.setServerLevel(worldserver1);
|
||||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||||
Player player = entity.getBukkitEntity();
|
Player player = entity.getBukkitEntity();
|
||||||
PlayerLoginEvent event = new PlayerLoginEvent(player, loginlistener.connection.hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.connection.channel.remoteAddress()).getAddress());
|
PlayerLoginEvent event = new PlayerLoginEvent(player, loginlistener.connection.hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.connection.channel.remoteAddress()).getAddress());
|
||||||
|
@ -180,35 +149,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
|
|
||||||
ichatmutablecomponent = Component.translatable("multiplayer.disconnect.banned.reason", gameprofilebanentry.getReason());
|
ichatmutablecomponent = Component.translatable("multiplayer.disconnect.banned.reason", gameprofilebanentry.getReason());
|
||||||
if (gameprofilebanentry.getExpires() != null) {
|
if (gameprofilebanentry.getExpires() != null) {
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Saddleable.java b/src/main/java/net/minecraft/world/entity/Saddleable.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Saddleable.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Saddleable.java
|
|
||||||
@@ -0,0 +0,0 @@ public interface Saddleable {
|
|
||||||
boolean isSaddleable();
|
|
||||||
|
|
||||||
void equipSaddle(@Nullable SoundSource sound);
|
|
||||||
+ // Paper start - Fix saddles losing nbt data - MC-191591
|
|
||||||
+ default void equipSaddle(final @Nullable SoundSource sound, final @Nullable net.minecraft.world.item.ItemStack stack) {
|
|
||||||
+ this.equipSaddle(sound);
|
|
||||||
+ }
|
|
||||||
+ // Paper end
|
|
||||||
|
|
||||||
default SoundEvent getSaddleSoundEvent() {
|
|
||||||
return SoundEvents.HORSE_SADDLE;
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/BegGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/BegGoal.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/BegGoal.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/BegGoal.java
|
|
||||||
@@ -0,0 +0,0 @@ public class BegGoal extends Goal {
|
|
||||||
private boolean playerHoldingInteresting(Player player) {
|
|
||||||
for (InteractionHand interactionHand : InteractionHand.values()) {
|
|
||||||
ItemStack itemStack = player.getItemInHand(interactionHand);
|
|
||||||
- if (this.wolf.isTame() && itemStack.is(Items.BONE)) {
|
|
||||||
+ if (!this.wolf.isTame() && itemStack.is(Items.BONE)) { // Paper - Fix MC-84789
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
|
--- a/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
|
||||||
|
@ -275,25 +215,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
this.level().playSound((Player) null, (Entity) this, this.getEatingSound(itemstack), SoundSource.NEUTRAL, 1.0F, Mth.randomBetween(this.level().random, 0.8F, 1.2F));
|
this.level().playSound((Player) null, (Entity) this, this.getEatingSound(itemstack), SoundSource.NEUTRAL, 1.0F, Mth.randomBetween(this.level().random, 0.8F, 1.2F));
|
||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
|
||||||
@@ -0,0 +0,0 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void equipSaddle(@Nullable SoundSource sound) {
|
|
||||||
- this.inventory.setItem(0, new ItemStack(Items.SADDLE));
|
|
||||||
+ // Paper start - Fix saddles losing nbt data - MC-191591
|
|
||||||
+ this.equipSaddle(sound, null);
|
|
||||||
+ }
|
|
||||||
+ @Override
|
|
||||||
+ public void equipSaddle(@Nullable SoundSource sound, @Nullable ItemStack stack) {
|
|
||||||
+ this.inventory.setItem(0, stack != null ? stack : new ItemStack(Items.SADDLE));
|
|
||||||
+ // Paper end
|
|
||||||
}
|
|
||||||
|
|
||||||
public void equipBodyArmor(Player player, ItemStack stack) {
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||||
|
@ -311,8 +232,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
+
|
+
|
||||||
@Nullable
|
@Nullable
|
||||||
public MapId getFramedMapId() {
|
public MapId getFramedMapId(ItemStack itemstack) {
|
||||||
return (MapId) this.getItem().get(DataComponents.MAP_ID);
|
return (MapId) itemstack.get(DataComponents.MAP_ID);
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java b/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java
|
diff --git a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java b/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java
|
--- a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java
|
||||||
|
@ -343,19 +264,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
if (this.paymentSlot.hasItem()) {
|
if (this.paymentSlot.hasItem()) {
|
||||||
// Paper start - Add PlayerChangeBeaconEffectEvent
|
// Paper start - Add PlayerChangeBeaconEffectEvent
|
||||||
io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent event = new io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent((org.bukkit.entity.Player) this.player.player.getBukkitEntity(), convert(primary), convert(secondary), this.access.getLocation().getBlock());
|
io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent event = new io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent((org.bukkit.entity.Player) this.player.player.getBukkitEntity(), convert(primary), convert(secondary), this.access.getLocation().getBlock());
|
||||||
diff --git a/src/main/java/net/minecraft/world/item/SaddleItem.java b/src/main/java/net/minecraft/world/item/SaddleItem.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/item/SaddleItem.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/item/SaddleItem.java
|
|
||||||
@@ -0,0 +0,0 @@ public class SaddleItem extends Item {
|
|
||||||
public InteractionResult interactLivingEntity(ItemStack stack, Player user, LivingEntity entity, InteractionHand hand) {
|
|
||||||
if (entity instanceof Saddleable saddleable && entity.isAlive() && !saddleable.isSaddled() && saddleable.isSaddleable()) {
|
|
||||||
if (!user.level().isClientSide) {
|
|
||||||
- saddleable.equipSaddle(SoundSource.NEUTRAL);
|
|
||||||
+ saddleable.equipSaddle(SoundSource.NEUTRAL, stack.copyWithCount(1)); // Paper - Fix saddles losing nbt data - MC-191591
|
|
||||||
entity.level().gameEvent(entity, GameEvent.EQUIP, entity.position());
|
|
||||||
stack.shrink(1);
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java b/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java b/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java
|
||||||
|
@ -423,3 +331,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
super.setRemoved();
|
super.setRemoved();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/portal/DimensionTransition.java b/src/main/java/net/minecraft/world/level/portal/DimensionTransition.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/portal/DimensionTransition.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/portal/DimensionTransition.java
|
||||||
|
@@ -0,0 +0,0 @@ public record DimensionTransition(ServerLevel newLevel, Vec3 pos, Vec3 speed, fl
|
||||||
|
}
|
||||||
|
|
||||||
|
public DimensionTransition(ServerLevel worldserver, Entity entity, DimensionTransition.PostDimensionTransition dimensiontransition_a, PlayerTeleportEvent.TeleportCause cause) {
|
||||||
|
- this(worldserver, findAdjustedSharedSpawnPos(worldserver, entity), Vec3.ZERO, 0.0F, 0.0F, false, dimensiontransition_a, cause);
|
||||||
|
+ this(worldserver, findAdjustedSharedSpawnPos(worldserver, entity), Vec3.ZERO, worldserver.getSharedSpawnAngle(), 0.0F, false, dimensiontransition_a, cause); // Paper - MC-200092 - fix spawn pos yaw being ignored
|
||||||
|
// CraftBukkit end
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +0,0 @@ public record DimensionTransition(ServerLevel newLevel, Vec3 pos, Vec3 speed, fl
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DimensionTransition missingRespawnBlock(ServerLevel world, Entity entity, DimensionTransition.PostDimensionTransition postDimensionTransition) {
|
||||||
|
- return new DimensionTransition(world, findAdjustedSharedSpawnPos(world, entity), Vec3.ZERO, 0.0F, 0.0F, true, postDimensionTransition);
|
||||||
|
+ return new DimensionTransition(world, findAdjustedSharedSpawnPos(world, entity), Vec3.ZERO, world.getSharedSpawnAngle(), 0.0F, true, postDimensionTransition); // Paper - MC-200092 - fix spawn pos yaw being ignored
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Vec3 findAdjustedSharedSpawnPos(ServerLevel world, Entity entity) {
|
|
@ -15,15 +15,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@@ -0,0 +0,0 @@ public class Zombie extends Monster {
|
@@ -0,0 +0,0 @@ public class Zombie extends Monster {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getExperienceReward() {
|
protected int getBaseExperienceReward() {
|
||||||
+ final int previousReward = this.xpReward; // Paper - store previous value to reset after calculating XP reward
|
+ final int previousReward = this.xpReward; // Paper - store previous value to reset after calculating XP reward
|
||||||
if (this.isBaby()) {
|
if (this.isBaby()) {
|
||||||
this.xpReward = (int) ((double) this.xpReward * 2.5D);
|
this.xpReward = (int) ((double) this.xpReward * 2.5D);
|
||||||
}
|
}
|
||||||
|
|
||||||
- return super.getExperienceReward();
|
- return super.getBaseExperienceReward();
|
||||||
+ // Paper start - store previous value to reset after calculating XP reward
|
+ // Paper start - store previous value to reset after calculating XP reward
|
||||||
+ int reward = super.getExperienceReward();
|
+ int reward = super.getBaseExperienceReward();
|
||||||
+ this.xpReward = previousReward;
|
+ this.xpReward = previousReward;
|
||||||
+ return reward;
|
+ return reward;
|
||||||
+ // Paper end - store previous value to reset after calculating XP reward
|
+ // Paper end - store previous value to reset after calculating XP reward
|
|
@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||||
}
|
this.sendActivePlayerEffects(player);
|
||||||
// Paper start - Fire PlayerJoinEvent when Player is actually ready; move vehicle into method so it can be called above - short circuit around that code
|
// Paper start - Fire PlayerJoinEvent when Player is actually ready; move vehicle into method so it can be called above - short circuit around that code
|
||||||
this.onPlayerJoinFinish(player, worldserver1, s1);
|
this.onPlayerJoinFinish(player, worldserver1, s1);
|
||||||
+ // Paper start - Send empty chunk, so players aren't stuck in the world loading screen with our chunk system not sending chunks when dead
|
+ // Paper start - Send empty chunk, so players aren't stuck in the world loading screen with our chunk system not sending chunks when dead
|
|
@ -23,17 +23,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
|
|
||||||
nbttagcompound.remove("Dimension");
|
nbttagcompound.remove("Dimension");
|
||||||
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
}
|
entity2.restoreFrom(this);
|
||||||
}
|
this.removeAfterChangingDimensions();
|
||||||
|
// CraftBukkit start - Forward the CraftEntity to the new entity
|
||||||
|
- this.getBukkitEntity().setHandle(entity2);
|
||||||
|
- entity2.bukkitEntity = this.getBukkitEntity();
|
||||||
|
+ // this.getBukkitEntity().setHandle(entity2); // Paper - forward CraftEntity in teleport command; moved to Entity#restoreFrom
|
||||||
|
+ // entity2.bukkitEntity = this.getBukkitEntity();
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
- // CraftBukkit start - Forward the CraftEntity to the new entity
|
|
||||||
- this.getBukkitEntity().setHandle(entity);
|
|
||||||
- entity.bukkitEntity = this.getBukkitEntity();
|
|
||||||
- // CraftBukkit end
|
|
||||||
+ // // CraftBukkit start - Forward the CraftEntity to the new entity // Paper - Forward CraftEntity in teleport command; moved to Entity#restoreFrom
|
|
||||||
+ // this.getBukkitEntity().setHandle(entity);
|
|
||||||
+ // entity.bukkitEntity = this.getBukkitEntity();
|
|
||||||
+ // // CraftBukkit end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.removeAfterChangingDimensions();
|
|
|
@ -15,29 +15,41 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||||
@@ -0,0 +0,0 @@ public final class ItemStack implements DataComponentHolder {
|
@@ -0,0 +0,0 @@ public final class ItemStack implements DataComponentHolder {
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
+ // Paper start - ItemStack damage API - split hurtAndBreak to skip pre-checks like creative mode
|
|
||||||
+ this.hurtAndBreakWithoutChecks(amount, entity, slot);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
|
|
||||||
+ public void hurtAndBreakWithoutChecks(int amount, LivingEntity entity, @org.checkerframework.checker.nullness.qual.Nullable EquipmentSlot slot) {
|
|
||||||
+ {
|
|
||||||
+ // Paper end - ItemStack damage API - split hurtAndBreak to skip pre-checks like creative mode
|
|
||||||
RandomSource randomsource = entity.getRandom();
|
|
||||||
ServerPlayer entityplayer;
|
|
||||||
|
|
||||||
|
public void hurtAndBreak(int amount, ServerLevel world, @Nullable LivingEntity player, Consumer<Item> breakCallback) { // Paper - Add EntityDamageItemEvent
|
||||||
|
+ // Paper start - add param to skip infinite mats check
|
||||||
|
+ this.hurtAndBreak(amount, world, player, breakCallback, false);
|
||||||
|
+ }
|
||||||
|
+ public void hurtAndBreak(int amount, ServerLevel world, @Nullable LivingEntity player, Consumer<Item> breakCallback, boolean force) {
|
||||||
|
+ // Paper end - add param to skip infinite mats check
|
||||||
|
if (this.isDamageableItem()) {
|
||||||
|
- if (player == null || !player.hasInfiniteMaterials()) {
|
||||||
|
+ if (player == null || !player.hasInfiniteMaterials() || force) { // Paper
|
||||||
|
if (amount > 0) {
|
||||||
|
int originalDamage = amount; // Paper - Expand PlayerItemDamageEvent
|
||||||
|
amount = EnchantmentHelper.processDurabilityChange(world, this, amount);
|
||||||
@@ -0,0 +0,0 @@ public final class ItemStack implements DataComponentHolder {
|
@@ -0,0 +0,0 @@ public final class ItemStack implements DataComponentHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.hurtAndBreak(amount, randomsource, entity, () -> { // Paper - Add EntityDamageItemEvent
|
public void hurtAndBreak(int amount, LivingEntity entity, EquipmentSlot slot) {
|
||||||
- entity.broadcastBreakEvent(slot);
|
+ // Paper start - add param to skip infinite mats check
|
||||||
+ if (slot != null) entity.broadcastBreakEvent(slot); // Paper - ItemStack damage API - slot is nullable
|
+ this.hurtAndBreak(amount, entity, slot, false);
|
||||||
Item item = this.getItem();
|
+ }
|
||||||
// CraftBukkit start - Check for item breaking
|
+ public void hurtAndBreak(int amount, LivingEntity entity, EquipmentSlot slot, boolean force) {
|
||||||
if (this.count == 1 && entity instanceof net.minecraft.world.entity.player.Player) {
|
+ // Paper end - add param to skip infinite mats check
|
||||||
|
Level world = entity.level();
|
||||||
|
|
||||||
|
if (world instanceof ServerLevel worldserver) {
|
||||||
|
@@ -0,0 +0,0 @@ public final class ItemStack implements DataComponentHolder {
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
entity.onEquippedItemBroken(item, slot);
|
||||||
|
- });
|
||||||
|
+ }, force); // Paper
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
|
@ -49,7 +61,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
+ // Paper start - ItemStack damage API
|
+ // Paper start - ItemStack damage API
|
||||||
+ public void broadcastSlotBreak(final org.bukkit.inventory.EquipmentSlot slot) {
|
+ public void broadcastSlotBreak(final org.bukkit.inventory.EquipmentSlot slot) {
|
||||||
+ this.getHandle().broadcastBreakEvent(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot));
|
+ this.getHandle().level().broadcastEntityEvent(this.getHandle(), net.minecraft.world.entity.LivingEntity.entityEventForEquipmentBreak(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot)));
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
|
@ -87,7 +99,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private void damageItemStack0(final net.minecraft.world.item.ItemStack nmsStack, final int amount, final net.minecraft.world.entity.EquipmentSlot slot) {
|
+ private void damageItemStack0(final net.minecraft.world.item.ItemStack nmsStack, final int amount, final net.minecraft.world.entity.EquipmentSlot slot) {
|
||||||
+ nmsStack.hurtAndBreakWithoutChecks(amount, this.getHandle(), slot);
|
+ nmsStack.hurtAndBreak(amount, this.getHandle(), slot, true);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - ItemStack damage API
|
+ // Paper end - ItemStack damage API
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue