Skip to content

Add options to disable tripwire hook and leave decay updates#1297

Closed
SageSphinx63920 wants to merge 2 commits into
PurpurMC:ver/1.19.4from
SageSphinx63920:ver/1.19.4
Closed

Add options to disable tripwire hook and leave decay updates#1297
SageSphinx63920 wants to merge 2 commits into
PurpurMC:ver/1.19.4from
SageSphinx63920:ver/1.19.4

Conversation

@SageSphinx63920

Copy link
Copy Markdown
Contributor

This pr adds config option to disable both things.

@SageSphinx63920

Copy link
Copy Markdown
Contributor Author

I pr on the docs when this is approved

@SageSphinx63920

SageSphinx63920 commented Mar 22, 2023

Copy link
Copy Markdown
Contributor Author

The action fails, because the pufferfish/some random patch before it patch did smth bad. Running ./gradlew applyPatches works fine and ./gradlew runDev works also without any errors

@granny granny left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +101 to +120
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;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unneeded since you can set persistent to the blockstate to stop it from decaying

Comment on lines +147 to +166
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;

@granny granny Mar 26, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checks not placed in the correct methods

@granny

granny commented Mar 26, 2023

Copy link
Copy Markdown
Member

The action fails, because the pufferfish/some random patch before it patch did smth bad. Running ./gradlew applyPatches works fine and ./gradlew runDev works also without any errors

should be fine once you merge changes from ver/1.19.4

@granny

granny commented Apr 6, 2023

Copy link
Copy Markdown
Member

any updates? this pull request will be closed if it continues to be stale

@SageSphinx63920

Copy link
Copy Markdown
Contributor Author

Yeah sorry granny, I need to be reminded that sth like this exits bc I forgot about it. Ill fix it tomorrow

@granny granny closed this May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants