mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 18:37:42 +01:00
more patches
This commit is contained in:
78
patches/server/0112-Stonecutter-damage.patch
Normal file
78
patches/server/0112-Stonecutter-damage.patch
Normal file
@@ -0,0 +1,78 @@
|
||||
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 517542c4cf412d81c4a85d5a48191fa06a635364..2e412ab5ef06e2c07a8b07e0b3948e51c29dc81e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -897,7 +897,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..e67c14c272b0058e210c83f91600431e11f65f33 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)) { // Purpur
|
||||
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)) { // Purpur
|
||||
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 d04fe759b32926209150a9b412b5de200f3518ad..db10ff41061e6d7cad6944e6506b20a35d99d3c3 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -979,6 +979,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 turtleRidable = false;
|
||||
public boolean turtleRidableInWater = false;
|
||||
public boolean turtleEggsBreakFromExpOrbs = true;
|
||||
Reference in New Issue
Block a user