mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 02:20:01 +03:00
57 lines
3.2 KiB
Diff
57 lines
3.2 KiB
Diff
--- ../src-base/minecraft/net/minecraft/entity/monster/EntitySilverfish.java
|
|
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySilverfish.java
|
|
@@ -29,7 +29,7 @@
|
|
|
|
public class EntitySilverfish extends EntityMob
|
|
{
|
|
- private EntitySilverfish.AISummonSilverfish summonSilverfish;
|
|
+ private AISummonSilverfish summonSilverfish;
|
|
|
|
public EntitySilverfish(World worldIn)
|
|
{
|
|
@@ -44,11 +44,11 @@
|
|
|
|
protected void initEntityAI()
|
|
{
|
|
- this.summonSilverfish = new EntitySilverfish.AISummonSilverfish(this);
|
|
+ this.summonSilverfish = new AISummonSilverfish(this);
|
|
this.tasks.addTask(1, new EntityAISwimming(this));
|
|
this.tasks.addTask(3, this.summonSilverfish);
|
|
this.tasks.addTask(4, new EntityAIAttackMelee(this, 1.0D, false));
|
|
- this.tasks.addTask(5, new EntitySilverfish.AIHideInStone(this));
|
|
+ this.tasks.addTask(5, new AIHideInStone(this));
|
|
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[0]));
|
|
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
|
|
}
|
|
@@ -184,7 +184,7 @@
|
|
{
|
|
Random random = this.entity.getRNG();
|
|
|
|
- if (this.entity.world.getGameRules().getBoolean("mobGriefing") && random.nextInt(10) == 0)
|
|
+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.entity.world, this.entity) && random.nextInt(10) == 0)
|
|
{
|
|
this.facing = EnumFacing.random(random);
|
|
BlockPos blockpos = (new BlockPos(this.entity.posX, this.entity.posY + 0.5D, this.entity.posZ)).offset(this.facing);
|
|
@@ -221,6 +221,9 @@
|
|
|
|
if (BlockSilverfish.canContainSilverfish(iblockstate))
|
|
{
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.entity, blockpos, Blocks.MONSTER_EGG, Block.getIdFromBlock(BlockSilverfish.getBlockById(iblockstate.getBlock().getMetaFromState(iblockstate)))).isCancelled()) {
|
|
+ return;
|
|
+ }
|
|
world.setBlockState(blockpos, Blocks.MONSTER_EGG.getDefaultState().withProperty(BlockSilverfish.VARIANT, BlockSilverfish.EnumType.forModelBlock(iblockstate)), 3);
|
|
this.entity.spawnExplosionParticle();
|
|
this.entity.setDead();
|
|
@@ -273,7 +276,10 @@
|
|
|
|
if (iblockstate.getBlock() == Blocks.MONSTER_EGG)
|
|
{
|
|
- if (world.getGameRules().getBoolean("mobGriefing"))
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockpos1, Blocks.AIR, 0).isCancelled()) {
|
|
+ continue;
|
|
+ }
|
|
+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(world, this.silverfish))
|
|
{
|
|
world.destroyBlock(blockpos1, true);
|
|
}
|