Files
Purpur/patches/server/0110-Stonecutter-damage.patch
William Blake Galbreath 69c7c31f9a Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
26c37d99d5 create random seeds for features using SecureRandom
589bf2f1bf Upgrade gson to 2.8.8 (Closes #6370)
0a6103597b Get entity default attributes (#6449)
40057019e0 Correctly inflate villager activation bounding box (#6798)
e5f9241d15 Left handed API (#6775)
40ee63496c Add advancement display API (#6175)
9d570042ed Add ItemFactory#getMonsterEgg API (#6772)
55ca459515 rename method to getSpawnEgg
bb397ba74c Add critical damage API (#6275)
f47aeafe00 Add Horse Animation API (#5599)
7a0886180f AT & Mapping fixes (#6809)
5553432644 docs: Update gradle instructions for Java 16 (#6811) [ci skip]
a1f49e4c60 Fix command suggestion leak (#6592)
9472d38f3c Fix method name for Critical damage (#6813)
2021-10-21 10:58:20 -05:00

79 lines
4.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Mon, 5 Oct 2020 12:15:14 -0500
Subject: [PATCH] Stonecutter damage
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0820f4131692a9911e80df979ec1a4342ee76e58..ee2dd53fb2527a2e322ca9c385a8a1fa5c2131b2 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1035,7 +1035,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
// CraftBukkit end
- if (this.onGround && !this.isSteppingCarefully()) {
+ if (this.onGround && (!this.isSteppingCarefully() || (block == Blocks.STONECUTTER && level.purpurConfig.stonecutterDamage > 0.0F))) {
block.stepOn(this.level, blockposition, iblockdata, this);
}
diff --git a/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java b/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java
index e5c11ca529b524b444695f50e2648f0206ff34e1..75084a9943a3b481d20ce170565484071b96c8dc 100644
--- a/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java
@@ -93,4 +93,16 @@ public class StonecutterBlock extends Block {
public boolean isPathfindable(BlockState state, BlockGetter world, BlockPos pos, PathComputationType type) {
return false;
}
+
+ // Purpur start
+ @Override
+ public void stepOn(Level level, BlockPos pos, BlockState state, net.minecraft.world.entity.Entity entity) {
+ if (level.purpurConfig.stonecutterDamage > 0.0F && entity instanceof net.minecraft.world.entity.LivingEntity) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = level.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
+ entity.hurt(net.minecraft.world.damagesource.DamageSource.CACTUS, level.purpurConfig.stonecutterDamage);
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = null;
+ }
+ super.stepOn(level, pos, state, entity);
+ }
+ // Purpur end
}
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
index 2ad5ff9a1d7de54e75436e99da8a73db9dc91bde..60605a8a021cc56f9c3ba22bc43c43c302fb1a70 100644
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
@@ -463,7 +463,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
return BlockPathTypes.DANGER_CACTUS;
}
- if (blockState.is(Blocks.SWEET_BERRY_BUSH)) {
+ if (blockState.is(Blocks.SWEET_BERRY_BUSH) || blockState.is(Blocks.STONECUTTER)) {
return BlockPathTypes.DANGER_OTHER;
}
@@ -495,7 +495,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
return BlockPathTypes.POWDER_SNOW;
} else if (blockState.is(Blocks.CACTUS)) {
return BlockPathTypes.DAMAGE_CACTUS;
- } else if (blockState.is(Blocks.SWEET_BERRY_BUSH)) {
+ } else if (blockState.is(Blocks.SWEET_BERRY_BUSH) || blockState.is(Blocks.STONECUTTER)) {
return BlockPathTypes.DAMAGE_OTHER;
} else if (blockState.is(Blocks.HONEY_BLOCK)) {
return BlockPathTypes.STICKY_HONEY;
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 69b6b3f5646caa55e07fb9b581853f066c85a455..b2abdc1589a466835d74672f54cfd2be4cb3ebd7 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -469,6 +469,11 @@ public class PurpurWorldConfig {
spawnerDeactivateByRedstone = getBoolean("blocks.spawner.deactivate-by-redstone", spawnerDeactivateByRedstone);
}
+ public float stonecutterDamage = 0.0F;
+ private void stonecutterSettings() {
+ stonecutterDamage = (float) getDouble("blocks.stonecutter.damage", stonecutterDamage);
+ }
+
public boolean babiesAreRidable = true;
public boolean untamedTamablesAreRidable = true;
public boolean useNightVisionWhenRiding = false;