mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 04:20:02 +03:00
130 lines
6.2 KiB
Diff
130 lines
6.2 KiB
Diff
--- ../src-base/minecraft/net/minecraft/entity/passive/EntityRabbit.java
|
|
+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityRabbit.java
|
|
@@ -66,23 +66,28 @@
|
|
{
|
|
super(worldIn);
|
|
this.setSize(0.4F, 0.5F);
|
|
- this.jumpHelper = new EntityRabbit.RabbitJumpHelper(this);
|
|
- this.moveHelper = new EntityRabbit.RabbitMoveHelper(this);
|
|
+ this.jumpHelper = new RabbitJumpHelper(this);
|
|
+ this.moveHelper = new RabbitMoveHelper(this);
|
|
+ this.initializePathFinderGoals(); // CraftBukkit - moved code
|
|
+ }
|
|
+
|
|
+ // CraftBukkit start - code from constructor
|
|
+ public void initializePathFinderGoals(){
|
|
this.setMovementSpeed(0.0D);
|
|
}
|
|
|
|
protected void initEntityAI()
|
|
{
|
|
this.tasks.addTask(1, new EntityAISwimming(this));
|
|
- this.tasks.addTask(1, new EntityRabbit.AIPanic(this, 2.2D));
|
|
+ this.tasks.addTask(1, new AIPanic(this, 2.2D));
|
|
this.tasks.addTask(2, new EntityAIMate(this, 0.8D));
|
|
this.tasks.addTask(3, new EntityAITempt(this, 1.0D, Items.CARROT, false));
|
|
this.tasks.addTask(3, new EntityAITempt(this, 1.0D, Items.GOLDEN_CARROT, false));
|
|
this.tasks.addTask(3, new EntityAITempt(this, 1.0D, Item.getItemFromBlock(Blocks.YELLOW_FLOWER), false));
|
|
- this.tasks.addTask(4, new EntityRabbit.AIAvoidEntity(this, EntityPlayer.class, 8.0F, 2.2D, 2.2D));
|
|
- this.tasks.addTask(4, new EntityRabbit.AIAvoidEntity(this, EntityWolf.class, 10.0F, 2.2D, 2.2D));
|
|
- this.tasks.addTask(4, new EntityRabbit.AIAvoidEntity(this, EntityMob.class, 4.0F, 2.2D, 2.2D));
|
|
- this.tasks.addTask(5, new EntityRabbit.AIRaidFarm(this));
|
|
+ this.tasks.addTask(4, new AIAvoidEntity(this, EntityPlayer.class, 8.0F, 2.2D, 2.2D));
|
|
+ this.tasks.addTask(4, new AIAvoidEntity(this, EntityWolf.class, 10.0F, 2.2D, 2.2D));
|
|
+ this.tasks.addTask(4, new AIAvoidEntity(this, EntityMob.class, 4.0F, 2.2D, 2.2D));
|
|
+ this.tasks.addTask(5, new AIRaidFarm(this));
|
|
this.tasks.addTask(6, new EntityAIWanderAvoidWater(this, 0.6D));
|
|
this.tasks.addTask(11, new EntityAIWatchClosest(this, EntityPlayer.class, 10.0F));
|
|
}
|
|
@@ -205,7 +210,7 @@
|
|
}
|
|
}
|
|
|
|
- EntityRabbit.RabbitJumpHelper entityrabbit$rabbitjumphelper = (EntityRabbit.RabbitJumpHelper)this.jumpHelper;
|
|
+ RabbitJumpHelper entityrabbit$rabbitjumphelper = (RabbitJumpHelper)this.jumpHelper;
|
|
|
|
if (!entityrabbit$rabbitjumphelper.getIsJumping())
|
|
{
|
|
@@ -243,12 +248,12 @@
|
|
|
|
private void enableJumpControl()
|
|
{
|
|
- ((EntityRabbit.RabbitJumpHelper)this.jumpHelper).setCanJump(true);
|
|
+ ((RabbitJumpHelper)this.jumpHelper).setCanJump(true);
|
|
}
|
|
|
|
private void disableJumpControl()
|
|
{
|
|
- ((EntityRabbit.RabbitJumpHelper)this.jumpHelper).setCanJump(false);
|
|
+ ((RabbitJumpHelper)this.jumpHelper).setCanJump(false);
|
|
}
|
|
|
|
private void updateMoveTypeDuration()
|
|
@@ -401,7 +406,7 @@
|
|
if (rabbitTypeId == 99)
|
|
{
|
|
this.getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(8.0D);
|
|
- this.tasks.addTask(4, new EntityRabbit.AIEvilAttack(this));
|
|
+ this.tasks.addTask(4, new AIEvilAttack(this));
|
|
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0]));
|
|
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
|
|
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityWolf.class, true));
|
|
@@ -422,14 +427,14 @@
|
|
int i = this.getRandomRabbitType();
|
|
boolean flag = false;
|
|
|
|
- if (livingdata instanceof EntityRabbit.RabbitTypeData)
|
|
+ if (livingdata instanceof RabbitTypeData)
|
|
{
|
|
- i = ((EntityRabbit.RabbitTypeData)livingdata).typeData;
|
|
+ i = ((RabbitTypeData)livingdata).typeData;
|
|
flag = true;
|
|
}
|
|
else
|
|
{
|
|
- livingdata = new EntityRabbit.RabbitTypeData(i);
|
|
+ livingdata = new RabbitTypeData(i);
|
|
}
|
|
|
|
this.setRabbitType(i);
|
|
@@ -551,7 +556,7 @@
|
|
{
|
|
if (this.runDelay <= 0)
|
|
{
|
|
- if (!this.rabbit.world.getGameRules().getBoolean("mobGriefing"))
|
|
+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.rabbit.world, this.rabbit))
|
|
{
|
|
return false;
|
|
}
|
|
@@ -587,11 +592,21 @@
|
|
|
|
if (integer.intValue() == 0)
|
|
{
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.rabbit, blockpos, Blocks.AIR, 0).isCancelled()) {
|
|
+ return;
|
|
+ }
|
|
world.setBlockState(blockpos, Blocks.AIR.getDefaultState(), 2);
|
|
world.destroyBlock(blockpos, true);
|
|
}
|
|
else
|
|
{
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(
|
|
+ this.rabbit,
|
|
+ blockpos,
|
|
+ block, block.getMetaFromState(iblockstate.withProperty(BlockCarrot.AGE, Integer.valueOf(integer.intValue() - 1)))
|
|
+ ).isCancelled()) {
|
|
+ return;
|
|
+ }
|
|
world.setBlockState(blockpos, iblockstate.withProperty(BlockCarrot.AGE, Integer.valueOf(integer.intValue() - 1)), 2);
|
|
world.playEvent(2001, blockpos, Block.getStateId(iblockstate));
|
|
}
|
|
@@ -674,7 +689,7 @@
|
|
|
|
public void onUpdateMoveHelper()
|
|
{
|
|
- if (this.rabbit.onGround && !this.rabbit.isJumping && !((EntityRabbit.RabbitJumpHelper)this.rabbit.jumpHelper).getIsJumping())
|
|
+ if (this.rabbit.onGround && !this.rabbit.isJumping && !((RabbitJumpHelper)this.rabbit.jumpHelper).getIsJumping())
|
|
{
|
|
this.rabbit.setMovementSpeed(0.0D);
|
|
}
|