@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityAnimal.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityAnimal.java
|
||||
@@ -29,12 +29,19 @@
|
||||
@@ -30,12 +30,19 @@
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
protected EntityAnimal(EntityTypes<? extends EntityAnimal> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -71,6 +78,9 @@
|
||||
@@ -72,6 +79,9 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
@Override
|
||||
public boolean hurt(DamageSource damagesource, float f) {
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
@@ -80,6 +90,7 @@
|
||||
@@ -81,6 +91,7 @@
|
||||
return super.hurt(damagesource, f);
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
@Override
|
||||
public float getWalkTargetValue(BlockPosition blockposition, IWorldReader iworldreader) {
|
||||
@@ -174,10 +185,17 @@
|
||||
@@ -175,10 +186,17 @@
|
||||
}
|
||||
|
||||
public void setInLove(@Nullable EntityHuman entityhuman) {
|
||||
@@ -55,41 +55,45 @@
|
||||
}
|
||||
+ this.breedItem = entityhuman.getInventory().getSelected(); // CraftBukkit
|
||||
|
||||
this.level.broadcastEntityEvent(this, (byte) 18);
|
||||
this.level().broadcastEntityEvent(this, (byte) 18);
|
||||
}
|
||||
@@ -222,6 +240,16 @@
|
||||
if (entityplayer == null && entityanimal.getLoveCause() != null) {
|
||||
entityplayer = entityanimal.getLoveCause();
|
||||
}
|
||||
+ // CraftBukkit start - call EntityBreedEvent
|
||||
+ entityageable.setBaby(true);
|
||||
+ entityageable.moveTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F);
|
||||
+ int experience = this.getRandom().nextInt(7) + 1;
|
||||
+ org.bukkit.event.entity.EntityBreedEvent entityBreedEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(entityageable, this, entityanimal, entityplayer, this.breedItem, experience);
|
||||
+ if (entityBreedEvent.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ experience = entityBreedEvent.getExperience();
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (entityplayer != null) {
|
||||
entityplayer.awardStat(StatisticList.ANIMALS_BRED);
|
||||
@@ -232,12 +260,14 @@
|
||||
entityanimal.setAge(6000);
|
||||
this.resetLove();
|
||||
entityanimal.resetLove();
|
||||
- entityageable.setBaby(true);
|
||||
- entityageable.moveTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F);
|
||||
@@ -221,14 +239,23 @@
|
||||
entityageable.setBaby(true);
|
||||
entityageable.moveTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F);
|
||||
this.finalizeSpawnChildFromBreeding(worldserver, entityanimal, entityageable);
|
||||
- worldserver.addFreshEntityWithPassengers(entityageable);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
|
||||
worldserver.broadcastEntityEvent(this, (byte) 18);
|
||||
if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
- worldserver.addFreshEntity(new EntityExperienceOrb(worldserver, this.getX(), this.getY(), this.getZ(), this.getRandom().nextInt(7) + 1));
|
||||
+ // CraftBukkit start - use event experience
|
||||
+ if (experience > 0) {
|
||||
+ worldserver.addFreshEntity(new EntityExperienceOrb(worldserver, this.getX(), this.getY(), this.getZ(), experience));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void finalizeSpawnChildFromBreeding(WorldServer worldserver, EntityAnimal entityanimal, @Nullable EntityAgeable entityageable) {
|
||||
- Optional.ofNullable(this.getLoveCause()).or(() -> {
|
||||
+ // CraftBukkit start - call EntityBreedEvent
|
||||
+ Optional<EntityPlayer> cause = Optional.ofNullable(this.getLoveCause()).or(() -> {
|
||||
return Optional.ofNullable(entityanimal.getLoveCause());
|
||||
- }).ifPresent((entityplayer) -> {
|
||||
+ });
|
||||
+ int experience = this.getRandom().nextInt(7) + 1;
|
||||
+ org.bukkit.event.entity.EntityBreedEvent entityBreedEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(entityageable, this, entityanimal, cause.orElse(null), this.breedItem, experience);
|
||||
+ if (entityBreedEvent.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ experience = entityBreedEvent.getExperience();
|
||||
+ cause.ifPresent((entityplayer) -> {
|
||||
+ // CraftBukkit end
|
||||
entityplayer.awardStat(StatisticList.ANIMALS_BRED);
|
||||
CriterionTriggers.BRED_ANIMALS.trigger(entityplayer, this, entityanimal, entityageable);
|
||||
});
|
||||
@@ -238,7 +265,11 @@
|
||||
entityanimal.resetLove();
|
||||
worldserver.broadcastEntityEvent(this, (byte) 18);
|
||||
if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
- worldserver.addFreshEntity(new EntityExperienceOrb(worldserver, this.getX(), this.getY(), this.getZ(), this.getRandom().nextInt(7) + 1));
|
||||
+ // CraftBukkit start - use event experience
|
||||
+ if (experience > 0) {
|
||||
+ worldserver.addFreshEntity(new EntityExperienceOrb(worldserver, this.getX(), this.getY(), this.getZ(), experience));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityBee.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityBee.java
|
||||
@@ -243,7 +243,7 @@
|
||||
@@ -242,7 +242,7 @@
|
||||
}
|
||||
|
||||
if (b0 > 0) {
|
||||
@@ -9,15 +9,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -641,11 +641,15 @@
|
||||
@@ -640,11 +640,15 @@
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
- if (!this.level.isClientSide) {
|
||||
- if (!this.level().isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ boolean result = super.hurt(damagesource, f);
|
||||
+
|
||||
+ if (result && !this.level.isClientSide) {
|
||||
+ if (result && !this.level().isClientSide) {
|
||||
this.beePollinateGoal.stopPollinating();
|
||||
}
|
||||
|
||||
@@ -27,16 +27,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1221,7 +1225,7 @@
|
||||
@@ -1216,7 +1220,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (flag) {
|
||||
+ if (flag && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(EntityBee.this, blockposition, iblockdata.setValue(blockstateinteger, (Integer) iblockdata.getValue(blockstateinteger) + 1)).isCancelled()) { // Spigot
|
||||
EntityBee.this.level.levelEvent(2005, blockposition, 0);
|
||||
EntityBee.this.level.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.setValue(blockstateinteger, (Integer) iblockdata.getValue(blockstateinteger) + 1));
|
||||
- if (iblockdata1 != null) {
|
||||
+ if (iblockdata1 != null&& !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(EntityBee.this, blockposition, iblockdata1).isCancelled()) { // CraftBukkit
|
||||
EntityBee.this.level().levelEvent(2005, blockposition, 0);
|
||||
EntityBee.this.level().setBlockAndUpdate(blockposition, iblockdata1);
|
||||
EntityBee.this.incrementNumCropsGrownSincePollination();
|
||||
@@ -1294,7 +1298,7 @@
|
||||
@@ -1289,7 +1293,7 @@
|
||||
@Override
|
||||
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
if (entityinsentient instanceof EntityBee && this.mob.hasLineOfSight(entityliving)) {
|
||||
@@ -45,7 +45,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1303,7 +1307,7 @@
|
||||
@@ -1298,7 +1302,7 @@
|
||||
private static class c extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
|
||||
|
||||
c(EntityBee entitybee) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
+ if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { // CraftBukkit
|
||||
this.tame(entityhuman);
|
||||
this.setOrderedToSit(true);
|
||||
this.level.broadcastEntityEvent(this, (byte) 7);
|
||||
this.level().broadcastEntityEvent(this, (byte) 7);
|
||||
@@ -469,7 +469,7 @@
|
||||
private static class PathfinderGoalTemptChance extends PathfinderGoalTempt {
|
||||
|
||||
@@ -22,15 +22,15 @@
|
||||
while (iterator.hasNext()) {
|
||||
ItemStack itemstack = (ItemStack) iterator.next();
|
||||
|
||||
- this.cat.level.addFreshEntity(new EntityItem(this.cat.level, (double) blockposition_mutableblockposition.getX() - (double) MathHelper.sin(this.cat.yBodyRot * 0.017453292F), (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + (double) MathHelper.cos(this.cat.yBodyRot * 0.017453292F), itemstack));
|
||||
- this.cat.level().addFreshEntity(new EntityItem(this.cat.level(), (double) blockposition_mutableblockposition.getX() - (double) MathHelper.sin(this.cat.yBodyRot * 0.017453292F), (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + (double) MathHelper.cos(this.cat.yBodyRot * 0.017453292F), itemstack));
|
||||
+ // CraftBukkit start
|
||||
+ EntityItem entityitem = new EntityItem(this.cat.level, (double) blockposition_mutableblockposition.getX() - (double) MathHelper.sin(this.cat.yBodyRot * 0.017453292F), (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + (double) MathHelper.cos(this.cat.yBodyRot * 0.017453292F), itemstack);
|
||||
+ EntityItem entityitem = new EntityItem(this.cat.level(), (double) blockposition_mutableblockposition.getX() - (double) MathHelper.sin(this.cat.yBodyRot * 0.017453292F), (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + (double) MathHelper.cos(this.cat.yBodyRot * 0.017453292F), itemstack);
|
||||
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(this.cat.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
+ entityitem.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ entityitem.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ this.cat.level.addFreshEntity(entityitem);
|
||||
+ this.cat.level().addFreshEntity(entityitem);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+++ b/net/minecraft/world/entity/animal/EntityChicken.java
|
||||
@@ -96,7 +96,9 @@
|
||||
this.flap += this.flapping * 2.0F;
|
||||
if (!this.level.isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0) {
|
||||
if (!this.level().isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0) {
|
||||
this.playSound(SoundEffects.CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.spawnAtLocation((IMaterial) Items.EGG);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {
|
||||
+ // CraftBukkit start - Got milk?
|
||||
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.level, entityhuman, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET, enumhand);
|
||||
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.level(), entityhuman, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET, enumhand);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return EnumInteractionResult.PASS;
|
||||
@@ -29,4 +29,4 @@
|
||||
+ ItemStack itemstack1 = ItemLiquidUtil.createFilledResult(itemstack, entityhuman, CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit
|
||||
|
||||
entityhuman.setItemInHand(enumhand, itemstack1);
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
- return this.dolphin.gotFish() && this.dolphin.getAirSupply() >= 100;
|
||||
+ return this.dolphin.gotFish() && this.dolphin.getAirSupply() >= 100 && this.dolphin.level.getWorld().canGenerateStructures(); // MC-151364, SPIGOT-5494: hangs if generate-structures=false
|
||||
+ return this.dolphin.gotFish() && this.dolphin.getAirSupply() >= 100 && this.dolphin.level().getWorld().canGenerateStructures(); // MC-151364, SPIGOT-5494: hangs if generate-structures=false
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,7 +56,7 @@
|
||||
@@ -508,7 +520,7 @@
|
||||
}
|
||||
|
||||
if (this.player.isSwimming() && this.player.level.random.nextInt(6) == 0) {
|
||||
if (this.player.isSwimming() && this.player.level().random.nextInt(6) == 0) {
|
||||
- this.player.addEffect(new MobEffect(MobEffects.DOLPHINS_GRACE, 100), this.dolphin);
|
||||
+ this.player.addEffect(new MobEffect(MobEffects.DOLPHINS_GRACE, 100), this.dolphin, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.DOLPHIN); // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
int j = 1 + EntityFox.this.level.random.nextInt(2) + (i == 3 ? 1 : 0);
|
||||
int j = 1 + EntityFox.this.level().random.nextInt(2) + (i == 3 ? 1 : 0);
|
||||
ItemStack itemstack = EntityFox.this.getItemBySlot(EnumItemSlot.MAINHAND);
|
||||
|
||||
@@ -1441,7 +1459,7 @@
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityIronGolem.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityIronGolem.java
|
||||
@@ -105,7 +105,7 @@
|
||||
@@ -102,7 +102,7 @@
|
||||
@Override
|
||||
protected void doPush(Entity entity) {
|
||||
if (entity instanceof IMonster && !(entity instanceof EntityCreeper) && this.getRandom().nextInt(20) == 0) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
private static final DataWatcherObject<String> DATA_TYPE = DataWatcher.defineId(EntityMushroomCow.class, DataWatcherRegistry.STRING);
|
||||
@@ -115,6 +122,11 @@
|
||||
this.playSound(soundeffect, 1.0F, 1.0F);
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
|
||||
} else if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.handlePlayerShearEntityEvent(entityhuman, this, itemstack, enumhand)) {
|
||||
@@ -25,11 +25,11 @@
|
||||
+ // CraftBukkit end
|
||||
this.shear(SoundCategory.PLAYERS);
|
||||
this.gameEvent(GameEvent.SHEAR, entityhuman);
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -165,7 +177,7 @@
|
||||
|
||||
if (entitycow != null) {
|
||||
((WorldServer) this.level).sendParticles(Particles.EXPLOSION, this.getX(), this.getY(0.5D), this.getZ(), 1, 0.0D, 0.0D, 0.0D, 0.0D);
|
||||
((WorldServer) this.level()).sendParticles(Particles.EXPLOSION, this.getX(), this.getY(0.5D), this.getZ(), 1, 0.0D, 0.0D, 0.0D, 0.0D);
|
||||
- this.discard();
|
||||
+ // this.discard(); // CraftBukkit - moved down
|
||||
entitycow.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
|
||||
@@ -39,26 +39,26 @@
|
||||
}
|
||||
|
||||
entitycow.setInvulnerable(this.isInvulnerable());
|
||||
- this.level.addFreshEntity(entitycow);
|
||||
- this.level().addFreshEntity(entitycow);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ this.level.addFreshEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
|
||||
+ this.level().addFreshEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
|
||||
+
|
||||
+ this.discard(); // CraftBukkit - from above
|
||||
+ // CraftBukkit end
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
- this.level.addFreshEntity(new EntityItem(this.level, this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getVariant().blockState.getBlock())));
|
||||
- this.level().addFreshEntity(new EntityItem(this.level(), this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getVariant().blockState.getBlock())));
|
||||
+ // CraftBukkit start
|
||||
+ EntityItem entityitem = new EntityItem(this.level, this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getVariant().blockState.getBlock()));
|
||||
+ EntityItem entityitem = new EntityItem(this.level(), this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getVariant().blockState.getBlock()));
|
||||
+ EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ this.level.addFreshEntity(entityitem);
|
||||
+ this.level().addFreshEntity(entityitem);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
@@ -177,7 +177,8 @@
|
||||
if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemstack) && entityhuman.distanceToSqr((Entity) this) < 9.0D) {
|
||||
this.usePlayerItem(entityhuman, enumhand, itemstack);
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
- if (this.random.nextInt(3) == 0) {
|
||||
+ // CraftBukkit - added event call and isCancelled check
|
||||
+ if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
|
||||
this.setTrusting(true);
|
||||
this.spawnTrustingParticles(true);
|
||||
this.level.broadcastEntityEvent(this, (byte) 41);
|
||||
this.level().broadcastEntityEvent(this, (byte) 41);
|
||||
@@ -308,10 +309,10 @@
|
||||
private final EntityOcelot ocelot;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
@@ -1105,7 +1107,7 @@
|
||||
@Override
|
||||
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
if (entityinsentient instanceof EntityPanda && ((EntityPanda) entityinsentient).isAggressive()) {
|
||||
if (entityinsentient instanceof EntityPanda && entityinsentient.isAggressive()) {
|
||||
- entityinsentient.setTarget(entityliving);
|
||||
+ entityinsentient.setTarget(entityliving, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
@@ -261,7 +261,7 @@
|
||||
}
|
||||
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
- if (this.random.nextInt(10) == 0) {
|
||||
+ if (this.random.nextInt(10) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { // CraftBukkit
|
||||
this.tame(entityhuman);
|
||||
this.level.broadcastEntityEvent(this, (byte) 7);
|
||||
this.level().broadcastEntityEvent(this, (byte) 7);
|
||||
} else {
|
||||
@@ -275,7 +275,7 @@
|
||||
itemstack.shrink(1);
|
||||
@@ -30,7 +30,7 @@
|
||||
@@ -398,7 +398,7 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
- this.setOrderedToSit(false);
|
||||
+ // this.setOrderedToSit(false); // CraftBukkit - moved into EntityLiving.damageEntity(DamageSource, float)
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
@Override
|
||||
public void registerGoals() {
|
||||
@@ -570,9 +576,23 @@
|
||||
@@ -576,9 +582,23 @@
|
||||
int i = (Integer) iblockdata.getValue(BlockCarrots.AGE);
|
||||
|
||||
if (i == 0) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntitySheep.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntitySheep.java
|
||||
@@ -63,6 +63,14 @@
|
||||
@@ -64,6 +64,14 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.level.storage.loot.LootTables;
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
public class EntitySheep extends EntityAnimal implements IShearable {
|
||||
|
||||
private static final int EAT_ANIMATION_TICKS = 40;
|
||||
@@ -243,6 +251,11 @@
|
||||
@@ -244,6 +252,11 @@
|
||||
|
||||
if (itemstack.is(Items.SHEARS)) {
|
||||
if (!this.level.isClientSide && this.readyForShearing()) {
|
||||
if (!this.level().isClientSide && this.readyForShearing()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.handlePlayerShearEntityEvent(entityhuman, this, itemstack, enumhand)) {
|
||||
+ return EnumInteractionResult.PASS;
|
||||
@@ -27,7 +27,7 @@
|
||||
this.shear(SoundCategory.PLAYERS);
|
||||
this.gameEvent(GameEvent.SHEAR, entityhuman);
|
||||
itemstack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
|
||||
@@ -264,7 +277,9 @@
|
||||
@@ -265,7 +278,9 @@
|
||||
int i = 1 + this.random.nextInt(3);
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
@@ -37,29 +37,29 @@
|
||||
|
||||
if (entityitem != null) {
|
||||
entityitem.setDeltaMovement(entityitem.getDeltaMovement().add((double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (this.random.nextFloat() * 0.05F), (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F)));
|
||||
@@ -357,6 +372,12 @@
|
||||
@@ -358,6 +373,12 @@
|
||||
|
||||
@Override
|
||||
public void ate() {
|
||||
+ // CraftBukkit start
|
||||
+ SheepRegrowWoolEvent event = new SheepRegrowWoolEvent((org.bukkit.entity.Sheep) this.getBukkitEntity());
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) return;
|
||||
+ // CraftBukkit end
|
||||
super.ate();
|
||||
this.setSheared(false);
|
||||
if (this.isBaby()) {
|
||||
@@ -376,7 +397,7 @@
|
||||
@@ -377,7 +398,7 @@
|
||||
EnumColor enumcolor = ((EntitySheep) entityanimal).getColor();
|
||||
EnumColor enumcolor1 = ((EntitySheep) entityanimal1).getColor();
|
||||
InventoryCrafting inventorycrafting = makeContainer(enumcolor, enumcolor1);
|
||||
- Optional optional = this.level.getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level).map((recipecrafting) -> {
|
||||
+ Optional<Item> optional = this.level.getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level).map((recipecrafting) -> { // CraftBukkit - decompile error
|
||||
return recipecrafting.assemble(inventorycrafting, this.level.registryAccess());
|
||||
- Optional optional = this.level().getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level()).map((recipecrafting) -> {
|
||||
+ Optional<Item> optional = this.level().getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level()).map((recipecrafting) -> { // CraftBukkit - decompile error
|
||||
return recipecrafting.assemble(inventorycrafting, this.level().registryAccess());
|
||||
}).map(ItemStack::getItem);
|
||||
|
||||
@@ -399,10 +420,18 @@
|
||||
@@ -400,10 +421,18 @@
|
||||
public boolean stillValid(EntityHuman entityhuman) {
|
||||
return false;
|
||||
}
|
||||
@@ -72,9 +72,9 @@
|
||||
+ // CraftBukkit end
|
||||
}, 2, 1);
|
||||
|
||||
inventorycrafting.setItem(0, new ItemStack(ItemDye.byColor(enumcolor)));
|
||||
inventorycrafting.setItem(1, new ItemStack(ItemDye.byColor(enumcolor1)));
|
||||
+ inventorycrafting.resultInventory = new InventoryCraftResult(); // CraftBukkit - add result slot for event
|
||||
return inventorycrafting;
|
||||
transientcraftingcontainer.setItem(0, new ItemStack(ItemDye.byColor(enumcolor)));
|
||||
transientcraftingcontainer.setItem(1, new ItemStack(ItemDye.byColor(enumcolor1)));
|
||||
+ transientcraftingcontainer.resultInventory = new InventoryCraftResult(); // CraftBukkit - add result slot for event
|
||||
return transientcraftingcontainer;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,24 +13,24 @@
|
||||
private static final DataWatcherObject<Byte> DATA_PUMPKIN_ID = DataWatcher.defineId(EntitySnowman.class, DataWatcherRegistry.BYTE);
|
||||
@@ -97,7 +101,7 @@
|
||||
super.aiStep();
|
||||
if (!this.level.isClientSide) {
|
||||
if (this.level.getBiome(this.blockPosition()).is(BiomeTags.SNOW_GOLEM_MELTS)) {
|
||||
if (!this.level().isClientSide) {
|
||||
if (this.level().getBiome(this.blockPosition()).is(BiomeTags.SNOW_GOLEM_MELTS)) {
|
||||
- this.hurt(this.damageSources().onFire(), 1.0F);
|
||||
+ this.hurt(this.damageSources().melting, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
|
||||
}
|
||||
|
||||
if (!this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
if (!this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
@@ -113,7 +117,11 @@
|
||||
BlockPosition blockposition = new BlockPosition(j, k, l);
|
||||
|
||||
if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
|
||||
- this.level.setBlockAndUpdate(blockposition, iblockdata);
|
||||
if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
|
||||
- this.level().setBlockAndUpdate(blockposition, iblockdata);
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.level, blockposition, iblockdata, this)) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.level(), blockposition, iblockdata, this)) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level.gameEvent(GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(this, iblockdata));
|
||||
this.level().gameEvent(GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(this, iblockdata));
|
||||
}
|
||||
}
|
||||
@@ -145,6 +153,11 @@
|
||||
@@ -44,10 +44,10 @@
|
||||
+ // CraftBukkit end
|
||||
this.shear(SoundCategory.PLAYERS);
|
||||
this.gameEvent(GameEvent.SHEAR, entityhuman);
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -164,7 +177,9 @@
|
||||
this.level.playSound((EntityHuman) null, (Entity) this, SoundEffects.SNOW_GOLEM_SHEAR, soundcategory, 1.0F, 1.0F);
|
||||
if (!this.level.isClientSide()) {
|
||||
this.level().playSound((EntityHuman) null, (Entity) this, SoundEffects.SNOW_GOLEM_SHEAR, soundcategory, 1.0F, 1.0F);
|
||||
if (!this.level().isClientSide()) {
|
||||
this.setPumpkin(false);
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.spawnAtLocation(new ItemStack(Items.CARVED_PUMPKIN), 1.7F);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@@ -308,7 +308,9 @@
|
||||
protected void ageBoundaryReached() {
|
||||
super.ageBoundaryReached();
|
||||
if (!this.isBaby() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
if (!this.isBaby() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.spawnAtLocation(Items.SCUTE, 1);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
@@ -22,7 +22,7 @@
|
||||
private static class e extends ControllerMove {
|
||||
@@ -487,12 +491,16 @@
|
||||
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
|
||||
World world = this.turtle.level;
|
||||
World world = this.turtle.level();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), (IBlockData) Blocks.TURTLE_EGG.defaultBlockState().setValue(BlockTurtleEgg.EGGS, this.turtle.random.nextInt(4) + 1)).isCancelled()) {
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
@@ -298,7 +321,7 @@
|
||||
Entity entity = damagesource.getEntity();
|
||||
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
- this.setOrderedToSit(false);
|
||||
+ // this.setOrderedToSit(false); // CraftBukkit - moved into EntityLiving.damageEntity(DamageSource, float)
|
||||
}
|
||||
@@ -55,31 +55,31 @@
|
||||
} else {
|
||||
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(8.0D);
|
||||
}
|
||||
@@ -349,7 +372,7 @@
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
|
||||
- this.heal((float) item.getFoodProperties().getNutrition());
|
||||
+ this.heal((float) item.getFoodProperties().getNutrition(), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@@ -360,7 +383,7 @@
|
||||
this.setOrderedToSit(!this.isOrderedToSit());
|
||||
this.jumping = false;
|
||||
this.navigation.stop();
|
||||
- this.setTarget((EntityLiving) null);
|
||||
+ this.setTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@@ -382,7 +405,8 @@
|
||||
@@ -348,7 +371,7 @@
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
|
||||
- if (this.random.nextInt(3) == 0) {
|
||||
+ // CraftBukkit - added event call and isCancelled check.
|
||||
+ if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
|
||||
this.tame(entityhuman);
|
||||
- this.heal((float) item.getFoodProperties().getNutrition());
|
||||
+ this.heal((float) item.getFoodProperties().getNutrition(), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else {
|
||||
if (item instanceof ItemDye) {
|
||||
@@ -376,7 +399,7 @@
|
||||
this.setOrderedToSit(!this.isOrderedToSit());
|
||||
this.jumping = false;
|
||||
this.navigation.stop();
|
||||
this.setTarget((EntityLiving) null);
|
||||
- this.setTarget((EntityLiving) null);
|
||||
+ this.setTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else {
|
||||
return enuminteractionresult;
|
||||
@@ -387,7 +410,8 @@
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
|
||||
- if (this.random.nextInt(3) == 0) {
|
||||
+ // CraftBukkit - added event call and isCancelled check.
|
||||
+ if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
|
||||
this.tame(entityhuman);
|
||||
this.navigation.stop();
|
||||
this.setTarget((EntityLiving) null);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
+++ b/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
@@ -93,13 +93,14 @@
|
||||
private final DynamicGameEventListener<Allay.b> dynamicJukeboxListener;
|
||||
private final DynamicGameEventListener<Allay.a> dynamicJukeboxListener;
|
||||
private final InventorySubcontainer inventory = new InventorySubcontainer(1);
|
||||
@Nullable
|
||||
- private BlockPosition jukeboxPos;
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
public Allay(EntityTypes<? extends Allay> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -112,6 +113,12 @@
|
||||
this.dynamicJukeboxListener = new DynamicGameEventListener<>(new Allay.b(entitypositionsource, GameEvent.JUKEBOX_PLAY.getNotificationRadius()));
|
||||
@@ -111,6 +112,12 @@
|
||||
this.dynamicJukeboxListener = new DynamicGameEventListener<>(new Allay.a(this.vibrationUser.getPositionSource(), GameEvent.JUKEBOX_PLAY.getNotificationRadius()));
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@@ -30,7 +30,7 @@
|
||||
@Override
|
||||
protected BehaviorController.b<Allay> brainProvider() {
|
||||
return BehaviorController.provider(Allay.MEMORY_TYPES, Allay.SENSOR_TYPES);
|
||||
@@ -124,7 +131,7 @@
|
||||
@@ -123,7 +130,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<Allay> getBrain() {
|
||||
@@ -39,16 +39,16 @@
|
||||
}
|
||||
|
||||
public static AttributeProvider.Builder createAttributes() {
|
||||
@@ -231,7 +238,7 @@
|
||||
@@ -230,7 +237,7 @@
|
||||
public void aiStep() {
|
||||
super.aiStep();
|
||||
if (!this.level.isClientSide && this.isAlive() && this.tickCount % 10 == 0) {
|
||||
if (!this.level().isClientSide && this.isAlive() && this.tickCount % 10 == 0) {
|
||||
- this.heal(1.0F);
|
||||
+ this.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit
|
||||
}
|
||||
|
||||
if (this.isDancing() && this.shouldStopDancing() && this.tickCount % 20 == 0) {
|
||||
@@ -301,7 +308,12 @@
|
||||
@@ -300,7 +307,12 @@
|
||||
ItemStack itemstack1 = this.getItemInHand(EnumHand.MAIN_HAND);
|
||||
|
||||
if (this.isDancing() && this.isDuplicationItem(itemstack) && this.canDuplicate()) {
|
||||
@@ -59,59 +59,59 @@
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level.broadcastEntityEvent(this, (byte) 18);
|
||||
this.level.playSound(entityhuman, (Entity) this, SoundEffects.AMETHYST_BLOCK_CHIME, SoundCategory.NEUTRAL, 2.0F, 1.0F);
|
||||
this.level().broadcastEntityEvent(this, (byte) 18);
|
||||
this.level().playSound(entityhuman, (Entity) this, SoundEffects.AMETHYST_BLOCK_CHIME, SoundCategory.NEUTRAL, 2.0F, 1.0F);
|
||||
this.removeInteractionItem(entityhuman, itemstack);
|
||||
@@ -313,7 +325,7 @@
|
||||
@@ -311,7 +323,7 @@
|
||||
this.setItemInHand(EnumHand.MAIN_HAND, itemstack2);
|
||||
this.removeInteractionItem(entityhuman, itemstack);
|
||||
this.level.playSound(entityhuman, (Entity) this, SoundEffects.ALLAY_ITEM_GIVEN, SoundCategory.NEUTRAL, 2.0F, 1.0F);
|
||||
this.level().playSound(entityhuman, (Entity) this, SoundEffects.ALLAY_ITEM_GIVEN, SoundCategory.NEUTRAL, 2.0F, 1.0F);
|
||||
- this.getBrain().setMemory(MemoryModuleType.LIKED_PLAYER, (Object) entityhuman.getUUID());
|
||||
+ this.getBrain().setMemory(MemoryModuleType.LIKED_PLAYER, entityhuman.getUUID()); // CraftBukkit - decompile error
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else if (!itemstack1.isEmpty() && enumhand == EnumHand.MAIN_HAND && itemstack.isEmpty()) {
|
||||
this.setItemSlot(EnumItemSlot.MAINHAND, ItemStack.EMPTY);
|
||||
@@ -434,6 +446,7 @@
|
||||
@@ -432,6 +444,7 @@
|
||||
}
|
||||
|
||||
private boolean shouldStopDancing() {
|
||||
+ if (this.forceDancing) {return false;} // CraftBukkit
|
||||
return this.jukeboxPos == null || !this.jukeboxPos.closerToCenterThan(this.position(), (double) GameEvent.JUKEBOX_PLAY.getNotificationRadius()) || !this.level.getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
|
||||
return this.jukeboxPos == null || !this.jukeboxPos.closerToCenterThan(this.position(), (double) GameEvent.JUKEBOX_PLAY.getNotificationRadius()) || !this.level().getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
|
||||
}
|
||||
|
||||
@@ -478,7 +491,7 @@
|
||||
@@ -476,7 +489,7 @@
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
this.writeInventoryToTag(nbttagcompound);
|
||||
- DataResult dataresult = VibrationListener.codec(this.vibrationListenerConfig).encodeStart(DynamicOpsNBT.INSTANCE, (VibrationListener) this.dynamicVibrationListener.getListener());
|
||||
+ DataResult<net.minecraft.nbt.NBTBase> dataresult = VibrationListener.codec(this.vibrationListenerConfig).encodeStart(DynamicOpsNBT.INSTANCE, (VibrationListener) this.dynamicVibrationListener.getListener()); // CraftBukkit - decompile error
|
||||
- DataResult dataresult = VibrationSystem.a.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.vibrationData);
|
||||
+ DataResult<net.minecraft.nbt.NBTBase> dataresult = VibrationSystem.a.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.vibrationData); // CraftBukkit - decompile error
|
||||
Logger logger = Allay.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -494,7 +507,7 @@
|
||||
@@ -492,7 +505,7 @@
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
this.readInventoryFromTag(nbttagcompound);
|
||||
if (nbttagcompound.contains("listener", 10)) {
|
||||
- DataResult dataresult = VibrationListener.codec(this.vibrationListenerConfig).parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener")));
|
||||
+ DataResult<VibrationListener> dataresult = VibrationListener.codec(this.vibrationListenerConfig).parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener"))); // CraftBukkit - decompile error
|
||||
- DataResult dataresult = VibrationSystem.a.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener")));
|
||||
+ DataResult<VibrationSystem.a> dataresult = VibrationSystem.a.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener"))); // CraftBukkit - decompile error
|
||||
Logger logger = Allay.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -527,7 +540,7 @@
|
||||
@@ -525,7 +538,7 @@
|
||||
return Allay.DUPLICATION_ITEM.test(itemstack);
|
||||
}
|
||||
|
||||
- private void duplicateAllay() {
|
||||
+ public Allay duplicateAllay() { // CraftBukkit - return allay and private -> public
|
||||
Allay allay = (Allay) EntityTypes.ALLAY.create(this.level);
|
||||
Allay allay = (Allay) EntityTypes.ALLAY.create(this.level());
|
||||
|
||||
if (allay != null) {
|
||||
@@ -535,17 +548,17 @@
|
||||
@@ -533,17 +546,17 @@
|
||||
allay.setPersistenceRequired();
|
||||
allay.resetDuplicationCooldown();
|
||||
this.resetDuplicationCooldown();
|
||||
- this.level.addFreshEntity(allay);
|
||||
+ this.level.addFreshEntity(allay, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DUPLICATION); // CraftBukkit - reason for duplicated allay
|
||||
- this.level().addFreshEntity(allay);
|
||||
+ this.level().addFreshEntity(allay, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DUPLICATION); // CraftBukkit - reason for duplicated allay
|
||||
}
|
||||
-
|
||||
+ return allay; // CraftBukkit
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {
|
||||
+ // CraftBukkit start - Got milk?
|
||||
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.level, entityhuman, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET, enumhand);
|
||||
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.level(), entityhuman, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET, enumhand);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return EnumInteractionResult.PASS;
|
||||
@@ -37,4 +37,4 @@
|
||||
+ ItemStack itemstack1 = ItemLiquidUtil.createFilledResult(itemstack, entityhuman, CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit
|
||||
|
||||
entityhuman.setItemInHand(enumhand, itemstack1);
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
protected EntityHorseAbstract(EntityTypes<? extends EntityHorseAbstract> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -338,7 +341,7 @@
|
||||
@@ -334,7 +337,7 @@
|
||||
public void createInventory() {
|
||||
InventorySubcontainer inventorysubcontainer = this.inventory;
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
@@ -590,7 +593,7 @@
|
||||
super.aiStep();
|
||||
if (!this.level.isClientSide && this.isAlive()) {
|
||||
if (!this.level().isClientSide && this.isAlive()) {
|
||||
if (this.random.nextInt(900) == 0 && this.deathTime == 0) {
|
||||
- this.heal(1.0F);
|
||||
+ this.heal(1.0F, RegainReason.REGEN); // CraftBukkit
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
--- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||
+++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||
@@ -75,12 +75,21 @@
|
||||
@@ -82,14 +82,23 @@
|
||||
|
||||
public Sniffer(EntityTypes<? extends EntityAnimal> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
- this.entityData.define(Sniffer.DATA_STATE, Sniffer.a.IDLING);
|
||||
- this.entityData.define(Sniffer.DATA_STATE, Sniffer.State.IDLING);
|
||||
- this.entityData.define(Sniffer.DATA_DROP_SEED_AT_TICK, 0);
|
||||
+ // this.entityData.define(Sniffer.DATA_STATE, Sniffer.a.IDLING); // CraftBukkit - moved down to appropriate location
|
||||
+ // this.entityData.define(Sniffer.DATA_STATE, Sniffer.State.IDLING); // CraftBukkit - moved down to appropriate location
|
||||
+ // this.entityData.define(Sniffer.DATA_DROP_SEED_AT_TICK, 0); // CraftBukkit - moved down to appropriate location
|
||||
this.getNavigation().setCanFloat(true);
|
||||
this.setPathfindingMalus(PathType.WATER, -2.0F);
|
||||
this.setPathfindingMalus(PathType.WATER, -1.0F);
|
||||
this.setPathfindingMalus(PathType.DANGER_POWDER_SNOW, -1.0F);
|
||||
this.setPathfindingMalus(PathType.DAMAGE_CAUTIOUS, -1.0F);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - SPIGOT-7295: moved from constructor to appropriate location
|
||||
+ @Override
|
||||
+ protected void defineSynchedData() {
|
||||
+ super.defineSynchedData();
|
||||
+ this.entityData.define(Sniffer.DATA_STATE, Sniffer.a.IDLING);
|
||||
+ this.entityData.define(Sniffer.DATA_STATE, Sniffer.State.IDLING);
|
||||
+ this.entityData.define(Sniffer.DATA_DROP_SEED_AT_TICK, 0);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
@@ -24,67 +26,30 @@
|
||||
@Override
|
||||
protected float getStandingEyeHeight(EntityPose entitypose, EntitySize entitysize) {
|
||||
return this.getDimensions(entitypose).height * 0.6F;
|
||||
@@ -114,7 +123,7 @@
|
||||
return BlockPosition.containing(vec3d.x(), this.getY(), vec3d.z());
|
||||
}
|
||||
@@ -270,6 +279,13 @@
|
||||
ItemStack itemstack = (ItemStack) iterator.next();
|
||||
EntityItem entityitem = new EntityItem(worldserver, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack);
|
||||
|
||||
- private Sniffer.a getState() {
|
||||
+ public Sniffer.a getState() { // PAIL private -> public
|
||||
return (Sniffer.a) this.entityData.get(Sniffer.DATA_STATE);
|
||||
}
|
||||
+ // CraftBukkit start - handle EntityDropItemEvent
|
||||
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
worldserver.addFreshEntity(entityitem);
|
||||
}
|
||||
@@ -309,7 +325,7 @@
|
||||
List<GlobalPos> list = (List) this.getExploredPositions().limit(20L).collect(Collectors.toList());
|
||||
|
||||
@@ -207,7 +216,7 @@
|
||||
return this;
|
||||
}
|
||||
|
||||
- Optional<BlockPosition> calculateDigPosition() {
|
||||
+ public Optional<BlockPosition> calculateDigPosition() { // PAIL public
|
||||
return IntStream.range(0, 5).mapToObj((i) -> {
|
||||
return LandRandomPos.getPos(this, 10 + 2 * i, 3);
|
||||
}).filter(Objects::nonNull).map(BlockPosition::containing).map(BlockPosition::below).filter(this::canDig).findFirst();
|
||||
@@ -218,7 +227,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
- boolean canDig() {
|
||||
+ public boolean canDig() { // PAIL public
|
||||
return !this.isPanicking() && !this.isBaby() && !this.isInWater() && this.canDig(this.getHeadPosition().below());
|
||||
}
|
||||
|
||||
@@ -245,6 +254,13 @@
|
||||
BlockPosition blockposition = this.getHeadPosition();
|
||||
EntityItem entityitem = new EntityItem(this.level, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack);
|
||||
|
||||
+ // CraftBukkit start - handle EntityDropItemEvent
|
||||
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
this.level.addFreshEntity(entityitem);
|
||||
this.playSound(SoundEffects.SNIFFER_DROP_SEED, 1.0F, 1.0F);
|
||||
@@ -274,15 +290,15 @@
|
||||
return this;
|
||||
}
|
||||
|
||||
- private Sniffer storeExploredPosition(BlockPosition blockposition) {
|
||||
+ public Sniffer storeExploredPosition(BlockPosition blockposition) { // PAIL private -> public
|
||||
List<BlockPosition> list = (List) this.getExploredPositions().limit(20L).collect(Collectors.toList());
|
||||
|
||||
list.add(0, blockposition);
|
||||
list.add(0, GlobalPos.of(this.level().dimension(), blockposition));
|
||||
- this.getBrain().setMemory(MemoryModuleType.SNIFFER_EXPLORED_POSITIONS, (Object) list);
|
||||
+ this.getBrain().setMemory(MemoryModuleType.SNIFFER_EXPLORED_POSITIONS, list); // CraftBukkit - decompile error
|
||||
return this;
|
||||
}
|
||||
|
||||
- private Stream<BlockPosition> getExploredPositions() {
|
||||
+ public Stream<BlockPosition> getExploredPositions() { // PAIL private -> public
|
||||
return this.getBrain().getMemory(MemoryModuleType.SNIFFER_EXPLORED_POSITIONS).stream().flatMap(Collection::stream);
|
||||
}
|
||||
|
||||
@@ -416,7 +432,7 @@
|
||||
@@ -461,7 +477,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<Sniffer> getBrain() {
|
||||
|
||||
Reference in New Issue
Block a user