@@ -15,21 +15,21 @@
|
||||
@@ -16,7 +21,19 @@
|
||||
}
|
||||
|
||||
public boolean a(ItemStack itemstack) {
|
||||
- return this.key.isEmpty() || !itemstack.isEmpty() && itemstack.hasName() && this.key.equals(itemstack.getName().getString());
|
||||
public boolean unlocksWith(ItemStack itemstack) {
|
||||
- return this.key.isEmpty() || !itemstack.isEmpty() && itemstack.hasCustomHoverName() && this.key.equals(itemstack.getHoverName().getString());
|
||||
+ // CraftBukkit start - SPIGOT-6307: Check for color codes if the lock contains color codes
|
||||
+ if (this.key.isEmpty()) return true;
|
||||
+ if (!itemstack.isEmpty() && itemstack.hasName()) {
|
||||
+ if (!itemstack.isEmpty() && itemstack.hasCustomHoverName()) {
|
||||
+ if (this.key.indexOf(ChatColor.COLOR_CHAR) == -1) {
|
||||
+ // The lock key contains no color codes, so let's ignore colors in the item display name (vanilla Minecraft behavior):
|
||||
+ return this.key.equals(itemstack.getName().getString());
|
||||
+ return this.key.equals(itemstack.getHoverName().getString());
|
||||
+ } else {
|
||||
+ // The lock key contains color codes, so let's take them into account:
|
||||
+ return this.key.equals(CraftChatMessage.fromComponent(itemstack.getName()));
|
||||
+ return this.key.equals(CraftChatMessage.fromComponent(itemstack.getHoverName()));
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
public void addToTag(NBTTagCompound nbttagcompound) {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
- }
|
||||
+ int getMaxStackSize(); // CraftBukkit
|
||||
|
||||
void update();
|
||||
void setChanged();
|
||||
|
||||
@@ -62,4 +65,29 @@
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
||||
+
|
||||
+ public List<ItemStack> getContents() {
|
||||
+ List<ItemStack> result = new ArrayList<ItemStack>(this.getSize());
|
||||
+ for (int i = 0; i < this.getSize(); i++) {
|
||||
+ List<ItemStack> result = new ArrayList<ItemStack>(this.getContainerSize());
|
||||
+ for (int i = 0; i < this.getContainerSize(); i++) {
|
||||
+ result.add(this.getItem(i));
|
||||
+ }
|
||||
+ return result;
|
||||
@@ -61,9 +61,9 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public InventoryLargeChest(IInventory iinventory, IInventory iinventory1) {
|
||||
if (iinventory == null) {
|
||||
iinventory = iinventory1;
|
||||
@@ -62,7 +113,7 @@
|
||||
this.container1 = iinventory;
|
||||
this.container2 = iinventory1;
|
||||
@@ -54,7 +105,7 @@
|
||||
|
||||
@Override
|
||||
public int getMaxStackSize() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/InventorySubcontainer.java
|
||||
+++ b/net/minecraft/world/InventorySubcontainer.java
|
||||
@@ -13,13 +13,71 @@
|
||||
@@ -14,6 +14,12 @@
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
public class InventorySubcontainer implements IInventory, AutoRecipeOutput {
|
||||
|
||||
private final int size;
|
||||
public final NonNullList<ItemStack> items;
|
||||
@@ -21,7 +27,59 @@
|
||||
@Nullable
|
||||
private List<IInventoryListener> listeners;
|
||||
|
||||
+ // CraftBukkit start - add fields and methods
|
||||
@@ -58,7 +59,7 @@
|
||||
+ public InventorySubcontainer(InventorySubcontainer original) {
|
||||
+ this(original.size);
|
||||
+ for (int slot = 0; slot < original.size; slot++) {
|
||||
+ this.items.set(slot, original.items.get(slot).cloneItemStack());
|
||||
+ this.items.set(slot, original.items.get(slot).copy());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@@ -70,5 +71,5 @@
|
||||
+ this.bukkitOwner = owner;
|
||||
+ // CraftBukkit end
|
||||
this.size = i;
|
||||
this.items = NonNullList.a(i, ItemStack.EMPTY);
|
||||
this.items = NonNullList.withSize(i, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
@@ -17,5 +17,5 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
public static DamageSource b(EntityLiving entityliving) {
|
||||
public static DamageSource sting(EntityLiving entityliving) {
|
||||
return new EntityDamageSource("sting", entityliving);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+++ b/net/minecraft/world/damagesource/EntityDamageSourceIndirect.java
|
||||
@@ -38,4 +38,10 @@
|
||||
|
||||
return !itemstack.isEmpty() && itemstack.hasName() ? new ChatMessage(s1, new Object[]{entityliving.getScoreboardDisplayName(), ichatbasecomponent, itemstack.G()}) : new ChatMessage(s, new Object[]{entityliving.getScoreboardDisplayName(), ichatbasecomponent});
|
||||
return !itemstack.isEmpty() && itemstack.hasCustomHoverName() ? new ChatMessage(s1, new Object[]{entityliving.getDisplayName(), ichatbasecomponent, itemstack.getDisplayName()}) : new ChatMessage(s, new Object[]{entityliving.getDisplayName(), ichatbasecomponent});
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
private final Map<AttributeBase, AttributeModifier> attributeModifiers = Maps.newHashMap();
|
||||
@@ -44,26 +51,37 @@
|
||||
public void tick(EntityLiving entityliving, int i) {
|
||||
public void applyEffectTick(EntityLiving entityliving, int i) {
|
||||
if (this == MobEffects.REGENERATION) {
|
||||
if (entityliving.getHealth() < entityliving.getMaxHealth()) {
|
||||
- entityliving.heal(1.0F);
|
||||
@@ -23,14 +23,14 @@
|
||||
}
|
||||
} else if (this == MobEffects.POISON) {
|
||||
if (entityliving.getHealth() > 1.0F) {
|
||||
- entityliving.damageEntity(DamageSource.MAGIC, 1.0F);
|
||||
+ entityliving.damageEntity(CraftEventFactory.POISON, 1.0F); // CraftBukkit - DamageSource.MAGIC -> CraftEventFactory.POISON
|
||||
- entityliving.hurt(DamageSource.MAGIC, 1.0F);
|
||||
+ entityliving.hurt(CraftEventFactory.POISON, 1.0F); // CraftBukkit - DamageSource.MAGIC -> CraftEventFactory.POISON
|
||||
}
|
||||
} else if (this == MobEffects.WITHER) {
|
||||
entityliving.damageEntity(DamageSource.WITHER, 1.0F);
|
||||
entityliving.hurt(DamageSource.WITHER, 1.0F);
|
||||
} else if (this == MobEffects.HUNGER && entityliving instanceof EntityHuman) {
|
||||
- ((EntityHuman) entityliving).applyExhaustion(0.005F * (float) (i + 1));
|
||||
+ ((EntityHuman) entityliving).applyExhaustion(0.005F * (float) (i + 1), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.HUNGER_EFFECT); // CraftBukkit - EntityExhaustionEvent
|
||||
- ((EntityHuman) entityliving).causeFoodExhaustion(0.005F * (float) (i + 1));
|
||||
+ ((EntityHuman) entityliving).causeFoodExhaustion(0.005F * (float) (i + 1), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.HUNGER_EFFECT); // CraftBukkit - EntityExhaustionEvent
|
||||
} else if (this == MobEffects.SATURATION && entityliving instanceof EntityHuman) {
|
||||
if (!entityliving.level.isClientSide) {
|
||||
- ((EntityHuman) entityliving).getFoodData().eat(i + 1, 1.0F);
|
||||
@@ -44,12 +44,12 @@
|
||||
+ entityhuman.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, 1.0F);
|
||||
+ }
|
||||
+
|
||||
+ ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else if ((this != MobEffects.HEAL || entityliving.dT()) && (this != MobEffects.HARM || !entityliving.dT())) {
|
||||
if (this == MobEffects.HARM && !entityliving.dT() || this == MobEffects.HEAL && entityliving.dT()) {
|
||||
entityliving.damageEntity(DamageSource.MAGIC, (float) (6 << i));
|
||||
} else if ((this != MobEffects.HEAL || entityliving.isInvertedHealAndHarm()) && (this != MobEffects.HARM || !entityliving.isInvertedHealAndHarm())) {
|
||||
if (this == MobEffects.HARM && !entityliving.isInvertedHealAndHarm() || this == MobEffects.HEAL && entityliving.isInvertedHealAndHarm()) {
|
||||
entityliving.hurt(DamageSource.MAGIC, (float) (6 << i));
|
||||
}
|
||||
} else {
|
||||
- entityliving.heal((float) Math.max(4 << i, 0));
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+++ b/net/minecraft/world/effect/MobEffects.java
|
||||
@@ -65,6 +65,14 @@
|
||||
});
|
||||
public static final MobEffectList HERO_OF_THE_VILLAGE = a(32, "hero_of_the_village", new MobEffectList(MobEffectInfo.BENEFICIAL, 4521796));
|
||||
public static final MobEffectList HERO_OF_THE_VILLAGE = register(32, "hero_of_the_village", new MobEffectList(MobEffectInfo.BENEFICIAL, 4521796));
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ static {
|
||||
@@ -14,4 +14,4 @@
|
||||
+
|
||||
public MobEffects() {}
|
||||
|
||||
private static MobEffectList a(int i, String s, MobEffectList mobeffectlist) {
|
||||
private static MobEffectList register(int i, String s, MobEffectList mobeffectlist) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -116,8 +116,58 @@
|
||||
@@ -117,8 +117,58 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
+ // CraftBukkit start
|
||||
+ private static final int CURRENT_LEVEL = 2;
|
||||
+ static boolean isLevelAtLeast(NBTTagCompound tag, int level) {
|
||||
+ return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
|
||||
+ return tag.contains("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
|
||||
+ }
|
||||
+
|
||||
+ private CraftEntity bukkitEntity;
|
||||
@@ -59,10 +59,10 @@
|
||||
protected static final Logger LOGGER = LogManager.getLogger();
|
||||
public static final String ID_TAG = "id";
|
||||
public static final String PASSENGERS_TAG = "Passengers";
|
||||
@@ -224,6 +274,22 @@
|
||||
private float crystalSoundIntensity;
|
||||
private int lastCrystalSoundPlayTick;
|
||||
@@ -229,6 +279,22 @@
|
||||
public boolean hasVisualFire;
|
||||
@Nullable
|
||||
private IBlockData feetBlockState;
|
||||
+ // CraftBukkit start
|
||||
+ public boolean persist = true;
|
||||
+ public boolean valid;
|
||||
@@ -76,14 +76,14 @@
|
||||
+ }
|
||||
+
|
||||
+ public boolean isChunkLoaded() {
|
||||
+ return level.isChunkLoaded((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4);
|
||||
+ return level.hasChunk((int) Math.floor(this.getX()) >> 4, (int) Math.floor(this.getZ()) >> 4);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
public Entity(EntityTypes<?> entitytypes, World world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -359,6 +425,12 @@
|
||||
public void ae() {}
|
||||
@@ -366,6 +432,12 @@
|
||||
public void onClientRemoval() {}
|
||||
|
||||
public void setPose(EntityPose entitypose) {
|
||||
+ // CraftBukkit start
|
||||
@@ -95,10 +95,10 @@
|
||||
this.entityData.set(Entity.DATA_POSE, entitypose);
|
||||
}
|
||||
|
||||
@@ -375,6 +447,33 @@
|
||||
@@ -382,6 +454,33 @@
|
||||
}
|
||||
|
||||
protected void setYawPitch(float f, float f1) {
|
||||
protected void setRot(float f, float f1) {
|
||||
+ // CraftBukkit start - yaw was sometimes set to NaN, so we need to set it back to 0
|
||||
+ if (Float.isNaN(f)) {
|
||||
+ f = 0;
|
||||
@@ -106,7 +106,7 @@
|
||||
+
|
||||
+ if (f == Float.POSITIVE_INFINITY || f == Float.NEGATIVE_INFINITY) {
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ this.level.getCraftServer().getLogger().warning(this.getName() + " was caught trying to crash the server with an invalid yaw");
|
||||
+ this.level.getCraftServer().getLogger().warning(this.getScoreboardName() + " was caught trying to crash the server with an invalid yaw");
|
||||
+ ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Infinite yaw (Hacking?)");
|
||||
+ }
|
||||
+ f = 0;
|
||||
@@ -119,7 +119,7 @@
|
||||
+
|
||||
+ if (f1 == Float.POSITIVE_INFINITY || f1 == Float.NEGATIVE_INFINITY) {
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ this.level.getCraftServer().getLogger().warning(this.getName() + " was caught trying to crash the server with an invalid pitch");
|
||||
+ this.level.getCraftServer().getLogger().warning(this.getScoreboardName() + " was caught trying to crash the server with an invalid pitch");
|
||||
+ ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Infinite pitch (Hacking?)");
|
||||
+ }
|
||||
+ f1 = 0;
|
||||
@@ -129,36 +129,36 @@
|
||||
this.setYRot(f % 360.0F);
|
||||
this.setXRot(f1 % 360.0F);
|
||||
}
|
||||
@@ -416,6 +515,15 @@
|
||||
this.entityBaseTick();
|
||||
@@ -423,6 +522,15 @@
|
||||
this.baseTick();
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public void postTick() {
|
||||
+ // No clean way to break out of ticking once the entity has been copied to a new world, so instead we move the portalling later in the tick cycle
|
||||
+ if (!(this instanceof EntityPlayer)) {
|
||||
+ this.doPortalTick();
|
||||
+ this.handleNetherPortal();
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void entityBaseTick() {
|
||||
this.level.getMethodProfiler().enter("entityBaseTick");
|
||||
public void baseTick() {
|
||||
this.level.getProfiler().push("entityBaseTick");
|
||||
if (this.isPassenger() && this.getVehicle().isRemoved()) {
|
||||
@@ -429,7 +537,7 @@
|
||||
@@ -436,7 +544,7 @@
|
||||
this.walkDistO = this.walkDist;
|
||||
this.xRotO = this.getXRot();
|
||||
this.yRotO = this.getYRot();
|
||||
- this.doPortalTick();
|
||||
+ if (this instanceof EntityPlayer) this.doPortalTick(); // CraftBukkit - // Moved up to postTick
|
||||
if (this.aV()) {
|
||||
this.aW();
|
||||
- this.handleNetherPortal();
|
||||
+ if (this instanceof EntityPlayer) this.handleNetherPortal(); // CraftBukkit - // Moved up to postTick
|
||||
if (this.canSpawnSprintParticle()) {
|
||||
this.spawnSprintParticle();
|
||||
}
|
||||
@@ -507,7 +615,23 @@
|
||||
@@ -514,7 +622,23 @@
|
||||
|
||||
public void burnFromLava() {
|
||||
if (!this.isFireProof()) {
|
||||
- this.setOnFire(15);
|
||||
public void lavaHurt() {
|
||||
if (!this.fireImmune()) {
|
||||
- this.setSecondsOnFire(15);
|
||||
+ // CraftBukkit start - Fallen in lava TODO: this event spams!
|
||||
+ if (this instanceof EntityLiving && remainingFireTicks <= 0) {
|
||||
+ // not on fire yet
|
||||
@@ -169,25 +169,25 @@
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(combustEvent);
|
||||
+
|
||||
+ if (!combustEvent.isCancelled()) {
|
||||
+ this.setOnFire(combustEvent.getDuration(), false);
|
||||
+ this.setSecondsOnFire(combustEvent.getDuration(), false);
|
||||
+ }
|
||||
+ } else {
|
||||
+ // This will be called every single tick the entity is in lava, so don't throw an event
|
||||
+ this.setOnFire(15, false);
|
||||
+ this.setSecondsOnFire(15, false);
|
||||
+ }
|
||||
+ // CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls
|
||||
if (this.damageEntity(DamageSource.LAVA, 4.0F)) {
|
||||
if (this.hurt(DamageSource.LAVA, 4.0F)) {
|
||||
this.playSound(SoundEffects.GENERIC_BURN, 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
|
||||
}
|
||||
@@ -516,6 +640,22 @@
|
||||
@@ -523,6 +647,22 @@
|
||||
}
|
||||
|
||||
public void setOnFire(int i) {
|
||||
public void setSecondsOnFire(int i) {
|
||||
+ // CraftBukkit start
|
||||
+ this.setOnFire(i, true);
|
||||
+ this.setSecondsOnFire(i, true);
|
||||
+ }
|
||||
+
|
||||
+ public void setOnFire(int i, boolean callEvent) {
|
||||
+ public void setSecondsOnFire(int i, boolean callEvent) {
|
||||
+ if (callEvent) {
|
||||
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), i);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
@@ -202,14 +202,14 @@
|
||||
int j = i * 20;
|
||||
|
||||
if (this instanceof EntityLiving) {
|
||||
@@ -614,6 +754,28 @@
|
||||
block.a((IBlockAccess) this.level, this);
|
||||
@@ -627,6 +767,28 @@
|
||||
block.updateEntityAfterFallOn(this.level, this);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (horizontalCollision && getBukkitEntity() instanceof Vehicle) {
|
||||
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
+ org.bukkit.block.Block bl = this.level.getWorld().getBlockAt(MathHelper.floor(this.locX()), MathHelper.floor(this.locY()), MathHelper.floor(this.locZ()));
|
||||
+ org.bukkit.block.Block bl = this.level.getWorld().getBlockAt(MathHelper.floor(this.getX()), MathHelper.floor(this.getY()), MathHelper.floor(this.getZ()));
|
||||
+
|
||||
+ if (vec3d.x > vec3d1.x) {
|
||||
+ bl = bl.getRelative(BlockFace.EAST);
|
||||
@@ -228,43 +228,52 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.onGround && !this.bE()) {
|
||||
if (this.onGround && !this.isSteppingCarefully()) {
|
||||
block.stepOn(this.level, blockposition, iblockdata, this);
|
||||
}
|
||||
@@ -1276,6 +1438,7 @@
|
||||
@@ -846,7 +1008,7 @@
|
||||
boolean flag4 = flag && flag1 || flag && flag2 || flag1 && flag2;
|
||||
|
||||
if (flag4) {
|
||||
- List<VoxelShape> list1 = flag3 ? ImmutableList.builderWithExpectedSize(list.size() + 1).addAll(list).add(worldborder.getCollisionShape()).build() : list;
|
||||
+ List<VoxelShape> list1 = flag3 ? ImmutableList.<VoxelShape>builderWithExpectedSize(list.size() + 1).addAll(list).add(worldborder.getCollisionShape()).build() : list; // CraftBukkit - decompile error
|
||||
|
||||
return collideBoundingBox(vec3d, axisalignedbb, world, voxelshapecollision, (List) list1);
|
||||
} else {
|
||||
@@ -1306,6 +1468,7 @@
|
||||
this.yo = d1;
|
||||
this.zo = d4;
|
||||
this.setPosition(d3, d1, d4);
|
||||
+ if (valid) level.getChunkAt((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); // CraftBukkit
|
||||
this.setPos(d3, d1, d4);
|
||||
+ if (valid) level.getChunk((int) Math.floor(this.getX()) >> 4, (int) Math.floor(this.getZ()) >> 4); // CraftBukkit
|
||||
}
|
||||
|
||||
public void d(Vec3D vec3d) {
|
||||
@@ -1466,6 +1629,12 @@
|
||||
public void moveTo(Vec3D vec3d) {
|
||||
@@ -1496,6 +1659,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - collidable API
|
||||
+ public boolean canCollideWithBukkit(Entity entity) {
|
||||
+ return isCollidable();
|
||||
+ return isPushable();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void a(Entity entity, int i, DamageSource damagesource) {
|
||||
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
CriterionTriggers.ENTITY_KILLED_PLAYER.a((EntityPlayer) entity, this, damagesource);
|
||||
@@ -1499,7 +1668,7 @@
|
||||
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
|
||||
@@ -1529,7 +1698,7 @@
|
||||
} else {
|
||||
String s = this.getSaveID();
|
||||
String s = this.getEncodeId();
|
||||
|
||||
- if (s == null) {
|
||||
+ if (!this.persist || s == null) { // CraftBukkit - persist flag
|
||||
return false;
|
||||
} else {
|
||||
nbttagcompound.setString("id", s);
|
||||
@@ -1524,6 +1693,18 @@
|
||||
Vec3D vec3d = this.getMot();
|
||||
nbttagcompound.putString("id", s);
|
||||
@@ -1554,6 +1723,18 @@
|
||||
Vec3D vec3d = this.getDeltaMovement();
|
||||
|
||||
nbttagcompound.set("Motion", this.newDoubleList(vec3d.x, vec3d.y, vec3d.z));
|
||||
nbttagcompound.put("Motion", this.newDoubleList(vec3d.x, vec3d.y, vec3d.z));
|
||||
+
|
||||
+ // CraftBukkit start - Checking for NaN pitch/yaw and resetting to zero
|
||||
+ // TODO: make sure this is the best way to address this.
|
||||
@@ -277,29 +286,29 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
nbttagcompound.set("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
|
||||
nbttagcompound.setFloat("FallDistance", this.fallDistance);
|
||||
nbttagcompound.setShort("Fire", (short) this.remainingFireTicks);
|
||||
@@ -1532,6 +1713,18 @@
|
||||
nbttagcompound.setBoolean("Invulnerable", this.invulnerable);
|
||||
nbttagcompound.setInt("PortalCooldown", this.portalCooldown);
|
||||
nbttagcompound.a("UUID", this.getUniqueID());
|
||||
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
|
||||
nbttagcompound.putFloat("FallDistance", this.fallDistance);
|
||||
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
|
||||
@@ -1562,6 +1743,18 @@
|
||||
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
|
||||
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
|
||||
nbttagcompound.putUUID("UUID", this.getUUID());
|
||||
+ // CraftBukkit start
|
||||
+ // PAIL: Check above UUID reads 1.8 properly, ie: UUIDMost / UUIDLeast
|
||||
+ nbttagcompound.setLong("WorldUUIDLeast", ((WorldServer) this.level).getWorld().getUID().getLeastSignificantBits());
|
||||
+ nbttagcompound.setLong("WorldUUIDMost", ((WorldServer) this.level).getWorld().getUID().getMostSignificantBits());
|
||||
+ nbttagcompound.setInt("Bukkit.updateLevel", CURRENT_LEVEL);
|
||||
+ nbttagcompound.putLong("WorldUUIDLeast", ((WorldServer) this.level).getWorld().getUID().getLeastSignificantBits());
|
||||
+ nbttagcompound.putLong("WorldUUIDMost", ((WorldServer) this.level).getWorld().getUID().getMostSignificantBits());
|
||||
+ nbttagcompound.putInt("Bukkit.updateLevel", CURRENT_LEVEL);
|
||||
+ if (!this.persist) {
|
||||
+ nbttagcompound.setBoolean("Bukkit.persist", this.persist);
|
||||
+ nbttagcompound.putBoolean("Bukkit.persist", this.persist);
|
||||
+ }
|
||||
+ if (this.persistentInvisibility) {
|
||||
+ nbttagcompound.setBoolean("Bukkit.invisible", this.persistentInvisibility);
|
||||
+ nbttagcompound.putBoolean("Bukkit.invisible", this.persistentInvisibility);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
IChatBaseComponent ichatbasecomponent = this.getCustomName();
|
||||
|
||||
if (ichatbasecomponent != null) {
|
||||
@@ -1599,6 +1792,11 @@
|
||||
@@ -1629,6 +1822,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,8 +319,8 @@
|
||||
+ // CraftBukkit end
|
||||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT");
|
||||
@@ -1680,6 +1878,49 @@
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -1710,6 +1908,49 @@
|
||||
} else {
|
||||
throw new IllegalStateException("Entity has invalid position");
|
||||
}
|
||||
@@ -323,10 +332,10 @@
|
||||
+ // Reset the persistence for tamed animals
|
||||
+ if (entity instanceof EntityTameableAnimal && !isLevelAtLeast(nbttagcompound, 2) && !nbttagcompound.getBoolean("PersistenceRequired")) {
|
||||
+ EntityInsentient entityinsentient = (EntityInsentient) entity;
|
||||
+ entityinsentient.setPersistenceRequired(!entityinsentient.isTypeNotPersistent(0));
|
||||
+ entityinsentient.setPersistenceRequired(!entityinsentient.removeWhenFarAway(0));
|
||||
+ }
|
||||
+ }
|
||||
+ this.persist = !nbttagcompound.hasKey("Bukkit.persist") || nbttagcompound.getBoolean("Bukkit.persist");
|
||||
+ this.persist = !nbttagcompound.contains("Bukkit.persist") || nbttagcompound.getBoolean("Bukkit.persist");
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ // CraftBukkit start - Reset world
|
||||
@@ -337,7 +346,7 @@
|
||||
+ // TODO: Remove World related checks, replaced with WorldUID
|
||||
+ String worldName = nbttagcompound.getString("world");
|
||||
+
|
||||
+ if (nbttagcompound.hasKey("WorldUUIDMost") && nbttagcompound.hasKey("WorldUUIDLeast")) {
|
||||
+ if (nbttagcompound.contains("WorldUUIDMost") && nbttagcompound.contains("WorldUUIDLeast")) {
|
||||
+ UUID uid = new UUID(nbttagcompound.getLong("WorldUUIDMost"), nbttagcompound.getLong("WorldUUIDLeast"));
|
||||
+ bworld = server.getWorld(uid);
|
||||
+ } else {
|
||||
@@ -345,13 +354,13 @@
|
||||
+ }
|
||||
+
|
||||
+ if (bworld == null) {
|
||||
+ bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(World.OVERWORLD).getWorld();
|
||||
+ bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getLevel(World.OVERWORLD).getWorld();
|
||||
+ }
|
||||
+
|
||||
+ ((EntityPlayer) this).spawnIn(bworld == null ? null : ((CraftWorld) bworld).getHandle());
|
||||
+ ((EntityPlayer) this).setLevel(bworld == null ? null : ((CraftWorld) bworld).getHandle());
|
||||
+ }
|
||||
+ this.getBukkitEntity().readBukkitValues(nbttagcompound);
|
||||
+ if (nbttagcompound.hasKey("Bukkit.invisible")) {
|
||||
+ if (nbttagcompound.contains("Bukkit.invisible")) {
|
||||
+ boolean bukkitInvisible = nbttagcompound.getBoolean("Bukkit.invisible");
|
||||
+ this.setInvisible(bukkitInvisible);
|
||||
+ this.persistentInvisibility = bukkitInvisible;
|
||||
@@ -359,9 +368,9 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
|
||||
@@ -1755,9 +1996,22 @@
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
|
||||
@@ -1785,9 +2026,22 @@
|
||||
} else if (this.level.isClientSide) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -371,9 +380,9 @@
|
||||
+ return null;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
EntityItem entityitem = new EntityItem(this.level, this.locX(), this.locY() + (double) f, this.locZ(), itemstack);
|
||||
EntityItem entityitem = new EntityItem(this.level, this.getX(), this.getY() + (double) f, this.getZ(), itemstack);
|
||||
|
||||
entityitem.defaultPickupDelay();
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
+ // CraftBukkit start
|
||||
+ EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
@@ -381,19 +390,19 @@
|
||||
+ return null;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level.addEntity(entityitem);
|
||||
this.level.addFreshEntity(entityitem);
|
||||
return entityitem;
|
||||
}
|
||||
@@ -1849,7 +2103,7 @@
|
||||
@@ -1882,7 +2136,7 @@
|
||||
|
||||
this.setPose(EntityPose.STANDING);
|
||||
this.vehicle = entity;
|
||||
- this.vehicle.addPassenger(this);
|
||||
+ if (!this.vehicle.addPassenger(this)) this.vehicle = null; // CraftBukkit
|
||||
entity.n().filter((entity2) -> {
|
||||
entity.getIndirectPassengersStream().filter((entity2) -> {
|
||||
return entity2 instanceof EntityPlayer;
|
||||
}).forEach((entity2) -> {
|
||||
@@ -1880,7 +2134,7 @@
|
||||
@@ -1913,7 +2167,7 @@
|
||||
Entity entity = this.vehicle;
|
||||
|
||||
this.vehicle = null;
|
||||
@@ -402,8 +411,8 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1889,10 +2143,31 @@
|
||||
this.bo();
|
||||
@@ -1922,10 +2176,31 @@
|
||||
this.removeVehicle();
|
||||
}
|
||||
|
||||
- protected void addPassenger(Entity entity) {
|
||||
@@ -435,7 +444,7 @@
|
||||
if (this.passengers.isEmpty()) {
|
||||
this.passengers = ImmutableList.of(entity);
|
||||
} else {
|
||||
@@ -1908,12 +2183,32 @@
|
||||
@@ -1941,12 +2216,32 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -469,39 +478,39 @@
|
||||
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
|
||||
this.passengers = ImmutableList.of();
|
||||
} else {
|
||||
@@ -1924,6 +2219,7 @@
|
||||
@@ -1957,6 +2252,7 @@
|
||||
|
||||
entity.boardingCooldown = 60;
|
||||
}
|
||||
+ return true; // CraftBukkit
|
||||
}
|
||||
|
||||
protected boolean o(Entity entity) {
|
||||
@@ -1974,14 +2270,20 @@
|
||||
protected boolean canAddPassenger(Entity entity) {
|
||||
@@ -2007,14 +2303,20 @@
|
||||
|
||||
if (this.isInsidePortal) {
|
||||
MinecraftServer minecraftserver = worldserver.getMinecraftServer();
|
||||
- ResourceKey<World> resourcekey = this.level.getDimensionKey() == World.NETHER ? World.OVERWORLD : World.NETHER;
|
||||
MinecraftServer minecraftserver = worldserver.getServer();
|
||||
- ResourceKey<World> resourcekey = this.level.dimension() == World.NETHER ? World.OVERWORLD : World.NETHER;
|
||||
+ ResourceKey<World> resourcekey = this.level.getTypeKey() == DimensionManager.NETHER_LOCATION ? World.OVERWORLD : World.NETHER; // CraftBukkit
|
||||
WorldServer worldserver1 = minecraftserver.getWorldServer(resourcekey);
|
||||
WorldServer worldserver1 = minecraftserver.getLevel(resourcekey);
|
||||
|
||||
- if (worldserver1 != null && minecraftserver.getAllowNether() && !this.isPassenger() && this.portalTime++ >= i) {
|
||||
- if (worldserver1 != null && minecraftserver.isNetherEnabled() && !this.isPassenger() && this.portalTime++ >= i) {
|
||||
+ if (true && !this.isPassenger() && this.portalTime++ >= i) { // CraftBukkit
|
||||
this.level.getMethodProfiler().enter("portal");
|
||||
this.level.getProfiler().push("portal");
|
||||
this.portalTime = i;
|
||||
this.resetPortalCooldown();
|
||||
- this.b(worldserver1);
|
||||
this.setPortalCooldown();
|
||||
- this.changeDimension(worldserver1);
|
||||
+ // CraftBukkit start
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) this).b(worldserver1, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL);
|
||||
+ ((EntityPlayer) this).changeDimension(worldserver1, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL);
|
||||
+ } else {
|
||||
+ this.b(worldserver1);
|
||||
+ this.changeDimension(worldserver1);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level.getMethodProfiler().exit();
|
||||
this.level.getProfiler().pop();
|
||||
}
|
||||
|
||||
@@ -2099,6 +2401,13 @@
|
||||
@@ -2132,6 +2434,13 @@
|
||||
}
|
||||
|
||||
public void setSwimming(boolean flag) {
|
||||
@@ -512,27 +521,27 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.setFlag(4, flag);
|
||||
this.setSharedFlag(4, flag);
|
||||
}
|
||||
|
||||
@@ -2147,8 +2456,12 @@
|
||||
return this.getScoreboardTeam() != null ? this.getScoreboardTeam().isAlly(scoreboardteambase) : false;
|
||||
@@ -2180,8 +2489,12 @@
|
||||
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
|
||||
}
|
||||
|
||||
+ // CraftBukkit - start
|
||||
public void setInvisible(boolean flag) {
|
||||
- this.setFlag(5, flag);
|
||||
- this.setSharedFlag(5, flag);
|
||||
+ if (!this.persistentInvisibility) { // Prevent Minecraft from removing our invisibility flag
|
||||
+ this.setFlag(5, flag);
|
||||
+ this.setSharedFlag(5, flag);
|
||||
+ }
|
||||
+ // CraftBukkit - end
|
||||
}
|
||||
|
||||
public boolean getFlag(int i) {
|
||||
@@ -2175,7 +2488,17 @@
|
||||
public boolean getSharedFlag(int i) {
|
||||
@@ -2208,7 +2521,17 @@
|
||||
}
|
||||
|
||||
public void setAirTicks(int i) {
|
||||
public void setAirSupply(int i) {
|
||||
- this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, i);
|
||||
+ // CraftBukkit start
|
||||
+ EntityAirChangeEvent event = new EntityAirChangeEvent(this.getBukkitEntity(), i);
|
||||
@@ -548,10 +557,10 @@
|
||||
}
|
||||
|
||||
public int getTicksFrozen() {
|
||||
@@ -2202,11 +2525,41 @@
|
||||
@@ -2235,11 +2558,41 @@
|
||||
|
||||
public void onLightningStrike(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
this.setFireTicks(this.remainingFireTicks + 1);
|
||||
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
||||
+ // CraftBukkit start
|
||||
+ final org.bukkit.entity.Entity thisBukkitEntity = this.getBukkitEntity();
|
||||
+ final org.bukkit.entity.Entity stormBukkitEntity = entitylightning.getBukkitEntity();
|
||||
@@ -559,12 +568,12 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.remainingFireTicks == 0) {
|
||||
- this.setOnFire(8);
|
||||
- this.setSecondsOnFire(8);
|
||||
+ // CraftBukkit start - Call a combust event when lightning strikes
|
||||
+ EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8);
|
||||
+ pluginManager.callEvent(entityCombustEvent);
|
||||
+ if (!entityCombustEvent.isCancelled()) {
|
||||
+ this.setOnFire(entityCombustEvent.getDuration(), false);
|
||||
+ this.setSecondsOnFire(entityCombustEvent.getDuration(), false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
@@ -579,23 +588,23 @@
|
||||
+ }
|
||||
}
|
||||
|
||||
- this.damageEntity(DamageSource.LIGHTNING_BOLT, 5.0F);
|
||||
+ if (this.isFireProof()) {
|
||||
- this.hurt(DamageSource.LIGHTNING_BOLT, 5.0F);
|
||||
+ if (this.fireImmune()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ CraftEventFactory.entityDamage = entitylightning;
|
||||
+ if (!this.damageEntity(DamageSource.LIGHTNING_BOLT, 5.0F)) {
|
||||
+ if (!this.hurt(DamageSource.LIGHTNING_BOLT, 5.0F)) {
|
||||
+ CraftEventFactory.entityDamage = null;
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public void k(boolean flag) {
|
||||
@@ -2356,15 +2709,32 @@
|
||||
public void onAboveBubbleCol(boolean flag) {
|
||||
@@ -2393,15 +2746,32 @@
|
||||
|
||||
@Nullable
|
||||
public Entity b(WorldServer worldserver) {
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
+ // CraftBukkit start
|
||||
+ return teleportTo(worldserver, null);
|
||||
+ }
|
||||
@@ -604,55 +613,55 @@
|
||||
+ public Entity teleportTo(WorldServer worldserver, BlockPosition location) {
|
||||
+ // CraftBukkit end
|
||||
if (this.level instanceof WorldServer && !this.isRemoved()) {
|
||||
this.level.getMethodProfiler().enter("changeDimension");
|
||||
- this.decouple();
|
||||
this.level.getProfiler().push("changeDimension");
|
||||
- this.unRide();
|
||||
+ // CraftBukkit start
|
||||
+ // this.decouple();
|
||||
+ if (worldserver == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level.getMethodProfiler().enter("reposition");
|
||||
- ShapeDetectorShape shapedetectorshape = this.a(worldserver);
|
||||
+ ShapeDetectorShape shapedetectorshape = (location == null) ? this.a(worldserver) : new ShapeDetectorShape(new Vec3D(location.getX(), location.getY(), location.getZ()), Vec3D.ZERO, this.yRot, this.xRot, worldserver, null); // CraftBukkit
|
||||
this.level.getProfiler().push("reposition");
|
||||
- ShapeDetectorShape shapedetectorshape = this.findDimensionEntryPoint(worldserver);
|
||||
+ ShapeDetectorShape shapedetectorshape = (location == null) ? this.findDimensionEntryPoint(worldserver) : new ShapeDetectorShape(new Vec3D(location.getX(), location.getY(), location.getZ()), Vec3D.ZERO, this.yRot, this.xRot, worldserver, null); // CraftBukkit
|
||||
|
||||
if (shapedetectorshape == null) {
|
||||
return null;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ worldserver = shapedetectorshape.world;
|
||||
+ this.decouple();
|
||||
+ this.unRide();
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.level.getMethodProfiler().exitEnter("reloading");
|
||||
Entity entity = this.getEntityType().a((World) worldserver);
|
||||
this.level.getProfiler().popPush("reloading");
|
||||
Entity entity = this.getType().create(worldserver);
|
||||
|
||||
@@ -2373,9 +2743,17 @@
|
||||
entity.setPositionRotation(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
|
||||
entity.setMot(shapedetectorshape.speed);
|
||||
worldserver.addEntityTeleport(entity);
|
||||
- if (worldserver.getDimensionKey() == World.END) {
|
||||
- WorldServer.a(worldserver);
|
||||
@@ -2410,9 +2780,17 @@
|
||||
entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
|
||||
entity.setDeltaMovement(shapedetectorshape.speed);
|
||||
worldserver.addDuringTeleport(entity);
|
||||
- if (worldserver.dimension() == World.END) {
|
||||
- WorldServer.makeObsidianPlatform(worldserver);
|
||||
+ if (worldserver.getTypeKey() == DimensionManager.END_LOCATION) { // CraftBukkit
|
||||
+ WorldServer.a(worldserver, this); // CraftBukkit
|
||||
+ WorldServer.makeObsidianPlatform(worldserver, this); // CraftBukkit
|
||||
+ }
|
||||
+ // CraftBukkit start - Forward the CraftEntity to the new entity
|
||||
+ this.getBukkitEntity().setHandle(entity);
|
||||
+ entity.bukkitEntity = this.getBukkitEntity();
|
||||
+
|
||||
+ if (this instanceof EntityInsentient) {
|
||||
+ ((EntityInsentient) this).unleash(true, false); // Unleash to prevent duping of leads.
|
||||
+ ((EntityInsentient) this).dropLeash(true, false); // Unleash to prevent duping of leads.
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
this.cc();
|
||||
@@ -2396,13 +2774,18 @@
|
||||
this.removeAfterChangingDimensions();
|
||||
@@ -2433,20 +2811,33 @@
|
||||
|
||||
@Nullable
|
||||
protected ShapeDetectorShape a(WorldServer worldserver) {
|
||||
- boolean flag = this.level.getDimensionKey() == World.END && worldserver.getDimensionKey() == World.OVERWORLD;
|
||||
- boolean flag1 = worldserver.getDimensionKey() == World.END;
|
||||
protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) {
|
||||
- boolean flag = this.level.dimension() == World.END && worldserver.dimension() == World.OVERWORLD;
|
||||
- boolean flag1 = worldserver.dimension() == World.END;
|
||||
+ // CraftBukkit start
|
||||
+ if (worldserver == null) {
|
||||
+ return null;
|
||||
@@ -662,18 +671,16 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (!flag && !flag1) {
|
||||
- boolean flag2 = worldserver.getDimensionKey() == World.NETHER;
|
||||
- boolean flag2 = worldserver.dimension() == World.NETHER;
|
||||
+ boolean flag2 = worldserver.getTypeKey() == DimensionManager.NETHER_LOCATION; // CraftBukkit
|
||||
|
||||
- if (this.level.getDimensionKey() != World.NETHER && !flag2) {
|
||||
- if (this.level.dimension() != World.NETHER && !flag2) {
|
||||
+ if (this.level.getTypeKey() != DimensionManager.NETHER_LOCATION && !flag2) {
|
||||
return null;
|
||||
} else {
|
||||
WorldBorder worldborder = worldserver.getWorldBorder();
|
||||
@@ -2412,8 +2795,16 @@
|
||||
double d3 = Math.min(2.9999872E7D, worldborder.h() - 16.0D);
|
||||
double d4 = DimensionManager.a(this.level.getDimensionManager(), worldserver.getDimensionManager());
|
||||
BlockPosition blockposition = new BlockPosition(MathHelper.a(this.locX() * d4, d0, d2), this.locY(), MathHelper.a(this.locZ() * d4, d1, d3));
|
||||
double d0 = DimensionManager.getTeleportationScale(this.level.dimensionType(), worldserver.dimensionType());
|
||||
BlockPosition blockposition = worldborder.clampToBounds(this.getX() * d0, this.getY(), this.getZ() * d0);
|
||||
+ // CraftBukkit start
|
||||
+ CraftPortalEvent event = callPortalEvent(this, worldserver, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16);
|
||||
+ if (event == null) {
|
||||
@@ -682,26 +689,26 @@
|
||||
+ final WorldServer worldserverFinal = worldserver = ((CraftWorld) event.getTo().getWorld()).getHandle();
|
||||
+ blockposition = new BlockPosition(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
|
||||
|
||||
- return (ShapeDetectorShape) this.findOrCreatePortal(worldserver, blockposition, flag2).map((blockutil_rectangle) -> {
|
||||
+ return (ShapeDetectorShape) this.findOrCreatePortal(worldserver, blockposition, flag2, event.getSearchRadius(), event.getCanCreatePortal(), event.getCreationRadius()).map((blockutil_rectangle) -> {
|
||||
- return (ShapeDetectorShape) this.getExitPortal(worldserver, blockposition, flag2, worldborder).map((blockutil_rectangle) -> {
|
||||
+ return (ShapeDetectorShape) this.getExitPortal(worldserver, blockposition, flag2, worldborder, event.getSearchRadius(), event.getCanCreatePortal(), event.getCreationRadius()).map((blockutil_rectangle) -> {
|
||||
+ // CraftBukkit end
|
||||
IBlockData iblockdata = this.level.getType(this.portalEntrancePos);
|
||||
IBlockData iblockdata = this.level.getBlockState(this.portalEntrancePos);
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis;
|
||||
Vec3D vec3d;
|
||||
@@ -2430,8 +2821,8 @@
|
||||
@@ -2463,8 +2854,8 @@
|
||||
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
- return BlockPortalShape.a(worldserver, blockutil_rectangle, enumdirection_enumaxis, vec3d, this.a(this.getPose()), this.getMot(), this.getYRot(), this.getXRot());
|
||||
- return BlockPortalShape.createPortalInfo(worldserver, blockutil_rectangle, enumdirection_enumaxis, vec3d, this.getDimensions(this.getPose()), this.getDeltaMovement(), this.getYRot(), this.getXRot());
|
||||
- }).orElse((Object) null);
|
||||
+ return BlockPortalShape.a(worldserverFinal, blockutil_rectangle, enumdirection_enumaxis, vec3d, this.a(this.getPose()), this.getMot(), this.getYRot(), this.getXRot(), event); // CraftBukkit
|
||||
+ return BlockPortalShape.createPortalInfo(worldserverFinal, blockutil_rectangle, enumdirection_enumaxis, vec3d, this.getDimensions(this.getPose()), this.getDeltaMovement(), this.getYRot(), this.getXRot(), event); // CraftBukkit
|
||||
+ }).orElse(null); // CraftBuukkit - decompile error
|
||||
}
|
||||
} else {
|
||||
BlockPosition blockposition1;
|
||||
@@ -2441,8 +2832,15 @@
|
||||
@@ -2474,8 +2865,15 @@
|
||||
} else {
|
||||
blockposition1 = worldserver.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSpawn());
|
||||
blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos());
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ CraftPortalEvent event = callPortalEvent(this, worldserver, blockposition1, PlayerTeleportEvent.TeleportCause.END_PORTAL, 0, 0);
|
||||
@@ -710,18 +717,18 @@
|
||||
+ }
|
||||
+ blockposition1 = new BlockPosition(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
|
||||
|
||||
- return new ShapeDetectorShape(new Vec3D((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D), this.getMot(), this.getYRot(), this.getXRot());
|
||||
+ return new ShapeDetectorShape(new Vec3D((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D), this.getMot(), this.getYRot(), this.getXRot(), ((CraftWorld) event.getTo().getWorld()).getHandle(), event);
|
||||
- return new ShapeDetectorShape(new Vec3D((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D), this.getDeltaMovement(), this.getYRot(), this.getXRot());
|
||||
+ return new ShapeDetectorShape(new Vec3D((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D), this.getDeltaMovement(), this.getYRot(), this.getXRot(), ((CraftWorld) event.getTo().getWorld()).getHandle(), event);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2450,8 +2848,23 @@
|
||||
return BlockPortalShape.a(blockutil_rectangle, enumdirection_enumaxis, this.getPositionVector(), this.a(this.getPose()));
|
||||
@@ -2483,8 +2881,23 @@
|
||||
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
|
||||
}
|
||||
|
||||
- protected Optional<BlockUtil.Rectangle> findOrCreatePortal(WorldServer worldserver, BlockPosition blockposition, boolean flag) {
|
||||
- return worldserver.getTravelAgent().findPortal(blockposition, flag);
|
||||
- protected Optional<BlockUtil.Rectangle> getExitPortal(WorldServer worldserver, BlockPosition blockposition, boolean flag, WorldBorder worldborder) {
|
||||
- return worldserver.getPortalForcer().findPortalAround(blockposition, flag, worldborder);
|
||||
+ // CraftBukkit start
|
||||
+ protected CraftPortalEvent callPortalEvent(Entity entity, WorldServer exitWorldServer, BlockPosition exitPosition, PlayerTeleportEvent.TeleportCause cause, int searchRadius, int creationRadius) {
|
||||
+ org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
|
||||
@@ -736,16 +743,16 @@
|
||||
+ return new CraftPortalEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ protected Optional<BlockUtil.Rectangle> findOrCreatePortal(WorldServer worldserver, BlockPosition blockposition, boolean flag, int searchRadius, boolean canCreatePortal, int createRadius) {
|
||||
+ return worldserver.getTravelAgent().findPortal(blockposition, searchRadius);
|
||||
+ protected Optional<BlockUtil.Rectangle> getExitPortal(WorldServer worldserver, BlockPosition blockposition, boolean flag, WorldBorder worldborder, int searchRadius, boolean canCreatePortal, int createRadius) {
|
||||
+ return worldserver.getPortalForcer().findPortalAround(blockposition, worldborder, searchRadius);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean canPortal() {
|
||||
@@ -2660,7 +3073,26 @@
|
||||
public boolean canChangeDimensions() {
|
||||
@@ -2693,7 +3106,26 @@
|
||||
}
|
||||
|
||||
public final void a(AxisAlignedBB axisalignedbb) {
|
||||
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
|
||||
- this.bb = axisalignedbb;
|
||||
+ // CraftBukkit start - block invalid bounding boxes
|
||||
+ double minX = axisalignedbb.minX,
|
||||
@@ -769,4 +776,4 @@
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
protected float getHeadHeight(EntityPose entitypose, EntitySize entitysize) {
|
||||
protected float getEyeHeight(EntityPose entitypose, EntitySize entitysize) {
|
||||
|
||||
@@ -9,16 +9,16 @@
|
||||
protected EntityAgeable(EntityTypes<? extends EntityAgeable> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -102,6 +103,7 @@
|
||||
super.saveData(nbttagcompound);
|
||||
nbttagcompound.setInt("Age", this.getAge());
|
||||
nbttagcompound.setInt("ForcedAge", this.forcedAge);
|
||||
+ nbttagcompound.setBoolean("AgeLocked", this.ageLocked); // CraftBukkit
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
nbttagcompound.putInt("Age", this.getAge());
|
||||
nbttagcompound.putInt("ForcedAge", this.forcedAge);
|
||||
+ nbttagcompound.putBoolean("AgeLocked", this.ageLocked); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -109,6 +111,7 @@
|
||||
super.loadData(nbttagcompound);
|
||||
this.setAgeRaw(nbttagcompound.getInt("Age"));
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
this.setAge(nbttagcompound.getInt("Age"));
|
||||
this.forcedAge = nbttagcompound.getInt("ForcedAge");
|
||||
+ this.ageLocked = nbttagcompound.getBoolean("AgeLocked"); // CraftBukkit
|
||||
}
|
||||
@@ -26,10 +26,10 @@
|
||||
@Override
|
||||
@@ -123,7 +126,7 @@
|
||||
@Override
|
||||
public void movementTick() {
|
||||
super.movementTick();
|
||||
public void aiStep() {
|
||||
super.aiStep();
|
||||
- if (this.level.isClientSide) {
|
||||
+ if (this.level.isClientSide || ageLocked) { // CraftBukkit
|
||||
if (this.forcedAgeTimer > 0) {
|
||||
if (this.forcedAgeTimer % 4 == 0) {
|
||||
this.level.addParticle(Particles.HAPPY_VILLAGER, this.d(1.0D), this.da() + 0.5D, this.g(1.0D), 0.0D, 0.0D, 0.0D);
|
||||
this.level.addParticle(Particles.HAPPY_VILLAGER, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), 0.0D, 0.0D, 0.0D);
|
||||
|
||||
@@ -20,21 +20,21 @@
|
||||
+ // CraftBukkit start accessor methods
|
||||
+ public void refreshEffects() {
|
||||
+ if (!this.fixedColor) {
|
||||
+ this.getDataWatcher().set(EntityAreaEffectCloud.DATA_COLOR, PotionUtil.a((Collection) PotionUtil.a(this.potion, (Collection) this.effects))); // PAIL: rename
|
||||
+ this.getEntityData().set(EntityAreaEffectCloud.DATA_COLOR, PotionUtil.getColor((Collection) PotionUtil.getAllEffects(this.potion, this.effects)));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public String getType() {
|
||||
+ public String getPotionType() {
|
||||
+ return ((MinecraftKey) IRegistry.POTION.getKey(this.potion)).toString();
|
||||
+ }
|
||||
+
|
||||
+ public void setType(String string) {
|
||||
+ a(IRegistry.POTION.get(new MinecraftKey(string)));
|
||||
+ public void setPotionType(String string) {
|
||||
+ setPotion(IRegistry.POTION.get(new MinecraftKey(string)));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public int getColor() {
|
||||
return (Integer) this.getDataWatcher().get(EntityAreaEffectCloud.DATA_COLOR);
|
||||
return (Integer) this.getEntityData().get(EntityAreaEffectCloud.DATA_COLOR);
|
||||
}
|
||||
@@ -259,6 +281,7 @@
|
||||
if (!list1.isEmpty()) {
|
||||
@@ -63,8 +63,8 @@
|
||||
Iterator iterator2 = list.iterator();
|
||||
|
||||
@@ -277,7 +311,7 @@
|
||||
if (mobeffect1.getMobEffect().isInstant()) {
|
||||
mobeffect1.getMobEffect().applyInstantEffect(this, this.getSource(), entityliving, mobeffect1.getAmplifier(), 0.5D);
|
||||
if (mobeffect1.getEffect().isInstantenous()) {
|
||||
mobeffect1.getEffect().applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect1.getAmplifier(), 0.5D);
|
||||
} else {
|
||||
- entityliving.addEffect(new MobEffect(mobeffect1), this);
|
||||
+ entityliving.addEffect(new MobEffect(mobeffect1), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AREA_EFFECT_CLOUD); // CraftBukkit
|
||||
|
||||
@@ -10,20 +10,20 @@
|
||||
+
|
||||
public abstract class EntityCreature extends EntityInsentient {
|
||||
|
||||
protected EntityCreature(EntityTypes<? extends EntityCreature> entitytypes, World world) {
|
||||
@@ -41,6 +45,7 @@
|
||||
protected static final float DEFAULT_WALK_TARGET_VALUE = 0.0F;
|
||||
@@ -43,6 +47,7 @@
|
||||
|
||||
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) {
|
||||
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isInSittingPose()) {
|
||||
if (f > 10.0F) {
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
|
||||
this.unleash(true, true);
|
||||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
@@ -49,6 +54,7 @@
|
||||
@@ -51,6 +56,7 @@
|
||||
|
||||
this.y(f);
|
||||
this.onLeashDistance(f);
|
||||
if (f > 10.0F) {
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
|
||||
this.unleash(true, true);
|
||||
this.goalSelector.a(PathfinderGoal.Type.MOVE);
|
||||
this.dropLeash(true, true);
|
||||
this.goalSelector.disableControlFlag(PathfinderGoal.Type.MOVE);
|
||||
} else if (f > 6.0F) {
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
public void tick() {
|
||||
super.tick();
|
||||
+ EntityHuman prevTarget = this.followingPlayer;// CraftBukkit - store old target
|
||||
this.xo = this.locX();
|
||||
this.yo = this.locY();
|
||||
this.zo = this.locZ();
|
||||
this.xo = this.getX();
|
||||
this.yo = this.getY();
|
||||
this.zo = this.getZ();
|
||||
@@ -84,7 +91,22 @@
|
||||
this.followingPlayer = null;
|
||||
}
|
||||
@@ -42,22 +42,22 @@
|
||||
+
|
||||
+ if (this.followingPlayer != null && !cancelled) {
|
||||
+ // CraftBukkit end
|
||||
Vec3D vec3d = new Vec3D(this.followingPlayer.locX() - this.locX(), this.followingPlayer.locY() + (double) this.followingPlayer.getHeadHeight() / 2.0D - this.locY(), this.followingPlayer.locZ() - this.locZ());
|
||||
double d0 = vec3d.g();
|
||||
Vec3D vec3d = new Vec3D(this.followingPlayer.getX() - this.getX(), this.followingPlayer.getY() + (double) this.followingPlayer.getEyeHeight() / 2.0D - this.getY(), this.followingPlayer.getZ() - this.getZ());
|
||||
double d0 = vec3d.lengthSqr();
|
||||
|
||||
@@ -225,7 +247,7 @@
|
||||
int i = this.a(entityhuman, this.value);
|
||||
int i = this.repairPlayerItems(entityhuman, this.value);
|
||||
|
||||
if (i > 0) {
|
||||
- entityhuman.giveExp(i);
|
||||
+ entityhuman.giveExp(CraftEventFactory.callPlayerExpChangeEvent(entityhuman, i).getAmount()); // CraftBukkit - this.value -> event.getAmount()
|
||||
- entityhuman.giveExperiencePoints(i);
|
||||
+ entityhuman.giveExperiencePoints(CraftEventFactory.callPlayerExpChangeEvent(entityhuman, i).getAmount()); // CraftBukkit - this.value -> event.getAmount()
|
||||
}
|
||||
|
||||
--this.count;
|
||||
@@ -243,9 +265,17 @@
|
||||
if (entry != null) {
|
||||
ItemStack itemstack = (ItemStack) entry.getValue();
|
||||
int j = Math.min(this.c(this.value), itemstack.getDamage());
|
||||
int j = Math.min(this.xpToDurability(this.value), itemstack.getDamageValue());
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.player.PlayerItemMendEvent event = CraftEventFactory.callPlayerItemMendEvent(entityhuman, this, itemstack, j);
|
||||
+ j = event.getRepairAmount();
|
||||
@@ -66,16 +66,16 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
itemstack.setDamage(itemstack.getDamage() - j);
|
||||
int k = i - this.b(j);
|
||||
itemstack.setDamageValue(itemstack.getDamageValue() - j);
|
||||
int k = i - this.durabilityToXp(j);
|
||||
+ this.value = k; // CraftBukkit - update exp value of orb for PlayerItemMendEvent calls
|
||||
|
||||
return k > 0 ? this.a(entityhuman, k) : 0;
|
||||
return k > 0 ? this.repairPlayerItems(entityhuman, k) : 0;
|
||||
} else {
|
||||
@@ -270,6 +300,24 @@
|
||||
}
|
||||
|
||||
public static int getOrbValue(int i) {
|
||||
public static int getExperienceValue(int i) {
|
||||
+ // CraftBukkit start
|
||||
+ if (i > 162670129) return i - 100000;
|
||||
+ if (i > 81335063) return 81335063;
|
||||
|
||||
@@ -19,17 +19,8 @@
|
||||
+
|
||||
public abstract class EntityInsentient extends EntityLiving {
|
||||
|
||||
private static final DataWatcherObject<Byte> DATA_MOB_FLAGS_ID = DataWatcher.a(EntityInsentient.class, DataWatcherRegistry.BYTE);
|
||||
@@ -101,7 +114,7 @@
|
||||
private final NonNullList<ItemStack> armorItems;
|
||||
public final float[] armorDropChances;
|
||||
private boolean canPickUpLoot;
|
||||
- public boolean persistenceRequired;
|
||||
+ private boolean persistenceRequired;
|
||||
private final Map<PathType, Float> pathfindingMalus;
|
||||
public MinecraftKey lootTable;
|
||||
public long lootTableSeed;
|
||||
@@ -113,6 +126,8 @@
|
||||
private static final DataWatcherObject<Byte> DATA_MOB_FLAGS_ID = DataWatcher.defineId(EntityInsentient.class, DataWatcherRegistry.BYTE);
|
||||
@@ -116,6 +129,8 @@
|
||||
private BlockPosition restrictCenter;
|
||||
private float restrictRadius;
|
||||
|
||||
@@ -37,13 +28,13 @@
|
||||
+
|
||||
protected EntityInsentient(EntityTypes<? extends EntityInsentient> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
this.handItems = NonNullList.a(2, ItemStack.EMPTY);
|
||||
@@ -136,7 +151,14 @@
|
||||
this.initPathfinder();
|
||||
this.handItems = NonNullList.withSize(2, ItemStack.EMPTY);
|
||||
@@ -139,7 +154,14 @@
|
||||
this.registerGoals();
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - default persistance to type's persistance value
|
||||
+ this.persistenceRequired = !isTypeNotPersistent(0);
|
||||
+ this.persistenceRequired = !removeWhenFarAway(0);
|
||||
+ }
|
||||
+
|
||||
+ public void setPersistenceRequired(boolean persistenceRequired) {
|
||||
@@ -51,21 +42,21 @@
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
protected void initPathfinder() {}
|
||||
protected void registerGoals() {}
|
||||
|
||||
@@ -216,7 +238,38 @@
|
||||
@@ -219,7 +241,38 @@
|
||||
}
|
||||
|
||||
public void setGoalTarget(@Nullable EntityLiving entityliving) {
|
||||
public void setTarget(@Nullable EntityLiving entityliving) {
|
||||
+ // CraftBukkit start - fire event
|
||||
+ setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true);
|
||||
+ setTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true);
|
||||
+ }
|
||||
+
|
||||
+ public boolean setGoalTarget(EntityLiving entityliving, EntityTargetEvent.TargetReason reason, boolean fireEvent) {
|
||||
+ if (getGoalTarget() == entityliving) return false;
|
||||
+ public boolean setTarget(EntityLiving entityliving, EntityTargetEvent.TargetReason reason, boolean fireEvent) {
|
||||
+ if (getTarget() == entityliving) return false;
|
||||
+ if (fireEvent) {
|
||||
+ if (reason == EntityTargetEvent.TargetReason.UNKNOWN && getGoalTarget() != null && entityliving == null) {
|
||||
+ reason = getGoalTarget().isAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
|
||||
+ if (reason == EntityTargetEvent.TargetReason.UNKNOWN && getTarget() != null && entityliving == null) {
|
||||
+ reason = getTarget().isAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
|
||||
+ }
|
||||
+ if (reason == EntityTargetEvent.TargetReason.UNKNOWN) {
|
||||
+ level.getCraftServer().getLogger().log(java.util.logging.Level.WARNING, "Unknown target reason, please report on the issue tracker", new Exception());
|
||||
@@ -92,23 +83,23 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -443,16 +496,26 @@
|
||||
nbttagcompound.setBoolean("NoAI", this.isNoAI());
|
||||
@@ -446,16 +499,26 @@
|
||||
nbttagcompound.putBoolean("NoAI", this.isNoAi());
|
||||
}
|
||||
|
||||
+ nbttagcompound.setBoolean("Bukkit.Aware", this.aware); // CraftBukkit
|
||||
+ nbttagcompound.putBoolean("Bukkit.Aware", this.aware); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadData(NBTTagCompound nbttagcompound) {
|
||||
super.loadData(nbttagcompound);
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
+
|
||||
+ // CraftBukkit start - If looting or persistence is false only use it if it was set after we started using it
|
||||
if (nbttagcompound.hasKeyOfType("CanPickUpLoot", 1)) {
|
||||
- this.setCanPickupLoot(nbttagcompound.getBoolean("CanPickUpLoot"));
|
||||
if (nbttagcompound.contains("CanPickUpLoot", 1)) {
|
||||
- this.setCanPickUpLoot(nbttagcompound.getBoolean("CanPickUpLoot"));
|
||||
+ boolean data = nbttagcompound.getBoolean("CanPickUpLoot");
|
||||
+ if (isLevelAtLeast(nbttagcompound, 1) || data) {
|
||||
+ this.setCanPickupLoot(data);
|
||||
+ this.setCanPickUpLoot(data);
|
||||
+ }
|
||||
}
|
||||
|
||||
@@ -121,207 +112,202 @@
|
||||
NBTTagList nbttaglist;
|
||||
int i;
|
||||
|
||||
@@ -499,6 +562,11 @@
|
||||
@@ -502,6 +565,11 @@
|
||||
}
|
||||
|
||||
this.setNoAI(nbttagcompound.getBoolean("NoAI"));
|
||||
this.setNoAi(nbttagcompound.getBoolean("NoAI"));
|
||||
+ // CraftBukkit start
|
||||
+ if (nbttagcompound.hasKey("Bukkit.Aware")) {
|
||||
+ if (nbttagcompound.contains("Bukkit.Aware")) {
|
||||
+ this.aware = nbttagcompound.getBoolean("Bukkit.Aware");
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -562,7 +630,7 @@
|
||||
protected void b(EntityItem entityitem) {
|
||||
ItemStack itemstack = entityitem.getItemStack();
|
||||
@@ -565,7 +633,7 @@
|
||||
protected void pickUpItem(EntityItem entityitem) {
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
|
||||
- if (this.j(itemstack)) {
|
||||
+ if (this.j(itemstack, entityitem)) { // CraftBukkit - add item
|
||||
this.a(entityitem);
|
||||
this.receive(entityitem, itemstack.getCount());
|
||||
entityitem.die();
|
||||
@@ -571,15 +639,29 @@
|
||||
- if (this.equipItemIfPossible(itemstack)) {
|
||||
+ if (this.equipItemIfPossible(itemstack, entityitem)) { // CraftBukkit - add item
|
||||
this.onItemPickup(entityitem);
|
||||
this.take(entityitem, itemstack.getCount());
|
||||
entityitem.discard();
|
||||
@@ -574,15 +642,29 @@
|
||||
}
|
||||
|
||||
public boolean j(ItemStack itemstack) {
|
||||
public boolean equipItemIfPossible(ItemStack itemstack) {
|
||||
+ // CraftBukkit start - add item
|
||||
+ return this.j(itemstack, null);
|
||||
+ return this.equipItemIfPossible(itemstack, null);
|
||||
+ }
|
||||
+
|
||||
+ public boolean j(ItemStack itemstack, EntityItem entityitem) {
|
||||
+ public boolean equipItemIfPossible(ItemStack itemstack, EntityItem entityitem) {
|
||||
+ // CraftBukkit end
|
||||
EnumItemSlot enumitemslot = getEquipmentSlotForItem(itemstack);
|
||||
ItemStack itemstack1 = this.getEquipment(enumitemslot);
|
||||
boolean flag = this.a(itemstack, itemstack1);
|
||||
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
|
||||
boolean flag = this.canReplaceCurrentItem(itemstack, itemstack1);
|
||||
|
||||
- if (flag && this.canPickup(itemstack)) {
|
||||
- if (flag && this.canHoldItem(itemstack)) {
|
||||
+ // CraftBukkit start
|
||||
+ boolean canPickup = flag && this.canPickup(itemstack);
|
||||
+ boolean canPickup = flag && this.canHoldItem(itemstack);
|
||||
+ if (entityitem != null) {
|
||||
+ canPickup = !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, entityitem, 0, !canPickup).isCancelled();
|
||||
+ }
|
||||
+ if (canPickup) {
|
||||
+ // CraftBukkit end
|
||||
double d0 = (double) this.e(enumitemslot);
|
||||
double d0 = (double) this.getEquipmentDropChance(enumitemslot);
|
||||
|
||||
if (!itemstack1.isEmpty() && (double) Math.max(this.random.nextFloat() - 0.1F, 0.0F) < d0) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.b(itemstack1);
|
||||
this.spawnAtLocation(itemstack1);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
}
|
||||
|
||||
this.b(enumitemslot, itemstack);
|
||||
@@ -692,18 +774,18 @@
|
||||
EntityHuman entityhuman = this.level.findNearbyPlayer(this, -1.0D);
|
||||
|
||||
if (entityhuman != null) {
|
||||
- double d0 = entityhuman.f(this);
|
||||
+ double d0 = entityhuman.f((Entity) this); // CraftBukkit - decompile error
|
||||
int i = this.getEntityType().f().f();
|
||||
this.setItemSlotAndDropWhenKilled(enumitemslot, itemstack);
|
||||
@@ -699,14 +781,14 @@
|
||||
int i = this.getType().getCategory().getDespawnDistance();
|
||||
int j = i * i;
|
||||
|
||||
- if (d0 > (double) j && this.isTypeNotPersistent(d0)) {
|
||||
- if (d0 > (double) j && this.removeWhenFarAway(d0)) {
|
||||
+ if (d0 > (double) j) { // CraftBukkit - remove isTypeNotPersistent() check
|
||||
this.die();
|
||||
this.discard();
|
||||
}
|
||||
|
||||
int k = this.getEntityType().f().g();
|
||||
int k = this.getType().getCategory().getNoDespawnDistance();
|
||||
int l = k * k;
|
||||
|
||||
- if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l && this.isTypeNotPersistent(d0)) {
|
||||
- if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l && this.removeWhenFarAway(d0)) {
|
||||
+ if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l) { // CraftBukkit - remove isTypeNotPersistent() check
|
||||
this.die();
|
||||
this.discard();
|
||||
} else if (d0 < (double) l) {
|
||||
this.noActionTime = 0;
|
||||
@@ -718,6 +800,7 @@
|
||||
@@ -721,6 +803,7 @@
|
||||
@Override
|
||||
protected final void doTick() {
|
||||
protected final void serverAiStep() {
|
||||
++this.noActionTime;
|
||||
+ if (!this.aware) return; // CraftBukkit
|
||||
this.level.getMethodProfiler().enter("sensing");
|
||||
this.sensing.a();
|
||||
this.level.getMethodProfiler().exit();
|
||||
@@ -1101,6 +1184,12 @@
|
||||
this.level.getProfiler().push("sensing");
|
||||
this.sensing.tick();
|
||||
this.level.getProfiler().pop();
|
||||
@@ -1116,6 +1199,12 @@
|
||||
if (!this.isAlive()) {
|
||||
return EnumInteractionResult.PASS;
|
||||
} else if (this.getLeashHolder() == entityhuman) {
|
||||
+ // CraftBukkit start - fire PlayerUnleashEntityEvent
|
||||
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman).isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutAttachEntity(this, this.getLeashHolder()));
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutAttachEntity(this, this.getLeashHolder()));
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.unleash(true, !entityhuman.getAbilities().instabuild);
|
||||
return EnumInteractionResult.a(this.level.isClientSide);
|
||||
this.dropLeash(true, !entityhuman.getAbilities().instabuild);
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
} else {
|
||||
@@ -1119,6 +1208,12 @@
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
@@ -1134,6 +1223,12 @@
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack.a(Items.LEAD) && this.a(entityhuman)) {
|
||||
if (itemstack.is(Items.LEAD) && this.canBeLeashed(entityhuman)) {
|
||||
+ // CraftBukkit start - fire PlayerLeashEntityEvent
|
||||
+ if (CraftEventFactory.callPlayerLeashEntityEvent(this, entityhuman, entityhuman).isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutAttachEntity(this, this.getLeashHolder()));
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutAttachEntity(this, this.getLeashHolder()));
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.setLeashHolder(entityhuman, true);
|
||||
itemstack.subtract(1);
|
||||
return EnumInteractionResult.a(this.level.isClientSide);
|
||||
@@ -1134,7 +1229,7 @@
|
||||
this.setLeashedTo(entityhuman, true);
|
||||
itemstack.shrink(1);
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
@@ -1149,7 +1244,7 @@
|
||||
if (itemstack.getItem() instanceof ItemMonsterEgg) {
|
||||
if (this.level instanceof WorldServer) {
|
||||
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
|
||||
- Optional<EntityInsentient> optional = itemmonsteregg.a(entityhuman, this, this.getEntityType(), (WorldServer) this.level, this.getPositionVector(), itemstack);
|
||||
+ Optional<EntityInsentient> optional = itemmonsteregg.a(entityhuman, this, (EntityTypes<? extends EntityInsentient>) this.getEntityType(), (WorldServer) this.level, this.getPositionVector(), itemstack); // CraftBukkit - decompile error
|
||||
- Optional<EntityInsentient> optional = itemmonsteregg.spawnOffspringFromSpawnEgg(entityhuman, this, this.getType(), (WorldServer) this.level, this.position(), itemstack);
|
||||
+ Optional<EntityInsentient> optional = itemmonsteregg.spawnOffspringFromSpawnEgg(entityhuman, this, (EntityTypes<? extends EntityInsentient>) this.getType(), (WorldServer) this.level, this.position(), itemstack); // CraftBukkit - decompile error
|
||||
|
||||
optional.ifPresent((entityinsentient) -> {
|
||||
this.a(entityhuman, entityinsentient);
|
||||
@@ -1184,12 +1279,19 @@
|
||||
this.onOffspringSpawnedFromEgg(entityhuman, entityinsentient);
|
||||
@@ -1199,12 +1294,19 @@
|
||||
return this.restrictRadius != -1.0F;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@Nullable
|
||||
public <T extends EntityInsentient> T a(EntityTypes<T> entitytypes, boolean flag) {
|
||||
+ return this.a(entitytypes, flag, EntityTransformEvent.TransformReason.UNKNOWN, CreatureSpawnEvent.SpawnReason.DEFAULT);
|
||||
public <T extends EntityInsentient> T convertTo(EntityTypes<T> entitytypes, boolean flag) {
|
||||
+ return this.convertTo(entitytypes, flag, EntityTransformEvent.TransformReason.UNKNOWN, CreatureSpawnEvent.SpawnReason.DEFAULT);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public <T extends EntityInsentient> T a(EntityTypes<T> entitytypes, boolean flag, EntityTransformEvent.TransformReason transformReason, CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ public <T extends EntityInsentient> T convertTo(EntityTypes<T> entitytypes, boolean flag, EntityTransformEvent.TransformReason transformReason, CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ // CraftBukkit end
|
||||
if (this.isRemoved()) {
|
||||
return null;
|
||||
} else {
|
||||
- T t0 = (EntityInsentient) entitytypes.a(this.level);
|
||||
+ T t0 = entitytypes.a(this.level); // CraftBukkit - decompile error
|
||||
- T t0 = (EntityInsentient) entitytypes.create(this.level);
|
||||
+ T t0 = entitytypes.create(this.level); // CraftBukkit - decompile error
|
||||
|
||||
t0.s(this);
|
||||
t0.copyPosition(this);
|
||||
t0.setBaby(this.isBaby());
|
||||
@@ -1221,7 +1323,12 @@
|
||||
@@ -1236,7 +1338,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.level.addEntity(t0);
|
||||
- this.level.addFreshEntity(t0);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, t0, transformReason).isCancelled()) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ this.level.addEntity(t0, spawnReason);
|
||||
+ this.level.addFreshEntity(t0, spawnReason);
|
||||
+ // CraftBukkit end
|
||||
if (this.isPassenger()) {
|
||||
Entity entity = this.getVehicle();
|
||||
|
||||
@@ -1241,6 +1348,7 @@
|
||||
@@ -1256,6 +1363,7 @@
|
||||
|
||||
if (this.leashHolder != null) {
|
||||
if (!this.isAlive() || !this.leashHolder.isAlive()) {
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit
|
||||
this.unleash(true, true);
|
||||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
@@ -1252,7 +1360,9 @@
|
||||
@@ -1267,7 +1375,9 @@
|
||||
this.leashHolder = null;
|
||||
this.leashInfoTag = null;
|
||||
if (!this.level.isClientSide && flag1) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.a((IMaterial) Items.LEAD);
|
||||
this.spawnAtLocation((IMaterial) Items.LEAD);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
}
|
||||
|
||||
if (!this.level.isClientSide && flag && this.level instanceof WorldServer) {
|
||||
@@ -1302,6 +1412,7 @@
|
||||
boolean flag1 = super.a(entity, flag);
|
||||
@@ -1317,6 +1427,7 @@
|
||||
boolean flag1 = super.startRiding(entity, flag);
|
||||
|
||||
if (flag1 && this.isLeashed()) {
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
|
||||
this.unleash(true, true);
|
||||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
@@ -1397,7 +1508,14 @@
|
||||
int i = EnchantmentManager.getFireAspectEnchantmentLevel(this);
|
||||
@@ -1412,7 +1523,14 @@
|
||||
int i = EnchantmentManager.getFireAspect(this);
|
||||
|
||||
if (i > 0) {
|
||||
- entity.setOnFire(i * 4);
|
||||
- entity.setSecondsOnFire(i * 4);
|
||||
+ // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
|
||||
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), i * 4);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
|
||||
+
|
||||
+ if (!combustEvent.isCancelled()) {
|
||||
+ entity.setOnFire(combustEvent.getDuration(), false);
|
||||
+ entity.setSecondsOnFire(combustEvent.getDuration(), false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
boolean flag = entity.damageEntity(DamageSource.mobAttack(this), f);
|
||||
@@ -1465,9 +1583,10 @@
|
||||
boolean flag = entity.hurt(DamageSource.mobAttack(this), f);
|
||||
@@ -1480,9 +1598,10 @@
|
||||
@Override
|
||||
protected void cc() {
|
||||
super.cc();
|
||||
protected void removeAfterChangingDimensions() {
|
||||
super.removeAfterChangingDimensions();
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
|
||||
this.unleash(true, false);
|
||||
this.by().forEach((itemstack) -> {
|
||||
this.dropLeash(true, false);
|
||||
this.getAllSlots().forEach((itemstack) -> {
|
||||
- itemstack.setCount(0);
|
||||
+ if (!itemstack.isEmpty()) itemstack.setCount(0); // CraftBukkit
|
||||
});
|
||||
|
||||
@@ -1,64 +1,63 @@
|
||||
--- a/net/minecraft/world/entity/EntityLightning.java
|
||||
+++ b/net/minecraft/world/entity/EntityLightning.java
|
||||
@@ -32,6 +32,11 @@
|
||||
@@ -31,6 +31,10 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutNamedSoundEffect;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityLightning extends Entity {
|
||||
|
||||
private static final int START_LIFE = 2;
|
||||
@@ -132,7 +137,7 @@
|
||||
@@ -131,7 +135,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (this.life >= 0) {
|
||||
+ if (this.life >= 0 && !this.visualOnly) { // CraftBukkit - add !this.isEffect
|
||||
+ if (this.life >= 0 && !this.visualOnly) { // CraftBukkit - add !this.visualOnly
|
||||
if (!(this.level instanceof WorldServer)) {
|
||||
this.level.c(2);
|
||||
this.level.setSkyFlashTime(2);
|
||||
} else if (!this.visualOnly) {
|
||||
@@ -166,8 +171,12 @@
|
||||
IBlockData iblockdata = BlockFireAbstract.a((IBlockAccess) this.level, blockposition);
|
||||
@@ -165,8 +169,12 @@
|
||||
IBlockData iblockdata = BlockFireAbstract.getState(this.level, blockposition);
|
||||
|
||||
if (this.level.getType(blockposition).isAir() && iblockdata.canPlace(this.level, blockposition)) {
|
||||
- this.level.setTypeUpdate(blockposition, iblockdata);
|
||||
if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
|
||||
- this.level.setBlockAndUpdate(blockposition, iblockdata);
|
||||
- ++this.blocksSetOnFire;
|
||||
+ // CraftBukkit start - add "!isEffect"
|
||||
+ // CraftBukkit start - add "!visualOnly"
|
||||
+ if (!visualOnly && !CraftEventFactory.callBlockIgniteEvent(level, blockposition, this).isCancelled()) {
|
||||
+ this.level.setTypeUpdate(blockposition, iblockdata);
|
||||
+ this.level.setBlockAndUpdate(blockposition, iblockdata);
|
||||
+ ++this.blocksSetOnFire;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
@@ -175,8 +184,12 @@
|
||||
@@ -174,8 +182,12 @@
|
||||
|
||||
iblockdata = BlockFireAbstract.a((IBlockAccess) this.level, blockposition1);
|
||||
if (this.level.getType(blockposition1).isAir() && iblockdata.canPlace(this.level, blockposition1)) {
|
||||
- this.level.setTypeUpdate(blockposition1, iblockdata);
|
||||
iblockdata = BlockFireAbstract.getState(this.level, blockposition1);
|
||||
if (this.level.getBlockState(blockposition1).isAir() && iblockdata.canSurvive(this.level, blockposition1)) {
|
||||
- this.level.setBlockAndUpdate(blockposition1, iblockdata);
|
||||
- ++this.blocksSetOnFire;
|
||||
+ // CraftBukkit start - add "!isEffect"
|
||||
+ // CraftBukkit start - add "!visualOnly"
|
||||
+ if (!visualOnly && !CraftEventFactory.callBlockIgniteEvent(level, blockposition1, this).isCancelled()) {
|
||||
+ this.level.setTypeUpdate(blockposition1, iblockdata);
|
||||
+ this.level.setBlockAndUpdate(blockposition1, iblockdata);
|
||||
+ ++this.blocksSetOnFire;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,8 +253,9 @@
|
||||
iblockdata = world.getType(blockposition1);
|
||||
@@ -239,8 +251,9 @@
|
||||
iblockdata = world.getBlockState(blockposition1);
|
||||
} while (!(iblockdata.getBlock() instanceof WeatheringCopper));
|
||||
|
||||
+ BlockPosition blockposition1Final = blockposition1; // CraftBukkit - decompile error
|
||||
WeatheringCopper.b(iblockdata).ifPresent((iblockdata1) -> {
|
||||
- world.setTypeUpdate(blockposition1, iblockdata1);
|
||||
+ world.setTypeUpdate(blockposition1Final, iblockdata1); // CraftBukkit - decompile error
|
||||
WeatheringCopper.getPrevious(iblockdata).ifPresent((iblockdata1) -> {
|
||||
- world.setBlockAndUpdate(blockposition1, iblockdata1);
|
||||
+ world.setBlockAndUpdate(blockposition1Final, iblockdata1); // CraftBukkit - decompile error
|
||||
});
|
||||
world.triggerEffect(3002, blockposition1, -1);
|
||||
world.levelEvent(3002, blockposition1, -1);
|
||||
return Optional.of(blockposition1);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/EntityLiving.java
|
||||
+++ b/net/minecraft/world/entity/EntityLiving.java
|
||||
@@ -119,6 +119,30 @@
|
||||
@@ -116,6 +116,30 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeam;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
public abstract class EntityLiving extends Entity {
|
||||
|
||||
private static final UUID SPEED_MODIFIER_SPRINTING_UUID = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
|
||||
@@ -227,6 +251,21 @@
|
||||
@@ -224,6 +248,21 @@
|
||||
private float swimAmount;
|
||||
private float swimAmountO;
|
||||
protected BehaviorController<?> brain;
|
||||
@@ -47,83 +47,83 @@
|
||||
+
|
||||
+ @Override
|
||||
+ public float getBukkitYaw() {
|
||||
+ return getHeadRotation();
|
||||
+ return getYHeadRot();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
protected EntityLiving(EntityTypes<? extends EntityLiving> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -239,7 +278,9 @@
|
||||
@@ -236,7 +275,9 @@
|
||||
this.useItem = ItemStack.EMPTY;
|
||||
this.lastClimbablePos = Optional.empty();
|
||||
this.attributes = new AttributeMapBase(AttributeDefaults.a(entitytypes));
|
||||
this.attributes = new AttributeMapBase(AttributeDefaults.getSupplier(entitytypes));
|
||||
- this.setHealth(this.getMaxHealth());
|
||||
+ this.craftAttributes = new CraftAttributeMap(attributes); // CraftBukkit
|
||||
+ // CraftBukkit - setHealth(getMaxHealth()) inlined and simplified to skip the instanceof check for EntityPlayer, as getBukkitEntity() is not initialized in constructor
|
||||
+ this.entityData.set(EntityLiving.DATA_HEALTH_ID, (float) this.getAttributeInstance(GenericAttributes.MAX_HEALTH).getValue());
|
||||
+ this.entityData.set(EntityLiving.DATA_HEALTH_ID, (float) this.getAttribute(GenericAttributes.MAX_HEALTH).getValue());
|
||||
this.blocksBuilding = true;
|
||||
this.rotA = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
|
||||
this.ah();
|
||||
@@ -306,7 +347,13 @@
|
||||
this.reapplyPosition();
|
||||
@@ -303,7 +344,13 @@
|
||||
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
|
||||
int i = (int) (150.0D * d1);
|
||||
|
||||
- ((WorldServer) this.level).a(new ParticleParamBlock(Particles.BLOCK, iblockdata), this.locX(), this.locY(), this.locZ(), i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
- ((WorldServer) this.level).sendParticles(new ParticleParamBlock(Particles.BLOCK, iblockdata), this.getX(), this.getY(), this.getZ(), i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
+ // CraftBukkit start - visiblity api
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ ((WorldServer) this.level).sendParticles((EntityPlayer) this, new ParticleParamBlock(Particles.BLOCK, iblockdata), this.locX(), this.locY(), this.locZ(), i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, false);
|
||||
+ ((WorldServer) this.level).sendParticles((EntityPlayer) this, new ParticleParamBlock(Particles.BLOCK, iblockdata), this.getX(), this.getY(), this.getZ(), i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, false);
|
||||
+ } else {
|
||||
+ ((WorldServer) this.level).a(new ParticleParamBlock(Particles.BLOCK, iblockdata), this.locX(), this.locY(), this.locZ(), i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
+ ((WorldServer) this.level).sendParticles(new ParticleParamBlock(Particles.BLOCK, iblockdata), this.getX(), this.getY(), this.getZ(), i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,7 +613,7 @@
|
||||
@@ -561,7 +608,7 @@
|
||||
|
||||
protected void dB() {
|
||||
protected void tickDeath() {
|
||||
++this.deathTime;
|
||||
- if (this.deathTime == 20 && !this.level.isClientSide()) {
|
||||
+ if (this.deathTime >= 20 && !this.isRemoved() && !this.level.isClientSide()) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead)
|
||||
this.level.broadcastEntityEffect(this, (byte) 60);
|
||||
this.a(Entity.RemovalReason.KILLED);
|
||||
this.level.broadcastEntityEvent(this, (byte) 60);
|
||||
this.remove(Entity.RemovalReason.KILLED);
|
||||
}
|
||||
@@ -658,9 +705,15 @@
|
||||
@@ -653,9 +700,15 @@
|
||||
}
|
||||
|
||||
protected void playEquipSound(ItemStack itemstack) {
|
||||
protected void equipEventAndSound(ItemStack itemstack) {
|
||||
+ // CraftBukkit start
|
||||
+ this.playEquipSound(itemstack, false);
|
||||
+ this.equipEventAndSound(itemstack, false);
|
||||
+ }
|
||||
+
|
||||
+ protected void playEquipSound(ItemStack itemstack, boolean silent) {
|
||||
SoundEffect soundeffect = itemstack.M();
|
||||
+ protected void equipEventAndSound(ItemStack itemstack, boolean silent) {
|
||||
SoundEffect soundeffect = itemstack.getEquipSound();
|
||||
|
||||
- if (!itemstack.isEmpty() && soundeffect != null && !this.isSpectator()) {
|
||||
+ if (!itemstack.isEmpty() && soundeffect != null && !this.isSpectator() && !silent) {
|
||||
+ // CraftBukkit end
|
||||
this.a(GameEvent.EQUIP);
|
||||
this.gameEvent(GameEvent.EQUIP);
|
||||
this.playSound(soundeffect, 1.0F, 1.0F);
|
||||
}
|
||||
@@ -722,6 +775,17 @@
|
||||
@@ -717,6 +770,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (nbttagcompound.hasKey("Bukkit.MaxHealth")) {
|
||||
+ if (nbttagcompound.contains("Bukkit.MaxHealth")) {
|
||||
+ NBTBase nbtbase = nbttagcompound.get("Bukkit.MaxHealth");
|
||||
+ if (nbtbase.getTypeId() == 5) {
|
||||
+ this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(((NBTTagFloat) nbtbase).asDouble());
|
||||
+ } else if (nbtbase.getTypeId() == 3) {
|
||||
+ this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(((NBTTagInt) nbtbase).asDouble());
|
||||
+ if (nbtbase.getId() == 5) {
|
||||
+ this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(((NBTTagFloat) nbtbase).getAsDouble());
|
||||
+ } else if (nbtbase.getId() == 3) {
|
||||
+ this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(((NBTTagInt) nbtbase).getAsDouble());
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (nbttagcompound.hasKeyOfType("Health", 99)) {
|
||||
if (nbttagcompound.contains("Health", 99)) {
|
||||
this.setHealth(nbttagcompound.getFloat("Health"));
|
||||
}
|
||||
@@ -759,9 +823,32 @@
|
||||
@@ -754,9 +818,32 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -149,15 +149,15 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
protected void tickPotionEffects() {
|
||||
protected void tickEffects() {
|
||||
Iterator iterator = this.activeEffects.keySet().iterator();
|
||||
|
||||
+ isTickingEffects = true; // CraftBukkit
|
||||
try {
|
||||
while (iterator.hasNext()) {
|
||||
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
|
||||
@@ -771,6 +858,12 @@
|
||||
this.a(mobeffect, true, (Entity) null);
|
||||
@@ -766,6 +853,12 @@
|
||||
this.onEffectUpdated(mobeffect, true, (Entity) null);
|
||||
})) {
|
||||
if (!this.level.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
@@ -167,9 +167,9 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
iterator.remove();
|
||||
this.a(mobeffect);
|
||||
this.onEffectRemoved(mobeffect);
|
||||
}
|
||||
@@ -781,6 +874,17 @@
|
||||
@@ -776,6 +869,17 @@
|
||||
} catch (ConcurrentModificationException concurrentmodificationexception) {
|
||||
;
|
||||
}
|
||||
@@ -187,7 +187,7 @@
|
||||
|
||||
if (this.effectsDirty) {
|
||||
if (!this.level.isClientSide) {
|
||||
@@ -907,7 +1011,13 @@
|
||||
@@ -902,7 +1006,13 @@
|
||||
this.entityData.set(EntityLiving.DATA_EFFECT_COLOR_ID, 0);
|
||||
}
|
||||
|
||||
@@ -201,23 +201,23 @@
|
||||
if (this.level.isClientSide) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -916,7 +1026,14 @@
|
||||
@@ -911,7 +1021,14 @@
|
||||
boolean flag;
|
||||
|
||||
for (flag = false; iterator.hasNext(); flag = true) {
|
||||
- this.a((MobEffect) iterator.next());
|
||||
- this.onEffectRemoved((MobEffect) iterator.next());
|
||||
+ // CraftBukkit start
|
||||
+ MobEffect effect = (MobEffect) iterator.next();
|
||||
+ EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, effect, null, cause, EntityPotionEffectEvent.Action.CLEARED);
|
||||
+ if (event.isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ this.a(effect);
|
||||
+ this.onEffectRemoved(effect);
|
||||
+ // CraftBukkit end
|
||||
iterator.remove();
|
||||
}
|
||||
|
||||
@@ -945,18 +1062,48 @@
|
||||
@@ -940,18 +1057,48 @@
|
||||
return this.addEffect(mobeffect, (Entity) null);
|
||||
}
|
||||
|
||||
@@ -237,15 +237,15 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (!this.c(mobeffect)) {
|
||||
if (!this.canBeAffected(mobeffect)) {
|
||||
return false;
|
||||
} else {
|
||||
MobEffect mobeffect1 = (MobEffect) this.activeEffects.get(mobeffect.getMobEffect());
|
||||
MobEffect mobeffect1 = (MobEffect) this.activeEffects.get(mobeffect.getEffect());
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ boolean override = false;
|
||||
+ if (mobeffect1 != null) {
|
||||
+ override = new MobEffect(mobeffect1).b(mobeffect);
|
||||
+ override = new MobEffect(mobeffect1).update(mobeffect);
|
||||
+ }
|
||||
+
|
||||
+ EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, mobeffect1, mobeffect, cause, override);
|
||||
@@ -255,25 +255,25 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (mobeffect1 == null) {
|
||||
this.activeEffects.put(mobeffect.getMobEffect(), mobeffect);
|
||||
this.a(mobeffect, entity);
|
||||
this.activeEffects.put(mobeffect.getEffect(), mobeffect);
|
||||
this.onEffectAdded(mobeffect, entity);
|
||||
return true;
|
||||
- } else if (mobeffect1.b(mobeffect)) {
|
||||
- } else if (mobeffect1.update(mobeffect)) {
|
||||
+ // CraftBukkit start
|
||||
+ } else if (event.isOverride()) {
|
||||
+ mobeffect1.b(mobeffect);
|
||||
this.a(mobeffect1, true, entity);
|
||||
+ mobeffect1.update(mobeffect);
|
||||
this.onEffectUpdated(mobeffect1, true, entity);
|
||||
+ // CraftBukkit end
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -993,13 +1140,39 @@
|
||||
return this.getMonsterType() == EnumMonsterType.UNDEAD;
|
||||
@@ -988,13 +1135,39 @@
|
||||
return this.getMobType() == EnumMonsterType.UNDEAD;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@Nullable
|
||||
public MobEffect c(@Nullable MobEffectList mobeffectlist) {
|
||||
public MobEffect removeEffectNoUpdate(@Nullable MobEffectList mobeffectlist) {
|
||||
+ return c(mobeffectlist, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.UNKNOWN);
|
||||
+ }
|
||||
+
|
||||
@@ -298,7 +298,7 @@
|
||||
}
|
||||
|
||||
public boolean removeEffect(MobEffectList mobeffectlist) {
|
||||
- MobEffect mobeffect = this.c(mobeffectlist);
|
||||
- MobEffect mobeffect = this.removeEffectNoUpdate(mobeffectlist);
|
||||
+ return removeEffect(mobeffectlist, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.UNKNOWN);
|
||||
+ }
|
||||
+
|
||||
@@ -307,8 +307,8 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (mobeffect != null) {
|
||||
this.a(mobeffect);
|
||||
@@ -1036,20 +1209,55 @@
|
||||
this.onEffectRemoved(mobeffect);
|
||||
@@ -1031,20 +1204,55 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -362,33 +362,33 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.a(f, 0.0F, this.getMaxHealth()));
|
||||
this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.clamp(f, 0.0F, this.getMaxHealth()));
|
||||
}
|
||||
|
||||
@@ -1063,7 +1271,7 @@
|
||||
@@ -1058,7 +1266,7 @@
|
||||
return false;
|
||||
} else if (this.level.isClientSide) {
|
||||
return false;
|
||||
- } else if (this.dV()) {
|
||||
- } else if (this.isDeadOrDying()) {
|
||||
+ } else if (this.isRemoved() || this.dead || this.getHealth() <= 0.0F) { // CraftBukkit - Don't allow entities that got set to dead/killed elsewhere to get damaged and die
|
||||
return false;
|
||||
} else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
|
||||
return false;
|
||||
@@ -1074,10 +1282,11 @@
|
||||
@@ -1069,10 +1277,11 @@
|
||||
|
||||
this.noActionTime = 0;
|
||||
float f1 = f;
|
||||
- boolean flag = false;
|
||||
+ boolean flag = f > 0.0F && this.applyBlockingModifier(damagesource); // Copied from below
|
||||
+ boolean flag = f > 0.0F && this.isDamageSourceBlocked(damagesource); // Copied from below
|
||||
float f2 = 0.0F;
|
||||
|
||||
- if (f > 0.0F && this.applyBlockingModifier(damagesource)) {
|
||||
- if (f > 0.0F && this.isDamageSourceBlocked(damagesource)) {
|
||||
+ // CraftBukkit - Moved into damageEntity0(DamageSource, float)
|
||||
+ if (false && f > 0.0F && this.applyBlockingModifier(damagesource)) {
|
||||
this.damageShield(f);
|
||||
+ if (false && f > 0.0F && this.isDamageSourceBlocked(damagesource)) {
|
||||
this.hurtCurrentlyUsedShield(f);
|
||||
f2 = f;
|
||||
f = 0.0F;
|
||||
@@ -1095,27 +1304,47 @@
|
||||
@@ -1090,27 +1299,47 @@
|
||||
this.animationSpeed = 1.5F;
|
||||
boolean flag1 = true;
|
||||
|
||||
@@ -399,7 +399,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
- this.damageEntity0(damagesource, f - this.lastHurt);
|
||||
- this.actuallyHurt(damagesource, f - this.lastHurt);
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.damageEntity0(damagesource, f - this.lastHurt)) {
|
||||
+ return false;
|
||||
@@ -414,7 +414,7 @@
|
||||
+ }
|
||||
this.lastHurt = f;
|
||||
- this.invulnerableTime = 20;
|
||||
- this.damageEntity0(damagesource, f);
|
||||
- this.actuallyHurt(damagesource, f);
|
||||
+ this.invulnerableTime = this.invulnerableDuration; // CraftBukkit - restore use of maxNoDamageTicks
|
||||
+ // this.damageEntity0(damagesource, f);
|
||||
+ // CraftBukkit end
|
||||
@@ -422,10 +422,10 @@
|
||||
this.hurtTime = this.hurtDuration;
|
||||
}
|
||||
|
||||
- if (damagesource.g() && !this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
|
||||
- if (damagesource.isDamageHelmet() && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
|
||||
+ // CraftBukkit - Moved into damageEntity0(DamageSource, float)
|
||||
+ if (false && damagesource.g() && !this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
|
||||
this.damageHelmet(damagesource, f);
|
||||
+ if (false && damagesource.isDamageHelmet() && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
|
||||
this.hurtHelmet(damagesource, f);
|
||||
f *= 0.75F;
|
||||
}
|
||||
|
||||
@@ -433,7 +433,7 @@
|
||||
+ if (this instanceof EntityAnimal) {
|
||||
+ ((EntityAnimal) this).resetLove();
|
||||
+ if (this instanceof EntityTameableAnimal) {
|
||||
+ ((EntityTameableAnimal) this).setWillSit(false);
|
||||
+ ((EntityTameableAnimal) this).setOrderedToSit(false);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
@@ -441,7 +441,7 @@
|
||||
this.hurtDir = 0.0F;
|
||||
Entity entity1 = damagesource.getEntity();
|
||||
|
||||
@@ -1238,19 +1467,29 @@
|
||||
@@ -1233,19 +1462,29 @@
|
||||
EnumHand[] aenumhand = EnumHand.values();
|
||||
int i = aenumhand.length;
|
||||
|
||||
@@ -449,12 +449,12 @@
|
||||
+ ItemStack itemstack1 = ItemStack.EMPTY;
|
||||
for (int j = 0; j < i; ++j) {
|
||||
EnumHand enumhand = aenumhand[j];
|
||||
- ItemStack itemstack1 = this.b(enumhand);
|
||||
+ itemstack1 = this.b(enumhand);
|
||||
- ItemStack itemstack1 = this.getItemInHand(enumhand);
|
||||
+ itemstack1 = this.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack1.a(Items.TOTEM_OF_UNDYING)) {
|
||||
itemstack = itemstack1.cloneItemStack();
|
||||
- itemstack1.subtract(1);
|
||||
if (itemstack1.is(Items.TOTEM_OF_UNDYING)) {
|
||||
itemstack = itemstack1.copy();
|
||||
- itemstack1.shrink(1);
|
||||
+ // itemstack1.subtract(1); // CraftBukkit
|
||||
break;
|
||||
}
|
||||
@@ -468,14 +468,14 @@
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ if (!itemstack1.isEmpty()) {
|
||||
+ itemstack1.subtract(1);
|
||||
+ itemstack1.shrink(1);
|
||||
+ }
|
||||
+ if (itemstack != null && this instanceof EntityPlayer) {
|
||||
+ // CraftBukkit end
|
||||
EntityPlayer entityplayer = (EntityPlayer) this;
|
||||
|
||||
entityplayer.b(StatisticList.ITEM_USED.b(Items.TOTEM_OF_UNDYING));
|
||||
@@ -1258,14 +1497,16 @@
|
||||
entityplayer.awardStat(StatisticList.ITEM_USED.get(Items.TOTEM_OF_UNDYING));
|
||||
@@ -1253,14 +1492,16 @@
|
||||
}
|
||||
|
||||
this.setHealth(1.0F);
|
||||
@@ -489,7 +489,7 @@
|
||||
+ this.addEffect(new MobEffect(MobEffects.ABSORPTION, 100, 1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TOTEM);
|
||||
+ this.addEffect(new MobEffect(MobEffects.FIRE_RESISTANCE, 800, 0), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TOTEM);
|
||||
+ // CraftBukkit end
|
||||
this.level.broadcastEntityEffect(this, (byte) 35);
|
||||
this.level.broadcastEntityEvent(this, (byte) 35);
|
||||
}
|
||||
|
||||
- return itemstack != null;
|
||||
@@ -497,11 +497,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1370,14 +1611,22 @@
|
||||
IBlockData iblockdata = Blocks.WITHER_ROSE.getBlockData();
|
||||
@@ -1365,14 +1606,22 @@
|
||||
IBlockData iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
|
||||
|
||||
if (this.level.getType(blockposition).isAir() && iblockdata.canPlace(this.level, blockposition)) {
|
||||
- this.level.setTypeAndData(blockposition, iblockdata, 3);
|
||||
if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
|
||||
- this.level.setBlock(blockposition, iblockdata, 3);
|
||||
- flag = true;
|
||||
+ // CraftBukkit start - call EntityBlockFormEvent for Wither Rose
|
||||
+ flag = org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.level, blockposition, iblockdata, 3, this);
|
||||
@@ -510,7 +510,7 @@
|
||||
}
|
||||
|
||||
if (!flag) {
|
||||
EntityItem entityitem = new EntityItem(this.level, this.locX(), this.locY(), this.locZ(), new ItemStack(Items.WITHER_ROSE));
|
||||
EntityItem entityitem = new EntityItem(this.level, this.getX(), this.getY(), this.getZ(), new ItemStack(Items.WITHER_ROSE));
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
@@ -519,36 +519,36 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level.addEntity(entityitem);
|
||||
this.level.addFreshEntity(entityitem);
|
||||
}
|
||||
}
|
||||
@@ -1397,21 +1646,40 @@
|
||||
@@ -1392,21 +1641,40 @@
|
||||
|
||||
boolean flag = this.lastHurtByPlayerTime > 0;
|
||||
|
||||
+ this.dropInventory(); // CraftBukkit - from below
|
||||
if (this.dD() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
this.a(damagesource, flag);
|
||||
this.dropDeathLoot(damagesource, i, flag);
|
||||
+ this.dropEquipment(); // CraftBukkit - from below
|
||||
if (this.shouldDropLoot() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
this.dropFromLootTable(damagesource, flag);
|
||||
this.dropCustomDeathLoot(damagesource, i, flag);
|
||||
}
|
||||
+ // CraftBukkit start - Call death event
|
||||
+ CraftEventFactory.callEntityDeathEvent(this, this.drops);
|
||||
+ this.drops = new ArrayList<>();
|
||||
+ // CraftBukkit end
|
||||
|
||||
- this.dropInventory();
|
||||
- this.dropEquipment();
|
||||
+ // this.dropInventory();// CraftBukkit - moved up
|
||||
this.dropExperience();
|
||||
}
|
||||
|
||||
protected void dropInventory() {}
|
||||
protected void dropEquipment() {}
|
||||
|
||||
- protected void dropExperience() {
|
||||
+ // CraftBukkit start
|
||||
+ public int getExpReward() {
|
||||
if (this.level instanceof WorldServer && (this.alwaysGivesExp() || this.lastHurtByPlayerTime > 0 && this.isDropExperience() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT))) {
|
||||
- EntityExperienceOrb.a((WorldServer) this.level, this.getPositionVector(), this.getExpValue(this.lastHurtByPlayer));
|
||||
+ int i = this.getExpValue(this.lastHurtByPlayer);
|
||||
if (this.level instanceof WorldServer && (this.isAlwaysExperienceDropper() || this.lastHurtByPlayerTime > 0 && this.shouldDropExperience() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT))) {
|
||||
- EntityExperienceOrb.award((WorldServer) this.level, this.position(), this.getExperienceReward(this.lastHurtByPlayer));
|
||||
+ int i = this.getExperienceReward(this.lastHurtByPlayer);
|
||||
+ return i;
|
||||
+ } else {
|
||||
+ return 0;
|
||||
@@ -559,39 +559,39 @@
|
||||
+ protected void dropExperience() {
|
||||
+ // CraftBukkit start - Update getExpReward() above if the removed if() changes!
|
||||
+ if (true) {
|
||||
+ EntityExperienceOrb.a((WorldServer) this.level, this.getPositionVector(), this.expToDrop);
|
||||
+ EntityExperienceOrb.award((WorldServer) this.level, this.position(), this.expToDrop);
|
||||
+ this.expToDrop = 0;
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
}
|
||||
|
||||
@@ -1527,9 +1795,14 @@
|
||||
int i = this.d(f, f1);
|
||||
@@ -1526,9 +1794,14 @@
|
||||
int i = this.calculateFallDamage(f, f1);
|
||||
|
||||
if (i > 0) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.damageEntity(damagesource, (float) i)) {
|
||||
+ if (!this.hurt(damagesource, (float) i)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.playSound(this.getSoundFall(i), 1.0F, 1.0F);
|
||||
this.playBlockStepSound();
|
||||
- this.damageEntity(damagesource, (float) i);
|
||||
this.playSound(this.getFallDamageSound(i), 1.0F, 1.0F);
|
||||
this.playBlockFallSound();
|
||||
- this.hurt(damagesource, (float) i);
|
||||
+ // this.damageEntity(damagesource, (float) i); // CraftBukkit - moved up
|
||||
return true;
|
||||
} else {
|
||||
return flag;
|
||||
@@ -1578,7 +1851,7 @@
|
||||
@@ -1577,7 +1850,7 @@
|
||||
|
||||
protected float applyArmorModifier(DamageSource damagesource, float f) {
|
||||
if (!damagesource.ignoresArmor()) {
|
||||
- this.damageArmor(damagesource, f);
|
||||
protected float getDamageAfterArmorAbsorb(DamageSource damagesource, float f) {
|
||||
if (!damagesource.isBypassArmor()) {
|
||||
- this.hurtArmor(damagesource, f);
|
||||
+ // this.damageArmor(damagesource, f); // CraftBukkit - Moved into damageEntity0(DamageSource, float)
|
||||
f = CombatMath.a(f, (float) this.getArmorStrength(), (float) this.b(GenericAttributes.ARMOR_TOUGHNESS));
|
||||
f = CombatMath.getDamageAfterAbsorb(f, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
|
||||
}
|
||||
|
||||
@@ -1591,7 +1864,8 @@
|
||||
@@ -1590,7 +1863,8 @@
|
||||
} else {
|
||||
int i;
|
||||
|
||||
@@ -601,24 +601,24 @@
|
||||
i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
|
||||
int j = 25 - i;
|
||||
float f1 = f * (float) j;
|
||||
@@ -1622,29 +1896,172 @@
|
||||
@@ -1621,29 +1895,172 @@
|
||||
}
|
||||
}
|
||||
|
||||
- protected void damageEntity0(DamageSource damagesource, float f) {
|
||||
- if (!this.isInvulnerable(damagesource)) {
|
||||
- f = this.applyArmorModifier(damagesource, f);
|
||||
- f = this.applyMagicModifier(damagesource, f);
|
||||
- protected void actuallyHurt(DamageSource damagesource, float f) {
|
||||
- if (!this.isInvulnerableTo(damagesource)) {
|
||||
- f = this.getDamageAfterArmorAbsorb(damagesource, f);
|
||||
- f = this.getDamageAfterMagicAbsorb(damagesource, f);
|
||||
- float f1 = f;
|
||||
+ // CraftBukkit start
|
||||
+ protected boolean damageEntity0(final DamageSource damagesource, float f) { // void -> boolean, add final
|
||||
+ if (!this.isInvulnerable(damagesource)) {
|
||||
+ if (!this.isInvulnerableTo(damagesource)) {
|
||||
+ final boolean human = this instanceof EntityHuman;
|
||||
+ float originalDamage = f;
|
||||
+ Function<Double, Double> hardHat = new Function<Double, Double>() {
|
||||
+ @Override
|
||||
+ public Double apply(Double f) {
|
||||
+ if (damagesource.g() && !EntityLiving.this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
|
||||
+ if (damagesource.isDamageHelmet() && !EntityLiving.this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
|
||||
+ return -(f - (f * 0.75F));
|
||||
+
|
||||
+ }
|
||||
@@ -631,7 +631,7 @@
|
||||
+ Function<Double, Double> blocking = new Function<Double, Double>() {
|
||||
+ @Override
|
||||
+ public Double apply(Double f) {
|
||||
+ return -((EntityLiving.this.applyBlockingModifier(damagesource)) ? f : 0.0);
|
||||
+ return -((EntityLiving.this.isDamageSourceBlocked(damagesource)) ? f : 0.0);
|
||||
+ }
|
||||
+ };
|
||||
+ float blockingModifier = blocking.apply((double) f).floatValue();
|
||||
@@ -640,7 +640,7 @@
|
||||
+ Function<Double, Double> armor = new Function<Double, Double>() {
|
||||
+ @Override
|
||||
+ public Double apply(Double f) {
|
||||
+ return -(f - EntityLiving.this.applyArmorModifier(damagesource, f.floatValue()));
|
||||
+ return -(f - EntityLiving.this.getDamageAfterArmorAbsorb(damagesource, f.floatValue()));
|
||||
+ }
|
||||
+ };
|
||||
+ float armorModifier = armor.apply((double) f).floatValue();
|
||||
@@ -649,7 +649,7 @@
|
||||
+ Function<Double, Double> resistance = new Function<Double, Double>() {
|
||||
+ @Override
|
||||
+ public Double apply(Double f) {
|
||||
+ if (!damagesource.isStarvation() && EntityLiving.this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) {
|
||||
+ if (!damagesource.isBypassMagic() && EntityLiving.this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) {
|
||||
+ int i = (EntityLiving.this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
|
||||
+ int j = 25 - i;
|
||||
+ float f1 = f.floatValue() * (float) j;
|
||||
@@ -664,7 +664,7 @@
|
||||
+ Function<Double, Double> magic = new Function<Double, Double>() {
|
||||
+ @Override
|
||||
+ public Double apply(Double f) {
|
||||
+ return -(f - EntityLiving.this.applyMagicModifier(damagesource, f.floatValue()));
|
||||
+ return -(f - EntityLiving.this.getDamageAfterMagicAbsorb(damagesource, f.floatValue()));
|
||||
+ }
|
||||
+ };
|
||||
+ float magicModifier = magic.apply((double) f).floatValue();
|
||||
@@ -673,104 +673,104 @@
|
||||
+ Function<Double, Double> absorption = new Function<Double, Double>() {
|
||||
+ @Override
|
||||
+ public Double apply(Double f) {
|
||||
+ return -(Math.max(f - Math.max(f - EntityLiving.this.getAbsorptionHearts(), 0.0F), 0.0F));
|
||||
+ return -(Math.max(f - Math.max(f - EntityLiving.this.getAbsorptionAmount(), 0.0F), 0.0F));
|
||||
+ }
|
||||
+ };
|
||||
+ float absorptionModifier = absorption.apply((double) f).floatValue();
|
||||
+
|
||||
+ EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption);
|
||||
+ if (damagesource.getEntity() instanceof EntityHuman) {
|
||||
+ ((EntityHuman) damagesource.getEntity()).resetAttackCooldown(); // Moved from EntityHuman in order to make the cooldown reset get called after the damage event is fired
|
||||
+ ((EntityHuman) damagesource.getEntity()).resetAttackStrengthTicker(); // Moved from EntityHuman in order to make the cooldown reset get called after the damage event is fired
|
||||
+ }
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
|
||||
- f = Math.max(f - this.getAbsorptionHearts(), 0.0F);
|
||||
- this.setAbsorptionHearts(this.getAbsorptionHearts() - (f1 - f));
|
||||
- float f2 = f1 - f;
|
||||
+
|
||||
+ f = (float) event.getFinalDamage();
|
||||
|
||||
+
|
||||
+ // Resistance
|
||||
+ if (event.getDamage(DamageModifier.RESISTANCE) < 0) {
|
||||
+ float f3 = (float) -event.getDamage(DamageModifier.RESISTANCE);
|
||||
+ if (f3 > 0.0F && f3 < 3.4028235E37F) {
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) this).a(StatisticList.DAMAGE_RESISTED, Math.round(f3 * 10.0F));
|
||||
+ ((EntityPlayer) this).awardStat(StatisticList.DAMAGE_RESISTED, Math.round(f3 * 10.0F));
|
||||
+ } else if (damagesource.getEntity() instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) damagesource.getEntity()).a(StatisticList.DAMAGE_DEALT_RESISTED, Math.round(f3 * 10.0F));
|
||||
+ ((EntityPlayer) damagesource.getEntity()).awardStat(StatisticList.DAMAGE_DEALT_RESISTED, Math.round(f3 * 10.0F));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Apply damage to helmet
|
||||
+ if (damagesource.g() && !this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
|
||||
+ this.damageHelmet(damagesource, f);
|
||||
+ if (damagesource.isDamageHelmet() && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
|
||||
+ this.hurtHelmet(damagesource, f);
|
||||
+ }
|
||||
+
|
||||
|
||||
- f = Math.max(f - this.getAbsorptionAmount(), 0.0F);
|
||||
- this.setAbsorptionAmount(this.getAbsorptionAmount() - (f1 - f));
|
||||
- float f2 = f1 - f;
|
||||
+ // Apply damage to armor
|
||||
+ if (!damagesource.ignoresArmor()) {
|
||||
+ if (!damagesource.isBypassArmor()) {
|
||||
+ float armorDamage = (float) (event.getDamage() + event.getDamage(DamageModifier.BLOCKING) + event.getDamage(DamageModifier.HARD_HAT));
|
||||
+ this.damageArmor(damagesource, armorDamage);
|
||||
+ this.hurtArmor(damagesource, armorDamage);
|
||||
+ }
|
||||
+
|
||||
+ // Apply blocking code // PAIL: steal from above
|
||||
+ if (event.getDamage(DamageModifier.BLOCKING) < 0) {
|
||||
+ this.level.broadcastEntityEffect(this, (byte) 29); // SPIGOT-4635 - shield damage sound
|
||||
+ this.damageShield((float) -event.getDamage(DamageModifier.BLOCKING));
|
||||
+ Entity entity = damagesource.k();
|
||||
+ this.level.broadcastEntityEvent(this, (byte) 29); // SPIGOT-4635 - shield damage sound
|
||||
+ this.hurtCurrentlyUsedShield((float) -event.getDamage(DamageModifier.BLOCKING));
|
||||
+ Entity entity = damagesource.getDirectEntity();
|
||||
+
|
||||
+ if (entity instanceof EntityLiving) {
|
||||
+ this.shieldBlock((EntityLiving) entity);
|
||||
+ this.blockUsingShield((EntityLiving) entity);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ absorptionModifier = (float) -event.getDamage(DamageModifier.ABSORPTION);
|
||||
+ this.setAbsorptionHearts(Math.max(this.getAbsorptionHearts() - absorptionModifier, 0.0F));
|
||||
+ this.setAbsorptionAmount(Math.max(this.getAbsorptionAmount() - absorptionModifier, 0.0F));
|
||||
+ float f2 = absorptionModifier;
|
||||
+
|
||||
|
||||
+ if (f2 > 0.0F && f2 < 3.4028235E37F && this instanceof EntityHuman) {
|
||||
+ ((EntityHuman) this).a(StatisticList.DAMAGE_ABSORBED, Math.round(f2 * 10.0F));
|
||||
+ ((EntityHuman) this).awardStat(StatisticList.DAMAGE_ABSORBED, Math.round(f2 * 10.0F));
|
||||
+ }
|
||||
if (f2 > 0.0F && f2 < 3.4028235E37F && damagesource.getEntity() instanceof EntityPlayer) {
|
||||
((EntityPlayer) damagesource.getEntity()).a(StatisticList.DAMAGE_DEALT_ABSORBED, Math.round(f2 * 10.0F));
|
||||
((EntityPlayer) damagesource.getEntity()).awardStat(StatisticList.DAMAGE_DEALT_ABSORBED, Math.round(f2 * 10.0F));
|
||||
}
|
||||
|
||||
- if (f != 0.0F) {
|
||||
+ if (f > 0 || !human) {
|
||||
+ if (human) {
|
||||
+ // PAIL: Be sure to drag all this code from the EntityHuman subclass each update.
|
||||
+ ((EntityHuman) this).applyExhaustion(damagesource.getExhaustionCost(), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.DAMAGED); // CraftBukkit - EntityExhaustionEvent
|
||||
+ ((EntityHuman) this).causeFoodExhaustion(damagesource.getFoodExhaustion(), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.DAMAGED); // CraftBukkit - EntityExhaustionEvent
|
||||
+ if (f < 3.4028235E37F) {
|
||||
+ ((EntityHuman) this).a(StatisticList.DAMAGE_TAKEN, Math.round(f * 10.0F));
|
||||
+ ((EntityHuman) this).awardStat(StatisticList.DAMAGE_TAKEN, Math.round(f * 10.0F));
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
float f3 = this.getHealth();
|
||||
|
||||
this.setHealth(f3 - f);
|
||||
this.getCombatTracker().trackDamage(damagesource, f3, f);
|
||||
- this.setAbsorptionHearts(this.getAbsorptionHearts() - f);
|
||||
this.getCombatTracker().recordDamage(damagesource, f3, f);
|
||||
- this.setAbsorptionAmount(this.getAbsorptionAmount() - f);
|
||||
+ // CraftBukkit start
|
||||
+ if (!human) {
|
||||
+ this.setAbsorptionHearts(this.getAbsorptionHearts() - f);
|
||||
+ this.setAbsorptionAmount(this.getAbsorptionAmount() - f);
|
||||
+ }
|
||||
this.a(GameEvent.ENTITY_DAMAGED, damagesource.getEntity());
|
||||
this.gameEvent(GameEvent.ENTITY_DAMAGED, damagesource.getEntity());
|
||||
+
|
||||
+ return true;
|
||||
+ } else {
|
||||
+ // Duplicate triggers if blocking
|
||||
+ if (event.getDamage(DamageModifier.BLOCKING) < 0) {
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ CriterionTriggers.ENTITY_HURT_PLAYER.a((EntityPlayer) this, damagesource, f, originalDamage, true);
|
||||
+ CriterionTriggers.ENTITY_HURT_PLAYER.trigger((EntityPlayer) this, damagesource, f, originalDamage, true);
|
||||
+ f2 = (float) -event.getDamage(DamageModifier.BLOCKING);
|
||||
+ if (f2 > 0.0F && f2 < 3.4028235E37F) {
|
||||
+ ((EntityPlayer) this).a(StatisticList.DAMAGE_BLOCKED_BY_SHIELD, Math.round(originalDamage * 10.0F));
|
||||
+ ((EntityPlayer) this).awardStat(StatisticList.DAMAGE_BLOCKED_BY_SHIELD, Math.round(originalDamage * 10.0F));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (damagesource.getEntity() instanceof EntityPlayer) {
|
||||
+ CriterionTriggers.PLAYER_HURT_ENTITY.a((EntityPlayer) damagesource.getEntity(), this, damagesource, f, originalDamage, true);
|
||||
+ CriterionTriggers.PLAYER_HURT_ENTITY.trigger((EntityPlayer) damagesource.getEntity(), this, damagesource, f, originalDamage, true);
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
@@ -784,7 +784,7 @@
|
||||
}
|
||||
|
||||
public CombatTracker getCombatTracker() {
|
||||
@@ -1665,8 +2082,18 @@
|
||||
@@ -1664,8 +2081,18 @@
|
||||
}
|
||||
|
||||
public final void setArrowCount(int i) {
|
||||
@@ -802,66 +802,66 @@
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
public final int eh() {
|
||||
public final int getStingerCount() {
|
||||
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
|
||||
@@ -1962,6 +2389,12 @@
|
||||
@@ -1961,6 +2388,12 @@
|
||||
|
||||
public abstract ItemStack getEquipment(EnumItemSlot enumitemslot);
|
||||
public abstract ItemStack getItemBySlot(EnumItemSlot enumitemslot);
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack, boolean silent) {
|
||||
+ this.setSlot(enumitemslot, itemstack);
|
||||
+ public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack, boolean silent) {
|
||||
+ this.setItemSlot(enumitemslot, itemstack);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
public abstract void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
|
||||
public abstract void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
|
||||
|
||||
@@ -2205,6 +2638,7 @@
|
||||
@@ -2204,6 +2637,7 @@
|
||||
}
|
||||
|
||||
if (this.onGround && !this.level.isClientSide) {
|
||||
+ if (getFlag(7) && !CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) // CraftBukkit
|
||||
this.setFlag(7, false);
|
||||
+ if (getSharedFlag(7) && !CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) // CraftBukkit
|
||||
this.setSharedFlag(7, false);
|
||||
}
|
||||
} else {
|
||||
@@ -2735,6 +3169,7 @@
|
||||
@@ -2734,6 +3168,7 @@
|
||||
}
|
||||
|
||||
if (!this.level.isClientSide) {
|
||||
+ if (flag != this.getFlag(7) && !CraftEventFactory.callToggleGlideEvent(this, flag).isCancelled()) // CraftBukkit
|
||||
this.setFlag(7, flag);
|
||||
+ if (flag != this.getSharedFlag(7) && !CraftEventFactory.callToggleGlideEvent(this, flag).isCancelled()) // CraftBukkit
|
||||
this.setSharedFlag(7, flag);
|
||||
}
|
||||
|
||||
@@ -2902,14 +3337,21 @@
|
||||
@@ -2901,14 +3336,21 @@
|
||||
|
||||
@Override
|
||||
public boolean isInteractable() {
|
||||
public boolean isPickable() {
|
||||
- return !this.isRemoved();
|
||||
+ return !this.isRemoved() && this.collides; // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCollidable() {
|
||||
- return this.isAlive() && !this.isSpectator() && !this.isClimbing();
|
||||
+ return this.isAlive() && !this.isSpectator() && !this.isClimbing() && this.collides; // CraftBukkit
|
||||
public boolean isPushable() {
|
||||
- return this.isAlive() && !this.isSpectator() && !this.onClimbable();
|
||||
+ return this.isAlive() && !this.isSpectator() && !this.onClimbable() && this.collides; // CraftBukkit
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - collidable API
|
||||
+ @Override
|
||||
+ public boolean canCollideWithBukkit(Entity entity) {
|
||||
+ return isCollidable() && this.collides != this.collidableExemptions.contains(entity.getUniqueID());
|
||||
+ return isPushable() && this.collides != this.collidableExemptions.contains(entity.getUUID());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
protected void velocityChanged() {
|
||||
this.hurtMarked = this.random.nextDouble() >= this.b(GenericAttributes.KNOCKBACK_RESISTANCE);
|
||||
@@ -3107,7 +3549,25 @@
|
||||
protected void markHurt() {
|
||||
this.hurtMarked = this.random.nextDouble() >= this.getAttributeValue(GenericAttributes.KNOCKBACK_RESISTANCE);
|
||||
@@ -3106,7 +3548,25 @@
|
||||
} else {
|
||||
if (!this.useItem.isEmpty() && this.isHandRaised()) {
|
||||
this.b(this.useItem, 16);
|
||||
- ItemStack itemstack = this.useItem.a(this.level, this);
|
||||
if (!this.useItem.isEmpty() && this.isUsingItem()) {
|
||||
this.triggerItemUseEffects(this.useItem, 16);
|
||||
- ItemStack itemstack = this.useItem.finishUsingItem(this.level, this);
|
||||
+ // CraftBukkit start - fire PlayerItemConsumeEvent
|
||||
+ ItemStack itemstack;
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
@@ -876,42 +876,42 @@
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ itemstack = (craftItem.equals(event.getItem())) ? this.useItem.a(this.level, this) : CraftItemStack.asNMSCopy(event.getItem()).a(level, this);
|
||||
+ itemstack = (craftItem.equals(event.getItem())) ? this.useItem.finishUsingItem(this.level, this) : CraftItemStack.asNMSCopy(event.getItem()).finishUsingItem(level, this);
|
||||
+ } else {
|
||||
+ itemstack = this.useItem.a(this.level, this);
|
||||
+ itemstack = this.useItem.finishUsingItem(this.level, this);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (itemstack != this.useItem) {
|
||||
this.a(enumhand, itemstack);
|
||||
@@ -3179,6 +3639,12 @@
|
||||
this.setItemInHand(enumhand, itemstack);
|
||||
@@ -3178,6 +3638,12 @@
|
||||
}
|
||||
|
||||
public boolean a(double d0, double d1, double d2, boolean flag) {
|
||||
public boolean randomTeleport(double d0, double d1, double d2, boolean flag) {
|
||||
+ // CraftBukkit start
|
||||
+ return safeTeleport(d0, d1, d2, flag, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.UNKNOWN).orElse(false);
|
||||
+ return randomTeleport(d0, d1, d2, flag, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.UNKNOWN).orElse(false);
|
||||
+ }
|
||||
+
|
||||
+ public Optional<Boolean> safeTeleport(double d0, double d1, double d2, boolean flag, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause) {
|
||||
+ public Optional<Boolean> randomTeleport(double d0, double d1, double d2, boolean flag, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause) {
|
||||
+ // CraftBukkit end
|
||||
double d3 = this.locX();
|
||||
double d4 = this.locY();
|
||||
double d5 = this.locZ();
|
||||
@@ -3203,16 +3669,41 @@
|
||||
double d3 = this.getX();
|
||||
double d4 = this.getY();
|
||||
double d5 = this.getZ();
|
||||
@@ -3202,16 +3668,41 @@
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
- this.enderTeleportTo(d0, d6, d2);
|
||||
- this.teleportTo(d0, d6, d2);
|
||||
+ // CraftBukkit start - Teleport event
|
||||
+ // this.enderTeleportTo(d0, d6, d2);
|
||||
+ // this.teleportTo(d0, d6, d2);
|
||||
+
|
||||
+ // first set position, to check if the place to teleport is valid
|
||||
+ this.setPosition(d0, d6, d2);
|
||||
if (world.getCubes(this) && !world.containsLiquid(this.getBoundingBox())) {
|
||||
+ this.setPos(d0, d6, d2);
|
||||
if (world.noCollision((Entity) this) && !world.containsAnyLiquid(this.getBoundingBox())) {
|
||||
flag1 = true;
|
||||
}
|
||||
+ // now revert and call event if the teleport place is valid
|
||||
+ this.setPosition(d3, d4, d5);
|
||||
+ this.setPos(d3, d4, d5);
|
||||
+
|
||||
+ if (flag1) {
|
||||
+ if (!(this instanceof EntityPlayer)) {
|
||||
@@ -919,13 +919,13 @@
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(teleport);
|
||||
+ if (!teleport.isCancelled()) {
|
||||
+ Location to = teleport.getTo();
|
||||
+ this.enderTeleportTo(to.getX(), to.getY(), to.getZ());
|
||||
+ this.teleportTo(to.getX(), to.getY(), to.getZ());
|
||||
+ } else {
|
||||
+ return Optional.empty();
|
||||
+ }
|
||||
+ } else {
|
||||
+ // player teleport event is called in the underlining code
|
||||
+ if (((EntityPlayer) this).connection.a(d0, d6, d2, this.getYRot(), this.getXRot(), java.util.Collections.emptySet(), false, cause)) {
|
||||
+ if (((EntityPlayer) this).connection.teleport(d0, d6, d2, this.getYRot(), this.getXRot(), java.util.Collections.emptySet(), false, cause)) {
|
||||
+ return Optional.empty();
|
||||
+ }
|
||||
+ }
|
||||
@@ -935,15 +935,15 @@
|
||||
}
|
||||
|
||||
if (!flag1) {
|
||||
- this.enderTeleportTo(d3, d4, d5);
|
||||
- this.teleportTo(d3, d4, d5);
|
||||
- return false;
|
||||
+ // this.enderTeleportTo(d3, d4, d5); // CraftBukkit - already set the location back
|
||||
+ return Optional.of(false); // CraftBukkit
|
||||
} else {
|
||||
if (flag) {
|
||||
world.broadcastEntityEffect(this, (byte) 46);
|
||||
@@ -3222,7 +3713,7 @@
|
||||
((EntityCreature) this).getNavigation().o();
|
||||
world.broadcastEntityEvent(this, (byte) 46);
|
||||
@@ -3221,7 +3712,7 @@
|
||||
((EntityCreature) this).getNavigation().stop();
|
||||
}
|
||||
|
||||
- return true;
|
||||
@@ -951,25 +951,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3305,7 +3796,7 @@
|
||||
@@ -3304,7 +3795,7 @@
|
||||
}
|
||||
|
||||
public void entityWakeup() {
|
||||
- Optional optional = this.getBedPosition();
|
||||
+ Optional<BlockPosition> optional = this.getBedPosition(); // CraftBukkit - decompile error
|
||||
public void stopSleeping() {
|
||||
- Optional optional = this.getSleepingPos();
|
||||
+ Optional<BlockPosition> optional = this.getSleepingPos(); // CraftBukkit - decompile error
|
||||
World world = this.level;
|
||||
|
||||
java.util.Objects.requireNonNull(this.level);
|
||||
@@ -3337,7 +3828,7 @@
|
||||
@@ -3336,7 +3827,7 @@
|
||||
|
||||
@Nullable
|
||||
public EnumDirection eX() {
|
||||
- BlockPosition blockposition = (BlockPosition) this.getBedPosition().orElse((Object) null);
|
||||
+ BlockPosition blockposition = (BlockPosition) this.getBedPosition().orElse(null); // CraftBukkit - decompile error
|
||||
public EnumDirection getBedOrientation() {
|
||||
- BlockPosition blockposition = (BlockPosition) this.getSleepingPos().orElse((Object) null);
|
||||
+ BlockPosition blockposition = (BlockPosition) this.getSleepingPos().orElse(null); // CraftBukkit - decompile error
|
||||
|
||||
return blockposition != null ? BlockBed.a((IBlockAccess) this.level, blockposition) : null;
|
||||
return blockposition != null ? BlockBed.getBedOrientation(this.level, blockposition) : null;
|
||||
}
|
||||
@@ -3386,7 +3877,7 @@
|
||||
@@ -3385,7 +3876,7 @@
|
||||
Pair<MobEffect, Float> pair = (Pair) iterator.next();
|
||||
|
||||
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {
|
||||
@@ -978,3 +978,24 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3488,8 +3979,10 @@
|
||||
this.setDeltaMovement((double) ((float) packetplayoutspawnentityliving.getXd() / 8000.0F), (double) ((float) packetplayoutspawnentityliving.getYd() / 8000.0F), (double) ((float) packetplayoutspawnentityliving.getZd() / 8000.0F));
|
||||
}
|
||||
|
||||
- public static final class a extends Record {
|
||||
+ // CraftBukkit start
|
||||
+ public static final record a(SoundEffect small, SoundEffect big) {
|
||||
|
||||
+ /*
|
||||
private final SoundEffect small;
|
||||
private final SoundEffect big;
|
||||
|
||||
@@ -3509,6 +4002,8 @@
|
||||
public final boolean equals(Object object) {
|
||||
return this.equals<invokedynamic>(this, object);
|
||||
}
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
|
||||
public SoundEffect small() {
|
||||
return this.small;
|
||||
|
||||
@@ -4,35 +4,37 @@
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
public static final String ENTITY_TAG = "EntityTag";
|
||||
private static final float MAGIC_HORSE_WIDTH = 1.3964844F;
|
||||
- public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = a("area_effect_cloud", EntityTypes.Builder.a(EntityAreaEffectCloud::new, EnumCreatureType.MISC).c().a(6.0F, 0.5F).trackingRange(10).updateInterval(Integer.MAX_VALUE));
|
||||
+ public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = a("area_effect_cloud", EntityTypes.Builder.a(EntityAreaEffectCloud::new, EnumCreatureType.MISC).c().a(6.0F, 0.5F).trackingRange(10).updateInterval(10)); // CraftBukkit - SPIGOT-3729: track area effect clouds
|
||||
public static final EntityTypes<EntityArmorStand> ARMOR_STAND = a("armor_stand", EntityTypes.Builder.a(EntityArmorStand::new, EnumCreatureType.MISC).a(0.5F, 1.975F).trackingRange(10));
|
||||
public static final EntityTypes<EntityTippedArrow> ARROW = a("arrow", EntityTypes.Builder.a(EntityTippedArrow::new, EnumCreatureType.MISC).a(0.5F, 0.5F).trackingRange(4).updateInterval(20));
|
||||
public static final EntityTypes<Axolotl> AXOLOTL = a("axolotl", EntityTypes.Builder.a(Axolotl::new, EnumCreatureType.UNDERGROUND_WATER_CREATURE).a(0.75F, 0.42F).trackingRange(10));
|
||||
@@ -282,7 +282,7 @@
|
||||
- public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = register("area_effect_cloud", EntityTypes.Builder.of(EntityAreaEffectCloud::new, EnumCreatureType.MISC).fireImmune().sized(6.0F, 0.5F).clientTrackingRange(10).updateInterval(Integer.MAX_VALUE));
|
||||
+ public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = register("area_effect_cloud", EntityTypes.Builder.of(EntityAreaEffectCloud::new, EnumCreatureType.MISC).fireImmune().sized(6.0F, 0.5F).clientTrackingRange(10).updateInterval(10)); // CraftBukkit - SPIGOT-3729: track area effect clouds
|
||||
public static final EntityTypes<EntityArmorStand> ARMOR_STAND = register("armor_stand", EntityTypes.Builder.of(EntityArmorStand::new, EnumCreatureType.MISC).sized(0.5F, 1.975F).clientTrackingRange(10));
|
||||
public static final EntityTypes<EntityTippedArrow> ARROW = register("arrow", EntityTypes.Builder.of(EntityTippedArrow::new, EnumCreatureType.MISC).sized(0.5F, 0.5F).clientTrackingRange(4).updateInterval(20));
|
||||
public static final EntityTypes<Axolotl> AXOLOTL = register("axolotl", EntityTypes.Builder.of(Axolotl::new, EnumCreatureType.AXOLOTLS).sized(0.75F, 0.42F).clientTrackingRange(10));
|
||||
@@ -282,8 +282,8 @@
|
||||
private MinecraftKey lootTable;
|
||||
private final EntitySize dimensions;
|
||||
|
||||
- private static <T extends Entity> EntityTypes<T> a(String s, EntityTypes.Builder<T> entitytypes_builder) {
|
||||
+ private static <T extends Entity> EntityTypes<T> a(String s, EntityTypes.Builder entitytypes_builder) { // CraftBukkit - decompile error
|
||||
return (EntityTypes) IRegistry.a((IRegistry) IRegistry.ENTITY_TYPE, s, (Object) entitytypes_builder.a(s));
|
||||
- private static <T extends Entity> EntityTypes<T> register(String s, EntityTypes.Builder<T> entitytypes_builder) {
|
||||
- return (EntityTypes) IRegistry.register(IRegistry.ENTITY_TYPE, s, entitytypes_builder.build(s));
|
||||
+ private static <T extends Entity> EntityTypes<T> register(String s, EntityTypes.Builder entitytypes_builder) { // CraftBukkit - decompile error
|
||||
+ return (EntityTypes) IRegistry.register(IRegistry.ENTITY_TYPE, s, (EntityTypes<T>) entitytypes_builder.build(s)); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public static MinecraftKey getKey(EntityTypes<?> entitytypes) {
|
||||
@@ -314,10 +314,18 @@
|
||||
|
||||
@Nullable
|
||||
public T spawnCreature(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
|
||||
public T spawn(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
|
||||
+ // CraftBukkit start
|
||||
+ return this.spawnCreature(worldserver, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
|
||||
+ return this.spawn(worldserver, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public T spawnCreature(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
T t0 = this.createCreature(worldserver, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1);
|
||||
+ public T spawn(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
T t0 = this.create(worldserver, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1);
|
||||
|
||||
if (t0 != null) {
|
||||
- worldserver.addAllEntities(t0);
|
||||
+ worldserver.addAllEntities(t0, spawnReason);
|
||||
- worldserver.addFreshEntityWithPassengers(t0);
|
||||
+ worldserver.addFreshEntityWithPassengers(t0, spawnReason);
|
||||
+ return !t0.isRemoved() ? t0 : null; // Don't return an entity when CreatureSpawnEvent is canceled
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
@@ -42,12 +44,12 @@
|
||||
t0.setCustomName(ichatbasecomponent);
|
||||
}
|
||||
|
||||
- a((World) worldserver, entityhuman, t0, nbttagcompound);
|
||||
+ try { a((World) worldserver, entityhuman, t0, nbttagcompound); } catch (Throwable t) { LOGGER.warn("Error loading spawn egg NBT", t); } // CraftBukkit - SPIGOT-5665
|
||||
- updateCustomEntityTag(worldserver, entityhuman, t0, nbttagcompound);
|
||||
+ try { updateCustomEntityTag(worldserver, entityhuman, t0, nbttagcompound); } catch (Throwable t) { LOGGER.warn("Error loading spawn egg NBT", t); } // CraftBukkit - SPIGOT-5665
|
||||
return t0;
|
||||
}
|
||||
}
|
||||
@@ -512,7 +520,7 @@
|
||||
@@ -510,7 +518,7 @@
|
||||
}
|
||||
|
||||
return entity;
|
||||
@@ -55,22 +57,22 @@
|
||||
+ }).orElse(null); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public static Stream<Entity> a(final List<? extends NBTBase> list, final World world) {
|
||||
@@ -569,7 +577,7 @@
|
||||
public static Stream<Entity> loadEntitiesRecursive(final List<? extends NBTBase> list, final World world) {
|
||||
@@ -567,7 +575,7 @@
|
||||
|
||||
@Nullable
|
||||
public T a(Entity entity) {
|
||||
- return entity.getEntityType() == this ? entity : null;
|
||||
+ return entity.getEntityType() == this ? (T) entity : null; // CraftBukkit - decompile error
|
||||
public T tryCast(Entity entity) {
|
||||
- return entity.getType() == this ? entity : null;
|
||||
+ return entity.getType() == this ? (T) entity : null; // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -596,7 +604,7 @@
|
||||
@@ -594,7 +602,7 @@
|
||||
this.canSpawnFarFromPlayer = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC;
|
||||
}
|
||||
|
||||
- public static <T extends Entity> EntityTypes.Builder<T> a(EntityTypes.b<T> entitytypes_b, EnumCreatureType enumcreaturetype) {
|
||||
+ public static <T extends Entity> EntityTypes.Builder<T> a(EntityTypes.b entitytypes_b, EnumCreatureType enumcreaturetype) { // CraftBukkit - decompile error
|
||||
- public static <T extends Entity> EntityTypes.Builder<T> of(EntityTypes.b<T> entitytypes_b, EnumCreatureType enumcreaturetype) {
|
||||
+ public static <T extends Entity> EntityTypes.Builder<T> of(EntityTypes.b entitytypes_b, EnumCreatureType enumcreaturetype) { // CraftBukkit - decompile error
|
||||
return new EntityTypes.Builder<>(entitytypes_b, enumcreaturetype);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
--- a/net/minecraft/world/entity/IEntityAngerable.java
|
||||
+++ b/net/minecraft/world/entity/IEntityAngerable.java
|
||||
@@ -108,7 +108,7 @@
|
||||
default void pacify() {
|
||||
this.setLastDamager((EntityLiving) null);
|
||||
this.setAngerTarget((UUID) null);
|
||||
- this.setGoalTarget((EntityLiving) null);
|
||||
+ this.setGoalTarget((EntityLiving) null, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit
|
||||
this.setAnger(0);
|
||||
default void stopBeingAngry() {
|
||||
this.setLastHurtByMob((EntityLiving) null);
|
||||
this.setPersistentAngerTarget((UUID) null);
|
||||
- this.setTarget((EntityLiving) null);
|
||||
+ this.setTarget((EntityLiving) null, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit
|
||||
this.setRemainingPersistentAngerTime(0);
|
||||
}
|
||||
|
||||
@@ -121,6 +121,8 @@
|
||||
|
||||
void setGoalTarget(@Nullable EntityLiving entityliving);
|
||||
void setTarget(@Nullable EntityLiving entityliving);
|
||||
|
||||
+ boolean setGoalTarget(@Nullable EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent); // CraftBukkit
|
||||
+ boolean setTarget(@Nullable EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent); // CraftBukkit
|
||||
+
|
||||
boolean c(EntityLiving entityliving);
|
||||
boolean canAttack(EntityLiving entityliving);
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/IEntitySelector.java
|
||||
+++ b/net/minecraft/world/entity/IEntitySelector.java
|
||||
@@ -42,7 +42,7 @@
|
||||
@@ -43,7 +43,7 @@
|
||||
ScoreboardTeamBase.EnumTeamPush scoreboardteambase_enumteampush = scoreboardteambase == null ? ScoreboardTeamBase.EnumTeamPush.ALWAYS : scoreboardteambase.getCollisionRule();
|
||||
|
||||
return (Predicate) (scoreboardteambase_enumteampush == ScoreboardTeamBase.EnumTeamPush.NEVER ? Predicates.alwaysFalse() : IEntitySelector.NO_SPECTATORS.and((entity1) -> {
|
||||
- if (!entity1.isCollidable()) {
|
||||
- if (!entity1.isPushable()) {
|
||||
+ if (!entity1.canCollideWithBukkit(entity) || !entity.canCollideWithBukkit(entity1)) { // CraftBukkit - collidable API
|
||||
return false;
|
||||
} else if (entity.level.isClientSide && (!(entity1 instanceof EntityHuman) || !((EntityHuman) entity1).fi())) {
|
||||
} else if (entity.level.isClientSide && (!(entity1 instanceof EntityHuman) || !((EntityHuman) entity1).isLocalPlayer())) {
|
||||
return false;
|
||||
|
||||
@@ -13,6 +13,6 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setBoolean("Saddle", this.hasSaddle());
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.putBoolean("Saddle", this.hasSaddle());
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
@Override
|
||||
public double a(double d0) {
|
||||
+ if (d0 != d0) return getDefault(); // CraftBukkit
|
||||
public double sanitizeValue(double d0) {
|
||||
+ if (d0 != d0) return getDefaultValue(); // CraftBukkit
|
||||
+
|
||||
d0 = MathHelper.a(d0, this.minValue, this.maxValue);
|
||||
d0 = MathHelper.clamp(d0, this.minValue, this.maxValue);
|
||||
return d0;
|
||||
}
|
||||
|
||||
@@ -5,11 +5,3 @@
|
||||
package net.minecraft.world.entity.ai.attributes;
|
||||
|
||||
import net.minecraft.core.IRegistry;
|
||||
@@ -21,6 +22,6 @@
|
||||
public GenericAttributes() {}
|
||||
|
||||
private static AttributeBase a(String s, AttributeBase attributebase) {
|
||||
- return (AttributeBase) IRegistry.a(IRegistry.ATTRIBUTE, s, (Object) attributebase);
|
||||
+ return (AttributeBase) IRegistry.a(IRegistry.ATTRIBUTE, s, attributebase); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,18 +16,18 @@
|
||||
@@ -77,6 +83,17 @@
|
||||
}
|
||||
|
||||
protected void a(E e0) {
|
||||
protected void clearAttackTarget(E e0) {
|
||||
+ // CraftBukkit start
|
||||
+ EntityLiving old = e0.getBehaviorController().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null);
|
||||
+ EntityLiving old = e0.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null);
|
||||
+ EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(e0, null, (old != null && !old.isAlive()) ? EntityTargetEvent.TargetReason.TARGET_DIED : EntityTargetEvent.TargetReason.FORGOT_TARGET);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (event.getTarget() != null) {
|
||||
+ e0.getBehaviorController().setMemory(MemoryModuleType.ATTACK_TARGET, ((CraftLivingEntity) event.getTarget()).getHandle());
|
||||
+ e0.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, ((CraftLivingEntity) event.getTarget()).getHandle());
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.onTargetErased.accept(e0);
|
||||
e0.getBehaviorController().removeMemory(MemoryModuleType.ATTACK_TARGET);
|
||||
e0.getBrain().eraseMemory(MemoryModuleType.ATTACK_TARGET);
|
||||
}
|
||||
|
||||
@@ -17,15 +17,15 @@
|
||||
@@ -38,13 +45,21 @@
|
||||
}
|
||||
|
||||
protected void a(WorldServer worldserver, E e0, long i) {
|
||||
protected void start(WorldServer worldserver, E e0, long i) {
|
||||
- ((Optional) this.targetFinderFunction.apply(e0)).ifPresent((entityliving) -> {
|
||||
+ (this.targetFinderFunction.apply(e0)).ifPresent((entityliving) -> { // CraftBukkit - decompile error
|
||||
this.a(e0, entityliving);
|
||||
this.setAttackTarget(e0, entityliving);
|
||||
});
|
||||
}
|
||||
|
||||
private void a(E e0, EntityLiving entityliving) {
|
||||
- e0.getBehaviorController().setMemory(MemoryModuleType.ATTACK_TARGET, (Object) entityliving);
|
||||
private void setAttackTarget(E e0, EntityLiving entityliving) {
|
||||
- e0.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, (Object) entityliving);
|
||||
+ // CraftBukkit start
|
||||
+ EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(e0, entityliving, (entityliving instanceof EntityPlayer) ? EntityTargetEvent.TargetReason.CLOSEST_PLAYER : EntityTargetEvent.TargetReason.CLOSEST_ENTITY);
|
||||
+ if (event.isCancelled()) {
|
||||
@@ -34,7 +34,7 @@
|
||||
+ entityliving = (event.getTarget() != null) ? ((CraftLivingEntity) event.getTarget()).getHandle() : null;
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ e0.getBehaviorController().setMemory(MemoryModuleType.ATTACK_TARGET, entityliving); // CraftBukkit - decompile error
|
||||
e0.getBehaviorController().removeMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
|
||||
+ e0.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, entityliving); // CraftBukkit - decompile error
|
||||
e0.getBrain().eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,27 +14,27 @@
|
||||
|
||||
public BehaviorCareer() {
|
||||
@@ -29,7 +35,7 @@
|
||||
GlobalPos globalpos = (GlobalPos) entityvillager.getBehaviorController().getMemory(MemoryModuleType.POTENTIAL_JOB_SITE).get();
|
||||
GlobalPos globalpos = (GlobalPos) entityvillager.getBrain().getMemory(MemoryModuleType.POTENTIAL_JOB_SITE).get();
|
||||
|
||||
entityvillager.getBehaviorController().removeMemory(MemoryModuleType.POTENTIAL_JOB_SITE);
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.JOB_SITE, (Object) globalpos);
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.JOB_SITE, globalpos); // CraftBukkit - decompile error
|
||||
worldserver.broadcastEntityEffect(entityvillager, (byte) 14);
|
||||
entityvillager.getBrain().eraseMemory(MemoryModuleType.POTENTIAL_JOB_SITE);
|
||||
- entityvillager.getBrain().setMemory(MemoryModuleType.JOB_SITE, (Object) globalpos);
|
||||
+ entityvillager.getBrain().setMemory(MemoryModuleType.JOB_SITE, globalpos); // CraftBukkit - decompile error
|
||||
worldserver.broadcastEntityEvent(entityvillager, (byte) 14);
|
||||
if (entityvillager.getVillagerData().getProfession() == VillagerProfession.NONE) {
|
||||
MinecraftServer minecraftserver = worldserver.getMinecraftServer();
|
||||
MinecraftServer minecraftserver = worldserver.getServer();
|
||||
@@ -41,7 +47,14 @@
|
||||
return villagerprofession.b() == villageplacetype;
|
||||
return villagerprofession.getJobPoiType() == villageplacetype;
|
||||
}).findFirst();
|
||||
}).ifPresent((villagerprofession) -> {
|
||||
- entityvillager.setVillagerData(entityvillager.getVillagerData().withProfession(villagerprofession));
|
||||
- entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(villagerprofession));
|
||||
+ // CraftBukkit start - Fire VillagerCareerChangeEvent where Villager gets employed
|
||||
+ VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(entityvillager, CraftVillager.nmsToBukkitProfession(villagerprofession), VillagerCareerChangeEvent.ChangeReason.EMPLOYED);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ entityvillager.setVillagerData(entityvillager.getVillagerData().withProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
|
||||
+ entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
|
||||
+ // CraftBukkit end
|
||||
entityvillager.c(worldserver);
|
||||
entityvillager.refreshBrain(worldserver);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,54 +2,54 @@
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorFarm.java
|
||||
@@ -80,8 +80,8 @@
|
||||
|
||||
protected void a(WorldServer worldserver, EntityVillager entityvillager, long i) {
|
||||
protected void start(WorldServer worldserver, EntityVillager entityvillager, long i) {
|
||||
if (i > this.nextOkStartTime && this.aboveFarmlandPos != null) {
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(this.aboveFarmlandPos)));
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (Object) (new MemoryTarget(new BehaviorTarget(this.aboveFarmlandPos), 0.5F, 1)));
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(this.aboveFarmlandPos))); // CraftBukkit - decompile error
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (new MemoryTarget(new BehaviorTarget(this.aboveFarmlandPos), 0.5F, 1))); // CraftBukkit - decompile error
|
||||
- entityvillager.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(this.aboveFarmlandPos)));
|
||||
- entityvillager.getBrain().setMemory(MemoryModuleType.WALK_TARGET, (Object) (new MemoryTarget(new BehaviorTarget(this.aboveFarmlandPos), 0.5F, 1)));
|
||||
+ entityvillager.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(this.aboveFarmlandPos))); // CraftBukkit - decompile error
|
||||
+ entityvillager.getBrain().setMemory(MemoryModuleType.WALK_TARGET, (new MemoryTarget(new BehaviorTarget(this.aboveFarmlandPos), 0.5F, 1))); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
}
|
||||
@@ -101,7 +101,11 @@
|
||||
Block block1 = worldserver.getType(this.aboveFarmlandPos.down()).getBlock();
|
||||
Block block1 = worldserver.getBlockState(this.aboveFarmlandPos.below()).getBlock();
|
||||
|
||||
if (block instanceof BlockCrops && ((BlockCrops) block).isRipe(iblockdata)) {
|
||||
- worldserver.a(this.aboveFarmlandPos, true, entityvillager);
|
||||
if (block instanceof BlockCrops && ((BlockCrops) block).isMaxAge(iblockdata)) {
|
||||
- worldserver.destroyBlock(this.aboveFarmlandPos, true, entityvillager);
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.aboveFarmlandPos, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ worldserver.a(this.aboveFarmlandPos, true, entityvillager);
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.aboveFarmlandPos, Blocks.AIR.defaultBlockState()).isCancelled()) {
|
||||
+ worldserver.destroyBlock(this.aboveFarmlandPos, true, entityvillager);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
if (iblockdata.isAir() && block1 instanceof BlockSoil && entityvillager.canPlant()) {
|
||||
if (iblockdata.isAir() && block1 instanceof BlockSoil && entityvillager.hasFarmSeeds()) {
|
||||
@@ -112,19 +116,28 @@
|
||||
boolean flag = false;
|
||||
|
||||
if (!itemstack.isEmpty()) {
|
||||
+ // CraftBukkit start
|
||||
+ Block planted = null;
|
||||
if (itemstack.a(Items.WHEAT_SEEDS)) {
|
||||
- worldserver.setTypeAndData(this.aboveFarmlandPos, Blocks.WHEAT.getBlockData(), 3);
|
||||
if (itemstack.is(Items.WHEAT_SEEDS)) {
|
||||
- worldserver.setBlock(this.aboveFarmlandPos, Blocks.WHEAT.defaultBlockState(), 3);
|
||||
+ planted = Blocks.WHEAT;
|
||||
flag = true;
|
||||
} else if (itemstack.a(Items.POTATO)) {
|
||||
- worldserver.setTypeAndData(this.aboveFarmlandPos, Blocks.POTATOES.getBlockData(), 3);
|
||||
} else if (itemstack.is(Items.POTATO)) {
|
||||
- worldserver.setBlock(this.aboveFarmlandPos, Blocks.POTATOES.defaultBlockState(), 3);
|
||||
+ planted = Blocks.POTATOES;
|
||||
flag = true;
|
||||
} else if (itemstack.a(Items.CARROT)) {
|
||||
- worldserver.setTypeAndData(this.aboveFarmlandPos, Blocks.CARROTS.getBlockData(), 3);
|
||||
} else if (itemstack.is(Items.CARROT)) {
|
||||
- worldserver.setBlock(this.aboveFarmlandPos, Blocks.CARROTS.defaultBlockState(), 3);
|
||||
+ planted = Blocks.CARROTS;
|
||||
flag = true;
|
||||
} else if (itemstack.a(Items.BEETROOT_SEEDS)) {
|
||||
- worldserver.setTypeAndData(this.aboveFarmlandPos, Blocks.BEETROOTS.getBlockData(), 3);
|
||||
} else if (itemstack.is(Items.BEETROOT_SEEDS)) {
|
||||
- worldserver.setBlock(this.aboveFarmlandPos, Blocks.BEETROOTS.defaultBlockState(), 3);
|
||||
+ planted = Blocks.BEETROOTS;
|
||||
flag = true;
|
||||
}
|
||||
+
|
||||
+ if (planted != null && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.aboveFarmlandPos, planted.getBlockData()).isCancelled()) {
|
||||
+ worldserver.setTypeAndData(this.aboveFarmlandPos, planted.getBlockData(), 3);
|
||||
+ if (planted != null && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.aboveFarmlandPos, planted.defaultBlockState()).isCancelled()) {
|
||||
+ worldserver.setBlock(this.aboveFarmlandPos, planted.defaultBlockState(), 3);
|
||||
+ } else {
|
||||
+ flag = false;
|
||||
+ }
|
||||
@@ -58,13 +58,13 @@
|
||||
|
||||
if (flag) {
|
||||
@@ -143,8 +156,8 @@
|
||||
this.aboveFarmlandPos = this.a(worldserver);
|
||||
this.aboveFarmlandPos = this.getValidFarmland(worldserver);
|
||||
if (this.aboveFarmlandPos != null) {
|
||||
this.nextOkStartTime = i + 20L;
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (Object) (new MemoryTarget(new BehaviorTarget(this.aboveFarmlandPos), 0.5F, 1)));
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(this.aboveFarmlandPos)));
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (new MemoryTarget(new BehaviorTarget(this.aboveFarmlandPos), 0.5F, 1))); // CraftBukkit - decompile error
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(this.aboveFarmlandPos))); // CraftBukkit - decompile error
|
||||
- entityvillager.getBrain().setMemory(MemoryModuleType.WALK_TARGET, (Object) (new MemoryTarget(new BehaviorTarget(this.aboveFarmlandPos), 0.5F, 1)));
|
||||
- entityvillager.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(this.aboveFarmlandPos)));
|
||||
+ entityvillager.getBrain().setMemory(MemoryModuleType.WALK_TARGET, (new MemoryTarget(new BehaviorTarget(this.aboveFarmlandPos), 0.5F, 1))); // CraftBukkit - decompile error
|
||||
+ entityvillager.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(this.aboveFarmlandPos))); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@@ -69,6 +69,13 @@
|
||||
BlockDoor blockdoor = (BlockDoor) iblockdata.getBlock();
|
||||
|
||||
if (!blockdoor.h(iblockdata)) {
|
||||
if (!blockdoor.isOpen(iblockdata)) {
|
||||
+ // CraftBukkit start - entities opening doors
|
||||
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.level, blockposition));
|
||||
+ entityliving.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
@@ -11,13 +11,13 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
blockdoor.setDoor(entityliving, worldserver, iblockdata, blockposition, true);
|
||||
blockdoor.setOpen(entityliving, worldserver, iblockdata, blockposition, true);
|
||||
}
|
||||
|
||||
@@ -82,6 +89,13 @@
|
||||
BlockDoor blockdoor1 = (BlockDoor) iblockdata1.getBlock();
|
||||
|
||||
if (!blockdoor1.h(iblockdata1)) {
|
||||
if (!blockdoor1.isOpen(iblockdata1)) {
|
||||
+ // CraftBukkit start - entities opening doors
|
||||
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.level, blockposition1));
|
||||
+ entityliving.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
@@ -25,18 +25,18 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
blockdoor1.setDoor(entityliving, worldserver, iblockdata1, blockposition1, true);
|
||||
this.c(worldserver, entityliving, blockposition1);
|
||||
blockdoor1.setOpen(entityliving, worldserver, iblockdata1, blockposition1, true);
|
||||
this.rememberDoorToClose(worldserver, entityliving, blockposition1);
|
||||
}
|
||||
@@ -130,7 +144,7 @@
|
||||
private static boolean a(WorldServer worldserver, EntityLiving entityliving, BlockPosition blockposition) {
|
||||
BehaviorController<?> behaviorcontroller = entityliving.getBehaviorController();
|
||||
private static boolean areOtherMobsComingThroughDoor(WorldServer worldserver, EntityLiving entityliving, BlockPosition blockposition) {
|
||||
BehaviorController<?> behaviorcontroller = entityliving.getBrain();
|
||||
|
||||
- return !behaviorcontroller.hasMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES) ? false : ((List) behaviorcontroller.getMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES).get()).stream().filter((entityliving1) -> {
|
||||
+ return !behaviorcontroller.hasMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES) ? false : (behaviorcontroller.getMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES).get()).stream().filter((entityliving1) -> { // CraftBukkit - decompile error
|
||||
return entityliving1.getEntityType() == entityliving.getEntityType();
|
||||
- return !behaviorcontroller.hasMemoryValue(MemoryModuleType.NEAREST_LIVING_ENTITIES) ? false : ((List) behaviorcontroller.getMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES).get()).stream().filter((entityliving1) -> {
|
||||
+ return !behaviorcontroller.hasMemoryValue(MemoryModuleType.NEAREST_LIVING_ENTITIES) ? false : (behaviorcontroller.getMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES).get()).stream().filter((entityliving1) -> { // CraftBukkit - decompile error
|
||||
return entityliving1.getType() == entityliving.getType();
|
||||
}).filter((entityliving1) -> {
|
||||
return blockposition.a((IPosition) entityliving1.getPositionVector(), 2.0D);
|
||||
return blockposition.closerThan((IPosition) entityliving1.position(), 2.0D);
|
||||
@@ -172,7 +186,7 @@
|
||||
if (behaviorcontroller.getMemory(MemoryModuleType.DOORS_TO_CLOSE).isPresent()) {
|
||||
((Set) behaviorcontroller.getMemory(MemoryModuleType.DOORS_TO_CLOSE).get()).add(globalpos);
|
||||
|
||||
@@ -4,27 +4,27 @@
|
||||
if (entityvillager2 == null) {
|
||||
return Optional.empty();
|
||||
} else {
|
||||
- entityvillager.setAgeRaw(6000);
|
||||
- entityvillager1.setAgeRaw(6000);
|
||||
- entityvillager.setAge(6000);
|
||||
- entityvillager1.setAge(6000);
|
||||
+ // CraftBukkit start - call EntityBreedEvent
|
||||
entityvillager2.setAgeRaw(-24000);
|
||||
entityvillager2.setPositionRotation(entityvillager.locX(), entityvillager.locY(), entityvillager.locZ(), 0.0F, 0.0F);
|
||||
- worldserver.addAllEntities(entityvillager2);
|
||||
entityvillager2.setAge(-24000);
|
||||
entityvillager2.moveTo(entityvillager.getX(), entityvillager.getY(), entityvillager.getZ(), 0.0F, 0.0F);
|
||||
- worldserver.addFreshEntityWithPassengers(entityvillager2);
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(entityvillager2, entityvillager, entityvillager1, null, null, 0).isCancelled()) {
|
||||
+ return Optional.empty();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ entityvillager.setAgeRaw(6000);
|
||||
+ entityvillager1.setAgeRaw(6000);
|
||||
+ worldserver.addAllEntities(entityvillager2, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
|
||||
worldserver.broadcastEntityEffect(entityvillager2, (byte) 12);
|
||||
+ entityvillager.setAge(6000);
|
||||
+ entityvillager1.setAge(6000);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityvillager2, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
|
||||
worldserver.broadcastEntityEvent(entityvillager2, (byte) 12);
|
||||
return Optional.of(entityvillager2);
|
||||
}
|
||||
@@ -125,6 +130,6 @@
|
||||
private void a(WorldServer worldserver, EntityVillager entityvillager, BlockPosition blockposition) {
|
||||
GlobalPos globalpos = GlobalPos.create(worldserver.getDimensionKey(), blockposition);
|
||||
private void giveBedToChild(WorldServer worldserver, EntityVillager entityvillager, BlockPosition blockposition) {
|
||||
GlobalPos globalpos = GlobalPos.of(worldserver.dimension(), blockposition);
|
||||
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.HOME, (Object) globalpos);
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.HOME, globalpos); // CraftBukkit - decompile error
|
||||
- entityvillager.getBrain().setMemory(MemoryModuleType.HOME, (Object) globalpos);
|
||||
+ entityvillager.getBrain().setMemory(MemoryModuleType.HOME, globalpos); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,16 +16,16 @@
|
||||
@@ -21,7 +27,14 @@
|
||||
}
|
||||
|
||||
protected void a(WorldServer worldserver, EntityVillager entityvillager, long i) {
|
||||
- entityvillager.setVillagerData(entityvillager.getVillagerData().withProfession(VillagerProfession.NONE));
|
||||
protected void start(WorldServer worldserver, EntityVillager entityvillager, long i) {
|
||||
- entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(VillagerProfession.NONE));
|
||||
+ // CraftBukkit start
|
||||
+ VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(entityvillager, CraftVillager.nmsToBukkitProfession(VillagerProfession.NONE), VillagerCareerChangeEvent.ChangeReason.EMPLOYED);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ entityvillager.setVillagerData(entityvillager.getVillagerData().withProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
|
||||
+ entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
|
||||
+ // CraftBukkit end
|
||||
entityvillager.c(worldserver);
|
||||
entityvillager.refreshBrain(worldserver);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorUtil.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorUtil.java
|
||||
@@ -62,7 +62,7 @@
|
||||
@@ -61,7 +61,7 @@
|
||||
}
|
||||
|
||||
public static void a(EntityLiving entityliving, EntityLiving entityliving1) {
|
||||
- entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorPositionEntity(entityliving1, true)));
|
||||
+ entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorPositionEntity(entityliving1, true))); // CraftBukkit - decompile error
|
||||
public static void lookAtEntity(EntityLiving entityliving, EntityLiving entityliving1) {
|
||||
- entityliving.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorPositionEntity(entityliving1, true)));
|
||||
+ entityliving.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorPositionEntity(entityliving1, true))); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
private static void b(EntityLiving entityliving, EntityLiving entityliving1, float f) {
|
||||
@@ -75,18 +75,19 @@
|
||||
public static void a(EntityLiving entityliving, Entity entity, float f, int i) {
|
||||
private static void setWalkAndLookTargetMemoriesToEachOther(EntityLiving entityliving, EntityLiving entityliving1, float f) {
|
||||
@@ -74,18 +74,19 @@
|
||||
public static void setWalkAndLookTargetMemories(EntityLiving entityliving, Entity entity, float f, int i) {
|
||||
MemoryTarget memorytarget = new MemoryTarget(new BehaviorPositionEntity(entity, false), f, i);
|
||||
|
||||
- entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorPositionEntity(entity, true)));
|
||||
- entityliving.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (Object) memorytarget);
|
||||
+ entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorPositionEntity(entity, true))); // CraftBukkit - decompile error
|
||||
+ entityliving.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, memorytarget); // CraftBukkit - decompile error
|
||||
- entityliving.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorPositionEntity(entity, true)));
|
||||
- entityliving.getBrain().setMemory(MemoryModuleType.WALK_TARGET, (Object) memorytarget);
|
||||
+ entityliving.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorPositionEntity(entity, true))); // CraftBukkit - decompile error
|
||||
+ entityliving.getBrain().setMemory(MemoryModuleType.WALK_TARGET, memorytarget); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public static void a(EntityLiving entityliving, BlockPosition blockposition, float f, int i) {
|
||||
public static void setWalkAndLookTargetMemories(EntityLiving entityliving, BlockPosition blockposition, float f, int i) {
|
||||
MemoryTarget memorytarget = new MemoryTarget(new BehaviorTarget(blockposition), f, i);
|
||||
|
||||
- entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(blockposition)));
|
||||
- entityliving.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (Object) memorytarget);
|
||||
+ entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(blockposition))); // CraftBukkit - decompile error
|
||||
+ entityliving.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, memorytarget); // CraftBukkit - decompile error
|
||||
- entityliving.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(blockposition)));
|
||||
- entityliving.getBrain().setMemory(MemoryModuleType.WALK_TARGET, (Object) memorytarget);
|
||||
+ entityliving.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(blockposition))); // CraftBukkit - decompile error
|
||||
+ entityliving.getBrain().setMemory(MemoryModuleType.WALK_TARGET, memorytarget); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public static void a(EntityLiving entityliving, ItemStack itemstack, Vec3D vec3d) {
|
||||
public static void throwItem(EntityLiving entityliving, ItemStack itemstack, Vec3D vec3d) {
|
||||
+ if (itemstack.isEmpty()) return; // CraftBukkit - SPIGOT-4940: no empty loot
|
||||
double d0 = entityliving.getHeadY() - 0.30000001192092896D;
|
||||
EntityItem entityitem = new EntityItem(entityliving.level, entityliving.locX(), d0, entityliving.locZ(), itemstack);
|
||||
double d0 = entityliving.getEyeY() - 0.30000001192092896D;
|
||||
EntityItem entityitem = new EntityItem(entityliving.level, entityliving.getX(), d0, entityliving.getZ(), itemstack);
|
||||
float f = 0.3F;
|
||||
@@ -95,12 +96,19 @@
|
||||
vec3d1 = vec3d1.d().a(0.30000001192092896D);
|
||||
entityitem.setMot(vec3d1);
|
||||
entityitem.defaultPickupDelay();
|
||||
@@ -94,12 +95,19 @@
|
||||
vec3d1 = vec3d1.normalize().scale(0.30000001192092896D);
|
||||
entityitem.setDeltaMovement(vec3d1);
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(entityliving.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
+ entityitem.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
@@ -44,13 +44,13 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entityliving.level.addEntity(entityitem);
|
||||
entityliving.level.addFreshEntity(entityitem);
|
||||
}
|
||||
|
||||
public static SectionPosition a(WorldServer worldserver, SectionPosition sectionposition, int i) {
|
||||
int j = worldserver.b(sectionposition);
|
||||
- Stream stream = SectionPosition.a(sectionposition, i).filter((sectionposition1) -> {
|
||||
+ Stream<SectionPosition> stream = SectionPosition.a(sectionposition, i).filter((sectionposition1) -> { // CraftBukkit - decompile error
|
||||
return worldserver.b(sectionposition1) < j;
|
||||
public static SectionPosition findSectionClosestToVillage(WorldServer worldserver, SectionPosition sectionposition, int i) {
|
||||
int j = worldserver.sectionsToVillage(sectionposition);
|
||||
- Stream stream = SectionPosition.cube(sectionposition, i).filter((sectionposition1) -> {
|
||||
+ Stream<SectionPosition> stream = SectionPosition.cube(sectionposition, i).filter((sectionposition1) -> { // CraftBukkit - decompile error
|
||||
return worldserver.sectionsToVillage(sectionposition1) < j;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,20 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorWorkComposter.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorWorkComposter.java
|
||||
@@ -23,7 +23,7 @@
|
||||
public BehaviorWorkComposter() {}
|
||||
|
||||
@Override
|
||||
- protected void a(WorldServer worldserver, EntityVillager entityvillager) {
|
||||
+ protected void doWork(WorldServer worldserver, EntityVillager entityvillager) { // PAIL
|
||||
Optional<GlobalPos> optional = entityvillager.getBehaviorController().getMemory(MemoryModuleType.JOB_SITE);
|
||||
|
||||
if (optional.isPresent()) {
|
||||
@@ -42,7 +42,7 @@
|
||||
BlockPosition blockposition = globalpos.getBlockPosition();
|
||||
BlockPosition blockposition = globalpos.pos();
|
||||
|
||||
if ((Integer) iblockdata.get(BlockComposter.LEVEL) == 8) {
|
||||
- iblockdata = BlockComposter.d(iblockdata, worldserver, blockposition);
|
||||
+ iblockdata = BlockComposter.d(iblockdata, worldserver, blockposition, entityvillager); // CraftBukkit
|
||||
if ((Integer) iblockdata.getValue(BlockComposter.LEVEL) == 8) {
|
||||
- iblockdata = BlockComposter.extractProduce(iblockdata, worldserver, blockposition);
|
||||
+ iblockdata = BlockComposter.extractProduce(iblockdata, worldserver, blockposition, entityvillager); // CraftBukkit
|
||||
}
|
||||
|
||||
int i = 20;
|
||||
@@ -22,8 +13,8 @@
|
||||
i -= k1;
|
||||
|
||||
for (int l1 = 0; l1 < k1; ++l1) {
|
||||
- iblockdata1 = BlockComposter.a(iblockdata1, worldserver, itemstack, blockposition);
|
||||
+ iblockdata1 = BlockComposter.a(iblockdata1, worldserver, itemstack, blockposition, entityvillager); // CraftBukkit
|
||||
if ((Integer) iblockdata1.get(BlockComposter.LEVEL) == 7) {
|
||||
this.a(worldserver, iblockdata, blockposition, iblockdata1);
|
||||
- iblockdata1 = BlockComposter.insertItem(iblockdata1, worldserver, itemstack, blockposition);
|
||||
+ iblockdata1 = BlockComposter.insertItem(iblockdata1, worldserver, itemstack, blockposition, entityvillager); // CraftBukkit
|
||||
if ((Integer) iblockdata1.getValue(BlockComposter.LEVEL) == 7) {
|
||||
this.spawnComposterFillEffects(worldserver, iblockdata, blockposition, iblockdata1);
|
||||
return;
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
@@ -72,6 +72,12 @@
|
||||
}
|
||||
|
||||
if (this.breakTime == this.f() && this.a(this.mob.level.getDifficulty())) {
|
||||
if (this.breakTime == this.getDoorBreakTime() && this.isValidDifficulty(this.mob.level.getDifficulty())) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreakDoorEvent(this.mob, this.doorPos).isCancelled()) {
|
||||
+ this.c();
|
||||
+ this.start();
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.mob.level.a(this.doorPos, false);
|
||||
this.mob.level.triggerEffect(1021, this.doorPos, 0);
|
||||
this.mob.level.triggerEffect(2001, this.doorPos, Block.getCombinedId(this.mob.level.getType(this.doorPos)));
|
||||
this.mob.level.removeBlock(this.doorPos, false);
|
||||
this.mob.level.levelEvent(1021, this.doorPos, 0);
|
||||
this.mob.level.levelEvent(2001, this.doorPos, Block.getId(this.mob.level.getBlockState(this.doorPos)));
|
||||
|
||||
@@ -12,22 +12,22 @@
|
||||
|
||||
private static final int EAT_ANIMATION_TICKS = 40;
|
||||
@@ -65,7 +69,8 @@
|
||||
BlockPosition blockposition = this.mob.getChunkCoordinates();
|
||||
BlockPosition blockposition = this.mob.blockPosition();
|
||||
|
||||
if (PathfinderGoalEatTile.IS_TALL_GRASS.test(this.level.getType(blockposition))) {
|
||||
if (PathfinderGoalEatTile.IS_TALL_GRASS.test(this.level.getBlockState(blockposition))) {
|
||||
- if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ // CraftBukkit
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, Blocks.AIR.getBlockData(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) {
|
||||
this.level.b(blockposition, false);
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, Blocks.AIR.defaultBlockState(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) {
|
||||
this.level.destroyBlock(blockposition, false);
|
||||
}
|
||||
|
||||
@@ -75,7 +80,8 @@
|
||||
BlockPosition blockposition1 = blockposition.down();
|
||||
BlockPosition blockposition1 = blockposition.below();
|
||||
|
||||
if (this.level.getType(blockposition1).a(Blocks.GRASS_BLOCK)) {
|
||||
if (this.level.getBlockState(blockposition1).is(Blocks.GRASS_BLOCK)) {
|
||||
- if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ // CraftBukkit
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.AIR.getBlockData(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) {
|
||||
this.level.triggerEffect(2001, blockposition1, Block.getCombinedId(Blocks.GRASS_BLOCK.getBlockData()));
|
||||
this.level.setTypeAndData(blockposition1, Blocks.DIRT.getBlockData(), 2);
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.AIR.defaultBlockState(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) {
|
||||
this.level.levelEvent(2001, blockposition1, Block.getId(Blocks.GRASS_BLOCK.defaultBlockState()));
|
||||
this.level.setBlock(blockposition1, Blocks.DIRT.defaultBlockState(), 2);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalFollowOwner.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalFollowOwner.java
|
||||
@@ -15,6 +15,12 @@
|
||||
@@ -14,6 +14,12 @@
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
import net.minecraft.world.level.pathfinder.PathfinderNormal;
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
public class PathfinderGoalFollowOwner extends PathfinderGoal {
|
||||
|
||||
public static final int TELEPORT_WHEN_DISTANCE_IS = 12;
|
||||
@@ -121,7 +127,18 @@
|
||||
} else if (!this.a(new BlockPosition(i, j, k))) {
|
||||
@@ -120,7 +126,18 @@
|
||||
} else if (!this.canTeleportTo(new BlockPosition(i, j, k))) {
|
||||
return false;
|
||||
} else {
|
||||
- this.tamable.setPositionRotation((double) i + 0.5D, (double) j, (double) k + 0.5D, this.tamable.getYRot(), this.tamable.getXRot());
|
||||
- this.tamable.moveTo((double) i + 0.5D, (double) j, (double) k + 0.5D, this.tamable.getYRot(), this.tamable.getXRot());
|
||||
+ // CraftBukkit start
|
||||
+ CraftEntity entity = this.tamable.getBukkitEntity();
|
||||
+ Location to = new Location(entity.getWorld(), (double) i + 0.5D, (double) j, (double) k + 0.5D, this.tamable.getYRot(), this.tamable.getXRot());
|
||||
@@ -28,8 +28,8 @@
|
||||
+ }
|
||||
+ to = event.getTo();
|
||||
+
|
||||
+ this.tamable.setPositionRotation(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
|
||||
+ this.tamable.moveTo(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
|
||||
+ // CraftBukkit end
|
||||
this.navigation.o();
|
||||
this.navigation.stop();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -10,17 +10,25 @@
|
||||
+
|
||||
public class PathfinderGoalPanic extends PathfinderGoal {
|
||||
|
||||
protected final EntityCreature mob;
|
||||
@@ -76,6 +80,12 @@
|
||||
public static final int WATER_CHECK_DISTANCE_VERTICAL = 1;
|
||||
@@ -77,6 +81,12 @@
|
||||
|
||||
@Override
|
||||
public boolean b() {
|
||||
public boolean canContinueToUse() {
|
||||
+ // CraftBukkit start - introduce a temporary timeout hack until this is fixed properly
|
||||
+ if ((this.mob.tickCount - this.mob.lastHurtByMobTimestamp) > 100) {
|
||||
+ this.mob.setLastDamager((EntityLiving) null);
|
||||
+ this.mob.setLastHurtByMob((EntityLiving) null);
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return !this.mob.getNavigation().m();
|
||||
return !this.mob.getNavigation().isDone();
|
||||
}
|
||||
|
||||
@@ -86,6 +96,6 @@
|
||||
|
||||
return !iblockaccess.getBlockState(blockposition).getCollisionShape(iblockaccess, blockposition).isEmpty() ? null : (BlockPosition) BlockPosition.findClosestMatch(entity.blockPosition(), i, 1, (blockposition1) -> {
|
||||
return iblockaccess.getFluidState(blockposition1).is((Tag) TagsFluid.WATER);
|
||||
- }).orElse((Object) null);
|
||||
+ }).orElse(null); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.a(blockposition1, false);
|
||||
world.removeBlock(blockposition1, false);
|
||||
if (!world.isClientSide) {
|
||||
for (int i = 0; i < 20; ++i) {
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalSit.java
|
||||
@@ -22,7 +22,7 @@
|
||||
@Override
|
||||
public boolean a() {
|
||||
if (!this.mob.isTamed()) {
|
||||
public boolean canUse() {
|
||||
if (!this.mob.isTame()) {
|
||||
- return false;
|
||||
+ return this.mob.isWillSit() && this.mob.getGoalTarget() == null; // CraftBukkit - Allow sitting for wild animals
|
||||
} else if (this.mob.aO()) {
|
||||
+ return this.mob.isOrderedToSit() && this.mob.getTarget() == null; // CraftBukkit - Allow sitting for wild animals
|
||||
} else if (this.mob.isInWaterOrBubble()) {
|
||||
return false;
|
||||
} else if (!this.mob.isOnGround()) {
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalTame.java
|
||||
@@ -62,7 +62,8 @@
|
||||
int i = this.horse.getTemper();
|
||||
int j = this.horse.getMaxDomestication();
|
||||
int j = this.horse.getMaxTemper();
|
||||
|
||||
- if (j > 0 && this.horse.getRandom().nextInt(j) < i) {
|
||||
+ // CraftBukkit - fire EntityTameEvent
|
||||
+ if (j > 0 && this.horse.getRandom().nextInt(j) < i && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this.horse, ((org.bukkit.craftbukkit.entity.CraftHumanEntity) this.horse.getBukkitEntity().getPassenger()).getHandle()).isCancelled()) {
|
||||
this.horse.i((EntityHuman) entity);
|
||||
this.horse.tameWithName((EntityHuman) entity);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalTempt.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalTempt.java
|
||||
@@ -8,6 +8,13 @@
|
||||
@@ -9,6 +9,13 @@
|
||||
import net.minecraft.world.entity.player.EntityHuman;
|
||||
import net.minecraft.world.item.crafting.RecipeItemStack;
|
||||
|
||||
@@ -13,20 +13,20 @@
|
||||
+
|
||||
public class PathfinderGoalTempt extends PathfinderGoal {
|
||||
|
||||
private static final PathfinderTargetCondition TEMP_TARGETING = PathfinderTargetCondition.b().a(10.0D).d();
|
||||
@@ -19,7 +26,7 @@
|
||||
private double pz;
|
||||
private static final PathfinderTargetCondition TEMP_TARGETING = PathfinderTargetCondition.forNonCombat().range(10.0D).ignoreLineOfSight();
|
||||
@@ -21,7 +28,7 @@
|
||||
private double pRotX;
|
||||
private double pRotY;
|
||||
@Nullable
|
||||
- protected EntityHuman player;
|
||||
+ protected EntityLiving player; // CraftBukkit
|
||||
private int calmDown;
|
||||
private boolean isRunning;
|
||||
private final RecipeItemStack items;
|
||||
@@ -41,6 +48,15 @@
|
||||
@@ -43,6 +50,15 @@
|
||||
return false;
|
||||
} else {
|
||||
this.player = this.mob.level.a(this.targetingConditions, (EntityLiving) this.mob);
|
||||
this.player = this.mob.level.getNearestPlayer(this.targetingConditions, this.mob);
|
||||
+ // CraftBukkit start
|
||||
+ if (this.player != null) {
|
||||
+ EntityTargetLivingEntityEvent event = CraftEventFactory.callEntityTargetLivingEvent(this.mob, this.player, EntityTargetEvent.TargetReason.TEMPT);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/target/PathfinderGoalDefendVillage.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/target/PathfinderGoalDefendVillage.java
|
||||
@@ -56,7 +56,7 @@
|
||||
@@ -58,7 +58,7 @@
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
- this.golem.setGoalTarget(this.potentialTarget);
|
||||
+ this.golem.setGoalTarget(this.potentialTarget, org.bukkit.event.entity.EntityTargetEvent.TargetReason.DEFEND_VILLAGE, true); // CraftBukkit - reason
|
||||
super.c();
|
||||
public void start() {
|
||||
- this.golem.setTarget(this.potentialTarget);
|
||||
+ this.golem.setTarget(this.potentialTarget, org.bukkit.event.entity.EntityTargetEvent.TargetReason.DEFEND_VILLAGE, true); // CraftBukkit - reason
|
||||
super.start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/target/PathfinderGoalHurtByTarget.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/target/PathfinderGoalHurtByTarget.java
|
||||
@@ -64,7 +64,7 @@
|
||||
@@ -67,7 +67,7 @@
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
- this.mob.setGoalTarget(this.mob.getLastDamager());
|
||||
+ this.mob.setGoalTarget(this.mob.getLastDamager(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit - reason
|
||||
this.targetMob = this.mob.getGoalTarget();
|
||||
this.timestamp = this.mob.dH();
|
||||
public void start() {
|
||||
- this.mob.setTarget(this.mob.getLastHurtByMob());
|
||||
+ this.mob.setTarget(this.mob.getLastHurtByMob(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit - reason
|
||||
this.targetMob = this.mob.getTarget();
|
||||
this.timestamp = this.mob.getLastHurtByMobTimestamp();
|
||||
this.unseenMemoryTicks = 300;
|
||||
@@ -111,6 +111,6 @@
|
||||
@@ -114,6 +114,6 @@
|
||||
}
|
||||
|
||||
protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
- entityinsentient.setGoalTarget(entityliving);
|
||||
+ entityinsentient.setGoalTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit - reason
|
||||
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
- entityinsentient.setTarget(entityliving);
|
||||
+ entityinsentient.setTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit - reason
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/target/PathfinderGoalNearestAttackableTarget.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/target/PathfinderGoalNearestAttackableTarget.java
|
||||
@@ -61,7 +61,7 @@
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
- this.mob.setGoalTarget(this.target);
|
||||
+ this.mob.setGoalTarget(this.target, target instanceof EntityPlayer ? org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER : org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_ENTITY, true); // CraftBukkit - reason
|
||||
super.c();
|
||||
public void start() {
|
||||
- this.mob.setTarget(this.target);
|
||||
+ this.mob.setTarget(this.target, target instanceof EntityPlayer ? org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER : org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_ENTITY, true); // CraftBukkit - reason
|
||||
super.start();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -38,7 +38,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 - reason
|
||||
public void start() {
|
||||
- this.mob.setTarget(this.ownerLastHurtBy);
|
||||
+ this.mob.setTarget(this.ownerLastHurtBy, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER, true); // CraftBukkit - reason
|
||||
EntityLiving entityliving = this.tameAnimal.getOwner();
|
||||
|
||||
if (entityliving != null) {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
- this.mob.setGoalTarget(this.ownerLastHurt);
|
||||
+ this.mob.setGoalTarget(this.ownerLastHurt, org.bukkit.event.entity.EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET, true); // CraftBukkit - reason
|
||||
public void start() {
|
||||
- this.mob.setTarget(this.ownerLastHurt);
|
||||
+ this.mob.setTarget(this.ownerLastHurt, org.bukkit.event.entity.EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET, true); // CraftBukkit - reason
|
||||
EntityLiving entityliving = this.tameAnimal.getOwner();
|
||||
|
||||
if (entityliving != null) {
|
||||
|
||||
@@ -9,21 +9,21 @@
|
||||
public abstract class PathfinderGoalTarget extends PathfinderGoal {
|
||||
|
||||
private static final int EMPTY_REACH_CACHE = 0;
|
||||
@@ -68,7 +70,7 @@
|
||||
@@ -69,7 +71,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.mob.setGoalTarget(entityliving);
|
||||
+ this.mob.setGoalTarget(entityliving, EntityTargetEvent.TargetReason.CLOSEST_ENTITY, true); // CraftBukkit
|
||||
- this.mob.setTarget(entityliving);
|
||||
+ this.mob.setTarget(entityliving, EntityTargetEvent.TargetReason.CLOSEST_ENTITY, true); // CraftBukkit
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -88,7 +90,7 @@
|
||||
@@ -89,7 +91,7 @@
|
||||
|
||||
@Override
|
||||
public void d() {
|
||||
- this.mob.setGoalTarget((EntityLiving) null);
|
||||
+ this.mob.setGoalTarget((EntityLiving) null, EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit
|
||||
public void stop() {
|
||||
- this.mob.setTarget((EntityLiving) null);
|
||||
+ this.mob.setTarget((EntityLiving) null, EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit
|
||||
this.targetMob = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/ai/village/VillageSiege.java
|
||||
+++ b/net/minecraft/world/entity/ai/village/VillageSiege.java
|
||||
@@ -123,7 +123,7 @@
|
||||
@@ -122,7 +122,7 @@
|
||||
}
|
||||
|
||||
entityzombie.setPositionRotation(vec3d.x, vec3d.y, vec3d.z, worldserver.random.nextFloat() * 360.0F, 0.0F);
|
||||
- worldserver.addAllEntities(entityzombie);
|
||||
+ worldserver.addAllEntities(entityzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_INVASION); // CraftBukkit
|
||||
entityzombie.moveTo(vec3d.x, vec3d.y, vec3d.z, worldserver.random.nextFloat() * 360.0F, 0.0F);
|
||||
- worldserver.addFreshEntityWithPassengers(entityzombie);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_INVASION); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/ambient/EntityBat.java
|
||||
+++ b/net/minecraft/world/entity/ambient/EntityBat.java
|
||||
@@ -30,6 +30,8 @@
|
||||
@@ -29,6 +29,8 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
@@ -138,16 +140,24 @@
|
||||
}
|
||||
|
||||
if (this.level.a(EntityBat.BAT_RESTING_TARGETING, (EntityLiving) this) != null) {
|
||||
if (this.level.getNearestPlayer(EntityBat.BAT_RESTING_TARGETING, this) != null) {
|
||||
+ // CraftBukkit Start - Call BatToggleSleepEvent
|
||||
+ if (CraftEventFactory.handleBatToggleSleepEvent(this, true)) {
|
||||
+ this.setAsleep(false);
|
||||
+ this.setResting(false);
|
||||
+ if (!flag) {
|
||||
+ this.level.a((EntityHuman) null, 1025, blockposition, 0);
|
||||
+ this.level.levelEvent((EntityHuman) null, 1025, blockposition, 0);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit End
|
||||
@@ -25,28 +25,28 @@
|
||||
+ } else {
|
||||
+ // CraftBukkit Start - Call BatToggleSleepEvent
|
||||
+ if (CraftEventFactory.handleBatToggleSleepEvent(this, true)) {
|
||||
this.setAsleep(false);
|
||||
this.setResting(false);
|
||||
if (!flag) {
|
||||
this.level.a((EntityHuman) null, 1025, blockposition, 0);
|
||||
this.level.levelEvent((EntityHuman) null, 1025, blockposition, 0);
|
||||
}
|
||||
}
|
||||
- } else {
|
||||
- this.setAsleep(false);
|
||||
- this.setResting(false);
|
||||
- if (!flag) {
|
||||
- this.level.a((EntityHuman) null, 1025, blockposition, 0);
|
||||
- this.level.levelEvent((EntityHuman) null, 1025, blockposition, 0);
|
||||
- }
|
||||
+ // CraftBukkit End - Call BatToggleSleepEvent
|
||||
}
|
||||
} else {
|
||||
if (this.targetPosition != null && (!this.level.isEmpty(this.targetPosition) || this.targetPosition.getY() <= this.level.getMinBuildHeight())) {
|
||||
if (this.targetPosition != null && (!this.level.isEmptyBlock(this.targetPosition) || this.targetPosition.getY() <= this.level.getMinBuildHeight())) {
|
||||
@@ -171,7 +181,11 @@
|
||||
this.zza = 0.5F;
|
||||
this.setYRot(this.getYRot() + f1);
|
||||
if (this.random.nextInt(100) == 0 && this.level.getType(blockposition1).isOccluding(this.level, blockposition1)) {
|
||||
- this.setAsleep(true);
|
||||
if (this.random.nextInt(100) == 0 && this.level.getBlockState(blockposition1).isRedstoneConductor(this.level, blockposition1)) {
|
||||
- this.setResting(true);
|
||||
+ // CraftBukkit Start - Call BatToggleSleepEvent
|
||||
+ if (CraftEventFactory.handleBatToggleSleepEvent(this, false)) {
|
||||
+ this.setAsleep(true);
|
||||
+ this.setResting(true);
|
||||
+ }
|
||||
+ // CraftBukkit End
|
||||
}
|
||||
@@ -55,13 +55,13 @@
|
||||
@@ -201,7 +215,11 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.level.isClientSide && this.isAsleep()) {
|
||||
- this.setAsleep(false);
|
||||
if (!this.level.isClientSide && this.isResting()) {
|
||||
- this.setResting(false);
|
||||
+ // CraftBukkit Start - Call BatToggleSleepEvent
|
||||
+ if (CraftEventFactory.handleBatToggleSleepEvent(this, true)) {
|
||||
+ this.setAsleep(false);
|
||||
+ this.setResting(false);
|
||||
+ }
|
||||
+ // CraftBukkit End - Call BatToggleSleepEvent
|
||||
}
|
||||
|
||||
return super.damageEntity(damagesource, f);
|
||||
return super.hurt(damagesource, f);
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java
|
||||
+++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java
|
||||
@@ -22,6 +22,11 @@
|
||||
@@ -21,6 +21,11 @@
|
||||
import net.minecraft.world.level.block.BlockFireAbstract;
|
||||
import net.minecraft.world.level.dimension.end.EnderDragonBattle;
|
||||
|
||||
@@ -11,21 +11,21 @@
|
||||
+
|
||||
public class EntityEnderCrystal extends Entity {
|
||||
|
||||
private static final DataWatcherObject<Optional<BlockPosition>> DATA_BEAM_TARGET = DataWatcher.a(EntityEnderCrystal.class, DataWatcherRegistry.OPTIONAL_BLOCK_POS);
|
||||
@@ -57,7 +62,11 @@
|
||||
BlockPosition blockposition = this.getChunkCoordinates();
|
||||
private static final DataWatcherObject<Optional<BlockPosition>> DATA_BEAM_TARGET = DataWatcher.defineId(EntityEnderCrystal.class, DataWatcherRegistry.OPTIONAL_BLOCK_POS);
|
||||
@@ -56,7 +61,11 @@
|
||||
BlockPosition blockposition = this.blockPosition();
|
||||
|
||||
if (((WorldServer) this.level).getDragonBattle() != null && this.level.getType(blockposition).isAir()) {
|
||||
- this.level.setTypeUpdate(blockposition, BlockFireAbstract.a((IBlockAccess) this.level, blockposition));
|
||||
if (((WorldServer) this.level).dragonFight() != null && this.level.getBlockState(blockposition).isAir()) {
|
||||
- this.level.setBlockAndUpdate(blockposition, BlockFireAbstract.getState(this.level, blockposition));
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.callBlockIgniteEvent(this.level, blockposition, this).isCancelled()) {
|
||||
+ this.level.setTypeUpdate(blockposition, BlockFireAbstract.a((IBlockAccess) this.level, blockposition));
|
||||
+ this.level.setBlockAndUpdate(blockposition, BlockFireAbstract.getState(this.level, blockposition));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,9 +106,22 @@
|
||||
@@ -96,9 +105,22 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.isRemoved() && !this.level.isClientSide) {
|
||||
@@ -34,9 +34,9 @@
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.a(Entity.RemovalReason.KILLED);
|
||||
this.remove(Entity.RemovalReason.KILLED);
|
||||
if (!damagesource.isExplosion()) {
|
||||
- this.level.explode((Entity) null, this.locX(), this.locY(), this.locZ(), 6.0F, Explosion.Effect.DESTROY);
|
||||
- this.level.explode((Entity) null, this.getX(), this.getY(), this.getZ(), 6.0F, Explosion.Effect.DESTROY);
|
||||
+ // CraftBukkit start
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 6.0F, false);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
@@ -44,8 +44,8 @@
|
||||
+ this.unsetRemoved();
|
||||
+ return false;
|
||||
+ }
|
||||
+ this.level.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), Explosion.Effect.DESTROY);
|
||||
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Explosion.Effect.DESTROY);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
this.a(damagesource);
|
||||
this.onDestroyedBy(damagesource);
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
super(EntityTypes.ENDER_DRAGON, world);
|
||||
@@ -236,7 +249,7 @@
|
||||
|
||||
Vec3D vec3d1 = idragoncontroller.g();
|
||||
Vec3D vec3d1 = idragoncontroller.getFlyTargetLocation();
|
||||
|
||||
- if (vec3d1 != null) {
|
||||
+ if (vec3d1 != null && idragoncontroller.getControllerPhase() != DragonControllerPhase.HOVERING) { // CraftBukkit - Don't move when hovering
|
||||
d0 = vec3d1.x - this.locX();
|
||||
d1 = vec3d1.y - this.locY();
|
||||
d2 = vec3d1.z - this.locZ();
|
||||
+ if (vec3d1 != null && idragoncontroller.getPhase() != DragonControllerPhase.HOVERING) { // CraftBukkit - Don't move when hovering
|
||||
d0 = vec3d1.x - this.getX();
|
||||
d1 = vec3d1.y - this.getY();
|
||||
d2 = vec3d1.z - this.getZ();
|
||||
@@ -378,7 +391,14 @@
|
||||
if (this.nearestCrystal.isRemoved()) {
|
||||
this.nearestCrystal = null;
|
||||
@@ -65,10 +65,10 @@
|
||||
@@ -462,7 +485,11 @@
|
||||
|
||||
if (!iblockdata.isAir() && iblockdata.getMaterial() != Material.FIRE) {
|
||||
if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.a((Tag) TagsBlock.DRAGON_IMMUNE)) {
|
||||
- flag1 = this.level.a(blockposition, false) || flag1;
|
||||
if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.is((Tag) TagsBlock.DRAGON_IMMUNE)) {
|
||||
- flag1 = this.level.removeBlock(blockposition, false) || flag1;
|
||||
+ // CraftBukkit start - Add blocks to list rather than destroying them
|
||||
+ // flag1 = this.level.a(blockposition, false) || flag1;
|
||||
+ // flag1 = this.level.removeBlock(blockposition, false) || flag1;
|
||||
+ flag1 = true;
|
||||
+ destroyedBlocks.add(CraftBlock.at(level, blockposition));
|
||||
+ // CraftBukkit end
|
||||
@@ -95,7 +95,7 @@
|
||||
+ } else if (event.getYield() == 0F) {
|
||||
+ // Yield zero ==> no drops
|
||||
+ for (org.bukkit.block.Block block : event.blockList()) {
|
||||
+ this.level.a(new BlockPosition(block.getX(), block.getY(), block.getZ()), false);
|
||||
+ this.level.removeBlock(new BlockPosition(block.getX(), block.getY(), block.getZ()), false);
|
||||
+ }
|
||||
+ } else {
|
||||
+ for (org.bukkit.block.Block block : event.blockList()) {
|
||||
@@ -108,18 +108,18 @@
|
||||
+ BlockPosition blockposition = craftBlock.getPosition();
|
||||
+
|
||||
+ Block nmsBlock = craftBlock.getNMS().getBlock();
|
||||
+ if (nmsBlock.a(explosionSource)) {
|
||||
+ TileEntity tileentity = craftBlock.getNMS().isTileEntity() ? this.level.getTileEntity(blockposition) : null;
|
||||
+ LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.level)).a(this.level.random).set(LootContextParameters.ORIGIN, Vec3D.a(blockposition)).set(LootContextParameters.TOOL, ItemStack.EMPTY).set(LootContextParameters.EXPLOSION_RADIUS, 1.0F / event.getYield()).setOptional(LootContextParameters.BLOCK_ENTITY, tileentity);
|
||||
+ if (nmsBlock.dropFromExplosion(explosionSource)) {
|
||||
+ TileEntity tileentity = craftBlock.getNMS().hasBlockEntity() ? this.level.getBlockEntity(blockposition) : null;
|
||||
+ LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.level)).withRandom(this.level.random).withParameter(LootContextParameters.ORIGIN, Vec3D.atCenterOf(blockposition)).withParameter(LootContextParameters.TOOL, ItemStack.EMPTY).withParameter(LootContextParameters.EXPLOSION_RADIUS, 1.0F / event.getYield()).withOptionalParameter(LootContextParameters.BLOCK_ENTITY, tileentity);
|
||||
+
|
||||
+ craftBlock.getNMS().a(loottableinfo_builder).forEach((itemstack) -> {
|
||||
+ Block.a(level, blockposition, itemstack);
|
||||
+ craftBlock.getNMS().getDrops(loottableinfo_builder).forEach((itemstack) -> {
|
||||
+ Block.popResource(level, blockposition, itemstack);
|
||||
+ });
|
||||
+ craftBlock.getNMS().dropNaturally((WorldServer) level, blockposition, ItemStack.EMPTY);
|
||||
+ craftBlock.getNMS().spawnAfterBreak((WorldServer) level, blockposition, ItemStack.EMPTY);
|
||||
+ }
|
||||
+ nmsBlock.wasExploded(level, blockposition, explosionSource);
|
||||
+
|
||||
+ this.level.a(blockposition, false);
|
||||
+ this.level.removeBlock(blockposition, false);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerManager.java
|
||||
+++ b/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerManager.java
|
||||
@@ -4,6 +4,11 @@
|
||||
@@ -5,6 +5,11 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
public class DragonControllerManager {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -22,6 +27,19 @@
|
||||
this.currentPhase.e();
|
||||
@@ -24,6 +29,19 @@
|
||||
this.currentPhase.end();
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Call EnderDragonChangePhaseEvent
|
||||
+ EnderDragonChangePhaseEvent event = new EnderDragonChangePhaseEvent(
|
||||
+ (CraftEnderDragon) this.dragon.getBukkitEntity(),
|
||||
+ (this.currentPhase == null) ? null : CraftEnderDragon.getBukkitPhase(this.currentPhase.getControllerPhase()),
|
||||
+ (this.currentPhase == null) ? null : CraftEnderDragon.getBukkitPhase(this.currentPhase.getPhase()),
|
||||
+ CraftEnderDragon.getBukkitPhase(dragoncontrollerphase)
|
||||
+ );
|
||||
+ this.dragon.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
@@ -29,11 +29,11 @@
|
||||
+ dragoncontrollerphase = CraftEnderDragon.getMinecraftPhase(event.getNewPhase());
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.currentPhase = this.b(dragoncontrollerphase);
|
||||
this.currentPhase = this.getPhase(dragoncontrollerphase);
|
||||
if (!this.dragon.level.isClientSide) {
|
||||
this.dragon.getDataWatcher().set(EntityEnderDragon.DATA_PHASE, dragoncontrollerphase.b());
|
||||
@@ -43,6 +61,6 @@
|
||||
this.phases[i] = dragoncontrollerphase.a(this.dragon);
|
||||
this.dragon.getEntityData().set(EntityEnderDragon.DATA_PHASE, dragoncontrollerphase.getId());
|
||||
@@ -45,6 +63,6 @@
|
||||
this.phases[i] = dragoncontrollerphase.createInstance(this.dragon);
|
||||
}
|
||||
|
||||
- return this.phases[i];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/boss/wither/EntityWither.java
|
||||
+++ b/net/minecraft/world/entity/boss/wither/EntityWither.java
|
||||
@@ -54,6 +54,17 @@
|
||||
@@ -56,6 +56,17 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -17,72 +17,72 @@
|
||||
+
|
||||
public class EntityWither extends EntityMonster implements PowerableMob, IRangedEntity {
|
||||
|
||||
private static final DataWatcherObject<Integer> DATA_TARGET_A = DataWatcher.a(EntityWither.class, DataWatcherRegistry.INT);
|
||||
@@ -238,16 +249,40 @@
|
||||
private static final DataWatcherObject<Integer> DATA_TARGET_A = DataWatcher.defineId(EntityWither.class, DataWatcherRegistry.INT);
|
||||
@@ -250,16 +261,40 @@
|
||||
this.bossEvent.setProgress(1.0F - (float) i / 220.0F);
|
||||
if (i <= 0) {
|
||||
Explosion.Effect explosion_effect = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
|
||||
+ // CraftBukkit start
|
||||
+ // this.world.createExplosion(this, this.locX(), this.getHeadY(), this.locZ(), 7.0F, false, explosion_effect);
|
||||
+ // this.level.explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, explosion_effect);
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 7.0F, false);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.level.createExplosion(this, this.locX(), this.getHeadY(), this.locZ(), event.getRadius(), event.getFire(), explosion_effect);
|
||||
+ this.level.explode(this, this.getX(), this.getEyeY(), this.getZ(), event.getRadius(), event.getFire(), explosion_effect);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
- this.level.createExplosion(this, this.locX(), this.getHeadY(), this.locZ(), 7.0F, false, explosion_effect);
|
||||
- this.level.explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, explosion_effect);
|
||||
if (!this.isSilent()) {
|
||||
- this.level.b(1023, this.getChunkCoordinates(), 0);
|
||||
- this.level.globalLevelEvent(1023, this.blockPosition(), 0);
|
||||
+ // CraftBukkit start - Use relative location for far away sounds
|
||||
+ // this.world.b(1023, new BlockPosition(this), 0);
|
||||
+ // this.world.globalLevelEvent(1023, new BlockPosition(this), 0);
|
||||
+ int viewDistance = ((WorldServer) this.level).getCraftServer().getViewDistance() * 16;
|
||||
+ for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
|
||||
+ double deltaX = this.locX() - player.locX();
|
||||
+ double deltaZ = this.locZ() - player.locZ();
|
||||
+ double deltaX = this.getX() - player.getX();
|
||||
+ double deltaZ = this.getZ() - player.getZ();
|
||||
+ double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
||||
+ if (distanceSquared > viewDistance * viewDistance) {
|
||||
+ double deltaLength = Math.sqrt(distanceSquared);
|
||||
+ double relativeX = player.locX() + (deltaX / deltaLength) * viewDistance;
|
||||
+ double relativeZ = player.locZ() + (deltaZ / deltaLength) * viewDistance;
|
||||
+ player.connection.sendPacket(new PacketPlayOutWorldEvent(1023, new BlockPosition((int) relativeX, (int) this.locY(), (int) relativeZ), 0, true));
|
||||
+ double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance;
|
||||
+ double relativeZ = player.getZ() + (deltaZ / deltaLength) * viewDistance;
|
||||
+ player.connection.send(new PacketPlayOutWorldEvent(1023, new BlockPosition((int) relativeX, (int) this.getY(), (int) relativeZ), 0, true));
|
||||
+ } else {
|
||||
+ player.connection.sendPacket(new PacketPlayOutWorldEvent(1023, this.getChunkCoordinates(), 0, true));
|
||||
+ player.connection.send(new PacketPlayOutWorldEvent(1023, this.blockPosition(), 0, true));
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
this.setInvul(i);
|
||||
this.setInvulnerableTicks(i);
|
||||
if (this.tickCount % 10 == 0) {
|
||||
- this.heal(10.0F);
|
||||
+ this.heal(10.0F, EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -292,6 +327,7 @@
|
||||
@@ -304,6 +339,7 @@
|
||||
if (!list.isEmpty()) {
|
||||
EntityLiving entityliving1 = (EntityLiving) list.get(this.random.nextInt(list.size()));
|
||||
|
||||
+ if (CraftEventFactory.callEntityTargetLivingEvent(this, entityliving1, EntityTargetEvent.TargetReason.CLOSEST_ENTITY).isCancelled()) continue; // CraftBukkit
|
||||
this.setHeadTarget(i, entityliving1.getId());
|
||||
this.setAlternativeTarget(i, entityliving1.getId());
|
||||
}
|
||||
}
|
||||
@@ -322,6 +358,11 @@
|
||||
IBlockData iblockdata = this.level.getType(blockposition);
|
||||
@@ -334,6 +370,11 @@
|
||||
IBlockData iblockdata = this.level.getBlockState(blockposition);
|
||||
|
||||
if (c(iblockdata)) {
|
||||
if (canDestroy(iblockdata)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
flag = this.level.a(blockposition, true, this) || flag;
|
||||
flag = this.level.destroyBlock(blockposition, true, this) || flag;
|
||||
}
|
||||
}
|
||||
@@ -335,7 +376,7 @@
|
||||
@@ -347,7 +388,7 @@
|
||||
}
|
||||
|
||||
if (this.tickCount % 20 == 0) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/decoration/EntityArmorStand.java
|
||||
+++ b/net/minecraft/world/entity/decoration/EntityArmorStand.java
|
||||
@@ -44,6 +44,15 @@
|
||||
@@ -43,6 +43,15 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
public class EntityArmorStand extends EntityLiving {
|
||||
|
||||
public static final int WOBBLE_TIME = 5;
|
||||
@@ -106,6 +115,13 @@
|
||||
this.setPosition(d0, d1, d2);
|
||||
@@ -105,6 +114,13 @@
|
||||
this.setPos(d0, d1, d2);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - SPIGOT-3607, SPIGOT-3637
|
||||
@@ -28,33 +28,33 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
public void updateSize() {
|
||||
double d0 = this.locX();
|
||||
@@ -161,14 +177,21 @@
|
||||
public void refreshDimensions() {
|
||||
double d0 = this.getX();
|
||||
@@ -160,14 +176,21 @@
|
||||
|
||||
@Override
|
||||
public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||
+ // CraftBukkit start
|
||||
+ this.setSlot(enumitemslot, itemstack, false);
|
||||
+ this.setItemSlot(enumitemslot, itemstack, false);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack, boolean silent) {
|
||||
+ public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack, boolean silent) {
|
||||
+ // CraftBukkit end
|
||||
this.f(itemstack);
|
||||
switch (enumitemslot.a()) {
|
||||
this.verifyEquippedItem(itemstack);
|
||||
switch (enumitemslot.getType()) {
|
||||
case HAND:
|
||||
- this.playEquipSound(itemstack);
|
||||
+ this.playEquipSound(itemstack, silent); // CraftBukkit
|
||||
this.handItems.set(enumitemslot.b(), itemstack);
|
||||
- this.equipEventAndSound(itemstack);
|
||||
+ this.equipEventAndSound(itemstack, silent); // CraftBukkit
|
||||
this.handItems.set(enumitemslot.getIndex(), itemstack);
|
||||
break;
|
||||
case ARMOR:
|
||||
- this.playEquipSound(itemstack);
|
||||
+ this.playEquipSound(itemstack, silent); // CraftBukkit
|
||||
this.armorItems.set(enumitemslot.b(), itemstack);
|
||||
- this.equipEventAndSound(itemstack);
|
||||
+ this.equipEventAndSound(itemstack, silent); // CraftBukkit
|
||||
this.armorItems.set(enumitemslot.getIndex(), itemstack);
|
||||
}
|
||||
|
||||
@@ -405,6 +428,21 @@
|
||||
@@ -404,6 +427,21 @@
|
||||
return false;
|
||||
} else {
|
||||
ItemStack itemstack2;
|
||||
@@ -75,9 +75,9 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (entityhuman.getAbilities().instabuild && itemstack1.isEmpty() && !itemstack.isEmpty()) {
|
||||
itemstack2 = itemstack.cloneItemStack();
|
||||
@@ -433,9 +471,19 @@
|
||||
public boolean damageEntity(DamageSource damagesource, float f) {
|
||||
itemstack2 = itemstack.copy();
|
||||
@@ -432,9 +470,19 @@
|
||||
public boolean hurt(DamageSource damagesource, float f) {
|
||||
if (!this.level.isClientSide && !this.isRemoved()) {
|
||||
if (DamageSource.OUT_OF_WORLD.equals(damagesource)) {
|
||||
+ // CraftBukkit start
|
||||
@@ -85,79 +85,79 @@
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.killEntity();
|
||||
this.kill();
|
||||
return false;
|
||||
- } else if (!this.isInvulnerable(damagesource) && !this.invisible && !this.isMarker()) {
|
||||
+ } else if (!this.isInvulnerable(damagesource) && (true || !this.invisible) && !this.isMarker()) { // CraftBukkit
|
||||
- } else if (!this.isInvulnerableTo(damagesource) && !this.invisible && !this.isMarker()) {
|
||||
+ } else if (!this.isInvulnerableTo(damagesource) && (true || !this.invisible) && !this.isMarker()) { // CraftBukkit
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, true, this.invisible)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (damagesource.isExplosion()) {
|
||||
this.h(damagesource);
|
||||
this.killEntity();
|
||||
@@ -475,7 +523,7 @@
|
||||
this.brokenByAnything(damagesource);
|
||||
this.kill();
|
||||
@@ -474,7 +522,7 @@
|
||||
} else {
|
||||
this.g(damagesource);
|
||||
this.G();
|
||||
- this.killEntity();
|
||||
+ this.die(); // CraftBukkit - SPIGOT-4890: remain as this.die() since above damagesource method will call death event
|
||||
this.brokenByPlayer(damagesource);
|
||||
this.showBreakingParticles();
|
||||
- this.kill();
|
||||
+ this.discard(); // CraftBukkit - SPIGOT-4890: remain as this.die() since above damagesource method will call death event
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -536,13 +584,13 @@
|
||||
@@ -535,13 +583,13 @@
|
||||
}
|
||||
|
||||
private void g(DamageSource damagesource) {
|
||||
- Block.a(this.level, this.getChunkCoordinates(), new ItemStack(Items.ARMOR_STAND));
|
||||
private void brokenByPlayer(DamageSource damagesource) {
|
||||
- Block.popResource(this.level, this.blockPosition(), new ItemStack(Items.ARMOR_STAND));
|
||||
+ drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(new ItemStack(Items.ARMOR_STAND))); // CraftBukkit - add to drops
|
||||
this.h(damagesource);
|
||||
this.brokenByAnything(damagesource);
|
||||
}
|
||||
|
||||
private void h(DamageSource damagesource) {
|
||||
this.H();
|
||||
- this.f(damagesource);
|
||||
+ // this.f(damagesource); // CraftBukkit - moved down
|
||||
private void brokenByAnything(DamageSource damagesource) {
|
||||
this.playBrokenSound();
|
||||
- this.dropAllDeathLoot(damagesource);
|
||||
+ // this.dropAllDeathLoot(damagesource); // CraftBukkit - moved down
|
||||
|
||||
ItemStack itemstack;
|
||||
int i;
|
||||
@@ -550,7 +598,7 @@
|
||||
@@ -549,7 +597,7 @@
|
||||
for (i = 0; i < this.handItems.size(); ++i) {
|
||||
itemstack = (ItemStack) this.handItems.get(i);
|
||||
if (!itemstack.isEmpty()) {
|
||||
- Block.a(this.level, this.getChunkCoordinates().up(), itemstack);
|
||||
- Block.popResource(this.level, this.blockPosition().above(), itemstack);
|
||||
+ drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
|
||||
this.handItems.set(i, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
@@ -558,10 +606,11 @@
|
||||
@@ -557,10 +605,11 @@
|
||||
for (i = 0; i < this.armorItems.size(); ++i) {
|
||||
itemstack = (ItemStack) this.armorItems.get(i);
|
||||
if (!itemstack.isEmpty()) {
|
||||
- Block.a(this.level, this.getChunkCoordinates().up(), itemstack);
|
||||
- Block.popResource(this.level, this.blockPosition().above(), itemstack);
|
||||
+ drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
|
||||
this.armorItems.set(i, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
+ this.f(damagesource); // CraftBukkit - moved from above
|
||||
+ this.dropAllDeathLoot(damagesource); // CraftBukkit - moved from above
|
||||
|
||||
}
|
||||
|
||||
@@ -662,8 +711,16 @@
|
||||
@@ -661,8 +710,16 @@
|
||||
return this.isSmall();
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ protected boolean isDropExperience() {
|
||||
+ protected boolean shouldDropExperience() {
|
||||
+ return true; // MC-157395, SPIGOT-5193 even baby (small) armor stands should drop
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
public void killEntity() {
|
||||
public void kill() {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, drops); // CraftBukkit - call event
|
||||
this.a(Entity.RemovalReason.KILLED);
|
||||
this.remove(Entity.RemovalReason.KILLED);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
protected static final Predicate<Entity> HANGING_ENTITY = (entity) -> {
|
||||
@@ -57,26 +65,37 @@
|
||||
|
||||
protected void updateBoundingBox() {
|
||||
protected void recalculateBoundingBox() {
|
||||
if (this.direction != null) {
|
||||
- double d0 = (double) this.pos.getX() + 0.5D;
|
||||
- double d1 = (double) this.pos.getY() + 0.5D;
|
||||
- double d2 = (double) this.pos.getZ() + 0.5D;
|
||||
+ // CraftBukkit start code moved in to calculateBoundingBox
|
||||
+ this.a(calculateBoundingBox(this, this.pos, this.direction, this.getHangingWidth(), this.getHangingHeight()));
|
||||
+ this.setBoundingBox(calculateBoundingBox(this, this.pos, this.direction, this.getWidth(), this.getHeight()));
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+ }
|
||||
@@ -35,34 +35,34 @@
|
||||
+ double d1 = (double) blockPosition.getY() + 0.5D;
|
||||
+ double d2 = (double) blockPosition.getZ() + 0.5D;
|
||||
double d3 = 0.46875D;
|
||||
- double d4 = this.a(this.getHangingWidth());
|
||||
- double d5 = this.a(this.getHangingHeight());
|
||||
+ double d4 = a(width);
|
||||
+ double d5 = a(height);
|
||||
- double d4 = this.offs(this.getWidth());
|
||||
- double d5 = this.offs(this.getHeight());
|
||||
+ double d4 = offs(width);
|
||||
+ double d5 = offs(height);
|
||||
|
||||
- d0 -= (double) this.direction.getAdjacentX() * 0.46875D;
|
||||
- d2 -= (double) this.direction.getAdjacentZ() * 0.46875D;
|
||||
+ d0 -= (double) direction.getAdjacentX() * 0.46875D;
|
||||
+ d2 -= (double) direction.getAdjacentZ() * 0.46875D;
|
||||
- d0 -= (double) this.direction.getStepX() * 0.46875D;
|
||||
- d2 -= (double) this.direction.getStepZ() * 0.46875D;
|
||||
+ d0 -= (double) direction.getStepX() * 0.46875D;
|
||||
+ d2 -= (double) direction.getStepZ() * 0.46875D;
|
||||
d1 += d5;
|
||||
- EnumDirection enumdirection = this.direction.h();
|
||||
+ EnumDirection enumdirection = direction.h();
|
||||
- EnumDirection enumdirection = this.direction.getCounterClockWise();
|
||||
+ EnumDirection enumdirection = direction.getCounterClockWise();
|
||||
|
||||
d0 += d4 * (double) enumdirection.getAdjacentX();
|
||||
d2 += d4 * (double) enumdirection.getAdjacentZ();
|
||||
- this.setPositionRaw(d0, d1, d2);
|
||||
- double d6 = (double) this.getHangingWidth();
|
||||
- double d7 = (double) this.getHangingHeight();
|
||||
- double d8 = (double) this.getHangingWidth();
|
||||
d0 += d4 * (double) enumdirection.getStepX();
|
||||
d2 += d4 * (double) enumdirection.getStepZ();
|
||||
- this.setPosRaw(d0, d1, d2);
|
||||
- double d6 = (double) this.getWidth();
|
||||
- double d7 = (double) this.getHeight();
|
||||
- double d8 = (double) this.getWidth();
|
||||
+ if (entity != null) {
|
||||
+ entity.setPositionRaw(d0, d1, d2);
|
||||
+ entity.setPosRaw(d0, d1, d2);
|
||||
+ }
|
||||
+ double d6 = (double) width;
|
||||
+ double d7 = (double) height;
|
||||
+ double d8 = (double) width;
|
||||
|
||||
- if (this.direction.n() == EnumDirection.EnumAxis.Z) {
|
||||
+ if (direction.n() == EnumDirection.EnumAxis.Z) {
|
||||
- if (this.direction.getAxis() == EnumDirection.EnumAxis.Z) {
|
||||
+ if (direction.getAxis() == EnumDirection.EnumAxis.Z) {
|
||||
d8 = 1.0D;
|
||||
} else {
|
||||
d6 = 1.0D;
|
||||
@@ -70,14 +70,14 @@
|
||||
d6 /= 32.0D;
|
||||
d7 /= 32.0D;
|
||||
d8 /= 32.0D;
|
||||
- this.a(new AxisAlignedBB(d0 - d6, d1 - d7, d2 - d8, d0 + d6, d1 + d7, d2 + d8));
|
||||
- this.setBoundingBox(new AxisAlignedBB(d0 - d6, d1 - d7, d2 - d8, d0 + d6, d1 + d7, d2 + d8));
|
||||
+ return new AxisAlignedBB(d0 - d6, d1 - d7, d2 - d8, d0 + d6, d1 + d7, d2 + d8);
|
||||
}
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
- private double a(int i) {
|
||||
+ private static double a(int i) { // CraftBukkit - static
|
||||
- private double offs(int i) {
|
||||
+ private static double offs(int i) { // CraftBukkit - static
|
||||
return i % 32 == 0 ? 0.5D : 0.0D;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
this.checkInterval = 0;
|
||||
if (!this.isRemoved() && !this.survives()) {
|
||||
+ // CraftBukkit start - fire break events
|
||||
+ Material material = this.level.getType(this.getChunkCoordinates()).getMaterial();
|
||||
+ Material material = this.level.getBlockState(this.blockPosition()).getMaterial();
|
||||
+ HangingBreakEvent.RemoveCause cause;
|
||||
+
|
||||
+ if (!material.equals(Material.AIR)) {
|
||||
@@ -103,8 +103,8 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.die();
|
||||
this.a((Entity) null);
|
||||
this.discard();
|
||||
this.dropItem((Entity) null);
|
||||
}
|
||||
@@ -163,6 +201,22 @@
|
||||
return false;
|
||||
@@ -126,13 +126,13 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.killEntity();
|
||||
this.velocityChanged();
|
||||
this.a(damagesource.getEntity());
|
||||
this.kill();
|
||||
this.markHurt();
|
||||
this.dropItem(damagesource.getEntity());
|
||||
@@ -175,6 +229,18 @@
|
||||
@Override
|
||||
public void move(EnumMoveType enummovetype, Vec3D vec3d) {
|
||||
if (!this.level.isClientSide && !this.isRemoved() && vec3d.g() > 0.0D) {
|
||||
if (!this.level.isClientSide && !this.isRemoved() && vec3d.lengthSqr() > 0.0D) {
|
||||
+ if (this.isRemoved()) return; // CraftBukkit
|
||||
+
|
||||
+ // CraftBukkit start - fire break events
|
||||
@@ -145,15 +145,15 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.killEntity();
|
||||
this.a((Entity) null);
|
||||
this.kill();
|
||||
this.dropItem((Entity) null);
|
||||
}
|
||||
@@ -183,7 +249,7 @@
|
||||
|
||||
@Override
|
||||
public void i(double d0, double d1, double d2) {
|
||||
public void push(double d0, double d1, double d2) {
|
||||
- if (!this.level.isClientSide && !this.isRemoved() && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
|
||||
+ if (false && !this.level.isClientSide && !this.isRemoved() && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { // CraftBukkit - not needed
|
||||
this.killEntity();
|
||||
this.a((Entity) null);
|
||||
this.kill();
|
||||
this.dropItem((Entity) null);
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
+++ b/net/minecraft/world/entity/decoration/EntityItemFrame.java
|
||||
@@ -91,16 +91,27 @@
|
||||
@Override
|
||||
protected void updateBoundingBox() {
|
||||
protected void recalculateBoundingBox() {
|
||||
if (this.direction != null) {
|
||||
+ // CraftBukkit start code moved in to calculateBoundingBox
|
||||
+ this.a(calculateBoundingBox(this, this.pos, this.direction, this.getHangingWidth(), this.getHangingHeight()));
|
||||
+ this.setBoundingBox(calculateBoundingBox(this, this.pos, this.direction, this.getWidth(), this.getHeight()));
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+ }
|
||||
@@ -14,26 +14,26 @@
|
||||
+ public static AxisAlignedBB calculateBoundingBox(@Nullable Entity entity, BlockPosition blockPosition, EnumDirection direction, int width, int height) {
|
||||
+ {
|
||||
double d0 = 0.46875D;
|
||||
- double d1 = (double) this.pos.getX() + 0.5D - (double) this.direction.getAdjacentX() * 0.46875D;
|
||||
- double d2 = (double) this.pos.getY() + 0.5D - (double) this.direction.getAdjacentY() * 0.46875D;
|
||||
- double d3 = (double) this.pos.getZ() + 0.5D - (double) this.direction.getAdjacentZ() * 0.46875D;
|
||||
- double d1 = (double) this.pos.getX() + 0.5D - (double) this.direction.getStepX() * 0.46875D;
|
||||
- double d2 = (double) this.pos.getY() + 0.5D - (double) this.direction.getStepY() * 0.46875D;
|
||||
- double d3 = (double) this.pos.getZ() + 0.5D - (double) this.direction.getStepZ() * 0.46875D;
|
||||
-
|
||||
- this.setPositionRaw(d1, d2, d3);
|
||||
- double d4 = (double) this.getHangingWidth();
|
||||
- double d5 = (double) this.getHangingHeight();
|
||||
- double d6 = (double) this.getHangingWidth();
|
||||
- EnumDirection.EnumAxis enumdirection_enumaxis = this.direction.n();
|
||||
+ double d1 = (double) blockPosition.getX() + 0.5D - (double) direction.getAdjacentX() * 0.46875D;
|
||||
+ double d2 = (double) blockPosition.getY() + 0.5D - (double) direction.getAdjacentY() * 0.46875D;
|
||||
+ double d3 = (double) blockPosition.getZ() + 0.5D - (double) direction.getAdjacentZ() * 0.46875D;
|
||||
- this.setPosRaw(d1, d2, d3);
|
||||
- double d4 = (double) this.getWidth();
|
||||
- double d5 = (double) this.getHeight();
|
||||
- double d6 = (double) this.getWidth();
|
||||
- EnumDirection.EnumAxis enumdirection_enumaxis = this.direction.getAxis();
|
||||
+ double d1 = (double) blockPosition.getX() + 0.5D - (double) direction.getStepX() * 0.46875D;
|
||||
+ double d2 = (double) blockPosition.getY() + 0.5D - (double) direction.getStepY() * 0.46875D;
|
||||
+ double d3 = (double) blockPosition.getZ() + 0.5D - (double) direction.getStepZ() * 0.46875D;
|
||||
+
|
||||
+ if (entity != null) {
|
||||
+ entity.setPositionRaw(d1, d2, d3);
|
||||
+ entity.setPosRaw(d1, d2, d3);
|
||||
+ }
|
||||
+ double d4 = (double) width;
|
||||
+ double d5 = (double) height;
|
||||
+ double d6 = (double) width;
|
||||
+ EnumDirection.EnumAxis enumdirection_enumaxis = direction.n();
|
||||
+ EnumDirection.EnumAxis enumdirection_enumaxis = direction.getAxis();
|
||||
|
||||
switch (enumdirection_enumaxis) {
|
||||
case X:
|
||||
@@ -41,7 +41,7 @@
|
||||
d4 /= 32.0D;
|
||||
d5 /= 32.0D;
|
||||
d6 /= 32.0D;
|
||||
- this.a(new AxisAlignedBB(d1 - d4, d2 - d5, d3 - d6, d1 + d4, d2 + d5, d3 + d6));
|
||||
- this.setBoundingBox(new AxisAlignedBB(d1 - d4, d2 - d5, d3 - d6, d1 + d4, d2 + d5, d3 + d6));
|
||||
+ return new AxisAlignedBB(d1 - d4, d2 - d5, d3 - d6, d1 + d4, d2 + d5, d3 + d6);
|
||||
}
|
||||
}
|
||||
@@ -58,8 +58,8 @@
|
||||
+ return true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.b(damagesource.getEntity(), false);
|
||||
this.playSound(this.h(), 1.0F, 1.0F);
|
||||
this.dropItem(damagesource.getEntity(), false);
|
||||
this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F);
|
||||
}
|
||||
@@ -277,6 +294,12 @@
|
||||
}
|
||||
@@ -72,14 +72,14 @@
|
||||
+ public void setItem(ItemStack itemstack, boolean flag, boolean playSound) {
|
||||
+ // CraftBukkit end
|
||||
if (!itemstack.isEmpty()) {
|
||||
itemstack = itemstack.cloneItemStack();
|
||||
itemstack = itemstack.copy();
|
||||
itemstack.setCount(1);
|
||||
@@ -284,7 +307,7 @@
|
||||
}
|
||||
|
||||
this.getDataWatcher().set(EntityItemFrame.DATA_ITEM, itemstack);
|
||||
this.getEntityData().set(EntityItemFrame.DATA_ITEM, itemstack);
|
||||
- if (!itemstack.isEmpty()) {
|
||||
+ if (!itemstack.isEmpty() && playSound) { // CraftBukkit
|
||||
this.playSound(this.l(), 1.0F, 1.0F);
|
||||
this.playSound(this.getAddItemSound(), 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,20 +19,20 @@
|
||||
if (entityinsentient.getLeashHolder() == entityhuman) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callPlayerLeashEntityEvent(entityinsentient, this, entityhuman).isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutAttachEntity(entityinsentient, entityinsentient.getLeashHolder()));
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutAttachEntity(entityinsentient, entityinsentient.getLeashHolder()));
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entityinsentient.setLeashHolder(this, true);
|
||||
entityinsentient.setLeashedTo(this, true);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag) {
|
||||
- this.die();
|
||||
- this.discard();
|
||||
- if (entityhuman.getAbilities().instabuild) {
|
||||
+ // CraftBukkit start - Move below
|
||||
+ // this.die();
|
||||
+ // this.discard();
|
||||
+ boolean die = true;
|
||||
+ // CraftBukkit end
|
||||
+ if (true || entityhuman.getAbilities().instabuild) { // CraftBukkit - Process for non-creative as well
|
||||
@@ -41,19 +41,19 @@
|
||||
while (iterator.hasNext()) {
|
||||
entityinsentient = (EntityInsentient) iterator.next();
|
||||
if (entityinsentient.isLeashed() && entityinsentient.getLeashHolder() == this) {
|
||||
- entityinsentient.unleash(true, false);
|
||||
- entityinsentient.dropLeash(true, false);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient, entityhuman).isCancelled()) {
|
||||
+ die = false;
|
||||
+ continue;
|
||||
+ }
|
||||
+ entityinsentient.unleash(true, !entityhuman.getAbilities().instabuild); // false -> survival mode boolean
|
||||
+ entityinsentient.dropLeash(true, !entityhuman.getAbilities().instabuild); // false -> survival mode boolean
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ if (die) {
|
||||
+ this.die();
|
||||
+ this.discard();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/decoration/EntityPainting.java
|
||||
+++ b/net/minecraft/world/entity/decoration/EntityPainting.java
|
||||
@@ -27,6 +27,10 @@
|
||||
|
||||
public EntityPainting(EntityTypes<? extends EntityPainting> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
+ // CraftBukkit start - generate a non-null painting
|
||||
+ List<Paintings> list = Lists.newArrayList(Paintings.KEBAB);
|
||||
+ this.motive = (Paintings) list.get(this.random.nextInt(list.size()));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public EntityPainting(World world, BlockPosition blockposition, EnumDirection enumdirection) {
|
||||
@@ -8,30 +8,30 @@
|
||||
+
|
||||
public class EntityFallingBlock extends Entity {
|
||||
|
||||
private IBlockData blockState;
|
||||
@@ -114,7 +116,7 @@
|
||||
private static final int REMOVAL_DELAY_MILLIS = 50;
|
||||
@@ -122,7 +124,7 @@
|
||||
|
||||
if (this.time++ == 0) {
|
||||
blockposition = this.getChunkCoordinates();
|
||||
- if (this.level.getType(blockposition).a(block)) {
|
||||
+ if (this.level.getType(blockposition).a(block) && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
this.level.a(blockposition, false);
|
||||
blockposition = this.blockPosition();
|
||||
- if (this.level.getBlockState(blockposition).is(block)) {
|
||||
+ if (this.level.getBlockState(blockposition).is(block) && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
|
||||
this.level.removeBlock(blockposition, false);
|
||||
} else if (!this.level.isClientSide) {
|
||||
this.die();
|
||||
@@ -165,6 +167,12 @@
|
||||
this.blockState = (IBlockData) this.blockState.set(BlockProperties.WATERLOGGED, true);
|
||||
this.discard();
|
||||
@@ -173,6 +175,12 @@
|
||||
this.blockState = (IBlockData) this.blockState.setValue(BlockProperties.WATERLOGGED, true);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, this.blockState).isCancelled()) {
|
||||
+ this.die(); // SPIGOT-6586 called before the event in previous versions
|
||||
+ this.discard(); // SPIGOT-6586 called before the event in previous versions
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (this.level.setTypeAndData(blockposition, this.blockState, 3)) {
|
||||
((WorldServer) this.level).getChunkProvider().chunkMap.broadcast(this, new PacketPlayOutBlockChange(blockposition, this.level.getType(blockposition)));
|
||||
this.die();
|
||||
@@ -238,7 +246,7 @@
|
||||
if (this.level.setBlock(blockposition, this.blockState, 3)) {
|
||||
((WorldServer) this.level).getChunkSource().chunkMap.broadcast(this, new PacketPlayOutBlockChange(blockposition, this.level.getBlockState(blockposition)));
|
||||
this.discard();
|
||||
@@ -252,7 +260,7 @@
|
||||
if (i < 0) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -40,13 +40,13 @@
|
||||
DamageSource damagesource1;
|
||||
|
||||
if (this.blockState.getBlock() instanceof Fallable) {
|
||||
@@ -254,7 +262,9 @@
|
||||
float f2 = (float) Math.min(MathHelper.d((float) i * this.fallDamagePerDistance), this.fallDamageMax);
|
||||
@@ -268,7 +276,9 @@
|
||||
float f2 = (float) Math.min(MathHelper.floor((float) i * this.fallDamagePerDistance), this.fallDamageMax);
|
||||
|
||||
this.level.getEntities(this, this.getBoundingBox(), predicate).forEach((entity) -> {
|
||||
this.level.getEntities((Entity) this, this.getBoundingBox(), predicate).forEach((entity) -> {
|
||||
+ CraftEventFactory.entityDamage = this; // CraftBukkit
|
||||
entity.damageEntity(damagesource1, f2);
|
||||
entity.hurt(damagesource1, f2);
|
||||
+ CraftEventFactory.entityDamage = null; // CraftBukkit
|
||||
});
|
||||
boolean flag = this.blockState.a((Tag) TagsBlock.ANVIL);
|
||||
boolean flag = this.blockState.is((Tag) TagsBlock.ANVIL);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/item/EntityItem.java
|
||||
+++ b/net/minecraft/world/entity/item/EntityItem.java
|
||||
@@ -33,6 +33,12 @@
|
||||
@@ -32,6 +32,12 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -12,17 +12,17 @@
|
||||
+
|
||||
public class EntityItem extends Entity {
|
||||
|
||||
private static final DataWatcherObject<ItemStack> DATA_ITEM = DataWatcher.a(EntityItem.class, DataWatcherRegistry.ITEM_STACK);
|
||||
@@ -45,6 +51,7 @@
|
||||
private UUID thrower;
|
||||
private static final DataWatcherObject<ItemStack> DATA_ITEM = DataWatcher.defineId(EntityItem.class, DataWatcherRegistry.ITEM_STACK);
|
||||
@@ -46,6 +52,7 @@
|
||||
@Nullable
|
||||
private UUID owner;
|
||||
public final float bobOffs;
|
||||
+ private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit
|
||||
|
||||
public EntityItem(EntityTypes<? extends EntityItem> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -94,9 +101,12 @@
|
||||
this.die();
|
||||
@@ -95,9 +102,12 @@
|
||||
this.discard();
|
||||
} else {
|
||||
super.tick();
|
||||
- if (this.pickupDelay > 0 && this.pickupDelay != 32767) {
|
||||
@@ -35,10 +35,10 @@
|
||||
+ this.lastTick = MinecraftServer.currentTick;
|
||||
+ // CraftBukkit end
|
||||
|
||||
this.xo = this.locX();
|
||||
this.yo = this.locY();
|
||||
@@ -148,9 +158,11 @@
|
||||
this.mergeNearby();
|
||||
this.xo = this.getX();
|
||||
this.yo = this.getY();
|
||||
@@ -147,9 +157,11 @@
|
||||
this.mergeWithNeighbours();
|
||||
}
|
||||
|
||||
+ /* CraftBukkit start - moved up
|
||||
@@ -47,9 +47,9 @@
|
||||
}
|
||||
+ // CraftBukkit end */
|
||||
|
||||
this.hasImpulse |= this.aR();
|
||||
this.hasImpulse |= this.updateInWaterStateAndDoFluidPushing();
|
||||
if (!this.level.isClientSide) {
|
||||
@@ -162,6 +174,12 @@
|
||||
@@ -161,6 +173,12 @@
|
||||
}
|
||||
|
||||
if (!this.level.isClientSide && this.age >= 6000) {
|
||||
@@ -59,24 +59,24 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.die();
|
||||
this.discard();
|
||||
}
|
||||
|
||||
@@ -237,10 +255,11 @@
|
||||
private static void a(EntityItem entityitem, ItemStack itemstack, ItemStack itemstack1) {
|
||||
ItemStack itemstack2 = a(itemstack, itemstack1, 64);
|
||||
@@ -236,10 +254,11 @@
|
||||
private static void merge(EntityItem entityitem, ItemStack itemstack, ItemStack itemstack1) {
|
||||
ItemStack itemstack2 = merge(itemstack, itemstack1, 64);
|
||||
|
||||
- entityitem.setItemStack(itemstack2);
|
||||
+ if (!itemstack2.isEmpty()) entityitem.setItemStack(itemstack2); // CraftBukkit - don't set empty stacks
|
||||
- entityitem.setItem(itemstack2);
|
||||
+ if (!itemstack2.isEmpty()) entityitem.setItem(itemstack2); // CraftBukkit - don't set empty stacks
|
||||
}
|
||||
|
||||
private static void a(EntityItem entityitem, ItemStack itemstack, EntityItem entityitem1, ItemStack itemstack1) {
|
||||
private static void merge(EntityItem entityitem, ItemStack itemstack, EntityItem entityitem1, ItemStack itemstack1) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemMergeEvent(entityitem1, entityitem).isCancelled()) return; // CraftBukkit
|
||||
a(entityitem, itemstack, itemstack1);
|
||||
merge(entityitem, itemstack, itemstack1);
|
||||
entityitem.pickupDelay = Math.max(entityitem.pickupDelay, entityitem1.pickupDelay);
|
||||
entityitem.age = Math.min(entityitem.age, entityitem1.age);
|
||||
@@ -264,6 +283,11 @@
|
||||
} else if (!this.getItemStack().getItem().a(damagesource)) {
|
||||
@@ -263,6 +282,11 @@
|
||||
} else if (!this.getItem().getItem().canBeHurtBy(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
@@ -84,10 +84,10 @@
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.velocityChanged();
|
||||
this.markHurt();
|
||||
this.health = (int) ((float) this.health - f);
|
||||
this.a(GameEvent.ENTITY_DAMAGED, damagesource.getEntity());
|
||||
@@ -327,6 +351,46 @@
|
||||
this.gameEvent(GameEvent.ENTITY_DAMAGED, damagesource.getEntity());
|
||||
@@ -326,6 +350,46 @@
|
||||
Item item = itemstack.getItem();
|
||||
int i = itemstack.getCount();
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
+ }
|
||||
+
|
||||
+ // Update the ItemStack if it was changed in the event
|
||||
+ ItemStack current = this.getItemStack();
|
||||
+ ItemStack current = this.getItem();
|
||||
+ if (!itemstack.equals(current)) {
|
||||
+ itemstack = current;
|
||||
+ } else {
|
||||
@@ -131,16 +131,16 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.pickupDelay == 0 && (this.owner == null || this.owner.equals(entityhuman.getUniqueID())) && entityhuman.getInventory().pickup(itemstack)) {
|
||||
entityhuman.receive(this, i);
|
||||
if (this.pickupDelay == 0 && (this.owner == null || this.owner.equals(entityhuman.getUUID())) && entityhuman.getInventory().add(itemstack)) {
|
||||
entityhuman.take(this, i);
|
||||
if (itemstack.isEmpty()) {
|
||||
@@ -370,7 +434,9 @@
|
||||
@@ -369,7 +433,9 @@
|
||||
}
|
||||
|
||||
public void setItemStack(ItemStack itemstack) {
|
||||
public void setItem(ItemStack itemstack) {
|
||||
+ com.google.common.base.Preconditions.checkArgument(!itemstack.isEmpty(), "Cannot drop air"); // CraftBukkit
|
||||
this.getDataWatcher().set(EntityItem.DATA_ITEM, itemstack);
|
||||
+ this.getDataWatcher().markDirty(EntityItem.DATA_ITEM); // CraftBukkit - SPIGOT-4591, must mark dirty
|
||||
this.getEntityData().set(EntityItem.DATA_ITEM, itemstack);
|
||||
+ this.getEntityData().markDirty(EntityItem.DATA_ITEM); // CraftBukkit - SPIGOT-4591, must mark dirty
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
+
|
||||
public class EntityTNTPrimed extends Entity {
|
||||
|
||||
private static final DataWatcherObject<Integer> DATA_FUSE_ID = DataWatcher.a(EntityTNTPrimed.class, DataWatcherRegistry.INT);
|
||||
private static final DataWatcherObject<Integer> DATA_FUSE_ID = DataWatcher.defineId(EntityTNTPrimed.class, DataWatcherRegistry.INT);
|
||||
private static final int DEFAULT_FUSE_TIME = 80;
|
||||
@Nullable
|
||||
public EntityLiving owner;
|
||||
@@ -19,18 +19,18 @@
|
||||
super(entitytypes, world);
|
||||
@@ -73,10 +77,13 @@
|
||||
|
||||
this.setFuseTicks(i);
|
||||
this.setFuse(i);
|
||||
if (i <= 0) {
|
||||
- this.die();
|
||||
- this.discard();
|
||||
+ // CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event
|
||||
+ // this.die();
|
||||
+ // this.discard();
|
||||
if (!this.level.isClientSide) {
|
||||
this.explode();
|
||||
}
|
||||
+ this.die();
|
||||
+ this.discard();
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
this.aR();
|
||||
this.updateInWaterStateAndDoFluidPushing();
|
||||
if (this.level.isClientSide) {
|
||||
@@ -87,9 +94,16 @@
|
||||
}
|
||||
@@ -40,12 +40,12 @@
|
||||
+ // CraftBukkit start
|
||||
+ // float f = 4.0F;
|
||||
|
||||
- this.level.explode(this, this.locX(), this.e(0.0625D), this.locZ(), 4.0F, Explosion.Effect.BREAK);
|
||||
- this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 4.0F, Explosion.Effect.BREAK);
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity());
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.level.createExplosion(this, this.locX(), this.e(0.0625D), this.locZ(), event.getRadius(), event.getFire(), Explosion.Effect.BREAK);
|
||||
+ this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), Explosion.Effect.BREAK);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
+
|
||||
public class EntityCreeper extends EntityMonster implements PowerableMob {
|
||||
|
||||
private static final DataWatcherObject<Integer> DATA_SWELL_DIR = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.INT);
|
||||
private static final DataWatcherObject<Integer> DATA_SWELL_DIR = DataWatcher.defineId(EntityCreeper.class, DataWatcherRegistry.INT);
|
||||
@@ -219,9 +225,19 @@
|
||||
@Override
|
||||
public void onLightningStrike(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
super.onLightningStrike(worldserver, entitylightning);
|
||||
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
super.thunderHit(worldserver, entitylightning);
|
||||
- this.entityData.set(EntityCreeper.DATA_IS_POWERED, true);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callCreeperPowerEvent(this, entitylightning, org.bukkit.event.entity.CreeperPowerEvent.PowerCause.LIGHTNING).isCancelled()) {
|
||||
@@ -32,24 +32,24 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
protected EnumInteractionResult b(EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
protected EnumInteractionResult mobInteract(EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
@@ -246,10 +262,18 @@
|
||||
Explosion.Effect explosion_effect = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
|
||||
float f = this.isPowered() ? 2.0F : 1.0F;
|
||||
|
||||
- this.dead = true;
|
||||
- this.level.explode(this, this.locX(), this.locY(), this.locZ(), (float) this.explosionRadius * f, explosion_effect);
|
||||
- this.die();
|
||||
- this.createEffectCloud();
|
||||
- this.level.explode(this, this.getX(), this.getY(), this.getZ(), (float) this.explosionRadius * f, explosion_effect);
|
||||
- this.discard();
|
||||
- this.spawnLingeringCloud();
|
||||
+ // CraftBukkit start
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.dead = true;
|
||||
+ this.level.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), explosion_effect);
|
||||
+ this.die();
|
||||
+ this.createEffectCloud();
|
||||
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), explosion_effect);
|
||||
+ this.discard();
|
||||
+ this.spawnLingeringCloud();
|
||||
+ } else {
|
||||
+ swell = 0;
|
||||
+ }
|
||||
@@ -59,9 +59,9 @@
|
||||
}
|
||||
@@ -260,6 +284,7 @@
|
||||
if (!collection.isEmpty()) {
|
||||
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.level, this.locX(), this.locY(), this.locZ());
|
||||
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.level, this.getX(), this.getY(), this.getZ());
|
||||
|
||||
+ entityareaeffectcloud.setSource(this); // CraftBukkit
|
||||
+ entityareaeffectcloud.setOwner(this); // CraftBukkit
|
||||
entityareaeffectcloud.setRadius(2.5F);
|
||||
entityareaeffectcloud.setRadiusOnUse(-0.5F);
|
||||
entityareaeffectcloud.setWaitTime(10);
|
||||
@@ -69,8 +69,8 @@
|
||||
entityareaeffectcloud.addEffect(new MobEffect(mobeffect));
|
||||
}
|
||||
|
||||
- this.level.addEntity(entityareaeffectcloud);
|
||||
+ this.level.addEntity(entityareaeffectcloud, CreatureSpawnEvent.SpawnReason.EXPLOSION); // CraftBukkit
|
||||
- this.level.addFreshEntity(entityareaeffectcloud);
|
||||
+ this.level.addFreshEntity(entityareaeffectcloud, CreatureSpawnEvent.SpawnReason.EXPLOSION); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityEnderman.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityEnderman.java
|
||||
@@ -105,7 +105,17 @@
|
||||
@@ -110,7 +110,17 @@
|
||||
|
||||
@Override
|
||||
public void setGoalTarget(@Nullable EntityLiving entityliving) {
|
||||
- super.setGoalTarget(entityliving);
|
||||
public void setTarget(@Nullable EntityLiving entityliving) {
|
||||
- super.setTarget(entityliving);
|
||||
+ // CraftBukkit start - fire event
|
||||
+ setGoalTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.UNKNOWN, true);
|
||||
+ setTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.UNKNOWN, true);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) {
|
||||
+ if (!super.setGoalTarget(entityliving, reason, fireEvent)) {
|
||||
+ public boolean setTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) {
|
||||
+ if (!super.setTarget(entityliving, reason, fireEvent)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ entityliving = getGoalTarget();
|
||||
+ entityliving = getTarget();
|
||||
+ // CraftBukkit end
|
||||
AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
AttributeModifiable attributemodifiable = this.getAttribute(GenericAttributes.MOVEMENT_SPEED);
|
||||
|
||||
if (entityliving == null) {
|
||||
@@ -120,6 +130,7 @@
|
||||
attributemodifiable.b(EntityEnderman.SPEED_MODIFIER_ATTACKING);
|
||||
@@ -125,6 +135,7 @@
|
||||
attributemodifiable.addTransientModifier(EntityEnderman.SPEED_MODIFIER_ATTACKING);
|
||||
}
|
||||
}
|
||||
+ return true;
|
||||
|
||||
}
|
||||
|
||||
@@ -446,9 +457,13 @@
|
||||
@@ -471,9 +482,13 @@
|
||||
if (iblockdata2 != null) {
|
||||
iblockdata2 = Block.b(iblockdata2, (GeneratorAccess) this.enderman.level, blockposition);
|
||||
if (this.a(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
|
||||
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level, blockposition);
|
||||
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
|
||||
+ // CraftBukkit start - Place event
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, iblockdata2).isCancelled()) {
|
||||
world.setTypeAndData(blockposition, iblockdata2, 3);
|
||||
world.a((Entity) this.enderman, GameEvent.BLOCK_PLACE, blockposition);
|
||||
this.enderman.setCarried((IBlockData) null);
|
||||
world.setBlock(blockposition, iblockdata2, 3);
|
||||
world.gameEvent(this.enderman, GameEvent.BLOCK_PLACE, blockposition);
|
||||
this.enderman.setCarriedBlock((IBlockData) null);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -487,9 +502,13 @@
|
||||
boolean flag = movingobjectpositionblock.getBlockPosition().equals(blockposition);
|
||||
@@ -512,9 +527,13 @@
|
||||
boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition);
|
||||
|
||||
if (iblockdata.a((Tag) TagsBlock.ENDERMAN_HOLDABLE) && flag) {
|
||||
- world.a(blockposition, false);
|
||||
- world.a((Entity) this.enderman, GameEvent.BLOCK_DESTROY, blockposition);
|
||||
- this.enderman.setCarried(iblockdata.getBlock().getBlockData());
|
||||
if (iblockdata.is((Tag) TagsBlock.ENDERMAN_HOLDABLE) && flag) {
|
||||
- world.removeBlock(blockposition, false);
|
||||
- world.gameEvent(this.enderman, GameEvent.BLOCK_DESTROY, blockposition);
|
||||
- this.enderman.setCarriedBlock(iblockdata.getBlock().defaultBlockState());
|
||||
+ // CraftBukkit start - Pickup event
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ world.a(blockposition, false);
|
||||
+ world.a((Entity) this.enderman, GameEvent.BLOCK_DESTROY, blockposition);
|
||||
+ this.enderman.setCarried(iblockdata.getBlock().getBlockData());
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
|
||||
+ world.removeBlock(blockposition, false);
|
||||
+ world.gameEvent(this.enderman, GameEvent.BLOCK_DESTROY, blockposition);
|
||||
+ this.enderman.setCarriedBlock(iblockdata.getBlock().defaultBlockState());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityGhast.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityGhast.java
|
||||
@@ -318,6 +318,8 @@
|
||||
@@ -330,6 +330,8 @@
|
||||
|
||||
EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.ghast, d2, d3, d4, this.ghast.getPower());
|
||||
EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.ghast, d2, d3, d4, this.ghast.getExplosionPower());
|
||||
|
||||
+ // CraftBukkit - set bukkitYield when setting explosionpower
|
||||
+ entitylargefireball.bukkitYield = entitylargefireball.explosionPower = this.ghast.getPower();
|
||||
entitylargefireball.setPosition(this.ghast.locX() + vec3d.x * 4.0D, this.ghast.e(0.5D) + 0.5D, entitylargefireball.locZ() + vec3d.z * 4.0D);
|
||||
world.addEntity(entitylargefireball);
|
||||
this.chargeTime = -40;
|
||||
+ // CraftBukkit - set bukkitYield when setting explosionpower
|
||||
+ entitylargefireball.bukkitYield = entitylargefireball.explosionPower = this.ghast.getExplosionPower();
|
||||
entitylargefireball.setPos(this.ghast.getX() + vec3d.x * 4.0D, this.ghast.getY(0.5D) + 0.5D, entitylargefireball.getZ() + vec3d.z * 4.0D);
|
||||
world.addFreshEntity(entitylargefireball);
|
||||
this.chargeTime = -40;
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityGuardian.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityGuardian.java
|
||||
@@ -123,7 +123,7 @@
|
||||
return 80;
|
||||
}
|
||||
|
||||
- void a(int i) {
|
||||
+ public void a(int i) { // PAIL package -> public, rename setLaserTarget
|
||||
this.entityData.set(EntityGuardian.DATA_ID_ATTACK_TARGET, i);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
if (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < 2 || entityplayer.getEffect(mobeffectlist).getDuration() < 1200) {
|
||||
entityplayer.connection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.GUARDIAN_ELDER_EFFECT, this.isSilent() ? 0.0F : 1.0F));
|
||||
entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.GUARDIAN_ELDER_EFFECT, this.isSilent() ? 0.0F : 1.0F));
|
||||
- entityplayer.addEffect(new MobEffect(mobeffectlist, 6000, 2), this);
|
||||
+ entityplayer.addEffect(new MobEffect(mobeffectlist, 6000, 2), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -1,29 +1,20 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java
|
||||
@@ -70,7 +70,7 @@
|
||||
this.goalSelector.a(8, new PathfinderGoalRandomStroll(this, 0.6D));
|
||||
this.goalSelector.a(9, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 3.0F, 1.0F));
|
||||
this.goalSelector.a(10, new PathfinderGoalLookAtPlayer(this, EntityInsentient.class, 8.0F));
|
||||
- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a());
|
||||
+ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a(new Class[0])); // CraftBukkit - decompile error
|
||||
this.targetSelector.a(2, (new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)).a(300));
|
||||
this.targetSelector.a(3, (new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)).a(300));
|
||||
this.targetSelector.a(3, (new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, false)).a(300));
|
||||
@@ -228,7 +228,7 @@
|
||||
|
||||
@Override
|
||||
protected void j() {
|
||||
protected void performSpellCasting() {
|
||||
- EntityIllagerIllusioner.this.addEffect(new MobEffect(MobEffects.INVISIBILITY, 1200));
|
||||
+ EntityIllagerIllusioner.this.addEffect(new MobEffect(MobEffects.INVISIBILITY, 1200), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ILLUSION); // CraftBukkit
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -274,7 +274,7 @@
|
||||
@@ -279,7 +279,7 @@
|
||||
|
||||
@Override
|
||||
protected void j() {
|
||||
- EntityIllagerIllusioner.this.getGoalTarget().addEffect(new MobEffect(MobEffects.BLINDNESS, 400), EntityIllagerIllusioner.this);
|
||||
+ EntityIllagerIllusioner.this.getGoalTarget().addEffect(new MobEffect(MobEffects.BLINDNESS, 400), EntityIllagerIllusioner.this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
protected void performSpellCasting() {
|
||||
- EntityIllagerIllusioner.this.getTarget().addEffect(new MobEffect(MobEffects.BLINDNESS, 400), EntityIllagerIllusioner.this);
|
||||
+ EntityIllagerIllusioner.this.getTarget().addEffect(new MobEffect(MobEffects.BLINDNESS, 400), EntityIllagerIllusioner.this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityIllagerWizard.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityIllagerWizard.java
|
||||
@@ -161,6 +161,11 @@
|
||||
public void e() {
|
||||
public void tick() {
|
||||
--this.attackWarmupDelay;
|
||||
if (this.attackWarmupDelay == 0) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleEntitySpellCastEvent(EntityIllagerWizard.this, this.getCastSpell())) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleEntitySpellCastEvent(EntityIllagerWizard.this, this.getSpell())) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.j();
|
||||
EntityIllagerWizard.this.playSound(EntityIllagerWizard.this.getSoundCastSpell(), 1.0F, 1.0F);
|
||||
this.performSpellCasting();
|
||||
EntityIllagerWizard.this.playSound(EntityIllagerWizard.this.getCastingSoundEvent(), 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityPhantom.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityPhantom.java
|
||||
@@ -529,7 +529,7 @@
|
||||
@@ -523,14 +523,14 @@
|
||||
List<EntityHuman> list = EntityPhantom.this.level.getNearbyPlayers(this.attackTargeting, EntityPhantom.this, EntityPhantom.this.getBoundingBox().inflate(16.0D, 64.0D, 16.0D));
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
- list.sort(Comparator.comparing(Entity::getY).reversed());
|
||||
+ list.sort(Comparator.comparing((Entity e) -> { return e.getY(); }).reversed()); // CraftBukkit - decompile error
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
EntityHuman entityhuman = (EntityHuman) iterator.next();
|
||||
|
||||
if (EntityPhantom.this.a((EntityLiving) entityhuman, PathfinderTargetCondition.DEFAULT)) {
|
||||
- EntityPhantom.this.setGoalTarget(entityhuman);
|
||||
+ EntityPhantom.this.setGoalTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason
|
||||
if (EntityPhantom.this.canAttack(entityhuman, PathfinderTargetCondition.DEFAULT)) {
|
||||
- EntityPhantom.this.setTarget(entityhuman);
|
||||
+ EntityPhantom.this.setTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,53 +1,44 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityPigZombie.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityPigZombie.java
|
||||
@@ -71,7 +71,7 @@
|
||||
protected void n() {
|
||||
this.goalSelector.a(2, new PathfinderGoalZombieAttack(this, 1.0D, false));
|
||||
this.goalSelector.a(7, new PathfinderGoalRandomStrollLand(this, 1.0D));
|
||||
- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[0])).a());
|
||||
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this).a(new Class[0])); // CraftBukkit - decompile error
|
||||
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::a_));
|
||||
this.targetSelector.a(3, new PathfinderGoalUniversalAngerReset<>(this, true));
|
||||
}
|
||||
@@ -144,7 +144,7 @@
|
||||
@@ -145,7 +145,7 @@
|
||||
}).filter((entitypigzombie) -> {
|
||||
return !entitypigzombie.p(this.getGoalTarget());
|
||||
return !entitypigzombie.isAlliedTo((Entity) this.getTarget());
|
||||
}).forEach((entitypigzombie) -> {
|
||||
- entitypigzombie.setGoalTarget(this.getGoalTarget());
|
||||
+ entitypigzombie.setGoalTarget(this.getGoalTarget(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit
|
||||
- entitypigzombie.setTarget(this.getTarget());
|
||||
+ entitypigzombie.setTarget(this.getTarget(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit
|
||||
});
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
@@ -154,7 +154,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
- public void setGoalTarget(@Nullable EntityLiving entityliving) {
|
||||
+ public boolean setGoalTarget(@Nullable EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) { // CraftBukkit - signature
|
||||
if (this.getGoalTarget() == null && entityliving != null) {
|
||||
this.playFirstAngerSoundIn = EntityPigZombie.FIRST_ANGER_SOUND_DELAY.a(this.random);
|
||||
this.ticksUntilNextAlert = EntityPigZombie.ALERT_INTERVAL.a(this.random);
|
||||
@@ -163,12 +163,21 @@
|
||||
this.e((EntityHuman) entityliving);
|
||||
- public void setTarget(@Nullable EntityLiving entityliving) {
|
||||
+ public boolean setTarget(@Nullable EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) { // CraftBukkit - signature
|
||||
if (this.getTarget() == null && entityliving != null) {
|
||||
this.playFirstAngerSoundIn = EntityPigZombie.FIRST_ANGER_SOUND_DELAY.sample(this.random);
|
||||
this.ticksUntilNextAlert = EntityPigZombie.ALERT_INTERVAL.sample(this.random);
|
||||
@@ -164,12 +164,21 @@
|
||||
this.setLastHurtByPlayer((EntityHuman) entityliving);
|
||||
}
|
||||
|
||||
- super.setGoalTarget(entityliving);
|
||||
+ return super.setGoalTarget(entityliving, reason, fireEvent); // CraftBukkit
|
||||
- super.setTarget(entityliving);
|
||||
+ return super.setTarget(entityliving, reason, fireEvent); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void anger() {
|
||||
- this.setAnger(EntityPigZombie.PERSISTENT_ANGER_TIME.a(this.random));
|
||||
public void startPersistentAngerTimer() {
|
||||
- this.setRemainingPersistentAngerTime(EntityPigZombie.PERSISTENT_ANGER_TIME.sample(this.random));
|
||||
+ // CraftBukkit start
|
||||
+ Entity entity = ((WorldServer) this.level).getEntity(getAngerTarget());
|
||||
+ org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entity == null) ? null : entity.getBukkitEntity(), EntityPigZombie.PERSISTENT_ANGER_TIME.a(this.random));
|
||||
+ Entity entity = ((WorldServer) this.level).getEntity(getPersistentAngerTarget());
|
||||
+ org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entity == null) ? null : entity.getBukkitEntity(), EntityPigZombie.PERSISTENT_ANGER_TIME.sample(this.random));
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ this.setAngerTarget(null);
|
||||
+ this.setPersistentAngerTarget(null);
|
||||
+ return;
|
||||
+ }
|
||||
+ this.setAnger(event.getNewAnger());
|
||||
+ this.setRemainingPersistentAngerTime(event.getNewAnger());
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public static boolean b(EntityTypes<EntityPigZombie> entitytypes, GeneratorAccess generatoraccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, Random random) {
|
||||
public static boolean checkZombifiedPiglinSpawnRules(EntityTypes<EntityPigZombie> entitytypes, GeneratorAccess generatoraccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, Random random) {
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityPillager.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityPillager.java
|
||||
@@ -75,7 +75,7 @@
|
||||
this.goalSelector.a(8, new PathfinderGoalRandomStroll(this, 0.6D));
|
||||
this.goalSelector.a(9, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 15.0F, 1.0F));
|
||||
this.goalSelector.a(10, new PathfinderGoalLookAtPlayer(this, EntityInsentient.class, 15.0F));
|
||||
- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a());
|
||||
+ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a(new Class[0])); // CraftBukkit - decompile error
|
||||
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true));
|
||||
this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false));
|
||||
this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, true));
|
||||
@@ -1,20 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityRavager.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityRavager.java
|
||||
@@ -78,7 +78,7 @@
|
||||
this.goalSelector.a(5, new PathfinderGoalRandomStrollLand(this, 0.4D));
|
||||
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
|
||||
this.goalSelector.a(10, new PathfinderGoalLookAtPlayer(this, EntityInsentient.class, 8.0F));
|
||||
- this.targetSelector.a(2, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a());
|
||||
+ this.targetSelector.a(2, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a(new Class[0])); // CraftBukkit - decompile error
|
||||
this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true));
|
||||
this.targetSelector.a(4, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, true));
|
||||
this.targetSelector.a(4, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, true));
|
||||
@@ -169,7 +169,7 @@
|
||||
IBlockData iblockdata = this.level.getType(blockposition);
|
||||
@@ -168,7 +168,7 @@
|
||||
IBlockData iblockdata = this.level.getBlockState(blockposition);
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
- if (block instanceof BlockLeaves) {
|
||||
+ if (block instanceof BlockLeaves && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, net.minecraft.world.level.block.Blocks.AIR.getBlockData()).isCancelled()) { // CraftBukkit
|
||||
flag = this.level.a(blockposition, true, this) || flag;
|
||||
+ if (block instanceof BlockLeaves && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState()).isCancelled()) { // CraftBukkit
|
||||
flag = this.level.destroyBlock(blockposition, true, this) || flag;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,17 +13,8 @@
|
||||
public class EntityShulker extends EntityGolem implements IMonster {
|
||||
|
||||
private static final UUID COVERED_ARMOR_MODIFIER_UUID = UUID.fromString("7E0292F2-9434-48D5-A29F-9583AF7DF27F");
|
||||
@@ -95,7 +101,7 @@
|
||||
this.goalSelector.a(4, new EntityShulker.a());
|
||||
this.goalSelector.a(7, new EntityShulker.f());
|
||||
this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
|
||||
- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{this.getClass()})).a());
|
||||
+ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{this.getClass()})).a(new Class[0])); // CraftBukkit - decompile error
|
||||
this.targetSelector.a(2, new EntityShulker.e(this));
|
||||
this.targetSelector.a(3, new EntityShulker.c(this));
|
||||
}
|
||||
@@ -405,6 +411,16 @@
|
||||
EnumDirection enumdirection = this.g(blockposition1);
|
||||
EnumDirection enumdirection = this.findAttachableSurface(blockposition1);
|
||||
|
||||
if (enumdirection != null) {
|
||||
+ // CraftBukkit start
|
||||
@@ -36,15 +27,15 @@
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.decouple();
|
||||
this.unRide();
|
||||
this.setAttachFace(enumdirection);
|
||||
this.playSound(SoundEffects.SHULKER_TELEPORT, 1.0F, 1.0F);
|
||||
@@ -477,7 +493,7 @@
|
||||
}
|
||||
|
||||
entityshulker.d(vec3d);
|
||||
- this.level.addEntity(entityshulker);
|
||||
+ this.level.addEntity(entityshulker, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - the mysteries of life
|
||||
entityshulker.moveTo(vec3d);
|
||||
- this.level.addFreshEntity(entityshulker);
|
||||
+ this.level.addFreshEntity(entityshulker, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - the mysteries of life
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +1,26 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntitySilverfish.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySilverfish.java
|
||||
@@ -46,7 +46,7 @@
|
||||
this.goalSelector.a(3, this.friendsGoal);
|
||||
this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, 1.0D, false));
|
||||
this.goalSelector.a(5, new EntitySilverfish.PathfinderGoalSilverfishHideInBlock(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));
|
||||
}
|
||||
|
||||
@@ -171,6 +171,11 @@
|
||||
@@ -173,6 +173,11 @@
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
if (block instanceof BlockMonsterEggs) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, net.minecraft.world.level.block.Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState()).isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
world.a(blockposition1, true, this.silverfish);
|
||||
world.destroyBlock(blockposition1, true, this.silverfish);
|
||||
} else {
|
||||
@@ -239,6 +244,11 @@
|
||||
IBlockData iblockdata = world.getType(blockposition);
|
||||
@@ -242,6 +247,11 @@
|
||||
IBlockData iblockdata = world.getBlockState(blockposition);
|
||||
|
||||
if (BlockMonsterEggs.h(iblockdata)) {
|
||||
if (BlockMonsterEggs.isCompatibleHostBlock(iblockdata)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, BlockMonsterEggs.n(iblockdata)).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, BlockMonsterEggs.infestedStateByHost(iblockdata)).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, BlockMonsterEggs.n(iblockdata), 3);
|
||||
this.mob.doSpawnEffect();
|
||||
this.mob.die();
|
||||
world.setBlock(blockposition, BlockMonsterEggs.infestedStateByHost(iblockdata), 3);
|
||||
this.mob.spawnAnim();
|
||||
this.mob.discard();
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -86,7 +86,7 @@
|
||||
}
|
||||
|
||||
protected void fy() {
|
||||
- this.a(EntityTypes.STRAY, true);
|
||||
+ this.a(EntityTypes.STRAY, true, org.bukkit.event.entity.EntityTransformEvent.TransformReason.FROZEN, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.FROZEN); // CraftBukkit - add spawn and transform reasons
|
||||
protected void doFreezeConversion() {
|
||||
- this.convertTo(EntityTypes.STRAY, true);
|
||||
+ this.convertTo(EntityTypes.STRAY, true, org.bukkit.event.entity.EntityTransformEvent.TransformReason.FROZEN, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.FROZEN); // CraftBukkit - add spawn and transform reasons
|
||||
if (!this.isSilent()) {
|
||||
this.level.a((EntityHuman) null, 1048, this.getChunkCoordinates(), 0);
|
||||
this.level.levelEvent((EntityHuman) null, 1048, this.blockPosition(), 0);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user