mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Fix cancelling BlockPlaceEvent calling onRemove
This commit is contained in:
parent
acdfeeea3d
commit
276e09c3b0
3 changed files with 55 additions and 56 deletions
|
@ -152,7 +152,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -370,32 +418,198 @@
|
@@ -370,32 +418,200 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public InteractionResult useOn(UseOnContext context) {
|
public InteractionResult useOn(UseOnContext context) {
|
||||||
|
@ -169,7 +169,7 @@
|
||||||
+ DataComponentPatch oldData = this.components.asPatch();
|
+ DataComponentPatch oldData = this.components.asPatch();
|
||||||
+ int oldCount = this.getCount();
|
+ int oldCount = this.getCount();
|
||||||
+ ServerLevel world = (ServerLevel) context.getLevel();
|
+ ServerLevel world = (ServerLevel) context.getLevel();
|
||||||
+
|
|
||||||
+ if (!(item instanceof BucketItem/* || item instanceof SolidBucketItem*/)) { // if not bucket // Paper - Fix cancelled powdered snow bucket placement
|
+ if (!(item instanceof BucketItem/* || item instanceof SolidBucketItem*/)) { // if not bucket // Paper - Fix cancelled powdered snow bucket placement
|
||||||
+ world.captureBlockStates = true;
|
+ world.captureBlockStates = true;
|
||||||
+ // special case bonemeal
|
+ // special case bonemeal
|
||||||
|
@ -200,7 +200,7 @@
|
||||||
+ structureEvent = new StructureGrowEvent(location, treeType, isBonemeal, (Player) entityhuman.getBukkitEntity(), (List< BlockState>) (List<? extends BlockState>) blocks);
|
+ structureEvent = new StructureGrowEvent(location, treeType, isBonemeal, (Player) entityhuman.getBukkitEntity(), (List< BlockState>) (List<? extends BlockState>) blocks);
|
||||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(structureEvent);
|
+ org.bukkit.Bukkit.getPluginManager().callEvent(structureEvent);
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
+ BlockFertilizeEvent fertilizeEvent = new BlockFertilizeEvent(CraftBlock.at(world, blockposition), (Player) entityhuman.getBukkitEntity(), (List< BlockState>) (List<? extends BlockState>) blocks);
|
+ BlockFertilizeEvent fertilizeEvent = new BlockFertilizeEvent(CraftBlock.at(world, blockposition), (Player) entityhuman.getBukkitEntity(), (List< BlockState>) (List<? extends BlockState>) blocks);
|
||||||
+ fertilizeEvent.setCancelled(structureEvent != null && structureEvent.isCancelled());
|
+ fertilizeEvent.setCancelled(structureEvent != null && structureEvent.isCancelled());
|
||||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(fertilizeEvent);
|
+ org.bukkit.Bukkit.getPluginManager().callEvent(fertilizeEvent);
|
||||||
|
@ -246,9 +246,11 @@
|
||||||
+ world.capturedTileEntities.clear(); // Paper - Allow chests to be placed with NBT data; clear out block entities as chests and such will pop loot
|
+ world.capturedTileEntities.clear(); // Paper - Allow chests to be placed with NBT data; clear out block entities as chests and such will pop loot
|
||||||
+ // revert back all captured blocks
|
+ // revert back all captured blocks
|
||||||
+ world.preventPoiUpdated = true; // CraftBukkit - SPIGOT-5710
|
+ world.preventPoiUpdated = true; // CraftBukkit - SPIGOT-5710
|
||||||
|
+ world.isBlockPlaceCancelled = true; // Paper - prevent calling cleanup logic when undoing a block place upon a cancelled BlockPlaceEvent
|
||||||
+ for (BlockState blockstate : blocks) {
|
+ for (BlockState blockstate : blocks) {
|
||||||
+ blockstate.update(true, false);
|
+ blockstate.update(true, false);
|
||||||
+ }
|
+ }
|
||||||
|
+ world.isBlockPlaceCancelled = false; // Paper - prevent calling cleanup logic when undoing a block place upon a cancelled BlockPlaceEvent
|
||||||
+ world.preventPoiUpdated = false;
|
+ world.preventPoiUpdated = false;
|
||||||
+
|
+
|
||||||
+ // Brute force all possible updates
|
+ // Brute force all possible updates
|
||||||
|
@ -356,7 +358,7 @@
|
||||||
ItemStack itemstack = this.copy();
|
ItemStack itemstack = this.copy();
|
||||||
boolean flag = this.getUseDuration(user) <= 0;
|
boolean flag = this.getUseDuration(user) <= 0;
|
||||||
InteractionResult enuminteractionresult = this.getItem().use(world, user, hand);
|
InteractionResult enuminteractionresult = this.getItem().use(world, user, hand);
|
||||||
@@ -490,27 +704,66 @@
|
@@ -490,27 +706,66 @@
|
||||||
return this.isDamageableItem() && this.getDamageValue() >= this.getMaxDamage() - 1;
|
return this.isDamageableItem() && this.getDamageValue() >= this.getMaxDamage() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,7 +432,7 @@
|
||||||
|
|
||||||
this.shrink(1);
|
this.shrink(1);
|
||||||
breakCallback.accept(item);
|
breakCallback.accept(item);
|
||||||
@@ -518,7 +771,7 @@
|
@@ -518,7 +773,7 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,7 +441,7 @@
|
||||||
if (player instanceof ServerPlayer entityplayer) {
|
if (player instanceof ServerPlayer entityplayer) {
|
||||||
int j = this.processDurabilityChange(amount, entityplayer.serverLevel(), entityplayer);
|
int j = this.processDurabilityChange(amount, entityplayer.serverLevel(), entityplayer);
|
||||||
|
|
||||||
@@ -535,6 +788,11 @@
|
@@ -535,6 +790,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hurtAndBreak(int amount, LivingEntity entity, EquipmentSlot slot) {
|
public void hurtAndBreak(int amount, LivingEntity entity, EquipmentSlot slot) {
|
||||||
|
@ -451,7 +453,7 @@
|
||||||
Level world = entity.level();
|
Level world = entity.level();
|
||||||
|
|
||||||
if (world instanceof ServerLevel worldserver) {
|
if (world instanceof ServerLevel worldserver) {
|
||||||
@@ -546,9 +804,9 @@
|
@@ -546,9 +806,9 @@
|
||||||
entityplayer = null;
|
entityplayer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,7 +466,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -580,11 +838,11 @@
|
@@ -580,11 +840,11 @@
|
||||||
return this.getItem().getBarColor(this);
|
return this.getItem().getBarColor(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,7 +480,7 @@
|
||||||
return this.getItem().overrideOtherStackedOnMe(this, stack, slot, clickType, player, cursorStackReference);
|
return this.getItem().overrideOtherStackedOnMe(this, stack, slot, clickType, player, cursorStackReference);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -592,8 +850,8 @@
|
@@ -592,8 +852,8 @@
|
||||||
Item item = this.getItem();
|
Item item = this.getItem();
|
||||||
|
|
||||||
if (item.hurtEnemy(this, target, user)) {
|
if (item.hurtEnemy(this, target, user)) {
|
||||||
|
@ -489,7 +491,7 @@
|
||||||
|
|
||||||
entityhuman.awardStat(Stats.ITEM_USED.get(item));
|
entityhuman.awardStat(Stats.ITEM_USED.get(item));
|
||||||
}
|
}
|
||||||
@@ -608,7 +866,7 @@
|
@@ -608,7 +868,7 @@
|
||||||
this.getItem().postHurtEnemy(this, target, user);
|
this.getItem().postHurtEnemy(this, target, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,7 +500,7 @@
|
||||||
Item item = this.getItem();
|
Item item = this.getItem();
|
||||||
|
|
||||||
if (item.mineBlock(this, world, state, pos, miner)) {
|
if (item.mineBlock(this, world, state, pos, miner)) {
|
||||||
@@ -617,11 +875,11 @@
|
@@ -617,11 +877,11 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,7 +514,7 @@
|
||||||
return this.getItem().interactLivingEntity(this, user, entity, hand);
|
return this.getItem().interactLivingEntity(this, user, entity, hand);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -736,7 +994,7 @@
|
@@ -736,7 +996,7 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,7 +523,7 @@
|
||||||
player.awardStat(Stats.ITEM_CRAFTED.get(this.getItem()), amount);
|
player.awardStat(Stats.ITEM_CRAFTED.get(this.getItem()), amount);
|
||||||
this.getItem().onCraftedBy(this, world, player);
|
this.getItem().onCraftedBy(this, world, player);
|
||||||
}
|
}
|
||||||
@@ -768,7 +1026,13 @@
|
@@ -768,7 +1028,13 @@
|
||||||
|
|
||||||
public boolean useOnRelease() {
|
public boolean useOnRelease() {
|
||||||
return this.getItem().useOnRelease(this);
|
return this.getItem().useOnRelease(this);
|
||||||
|
@ -535,7 +537,7 @@
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public <T> T set(DataComponentType<? super T> type, @Nullable T value) {
|
public <T> T set(DataComponentType<? super T> type, @Nullable T value) {
|
||||||
@@ -805,6 +1069,25 @@
|
@@ -805,6 +1071,25 @@
|
||||||
this.getItem().verifyComponentsAfterLoad(this);
|
this.getItem().verifyComponentsAfterLoad(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -561,7 +563,7 @@
|
||||||
|
|
||||||
public void applyComponents(DataComponentPatch changes) {
|
public void applyComponents(DataComponentPatch changes) {
|
||||||
this.components.applyPatch(changes);
|
this.components.applyPatch(changes);
|
||||||
@@ -858,7 +1141,7 @@
|
@@ -858,7 +1143,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T extends TooltipProvider> void addToTooltip(DataComponentType<T> componentType, Item.TooltipContext context, Consumer<Component> textConsumer, TooltipFlag type) {
|
private <T extends TooltipProvider> void addToTooltip(DataComponentType<T> componentType, Item.TooltipContext context, Consumer<Component> textConsumer, TooltipFlag type) {
|
||||||
|
@ -570,7 +572,7 @@
|
||||||
|
|
||||||
if (t0 != null) {
|
if (t0 != null) {
|
||||||
t0.addToTooltip(context, textConsumer, type);
|
t0.addToTooltip(context, textConsumer, type);
|
||||||
@@ -866,7 +1149,7 @@
|
@@ -866,7 +1151,7 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,7 +581,7 @@
|
||||||
boolean flag = this.getItem().shouldPrintOpWarning(this, player);
|
boolean flag = this.getItem().shouldPrintOpWarning(this, player);
|
||||||
|
|
||||||
if (!type.isCreative() && this.has(DataComponents.HIDE_TOOLTIP)) {
|
if (!type.isCreative() && this.has(DataComponents.HIDE_TOOLTIP)) {
|
||||||
@@ -941,7 +1224,7 @@
|
@@ -941,7 +1226,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,7 +590,7 @@
|
||||||
ItemAttributeModifiers itemattributemodifiers = (ItemAttributeModifiers) this.getOrDefault(DataComponents.ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.EMPTY);
|
ItemAttributeModifiers itemattributemodifiers = (ItemAttributeModifiers) this.getOrDefault(DataComponents.ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.EMPTY);
|
||||||
|
|
||||||
if (itemattributemodifiers.showInTooltip()) {
|
if (itemattributemodifiers.showInTooltip()) {
|
||||||
@@ -966,7 +1249,7 @@
|
@@ -966,7 +1251,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,7 +599,7 @@
|
||||||
double d0 = modifier.amount();
|
double d0 = modifier.amount();
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
|
|
||||||
@@ -1091,6 +1374,19 @@
|
@@ -1091,6 +1376,19 @@
|
||||||
EnchantmentHelper.forEachModifier(this, slot, attributeModifierConsumer);
|
EnchantmentHelper.forEachModifier(this, slot, attributeModifierConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -617,7 +619,7 @@
|
||||||
public Component getDisplayName() {
|
public Component getDisplayName() {
|
||||||
MutableComponent ichatmutablecomponent = Component.empty().append(this.getHoverName());
|
MutableComponent ichatmutablecomponent = Component.empty().append(this.getHoverName());
|
||||||
|
|
||||||
@@ -1153,7 +1449,7 @@
|
@@ -1153,7 +1451,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void consume(int amount, @Nullable LivingEntity entity) {
|
public void consume(int amount, @Nullable LivingEntity entity) {
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
protected final NeighborUpdater neighborUpdater;
|
protected final NeighborUpdater neighborUpdater;
|
||||||
private final List<TickingBlockEntity> pendingBlockEntityTickers = Lists.newArrayList();
|
private final List<TickingBlockEntity> pendingBlockEntityTickers = Lists.newArrayList();
|
||||||
private boolean tickingBlockEntities;
|
private boolean tickingBlockEntities;
|
||||||
@@ -121,23 +145,90 @@
|
@@ -121,23 +145,91 @@
|
||||||
private final DamageSources damageSources;
|
private final DamageSources damageSources;
|
||||||
private long subTickCount;
|
private long subTickCount;
|
||||||
|
|
||||||
|
@ -87,6 +87,7 @@
|
||||||
+ public boolean preventPoiUpdated = false; // CraftBukkit - SPIGOT-5710
|
+ public boolean preventPoiUpdated = false; // CraftBukkit - SPIGOT-5710
|
||||||
+ public boolean captureBlockStates = false;
|
+ public boolean captureBlockStates = false;
|
||||||
+ public boolean captureTreeGeneration = false;
|
+ public boolean captureTreeGeneration = false;
|
||||||
|
+ public boolean isBlockPlaceCancelled = false; // Paper - prevent calling cleanup logic when undoing a block place upon a cancelled BlockPlaceEvent
|
||||||
+ public Map<BlockPos, org.bukkit.craftbukkit.block.CraftBlockState> capturedBlockStates = new java.util.LinkedHashMap<>(); // Paper
|
+ public Map<BlockPos, org.bukkit.craftbukkit.block.CraftBlockState> capturedBlockStates = new java.util.LinkedHashMap<>(); // Paper
|
||||||
+ public Map<BlockPos, BlockEntity> capturedTileEntities = new java.util.LinkedHashMap<>(); // Paper - Retain block place order when capturing blockstates
|
+ public Map<BlockPos, BlockEntity> capturedTileEntities = new java.util.LinkedHashMap<>(); // Paper - Retain block place order when capturing blockstates
|
||||||
+ public List<ItemEntity> captureDrops;
|
+ public List<ItemEntity> captureDrops;
|
||||||
|
@ -169,7 +170,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
@@ -145,13 +236,90 @@
|
@@ -145,13 +237,90 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.thread = Thread.currentThread();
|
this.thread = Thread.currentThread();
|
||||||
|
@ -265,7 +266,7 @@
|
||||||
@Override
|
@Override
|
||||||
public boolean isClientSide() {
|
public boolean isClientSide() {
|
||||||
return this.isClientSide;
|
return this.isClientSide;
|
||||||
@@ -163,6 +331,13 @@
|
@@ -163,6 +332,13 @@
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +280,7 @@
|
||||||
public boolean isInWorldBounds(BlockPos pos) {
|
public boolean isInWorldBounds(BlockPos pos) {
|
||||||
return !this.isOutsideBuildHeight(pos) && Level.isInWorldBoundsHorizontal(pos);
|
return !this.isOutsideBuildHeight(pos) && Level.isInWorldBoundsHorizontal(pos);
|
||||||
}
|
}
|
||||||
@@ -172,25 +347,87 @@
|
@@ -172,25 +348,87 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isInWorldBoundsHorizontal(BlockPos pos) {
|
private static boolean isInWorldBoundsHorizontal(BlockPos pos) {
|
||||||
|
@ -312,7 +313,7 @@
|
||||||
|
|
||||||
+ // Paper start - if loaded
|
+ // Paper start - if loaded
|
||||||
@Nullable
|
@Nullable
|
||||||
+ @Override
|
@Override
|
||||||
+ public final ChunkAccess getChunkIfLoadedImmediately(int x, int z) {
|
+ public final ChunkAccess getChunkIfLoadedImmediately(int x, int z) {
|
||||||
+ return ((ServerLevel)this).chunkSource.getChunkAtIfLoadedImmediately(x, z);
|
+ return ((ServerLevel)this).chunkSource.getChunkAtIfLoadedImmediately(x, z);
|
||||||
+ }
|
+ }
|
||||||
|
@ -365,13 +366,13 @@
|
||||||
+ return getWorldBorder().isWithinBounds(blockposition) ? getBlockStateIfLoaded(blockposition) : null;
|
+ return getWorldBorder().isWithinBounds(blockposition) ? getBlockStateIfLoaded(blockposition) : null;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@Override
|
+ @Override
|
||||||
public ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) {
|
public ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) {
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
ChunkAccess ichunkaccess = this.getChunkSource().getChunk(chunkX, chunkZ, leastStatus, create);
|
ChunkAccess ichunkaccess = this.getChunkSource().getChunk(chunkX, chunkZ, leastStatus, create);
|
||||||
|
|
||||||
if (ichunkaccess == null && create) {
|
if (ichunkaccess == null && create) {
|
||||||
@@ -207,6 +444,22 @@
|
@@ -207,6 +445,22 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
|
public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
|
||||||
|
@ -394,7 +395,7 @@
|
||||||
if (this.isOutsideBuildHeight(pos)) {
|
if (this.isOutsideBuildHeight(pos)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (!this.isClientSide && this.isDebug()) {
|
} else if (!this.isClientSide && this.isDebug()) {
|
||||||
@@ -214,45 +467,126 @@
|
@@ -214,44 +468,125 @@
|
||||||
} else {
|
} else {
|
||||||
LevelChunk chunk = this.getChunkAt(pos);
|
LevelChunk chunk = this.getChunkAt(pos);
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
|
@ -479,10 +480,10 @@
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
+
|
||||||
return true;
|
return true;
|
||||||
}
|
+ }
|
||||||
}
|
+ }
|
||||||
}
|
+ }
|
||||||
|
+
|
||||||
+ // CraftBukkit start - Split off from above in order to directly send client and physic updates
|
+ // CraftBukkit start - Split off from above in order to directly send client and physic updates
|
||||||
+ public void notifyAndUpdatePhysics(BlockPos blockposition, LevelChunk chunk, BlockState oldBlock, BlockState newBlock, BlockState actualBlock, int i, int j) {
|
+ public void notifyAndUpdatePhysics(BlockPos blockposition, LevelChunk chunk, BlockState oldBlock, BlockState newBlock, BlockState actualBlock, int i, int j) {
|
||||||
+ BlockState iblockdata = newBlock;
|
+ BlockState iblockdata = newBlock;
|
||||||
|
@ -522,21 +523,20 @@
|
||||||
+ iblockdata.updateNeighbourShapes(this, blockposition, k, j - 1);
|
+ iblockdata.updateNeighbourShapes(this, blockposition, k, j - 1);
|
||||||
+ iblockdata.updateIndirectNeighbourShapes(this, blockposition, k, j - 1);
|
+ iblockdata.updateIndirectNeighbourShapes(this, blockposition, k, j - 1);
|
||||||
+ } // Paper - Fix block place logic
|
+ } // Paper - Fix block place logic
|
||||||
+ }
|
}
|
||||||
+
|
+
|
||||||
+ // CraftBukkit start - SPIGOT-5710
|
+ // CraftBukkit start - SPIGOT-5710
|
||||||
+ if (!this.preventPoiUpdated) {
|
+ if (!this.preventPoiUpdated) {
|
||||||
+ this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
|
+ this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+ }
|
}
|
||||||
+ }
|
}
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
|
||||||
public void onBlockStateChange(BlockPos pos, BlockState oldBlock, BlockState newBlock) {}
|
public void onBlockStateChange(BlockPos pos, BlockState oldBlock, BlockState newBlock) {}
|
||||||
|
|
||||||
@Override
|
@@ -270,15 +605,33 @@
|
||||||
@@ -270,15 +604,33 @@
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
FluidState fluid = this.getFluidState(pos);
|
FluidState fluid = this.getFluidState(pos);
|
||||||
|
@ -573,7 +573,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean flag1 = this.setBlock(pos, fluid.createLegacyBlock(), 3, maxUpdateDepth);
|
boolean flag1 = this.setBlock(pos, fluid.createLegacyBlock(), 3, maxUpdateDepth);
|
||||||
@@ -340,10 +692,18 @@
|
@@ -340,10 +693,18 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlockState(BlockPos pos) {
|
public BlockState getBlockState(BlockPos pos) {
|
||||||
|
@ -593,7 +593,7 @@
|
||||||
|
|
||||||
return chunk.getBlockState(pos);
|
return chunk.getBlockState(pos);
|
||||||
}
|
}
|
||||||
@@ -446,34 +806,53 @@
|
@@ -446,34 +807,53 @@
|
||||||
this.pendingBlockEntityTickers.clear();
|
this.pendingBlockEntityTickers.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -656,7 +656,7 @@
|
||||||
|
|
||||||
public boolean shouldTickDeath(Entity entity) {
|
public boolean shouldTickDeath(Entity entity) {
|
||||||
return true;
|
return true;
|
||||||
@@ -510,13 +889,32 @@
|
@@ -510,13 +890,32 @@
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public BlockEntity getBlockEntity(BlockPos pos) {
|
public BlockEntity getBlockEntity(BlockPos pos) {
|
||||||
|
@ -690,7 +690,7 @@
|
||||||
this.getChunkAt(blockposition).addAndRegisterBlockEntity(blockEntity);
|
this.getChunkAt(blockposition).addAndRegisterBlockEntity(blockEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -643,7 +1041,7 @@
|
@@ -643,7 +1042,7 @@
|
||||||
|
|
||||||
for (int k = 0; k < j; ++k) {
|
for (int k = 0; k < j; ++k) {
|
||||||
EnderDragonPart entitycomplexpart = aentitycomplexpart[k];
|
EnderDragonPart entitycomplexpart = aentitycomplexpart[k];
|
||||||
|
@ -699,7 +699,7 @@
|
||||||
|
|
||||||
if (t0 != null && predicate.test(t0)) {
|
if (t0 != null && predicate.test(t0)) {
|
||||||
result.add(t0);
|
result.add(t0);
|
||||||
@@ -912,7 +1310,7 @@
|
@@ -912,7 +1311,7 @@
|
||||||
|
|
||||||
public static enum ExplosionInteraction implements StringRepresentable {
|
public static enum ExplosionInteraction implements StringRepresentable {
|
||||||
|
|
||||||
|
|
|
@ -202,8 +202,9 @@
|
||||||
|
|
||||||
boolean flag3 = iblockdata1.hasBlockEntity();
|
boolean flag3 = iblockdata1.hasBlockEntity();
|
||||||
|
|
||||||
if (!this.level.isClientSide) {
|
- if (!this.level.isClientSide) {
|
||||||
- iblockdata1.onRemove(this.level, pos, state, moved);
|
- iblockdata1.onRemove(this.level, pos, state, moved);
|
||||||
|
+ if (!this.level.isClientSide && !this.level.isBlockPlaceCancelled) { // Paper - prevent calling cleanup logic when undoing a block place upon a cancelled BlockPlaceEvent
|
||||||
+ iblockdata1.onRemove(this.level, blockposition, iblockdata, flag);
|
+ iblockdata1.onRemove(this.level, blockposition, iblockdata, flag);
|
||||||
} else if (!iblockdata1.is(block) && flag3) {
|
} else if (!iblockdata1.is(block) && flag3) {
|
||||||
- this.removeBlockEntity(pos);
|
- this.removeBlockEntity(pos);
|
||||||
|
@ -288,14 +289,10 @@
|
||||||
if (tileentity != null) {
|
if (tileentity != null) {
|
||||||
Level world = this.level;
|
Level world = this.level;
|
||||||
|
|
||||||
@@ -549,10 +626,69 @@
|
@@ -553,6 +630,65 @@
|
||||||
if (this.postLoad != null) {
|
|
||||||
this.postLoad.run(this);
|
}
|
||||||
this.postLoad = null;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ public void loadCallback() {
|
+ public void loadCallback() {
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
|
@ -333,9 +330,9 @@
|
||||||
+ }
|
+ }
|
||||||
+ server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk));
|
+ server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk));
|
||||||
+ }
|
+ }
|
||||||
}
|
|
||||||
+ }
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ public void unloadCallback() {
|
+ public void unloadCallback() {
|
||||||
+ org.bukkit.Server server = this.level.getCraftServer();
|
+ org.bukkit.Server server = this.level.getCraftServer();
|
||||||
+ org.bukkit.Chunk bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
|
+ org.bukkit.Chunk bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
|
||||||
|
@ -347,8 +344,8 @@
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ this.loadedTicketLevel = false;
|
+ this.loadedTicketLevel = false;
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
+ }
|
||||||
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public boolean isUnsaved() {
|
+ public boolean isUnsaved() {
|
||||||
+ return super.isUnsaved() && !this.mustNotSave;
|
+ return super.isUnsaved() && !this.mustNotSave;
|
||||||
|
|
Loading…
Reference in a new issue