mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 08:00:02 +03:00
32 lines
1.9 KiB
Diff
32 lines
1.9 KiB
Diff
--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIEatGrass.java
|
|
+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIEatGrass.java
|
|
@@ -10,6 +10,8 @@
|
|
import net.minecraft.init.Blocks;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.world.World;
|
|
+import org.bukkit.Material;
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
|
|
public class EntityAIEatGrass extends EntityAIBase
|
|
{
|
|
@@ -78,7 +80,8 @@
|
|
|
|
if (IS_TALL_GRASS.apply(this.entityWorld.getBlockState(blockpos)))
|
|
{
|
|
- if (this.entityWorld.getGameRules().getBoolean("mobGriefing"))
|
|
+ // TODO: Needs testing
|
|
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.grassEaterEntity, this.grassEaterEntity.world.getWorld().getBlockAt(blockpos.getX(), blockpos.getY(), blockpos.getZ()), Material.AIR, !net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.entityWorld, this.grassEaterEntity)).isCancelled())
|
|
{
|
|
this.entityWorld.destroyBlock(blockpos, false);
|
|
}
|
|
@@ -91,7 +94,8 @@
|
|
|
|
if (this.entityWorld.getBlockState(blockpos1).getBlock() == Blocks.GRASS)
|
|
{
|
|
- if (this.entityWorld.getGameRules().getBoolean("mobGriefing"))
|
|
+ // TODO: Needs testing
|
|
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.grassEaterEntity, this.grassEaterEntity.world.getWorld().getBlockAt(blockpos.getX(), blockpos.getY(), blockpos.getZ()), Material.AIR, !net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.entityWorld, this.grassEaterEntity)).isCancelled())
|
|
{
|
|
this.entityWorld.playEvent(2001, blockpos1, Block.getIdFromBlock(Blocks.GRASS));
|
|
this.entityWorld.setBlockState(blockpos1, Blocks.DIRT.getDefaultState(), 2);
|