2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/EntityRabbit.java
|
|
|
|
+++ b/net/minecraft/server/EntityRabbit.java
|
2020-07-09 01:04:11 +02:00
|
|
|
@@ -17,11 +17,17 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
super(entitytypes, world);
|
2020-06-25 02:00:00 +02:00
|
|
|
this.bp = new EntityRabbit.ControllerJumpRabbit(this);
|
2015-02-26 23:41:06 +01:00
|
|
|
this.moveController = new EntityRabbit.ControllerMoveRabbit(this);
|
2014-12-06 22:45:51 +01:00
|
|
|
+ this.initializePathFinderGoals(); // CraftBukkit - moved code
|
|
|
|
+ }
|
2015-02-26 23:41:06 +01:00
|
|
|
+
|
2014-12-06 22:45:51 +01:00
|
|
|
+ // CraftBukkit start - code from constructor
|
|
|
|
+ public void initializePathFinderGoals(){
|
2019-12-10 23:00:00 +01:00
|
|
|
this.i(0.0D);
|
2014-12-06 22:45:51 +01:00
|
|
|
}
|
|
|
|
+ // CraftBukkit end
|
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
@Override
|
2020-07-09 01:04:11 +02:00
|
|
|
- protected void initPathfinder() {
|
|
|
|
+ public void initPathfinder() {
|
|
|
|
this.goalSelector.a(1, new PathfinderGoalFloat(this));
|
|
|
|
this.goalSelector.a(1, new EntityRabbit.PathfinderGoalRabbitPanic(this, 2.2D));
|
|
|
|
this.goalSelector.a(2, new PathfinderGoalBreed(this, 0.8D));
|
2020-06-25 02:00:00 +02:00
|
|
|
@@ -285,7 +291,7 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
if (i == 99) {
|
|
|
|
this.getAttributeInstance(GenericAttributes.ARMOR).setValue(8.0D);
|
|
|
|
this.goalSelector.a(4, new EntityRabbit.PathfinderGoalKillerRabbitMeleeAttack(this));
|
|
|
|
- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[0])).a());
|
|
|
|
+ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[0])).a(new Class[0])); // CraftBukkit - decompile error
|
|
|
|
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true));
|
|
|
|
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityWolf.class, true));
|
|
|
|
if (!this.hasCustomName()) {
|
2020-06-25 02:00:00 +02:00
|
|
|
@@ -401,9 +407,23 @@
|
2016-06-30 08:15:38 +02:00
|
|
|
Integer integer = (Integer) iblockdata.get(BlockCarrots.AGE);
|
|
|
|
|
2018-12-06 00:00:00 +01:00
|
|
|
if (integer == 0) {
|
2016-06-30 08:15:38 +02:00
|
|
|
+ // CraftBukkit start
|
2018-12-13 01:00:00 +01:00
|
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.entity, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
2016-06-30 08:15:38 +02:00
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 2);
|
2019-12-10 23:00:00 +01:00
|
|
|
world.a(blockposition, true, this.entity);
|
2016-06-30 08:15:38 +02:00
|
|
|
} else {
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(
|
2018-12-13 01:00:00 +01:00
|
|
|
+ this.entity,
|
2016-07-08 03:12:40 +02:00
|
|
|
+ blockposition,
|
2018-12-06 00:00:00 +01:00
|
|
|
+ iblockdata.set(BlockCarrots.AGE, integer - 1)
|
2016-06-30 08:15:38 +02:00
|
|
|
+ ).isCancelled()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2018-12-06 00:00:00 +01:00
|
|
|
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockCarrots.AGE, integer - 1), 2);
|
2016-06-30 08:15:38 +02:00
|
|
|
world.triggerEffect(2001, blockposition, Block.getCombinedId(iblockdata));
|
|
|
|
}
|