mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Only capture actual tree growth
This commit is contained in:
parent
1754e3426c
commit
36ae0bcfea
5 changed files with 58 additions and 43 deletions
|
@ -285,10 +285,11 @@
|
||||||
return this.consumeWithRemainder(pointer, stack, new ItemStack(item));
|
return this.consumeWithRemainder(pointer, stack, new ItemStack(item));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -249,16 +436,44 @@
|
@@ -248,6 +435,30 @@
|
||||||
|
@Override
|
||||||
protected ItemStack execute(BlockSource pointer, ItemStack stack) {
|
protected ItemStack execute(BlockSource pointer, ItemStack stack) {
|
||||||
ServerLevel worldserver = pointer.level();
|
ServerLevel worldserver = pointer.level();
|
||||||
|
+
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos());
|
+ org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos());
|
||||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack);
|
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack);
|
||||||
|
@ -312,10 +313,10 @@
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
|
||||||
this.setSuccess(true);
|
this.setSuccess(true);
|
||||||
Direction enumdirection = (Direction) pointer.state().getValue(DispenserBlock.FACING);
|
Direction enumdirection = (Direction) pointer.state().getValue(DispenserBlock.FACING);
|
||||||
BlockPos blockposition = pointer.pos().relative(enumdirection);
|
@@ -255,10 +466,14 @@
|
||||||
BlockState iblockdata = worldserver.getBlockState(blockposition);
|
BlockState iblockdata = worldserver.getBlockState(blockposition);
|
||||||
|
|
||||||
if (BaseFireBlock.canBePlacedAt(worldserver, blockposition, enumdirection)) {
|
if (BaseFireBlock.canBePlacedAt(worldserver, blockposition, enumdirection)) {
|
||||||
|
@ -333,7 +334,7 @@
|
||||||
TntBlock.explode(worldserver, blockposition);
|
TntBlock.explode(worldserver, blockposition);
|
||||||
worldserver.removeBlock(blockposition, false);
|
worldserver.removeBlock(blockposition, false);
|
||||||
} else {
|
} else {
|
||||||
@@ -283,13 +498,63 @@
|
@@ -283,13 +498,64 @@
|
||||||
this.setSuccess(true);
|
this.setSuccess(true);
|
||||||
ServerLevel worldserver = pointer.level();
|
ServerLevel worldserver = pointer.level();
|
||||||
BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING));
|
BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING));
|
||||||
|
@ -389,6 +390,7 @@
|
||||||
+ if (!fertilizeEvent.isCancelled()) {
|
+ if (!fertilizeEvent.isCancelled()) {
|
||||||
+ for (org.bukkit.block.BlockState blockstate : blocks) {
|
+ for (org.bukkit.block.BlockState blockstate : blocks) {
|
||||||
+ blockstate.update(true);
|
+ blockstate.update(true);
|
||||||
|
+ worldserver.checkCapturedTreeStateForObserverNotify(blockposition, (org.bukkit.craftbukkit.block.CraftBlockState) blockstate); // Paper - notify observers even if grow failed
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
@ -397,7 +399,7 @@
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -298,12 +563,41 @@
|
@@ -298,12 +564,41 @@
|
||||||
protected ItemStack execute(BlockSource pointer, ItemStack stack) {
|
protected ItemStack execute(BlockSource pointer, ItemStack stack) {
|
||||||
ServerLevel worldserver = pointer.level();
|
ServerLevel worldserver = pointer.level();
|
||||||
BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING));
|
BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING));
|
||||||
|
@ -441,7 +443,7 @@
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -313,7 +607,31 @@
|
@@ -313,7 +608,31 @@
|
||||||
ServerLevel worldserver = pointer.level();
|
ServerLevel worldserver = pointer.level();
|
||||||
Direction enumdirection = (Direction) pointer.state().getValue(DispenserBlock.FACING);
|
Direction enumdirection = (Direction) pointer.state().getValue(DispenserBlock.FACING);
|
||||||
BlockPos blockposition = pointer.pos().relative(enumdirection);
|
BlockPos blockposition = pointer.pos().relative(enumdirection);
|
||||||
|
@ -473,7 +475,7 @@
|
||||||
if (worldserver.isEmptyBlock(blockposition) && WitherSkullBlock.canSpawnMob(worldserver, blockposition, stack)) {
|
if (worldserver.isEmptyBlock(blockposition) && WitherSkullBlock.canSpawnMob(worldserver, blockposition, stack)) {
|
||||||
worldserver.setBlock(blockposition, (BlockState) Blocks.WITHER_SKELETON_SKULL.defaultBlockState().setValue(SkullBlock.ROTATION, RotationSegment.convertToSegment(enumdirection)), 3);
|
worldserver.setBlock(blockposition, (BlockState) Blocks.WITHER_SKELETON_SKULL.defaultBlockState().setValue(SkullBlock.ROTATION, RotationSegment.convertToSegment(enumdirection)), 3);
|
||||||
worldserver.gameEvent((Entity) null, (Holder) GameEvent.BLOCK_PLACE, blockposition);
|
worldserver.gameEvent((Entity) null, (Holder) GameEvent.BLOCK_PLACE, blockposition);
|
||||||
@@ -339,6 +657,30 @@
|
@@ -339,6 +658,30 @@
|
||||||
BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING));
|
BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING));
|
||||||
CarvedPumpkinBlock blockpumpkincarved = (CarvedPumpkinBlock) Blocks.CARVED_PUMPKIN;
|
CarvedPumpkinBlock blockpumpkincarved = (CarvedPumpkinBlock) Blocks.CARVED_PUMPKIN;
|
||||||
|
|
||||||
|
@ -504,7 +506,7 @@
|
||||||
if (worldserver.isEmptyBlock(blockposition) && blockpumpkincarved.canSpawnGolem(worldserver, blockposition)) {
|
if (worldserver.isEmptyBlock(blockposition) && blockpumpkincarved.canSpawnGolem(worldserver, blockposition)) {
|
||||||
if (!worldserver.isClientSide) {
|
if (!worldserver.isClientSide) {
|
||||||
worldserver.setBlock(blockposition, blockpumpkincarved.defaultBlockState(), 3);
|
worldserver.setBlock(blockposition, blockpumpkincarved.defaultBlockState(), 3);
|
||||||
@@ -377,6 +719,30 @@
|
@@ -377,6 +720,30 @@
|
||||||
BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING));
|
BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING));
|
||||||
BlockState iblockdata = worldserver.getBlockState(blockposition);
|
BlockState iblockdata = worldserver.getBlockState(blockposition);
|
||||||
|
|
||||||
|
@ -535,7 +537,7 @@
|
||||||
if (iblockdata.is(BlockTags.BEEHIVES, (blockbase_blockdata) -> {
|
if (iblockdata.is(BlockTags.BEEHIVES, (blockbase_blockdata) -> {
|
||||||
return blockbase_blockdata.hasProperty(BeehiveBlock.HONEY_LEVEL) && blockbase_blockdata.getBlock() instanceof BeehiveBlock;
|
return blockbase_blockdata.hasProperty(BeehiveBlock.HONEY_LEVEL) && blockbase_blockdata.getBlock() instanceof BeehiveBlock;
|
||||||
}) && (Integer) iblockdata.getValue(BeehiveBlock.HONEY_LEVEL) >= 5) {
|
}) && (Integer) iblockdata.getValue(BeehiveBlock.HONEY_LEVEL) >= 5) {
|
||||||
@@ -402,6 +768,13 @@
|
@@ -402,6 +769,13 @@
|
||||||
this.setSuccess(true);
|
this.setSuccess(true);
|
||||||
if (iblockdata.is(Blocks.RESPAWN_ANCHOR)) {
|
if (iblockdata.is(Blocks.RESPAWN_ANCHOR)) {
|
||||||
if ((Integer) iblockdata.getValue(RespawnAnchorBlock.CHARGE) != 4) {
|
if ((Integer) iblockdata.getValue(RespawnAnchorBlock.CHARGE) != 4) {
|
||||||
|
@ -549,7 +551,7 @@
|
||||||
RespawnAnchorBlock.charge((Entity) null, worldserver, blockposition, iblockdata);
|
RespawnAnchorBlock.charge((Entity) null, worldserver, blockposition, iblockdata);
|
||||||
stack.shrink(1);
|
stack.shrink(1);
|
||||||
} else {
|
} else {
|
||||||
@@ -426,6 +799,31 @@
|
@@ -426,6 +800,31 @@
|
||||||
this.setSuccess(false);
|
this.setSuccess(false);
|
||||||
return stack;
|
return stack;
|
||||||
} else {
|
} else {
|
||||||
|
@ -581,7 +583,7 @@
|
||||||
Iterator iterator1 = list.iterator();
|
Iterator iterator1 = list.iterator();
|
||||||
|
|
||||||
Armadillo armadillo;
|
Armadillo armadillo;
|
||||||
@@ -454,6 +852,13 @@
|
@@ -454,6 +853,13 @@
|
||||||
Optional<BlockState> optional = HoneycombItem.getWaxed(iblockdata);
|
Optional<BlockState> optional = HoneycombItem.getWaxed(iblockdata);
|
||||||
|
|
||||||
if (optional.isPresent()) {
|
if (optional.isPresent()) {
|
||||||
|
@ -595,7 +597,7 @@
|
||||||
worldserver.setBlockAndUpdate(blockposition, (BlockState) optional.get());
|
worldserver.setBlockAndUpdate(blockposition, (BlockState) optional.get());
|
||||||
worldserver.levelEvent(3003, blockposition, 0);
|
worldserver.levelEvent(3003, blockposition, 0);
|
||||||
stack.shrink(1);
|
stack.shrink(1);
|
||||||
@@ -481,6 +886,12 @@
|
@@ -481,6 +887,12 @@
|
||||||
if (!worldserver.getBlockState(blockposition1).is(BlockTags.CONVERTABLE_TO_MUD)) {
|
if (!worldserver.getBlockState(blockposition1).is(BlockTags.CONVERTABLE_TO_MUD)) {
|
||||||
return this.defaultDispenseItemBehavior.dispense(pointer, stack);
|
return this.defaultDispenseItemBehavior.dispense(pointer, stack);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
+ // be more strict too, add a block (dumb plugins in move events?)
|
+ // be more strict too, add a block (dumb plugins in move events?)
|
||||||
+ int minBlockX = Mth.floor(axisalignedbb.minX - 1.0E-7D) - 3;
|
+ int minBlockX = Mth.floor(axisalignedbb.minX - 1.0E-7D) - 3;
|
||||||
+ int maxBlockX = Mth.floor(axisalignedbb.maxX + 1.0E-7D) + 3;
|
+ int maxBlockX = Mth.floor(axisalignedbb.maxX + 1.0E-7D) + 3;
|
||||||
|
+
|
||||||
+ int minBlockZ = Mth.floor(axisalignedbb.minZ - 1.0E-7D) - 3;
|
+ int minBlockZ = Mth.floor(axisalignedbb.minZ - 1.0E-7D) - 3;
|
||||||
+ int maxBlockZ = Mth.floor(axisalignedbb.maxZ + 1.0E-7D) + 3;
|
+ int maxBlockZ = Mth.floor(axisalignedbb.maxZ + 1.0E-7D) + 3;
|
||||||
+
|
+
|
||||||
|
@ -227,7 +227,7 @@
|
||||||
+ boolean flag2 = minecraftserver.forceSynchronousWrites();
|
+ boolean flag2 = minecraftserver.forceSynchronousWrites();
|
||||||
+ DataFixer datafixer = minecraftserver.getFixerUpper();
|
+ DataFixer datafixer = minecraftserver.getFixerUpper();
|
||||||
+ EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(new SimpleRegionStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, DataFixTypes.ENTITY_CHUNK), this, minecraftserver);
|
+ EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(new SimpleRegionStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, DataFixTypes.ENTITY_CHUNK), this, minecraftserver);
|
||||||
+
|
|
||||||
this.entityManager = new PersistentEntitySectionManager<>(Entity.class, new ServerLevel.EntityCallbacks(), entitypersistentstorage);
|
this.entityManager = new PersistentEntitySectionManager<>(Entity.class, new ServerLevel.EntityCallbacks(), entitypersistentstorage);
|
||||||
- StructureTemplateManager structuretemplatemanager = server.getStructureManager();
|
- StructureTemplateManager structuretemplatemanager = server.getStructureManager();
|
||||||
- int j = server.getPlayerList().getViewDistance();
|
- int j = server.getPlayerList().getViewDistance();
|
||||||
|
@ -1039,7 +1039,7 @@
|
||||||
return this.entityManager.getEntityGetter();
|
return this.entityManager.getEntityGetter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1802,6 +2203,17 @@
|
@@ -1802,6 +2203,27 @@
|
||||||
return this.serverLevelData.getGameRules();
|
return this.serverLevelData.getGameRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1053,11 +1053,21 @@
|
||||||
+ return range <= 0 ? 64.0 * 64.0 : range * range; // 64 is taken from default in ServerLevel#levelEvent
|
+ return range <= 0 ? 64.0 * 64.0 : range * range; // 64 is taken from default in ServerLevel#levelEvent
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - respect global sound events gamerule
|
+ // Paper end - respect global sound events gamerule
|
||||||
|
+ // Paper start - notify observers even if grow failed
|
||||||
|
+ public void checkCapturedTreeStateForObserverNotify(final BlockPos pos, final org.bukkit.craftbukkit.block.CraftBlockState craftBlockState) {
|
||||||
|
+ // notify observers if the block state is the same and the Y level equals the original y level (for mega trees)
|
||||||
|
+ // blocks at the same Y level with the same state can be assumed to be saplings which trigger observers regardless of if the
|
||||||
|
+ // tree grew or not
|
||||||
|
+ if (craftBlockState.getPosition().getY() == pos.getY() && this.getBlockState(craftBlockState.getPosition()) == craftBlockState.getHandle()) {
|
||||||
|
+ this.notifyAndUpdatePhysics(craftBlockState.getPosition(), null, craftBlockState.getHandle(), craftBlockState.getHandle(), craftBlockState.getHandle(), craftBlockState.getFlag(), 512);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ // Paper end - notify observers even if grow failed
|
||||||
+
|
+
|
||||||
@Override
|
@Override
|
||||||
public CrashReportCategory fillReportDetails(CrashReport report) {
|
public CrashReportCategory fillReportDetails(CrashReport report) {
|
||||||
CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report);
|
CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report);
|
||||||
@@ -1828,6 +2240,7 @@
|
@@ -1828,6 +2250,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTickingStart(Entity entity) {
|
public void onTickingStart(Entity entity) {
|
||||||
|
@ -1065,7 +1075,7 @@
|
||||||
ServerLevel.this.entityTickList.add(entity);
|
ServerLevel.this.entityTickList.add(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1836,14 +2249,15 @@
|
@@ -1836,14 +2259,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTrackingStart(Entity entity) {
|
public void onTrackingStart(Entity entity) {
|
||||||
|
@ -1083,7 +1093,7 @@
|
||||||
String s = "onTrackingStart called during navigation iteration";
|
String s = "onTrackingStart called during navigation iteration";
|
||||||
|
|
||||||
Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration"));
|
Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration"));
|
||||||
@@ -1864,9 +2278,58 @@
|
@@ -1864,9 +2288,58 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
|
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
|
||||||
|
@ -1142,7 +1152,7 @@
|
||||||
ServerLevel.this.getChunkSource().removeEntity(entity);
|
ServerLevel.this.getChunkSource().removeEntity(entity);
|
||||||
if (entity instanceof ServerPlayer entityplayer) {
|
if (entity instanceof ServerPlayer entityplayer) {
|
||||||
ServerLevel.this.players.remove(entityplayer);
|
ServerLevel.this.players.remove(entityplayer);
|
||||||
@@ -1874,7 +2337,7 @@
|
@@ -1874,7 +2347,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity instanceof Mob entityinsentient) {
|
if (entity instanceof Mob entityinsentient) {
|
||||||
|
@ -1151,7 +1161,7 @@
|
||||||
String s = "onTrackingStart called during navigation iteration";
|
String s = "onTrackingStart called during navigation iteration";
|
||||||
|
|
||||||
Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration"));
|
Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration"));
|
||||||
@@ -1895,10 +2358,27 @@
|
@@ -1895,10 +2368,27 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);
|
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);
|
||||||
|
|
|
@ -152,7 +152,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -370,32 +418,195 @@
|
@@ -370,32 +418,196 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public InteractionResult useOn(UseOnContext context) {
|
public InteractionResult useOn(UseOnContext context) {
|
||||||
|
@ -214,6 +214,7 @@
|
||||||
+ for (CraftBlockState blockstate : blocks) {
|
+ for (CraftBlockState blockstate : blocks) {
|
||||||
+ // SPIGOT-7572 - Move fix for SPIGOT-7248 to CapturedBlockState, to allow bees in bee nest
|
+ // SPIGOT-7572 - Move fix for SPIGOT-7248 to CapturedBlockState, to allow bees in bee nest
|
||||||
+ CapturedBlockState.setBlockState(blockstate);
|
+ CapturedBlockState.setBlockState(blockstate);
|
||||||
|
+ world.checkCapturedTreeStateForObserverNotify(blockposition, blockstate); // Paper - notify observers even if grow failed
|
||||||
+ }
|
+ }
|
||||||
+ entityhuman.awardStat(Stats.ITEM_USED.get(item)); // SPIGOT-7236 - award stat
|
+ entityhuman.awardStat(Stats.ITEM_USED.get(item)); // SPIGOT-7236 - award stat
|
||||||
+ }
|
+ }
|
||||||
|
@ -353,7 +354,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 +701,66 @@
|
@@ -490,8 +702,37 @@
|
||||||
return this.isDamageableItem() && this.getDamageValue() >= this.getMaxDamage() - 1;
|
return this.isDamageableItem() && this.getDamageValue() >= this.getMaxDamage() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +372,7 @@
|
||||||
+ if (player instanceof final ServerPlayer serverPlayer) { // Paper - Add EntityDamageItemEvent
|
+ if (player instanceof final ServerPlayer serverPlayer) { // Paper - Add EntityDamageItemEvent
|
||||||
+ PlayerItemDamageEvent event = new PlayerItemDamageEvent(serverPlayer.getBukkitEntity(), CraftItemStack.asCraftMirror(this), j, originalDamage); // Paper - Add EntityDamageItemEvent
|
+ PlayerItemDamageEvent event = new PlayerItemDamageEvent(serverPlayer.getBukkitEntity(), CraftItemStack.asCraftMirror(this), j, originalDamage); // Paper - Add EntityDamageItemEvent
|
||||||
+ event.getPlayer().getServer().getPluginManager().callEvent(event);
|
+ event.getPlayer().getServer().getPluginManager().callEvent(event);
|
||||||
|
+
|
||||||
+ if (j != event.getDamage() || event.isCancelled()) {
|
+ if (j != event.getDamage() || event.isCancelled()) {
|
||||||
+ event.getPlayer().updateInventory();
|
+ event.getPlayer().updateInventory();
|
||||||
+ }
|
+ }
|
||||||
|
@ -390,10 +391,10 @@
|
||||||
+ // Paper end - Add EntityDamageItemEvent
|
+ // Paper end - Add EntityDamageItemEvent
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
|
||||||
if (j != 0) {
|
if (j != 0) {
|
||||||
this.applyDamage(this.getDamageValue() + j, player, breakCallback);
|
this.applyDamage(this.getDamageValue() + j, player, breakCallback);
|
||||||
}
|
@@ -499,18 +740,28 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@
|
||||||
|
|
||||||
this.shrink(1);
|
this.shrink(1);
|
||||||
breakCallback.accept(item);
|
breakCallback.accept(item);
|
||||||
@@ -518,7 +768,7 @@
|
@@ -518,7 +769,7 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,7 +437,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 +785,11 @@
|
@@ -535,6 +786,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hurtAndBreak(int amount, LivingEntity entity, EquipmentSlot slot) {
|
public void hurtAndBreak(int amount, LivingEntity entity, EquipmentSlot slot) {
|
||||||
|
@ -448,7 +449,7 @@
|
||||||
Level world = entity.level();
|
Level world = entity.level();
|
||||||
|
|
||||||
if (world instanceof ServerLevel worldserver) {
|
if (world instanceof ServerLevel worldserver) {
|
||||||
@@ -546,9 +801,9 @@
|
@@ -546,9 +802,9 @@
|
||||||
entityplayer = null;
|
entityplayer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,7 +462,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -580,11 +835,11 @@
|
@@ -580,11 +836,11 @@
|
||||||
return this.getItem().getBarColor(this);
|
return this.getItem().getBarColor(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,7 +476,7 @@
|
||||||
return this.getItem().overrideOtherStackedOnMe(this, stack, slot, clickType, player, cursorStackReference);
|
return this.getItem().overrideOtherStackedOnMe(this, stack, slot, clickType, player, cursorStackReference);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -592,8 +847,8 @@
|
@@ -592,8 +848,8 @@
|
||||||
Item item = this.getItem();
|
Item item = this.getItem();
|
||||||
|
|
||||||
if (item.hurtEnemy(this, target, user)) {
|
if (item.hurtEnemy(this, target, user)) {
|
||||||
|
@ -486,7 +487,7 @@
|
||||||
|
|
||||||
entityhuman.awardStat(Stats.ITEM_USED.get(item));
|
entityhuman.awardStat(Stats.ITEM_USED.get(item));
|
||||||
}
|
}
|
||||||
@@ -608,7 +863,7 @@
|
@@ -608,7 +864,7 @@
|
||||||
this.getItem().postHurtEnemy(this, target, user);
|
this.getItem().postHurtEnemy(this, target, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,7 +496,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 +872,11 @@
|
@@ -617,11 +873,11 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,7 +510,7 @@
|
||||||
return this.getItem().interactLivingEntity(this, user, entity, hand);
|
return this.getItem().interactLivingEntity(this, user, entity, hand);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -736,7 +991,7 @@
|
@@ -736,7 +992,7 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,7 +519,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);
|
||||||
}
|
}
|
||||||
@@ -770,6 +1025,12 @@
|
@@ -770,6 +1026,12 @@
|
||||||
return this.getItem().useOnRelease(this);
|
return this.getItem().useOnRelease(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,7 +532,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) {
|
||||||
return this.components.set(type, value);
|
return this.components.set(type, value);
|
||||||
@@ -806,6 +1067,25 @@
|
@@ -806,6 +1068,25 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,7 +558,7 @@
|
||||||
public void applyComponents(DataComponentPatch changes) {
|
public void applyComponents(DataComponentPatch changes) {
|
||||||
this.components.applyPatch(changes);
|
this.components.applyPatch(changes);
|
||||||
this.getItem().verifyComponentsAfterLoad(this);
|
this.getItem().verifyComponentsAfterLoad(this);
|
||||||
@@ -858,7 +1138,7 @@
|
@@ -858,7 +1139,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) {
|
||||||
|
@ -566,7 +567,7 @@
|
||||||
|
|
||||||
if (t0 != null) {
|
if (t0 != null) {
|
||||||
t0.addToTooltip(context, textConsumer, type);
|
t0.addToTooltip(context, textConsumer, type);
|
||||||
@@ -866,7 +1146,7 @@
|
@@ -866,7 +1147,7 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -575,7 +576,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 +1221,7 @@
|
@@ -941,7 +1222,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,7 +585,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 +1246,7 @@
|
@@ -966,7 +1247,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,7 +594,7 @@
|
||||||
double d0 = modifier.amount();
|
double d0 = modifier.amount();
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
|
|
||||||
@@ -1091,6 +1371,14 @@
|
@@ -1091,6 +1372,14 @@
|
||||||
EnchantmentHelper.forEachModifier(this, slot, attributeModifierConsumer);
|
EnchantmentHelper.forEachModifier(this, slot, attributeModifierConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -608,7 +609,7 @@
|
||||||
public Component getDisplayName() {
|
public Component getDisplayName() {
|
||||||
MutableComponent ichatmutablecomponent = Component.empty().append(this.getHoverName());
|
MutableComponent ichatmutablecomponent = Component.empty().append(this.getHoverName());
|
||||||
|
|
||||||
@@ -1153,7 +1441,7 @@
|
@@ -1153,7 +1442,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void consume(int amount, @Nullable LivingEntity entity) {
|
public void consume(int amount, @Nullable LivingEntity entity) {
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MapCodec<? extends SaplingBlock> codec() {
|
public MapCodec<? extends SaplingBlock> codec() {
|
||||||
@@ -37,48 +45,73 @@
|
@@ -37,48 +45,74 @@
|
||||||
protected SaplingBlock(TreeGrower generator, BlockBehaviour.Properties settings) {
|
protected SaplingBlock(TreeGrower generator, BlockBehaviour.Properties settings) {
|
||||||
super(settings);
|
super(settings);
|
||||||
this.treeGrower = generator;
|
this.treeGrower = generator;
|
||||||
|
@ -81,6 +81,7 @@
|
||||||
+ if (event == null || !event.isCancelled()) {
|
+ if (event == null || !event.isCancelled()) {
|
||||||
+ for (BlockState blockstate : blocks) {
|
+ for (BlockState blockstate : blocks) {
|
||||||
+ CapturedBlockState.setBlockState(blockstate);
|
+ CapturedBlockState.setBlockState(blockstate);
|
||||||
|
+ world.checkCapturedTreeStateForObserverNotify(pos, (org.bukkit.craftbukkit.block.CraftBlockState) blockstate); // Paper - notify observers even if grow failed
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
|
|
@ -572,6 +572,7 @@ public class CraftBlock implements Block {
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
for (BlockState blockstate : blocks) {
|
for (BlockState blockstate : blocks) {
|
||||||
blockstate.update(true);
|
blockstate.update(true);
|
||||||
|
world.checkCapturedTreeStateForObserverNotify(this.position, (org.bukkit.craftbukkit.block.CraftBlockState) blockstate); // Paper - notify observers even if grow failed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue