@@ -14,28 +14,28 @@
|
||||
+
|
||||
public interface Bucketable {
|
||||
|
||||
boolean isFromBucket();
|
||||
boolean fromBucket();
|
||||
@@ -92,10 +100,22 @@
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack.getItem() == Items.WATER_BUCKET && t0.isAlive()) {
|
||||
- t0.playSound(((Bucketable) t0).t(), 1.0F, 1.0F);
|
||||
- t0.playSound(((Bucketable) t0).getPickupSound(), 1.0F, 1.0F);
|
||||
+ // CraftBukkit start
|
||||
+ // t0.playSound(((Bucketable) t0).t(), 1.0F, 1.0F); // CraftBukkit - moved down
|
||||
ItemStack itemstack1 = ((Bucketable) t0).getBucketItem();
|
||||
+ // t0.playSound(((Bucketable) t0).getPickupSound(), 1.0F, 1.0F); // CraftBukkit - moved down
|
||||
ItemStack itemstack1 = ((Bucketable) t0).getBucketItemStack();
|
||||
|
||||
((Bucketable) t0).setBucketName(itemstack1);
|
||||
((Bucketable) t0).saveToBucketTag(itemstack1);
|
||||
+
|
||||
+ PlayerBucketEntityEvent playerBucketFishEvent = CraftEventFactory.callPlayerFishBucketEvent(t0, entityhuman, itemstack, itemstack1);
|
||||
+ itemstack1 = CraftItemStack.asNMSCopy(playerBucketFishEvent.getEntityBucket());
|
||||
+ if (playerBucketFishEvent.isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).containerMenu.updateInventory(); // We need to update inventory to resync client's bucket
|
||||
+ ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutSpawnEntityLiving(t0)); // We need to play out these packets as the client assumes the fish is gone
|
||||
+ ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutEntityMetadata(t0.getId(), t0.getDataWatcher(), true)); // Need to send data such as the display name to client
|
||||
+ ((EntityPlayer) entityhuman).containerMenu.sendAllDataToRemote(); // We need to update inventory to resync client's bucket
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutSpawnEntityLiving(t0)); // We need to play out these packets as the client assumes the fish is gone
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutEntityMetadata(t0.getId(), t0.getEntityData(), true)); // Need to send data such as the display name to client
|
||||
+ return Optional.of(EnumInteractionResult.FAIL);
|
||||
+ }
|
||||
+ t0.playSound(((Bucketable) t0).t(), 1.0F, 1.0F);
|
||||
+ t0.playSound(((Bucketable) t0).getPickupSound(), 1.0F, 1.0F);
|
||||
+ // CraftBukkit end
|
||||
ItemStack itemstack2 = ItemLiquidUtil.a(itemstack, entityhuman, itemstack1, false);
|
||||
ItemStack itemstack2 = ItemLiquidUtil.createFilledResult(itemstack, entityhuman, itemstack1, false);
|
||||
|
||||
entityhuman.a(enumhand, itemstack2);
|
||||
entityhuman.setItemInHand(enumhand, itemstack2);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityAnimal.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityAnimal.java
|
||||
@@ -28,11 +28,18 @@
|
||||
@@ -31,12 +31,19 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
|
||||
@@ -14,12 +14,13 @@
|
||||
|
||||
static final int PARENT_AGE_AFTER_BREEDING = 6000;
|
||||
public int inLove;
|
||||
@Nullable
|
||||
public UUID loveCause;
|
||||
+ public ItemStack breedItem; // CraftBukkit - Add breedItem variable
|
||||
|
||||
protected EntityAnimal(EntityTypes<? extends EntityAnimal> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -69,6 +76,9 @@
|
||||
@@ -73,6 +80,9 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -27,20 +28,20 @@
|
||||
+ // Function disabled as it has no special function anymore after
|
||||
+ // setSitting is disabled.
|
||||
@Override
|
||||
public boolean damageEntity(DamageSource damagesource, float f) {
|
||||
if (this.isInvulnerable(damagesource)) {
|
||||
@@ -78,6 +88,7 @@
|
||||
return super.damageEntity(damagesource, f);
|
||||
public boolean hurt(DamageSource damagesource, float f) {
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
@@ -82,6 +92,7 @@
|
||||
return super.hurt(damagesource, f);
|
||||
}
|
||||
}
|
||||
+ // CraftBukkit end */
|
||||
|
||||
@Override
|
||||
public float a(BlockPosition blockposition, IWorldReader iworldreader) {
|
||||
@@ -170,10 +181,17 @@
|
||||
public float getWalkTargetValue(BlockPosition blockposition, IWorldReader iworldreader) {
|
||||
@@ -178,10 +189,17 @@
|
||||
}
|
||||
|
||||
public void g(@Nullable EntityHuman entityhuman) {
|
||||
public void setInLove(@Nullable EntityHuman entityhuman) {
|
||||
- this.inLove = 600;
|
||||
+ // CraftBukkit start
|
||||
+ EntityEnterLoveModeEvent entityEnterLoveModeEvent = CraftEventFactory.callEntityEnterLoveModeEvent(entityhuman, this, 600);
|
||||
@@ -50,29 +51,29 @@
|
||||
+ this.inLove = entityEnterLoveModeEvent.getTicksInLove();
|
||||
+ // CraftBukkit end
|
||||
if (entityhuman != null) {
|
||||
this.loveCause = entityhuman.getUniqueID();
|
||||
this.loveCause = entityhuman.getUUID();
|
||||
}
|
||||
+ this.breedItem = entityhuman.getInventory().getItemInHand(); // CraftBukkit
|
||||
+ this.breedItem = entityhuman.getInventory().getSelected(); // CraftBukkit
|
||||
|
||||
this.level.broadcastEntityEffect(this, (byte) 18);
|
||||
this.level.broadcastEntityEvent(this, (byte) 18);
|
||||
}
|
||||
@@ -213,11 +231,26 @@
|
||||
EntityAgeable entityageable = this.createChild(worldserver, entityanimal);
|
||||
@@ -221,11 +239,26 @@
|
||||
EntityAgeable entityageable = this.getBreedOffspring(worldserver, entityanimal);
|
||||
|
||||
if (entityageable != null) {
|
||||
+ // CraftBukkit start - set persistence for tame animals
|
||||
+ if (entityageable instanceof EntityTameableAnimal && ((EntityTameableAnimal) entityageable).isTamed()) {
|
||||
+ if (entityageable instanceof EntityTameableAnimal && ((EntityTameableAnimal) entityageable).isTame()) {
|
||||
+ entityageable.setPersistenceRequired(true);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
EntityPlayer entityplayer = this.getBreedCause();
|
||||
EntityPlayer entityplayer = this.getLoveCause();
|
||||
|
||||
if (entityplayer == null && entityanimal.getBreedCause() != null) {
|
||||
entityplayer = entityanimal.getBreedCause();
|
||||
if (entityplayer == null && entityanimal.getLoveCause() != null) {
|
||||
entityplayer = entityanimal.getLoveCause();
|
||||
}
|
||||
+ // CraftBukkit start - call EntityBreedEvent
|
||||
+ entityageable.setBaby(true);
|
||||
+ entityageable.setPositionRotation(this.locX(), this.locY(), this.locZ(), 0.0F, 0.0F);
|
||||
+ 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()) {
|
||||
@@ -82,21 +83,21 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (entityplayer != null) {
|
||||
entityplayer.a(StatisticList.ANIMALS_BRED);
|
||||
@@ -228,12 +261,14 @@
|
||||
entityanimal.setAgeRaw(6000);
|
||||
entityplayer.awardStat(StatisticList.ANIMALS_BRED);
|
||||
@@ -236,12 +269,14 @@
|
||||
entityanimal.setAge(6000);
|
||||
this.resetLove();
|
||||
entityanimal.resetLove();
|
||||
- entityageable.setBaby(true);
|
||||
- entityageable.setPositionRotation(this.locX(), this.locY(), this.locZ(), 0.0F, 0.0F);
|
||||
- worldserver.addAllEntities(entityageable);
|
||||
+ worldserver.addAllEntities(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
|
||||
worldserver.broadcastEntityEffect(this, (byte) 18);
|
||||
- entityageable.moveTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F);
|
||||
- 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.addEntity(new EntityExperienceOrb(worldserver, this.locX(), this.locY(), this.locZ(), this.getRandom().nextInt(7) + 1));
|
||||
- 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.addEntity(new EntityExperienceOrb(worldserver, this.locX(), this.locY(), this.locZ(), experience));
|
||||
+ 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 @@
|
||||
@@ -244,7 +244,7 @@
|
||||
}
|
||||
|
||||
if (b0 > 0) {
|
||||
@@ -9,48 +9,48 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -642,11 +642,15 @@
|
||||
if (this.isInvulnerable(damagesource)) {
|
||||
@@ -644,11 +644,15 @@
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
- if (!this.level.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ boolean result = super.damageEntity(damagesource, f);
|
||||
+ boolean result = super.hurt(damagesource, f);
|
||||
+
|
||||
+ if (result && !this.level.isClientSide) {
|
||||
this.beePollinateGoal.l();
|
||||
this.beePollinateGoal.stopPollinating();
|
||||
}
|
||||
|
||||
- return super.damageEntity(damagesource, f);
|
||||
- return super.hurt(damagesource, f);
|
||||
+ return result;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1216,7 +1220,7 @@
|
||||
@@ -1224,7 +1228,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (flag) {
|
||||
+ if (flag && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(EntityBee.this, blockposition, iblockdata.set(blockstateinteger, (Integer) iblockdata.get(blockstateinteger) + 1)).isCancelled()) { // Spigot
|
||||
EntityBee.this.level.triggerEffect(2005, blockposition, 0);
|
||||
EntityBee.this.level.setTypeUpdate(blockposition, (IBlockData) iblockdata.set(blockstateinteger, (Integer) iblockdata.get(blockstateinteger) + 1));
|
||||
EntityBee.this.fS();
|
||||
@@ -1289,7 +1293,7 @@
|
||||
+ 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));
|
||||
EntityBee.this.incrementNumCropsGrownSincePollination();
|
||||
@@ -1297,7 +1301,7 @@
|
||||
@Override
|
||||
protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
if (entityinsentient instanceof EntityBee && this.mob.hasLineOfSight(entityliving)) {
|
||||
- entityinsentient.setGoalTarget(entityliving);
|
||||
+ entityinsentient.setGoalTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit - reason
|
||||
- entityinsentient.setTarget(entityliving);
|
||||
+ entityinsentient.setTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit - reason
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1298,7 +1302,7 @@
|
||||
@@ -1306,7 +1310,7 @@
|
||||
private static class c extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
|
||||
|
||||
c(EntityBee entitybee) {
|
||||
- Objects.requireNonNull(entitybee);
|
||||
+ // Objects.requireNonNull(entitybee); // CraftBukkit - decompile error
|
||||
super(entitybee, EntityHuman.class, 10, true, false, entitybee::a_);
|
||||
super(entitybee, EntityHuman.class, 10, true, false, entitybee::isAngryAt);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +1,15 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityCat.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityCat.java
|
||||
@@ -95,7 +95,7 @@
|
||||
public static final int TYPE_ALL_BLACK = 10;
|
||||
private static final int NUMBER_OF_CAT_TYPES = 11;
|
||||
private static final int NUMBER_OF_CAT_TYPES_EXCEPT_ALL_BLACK = 10;
|
||||
- public static final Map<Integer, MinecraftKey> TEXTURE_BY_TYPE = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> {
|
||||
+ public static final Map<Integer, MinecraftKey> TEXTURE_BY_TYPE = (Map) SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // CraftBukkit - decompile error
|
||||
hashmap.put(0, new MinecraftKey("textures/entity/cat/tabby.png"));
|
||||
hashmap.put(1, new MinecraftKey("textures/entity/cat/black.png"));
|
||||
hashmap.put(2, new MinecraftKey("textures/entity/cat/red.png"));
|
||||
@@ -433,7 +433,7 @@
|
||||
@@ -434,7 +434,7 @@
|
||||
}
|
||||
} else if (this.isBreedItem(itemstack)) {
|
||||
this.a(entityhuman, enumhand, itemstack);
|
||||
} else if (this.isFood(itemstack)) {
|
||||
this.usePlayerItem(entityhuman, enumhand, itemstack);
|
||||
- if (this.random.nextInt(3) == 0) {
|
||||
+ if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { // CraftBukkit
|
||||
this.tame(entityhuman);
|
||||
this.setWillSit(true);
|
||||
this.level.broadcastEntityEffect(this, (byte) 7);
|
||||
@@ -490,7 +490,7 @@
|
||||
this.setOrderedToSit(true);
|
||||
this.level.broadcastEntityEvent(this, (byte) 7);
|
||||
@@ -491,7 +491,7 @@
|
||||
private static class PathfinderGoalTemptChance extends PathfinderGoalTempt {
|
||||
|
||||
@Nullable
|
||||
@@ -27,11 +18,11 @@
|
||||
private final EntityCat cat;
|
||||
|
||||
public PathfinderGoalTemptChance(EntityCat entitycat, double d0, RecipeItemStack recipeitemstack, boolean flag) {
|
||||
@@ -629,7 +629,15 @@
|
||||
@@ -632,7 +632,15 @@
|
||||
while (iterator.hasNext()) {
|
||||
ItemStack itemstack = (ItemStack) iterator.next();
|
||||
|
||||
- this.cat.level.addEntity(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);
|
||||
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(this.cat.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
@@ -39,17 +30,17 @@
|
||||
+ if (event.isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ this.cat.level.addEntity(entityitem);
|
||||
+ this.cat.level.addFreshEntity(entityitem);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -661,10 +669,10 @@
|
||||
@@ -664,10 +672,10 @@
|
||||
private final EntityCat cat;
|
||||
|
||||
public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) {
|
||||
- Predicate predicate = IEntitySelector.NO_CREATIVE_OR_SPECTATOR;
|
||||
+ // Predicate predicate = IEntitySelector.e; // CraftBukkit - decompile error
|
||||
+ // Predicate predicate = IEntitySelector.NO_CREATIVE_OR_SPECTATOR; // CraftBukkit - decompile error
|
||||
|
||||
- Objects.requireNonNull(predicate);
|
||||
- super(entitycat, oclass, f, d0, d1, predicate::test);
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
@@ -75,6 +75,11 @@
|
||||
|
||||
@Override
|
||||
public void movementTick() {
|
||||
public void aiStep() {
|
||||
+ // CraftBukkit start
|
||||
+ if (this.isChickenJockey()) {
|
||||
+ this.setPersistenceRequired(!this.isTypeNotPersistent(0));
|
||||
+ this.setPersistenceRequired(!this.removeWhenFarAway(0));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
super.movementTick();
|
||||
super.aiStep();
|
||||
this.oFlap = this.flap;
|
||||
this.oFlapSpeed = this.flapSpeed;
|
||||
@@ -94,7 +99,9 @@
|
||||
@@ -17,7 +17,7 @@
|
||||
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.a((IMaterial) Items.EGG);
|
||||
this.spawnAtLocation((IMaterial) Items.EGG);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
this.eggTime = this.random.nextInt(6000) + 6000;
|
||||
}
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
|
||||
public EntityCow(EntityTypes<? extends EntityCow> entitytypes, World world) {
|
||||
@@ -82,8 +87,16 @@
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack.a(Items.BUCKET) && !this.isBaby()) {
|
||||
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {
|
||||
+ // CraftBukkit start - Got milk?
|
||||
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.level, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET);
|
||||
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.level, entityhuman, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return EnumInteractionResult.PASS;
|
||||
@@ -25,8 +25,8 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
entityhuman.playSound(SoundEffects.COW_MILK, 1.0F, 1.0F);
|
||||
- ItemStack itemstack1 = ItemLiquidUtil.a(itemstack, entityhuman, Items.MILK_BUCKET.createItemStack());
|
||||
+ ItemStack itemstack1 = ItemLiquidUtil.a(itemstack, entityhuman, CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit
|
||||
- ItemStack itemstack1 = ItemLiquidUtil.createFilledResult(itemstack, entityhuman, Items.MILK_BUCKET.getDefaultInstance());
|
||||
+ ItemStack itemstack1 = ItemLiquidUtil.createFilledResult(itemstack, entityhuman, CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit
|
||||
|
||||
entityhuman.a(enumhand, itemstack1);
|
||||
return EnumInteractionResult.a(this.level.isClientSide);
|
||||
entityhuman.setItemInHand(enumhand, itemstack1);
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
|
||||
@@ -1,46 +1,37 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityDolphin.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityDolphin.java
|
||||
@@ -176,7 +176,7 @@
|
||||
this.goalSelector.a(8, new EntityDolphin.c());
|
||||
this.goalSelector.a(8, new PathfinderGoalFollowBoat(this));
|
||||
this.goalSelector.a(9, new PathfinderGoalAvoidTarget<>(this, EntityGuardian.class, 8.0F, 1.0D, 1.0D));
|
||||
- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityGuardian.class})).a());
|
||||
+ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityGuardian.class})).a(new Class[0])); // CraftBukkit - decompile error
|
||||
}
|
||||
@@ -233,6 +233,12 @@
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
|
||||
public static AttributeProvider.Builder fw() {
|
||||
@@ -243,6 +243,12 @@
|
||||
ItemStack itemstack = entityitem.getItemStack();
|
||||
|
||||
if (this.canPickup(itemstack)) {
|
||||
if (this.canHoldItem(itemstack)) {
|
||||
+ // CraftBukkit start - call EntityPickupItemEvent
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, entityitem, 0, false).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ itemstack = entityitem.getItemStack(); // update ItemStack from event
|
||||
+ itemstack = entityitem.getItem(); // update ItemStack from event
|
||||
+ // CraftBukkit end
|
||||
this.a(entityitem);
|
||||
this.setSlot(EnumItemSlot.MAINHAND, itemstack);
|
||||
this.handDropChances[EnumItemSlot.MAINHAND.b()] = 2.0F;
|
||||
@@ -411,7 +417,7 @@
|
||||
this.onItemPickup(entityitem);
|
||||
this.setItemSlot(EnumItemSlot.MAINHAND, itemstack);
|
||||
this.handDropChances[EnumItemSlot.MAINHAND.getIndex()] = 2.0F;
|
||||
@@ -391,7 +397,7 @@
|
||||
|
||||
@Override
|
||||
public boolean a() {
|
||||
- return this.dolphin.gotFish() && this.dolphin.getAirTicks() >= 100;
|
||||
+ return this.dolphin.gotFish() && this.dolphin.getAirTicks() >= 100 && this.dolphin.level.getWorld().canGenerateStructures(); // MC-151364, SPIGOT-5494: hangs if generate-structures=false
|
||||
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
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -520,7 +526,7 @@
|
||||
@@ -501,7 +507,7 @@
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
public void start() {
|
||||
- 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
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -539,7 +545,7 @@
|
||||
@@ -520,7 +526,7 @@
|
||||
}
|
||||
|
||||
if (this.player.isSwimming() && this.player.level.random.nextInt(6) == 0) {
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityFish.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityFish.java
|
||||
@@ -68,7 +68,7 @@
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
@Override
|
||||
public boolean isTypeNotPersistent(double d0) {
|
||||
- return !this.isFromBucket() && !this.hasCustomName();
|
||||
public boolean removeWhenFarAway(double d0) {
|
||||
- return !this.fromBucket() && !this.hasCustomName();
|
||||
+ return true; // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,6 +90,7 @@
|
||||
@@ -81,6 +81,7 @@
|
||||
@Override
|
||||
public void setFromBucket(boolean flag) {
|
||||
this.entityData.set(EntityFish.FROM_BUCKET, flag);
|
||||
+ this.setPersistenceRequired(this.isPersistent()); // CraftBukkit - SPIGOT-4106 update persistence
|
||||
+ this.setPersistenceRequired(this.isPersistenceRequired()); // CraftBukkit - SPIGOT-4106 update persistence
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityFox.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityFox.java
|
||||
@@ -502,7 +502,8 @@
|
||||
protected void b(EntityItem entityitem) {
|
||||
ItemStack itemstack = entityitem.getItemStack();
|
||||
@@ -507,7 +507,8 @@
|
||||
protected void pickUpItem(EntityItem entityitem) {
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
|
||||
- if (this.canPickup(itemstack)) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, entityitem, itemstack.getCount() - 1, !this.canPickup(itemstack)).isCancelled()) { // CraftBukkit - call EntityPickupItemEvent
|
||||
+ itemstack = entityitem.getItemStack(); // CraftBukkit - update ItemStack from event
|
||||
- if (this.canHoldItem(itemstack)) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, entityitem, itemstack.getCount() - 1, !this.canHoldItem(itemstack)).isCancelled()) { // CraftBukkit - call EntityPickupItemEvent
|
||||
+ itemstack = entityitem.getItem(); // CraftBukkit - update ItemStack from event
|
||||
int i = itemstack.getCount();
|
||||
|
||||
if (i > 1) {
|
||||
@@ -857,6 +858,16 @@
|
||||
@@ -862,6 +863,16 @@
|
||||
if (entityplayer1 != null && entityplayer != entityplayer1) {
|
||||
entityfox.b(entityplayer1.getUniqueID());
|
||||
entityfox.addTrustedUUID(entityplayer1.getUUID());
|
||||
}
|
||||
+ // CraftBukkit start - call EntityBreedEvent
|
||||
+ entityfox.setAgeRaw(-24000);
|
||||
+ entityfox.setPositionRotation(this.animal.locX(), this.animal.locY(), this.animal.locZ(), 0.0F, 0.0F);
|
||||
+ entityfox.setAge(-24000);
|
||||
+ entityfox.moveTo(this.animal.getX(), this.animal.getY(), this.animal.getZ(), 0.0F, 0.0F);
|
||||
+ int experience = this.animal.getRandom().nextInt(7) + 1;
|
||||
+ org.bukkit.event.entity.EntityBreedEvent entityBreedEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(entityfox, animal, partner, entityplayer, this.animal.breedItem, experience);
|
||||
+ if (entityBreedEvent.isCancelled()) {
|
||||
@@ -26,47 +26,47 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (entityplayer2 != null) {
|
||||
entityplayer2.a(StatisticList.ANIMALS_BRED);
|
||||
@@ -867,12 +878,14 @@
|
||||
this.partner.setAgeRaw(6000);
|
||||
entityplayer2.awardStat(StatisticList.ANIMALS_BRED);
|
||||
@@ -872,12 +883,14 @@
|
||||
this.partner.setAge(6000);
|
||||
this.animal.resetLove();
|
||||
this.partner.resetLove();
|
||||
- entityfox.setAgeRaw(-24000);
|
||||
- entityfox.setPositionRotation(this.animal.locX(), this.animal.locY(), this.animal.locZ(), 0.0F, 0.0F);
|
||||
- worldserver.addAllEntities(entityfox);
|
||||
+ worldserver.addAllEntities(entityfox, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
|
||||
this.level.broadcastEntityEffect(this.animal, (byte) 18);
|
||||
- entityfox.setAge(-24000);
|
||||
- entityfox.moveTo(this.animal.getX(), this.animal.getY(), this.animal.getZ(), 0.0F, 0.0F);
|
||||
- worldserver.addFreshEntityWithPassengers(entityfox);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityfox, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
|
||||
this.level.broadcastEntityEvent(this.animal, (byte) 18);
|
||||
if (this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
- this.level.addEntity(new EntityExperienceOrb(this.level, this.animal.locX(), this.animal.locY(), this.animal.locZ(), this.animal.getRandom().nextInt(7) + 1));
|
||||
- this.level.addFreshEntity(new EntityExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), this.animal.getRandom().nextInt(7) + 1));
|
||||
+ // CraftBukkit start - use event experience
|
||||
+ if (experience > 0) {
|
||||
+ this.level.addEntity(new EntityExperienceOrb(this.level, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience));
|
||||
+ this.level.addFreshEntity(new EntityExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), experience));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1258,13 +1271,18 @@
|
||||
@@ -1268,13 +1281,18 @@
|
||||
}
|
||||
|
||||
private void a(IBlockData iblockdata) {
|
||||
- CaveVines.harvest(iblockdata, EntityFox.this.level, this.blockPos);
|
||||
+ CaveVines.harvest(iblockdata, EntityFox.this.level, this.blockPos, EntityFox.this); // CraftBukkit
|
||||
private void pickGlowBerry(IBlockData iblockdata) {
|
||||
- CaveVines.use(iblockdata, EntityFox.this.level, this.blockPos);
|
||||
+ CaveVines.use(iblockdata, EntityFox.this.level, this.blockPos, EntityFox.this); // CraftBukkit
|
||||
}
|
||||
|
||||
private void b(IBlockData iblockdata) {
|
||||
int i = (Integer) iblockdata.get(BlockSweetBerryBush.AGE);
|
||||
private void pickSweetBerries(IBlockData iblockdata) {
|
||||
int i = (Integer) iblockdata.getValue(BlockSweetBerryBush.AGE);
|
||||
|
||||
iblockdata.set(BlockSweetBerryBush.AGE, 1);
|
||||
iblockdata.setValue(BlockSweetBerryBush.AGE, 1);
|
||||
+ // CraftBukkit start - call EntityChangeBlockEvent
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(EntityFox.this, this.blockPos, iblockdata.set(BlockSweetBerryBush.AGE, 1)).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(EntityFox.this, this.blockPos, iblockdata.setValue(BlockSweetBerryBush.AGE, 1)).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
int j = 1 + EntityFox.this.level.random.nextInt(2) + (i == 3 ? 1 : 0);
|
||||
ItemStack itemstack = EntityFox.this.getEquipment(EnumItemSlot.MAINHAND);
|
||||
ItemStack itemstack = EntityFox.this.getItemBySlot(EnumItemSlot.MAINHAND);
|
||||
|
||||
@@ -1420,7 +1438,7 @@
|
||||
@@ -1431,7 +1449,7 @@
|
||||
private EntityLiving trustedLastHurt;
|
||||
private int timestamp;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
+++ b/net/minecraft/world/entity/animal/EntityIronGolem.java
|
||||
@@ -106,7 +106,7 @@
|
||||
@Override
|
||||
protected void A(Entity entity) {
|
||||
protected void doPush(Entity entity) {
|
||||
if (entity instanceof IMonster && !(entity instanceof EntityCreeper) && this.getRandom().nextInt(20) == 0) {
|
||||
- this.setGoalTarget((EntityLiving) entity);
|
||||
+ this.setGoalTarget((EntityLiving) entity, org.bukkit.event.entity.EntityTargetLivingEntityEvent.TargetReason.COLLISION, true); // CraftBukkit - set reason
|
||||
- this.setTarget((EntityLiving) entity);
|
||||
+ this.setTarget((EntityLiving) entity, org.bukkit.event.entity.EntityTargetLivingEntityEvent.TargetReason.COLLISION, true); // CraftBukkit - set reason
|
||||
}
|
||||
|
||||
super.A(entity);
|
||||
super.doPush(entity);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityMushroomCow.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityMushroomCow.java
|
||||
@@ -42,6 +42,13 @@
|
||||
@@ -44,6 +44,13 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
@@ -13,52 +13,52 @@
|
||||
+
|
||||
public class EntityMushroomCow extends EntityCow implements IShearable {
|
||||
|
||||
private static final DataWatcherObject<String> DATA_TYPE = DataWatcher.a(EntityMushroomCow.class, DataWatcherRegistry.STRING);
|
||||
@@ -113,6 +120,11 @@
|
||||
private static final DataWatcherObject<String> DATA_TYPE = DataWatcher.defineId(EntityMushroomCow.class, DataWatcherRegistry.STRING);
|
||||
@@ -117,6 +124,11 @@
|
||||
this.playSound(soundeffect, 1.0F, 1.0F);
|
||||
return EnumInteractionResult.a(this.level.isClientSide);
|
||||
} else if (itemstack.a(Items.SHEARS) && this.canShear()) {
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
} else if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.handlePlayerShearEntityEvent(entityhuman, this, itemstack, enumhand)) {
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.shear(SoundCategory.PLAYERS);
|
||||
this.a(GameEvent.SHEAR, (Entity) entityhuman);
|
||||
this.gameEvent(GameEvent.SHEAR, (Entity) entityhuman);
|
||||
if (!this.level.isClientSide) {
|
||||
@@ -160,7 +172,7 @@
|
||||
@@ -164,7 +176,7 @@
|
||||
this.level.playSound((EntityHuman) null, (Entity) this, SoundEffects.MOOSHROOM_SHEAR, soundcategory, 1.0F, 1.0F);
|
||||
if (!this.level.isClientSide()) {
|
||||
((WorldServer) this.level).a(Particles.EXPLOSION, this.locX(), this.e(0.5D), this.locZ(), 1, 0.0D, 0.0D, 0.0D, 0.0D);
|
||||
- this.die();
|
||||
+ // this.die(); // CraftBukkit - moved down
|
||||
EntityCow entitycow = (EntityCow) EntityTypes.COW.a(this.level);
|
||||
((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 entitycow = (EntityCow) EntityTypes.COW.create(this.level);
|
||||
|
||||
entitycow.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.getYRot(), this.getXRot());
|
||||
@@ -176,10 +188,25 @@
|
||||
entitycow.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
|
||||
@@ -180,10 +192,25 @@
|
||||
}
|
||||
|
||||
entitycow.setInvulnerable(this.isInvulnerable());
|
||||
- this.level.addEntity(entitycow);
|
||||
- this.level.addFreshEntity(entitycow);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ this.level.addEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
|
||||
+ this.level.addFreshEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
|
||||
+
|
||||
+ this.die(); // CraftBukkit - from above
|
||||
+ this.discard(); // CraftBukkit - from above
|
||||
+ // CraftBukkit end
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
- this.level.addEntity(new EntityItem(this.level, this.locX(), this.e(1.0D), this.locZ(), new ItemStack(this.getVariant().blockState.getBlock())));
|
||||
- this.level.addFreshEntity(new EntityItem(this.level, this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getMushroomType().blockState.getBlock())));
|
||||
+ // CraftBukkit start
|
||||
+ EntityItem entityitem = new EntityItem(this.level, this.locX(), this.e(1.0D), this.locZ(), new ItemStack(this.getVariant().blockState.getBlock()));
|
||||
+ EntityItem entityitem = new EntityItem(this.level, this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getMushroomType().blockState.getBlock()));
|
||||
+ EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ this.level.addEntity(entityitem);
|
||||
+ this.level.addFreshEntity(entityitem);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityOcelot.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityOcelot.java
|
||||
@@ -133,7 +133,7 @@
|
||||
@@ -134,7 +134,7 @@
|
||||
|
||||
@Override
|
||||
public boolean isTypeNotPersistent(double d0) {
|
||||
public boolean removeWhenFarAway(double d0) {
|
||||
- return !this.isTrusting() && this.tickCount > 2400;
|
||||
+ return !this.isTrusting() /*&& this.ticksLived > 2400*/; // CraftBukkit
|
||||
+ return !this.isTrusting() /*&& this.tickCount > 2400*/; // CraftBukkit
|
||||
}
|
||||
|
||||
public static AttributeProvider.Builder p() {
|
||||
@@ -182,7 +182,8 @@
|
||||
if ((this.temptGoal == null || this.temptGoal.h()) && !this.isTrusting() && this.isBreedItem(itemstack) && entityhuman.f((Entity) this) < 9.0D) {
|
||||
this.a(entityhuman, enumhand, itemstack);
|
||||
public static AttributeProvider.Builder createAttributes() {
|
||||
@@ -183,7 +183,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.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.w(true);
|
||||
this.level.broadcastEntityEffect(this, (byte) 41);
|
||||
@@ -312,10 +313,10 @@
|
||||
this.spawnTrustingParticles(true);
|
||||
this.level.broadcastEntityEvent(this, (byte) 41);
|
||||
@@ -313,10 +314,10 @@
|
||||
private final EntityOcelot ocelot;
|
||||
|
||||
public a(EntityOcelot entityocelot, Class<T> oclass, float f, double d0, double d1) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityPanda.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityPanda.java
|
||||
@@ -65,6 +65,8 @@
|
||||
@@ -64,6 +64,8 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -8,17 +8,17 @@
|
||||
+
|
||||
public class EntityPanda extends EntityAnimal {
|
||||
|
||||
private static final DataWatcherObject<Integer> UNHAPPY_COUNTER = DataWatcher.a(EntityPanda.class, DataWatcherRegistry.INT);
|
||||
@@ -525,7 +527,7 @@
|
||||
private static final DataWatcherObject<Integer> UNHAPPY_COUNTER = DataWatcher.defineId(EntityPanda.class, DataWatcherRegistry.INT);
|
||||
@@ -526,7 +528,7 @@
|
||||
|
||||
@Override
|
||||
protected void b(EntityItem entityitem) {
|
||||
- if (this.getEquipment(EnumItemSlot.MAINHAND).isEmpty() && EntityPanda.PANDA_ITEMS.test(entityitem)) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, entityitem, 0, !(this.getEquipment(EnumItemSlot.MAINHAND).isEmpty() && EntityPanda.PANDA_ITEMS.test(entityitem))).isCancelled()) { // CraftBukkit
|
||||
this.a(entityitem);
|
||||
ItemStack itemstack = entityitem.getItemStack();
|
||||
protected void pickUpItem(EntityItem entityitem) {
|
||||
- if (this.getItemBySlot(EnumItemSlot.MAINHAND).isEmpty() && EntityPanda.PANDA_ITEMS.test(entityitem)) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, entityitem, 0, !(this.getItemBySlot(EnumItemSlot.MAINHAND).isEmpty() && EntityPanda.PANDA_ITEMS.test(entityitem))).isCancelled()) { // CraftBukkit
|
||||
this.onItemPickup(entityitem);
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
|
||||
@@ -881,10 +883,10 @@
|
||||
@@ -882,10 +884,10 @@
|
||||
private final EntityPanda panda;
|
||||
|
||||
public c(EntityPanda entitypanda, Class<T> oclass, float f, double d0, double d1) {
|
||||
@@ -32,12 +32,12 @@
|
||||
this.panda = entitypanda;
|
||||
}
|
||||
|
||||
@@ -1131,7 +1133,7 @@
|
||||
@@ -1132,7 +1134,7 @@
|
||||
@Override
|
||||
protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
if (entityinsentient instanceof EntityPanda && ((EntityPanda) entityinsentient).isAggressive()) {
|
||||
- entityinsentient.setGoalTarget(entityliving);
|
||||
+ entityinsentient.setGoalTarget(entityliving, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit
|
||||
- entityinsentient.setTarget(entityliving);
|
||||
+ entityinsentient.setTarget(entityliving, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,47 +1,38 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityParrot.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityParrot.java
|
||||
@@ -75,7 +75,7 @@
|
||||
private static final Item POISONOUS_FOOD = Items.COOKIE;
|
||||
private static final Set<Item> TAME_FOOD = Sets.newHashSet(new Item[]{Items.WHEAT_SEEDS, Items.MELON_SEEDS, Items.PUMPKIN_SEEDS, Items.BEETROOT_SEEDS});
|
||||
private static final int VARIANTS = 5;
|
||||
- static final Map<EntityTypes<?>, SoundEffect> MOB_SOUND_MAP = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> {
|
||||
+ static final Map<EntityTypes<?>, SoundEffect> MOB_SOUND_MAP = (Map) SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // CraftBukkit - decompile error
|
||||
hashmap.put(EntityTypes.BLAZE, SoundEffects.PARROT_IMITATE_BLAZE);
|
||||
hashmap.put(EntityTypes.CAVE_SPIDER, SoundEffects.PARROT_IMITATE_SPIDER);
|
||||
hashmap.put(EntityTypes.CREEPER, SoundEffects.PARROT_IMITATE_CREEPER);
|
||||
@@ -253,7 +253,7 @@
|
||||
@@ -258,7 +258,7 @@
|
||||
}
|
||||
|
||||
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.broadcastEntityEffect(this, (byte) 7);
|
||||
this.level.broadcastEntityEvent(this, (byte) 7);
|
||||
} else {
|
||||
@@ -267,7 +267,7 @@
|
||||
itemstack.subtract(1);
|
||||
@@ -272,7 +272,7 @@
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
|
||||
- this.addEffect(new MobEffect(MobEffects.POISON, 900));
|
||||
+ this.addEffect(new MobEffect(MobEffects.POISON, 900), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // CraftBukkit
|
||||
if (entityhuman.isCreative() || !this.isInvulnerable()) {
|
||||
this.damageEntity(DamageSource.playerAttack(entityhuman), Float.MAX_VALUE);
|
||||
this.hurt(DamageSource.playerAttack(entityhuman), Float.MAX_VALUE);
|
||||
}
|
||||
@@ -381,7 +381,7 @@
|
||||
@@ -384,7 +384,7 @@
|
||||
|
||||
@Override
|
||||
public boolean isCollidable() {
|
||||
public boolean isPushable() {
|
||||
- return true;
|
||||
+ return super.isCollidable(); // CraftBukkit - collidable API
|
||||
+ return super.isPushable(); // CraftBukkit - collidable API
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -396,7 +396,7 @@
|
||||
if (this.isInvulnerable(damagesource)) {
|
||||
@@ -399,7 +399,7 @@
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
- this.setWillSit(false);
|
||||
+ // this.setWillSit(false); // CraftBukkit - moved into EntityLiving.damageEntity(DamageSource, float)
|
||||
return super.damageEntity(damagesource, f);
|
||||
- this.setOrderedToSit(false);
|
||||
+ // this.setOrderedToSit(false); // CraftBukkit - moved into EntityLiving.damageEntity(DamageSource, float)
|
||||
return super.hurt(damagesource, f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityPig.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityPig.java
|
||||
@@ -50,6 +50,10 @@
|
||||
@@ -49,6 +49,10 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -10,19 +10,19 @@
|
||||
+
|
||||
public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable {
|
||||
|
||||
private static final DataWatcherObject<Boolean> DATA_SADDLE_ID = DataWatcher.a(EntityPig.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -251,7 +255,13 @@
|
||||
private static final DataWatcherObject<Boolean> DATA_SADDLE_ID = DataWatcher.defineId(EntityPig.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -250,7 +254,13 @@
|
||||
}
|
||||
|
||||
entitypigzombie.setPersistent();
|
||||
- worldserver.addEntity(entitypigzombie);
|
||||
entitypigzombie.setPersistenceRequired();
|
||||
- worldserver.addFreshEntity(entitypigzombie);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit - added a reason for spawning this creature
|
||||
+ worldserver.addEntity(entitypigzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
|
||||
+ worldserver.addFreshEntity(entitypigzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
|
||||
+ // CraftBukkit end
|
||||
this.die();
|
||||
this.discard();
|
||||
} else {
|
||||
super.onLightningStrike(worldserver, entitylightning);
|
||||
super.thunderHit(worldserver, entitylightning);
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
@@ -144,7 +144,7 @@
|
||||
int i = this.getPuffState();
|
||||
|
||||
if (entityinsentient.damageEntity(DamageSource.mobAttack(this), (float) (1 + i))) {
|
||||
if (entityinsentient.hurt(DamageSource.mobAttack(this), (float) (1 + i))) {
|
||||
- entityinsentient.addEffect(new MobEffect(MobEffects.POISON, 60 * i, 0), this);
|
||||
+ entityinsentient.addEffect(new MobEffect(MobEffects.POISON, 60 * i, 0), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
this.playSound(SoundEffects.PUFFER_FISH_STING, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.PUFFER_FISH_STING, 0.0F));
|
||||
((EntityPlayer) entityhuman).connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.PUFFER_FISH_STING, 0.0F));
|
||||
}
|
||||
|
||||
- entityhuman.addEffect(new MobEffect(MobEffects.POISON, 60 * i, 0), this);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityRabbit.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityRabbit.java
|
||||
@@ -86,8 +86,14 @@
|
||||
@@ -88,8 +88,14 @@
|
||||
super(entitytypes, world);
|
||||
this.jumpControl = new EntityRabbit.ControllerJumpRabbit(this);
|
||||
this.moveControl = new EntityRabbit.ControllerMoveRabbit(this);
|
||||
@@ -9,42 +9,33 @@
|
||||
+
|
||||
+ // CraftBukkit start - code from constructor
|
||||
+ public void initializePathFinderGoals(){
|
||||
this.i(0.0D);
|
||||
this.setSpeedModifier(0.0D);
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
@Override
|
||||
public void initPathfinder() {
|
||||
@@ -353,7 +359,7 @@
|
||||
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()) {
|
||||
public void registerGoals() {
|
||||
@@ -556,9 +562,23 @@
|
||||
int i = (Integer) iblockdata.get(BlockCarrots.AGE);
|
||||
int i = (Integer) iblockdata.getValue(BlockCarrots.AGE);
|
||||
|
||||
if (i == 0) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.rabbit, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.rabbit, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 2);
|
||||
world.a(blockposition, true, this.rabbit);
|
||||
world.setBlock(blockposition, Blocks.AIR.defaultBlockState(), 2);
|
||||
world.destroyBlock(blockposition, true, this.rabbit);
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(
|
||||
+ this.rabbit,
|
||||
+ blockposition,
|
||||
+ iblockdata.set(BlockCarrots.AGE, i - 1)
|
||||
+ iblockdata.setValue(BlockCarrots.AGE, i - 1)
|
||||
+ ).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockCarrots.AGE, i - 1), 2);
|
||||
world.triggerEffect(2001, blockposition, Block.getCombinedId(iblockdata));
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockCarrots.AGE, i - 1), 2);
|
||||
world.levelEvent(2001, blockposition, Block.getId(iblockdata));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntitySheep.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntitySheep.java
|
||||
@@ -64,11 +64,19 @@
|
||||
@@ -63,6 +63,14 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.level.storage.loot.LootTables;
|
||||
|
||||
@@ -15,38 +15,32 @@
|
||||
public class EntitySheep extends EntityAnimal implements IShearable {
|
||||
|
||||
private static final int EAT_ANIMATION_TICKS = 40;
|
||||
private static final DataWatcherObject<Byte> DATA_WOOL_ID = DataWatcher.a(EntitySheep.class, DataWatcherRegistry.BYTE);
|
||||
- private static final Map<EnumColor, IMaterial> ITEM_BY_DYE = (Map) SystemUtils.a((Object) Maps.newEnumMap(EnumColor.class), (enummap) -> {
|
||||
+ private static final Map<EnumColor, IMaterial> ITEM_BY_DYE = (Map) SystemUtils.a(Maps.newEnumMap(EnumColor.class), (enummap) -> { // CraftBukkit - decompile error
|
||||
enummap.put(EnumColor.WHITE, Blocks.WHITE_WOOL);
|
||||
enummap.put(EnumColor.ORANGE, Blocks.ORANGE_WOOL);
|
||||
enummap.put(EnumColor.MAGENTA, Blocks.MAGENTA_WOOL);
|
||||
@@ -223,6 +231,11 @@
|
||||
@@ -222,6 +230,11 @@
|
||||
|
||||
if (itemstack.a(Items.SHEARS)) {
|
||||
if (!this.level.isClientSide && this.canShear()) {
|
||||
if (itemstack.is(Items.SHEARS)) {
|
||||
if (!this.level.isClientSide && this.readyForShearing()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.handlePlayerShearEntityEvent(entityhuman, this, itemstack, enumhand)) {
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.shear(SoundCategory.PLAYERS);
|
||||
this.a(GameEvent.SHEAR, (Entity) entityhuman);
|
||||
itemstack.damage(1, entityhuman, (entityhuman1) -> {
|
||||
@@ -244,7 +257,9 @@
|
||||
this.gameEvent(GameEvent.SHEAR, (Entity) entityhuman);
|
||||
itemstack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
|
||||
@@ -243,7 +256,9 @@
|
||||
int i = 1 + this.random.nextInt(3);
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
EntityItem entityitem = this.a((IMaterial) EntitySheep.ITEM_BY_DYE.get(this.getColor()), 1);
|
||||
EntityItem entityitem = this.spawnAtLocation((IMaterial) EntitySheep.ITEM_BY_DYE.get(this.getColor()), 1);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
|
||||
if (entityitem != null) {
|
||||
entityitem.setMot(entityitem.getMot().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)));
|
||||
@@ -334,6 +349,12 @@
|
||||
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)));
|
||||
@@ -333,6 +348,12 @@
|
||||
|
||||
@Override
|
||||
public void blockEaten() {
|
||||
public void ate() {
|
||||
+ // CraftBukkit start
|
||||
+ SheepRegrowWoolEvent event = new SheepRegrowWoolEvent((org.bukkit.entity.Sheep) this.getBukkitEntity());
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
@@ -55,20 +49,18 @@
|
||||
+ // CraftBukkit end
|
||||
this.setSheared(false);
|
||||
if (this.isBaby()) {
|
||||
this.setAge(60);
|
||||
@@ -352,8 +373,8 @@
|
||||
this.ageUp(60);
|
||||
@@ -351,7 +372,7 @@
|
||||
EnumColor enumcolor = ((EntitySheep) entityanimal).getColor();
|
||||
EnumColor enumcolor1 = ((EntitySheep) entityanimal1).getColor();
|
||||
InventoryCrafting inventorycrafting = a(enumcolor, enumcolor1);
|
||||
- Optional optional = this.level.getCraftingManager().craft(Recipes.CRAFTING, inventorycrafting, this.level).map((recipecrafting) -> {
|
||||
- return recipecrafting.a((IInventory) inventorycrafting);
|
||||
+ Optional<Item> optional = this.level.getCraftingManager().craft(Recipes.CRAFTING, inventorycrafting, this.level).map((recipecrafting) -> { // Eclipse fail
|
||||
+ return recipecrafting.a(inventorycrafting); // CraftBukkit - decompile error
|
||||
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);
|
||||
}).map(ItemStack::getItem);
|
||||
|
||||
Objects.requireNonNull(ItemDye.class);
|
||||
@@ -370,10 +391,18 @@
|
||||
public boolean canUse(EntityHuman entityhuman) {
|
||||
@@ -369,10 +390,18 @@
|
||||
public boolean stillValid(EntityHuman entityhuman) {
|
||||
return false;
|
||||
}
|
||||
+
|
||||
@@ -80,8 +72,8 @@
|
||||
+ // CraftBukkit end
|
||||
}, 2, 1);
|
||||
|
||||
inventorycrafting.setItem(0, new ItemStack(ItemDye.a(enumcolor)));
|
||||
inventorycrafting.setItem(1, new ItemStack(ItemDye.a(enumcolor1)));
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -10,43 +10,43 @@
|
||||
+
|
||||
public class EntitySnowman extends EntityGolem implements IShearable, IRangedEntity {
|
||||
|
||||
private static final DataWatcherObject<Byte> DATA_PUMPKIN_ID = DataWatcher.a(EntitySnowman.class, DataWatcherRegistry.BYTE);
|
||||
private static final DataWatcherObject<Byte> DATA_PUMPKIN_ID = DataWatcher.defineId(EntitySnowman.class, DataWatcherRegistry.BYTE);
|
||||
@@ -100,7 +104,7 @@
|
||||
int k = MathHelper.floor(this.locZ());
|
||||
int k = MathHelper.floor(this.getZ());
|
||||
|
||||
if (this.level.getBiome(new BlockPosition(i, 0, k)).getAdjustedTemperature(new BlockPosition(i, j, k)) > 1.0F) {
|
||||
- this.damageEntity(DamageSource.ON_FIRE, 1.0F);
|
||||
+ this.damageEntity(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
|
||||
if (this.level.getBiome(new BlockPosition(i, 0, k)).getTemperature(new BlockPosition(i, j, k)) > 1.0F) {
|
||||
- this.hurt(DamageSource.ON_FIRE, 1.0F);
|
||||
+ this.hurt(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
|
||||
}
|
||||
|
||||
if (!this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
@@ -116,7 +120,7 @@
|
||||
BlockPosition blockposition = new BlockPosition(i, j, k);
|
||||
|
||||
if (this.level.getType(blockposition).isAir() && this.level.getBiome(blockposition).getAdjustedTemperature(blockposition) < 0.8F && iblockdata.canPlace(this.level, blockposition)) {
|
||||
- this.level.setTypeUpdate(blockposition, iblockdata);
|
||||
if (this.level.getBlockState(blockposition).isAir() && this.level.getBiome(blockposition).getTemperature(blockposition) < 0.8F && iblockdata.canSurvive(this.level, blockposition)) {
|
||||
- this.level.setBlockAndUpdate(blockposition, iblockdata);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.level, blockposition, iblockdata, this); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,6 +151,11 @@
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack.a(Items.SHEARS) && this.canShear()) {
|
||||
if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.handlePlayerShearEntityEvent(entityhuman, this, itemstack, enumhand)) {
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.shear(SoundCategory.PLAYERS);
|
||||
this.a(GameEvent.SHEAR, (Entity) entityhuman);
|
||||
this.gameEvent(GameEvent.SHEAR, (Entity) entityhuman);
|
||||
if (!this.level.isClientSide) {
|
||||
@@ -166,7 +175,9 @@
|
||||
this.level.playSound((EntityHuman) null, (Entity) this, SoundEffects.SNOW_GOLEM_SHEAR, soundcategory, 1.0F, 1.0F);
|
||||
if (!this.level.isClientSide()) {
|
||||
this.setHasPumpkin(false);
|
||||
this.setPumpkin(false);
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.a(new ItemStack(Items.CARVED_PUMPKIN), 1.7F);
|
||||
this.spawnAtLocation(new ItemStack(Items.CARVED_PUMPKIN), 1.7F);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
}
|
||||
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
+// mc-dev import
|
||||
package net.minecraft.world.entity.animal;
|
||||
|
||||
import java.util.Random;
|
||||
import net.minecraft.core.BlockPosition;
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityTurtle.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityTurtle.java
|
||||
@@ -314,7 +314,9 @@
|
||||
protected void n() {
|
||||
super.n();
|
||||
@@ -311,7 +311,9 @@
|
||||
protected void ageBoundaryReached() {
|
||||
super.ageBoundaryReached();
|
||||
if (!this.isBaby() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.a((IMaterial) Items.SCUTE, 1);
|
||||
this.spawnAtLocation(Items.SCUTE, 1);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -341,7 +343,9 @@
|
||||
@@ -338,7 +340,9 @@
|
||||
|
||||
@Override
|
||||
public void onLightningStrike(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = entitylightning; // CraftBukkit
|
||||
this.damageEntity(DamageSource.LIGHTNING_BOLT, Float.MAX_VALUE);
|
||||
this.hurt(DamageSource.LIGHTNING_BOLT, Float.MAX_VALUE);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = null; // CraftBukkit
|
||||
}
|
||||
|
||||
private static class e extends ControllerMove {
|
||||
@@ -487,8 +491,12 @@
|
||||
} else if (this.turtle.layEggCounter > 200) {
|
||||
@@ -484,8 +488,12 @@
|
||||
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
|
||||
World world = this.turtle.level;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.up(), (IBlockData) Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.EGGS, this.turtle.random.nextInt(4) + 1)).isCancelled()) {
|
||||
+ 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()) {
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.TURTLE_LAY_EGG, SoundCategory.BLOCKS, 0.3F, 0.9F + world.random.nextFloat() * 0.2F);
|
||||
world.setTypeAndData(this.blockPos.up(), (IBlockData) Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.EGGS, this.turtle.random.nextInt(4) + 1), 3);
|
||||
world.setBlock(this.blockPos.above(), (IBlockData) Blocks.TURTLE_EGG.defaultBlockState().setValue(BlockTurtleEgg.EGGS, this.turtle.random.nextInt(4) + 1), 3);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.turtle.setHasEgg(false);
|
||||
this.turtle.w(false);
|
||||
this.turtle.setLoveTicks(600);
|
||||
this.turtle.setLayingEgg(false);
|
||||
this.turtle.setInLoveTime(600);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityWolf.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityWolf.java
|
||||
@@ -63,6 +63,11 @@
|
||||
@@ -68,6 +68,11 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -11,27 +11,18 @@
|
||||
+
|
||||
public class EntityWolf extends EntityTameableAnimal implements IEntityAngerable {
|
||||
|
||||
private static final DataWatcherObject<Boolean> DATA_INTERESTED_ID = DataWatcher.a(EntityWolf.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -104,7 +109,7 @@
|
||||
this.goalSelector.a(10, new PathfinderGoalRandomLookaround(this));
|
||||
this.targetSelector.a(1, new PathfinderGoalOwnerHurtByTarget(this));
|
||||
this.targetSelector.a(2, new PathfinderGoalOwnerHurtTarget(this));
|
||||
- this.targetSelector.a(3, (new PathfinderGoalHurtByTarget(this, new Class[0])).a());
|
||||
+ this.targetSelector.a(3, (new PathfinderGoalHurtByTarget(this, new Class[0])).a(new Class[0])); // CraftBukkit - decompile error
|
||||
this.targetSelector.a(4, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::a_));
|
||||
this.targetSelector.a(5, new PathfinderGoalRandomTargetNonTamed<>(this, EntityAnimal.class, false, EntityWolf.PREY_SELECTOR));
|
||||
this.targetSelector.a(6, new PathfinderGoalRandomTargetNonTamed<>(this, EntityTurtle.class, false, EntityTurtle.BABY_ON_LAND_SELECTOR));
|
||||
@@ -116,6 +121,24 @@
|
||||
return EntityInsentient.w().a(GenericAttributes.MOVEMENT_SPEED, 0.30000001192092896D).a(GenericAttributes.MAX_HEALTH, 8.0D).a(GenericAttributes.ATTACK_DAMAGE, 2.0D);
|
||||
private static final DataWatcherObject<Boolean> DATA_INTERESTED_ID = DataWatcher.defineId(EntityWolf.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -122,6 +127,24 @@
|
||||
return EntityInsentient.createMobAttributes().add(GenericAttributes.MOVEMENT_SPEED, 0.30000001192092896D).add(GenericAttributes.MAX_HEALTH, 8.0D).add(GenericAttributes.ATTACK_DAMAGE, 2.0D);
|
||||
}
|
||||
|
||||
+ // CraftBukkit - add overriden version
|
||||
+ @Override
|
||||
+ public boolean setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fire) {
|
||||
+ if (!super.setGoalTarget(entityliving, reason, fire)) {
|
||||
+ public boolean setTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fire) {
|
||||
+ if (!super.setTarget(entityliving, reason, fire)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ entityliving = getGoalTarget();
|
||||
+ entityliving = getTarget();
|
||||
+ /* // PAIL
|
||||
+ if (entityliving == null) {
|
||||
+ this.setAngry(false);
|
||||
@@ -44,51 +35,51 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
protected void initDatawatcher() {
|
||||
super.initDatawatcher();
|
||||
@@ -287,7 +310,7 @@
|
||||
protected void defineSynchedData() {
|
||||
super.defineSynchedData();
|
||||
@@ -293,7 +316,7 @@
|
||||
} else {
|
||||
Entity entity = damagesource.getEntity();
|
||||
|
||||
- this.setWillSit(false);
|
||||
- this.setOrderedToSit(false);
|
||||
+ // this.setWillSit(false); // CraftBukkit - moved into EntityLiving.damageEntity(DamageSource, float)
|
||||
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
|
||||
f = (f + 1.0F) / 2.0F;
|
||||
}
|
||||
@@ -312,7 +335,7 @@
|
||||
super.setTamed(flag);
|
||||
@@ -318,7 +341,7 @@
|
||||
super.setTame(flag);
|
||||
if (flag) {
|
||||
this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(20.0D);
|
||||
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(20.0D);
|
||||
- this.setHealth(20.0F);
|
||||
+ this.setHealth(this.getMaxHealth()); // CraftBukkit - 20.0 -> getMaxHealth()
|
||||
} else {
|
||||
this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(8.0D);
|
||||
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(8.0D);
|
||||
}
|
||||
@@ -336,7 +359,7 @@
|
||||
itemstack.subtract(1);
|
||||
@@ -342,7 +365,7 @@
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
|
||||
- this.heal((float) item.getFoodInfo().getNutrition());
|
||||
+ this.heal((float) item.getFoodInfo().getNutrition(), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit
|
||||
this.a(GameEvent.MOB_INTERACT, this.cT());
|
||||
- this.heal((float) item.getFoodProperties().getNutrition());
|
||||
+ this.heal((float) item.getFoodProperties().getNutrition(), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit
|
||||
this.gameEvent(GameEvent.MOB_INTERACT, this.eyeBlockPosition());
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
}
|
||||
@@ -348,7 +371,7 @@
|
||||
this.setWillSit(!this.isWillSit());
|
||||
@@ -354,7 +377,7 @@
|
||||
this.setOrderedToSit(!this.isOrderedToSit());
|
||||
this.jumping = false;
|
||||
this.navigation.o();
|
||||
- this.setGoalTarget((EntityLiving) null);
|
||||
+ this.setGoalTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
|
||||
this.navigation.stop();
|
||||
- this.setTarget((EntityLiving) null);
|
||||
+ this.setTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@@ -370,7 +393,8 @@
|
||||
itemstack.subtract(1);
|
||||
@@ -376,7 +399,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.o();
|
||||
this.setGoalTarget((EntityLiving) null);
|
||||
this.navigation.stop();
|
||||
this.setTarget((EntityLiving) null);
|
||||
|
||||
@@ -1,33 +1,24 @@
|
||||
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
||||
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
||||
@@ -68,7 +68,8 @@
|
||||
@@ -69,7 +69,8 @@
|
||||
|
||||
public static final int TOTAL_PLAYDEAD_TIME = 200;
|
||||
protected static final ImmutableList<? extends SensorType<? extends Sensor<? super Axolotl>>> SENSOR_TYPES = ImmutableList.of(SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_ADULT, SensorType.HURT_BY, SensorType.AXOLOTL_ATTACKABLES, SensorType.AXOLOTL_TEMPTATIONS);
|
||||
- protected static final ImmutableList<? extends MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.BREED_TARGET, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.NEAREST_VISIBLE_ADULT, new MemoryModuleType[]{MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.PLAY_DEAD_TICKS, MemoryModuleType.NEAREST_ATTACKABLE, MemoryModuleType.TEMPTING_PLAYER, MemoryModuleType.TEMPTATION_COOLDOWN_TICKS, MemoryModuleType.IS_TEMPTED, MemoryModuleType.HAS_HUNTING_COOLDOWN});
|
||||
+ // CraftBukkit - decompile error
|
||||
+ protected static final ImmutableList<? extends MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.<MemoryModuleType<?>>of(MemoryModuleType.BREED_TARGET, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.NEAREST_VISIBLE_ADULT, new MemoryModuleType[]{MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.PLAY_DEAD_TICKS, MemoryModuleType.NEAREST_ATTACKABLE, MemoryModuleType.TEMPTING_PLAYER, MemoryModuleType.TEMPTATION_COOLDOWN_TICKS, MemoryModuleType.IS_TEMPTED, MemoryModuleType.HAS_HUNTING_COOLDOWN});
|
||||
private static final DataWatcherObject<Integer> DATA_VARIANT = DataWatcher.a(Axolotl.class, DataWatcherRegistry.INT);
|
||||
private static final DataWatcherObject<Boolean> DATA_PLAYING_DEAD = DataWatcher.a(Axolotl.class, DataWatcherRegistry.BOOLEAN);
|
||||
private static final DataWatcherObject<Boolean> FROM_BUCKET = DataWatcher.a(Axolotl.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -235,6 +236,7 @@
|
||||
private static final DataWatcherObject<Integer> DATA_VARIANT = DataWatcher.defineId(Axolotl.class, DataWatcherRegistry.INT);
|
||||
private static final DataWatcherObject<Boolean> DATA_PLAYING_DEAD = DataWatcher.defineId(Axolotl.class, DataWatcherRegistry.BOOLEAN);
|
||||
private static final DataWatcherObject<Boolean> FROM_BUCKET = DataWatcher.defineId(Axolotl.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -236,6 +237,7 @@
|
||||
@Override
|
||||
public void setFromBucket(boolean flag) {
|
||||
this.entityData.set(Axolotl.FROM_BUCKET, flag);
|
||||
+ this.setPersistenceRequired(this.isPersistent()); // CraftBukkit - SPIGOT-4106 update persistence
|
||||
+ this.setPersistenceRequired(this.isPersistenceRequired()); // CraftBukkit - SPIGOT-4106 update persistence
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -276,7 +278,7 @@
|
||||
@Override
|
||||
protected void mobTick() {
|
||||
this.level.getMethodProfiler().enter("axolotlBrain");
|
||||
- this.getBehaviorController().a((WorldServer) this.level, (EntityLiving) this);
|
||||
+ this.getBehaviorController().a((WorldServer) this.level, this); // CraftBukkit - decompile error
|
||||
this.level.getMethodProfiler().exit();
|
||||
this.level.getMethodProfiler().enter("axolotlActivityUpdate");
|
||||
AxolotlAi.a(this);
|
||||
@@ -418,7 +420,7 @@
|
||||
@@ -419,7 +421,7 @@
|
||||
|
||||
if (i < 2400) {
|
||||
i = Math.min(2400, 100 + i);
|
||||
@@ -36,21 +27,21 @@
|
||||
}
|
||||
|
||||
entityhuman.removeEffect(MobEffects.DIG_SLOWDOWN);
|
||||
@@ -468,7 +470,7 @@
|
||||
@@ -469,7 +471,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<Axolotl> getBehaviorController() {
|
||||
- return super.getBehaviorController();
|
||||
+ return (BehaviorController<Axolotl>) super.getBehaviorController(); // CraftBukkit - decompile error
|
||||
public BehaviorController<Axolotl> getBrain() {
|
||||
- return super.getBrain();
|
||||
+ return (BehaviorController<Axolotl>) super.getBrain(); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -501,7 +503,7 @@
|
||||
@@ -502,7 +504,7 @@
|
||||
|
||||
@Override
|
||||
public boolean isTypeNotPersistent(double d0) {
|
||||
- return !this.isFromBucket() && !this.hasCustomName();
|
||||
public boolean removeWhenFarAway(double d0) {
|
||||
- return !this.fromBucket() && !this.hasCustomName();
|
||||
+ return true; // CraftBukkit
|
||||
}
|
||||
|
||||
private static class c extends SmoothSwimmingMoveControl {
|
||||
public static boolean checkAxolotlSpawnRules(EntityTypes<? extends EntityLiving> entitytypes, WorldAccess worldaccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, Random random) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
@@ -50,6 +50,11 @@
|
||||
@@ -52,6 +52,11 @@
|
||||
import net.minecraft.world.level.pathfinder.Pathfinder;
|
||||
import net.minecraft.world.level.pathfinder.PathfinderNormal;
|
||||
|
||||
@@ -11,37 +11,30 @@
|
||||
+
|
||||
public class Goat extends EntityAnimal {
|
||||
|
||||
public static final EntitySize LONG_JUMPING_DIMENSIONS = EntitySize.b(0.9F, 1.3F).a(0.7F);
|
||||
@@ -137,13 +142,13 @@
|
||||
public static final EntitySize LONG_JUMPING_DIMENSIONS = EntitySize.scalable(0.9F, 1.3F).scale(0.7F);
|
||||
@@ -139,7 +144,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<Goat> getBehaviorController() {
|
||||
- return super.getBehaviorController();
|
||||
+ return (BehaviorController<Goat>) super.getBehaviorController(); // CraftBukkit - decompile error
|
||||
public BehaviorController<Goat> getBrain() {
|
||||
- return super.getBrain();
|
||||
+ return (BehaviorController<Goat>) super.getBrain(); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mobTick() {
|
||||
this.level.getMethodProfiler().enter("goatBrain");
|
||||
- this.getBehaviorController().a((WorldServer) this.level, (EntityLiving) this);
|
||||
+ this.getBehaviorController().a((WorldServer) this.level, this); // CraftBukkit - decompile error
|
||||
this.level.getMethodProfiler().exit();
|
||||
this.level.getMethodProfiler().enter("goatActivityUpdate");
|
||||
GoatAi.b(this);
|
||||
@@ -175,8 +180,15 @@
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
@@ -177,8 +182,15 @@
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack.a(Items.BUCKET) && !this.isBaby()) {
|
||||
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {
|
||||
+ // CraftBukkit start - Got milk?
|
||||
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.level, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET);
|
||||
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.level, entityhuman, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entityhuman.playSound(this.t(), 1.0F, 1.0F);
|
||||
- ItemStack itemstack1 = ItemLiquidUtil.a(itemstack, entityhuman, Items.MILK_BUCKET.createItemStack());
|
||||
+ ItemStack itemstack1 = ItemLiquidUtil.a(itemstack, entityhuman, CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit
|
||||
entityhuman.playSound(this.getMilkingSound(), 1.0F, 1.0F);
|
||||
- ItemStack itemstack1 = ItemLiquidUtil.createFilledResult(itemstack, entityhuman, Items.MILK_BUCKET.getDefaultInstance());
|
||||
+ ItemStack itemstack1 = ItemLiquidUtil.createFilledResult(itemstack, entityhuman, CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit
|
||||
|
||||
entityhuman.a(enumhand, itemstack1);
|
||||
return EnumInteractionResult.a(this.level.isClientSide);
|
||||
entityhuman.setItemInHand(enumhand, itemstack1);
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
|
||||
@@ -69,6 +69,8 @@
|
||||
@@ -70,6 +70,8 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, IJumpable, ISaddleable {
|
||||
|
||||
public static final int EQUIPMENT_SLOT_OFFSET = 400;
|
||||
@@ -108,6 +110,7 @@
|
||||
@@ -109,6 +111,7 @@
|
||||
private float mouthAnimO;
|
||||
protected boolean canGallop = true;
|
||||
protected int gallopSoundCounter;
|
||||
@@ -17,25 +17,25 @@
|
||||
|
||||
protected EntityHorseAbstract(EntityTypes<? extends EntityHorseAbstract> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -292,7 +295,7 @@
|
||||
public void loadChest() {
|
||||
@@ -294,7 +297,7 @@
|
||||
public void createInventory() {
|
||||
InventorySubcontainer inventorysubcontainer = this.inventory;
|
||||
|
||||
- this.inventory = new InventorySubcontainer(this.getChestSlots());
|
||||
+ this.inventory = new InventorySubcontainer(this.getChestSlots(), (org.bukkit.entity.AbstractHorse) this.getBukkitEntity()); // CraftBukkit
|
||||
- this.inventory = new InventorySubcontainer(this.getInventorySize());
|
||||
+ this.inventory = new InventorySubcontainer(this.getInventorySize(), (org.bukkit.entity.AbstractHorse) this.getBukkitEntity()); // CraftBukkit
|
||||
if (inventorysubcontainer != null) {
|
||||
inventorysubcontainer.b((IInventoryListener) this);
|
||||
int i = Math.min(inventorysubcontainer.getSize(), this.inventory.getSize());
|
||||
@@ -408,7 +411,7 @@
|
||||
inventorysubcontainer.removeListener(this);
|
||||
int i = Math.min(inventorysubcontainer.getContainerSize(), this.inventory.getContainerSize());
|
||||
@@ -410,7 +413,7 @@
|
||||
}
|
||||
|
||||
public int getMaxDomestication() {
|
||||
public int getMaxTemper() {
|
||||
- return 100;
|
||||
+ return this.maxDomestication; // CraftBukkit - return stored max domestication instead of 100
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -478,7 +481,7 @@
|
||||
@@ -480,7 +483,7 @@
|
||||
}
|
||||
|
||||
if (this.getHealth() < this.getMaxHealth() && f > 0.0F) {
|
||||
@@ -44,39 +44,39 @@
|
||||
flag = true;
|
||||
}
|
||||
|
||||
@@ -555,7 +558,7 @@
|
||||
super.movementTick();
|
||||
@@ -557,7 +560,7 @@
|
||||
super.aiStep();
|
||||
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
|
||||
}
|
||||
|
||||
if (this.fV()) {
|
||||
@@ -786,6 +789,7 @@
|
||||
if (this.canEatGrass()) {
|
||||
@@ -788,6 +791,7 @@
|
||||
if (this.getOwnerUUID() != null) {
|
||||
nbttagcompound.a("Owner", this.getOwnerUUID());
|
||||
nbttagcompound.putUUID("Owner", this.getOwnerUUID());
|
||||
}
|
||||
+ nbttagcompound.setInt("Bukkit.MaxDomestication", this.maxDomestication); // CraftBukkit
|
||||
+ nbttagcompound.putInt("Bukkit.MaxDomestication", this.maxDomestication); // CraftBukkit
|
||||
|
||||
if (!this.inventory.getItem(0).isEmpty()) {
|
||||
nbttagcompound.set("SaddleItem", this.inventory.getItem(0).save(new NBTTagCompound()));
|
||||
@@ -813,6 +817,11 @@
|
||||
nbttagcompound.put("SaddleItem", this.inventory.getItem(0).save(new NBTTagCompound()));
|
||||
@@ -815,6 +819,11 @@
|
||||
if (uuid != null) {
|
||||
this.setOwnerUUID(uuid);
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ if (nbttagcompound.hasKey("Bukkit.MaxDomestication")) {
|
||||
+ if (nbttagcompound.contains("Bukkit.MaxDomestication")) {
|
||||
+ this.maxDomestication = nbttagcompound.getInt("Bukkit.MaxDomestication");
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("SaddleItem", 10)) {
|
||||
ItemStack itemstack = ItemStack.a(nbttagcompound.getCompound("SaddleItem"));
|
||||
@@ -895,6 +904,18 @@
|
||||
if (nbttagcompound.contains("SaddleItem", 10)) {
|
||||
ItemStack itemstack = ItemStack.of(nbttagcompound.getCompound("SaddleItem"));
|
||||
@@ -897,6 +906,18 @@
|
||||
|
||||
@Override
|
||||
public void b(int i) {
|
||||
public void handleStartJump(int i) {
|
||||
+ // CraftBukkit start
|
||||
+ float power;
|
||||
+ if (i >= 90) {
|
||||
@@ -90,5 +90,5 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.allowStandSliding = true;
|
||||
this.fE();
|
||||
this.fX();
|
||||
this.stand();
|
||||
this.playJumpSound();
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -152,7 +152,7 @@
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
- this.mob.setGoalTarget(this.ownerLastHurtBy);
|
||||
+ this.mob.setGoalTarget(this.ownerLastHurtBy, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER, true); // CraftBukkit
|
||||
public void start() {
|
||||
- this.mob.setTarget(this.ownerLastHurtBy);
|
||||
+ this.mob.setTarget(this.ownerLastHurtBy, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER, true); // CraftBukkit
|
||||
Entity entity = this.llama.getLeashHolder();
|
||||
|
||||
if (entity instanceof EntityVillagerTrader) {
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
--- a/net/minecraft/world/entity/animal/horse/PathfinderGoalHorseTrap.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/PathfinderGoalHorseTrap.java
|
||||
@@ -40,19 +40,20 @@
|
||||
@@ -39,19 +39,20 @@
|
||||
|
||||
entitylightning.teleportAndSync(this.horse.locX(), this.horse.locY(), this.horse.locZ());
|
||||
entitylightning.setEffect(true);
|
||||
- worldserver.addEntity(entitylightning);
|
||||
entitylightning.moveTo(this.horse.getX(), this.horse.getY(), this.horse.getZ());
|
||||
entitylightning.setVisualOnly(true);
|
||||
- worldserver.addFreshEntity(entitylightning);
|
||||
+ worldserver.strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRAP); // CraftBukkit
|
||||
EntitySkeleton entityskeleton = this.a(difficultydamagescaler, this.horse);
|
||||
EntitySkeleton entityskeleton = this.createSkeleton(difficultydamagescaler, this.horse);
|
||||
|
||||
- entityskeleton.startRiding(this.horse);
|
||||
- worldserver.addAllEntities(entityskeleton);
|
||||
- worldserver.addFreshEntityWithPassengers(entityskeleton);
|
||||
+ if (entityskeleton != null) entityskeleton.startRiding(this.horse); // CraftBukkit
|
||||
+ worldserver.addAllEntities(entityskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.TRAP); // CraftBukkit
|
||||
+ worldserver.addFreshEntityWithPassengers(entityskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.TRAP); // CraftBukkit
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
EntityHorseAbstract entityhorseabstract = this.a(difficultydamagescaler);
|
||||
EntityHorseAbstract entityhorseabstract = this.createHorse(difficultydamagescaler);
|
||||
+ if (entityhorseabstract == null) continue; // CraftBukkit
|
||||
EntitySkeleton entityskeleton1 = this.a(difficultydamagescaler, entityhorseabstract);
|
||||
EntitySkeleton entityskeleton1 = this.createSkeleton(difficultydamagescaler, entityhorseabstract);
|
||||
|
||||
- entityskeleton1.startRiding(entityhorseabstract);
|
||||
+ if (entityskeleton1 != null) entityskeleton1.startRiding(entityhorseabstract); // CraftBukkit
|
||||
entityhorseabstract.i(this.horse.getRandom().nextGaussian() * 0.5D, 0.0D, this.horse.getRandom().nextGaussian() * 0.5D);
|
||||
- worldserver.addAllEntities(entityhorseabstract);
|
||||
+ worldserver.addAllEntities(entityhorseabstract, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.JOCKEY); // CraftBukkit
|
||||
entityhorseabstract.push(this.horse.getRandom().nextGaussian() * 0.5D, 0.0D, this.horse.getRandom().nextGaussian() * 0.5D);
|
||||
- worldserver.addFreshEntityWithPassengers(entityhorseabstract);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityhorseabstract, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.JOCKEY); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user