Add options to disable tripwire hook and leave decay updates#1297
Add options to disable tripwire hook and leave decay updates#1297SageSphinx63920 wants to merge 2 commits into
Conversation
|
I pr on the docs when this is approved |
|
The action fails, because the pufferfish/some random patch before it patch did smth bad. Running |
granny
left a comment
There was a problem hiding this comment.
Remove the disable-leaves-decay-updates option completely, it's unneeded.
Your changes to TripWireBlock don't do what you think it does. Remove what you have and take inspiration from the other changes in this patch.
Hint: all public overridden methods that are meant to return a BlockState include a check that returns a default blockstate of the block.
| diff --git a/src/main/java/net/minecraft/world/level/block/LeavesBlock.java b/src/main/java/net/minecraft/world/level/block/LeavesBlock.java | ||
| index ae94ac1707d0340f7535f74652e3f37f0361ba22..ad338f0e4745f75b66d94c8825d393426f0aa9a3 100644 | ||
| --- a/src/main/java/net/minecraft/world/level/block/LeavesBlock.java | ||
| +++ b/src/main/java/net/minecraft/world/level/block/LeavesBlock.java | ||
| @@ -50,6 +50,7 @@ public class LeavesBlock extends Block implements SimpleWaterloggedBlock { | ||
| @Override | ||
| public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { | ||
| if (this.decaying(state)) { | ||
| + if(org.purpurmc.purpur.PurpurConfig.disableLeavesDecay) return; // Purpur - disable leaves decay | ||
| // CraftBukkit start | ||
| LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ())); | ||
| world.getCraftServer().getPluginManager().callEvent(event); | ||
| @@ -65,6 +66,7 @@ public class LeavesBlock extends Block implements SimpleWaterloggedBlock { | ||
| } | ||
|
|
||
| protected boolean decaying(BlockState state) { | ||
| + if(org.purpurmc.purpur.PurpurConfig.disableLeavesDecay) return false; // Purpur - disable leaves decay | ||
| return !(Boolean) state.getValue(LeavesBlock.PERSISTENT) && (Integer) state.getValue(LeavesBlock.DISTANCE) == 7; | ||
| } | ||
|
|
There was a problem hiding this comment.
unneeded since you can set persistent to the blockstate to stop it from decaying
| diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java | ||
| index 7f60175bf671d282c11e9084670d2bb900968255..ea0a3fb7fb325707a01aa619ace4c33fcb522131 100644 | ||
| --- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java | ||
| +++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java | ||
| @@ -127,6 +127,7 @@ public class TripWireBlock extends Block { | ||
|
|
||
| @Override | ||
| public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { | ||
| + if(org.purpurmc.purpur.PurpurConfig.disableTripwireUpdates) return; // Purpur - disable tripwire updates | ||
| if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper | ||
| if (!world.isClientSide) { | ||
| if (!(Boolean) state.getValue(TripWireBlock.POWERED)) { | ||
| @@ -143,6 +144,7 @@ public class TripWireBlock extends Block { | ||
| } | ||
|
|
||
| private void checkPressed(Level world, BlockPos pos) { | ||
| + if(org.purpurmc.purpur.PurpurConfig.disableTripwireUpdates) return; // Purpur - disable tripwire updates | ||
| BlockState iblockdata = world.getBlockState(pos); | ||
| boolean flag = (Boolean) iblockdata.getValue(TripWireBlock.POWERED); | ||
| boolean flag1 = false; |
There was a problem hiding this comment.
checks not placed in the correct methods
should be fine once you merge changes from |
|
any updates? this pull request will be closed if it continues to be stale |
|
Yeah sorry granny, I need to be reminded that sth like this exits bc I forgot about it. Ill fix it tomorrow |
This pr adds config option to disable both things.