mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 01:17:42 +01:00
Fix #318 - Stonecutter does not damage when sneaking
This commit is contained in:
@@ -4,31 +4,34 @@ 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 918edab475a8d33a253e3d6cd3c5655748d10dc0..b17443821b8a4ca4954eb430ea70b255ac336f0d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -894,7 +894,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
- if (this.onGround && !this.bv()) {
|
||||
+ if (this.onGround && (!this.bv() || (block == Blocks.STONECUTTER && world.purpurConfig.stonecutterDamage > 0.0F))) { // Purpur
|
||||
block.stepOn(this.world, blockposition, this);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BlockStonecutter.java b/src/main/java/net/minecraft/world/level/block/BlockStonecutter.java
|
||||
index 54c9586cd7f8c9691a1c7ded9c9c96b0f316b0b6..988204918854e982e334eb2417b83914b58cbcf6 100644
|
||||
index 54c9586cd7f8c9691a1c7ded9c9c96b0f316b0b6..68c6f090a10564a790f3bf175e2378d1f7103b8e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BlockStonecutter.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BlockStonecutter.java
|
||||
@@ -10,6 +10,9 @@ import net.minecraft.world.EnumHand;
|
||||
import net.minecraft.world.EnumInteractionResult;
|
||||
import net.minecraft.world.ITileInventory;
|
||||
import net.minecraft.world.TileInventory;
|
||||
+import net.minecraft.world.damagesource.DamageSource;
|
||||
+import net.minecraft.world.entity.Entity;
|
||||
+import net.minecraft.world.entity.EntityLiving;
|
||||
import net.minecraft.world.entity.player.EntityHuman;
|
||||
import net.minecraft.world.inventory.ContainerAccess;
|
||||
import net.minecraft.world.inventory.ContainerStonecutter;
|
||||
@@ -94,4 +97,16 @@ public class BlockStonecutter extends Block {
|
||||
@@ -94,4 +94,16 @@ public class BlockStonecutter extends Block {
|
||||
public boolean a(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition, PathMode pathmode) {
|
||||
return false;
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public void stepOn(World world, BlockPosition pos, Entity entity) {
|
||||
+ if (world.purpurConfig.stonecutterDamage > 0.0F && entity instanceof EntityLiving) {
|
||||
+ public void stepOn(World world, BlockPosition pos, net.minecraft.world.entity.Entity entity) {
|
||||
+ if (world.purpurConfig.stonecutterDamage > 0.0F && entity instanceof net.minecraft.world.entity.EntityLiving) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
|
||||
+ entity.damageEntity(DamageSource.CACTUS, world.purpurConfig.stonecutterDamage);
|
||||
+ entity.damageEntity(net.minecraft.world.damagesource.DamageSource.CACTUS, world.purpurConfig.stonecutterDamage);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = null;
|
||||
+ }
|
||||
+ super.stepOn(world, pos, entity);
|
||||
|
||||
Reference in New Issue
Block a user