SPIGOT-7300, #1180: Add new DamageSource API providing enhanced information about entity damage
By: Doc <nachito94@msn.com>
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
--- a/net/minecraft/world/level/block/BlockSweetBerryBush.java
|
||||
+++ b/net/minecraft/world/level/block/BlockSweetBerryBush.java
|
||||
@@ -28,6 +28,14 @@
|
||||
@@ -28,6 +28,13 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.Collections;
|
||||
+import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.player.PlayerHarvestBlockEvent;
|
||||
@@ -15,7 +14,7 @@
|
||||
public class BlockSweetBerryBush extends BlockPlant implements IBlockFragilePlantElement {
|
||||
|
||||
public static final MapCodec<BlockSweetBerryBush> CODEC = simpleCodec(BlockSweetBerryBush::new);
|
||||
@@ -69,7 +77,7 @@
|
||||
@@ -69,7 +76,7 @@
|
||||
if (i < 3 && randomsource.nextInt(5) == 0 && worldserver.getRawBrightness(blockposition.above(), 0) >= 9) {
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSweetBerryBush.AGE, i + 1);
|
||||
|
||||
@@ -24,17 +23,16 @@
|
||||
worldserver.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
|
||||
}
|
||||
|
||||
@@ -84,7 +92,9 @@
|
||||
@@ -84,7 +91,7 @@
|
||||
double d1 = Math.abs(entity.getZ() - entity.zOld);
|
||||
|
||||
if (d0 >= 0.003000000026077032D || d1 >= 0.003000000026077032D) {
|
||||
+ CraftEventFactory.blockDamage = CraftBlock.at(world, blockposition); // CraftBukkit
|
||||
entity.hurt(world.damageSources().sweetBerryBush(), 1.0F);
|
||||
+ CraftEventFactory.blockDamage = null; // CraftBukkit
|
||||
- entity.hurt(world.damageSources().sweetBerryBush(), 1.0F);
|
||||
+ entity.hurt(world.damageSources().sweetBerryBush().directBlock(world, blockposition), 1.0F); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +111,15 @@
|
||||
@@ -101,7 +108,15 @@
|
||||
} else if (i > 1) {
|
||||
int j = 1 + world.random.nextInt(2);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user