mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
79 lines
4.5 KiB
Diff
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 4ae2040d17f1a8c413c02996621d41c8641581f3..15e25843ba5bea971d7a844fbd8adb8b483001da 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -1024,7 +1024,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
|
}
|
|
// 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 ec1c04f354236af24e137865b3b311ab8eb29ac4..46ef683e027f95bf39a42e0abba3a8e4dcd66740 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 5e28c09d782166be6d0fbc6778ef9f6c4d7af409..ce891b7d8e5cbc956c28b8bb8c5c9976b7377039 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/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index 869db4be87334e6281d0b9dc8ae2496090fe7da1..26d46c07b483144911cb404809ad9873517ea4b3 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -443,6 +443,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;
|