Update to Minecraft 1.20.5

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-04-24 01:15:00 +10:00
parent 4deda9501f
commit 65bc2541a3
524 changed files with 7788 additions and 6181 deletions

View File

@@ -1,10 +1,11 @@
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -126,8 +126,68 @@
import org.joml.Vector3f;
@@ -128,8 +128,69 @@
import net.minecraft.world.scores.ScoreboardTeamBase;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
+import net.minecraft.world.level.dimension.WorldDimension;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
@@ -38,7 +39,7 @@
+import org.bukkit.plugin.PluginManager;
+// CraftBukkit end
+
public abstract class Entity implements INamableTileEntity, EntityAccess, ICommandListener, ScoreHolder {
public abstract class Entity implements SyncedDataHolder, INamableTileEntity, EntityAccess, ICommandListener, ScoreHolder {
+ // CraftBukkit start
+ private static final int CURRENT_LEVEL = 2;
@@ -69,10 +70,10 @@
private static final Logger LOGGER = LogUtils.getLogger();
public static final String ID_TAG = "id";
public static final String PASSENGERS_TAG = "Passengers";
@@ -242,6 +302,29 @@
@@ -243,6 +304,29 @@
public boolean hasVisualFire;
@Nullable
private IBlockData feetBlockState;
private IBlockData inBlockState;
+ // CraftBukkit start
+ public boolean persist = true;
+ public boolean visibleByDefault = true;
@@ -99,7 +100,7 @@
public Entity(EntityTypes<?> entitytypes, World world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
@@ -346,12 +429,18 @@
@@ -349,12 +433,18 @@
}
public void kill() {
@@ -119,8 +120,25 @@
+ // CraftBukkit end
}
protected abstract void defineSynchedData();
@@ -369,12 +458,24 @@
protected abstract void defineSynchedData(DataWatcher.a datawatcher_a);
@@ -363,6 +453,16 @@
return this.entityData;
}
+ // CraftBukkit start
+ public void refreshEntityData(EntityPlayer to) {
+ List<DataWatcher.c<?>> list = this.getEntityData().getNonDefaultValues();
+
+ if (list != null) {
+ to.connection.send(new PacketPlayOutEntityMetadata(this.getId(), list));
+ }
+ }
+ // CraftBukkit end
+
public boolean equals(Object object) {
return object instanceof Entity ? ((Entity) object).id == this.id : false;
}
@@ -372,12 +472,24 @@
}
public void remove(Entity.RemovalReason entity_removalreason) {
@@ -146,7 +164,7 @@
this.entityData.set(Entity.DATA_POSE, entitypose);
}
@@ -399,6 +500,33 @@
@@ -402,6 +514,33 @@
}
protected void setRot(float f, float f1) {
@@ -180,7 +198,7 @@
this.setYRot(f % 360.0F);
this.setXRot(f1 % 360.0F);
}
@@ -440,6 +568,15 @@
@@ -443,6 +582,15 @@
this.baseTick();
}
@@ -195,8 +213,8 @@
+
public void baseTick() {
this.level().getProfiler().push("entityBaseTick");
this.feetBlockState = null;
@@ -454,7 +591,7 @@
this.inBlockState = null;
@@ -457,7 +605,7 @@
this.walkDistO = this.walkDist;
this.xRotO = this.getXRot();
this.yRotO = this.getYRot();
@@ -205,7 +223,7 @@
if (this.canSpawnSprintParticle()) {
this.spawnSprintParticle();
}
@@ -489,6 +626,10 @@
@@ -492,6 +640,10 @@
if (this.isInLava()) {
this.lavaHurt();
this.fallDistance *= 0.5F;
@@ -216,11 +234,11 @@
}
this.checkBelowWorld();
@@ -540,15 +681,47 @@
@@ -543,15 +695,47 @@
public void lavaHurt() {
if (!this.fireImmune()) {
- this.setSecondsOnFire(15);
- this.igniteForSeconds(15);
- if (this.hurt(this.damageSources().lava(), 4.0F)) {
+ // CraftBukkit start - Fallen in lava TODO: this event spams!
+ if (this instanceof EntityLiving && remainingFireTicks <= 0) {
@@ -231,11 +249,11 @@
+ this.level.getCraftServer().getPluginManager().callEvent(combustEvent);
+
+ if (!combustEvent.isCancelled()) {
+ this.setSecondsOnFire(combustEvent.getDuration(), false);
+ this.igniteForSeconds(combustEvent.getDuration(), false);
+ }
+ } else {
+ // This will be called every single tick the entity is in lava, so don't throw an event
+ this.setSecondsOnFire(15, false);
+ this.igniteForSeconds(15, false);
+ }
+
+ if (this.hurt(this.damageSources().lava().directBlock(level, lastLavaContact), 4.0F)) {
@@ -246,12 +264,12 @@
}
}
public void setSecondsOnFire(int i) {
public final void igniteForSeconds(int i) {
+ // CraftBukkit start
+ this.setSecondsOnFire(i, true);
+ this.igniteForSeconds(i, true);
+ }
+
+ public void setSecondsOnFire(int i, boolean callEvent) {
+ public final void igniteForSeconds(int i, boolean callEvent) {
+ if (callEvent) {
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), i);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
@@ -263,10 +281,10 @@
+ i = event.getDuration();
+ }
+ // CraftBukkit end
int j = i * 20;
this.igniteForTicks(i * 20);
}
if (this instanceof EntityLiving) {
@@ -574,7 +747,7 @@
@@ -575,7 +759,7 @@
}
protected void onBelowWorld() {
@@ -275,7 +293,7 @@
}
public boolean isFree(double d0, double d1, double d2) {
@@ -699,6 +872,28 @@
@@ -700,6 +884,28 @@
block.updateEntityAfterFallOn(this.level(), this);
}
@@ -304,7 +322,7 @@
if (this.onGround()) {
block.stepOn(this.level(), blockposition, iblockdata, this);
}
@@ -1026,6 +1221,20 @@
@@ -1027,6 +1233,20 @@
return SoundEffects.GENERIC_SPLASH;
}
@@ -325,7 +343,7 @@
protected void checkInsideBlocks() {
AxisAlignedBB axisalignedbb = this.getBoundingBox();
BlockPosition blockposition = BlockPosition.containing(axisalignedbb.minX + 1.0E-7D, axisalignedbb.minY + 1.0E-7D, axisalignedbb.minZ + 1.0E-7D);
@@ -1440,6 +1649,7 @@
@@ -1454,6 +1674,7 @@
this.yo = d1;
this.zo = d4;
this.setPos(d3, d1, d4);
@@ -333,7 +351,7 @@
}
public void moveTo(Vec3D vec3d) {
@@ -1634,6 +1844,12 @@
@@ -1652,6 +1873,12 @@
return false;
}
@@ -346,7 +364,7 @@
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
if (entity instanceof EntityPlayer) {
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
@@ -1662,16 +1878,22 @@
@@ -1680,16 +1907,22 @@
}
public boolean saveAsPassenger(NBTTagCompound nbttagcompound) {
@@ -371,7 +389,7 @@
return true;
}
}
@@ -1682,16 +1904,38 @@
@@ -1700,16 +1933,38 @@
}
public NBTTagCompound saveWithoutId(NBTTagCompound nbttagcompound) {
@@ -414,7 +432,7 @@
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
nbttagcompound.putFloat("FallDistance", this.fallDistance);
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
@@ -1699,7 +1943,28 @@
@@ -1717,7 +1972,28 @@
nbttagcompound.putBoolean("OnGround", this.onGround());
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
@@ -444,7 +462,7 @@
IChatBaseComponent ichatbasecomponent = this.getCustomName();
if (ichatbasecomponent != null) {
@@ -1748,7 +2013,7 @@
@@ -1766,7 +2042,7 @@
nbttagcompound.put("Tags", nbttaglist);
}
@@ -453,7 +471,7 @@
if (this.isVehicle()) {
nbttaglist = new NBTTagList();
iterator = this.getPassengers().iterator();
@@ -1757,7 +2022,7 @@
@@ -1775,7 +2051,7 @@
Entity entity = (Entity) iterator.next();
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
@@ -462,7 +480,7 @@
nbttaglist.add(nbttagcompound1);
}
}
@@ -1767,6 +2032,11 @@
@@ -1785,6 +2061,11 @@
}
}
@@ -474,7 +492,7 @@
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -1850,6 +2120,45 @@
@@ -1868,6 +2149,45 @@
} else {
throw new IllegalStateException("Entity has invalid position");
}
@@ -520,7 +538,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
@@ -1871,6 +2180,12 @@
@@ -1889,6 +2209,12 @@
return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null;
}
@@ -533,7 +551,7 @@
protected abstract void readAdditionalSaveData(NBTTagCompound nbttagcompound);
protected abstract void addAdditionalSaveData(NBTTagCompound nbttagcompound);
@@ -1925,9 +2240,22 @@
@@ -1943,9 +2269,22 @@
} else if (this.level().isClientSide) {
return null;
} else {
@@ -556,7 +574,7 @@
this.level().addFreshEntity(entityitem);
return entityitem;
}
@@ -2025,6 +2353,27 @@
@@ -2046,6 +2385,27 @@
if (!flag && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
return false;
} else {
@@ -584,7 +602,7 @@
if (this.isPassenger()) {
this.stopRiding();
}
@@ -2058,7 +2407,7 @@
@@ -2079,7 +2439,7 @@
Entity entity = this.vehicle;
this.vehicle = null;
@@ -593,7 +611,7 @@
}
}
@@ -2089,10 +2438,38 @@
@@ -2110,10 +2470,38 @@
}
}
@@ -633,7 +651,7 @@
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
this.passengers = ImmutableList.of();
} else {
@@ -2104,6 +2481,7 @@
@@ -2125,6 +2513,7 @@
entity.boardingCooldown = 60;
this.gameEvent(GameEvent.ENTITY_DISMOUNT, entity);
}
@@ -641,7 +659,7 @@
}
protected boolean canAddPassenger(Entity entity) {
@@ -2190,14 +2568,20 @@
@@ -2210,14 +2599,20 @@
if (this.isInsidePortal) {
MinecraftServer minecraftserver = worldserver.getServer();
@@ -665,7 +683,7 @@
this.level().getProfiler().pop();
}
@@ -2321,6 +2705,13 @@
@@ -2327,6 +2722,13 @@
}
public void setSwimming(boolean flag) {
@@ -679,7 +697,7 @@
this.setSharedFlag(4, flag);
}
@@ -2370,8 +2761,12 @@
@@ -2376,8 +2778,12 @@
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
}
@@ -693,7 +711,7 @@
}
public boolean getSharedFlag(int i) {
@@ -2390,7 +2785,7 @@
@@ -2396,7 +2802,7 @@
}
public int getMaxAirSupply() {
@@ -702,7 +720,7 @@
}
public int getAirSupply() {
@@ -2398,7 +2793,18 @@
@@ -2404,7 +2810,18 @@
}
public void setAirSupply(int i) {
@@ -722,7 +740,7 @@
}
public int getTicksFrozen() {
@@ -2425,11 +2831,40 @@
@@ -2431,11 +2848,40 @@
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
this.setRemainingFireTicks(this.remainingFireTicks + 1);
@@ -733,12 +751,12 @@
+ // CraftBukkit end
+
if (this.remainingFireTicks == 0) {
- this.setSecondsOnFire(8);
- this.igniteForSeconds(8);
+ // CraftBukkit start - Call a combust event when lightning strikes
+ EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8);
+ pluginManager.callEvent(entityCombustEvent);
+ if (!entityCombustEvent.isCancelled()) {
+ this.setSecondsOnFire(entityCombustEvent.getDuration(), false);
+ this.igniteForSeconds(entityCombustEvent.getDuration(), false);
+ }
+ // CraftBukkit end
}
@@ -765,7 +783,7 @@
}
public void onAboveBubbleCol(boolean flag) {
@@ -2594,15 +3029,38 @@
@@ -2600,15 +3046,38 @@
@Nullable
public Entity changeDimension(WorldServer worldserver) {
@@ -806,7 +824,7 @@
this.level().getProfiler().popPush("reloading");
Entity entity = this.getType().create(worldserver);
@@ -2610,10 +3068,22 @@
@@ -2616,10 +3085,22 @@
entity.restoreFrom(this);
entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
entity.setDeltaMovement(shapedetectorshape.speed);
@@ -832,7 +850,7 @@
}
this.removeAfterChangingDimensions();
@@ -2629,25 +3099,39 @@
@@ -2635,25 +3116,39 @@
}
protected void removeAfterChangingDimensions() {
@@ -878,7 +896,7 @@
IBlockData iblockdata = this.level().getBlockState(this.portalEntrancePos);
EnumDirection.EnumAxis enumdirection_enumaxis;
Vec3D vec3d;
@@ -2664,8 +3148,8 @@
@@ -2670,8 +3165,8 @@
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
}
@@ -888,24 +906,24 @@
+ }).orElse(null); // CraftBukkit - decompile error
}
} else {
BlockPosition blockposition1;
@@ -2675,8 +3159,14 @@
BlockPosition blockposition1 = flag1 ? WorldServer.END_SPAWN_POINT : worldserver.getSharedSpawnPos();
@@ -2684,8 +3179,14 @@
} else {
blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos());
i = worldserver.getChunkAt(blockposition1).getHeight(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, blockposition1.getX(), blockposition1.getZ()) + 1;
}
+ // CraftBukkit start
+ CraftPortalEvent event = callPortalEvent(this, worldserver, new Vec3D(blockposition1.getX() + 0.5D, blockposition1.getY(), blockposition1.getZ() + 0.5D), PlayerTeleportEvent.TeleportCause.END_PORTAL, 0, 0);
+ CraftPortalEvent event = callPortalEvent(this, worldserver, new Vec3D(blockposition1.getX() + 0.5D, i, blockposition1.getZ() + 0.5D), PlayerTeleportEvent.TeleportCause.END_PORTAL, 0, 0);
+ if (event == null) {
+ return null;
+ }
- 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) i, (double) blockposition1.getZ() + 0.5D), this.getDeltaMovement(), this.getYRot(), this.getXRot());
+ return new ShapeDetectorShape(new Vec3D(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ()), this.getDeltaMovement(), this.getYRot(), this.getXRot(), ((CraftWorld) event.getTo().getWorld()).getHandle(), event);
+ // CraftBukkit end
}
}
@@ -2684,8 +3174,23 @@
@@ -2693,8 +3194,23 @@
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
}
@@ -931,7 +949,7 @@
}
public boolean canChangeDimensions() {
@@ -2806,6 +3311,12 @@
@@ -2815,6 +3331,12 @@
}
}
@@ -944,7 +962,7 @@
public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<RelativeMovement> set, float f, float f1) {
float f2 = MathHelper.clamp(f1, -90.0F, 90.0F);
@@ -2824,8 +3335,12 @@
@@ -2833,8 +3355,12 @@
entity.restoreFrom(this);
entity.moveTo(d0, d1, d2, f, f2);
entity.setYHeadRot(f);
@@ -959,7 +977,7 @@
}
return true;
@@ -2931,7 +3446,26 @@
@@ -2942,7 +3468,26 @@
}
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
@@ -986,8 +1004,8 @@
+ // CraftBukkit end
}
protected float getEyeHeight(EntityPose entitypose, EntitySize entitysize) {
@@ -3246,6 +3780,11 @@
public final float getEyeHeight(EntityPose entitypose) {
@@ -3263,6 +3808,11 @@
vec3d = vec3d.add(vec3d1);
++k1;
}
@@ -999,7 +1017,7 @@
}
}
}
@@ -3517,6 +4056,14 @@
@@ -3532,6 +4082,14 @@
@Override
public final void setRemoved(Entity.RemovalReason entity_removalreason) {

View File

@@ -1,11 +1,10 @@
--- a/net/minecraft/world/entity/EntityAreaEffectCloud.java
+++ b/net/minecraft/world/entity/EntityAreaEffectCloud.java
@@ -31,6 +31,13 @@
@@ -30,6 +30,12 @@
import net.minecraft.world.level.material.EnumPistonReaction;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.resources.MinecraftKey;
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.entity.EntityRemoveEvent;
@@ -14,7 +13,7 @@
public class EntityAreaEffectCloud extends Entity implements TraceableEntity {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -216,7 +223,7 @@
@@ -186,7 +192,7 @@
}
} else {
if (this.tickCount >= this.waitTime + this.duration) {
@@ -23,7 +22,7 @@
return;
}
@@ -233,7 +240,7 @@
@@ -203,7 +209,7 @@
if (this.radiusPerTick != 0.0F) {
f += this.radiusPerTick;
if (f < 0.5F) {
@@ -32,7 +31,7 @@
return;
}
@@ -264,6 +271,7 @@
@@ -237,6 +243,7 @@
if (!list1.isEmpty()) {
Iterator iterator1 = list1.iterator();
@@ -40,10 +39,10 @@
while (iterator1.hasNext()) {
EntityLiving entityliving = (EntityLiving) iterator1.next();
@@ -273,6 +281,17 @@
double d8 = d6 * d6 + d7 * d7;
@@ -246,6 +253,17 @@
double d5 = d3 * d3 + d4 * d4;
if (d8 <= (double) (f * f)) {
if (d5 <= (double) (f * f)) {
+ // CraftBukkit start
+ entities.add((LivingEntity) entityliving.getBukkitEntity());
+ }
@@ -58,9 +57,9 @@
this.victims.put(entityliving, this.tickCount + this.reapplicationDelay);
Iterator iterator2 = list.iterator();
@@ -282,14 +301,14 @@
if (mobeffect1.getEffect().isInstantenous()) {
mobeffect1.getEffect().applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect1.getAmplifier(), 0.5D);
@@ -255,14 +273,14 @@
if (((MobEffectList) mobeffect1.getEffect().value()).isInstantenous()) {
((MobEffectList) mobeffect1.getEffect().value()).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
@@ -75,7 +74,7 @@
return;
}
@@ -299,7 +318,7 @@
@@ -272,7 +290,7 @@
if (this.durationOnUse != 0) {
this.duration += this.durationOnUse;
if (this.duration <= 0) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityCreature.java
+++ b/net/minecraft/world/entity/EntityCreature.java
@@ -9,6 +9,10 @@
@@ -11,6 +11,10 @@
import net.minecraft.world.level.World;
import net.minecraft.world.phys.Vec3D;
@@ -11,7 +11,7 @@
public abstract class EntityCreature extends EntityInsentient {
protected static final float DEFAULT_WALK_TARGET_VALUE = 0.0F;
@@ -51,6 +55,7 @@
@@ -67,6 +71,7 @@
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isInSittingPose()) {
if (f > 10.0F) {
@@ -19,7 +19,7 @@
this.dropLeash(true, true);
}
@@ -59,6 +64,7 @@
@@ -75,6 +80,7 @@
this.onLeashDistance(f);
if (f > 10.0F) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityExperienceOrb.java
+++ b/net/minecraft/world/entity/EntityExperienceOrb.java
@@ -21,6 +21,14 @@
@@ -22,6 +22,14 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
@@ -15,7 +15,7 @@
public class EntityExperienceOrb extends Entity {
private static final int LIFETIME = 6000;
@@ -59,6 +67,7 @@
@@ -65,6 +73,7 @@
@Override
public void tick() {
super.tick();
@@ -23,7 +23,7 @@
this.xo = this.getX();
this.yo = this.getY();
this.zo = this.getZ();
@@ -84,7 +93,22 @@
@@ -90,7 +99,22 @@
this.followingPlayer = null;
}
@@ -47,7 +47,7 @@
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();
@@ -109,7 +133,7 @@
@@ -115,7 +139,7 @@
++this.age;
if (this.age >= 6000) {
@@ -56,7 +56,7 @@
}
}
@@ -178,7 +202,7 @@
@@ -184,7 +208,7 @@
private void merge(EntityExperienceOrb entityexperienceorb) {
this.count += entityexperienceorb.count;
this.age = Math.min(this.age, entityexperienceorb.age);
@@ -65,7 +65,7 @@
}
private void setUnderwaterMovement() {
@@ -200,7 +224,7 @@
@@ -206,7 +230,7 @@
this.markHurt();
this.health = (int) ((float) this.health - f);
if (this.health <= 0) {
@@ -74,7 +74,7 @@
}
return true;
@@ -227,17 +251,17 @@
@@ -233,17 +257,17 @@
public void playerTouch(EntityHuman entityhuman) {
if (!this.level().isClientSide) {
if (entityhuman.takeXpDelay == 0) {
@@ -95,7 +95,7 @@
}
}
@@ -250,9 +274,17 @@
@@ -256,9 +280,17 @@
if (entry != null) {
ItemStack itemstack = (ItemStack) entry.getValue();
int j = Math.min(this.xpToDurability(i), itemstack.getDamageValue());
@@ -113,7 +113,7 @@
return k > 0 ? this.repairPlayerItems(entityhuman, k) : 0;
} else {
@@ -277,6 +309,24 @@
@@ -283,6 +315,24 @@
}
public static int getExperienceValue(int i) {

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/EntityInsentient.java
+++ b/net/minecraft/world/entity/EntityInsentient.java
@@ -76,6 +76,20 @@
import net.minecraft.world.level.pathfinder.PathType;
@@ -89,6 +89,20 @@
import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
import net.minecraft.world.phys.AxisAlignedBB;
+// CraftBukkit start
@@ -18,10 +18,10 @@
+import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
+// CraftBukkit end
+
public abstract class EntityInsentient extends EntityLiving implements Targeting {
public abstract class EntityInsentient extends EntityLiving implements EquipmentUser, Targeting {
private static final DataWatcherObject<Byte> DATA_MOB_FLAGS_ID = DataWatcher.defineId(EntityInsentient.class, DataWatcherRegistry.BYTE);
@@ -123,6 +137,8 @@
@@ -138,6 +152,8 @@
private BlockPosition restrictCenter;
private float restrictRadius;
@@ -30,7 +30,7 @@
protected EntityInsentient(EntityTypes<? extends EntityInsentient> entitytypes, World world) {
super(entitytypes, world);
this.handItems = NonNullList.withSize(2, ItemStack.EMPTY);
@@ -148,6 +164,12 @@
@@ -165,6 +181,12 @@
}
@@ -43,7 +43,12 @@
protected void registerGoals() {}
public static AttributeProvider.Builder createMobAttributes() {
@@ -259,7 +281,38 @@
@@ -269,11 +291,42 @@
@Nullable
protected final EntityLiving getTargetFromBrain() {
- return (EntityLiving) this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse((Object) null);
+ return (EntityLiving) this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null); // CraftBukkit - decompile error
}
public void setTarget(@Nullable EntityLiving entityliving) {
@@ -82,7 +87,7 @@
}
@Override
@@ -399,6 +452,12 @@
@@ -412,6 +465,12 @@
return null;
}
@@ -95,16 +100,16 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@@ -457,7 +516,7 @@
@@ -486,7 +545,7 @@
}
}
nbttagcompound.put("HandDropChances", nbttaglist3);
- if (this.leashHolder != null) {
+ if (this.leashHolder != null && !this.leashHolder.pluginRemoved) { // CraftBukkit - SPIGOT-7487: Don't save (and possible drop) leash, when the holder was removed by a plugin
nbttagcompound2 = new NBTTagCompound();
if (this.leashHolder instanceof EntityLiving) {
UUID uuid = this.leashHolder.getUUID();
@@ -488,16 +547,26 @@
- if (either != null) {
+ if (either != null && !this.leashHolder.pluginRemoved) { // CraftBukkit - SPIGOT-7487: Don't save (and possible drop) leash, when the holder was removed by a plugin
nbttagcompound.put("leash", (NBTBase) either.map((uuid) -> {
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
@@ -507,16 +566,26 @@
nbttagcompound.putBoolean("NoAI", this.isNoAi());
}
@@ -131,9 +136,18 @@
+ }
+ // CraftBukkit end
NBTTagList nbttaglist;
NBTTagCompound nbttagcompound1;
int i;
@@ -544,6 +613,11 @@
@@ -565,7 +634,7 @@
if (nbttagcompound.contains("leash", 10)) {
this.delayedLeashInfo = Either.left(nbttagcompound.getCompound("leash").getUUID("UUID"));
} else if (nbttagcompound.contains("leash", 11)) {
- this.delayedLeashInfo = (Either) GameProfileSerializer.readBlockPos(nbttagcompound, "leash").map(Either::right).orElse((Object) null);
+ this.delayedLeashInfo = (Either) GameProfileSerializer.readBlockPos(nbttagcompound, "leash").map(Either::right).orElse(null); // CraftBukkit - decompile error
} else {
this.delayedLeashInfo = null;
}
@@ -577,6 +646,11 @@
}
this.setNoAi(nbttagcompound.getBoolean("NoAI"));
@@ -145,7 +159,7 @@
}
@Override
@@ -611,20 +685,26 @@
@@ -651,20 +725,26 @@
protected void pickUpItem(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItem();
@@ -174,7 +188,7 @@
EnumItemSlot enumitemslot = getEquipmentSlotForItem(itemstack);
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
boolean flag = this.canReplaceCurrentItem(itemstack, itemstack1);
@@ -635,11 +715,19 @@
@@ -675,11 +755,19 @@
flag = itemstack1.isEmpty();
}
@@ -195,7 +209,7 @@
}
if (enumitemslot.isArmor() && itemstack.getCount() > 1) {
@@ -760,7 +848,7 @@
@@ -813,7 +901,7 @@
@Override
public void checkDespawn() {
if (this.level().getDifficulty() == EnumDifficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
@@ -204,7 +218,7 @@
} else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) {
EntityHuman entityhuman = this.level().getNearestPlayer(this, -1.0D);
@@ -770,14 +858,14 @@
@@ -823,14 +911,14 @@
int j = i * i;
if (d0 > (double) j && this.removeWhenFarAway(d0)) {
@@ -221,15 +235,15 @@
} else if (d0 < (double) l) {
this.noActionTime = 0;
}
@@ -791,6 +879,7 @@
@@ -844,6 +932,7 @@
@Override
protected final void serverAiStep() {
++this.noActionTime;
+ if (!this.aware) return; // CraftBukkit
this.level().getProfiler().push("sensing");
this.sensing.tick();
this.level().getProfiler().pop();
@@ -1184,6 +1273,12 @@
GameProfilerFiller gameprofilerfiller = this.level().getProfiler();
gameprofilerfiller.push("sensing");
@@ -1311,6 +1400,12 @@
if (!this.isAlive()) {
return EnumInteractionResult.PASS;
} else if (this.getLeashHolder() == entityhuman) {
@@ -239,10 +253,10 @@
+ return EnumInteractionResult.PASS;
+ }
+ // CraftBukkit end
this.dropLeash(true, !entityhuman.getAbilities().instabuild);
this.dropLeash(true, !entityhuman.hasInfiniteMaterials());
this.gameEvent(GameEvent.ENTITY_INTERACT, entityhuman);
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
@@ -1209,6 +1304,12 @@
@@ -1336,6 +1431,12 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.LEAD) && this.canBeLeashed(entityhuman)) {
@@ -255,7 +269,7 @@
this.setLeashedTo(entityhuman, true);
itemstack.shrink(1);
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
@@ -1224,7 +1325,7 @@
@@ -1351,7 +1452,7 @@
if (itemstack.getItem() instanceof ItemMonsterEgg) {
if (this.level() instanceof WorldServer) {
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
@@ -264,7 +278,7 @@
optional.ifPresent((entityinsentient) -> {
this.onOffspringSpawnedFromEgg(entityhuman, entityinsentient);
@@ -1274,12 +1375,19 @@
@@ -1401,12 +1502,19 @@
return this.restrictRadius != -1.0F;
}
@@ -285,7 +299,7 @@
if (t0 == null) {
return null;
@@ -1313,7 +1421,12 @@
@@ -1440,7 +1548,12 @@
}
}
@@ -299,7 +313,7 @@
if (this.isPassenger()) {
Entity entity = this.getVehicle();
@@ -1321,7 +1434,7 @@
@@ -1448,7 +1561,7 @@
t0.startRiding(entity, true);
}
@@ -308,7 +322,7 @@
return t0;
}
}
@@ -1334,7 +1447,8 @@
@@ -1461,7 +1574,8 @@
if (this.leashHolder != null) {
if (!this.isAlive() || !this.leashHolder.isAlive()) {
@@ -318,9 +332,9 @@
}
}
@@ -1345,7 +1459,9 @@
this.leashHolder = null;
this.leashInfoTag = null;
@@ -1473,7 +1587,9 @@
this.delayedLeashInfo = null;
this.clearRestriction();
if (!this.level().isClientSide && flag1) {
+ this.forceDrops = true; // CraftBukkit
this.spawnAtLocation((IMaterial) Items.LEAD);
@@ -328,7 +342,7 @@
}
if (!this.level().isClientSide && flag && this.level() instanceof WorldServer) {
@@ -1395,6 +1511,7 @@
@@ -1527,6 +1643,7 @@
boolean flag1 = super.startRiding(entity, flag);
if (flag1 && this.isLeashed()) {
@@ -336,27 +350,27 @@
this.dropLeash(true, true);
}
@@ -1419,7 +1536,9 @@
}
@@ -1555,7 +1672,9 @@
}
if (this.tickCount > 100) {
+ this.forceDrops = true; // CraftBukkit
this.spawnAtLocation((IMaterial) Items.LEAD);
+ this.forceDrops = false; // CraftBukkit
this.leashInfoTag = null;
if (this.tickCount > 100) {
+ this.forceDrops = true; // CraftBukkit
this.spawnAtLocation((IMaterial) Items.LEAD);
+ this.forceDrops = false; // CraftBukkit
this.delayedLeashInfo = null;
}
}
}
@@ -1501,14 +1620,21 @@
@@ -1638,14 +1757,21 @@
int i = EnchantmentManager.getFireAspect(this);
if (i > 0) {
- entity.setSecondsOnFire(i * 4);
- entity.igniteForSeconds(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.setSecondsOnFire(combustEvent.getDuration(), false);
+ entity.igniteForSeconds(combustEvent.getDuration(), false);
+ }
+ // CraftBukkit end
}
@@ -370,7 +384,7 @@
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
}
@@ -1576,6 +1702,7 @@
@@ -1695,6 +1821,7 @@
@Override
protected void removeAfterChangingDimensions() {
super.removeAfterChangingDimensions();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityLightning.java
+++ b/net/minecraft/world/entity/EntityLightning.java
@@ -29,6 +29,11 @@
@@ -30,6 +30,11 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
@@ -12,7 +12,7 @@
public class EntityLightning extends Entity {
private static final int START_LIFE = 2;
@@ -120,7 +125,7 @@
@@ -121,7 +126,7 @@
}
}
@@ -21,7 +21,7 @@
} else if (this.life < -this.random.nextInt(10)) {
--this.flashes;
this.life = 1;
@@ -129,7 +134,7 @@
@@ -130,7 +135,7 @@
}
}
@@ -30,7 +30,7 @@
if (!(this.level() instanceof WorldServer)) {
this.level().setSkyFlashTime(2);
} else if (!this.visualOnly) {
@@ -163,8 +168,12 @@
@@ -164,8 +169,12 @@
IBlockData iblockdata = BlockFireAbstract.getState(this.level(), blockposition);
if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
@@ -45,7 +45,7 @@
}
for (int j = 0; j < i; ++j) {
@@ -172,8 +181,12 @@
@@ -173,8 +182,12 @@
iblockdata = BlockFireAbstract.getState(this.level(), blockposition1);
if (this.level().getBlockState(blockposition1).isAir() && iblockdata.canSurvive(this.level(), blockposition1)) {
@@ -60,7 +60,7 @@
}
}
@@ -237,8 +250,9 @@
@@ -238,8 +251,9 @@
iblockdata = world.getBlockState(blockposition1);
} while (!(iblockdata.getBlock() instanceof WeatheringCopper));

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityLiving.java
+++ b/net/minecraft/world/entity/EntityLiving.java
@@ -119,6 +119,32 @@
@@ -126,6 +126,32 @@
import net.minecraft.world.scores.ScoreboardTeam;
import org.slf4j.Logger;
@@ -33,21 +33,10 @@
public abstract class EntityLiving extends Entity implements Attackable {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -214,7 +240,7 @@
private int noJumpDelay;
private float absorptionAmount;
protected ItemStack useItem;
- protected int useItemRemaining;
+ public int useItemRemaining;
protected int fallFlyTicks;
private BlockPosition lastPos;
private Optional<BlockPosition> lastClimbablePos;
@@ -225,7 +251,21 @@
private float swimAmount;
private float swimAmountO;
@@ -237,6 +263,20 @@
protected BehaviorController<?> brain;
- private boolean skipDropExperience;
+ protected boolean skipDropExperience;
protected boolean skipDropExperience;
protected float appliedScale;
+ // CraftBukkit start
+ public int expToDrop;
+ public boolean forceDrops;
@@ -65,9 +54,9 @@
protected EntityLiving(EntityTypes<? extends EntityLiving> entitytypes, World world) {
super(entitytypes, world);
@@ -238,7 +278,9 @@
this.useItem = ItemStack.EMPTY;
@@ -251,7 +291,9 @@
this.lastClimbablePos = Optional.empty();
this.appliedScale = 1.0F;
this.attributes = new AttributeMapBase(AttributeDefaults.getSupplier(entitytypes));
- this.setHealth(this.getMaxHealth());
+ this.craftAttributes = new CraftAttributeMap(attributes); // CraftBukkit
@@ -76,22 +65,22 @@
this.blocksBuilding = true;
this.rotA = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
this.reapplyPosition();
@@ -317,7 +359,13 @@
double d7 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
int i = (int) (150.0D * d7);
@@ -329,7 +371,13 @@
double d8 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
int i = (int) (150.0D * d8);
- ((WorldServer) this.level()).sendParticles(new ParticleParamBlock(Particles.BLOCK, iblockdata), d1, d2, d3, 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.getX(), this.getY(), this.getZ(), i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, false);
+ } else {
+ ((WorldServer) this.level()).sendParticles(new ParticleParamBlock(Particles.BLOCK, iblockdata), d1, d2, d3, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
+ }
+ // CraftBukkit end
- ((WorldServer) this.level()).sendParticles(new ParticleParamBlock(Particles.BLOCK, iblockdata), d2, d3, d4, 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), d2, d3, d4, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, false);
+ } else {
+ ((WorldServer) this.level()).sendParticles(new ParticleParamBlock(Particles.BLOCK, iblockdata), d2, d3, d4, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
+ }
+ // CraftBukkit end
}
}
super.checkFallDamage(d0, flag, iblockdata, blockposition);
@@ -573,7 +621,7 @@
@@ -594,7 +642,7 @@
++this.deathTime;
if (this.deathTime >= 20 && !this.level().isClientSide() && !this.isRemoved()) {
this.level().broadcastEntityEvent(this, (byte) 60);
@@ -100,7 +89,7 @@
}
}
@@ -672,13 +720,19 @@
@@ -693,13 +741,19 @@
}
public void onEquipItem(EnumItemSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1) {
@@ -112,32 +101,39 @@
+ // CraftBukkit end
boolean flag = itemstack1.isEmpty() && itemstack.isEmpty();
if (!flag && !ItemStack.isSameItemSameTags(itemstack, itemstack1) && !this.firstTick) {
if (!flag && !ItemStack.isSameItemSameComponents(itemstack, itemstack1) && !this.firstTick) {
Equipable equipable = Equipable.get(itemstack1);
if (!this.level().isClientSide() && !this.isSpectator()) {
- if (!this.isSilent() && equipable != null && equipable.getEquipmentSlot() == enumitemslot) {
+ if (!this.isSilent() && equipable != null && equipable.getEquipmentSlot() == enumitemslot && !silent) { // CraftBukkit
this.level().playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), equipable.getEquipSound(), this.getSoundSource(), 1.0F, 1.0F);
this.level().playSeededSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), equipable.getEquipSound(), this.getSoundSource(), 1.0F, 1.0F, this.random.nextLong());
}
@@ -692,7 +746,14 @@
@@ -713,6 +767,13 @@
@Override
public void remove(Entity.RemovalReason entity_removalreason) {
- super.remove(entity_removalreason);
+ // CraftBukkit start - add Bukkit remove cause
+ this.remove(entity_removalreason, null);
+ }
+
+ @Override
+ public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) {
+ super.remove(entity_removalreason, cause);
+ // CraftBukkit end
if (entity_removalreason == Entity.RemovalReason.KILLED || entity_removalreason == Entity.RemovalReason.DISCARDED) {
Iterator iterator = this.getActiveEffects().iterator();
@@ -723,7 +784,7 @@
}
}
- super.remove(entity_removalreason);
+ super.remove(entity_removalreason, cause); // CraftBukkit
this.brain.clearMemories();
}
@@ -752,6 +813,17 @@
@@ -783,6 +844,17 @@
}
}
@@ -155,7 +151,7 @@
if (nbttagcompound.contains("Health", 99)) {
this.setHealth(nbttagcompound.getFloat("Health"));
}
@@ -789,9 +861,32 @@
@@ -821,9 +893,32 @@
}
@@ -165,7 +161,7 @@
+
+ private static class ProcessableEffect {
+
+ private MobEffectList type;
+ private Holder<MobEffectList> type;
+ private MobEffect effect;
+ private final EntityPotionEffectEvent.Cause cause;
+
@@ -174,7 +170,7 @@
+ this.cause = cause;
+ }
+
+ private ProcessableEffect(MobEffectList type, EntityPotionEffectEvent.Cause cause) {
+ private ProcessableEffect(Holder<MobEffectList> type, EntityPotionEffectEvent.Cause cause) {
+ this.type = type;
+ this.cause = cause;
+ }
@@ -182,13 +178,13 @@
+ // CraftBukkit end
+
protected void tickEffects() {
Iterator iterator = this.activeEffects.keySet().iterator();
Iterator<Holder<MobEffectList>> iterator = this.activeEffects.keySet().iterator();
+ isTickingEffects = true; // CraftBukkit
try {
while (iterator.hasNext()) {
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
@@ -801,6 +896,12 @@
Holder<MobEffectList> holder = (Holder) iterator.next();
@@ -833,6 +928,12 @@
this.onEffectUpdated(mobeffect, true, (Entity) null);
})) {
if (!this.level().isClientSide) {
@@ -201,7 +197,7 @@
iterator.remove();
this.onEffectRemoved(mobeffect);
}
@@ -811,6 +912,17 @@
@@ -843,6 +944,17 @@
} catch (ConcurrentModificationException concurrentmodificationexception) {
;
}
@@ -219,8 +215,8 @@
if (this.effectsDirty) {
if (!this.level().isClientSide) {
@@ -937,7 +1049,13 @@
this.entityData.set(EntityLiving.DATA_EFFECT_COLOR_ID, 0);
@@ -958,7 +1070,13 @@
this.entityData.set(EntityLiving.DATA_EFFECT_PARTICLES, List.of());
}
+ // CraftBukkit start
@@ -233,7 +229,7 @@
if (this.level().isClientSide) {
return false;
} else {
@@ -946,7 +1064,14 @@
@@ -967,7 +1085,14 @@
boolean flag;
for (flag = false; iterator.hasNext(); flag = true) {
@@ -249,7 +245,7 @@
iterator.remove();
}
@@ -975,19 +1100,49 @@
@@ -996,20 +1121,50 @@
return this.addEffect(mobeffect, (Entity) null);
}
@@ -291,6 +287,7 @@
this.activeEffects.put(mobeffect.getEffect(), mobeffect);
this.onEffectAdded(mobeffect, entity);
flag = true;
mobeffect.onEffectAdded(this);
- } else if (mobeffect1.update(mobeffect)) {
+ // CraftBukkit start
+ } else if (event.isOverride()) {
@@ -300,24 +297,24 @@
flag = true;
}
@@ -1025,13 +1180,39 @@
return this.getMobType() == EnumMonsterType.UNDEAD;
@@ -1040,13 +1195,39 @@
return this.getType().is(TagsEntity.INVERTED_HEALING_AND_HARM);
}
+ // CraftBukkit start
@Nullable
public MobEffect removeEffectNoUpdate(@Nullable MobEffectList mobeffectlist) {
+ return c(mobeffectlist, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.UNKNOWN);
public MobEffect removeEffectNoUpdate(Holder<MobEffectList> holder) {
+ return removeEffectNoUpdate(holder, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.UNKNOWN);
+ }
+
+ @Nullable
+ public MobEffect c(@Nullable MobEffectList mobeffectlist, EntityPotionEffectEvent.Cause cause) {
+ public MobEffect removeEffectNoUpdate(Holder<MobEffectList> holder, EntityPotionEffectEvent.Cause cause) {
+ if (isTickingEffects) {
+ effectsToProcess.add(new ProcessableEffect(mobeffectlist, cause));
+ effectsToProcess.add(new ProcessableEffect(holder, cause));
+ return null;
+ }
+
+ MobEffect effect = this.activeEffects.get(mobeffectlist);
+ MobEffect effect = this.activeEffects.get(holder);
+ if (effect == null) {
+ return null;
+ }
@@ -327,21 +324,21 @@
+ return null;
+ }
+
return (MobEffect) this.activeEffects.remove(mobeffectlist);
return (MobEffect) this.activeEffects.remove(holder);
}
public boolean removeEffect(MobEffectList mobeffectlist) {
- MobEffect mobeffect = this.removeEffectNoUpdate(mobeffectlist);
+ return removeEffect(mobeffectlist, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.UNKNOWN);
public boolean removeEffect(Holder<MobEffectList> holder) {
- MobEffect mobeffect = this.removeEffectNoUpdate(holder);
+ return removeEffect(holder, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.UNKNOWN);
+ }
+
+ public boolean removeEffect(MobEffectList mobeffectlist, EntityPotionEffectEvent.Cause cause) {
+ MobEffect mobeffect = this.c(mobeffectlist, cause);
+ public boolean removeEffect(Holder<MobEffectList> holder, EntityPotionEffectEvent.Cause cause) {
+ MobEffect mobeffect = this.removeEffectNoUpdate(holder, cause);
+ // CraftBukkit end
if (mobeffect != null) {
this.onEffectRemoved(mobeffect);
@@ -1129,20 +1310,55 @@
@@ -1142,20 +1323,55 @@
}
@@ -398,7 +395,7 @@
this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.clamp(f, 0.0F, this.getMaxHealth()));
}
@@ -1156,7 +1372,7 @@
@@ -1169,7 +1385,7 @@
return false;
} else if (this.level().isClientSide) {
return false;
@@ -407,7 +404,7 @@
return false;
} else if (damagesource.is(DamageTypeTags.IS_FIRE) && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
return false;
@@ -1167,10 +1383,11 @@
@@ -1180,10 +1396,11 @@
this.noActionTime = 0;
float f1 = f;
@@ -421,7 +418,17 @@
this.hurtCurrentlyUsedShield(f);
f2 = f;
f = 0.0F;
@@ -1194,23 +1411,33 @@
@@ -1204,7 +1421,8 @@
f *= 5.0F;
}
- if (damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
+ // CraftBukkit - Moved into actuallyHurt(DamageSource, float)
+ if (false && damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
this.hurtHelmet(damagesource, f);
f *= 0.75F;
}
@@ -1212,18 +1430,27 @@
this.walkAnimation.setSpeed(1.5F);
boolean flag1 = true;
@@ -453,14 +460,7 @@
this.hurtDuration = 10;
this.hurtTime = this.hurtDuration;
}
- if (damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
+ // CraftBukkit - Moved into actuallyHurt(DamageSource, float)
+ if (false && damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
this.hurtHelmet(damagesource, f);
f *= 0.75F;
}
@@ -1269,7 +1496,7 @@
@@ -1282,7 +1509,7 @@
d0 = (Math.random() - Math.random()) * 0.01D;
}
@@ -469,7 +469,7 @@
if (!flag) {
this.indicateDamage(d0, d1);
}
@@ -1317,7 +1544,7 @@
@@ -1335,7 +1562,7 @@
}
protected void blockedByShield(EntityLiving entityliving) {
@@ -478,7 +478,7 @@
}
private boolean checkTotemDeathProtection(DamageSource damagesource) {
@@ -1328,19 +1555,32 @@
@@ -1346,19 +1573,32 @@
EnumHand[] aenumhand = EnumHand.values();
int i = aenumhand.length;
@@ -515,7 +515,7 @@
EntityPlayer entityplayer = (EntityPlayer) this;
entityplayer.awardStat(StatisticList.ITEM_USED.get(Items.TOTEM_OF_UNDYING));
@@ -1349,14 +1589,16 @@
@@ -1367,14 +1607,16 @@
}
this.setHealth(1.0F);
@@ -537,7 +537,7 @@
}
}
@@ -1463,14 +1705,22 @@
@@ -1481,14 +1723,22 @@
IBlockData iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
@@ -562,7 +562,7 @@
this.level().addFreshEntity(entityitem);
}
}
@@ -1490,21 +1740,40 @@
@@ -1508,21 +1758,40 @@
boolean flag = this.lastHurtByPlayerTime > 0;
@@ -606,7 +606,7 @@
}
@@ -1533,13 +1802,25 @@
@@ -1551,13 +1820,25 @@
}
public void knockback(double d0, double d1, double d2) {
@@ -635,7 +635,7 @@
}
}
@@ -1596,6 +1877,28 @@
@@ -1614,6 +1895,28 @@
return itemstack.getEatingSound();
}
@@ -664,7 +664,7 @@
public Optional<BlockPosition> getLastClimbablePos() {
return this.lastClimbablePos;
}
@@ -1642,9 +1945,14 @@
@@ -1669,9 +1972,14 @@
int i = this.calculateFallDamage(f, f1);
if (i > 0) {
@@ -680,16 +680,16 @@
return true;
} else {
return flag;
@@ -1696,7 +2004,7 @@
@@ -1741,7 +2049,7 @@
protected float getDamageAfterArmorAbsorb(DamageSource damagesource, float f) {
if (!damagesource.is(DamageTypeTags.BYPASSES_ARMOR)) {
- this.hurtArmor(damagesource, f);
+ // this.hurtArmor(damagesource, f); // CraftBukkit - Moved into actuallyHurt(DamageSource, float)
f = CombatMath.getDamageAfterAbsorb(f, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
f = CombatMath.getDamageAfterAbsorb(f, damagesource, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
}
@@ -1709,7 +2017,8 @@
@@ -1754,7 +2062,8 @@
} else {
int i;
@@ -699,7 +699,7 @@
i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
@@ -1742,16 +2051,125 @@
@@ -1787,16 +2096,125 @@
}
}
@@ -746,7 +746,7 @@
+ };
+ float armorModifier = armor.apply((double) f).floatValue();
+ f += armorModifier;
+
+ Function<Double, Double> resistance = new Function<Double, Double>() {
+ @Override
+ public Double apply(Double f) {
@@ -805,7 +805,7 @@
+ if (damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
+ this.hurtHelmet(damagesource, f);
+ }
+
+ // Apply damage to armor
+ if (!damagesource.is(DamageTypeTags.BYPASSES_ARMOR)) {
+ float armorDamage = (float) (event.getDamage() + event.getDamage(DamageModifier.BLOCKING) + event.getDamage(DamageModifier.HARD_HAT));
@@ -833,7 +833,7 @@
if (f2 > 0.0F && f2 < 3.4028235E37F) {
Entity entity = damagesource.getEntity();
@@ -1762,13 +2180,47 @@
@@ -1807,13 +2225,47 @@
}
}
@@ -883,7 +883,7 @@
}
public CombatTracker getCombatTracker() {
@@ -1793,8 +2245,18 @@
@@ -1838,8 +2290,18 @@
}
public final void setArrowCount(int i) {
@@ -903,7 +903,7 @@
public final int getStingerCount() {
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
@@ -2036,6 +2498,12 @@
@@ -2075,6 +2537,12 @@
public abstract ItemStack getItemBySlot(EnumItemSlot enumitemslot);
@@ -913,10 +913,10 @@
+ }
+ // CraftBukkit end
+
@Override
public abstract void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
@@ -2270,6 +2738,7 @@
public Iterable<ItemStack> getHandSlots() {
@@ -2328,6 +2796,7 @@
}
if (this.onGround() && !this.level().isClientSide) {
@@ -924,7 +924,7 @@
this.setSharedFlag(7, false);
}
} else {
@@ -2440,7 +2909,7 @@
@@ -2498,7 +2967,7 @@
}
}
@@ -933,8 +933,8 @@
if (this.tickCount % 20 == 0) {
this.getCombatTracker().recheckStatus();
}
@@ -2537,7 +3006,7 @@
this.refreshDirtyAttributes();
@@ -2602,7 +3071,7 @@
}
- public void detectEquipmentUpdates() {
@@ -942,7 +942,7 @@
Map<EnumItemSlot, ItemStack> map = this.collectEquipmentChanges();
if (map != null) {
@@ -2839,6 +3308,7 @@
@@ -2924,6 +3393,7 @@
}
if (!this.level().isClientSide) {
@@ -950,7 +950,7 @@
this.setSharedFlag(7, flag);
}
@@ -3029,14 +3499,21 @@
@@ -3114,14 +3584,21 @@
@Override
public boolean isPickable() {
@@ -974,7 +974,7 @@
@Override
public float getYHeadRot() {
return this.yHeadRot;
@@ -3231,7 +3708,26 @@
@@ -3314,7 +3791,26 @@
} else {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
this.triggerItemUseEffects(this.useItem, 16);
@@ -1002,7 +1002,7 @@
if (itemstack != this.useItem) {
this.setItemInHand(enumhand, itemstack);
@@ -3309,6 +3805,12 @@
@@ -3392,6 +3888,12 @@
}
public boolean randomTeleport(double d0, double d1, double d2, boolean flag) {
@@ -1015,7 +1015,7 @@
double d3 = this.getX();
double d4 = this.getY();
double d5 = this.getZ();
@@ -3333,16 +3835,41 @@
@@ -3416,16 +3918,41 @@
}
if (flag2) {
@@ -1060,7 +1060,7 @@
} else {
if (flag) {
world.broadcastEntityEvent(this, (byte) 46);
@@ -3354,7 +3881,7 @@
@@ -3437,7 +3964,7 @@
entitycreature.getNavigation().stop();
}
@@ -1069,7 +1069,7 @@
}
}
@@ -3443,7 +3970,7 @@
@@ -3530,7 +4057,7 @@
}
public void stopSleeping() {
@@ -1078,7 +1078,7 @@
World world = this.level();
java.util.Objects.requireNonNull(world);
@@ -3477,7 +4004,7 @@
@@ -3564,7 +4091,7 @@
@Nullable
public EnumDirection getBedOrientation() {
@@ -1087,12 +1087,12 @@
return blockposition != null ? BlockBed.getBedOrientation(this.level(), blockposition) : null;
}
@@ -3525,7 +4052,7 @@
Pair<MobEffect, Float> pair = (Pair) iterator.next();
@@ -3600,7 +4127,7 @@
FoodInfo.b foodinfo_b = (FoodInfo.b) iterator.next();
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {
- entityliving.addEffect(new MobEffect((MobEffect) pair.getFirst()));
+ entityliving.addEffect(new MobEffect((MobEffect) pair.getFirst()), EntityPotionEffectEvent.Cause.FOOD); // CraftBukkit
if (this.random.nextFloat() < foodinfo_b.probability()) {
- this.addEffect(foodinfo_b.effect());
+ this.addEffect(foodinfo_b.effect(), EntityPotionEffectEvent.Cause.FOOD); // CraftBukkit
}
}
}

View File

@@ -1,24 +1,24 @@
--- a/net/minecraft/world/entity/EntityTypes.java
+++ b/net/minecraft/world/entity/EntityTypes.java
@@ -160,6 +160,7 @@
import net.minecraft.world.phys.AxisAlignedBB;
@@ -168,6 +168,7 @@
import net.minecraft.world.phys.Vec3D;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapes;
+import org.bukkit.event.entity.CreatureSpawnEvent;
import org.slf4j.Logger;
public class EntityTypes<T extends Entity> implements FeatureElement, EntityTypeTest<Entity, T> {
@@ -170,7 +171,7 @@
private static final float MAGIC_HORSE_WIDTH = 1.3964844F;
@@ -178,7 +179,7 @@
private static final int DISPLAY_TRACKING_RANGE = 10;
public static final EntityTypes<Allay> ALLAY = register("allay", EntityTypes.Builder.of(Allay::new, EnumCreatureType.CREATURE).sized(0.35F, 0.6F).clientTrackingRange(8).updateInterval(2));
- 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));
@@ -313,8 +314,8 @@
private final EntitySize dimensions;
public static final EntityTypes<Allay> ALLAY = register("allay", EntityTypes.Builder.of(Allay::new, EnumCreatureType.CREATURE).sized(0.35F, 0.6F).eyeHeight(0.36F).ridingOffset(0.04F).clientTrackingRange(8).updateInterval(2));
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<Armadillo> ARMADILLO = register("armadillo", EntityTypes.Builder.of(Armadillo::new, EnumCreatureType.CREATURE).sized(0.7F, 0.65F).eyeHeight(0.26F).clientTrackingRange(10));
+ public static final EntityTypes<Armadillo> ARMADILLO = register("armadillo", EntityTypes.Builder.of(Armadillo::new, EnumCreatureType.CREATURE).sized(0.7F, 0.65F).eyeHeight(0.26F).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).eyeHeight(1.7775F).clientTrackingRange(10));
public static final EntityTypes<EntityTippedArrow> ARROW = register("arrow", EntityTypes.Builder.of(EntityTippedArrow::new, EnumCreatureType.MISC).sized(0.5F, 0.5F).eyeHeight(0.13F).clientTrackingRange(4).updateInterval(20));
public static final EntityTypes<Axolotl> AXOLOTL = register("axolotl", EntityTypes.Builder.of(Axolotl::new, EnumCreatureType.AXOLOTLS).sized(0.75F, 0.42F).eyeHeight(0.2751F).clientTrackingRange(10));
@@ -325,8 +326,8 @@
private final float spawnDimensionsScale;
private final FeatureFlagSet requiredFeatures;
- private static <T extends Entity> EntityTypes<T> register(String s, EntityTypes.Builder<T> entitytypes_builder) {
@@ -28,10 +28,11 @@
}
public static MinecraftKey getKey(EntityTypes<?> entitytypes) {
@@ -342,8 +343,15 @@
@@ -355,7 +356,14 @@
@Nullable
public T spawn(WorldServer worldserver, @Nullable ItemStack itemstack, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
- Consumer consumer;
+ // CraftBukkit start
+ return this.spawn(worldserver, itemstack, entityhuman, blockposition, enummobspawn, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
+ }
@@ -39,53 +40,51 @@
+ @Nullable
+ public T spawn(WorldServer worldserver, @Nullable ItemStack itemstack, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
+ // CraftBukkit end
NBTTagCompound nbttagcompound;
- Consumer consumer;
+ Consumer<T> consumer; // CraftBukkit - decompile error
if (itemstack != null) {
nbttagcompound = itemstack.getTag();
@@ -354,7 +362,7 @@
nbttagcompound = null;
consumer = createDefaultStackConfig(worldserver, itemstack, entityhuman);
@@ -364,7 +372,7 @@
};
}
- return this.spawn(worldserver, nbttagcompound, consumer, blockposition, enummobspawn, flag, flag1);
+ return this.spawn(worldserver, nbttagcompound, consumer, blockposition, enummobspawn, flag, flag1, spawnReason); // CraftBukkit
- return this.spawn(worldserver, consumer, blockposition, enummobspawn, flag, flag1);
+ return this.spawn(worldserver, consumer, blockposition, enummobspawn, flag, flag1, spawnReason); // CraftBukkit
}
public static <T extends Entity> Consumer<T> createDefaultStackConfig(WorldServer worldserver, ItemStack itemstack, @Nullable EntityHuman entityhuman) {
@@ -376,21 +384,37 @@
NBTTagCompound nbttagcompound = itemstack.getTag();
@@ -388,21 +396,37 @@
CustomData customdata = (CustomData) itemstack.getOrDefault(DataComponents.ENTITY_DATA, CustomData.EMPTY);
return nbttagcompound != null ? consumer.andThen((entity) -> {
- updateCustomEntityTag(worldserver, entityhuman, entity, nbttagcompound);
+ try { updateCustomEntityTag(worldserver, entityhuman, entity, nbttagcompound); } catch (Throwable t) { LOGGER.warn("Error loading spawn egg NBT", t); } // CraftBukkit - SPIGOT-5665
return !customdata.isEmpty() ? consumer.andThen((entity) -> {
- updateCustomEntityTag(worldserver, entityhuman, entity, customdata);
+ try { updateCustomEntityTag(worldserver, entityhuman, entity, customdata); } catch (Throwable t) { LOGGER.warn("Error loading spawn egg NBT", t); } // CraftBukkit - SPIGOT-5665
}) : consumer;
}
@Nullable
public T spawn(WorldServer worldserver, BlockPosition blockposition, EnumMobSpawn enummobspawn) {
- return this.spawn(worldserver, (NBTTagCompound) null, (Consumer) null, blockposition, enummobspawn, false, false);
- return this.spawn(worldserver, (Consumer) null, blockposition, enummobspawn, false, false);
+ // CraftBukkit start
+ return this.spawn(worldserver, blockposition, enummobspawn, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
+ }
+
+ @Nullable
+ public T spawn(WorldServer worldserver, BlockPosition blockposition, EnumMobSpawn enummobspawn, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
+ return this.spawn(worldserver, (NBTTagCompound) null, null, blockposition, enummobspawn, false, false, spawnReason); // CraftBukkit - decompile error
+ return this.spawn(worldserver, (Consumer<T>) null, blockposition, enummobspawn, false, false, spawnReason); // CraftBukkit - decompile error
+ // CraftBukkit end
}
@Nullable
public T spawn(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable Consumer<T> consumer, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
public T spawn(WorldServer worldserver, @Nullable Consumer<T> consumer, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
+ // CraftBukkit start
+ return this.spawn(worldserver, nbttagcompound, consumer, blockposition, enummobspawn, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
+ return this.spawn(worldserver, consumer, blockposition, enummobspawn, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
+ }
+
+ @Nullable
+ public T spawn(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable Consumer<T> consumer, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
+ public T spawn(WorldServer worldserver, @Nullable Consumer<T> consumer, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
+ // CraftBukkit end
T t0 = this.create(worldserver, nbttagcompound, consumer, blockposition, enummobspawn, flag, flag1);
T t0 = this.create(worldserver, consumer, blockposition, enummobspawn, flag, flag1);
if (t0 != null) {
- worldserver.addFreshEntityWithPassengers(t0);
@@ -95,7 +94,7 @@
}
return t0;
@@ -577,7 +601,7 @@
@@ -583,7 +607,7 @@
}
return entity;
@@ -104,7 +103,7 @@
}
public static Stream<Entity> loadEntitiesRecursive(final List<? extends NBTBase> list, final World world) {
@@ -638,7 +662,7 @@
@@ -644,7 +668,7 @@
@Nullable
public T tryCast(Entity entity) {
@@ -113,7 +112,7 @@
}
@Override
@@ -673,7 +697,7 @@
@@ -681,7 +705,7 @@
this.canSpawnFarFromPlayer = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC;
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/IEntityAngerable.java
+++ b/net/minecraft/world/entity/IEntityAngerable.java
@@ -108,7 +108,7 @@
@@ -114,7 +114,7 @@
default void stopBeingAngry() {
this.setLastHurtByMob((EntityLiving) null);
this.setPersistentAngerTarget((UUID) null);
@@ -9,7 +9,7 @@
this.setRemainingPersistentAngerTime(0);
}
@@ -121,6 +121,8 @@
@@ -127,6 +127,8 @@
void setTarget(@Nullable EntityLiving entityliving);

View File

@@ -22,10 +22,10 @@
Logger logger;
if (nbttagcompound.contains("attack")) {
@@ -143,12 +149,19 @@
@@ -142,9 +148,16 @@
@Override
public boolean skipAttackInteraction(Entity entity) {
if (entity instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) entity;
if (entity instanceof EntityHuman entityhuman) {
+ // CraftBukkit start
+ DamageSource source = entityhuman.damageSources().playerAttack(entityhuman);
+ EntityDamageEvent event = CraftEventFactory.callNonLivingEntityDamageEvent(this, source, 1.0F, false);
@@ -33,11 +33,8 @@
+ return true;
+ }
+ // CraftBukkit end
this.attack = new Interaction.PlayerAction(entityhuman.getUUID(), this.level().getGameTime());
if (entityhuman instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) entityhuman;
if (entityhuman instanceof EntityPlayer entityplayer) {
- CriterionTriggers.PLAYER_HURT_ENTITY.trigger(entityplayer, this, entityhuman.damageSources().generic(), 1.0F, 1.0F, false);
+ CriterionTriggers.PLAYER_HURT_ENTITY.trigger(entityplayer, this, source, (float) event.getFinalDamage(), 1.0F, false); // CraftBukkit
}

View File

@@ -4,4 +4,4 @@
+// mc-dev import
package net.minecraft.world.entity.ai.attributes;
import net.minecraft.core.IRegistry;
import net.minecraft.core.Holder;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/behavior/BehaviorFarm.java
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorFarm.java
@@ -26,6 +26,11 @@
@@ -27,6 +27,11 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.gameevent.GameEvent;
@@ -12,7 +12,7 @@
public class BehaviorFarm extends Behavior<EntityVillager> {
private static final int HARVEST_DURATION = 200;
@@ -81,8 +86,8 @@
@@ -82,8 +87,8 @@
protected void start(WorldServer worldserver, EntityVillager entityvillager, long i) {
if (i > this.nextOkStartTime && this.aboveFarmlandPos != null) {
@@ -23,7 +23,7 @@
}
}
@@ -102,7 +107,9 @@
@@ -103,7 +108,9 @@
Block block1 = worldserver.getBlockState(this.aboveFarmlandPos.below()).getBlock();
if (block instanceof BlockCrops && ((BlockCrops) block).isMaxAge(iblockdata)) {
@@ -33,19 +33,19 @@
}
if (iblockdata.isAir() && block1 instanceof BlockSoil && entityvillager.hasFarmSeeds()) {
@@ -119,9 +126,11 @@
@@ -120,9 +127,11 @@
ItemBlock itemblock = (ItemBlock) item;
IBlockData iblockdata1 = itemblock.getBlock().defaultBlockState();
+ if (CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.aboveFarmlandPos, iblockdata1)) { // CraftBukkit
worldserver.setBlockAndUpdate(this.aboveFarmlandPos, iblockdata1);
worldserver.gameEvent(GameEvent.BLOCK_PLACE, this.aboveFarmlandPos, GameEvent.a.of(entityvillager, iblockdata1));
worldserver.gameEvent((Holder) GameEvent.BLOCK_PLACE, this.aboveFarmlandPos, GameEvent.a.of(entityvillager, iblockdata1));
flag = true;
+ } // CraftBukkit
}
}
@@ -141,8 +150,8 @@
@@ -142,8 +151,8 @@
this.aboveFarmlandPos = this.getValidFarmland(worldserver);
if (this.aboveFarmlandPos != null) {
this.nextOkStartTime = i + 20L;

View File

@@ -11,8 +11,8 @@
+
public class BehaviorMakeLove extends Behavior<EntityVillager> {
private static final int INTERACT_DIST_SQR = 5;
@@ -116,11 +121,17 @@
private long birthTimestamp;
@@ -114,11 +119,17 @@
if (entityvillager2 == null) {
return Optional.empty();
} else {
@@ -33,7 +33,7 @@
worldserver.broadcastEntityEvent(entityvillager2, (byte) 12);
return Optional.of(entityvillager2);
}
@@ -129,6 +140,6 @@
@@ -127,6 +138,6 @@
private void giveBedToChild(WorldServer worldserver, EntityVillager entityvillager, BlockPosition blockposition) {
GlobalPos globalpos = GlobalPos.of(worldserver.dimension(), blockposition);

View File

@@ -8,8 +8,8 @@
+ entityliving.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorPositionEntity(entityliving1, true))); // CraftBukkit - decompile error
}
private static void setWalkAndLookTargetMemoriesToEachOther(EntityLiving entityliving, EntityLiving entityliving1, float f) {
@@ -81,8 +81,8 @@
private static void setWalkAndLookTargetMemoriesToEachOther(EntityLiving entityliving, EntityLiving entityliving1, float f, int i) {
@@ -79,8 +79,8 @@
public static void setWalkAndLookTargetMemories(EntityLiving entityliving, BehaviorPosition behaviorposition, float f, int i) {
MemoryTarget memorytarget = new MemoryTarget(behaviorposition, f, i);
@@ -20,7 +20,7 @@
}
public static void throwItem(EntityLiving entityliving, ItemStack itemstack, Vec3D vec3d) {
@@ -92,6 +92,7 @@
@@ -90,6 +90,7 @@
}
public static void throwItem(EntityLiving entityliving, ItemStack itemstack, Vec3D vec3d, Vec3D vec3d1, float f) {
@@ -28,7 +28,7 @@
double d0 = entityliving.getEyeY() - (double) f;
EntityItem entityitem = new EntityItem(entityliving.level(), entityliving.getX(), d0, entityliving.getZ(), itemstack);
@@ -101,12 +102,19 @@
@@ -99,12 +100,19 @@
vec3d2 = vec3d2.normalize().multiply(vec3d1.x, vec3d1.y, vec3d1.z);
entityitem.setDeltaMovement(vec3d2);
entityitem.setDefaultPickUpDelay();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java
+++ b/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java
@@ -30,6 +30,13 @@
@@ -31,6 +31,13 @@
import net.minecraft.world.level.pathfinder.PathfinderNormal;
import net.minecraft.world.phys.Vec3D;
@@ -14,7 +14,7 @@
public class PrepareRamNearestTarget<E extends EntityCreature> extends Behavior<E> {
public static final int TIME_OUT_DURATION = 160;
@@ -62,6 +69,13 @@
@@ -63,6 +70,13 @@
return this.ramTargeting.test(entitycreature, entityliving);
});
}).ifPresent((entityliving) -> {
@@ -28,7 +28,7 @@
this.chooseRamPosition(entitycreature, entityliving);
});
}
@@ -71,7 +85,7 @@
@@ -72,7 +86,7 @@
if (!behaviorcontroller.hasMemoryValue(MemoryModuleType.RAM_TARGET)) {
worldserver.broadcastEntityEvent(e0, (byte) 59);
@@ -37,7 +37,7 @@
}
}
@@ -82,8 +96,8 @@
@@ -83,8 +97,8 @@
protected void tick(WorldServer worldserver, E e0, long i) {
if (!this.ramCandidate.isEmpty()) {
@@ -48,7 +48,7 @@
boolean flag = !((PrepareRamNearestTarget.a) this.ramCandidate.get()).getTarget().blockPosition().equals(((PrepareRamNearestTarget.a) this.ramCandidate.get()).getTargetPosition());
if (flag) {
@@ -100,7 +114,7 @@
@@ -101,7 +115,7 @@
}
if (i - (Long) this.reachedRamPositionTimestamp.get() >= (long) this.ramPrepareTime) {
@@ -57,7 +57,7 @@
worldserver.playSound((EntityHuman) null, (Entity) e0, (SoundEffect) this.getPrepareRamSound.apply(e0), SoundCategory.NEUTRAL, 1.0F, e0.getVoicePitch());
this.ramCandidate = Optional.empty();
}
@@ -152,7 +166,7 @@
@@ -153,7 +167,7 @@
}
NavigationAbstract navigationabstract = entitycreature.getNavigation();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/behavior/TryLaySpawnOnWaterNearLand.java
+++ b/net/minecraft/world/entity/ai/behavior/TryLaySpawnOnWaterNearLand.java
@@ -38,6 +38,12 @@
@@ -39,6 +39,12 @@
if (worldserver.getBlockState(blockposition2).isAir()) {
IBlockData iblockdata = block.defaultBlockState();
@@ -11,5 +11,5 @@
+ }
+ // CraftBukkit end
worldserver.setBlock(blockposition2, iblockdata, 3);
worldserver.gameEvent(GameEvent.BLOCK_PLACE, blockposition2, GameEvent.a.of(entityliving, iblockdata));
worldserver.gameEvent((Holder) GameEvent.BLOCK_PLACE, blockposition2, GameEvent.a.of(entityliving, iblockdata));
worldserver.playSound((EntityHuman) null, (Entity) entityliving, SoundEffects.FROG_LAY_SPAWN, SoundCategory.BLOCKS, 1.0F, 1.0F);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalFollowOwner.java
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalFollowOwner.java
@@ -14,6 +14,12 @@
@@ -15,6 +15,12 @@
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.level.pathfinder.PathfinderNormal;
@@ -13,7 +13,7 @@
public class PathfinderGoalFollowOwner extends PathfinderGoal {
public static final int TELEPORT_WHEN_DISTANCE_IS = 12;
@@ -122,7 +128,14 @@
@@ -123,7 +129,14 @@
} else if (!this.canTeleportTo(new BlockPosition(i, j, k))) {
return false;
} else {

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalRemoveBlock.java
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalRemoveBlock.java
@@ -21,6 +21,11 @@
import net.minecraft.world.level.chunk.IChunkAccess;
import net.minecraft.world.level.chunk.status.ChunkStatus;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalTempt.java
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalTempt.java
@@ -9,6 +9,13 @@
@@ -10,6 +10,13 @@
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.item.crafting.RecipeItemStack;
import net.minecraft.world.item.ItemStack;
+// CraftBukkit start
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
@@ -14,7 +14,7 @@
public class PathfinderGoalTempt extends PathfinderGoal {
private static final PathfinderTargetCondition TEMP_TARGETING = PathfinderTargetCondition.forNonCombat().range(10.0D).ignoreLineOfSight();
@@ -21,7 +28,7 @@
@@ -22,7 +29,7 @@
private double pRotX;
private double pRotY;
@Nullable
@@ -22,8 +22,8 @@
+ protected EntityLiving player; // CraftBukkit
private int calmDown;
private boolean isRunning;
private final RecipeItemStack items;
@@ -43,6 +50,15 @@
private final Predicate<ItemStack> items;
@@ -44,6 +51,15 @@
return false;
} else {
this.player = this.mob.level().getNearestPlayer(this.targetingConditions, this.mob);

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/ai/sensing/TemptingSensor.java
+++ b/net/minecraft/world/entity/ai/sensing/TemptingSensor.java
@@ -18,6 +18,14 @@
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.RecipeItemStack;
+// CraftBukkit start
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/village/VillageSiege.java
+++ b/net/minecraft/world/entity/ai/village/VillageSiege.java
@@ -122,7 +122,7 @@
@@ -121,7 +121,7 @@
}
entityzombie.moveTo(vec3d.x, vec3d.y, vec3d.z, worldserver.random.nextFloat() * 360.0F, 0.0F);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ambient/EntityBat.java
+++ b/net/minecraft/world/entity/ambient/EntityBat.java
@@ -29,6 +29,10 @@
@@ -27,6 +27,10 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.Vec3D;
@@ -11,7 +11,7 @@
public class EntityBat extends EntityAmbient {
public static final float FLAP_LENGTH_SECONDS = 0.5F;
@@ -143,13 +147,13 @@
@@ -141,13 +145,13 @@
this.yHeadRot = (float) this.random.nextInt(360);
}
@@ -27,7 +27,7 @@
this.setResting(false);
if (!flag) {
this.level().levelEvent((EntityHuman) null, 1025, blockposition, 0);
@@ -176,7 +180,7 @@
@@ -174,7 +178,7 @@
this.zza = 0.5F;
this.setYRot(this.getYRot() + f1);
@@ -36,7 +36,7 @@
this.setResting(true);
}
}
@@ -201,7 +205,7 @@
@@ -199,7 +203,7 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/animal/Bucketable.java
+++ b/net/minecraft/world/entity/animal/Bucketable.java
@@ -15,6 +15,15 @@
import net.minecraft.world.item.Items;
@@ -17,6 +17,15 @@
import net.minecraft.world.item.component.CustomData;
import net.minecraft.world.level.World;
+// CraftBukkit start
@@ -16,7 +16,7 @@
public interface Bucketable {
boolean fromBucket();
@@ -94,10 +103,22 @@
@@ -93,10 +102,22 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.getItem() == Items.WATER_BUCKET && t0.isAlive()) {
@@ -32,7 +32,7 @@
+ if (playerBucketFishEvent.isCancelled()) {
+ ((EntityPlayer) entityhuman).containerMenu.sendAllDataToRemote(); // We need to update inventory to resync client's bucket
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutSpawnEntity(t0)); // We need to play out these packets as the client assumes the fish is gone
+ t0.getEntityData().refresh((EntityPlayer) entityhuman); // Need to send data such as the display name to client
+ t0.refreshEntityData((EntityPlayer) entityhuman); // Need to send data such as the display name to client
+ return Optional.of(EnumInteractionResult.FAIL);
+ }
+ t0.playSound(((Bucketable) t0).getPickupSound(), 1.0F, 1.0F);
@@ -40,7 +40,7 @@
ItemStack itemstack2 = ItemLiquidUtil.createFilledResult(itemstack, entityhuman, itemstack1, false);
entityhuman.setItemInHand(enumhand, itemstack2);
@@ -107,7 +128,7 @@
@@ -106,7 +127,7 @@
CriterionTriggers.FILLED_BUCKET.trigger((EntityPlayer) entityhuman, itemstack1);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityAnimal.java
+++ b/net/minecraft/world/entity/animal/EntityAnimal.java
@@ -30,12 +30,19 @@
@@ -29,12 +29,19 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.pathfinder.PathType;
@@ -20,22 +20,25 @@
protected EntityAnimal(EntityTypes<? extends EntityAnimal> entitytypes, World world) {
super(entitytypes, world);
@@ -77,8 +84,13 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {
+ // CraftBukkit start
+ boolean result = super.hurt(damagesource, f);
+ if (result) {
this.inLove = 0;
- return super.hurt(damagesource, f);
+ }
+ return result;
+ // CraftBukkit end
}
@@ -72,9 +79,15 @@
}
@@ -172,10 +184,17 @@
@Override
- protected void actuallyHurt(DamageSource damagesource, float f) {
+ // CraftBukkit start - void -> boolean
+ public boolean actuallyHurt(DamageSource damagesource, float f) {
+ boolean result = super.actuallyHurt(damagesource, f);
+ if (!result) {
+ return result;
+ }
this.resetLove();
- super.actuallyHurt(damagesource, f);
+ return result;
+ // CraftBukkit end
}
@Override
@@ -162,10 +175,17 @@
}
public void setInLove(@Nullable EntityHuman entityhuman) {
@@ -54,7 +57,7 @@
this.level().broadcastEntityEvent(this, (byte) 18);
}
@@ -217,12 +236,29 @@
@@ -207,12 +227,29 @@
if (entityageable != null) {
entityageable.setBaby(true);
entityageable.moveTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F);
@@ -86,7 +89,7 @@
Optional.ofNullable(this.getLoveCause()).or(() -> {
return Optional.ofNullable(entityanimal.getLoveCause());
}).ifPresent((entityplayer) -> {
@@ -235,7 +271,11 @@
@@ -225,7 +262,11 @@
entityanimal.resetLove();
worldserver.broadcastEntityEvent(this, (byte) 18);
if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityBee.java
+++ b/net/minecraft/world/entity/animal/EntityBee.java
@@ -90,6 +90,12 @@
@@ -86,6 +86,12 @@
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.phys.Vec3D;
@@ -13,7 +13,7 @@
public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityBird {
public static final float FLAP_DEGREES_PER_TICK = 120.32113F;
@@ -187,12 +193,19 @@
@@ -185,12 +191,19 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
@@ -27,15 +27,26 @@
super.addAdditionalSaveData(nbttagcompound);
- if (this.hasHive()) {
+ if (includeAll && this.hasHive()) { // CraftBukkit - selectively save hive
nbttagcompound.put("HivePos", GameProfileSerializer.writeBlockPos(this.getHivePos()));
nbttagcompound.put("hive_pos", GameProfileSerializer.writeBlockPos(this.getHivePos()));
}
- if (this.hasSavedFlowerPos()) {
+ if (includeAll && this.hasSavedFlowerPos()) { // CraftBukkit - selectively save flower
nbttagcompound.put("FlowerPos", GameProfileSerializer.writeBlockPos(this.getSavedFlowerPos()));
nbttagcompound.put("flower_pos", GameProfileSerializer.writeBlockPos(this.getSavedFlowerPos()));
}
@@ -242,7 +255,7 @@
@@ -204,8 +217,8 @@
@Override
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
- this.hivePos = (BlockPosition) GameProfileSerializer.readBlockPos(nbttagcompound, "hive_pos").orElse((Object) null);
- this.savedFlowerPos = (BlockPosition) GameProfileSerializer.readBlockPos(nbttagcompound, "flower_pos").orElse((Object) null);
+ this.hivePos = (BlockPosition) GameProfileSerializer.readBlockPos(nbttagcompound, "hive_pos").orElse(null); // CraftBukkit - decompile error
+ this.savedFlowerPos = (BlockPosition) GameProfileSerializer.readBlockPos(nbttagcompound, "flower_pos").orElse(null); // CraftBukkit - decompile error
super.readAdditionalSaveData(nbttagcompound);
this.setHasNectar(nbttagcompound.getBoolean("HasNectar"));
this.setHasStung(nbttagcompound.getBoolean("HasStung"));
@@ -232,7 +245,7 @@
}
if (b0 > 0) {
@@ -44,7 +55,7 @@
}
}
@@ -640,11 +653,14 @@
@@ -625,11 +638,14 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {
@@ -61,7 +72,7 @@
}
}
@@ -999,7 +1015,7 @@
@@ -981,7 +997,7 @@
e() {
super();
@@ -70,7 +81,7 @@
this.blacklistedTargets = Lists.newArrayList();
this.setFlags(EnumSet.of(PathfinderGoal.Type.MOVE));
}
@@ -1116,7 +1132,7 @@
@@ -1098,7 +1114,7 @@
f() {
super();
@@ -79,16 +90,16 @@
this.setFlags(EnumSet.of(PathfinderGoal.Type.MOVE));
}
@@ -1216,7 +1232,7 @@
@@ -1198,7 +1214,7 @@
}
}
- if (iblockdata1 != null) {
+ if (iblockdata1 != null && CraftEventFactory.callEntityChangeBlockEvent(EntityBee.this, blockposition, iblockdata1)) { // CraftBukkit
EntityBee.this.level().levelEvent(2005, blockposition, 0);
EntityBee.this.level().levelEvent(2011, blockposition, 15);
EntityBee.this.level().setBlockAndUpdate(blockposition, iblockdata1);
EntityBee.this.incrementNumCropsGrownSincePollination();
@@ -1289,7 +1305,7 @@
@@ -1271,7 +1287,7 @@
@Override
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
if (entityinsentient instanceof EntityBee && this.mob.hasLineOfSight(entityliving)) {
@@ -97,7 +108,7 @@
}
}
@@ -1298,7 +1314,7 @@
@@ -1280,7 +1296,7 @@
private static class c extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
c(EntityBee entitybee) {

View File

@@ -1,15 +1,28 @@
--- a/net/minecraft/world/entity/animal/EntityCat.java
+++ b/net/minecraft/world/entity/animal/EntityCat.java
@@ -413,7 +413,7 @@
}
} 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.setOrderedToSit(true);
this.level().broadcastEntityEvent(this, (byte) 7);
@@ -475,7 +475,7 @@
@@ -182,10 +182,10 @@
@Override
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.readAdditionalSaveData(nbttagcompound);
- Optional optional = Optional.ofNullable(MinecraftKey.tryParse(nbttagcompound.getString("variant"))).map((minecraftkey) -> {
+ Optional<ResourceKey<CatVariant>> optional = Optional.ofNullable(MinecraftKey.tryParse(nbttagcompound.getString("variant"))).map((minecraftkey) -> { // CraftBukkit - decompile error
return ResourceKey.create(Registries.CAT_VARIANT, minecraftkey);
});
- IRegistry iregistry = BuiltInRegistries.CAT_VARIANT;
+ IRegistry<CatVariant> iregistry = BuiltInRegistries.CAT_VARIANT; // CraftBukkit - decompile error
Objects.requireNonNull(iregistry);
optional.flatMap(iregistry::getHolder).ifPresent(this::setVariant);
@@ -462,7 +462,7 @@
}
private void tryToTame(EntityHuman entityhuman) {
- 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.setOrderedToSit(true);
this.level().broadcastEntityEvent(this, (byte) 7);
@@ -480,7 +480,7 @@
private static class PathfinderGoalTemptChance extends PathfinderGoalTempt {
@Nullable
@@ -17,8 +30,8 @@
+ private EntityLiving selectedPlayer; // CraftBukkit
private final EntityCat cat;
public PathfinderGoalTemptChance(EntityCat entitycat, double d0, RecipeItemStack recipeitemstack, boolean flag) {
@@ -616,7 +616,15 @@
public PathfinderGoalTemptChance(EntityCat entitycat, double d0, Predicate<ItemStack> predicate, boolean flag) {
@@ -621,7 +621,15 @@
while (iterator.hasNext()) {
ItemStack itemstack = (ItemStack) iterator.next();
@@ -35,7 +48,7 @@
}
}
@@ -648,10 +656,10 @@
@@ -653,10 +661,10 @@
private final EntityCat cat;
public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityChicken.java
+++ b/net/minecraft/world/entity/animal/EntityChicken.java
@@ -97,7 +97,9 @@
@@ -98,7 +98,9 @@
this.flap += this.flapping * 2.0F;
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);

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/animal/EntityCow.java
+++ b/net/minecraft/world/entity/animal/EntityCow.java
@@ -33,6 +33,12 @@
@@ -31,6 +31,12 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.state.IBlockData;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -12,8 +12,8 @@
+
public class EntityCow extends EntityAnimal {
public EntityCow(EntityTypes<? extends EntityCow> entitytypes, World world) {
@@ -85,8 +91,16 @@
private static final EntitySize BABY_DIMENSIONS = EntityTypes.COW.getDimensions().scale(0.5F).withEyeHeight(0.665F);
@@ -92,8 +98,16 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityDolphin.java
+++ b/net/minecraft/world/entity/animal/EntityDolphin.java
@@ -61,8 +61,20 @@
@@ -59,8 +59,20 @@
import net.minecraft.world.level.pathfinder.PathMode;
import net.minecraft.world.phys.Vec3D;
@@ -21,7 +21,7 @@
private static final DataWatcherObject<BlockPosition> TREASURE_POS = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.BLOCK_POS);
private static final DataWatcherObject<Boolean> GOT_FISH = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.BOOLEAN);
private static final DataWatcherObject<Integer> MOISTNESS_LEVEL = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.INT);
@@ -185,7 +197,7 @@
@@ -183,7 +195,7 @@
@Override
public int getMaxAirSupply() {
@@ -30,7 +30,7 @@
}
@Override
@@ -226,11 +238,17 @@
@@ -219,11 +231,17 @@
ItemStack itemstack = entityitem.getItem();
if (this.canHoldItem(itemstack)) {
@@ -49,7 +49,7 @@
}
}
@@ -484,7 +502,7 @@
@@ -474,7 +492,7 @@
@Override
public void start() {
@@ -58,7 +58,7 @@
}
@Override
@@ -503,7 +521,7 @@
@@ -493,7 +511,7 @@
}
if (this.player.isSwimming() && this.player.level().random.nextInt(6) == 0) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/animal/EntityFox.java
+++ b/net/minecraft/world/entity/animal/EntityFox.java
@@ -94,6 +94,10 @@
@@ -93,6 +93,10 @@
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.event.entity.EntityRemoveEvent;
@@ -11,7 +11,7 @@
public class EntityFox extends EntityAnimal implements VariantHolder<EntityFox.Type> {
private static final DataWatcherObject<Integer> DATA_TYPE_ID = DataWatcher.defineId(EntityFox.class, DataWatcherRegistry.INT);
@@ -523,7 +527,8 @@
@@ -518,7 +522,8 @@
protected void pickUpItem(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItem();
@@ -21,7 +21,7 @@
int i = itemstack.getCount();
if (i > 1) {
@@ -535,7 +540,7 @@
@@ -530,7 +535,7 @@
this.setItemSlot(EnumItemSlot.MAINHAND, itemstack.split(1));
this.setGuaranteedDrop(EnumItemSlot.MAINHAND);
this.take(entityitem, itemstack.getCount());
@@ -30,7 +30,7 @@
this.ticksSinceEaten = 0;
}
@@ -883,6 +888,16 @@
@@ -868,6 +873,16 @@
if (entityplayer1 != null && entityplayer != entityplayer1) {
entityfox.addTrustedUUID(entityplayer1.getUUID());
}
@@ -47,7 +47,7 @@
if (entityplayer2 != null) {
entityplayer2.awardStat(StatisticList.ANIMALS_BRED);
@@ -893,12 +908,14 @@
@@ -878,12 +893,14 @@
this.partner.setAge(6000);
this.animal.resetLove();
this.partner.resetLove();
@@ -66,7 +66,7 @@
}
}
@@ -1294,6 +1311,11 @@
@@ -1279,6 +1296,11 @@
int i = (Integer) iblockdata.getValue(BlockSweetBerryBush.AGE);
iblockdata.setValue(BlockSweetBerryBush.AGE, 1);
@@ -78,12 +78,12 @@
int j = 1 + EntityFox.this.level().random.nextInt(2) + (i == 3 ? 1 : 0);
ItemStack itemstack = EntityFox.this.getItemBySlot(EnumItemSlot.MAINHAND);
@@ -1451,7 +1473,7 @@
@@ -1436,7 +1458,7 @@
private EntityLiving trustedLastHurt;
private int timestamp;
- public a(Class oclass, boolean flag, boolean flag1, @Nullable Predicate predicate) {
+ public a(Class oclass, boolean flag, boolean flag1, @Nullable Predicate<EntityLiving> predicate) { // CraftBukkit - decompile error
- public a(final Class oclass, final boolean flag, final boolean flag1, @Nullable final Predicate predicate) {
+ public a(final Class oclass, final boolean flag, final boolean flag1, @Nullable final Predicate<EntityLiving> predicate) { // CraftBukkit - decompile error
super(EntityFox.this, oclass, 10, flag, flag1, predicate);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityIronGolem.java
+++ b/net/minecraft/world/entity/animal/EntityIronGolem.java
@@ -102,7 +102,7 @@
@@ -97,7 +97,7 @@
@Override
protected void doPush(Entity entity) {
if (entity instanceof IMonster && !(entity instanceof EntityCreeper) && this.getRandom().nextInt(20) == 0) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityMushroomCow.java
+++ b/net/minecraft/world/entity/animal/EntityMushroomCow.java
@@ -42,13 +42,21 @@
@@ -42,6 +42,14 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.gameevent.GameEvent;
@@ -15,14 +15,6 @@
public class EntityMushroomCow extends EntityCow implements IShearable, VariantHolder<EntityMushroomCow.Type> {
private static final DataWatcherObject<String> DATA_TYPE = DataWatcher.defineId(EntityMushroomCow.class, DataWatcherRegistry.STRING);
private static final int MUTATE_CHANCE = 1024;
private static final String TAG_STEW_EFFECTS = "stew_effects";
@Nullable
- private List<SuspiciousEffectHolder.a> stewEffects;
+ public List<SuspiciousEffectHolder.a> stewEffects;
@Nullable
private UUID lastLightningBoltUUID;
@@ -114,6 +122,11 @@
this.playSound(soundeffect, 1.0F, 1.0F);
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
@@ -35,7 +27,7 @@
this.shear(SoundCategory.PLAYERS);
this.gameEvent(GameEvent.SHEAR, entityhuman);
if (!this.level().isClientSide) {
@@ -161,7 +174,7 @@
@@ -157,7 +170,7 @@
if (entitycow != null) {
((WorldServer) this.level()).sendParticles(Particles.EXPLOSION, this.getX(), this.getY(0.5D), this.getZ(), 1, 0.0D, 0.0D, 0.0D, 0.0D);
@@ -44,7 +36,7 @@
entitycow.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
entitycow.setHealth(this.getHealth());
entitycow.yBodyRot = this.yBodyRot;
@@ -175,10 +188,25 @@
@@ -171,10 +184,25 @@
}
entitycow.setInvulnerable(this.isInvulnerable());

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityOcelot.java
+++ b/net/minecraft/world/entity/animal/EntityOcelot.java
@@ -179,7 +179,7 @@
@@ -177,7 +177,7 @@
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) {
@@ -9,7 +9,7 @@
this.setTrusting(true);
this.spawnTrustingParticles(true);
this.level().broadcastEntityEvent(this, (byte) 41);
@@ -315,10 +315,10 @@
@@ -308,10 +308,10 @@
private final EntityOcelot ocelot;
public a(EntityOcelot entityocelot, Class<T> oclass, float f, double d0, double d1) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/animal/EntityPanda.java
+++ b/net/minecraft/world/entity/animal/EntityPanda.java
@@ -67,6 +67,12 @@
@@ -72,6 +72,12 @@
import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -13,7 +13,7 @@
public class EntityPanda extends EntityAnimal {
private static final DataWatcherObject<Integer> UNHAPPY_COUNTER = DataWatcher.defineId(EntityPanda.class, DataWatcherRegistry.INT);
@@ -534,14 +540,14 @@
@@ -553,14 +559,14 @@
@Override
protected void pickUpItem(EntityItem entityitem) {
@@ -30,7 +30,7 @@
}
}
@@ -870,10 +876,10 @@
@@ -889,10 +895,10 @@
private final EntityPanda panda;
public c(EntityPanda entitypanda, Class<T> oclass, float f, double d0, double d1) {
@@ -44,7 +44,7 @@
this.panda = entitypanda;
}
@@ -1112,7 +1118,7 @@
@@ -1131,7 +1137,7 @@
@Override
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
if (entityinsentient instanceof EntityPanda && entityinsentient.isAggressive()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityParrot.java
+++ b/net/minecraft/world/entity/animal/EntityParrot.java
@@ -263,7 +263,7 @@
@@ -248,7 +248,7 @@
}
if (!this.level().isClientSide) {
@@ -9,16 +9,16 @@
this.tame(entityhuman);
this.level().broadcastEntityEvent(this, (byte) 7);
} else {
@@ -277,7 +277,7 @@
itemstack.shrink(1);
@@ -269,7 +269,7 @@
}
} else {
itemstack.consume(1, entityhuman);
- 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.hurt(this.damageSources().playerAttack(entityhuman), Float.MAX_VALUE);
}
@@ -384,7 +384,7 @@
@@ -368,7 +368,7 @@
@Override
public boolean isPushable() {
@@ -27,7 +27,7 @@
}
@Override
@@ -399,11 +399,14 @@
@@ -383,11 +383,14 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/animal/EntityPig.java
+++ b/net/minecraft/world/entity/animal/EntityPig.java
@@ -51,6 +51,11 @@
@@ -49,6 +49,11 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -12,7 +12,7 @@
public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable {
private static final DataWatcherObject<Boolean> DATA_SADDLE_ID = DataWatcher.defineId(EntityPig.class, DataWatcherRegistry.BOOLEAN);
@@ -252,8 +257,14 @@
@@ -253,8 +258,14 @@
}
entitypigzombie.setPersistenceRequired();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityPufferFish.java
+++ b/net/minecraft/world/entity/animal/EntityPufferFish.java
@@ -144,7 +144,7 @@
@@ -150,7 +150,7 @@
int i = this.getPuffState();
if (entityinsentient.hurt(this.damageSources().mobAttack(this), (float) (1 + i))) {
@@ -9,7 +9,7 @@
this.playSound(SoundEffects.PUFFER_FISH_STING, 1.0F, 1.0F);
}
@@ -159,7 +159,7 @@
@@ -165,7 +165,7 @@
((EntityPlayer) entityhuman).connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.PUFFER_FISH_STING, 0.0F));
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityRabbit.java
+++ b/net/minecraft/world/entity/animal/EntityRabbit.java
@@ -67,6 +67,10 @@
@@ -66,6 +66,10 @@
import net.minecraft.world.level.pathfinder.PathEntity;
import net.minecraft.world.phys.Vec3D;
@@ -11,7 +11,7 @@
public class EntityRabbit extends EntityAnimal implements VariantHolder<EntityRabbit.Variant> {
public static final double STROLL_SPEED_MOD = 0.6D;
@@ -89,7 +93,6 @@
@@ -88,7 +92,6 @@
super(entitytypes, world);
this.jumpControl = new EntityRabbit.ControllerJumpRabbit(this);
this.moveControl = new EntityRabbit.ControllerMoveRabbit(this);
@@ -19,7 +19,7 @@
}
@Override
@@ -577,9 +580,19 @@
@@ -574,9 +577,19 @@
int i = (Integer) iblockdata.getValue(BlockCarrots.AGE);
if (i == 0) {
@@ -37,5 +37,5 @@
+ }
+ // CraftBukkit end
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockCarrots.AGE, i - 1), 2);
world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of((Entity) this.rabbit));
world.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of((Entity) this.rabbit));
world.levelEvent(2001, blockposition, Block.getId(iblockdata));

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/animal/EntitySheep.java
+++ b/net/minecraft/world/entity/animal/EntitySheep.java
@@ -66,6 +66,14 @@
@@ -64,6 +64,14 @@
import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.LootTables;
import org.joml.Vector3f;
+// CraftBukkit start
+import net.minecraft.world.inventory.InventoryCraftResult;
@@ -15,7 +15,7 @@
public class EntitySheep extends EntityAnimal implements IShearable {
private static final int EAT_ANIMATION_TICKS = 40;
@@ -246,6 +254,11 @@
@@ -251,6 +259,11 @@
if (itemstack.is(Items.SHEARS)) {
if (!this.level().isClientSide && this.readyForShearing()) {
@@ -26,8 +26,8 @@
+ // CraftBukkit end
this.shear(SoundCategory.PLAYERS);
this.gameEvent(GameEvent.SHEAR, entityhuman);
itemstack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
@@ -267,7 +280,9 @@
itemstack.hurtAndBreak(1, entityhuman, getSlotForHand(enumhand));
@@ -270,7 +283,9 @@
int i = 1 + this.random.nextInt(3);
for (int j = 0; j < i; ++j) {
@@ -37,7 +37,7 @@
if (entityitem != null) {
entityitem.setDeltaMovement(entityitem.getDeltaMovement().add((double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (this.random.nextFloat() * 0.05F), (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F)));
@@ -360,6 +375,12 @@
@@ -363,6 +378,12 @@
@Override
public void ate() {
@@ -50,7 +50,7 @@
super.ate();
this.setSheared(false);
if (this.isBaby()) {
@@ -379,7 +400,7 @@
@@ -382,7 +403,7 @@
EnumColor enumcolor = ((EntitySheep) entityanimal).getColor();
EnumColor enumcolor1 = ((EntitySheep) entityanimal1).getColor();
InventoryCrafting inventorycrafting = makeContainer(enumcolor, enumcolor1);
@@ -59,7 +59,7 @@
return ((RecipeCrafting) recipeholder.value()).assemble(inventorycrafting, this.level().registryAccess());
}).map(ItemStack::getItem);
@@ -402,10 +423,18 @@
@@ -405,10 +426,18 @@
public boolean stillValid(EntityHuman entityhuman) {
return false;
}
@@ -77,4 +77,4 @@
+ transientcraftingcontainer.resultInventory = new InventoryCraftResult(); // CraftBukkit - add result slot for event
return transientcraftingcontainer;
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntitySnowman.java
+++ b/net/minecraft/world/entity/animal/EntitySnowman.java
@@ -41,6 +41,10 @@
@@ -40,6 +40,10 @@
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.phys.Vec3D;
@@ -11,7 +11,7 @@
public class EntitySnowman extends EntityGolem implements IShearable, IRangedEntity {
private static final DataWatcherObject<Byte> DATA_PUMPKIN_ID = DataWatcher.defineId(EntitySnowman.class, DataWatcherRegistry.BYTE);
@@ -97,7 +101,7 @@
@@ -95,7 +99,7 @@
super.aiStep();
if (!this.level().isClientSide) {
if (this.level().getBiome(this.blockPosition()).is(BiomeTags.SNOW_GOLEM_MELTS)) {
@@ -20,7 +20,7 @@
}
if (!this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
@@ -113,7 +117,11 @@
@@ -111,7 +115,11 @@
BlockPosition blockposition = new BlockPosition(j, k, l);
if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
@@ -30,10 +30,10 @@
+ continue;
+ }
+ // CraftBukkit end
this.level().gameEvent(GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(this, iblockdata));
this.level().gameEvent((Holder) GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(this, iblockdata));
}
}
@@ -145,6 +153,11 @@
@@ -138,6 +146,11 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
@@ -45,12 +45,12 @@
this.shear(SoundCategory.PLAYERS);
this.gameEvent(GameEvent.SHEAR, entityhuman);
if (!this.level().isClientSide) {
@@ -164,7 +177,9 @@
@@ -155,7 +168,9 @@
this.level().playSound((EntityHuman) null, (Entity) this, SoundEffects.SNOW_GOLEM_SHEAR, soundcategory, 1.0F, 1.0F);
if (!this.level().isClientSide()) {
this.setPumpkin(false);
+ this.forceDrops = true; // CraftBukkit
this.spawnAtLocation(new ItemStack(Items.CARVED_PUMPKIN), 1.7F);
this.spawnAtLocation(new ItemStack(Items.CARVED_PUMPKIN), this.getEyeHeight());
+ this.forceDrops = false; // CraftBukkit
}

View File

@@ -1,16 +1,16 @@
--- a/net/minecraft/world/entity/animal/EntityTurtle.java
+++ b/net/minecraft/world/entity/animal/EntityTurtle.java
@@ -307,7 +307,9 @@
@@ -305,7 +305,9 @@
protected void ageBoundaryReached() {
super.ageBoundaryReached();
if (!this.isBaby() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
+ this.forceDrops = true; // CraftBukkit
this.spawnAtLocation(Items.SCUTE, 1);
this.spawnAtLocation(Items.TURTLE_SCUTE, 1);
+ this.forceDrops = false; // CraftBukkit
}
}
@@ -334,7 +336,7 @@
@@ -332,7 +334,7 @@
@Override
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
@@ -19,7 +19,7 @@
}
@Override
@@ -491,12 +493,14 @@
@@ -489,12 +491,14 @@
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
World world = this.turtle.level();
@@ -29,7 +29,7 @@
IBlockData iblockdata = (IBlockData) Blocks.TURTLE_EGG.defaultBlockState().setValue(BlockTurtleEgg.EGGS, this.turtle.random.nextInt(4) + 1);
world.setBlock(blockposition1, iblockdata, 3);
world.gameEvent(GameEvent.BLOCK_PLACE, blockposition1, GameEvent.a.of(this.turtle, iblockdata));
world.gameEvent((Holder) GameEvent.BLOCK_PLACE, blockposition1, GameEvent.a.of(this.turtle, iblockdata));
+ } // CraftBukkit
this.turtle.setHasEgg(false);
this.turtle.setLayingEgg(false);

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/animal/EntityWolf.java
+++ b/net/minecraft/world/entity/animal/EntityWolf.java
@@ -70,6 +70,12 @@
@@ -88,6 +88,12 @@
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.event.entity.EntityRegainHealthEvent;
@@ -10,67 +10,77 @@
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+// CraftBukkit end
+
public class EntityWolf extends EntityTameableAnimal implements IEntityAngerable {
public class EntityWolf extends EntityTameableAnimal implements IEntityAngerable, VariantHolder<Holder<WolfVariant>> {
private static final DataWatcherObject<Boolean> DATA_INTERESTED_ID = DataWatcher.defineId(EntityWolf.class, DataWatcherRegistry.BOOLEAN);
@@ -298,15 +304,19 @@
@@ -350,18 +356,21 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {
Entity entity = damagesource.getEntity();
- if (!this.level().isClientSide) {
- this.setOrderedToSit(false);
- }
+ // CraftBukkit - move diff down
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
f = (f + 1.0F) / 2.0F;
}
- return super.hurt(damagesource, f);
+ // CraftBukkit start
+ boolean result = super.hurt(damagesource, f);
+ if (!this.level().isClientSide && result) {
+ this.setOrderedToSit(false);
+ }
+ return result;
+ // CraftBukkit end
+ // CraftBukkit end
this.setOrderedToSit(false);
}
- return super.hurt(damagesource, f);
+ return result; // CraftBukkit
}
}
@@ -326,7 +336,7 @@
super.setTame(flag);
if (flag) {
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(20.0D);
- this.setHealth(20.0F);
+ this.setHealth(this.getMaxHealth()); // CraftBukkit - 20.0 -> getMaxHealth()
@Override
- protected void actuallyHurt(DamageSource damagesource, float f) {
+ public boolean actuallyHurt(DamageSource damagesource, float f) { // CraftBukkit - void -> boolean
if (!this.canArmorAbsorb(damagesource)) {
- super.actuallyHurt(damagesource, f);
+ return super.actuallyHurt(damagesource, f); // CraftBukkit
} else {
ItemStack itemstack = this.getBodyArmorItem();
int i = itemstack.getDamageValue();
@@ -380,6 +389,7 @@
}
}
+ return false; // CraftBukkit
}
private boolean canArmorAbsorb(DamageSource damagesource) {
@@ -401,7 +411,7 @@
protected void applyTamingSideEffects() {
if (this.isTame()) {
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(40.0D);
- this.setHealth(40.0F);
+ this.setHealth(this.getMaxHealth()); // CraftBukkit - 40.0 -> getMaxHealth()
} else {
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(8.0D);
}
@@ -349,7 +359,7 @@
itemstack.shrink(1);
}
@@ -428,7 +438,7 @@
FoodInfo foodinfo = (FoodInfo) itemstack.get(DataComponents.FOOD);
float f = foodinfo != null ? (float) foodinfo.nutrition() : 1.0F;
- this.heal((float) item.getFoodProperties().getNutrition());
+ this.heal((float) item.getFoodProperties().getNutrition(), EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit
return EnumInteractionResult.SUCCESS;
- this.heal(2.0F * f);
+ this.heal(2.0F * f, EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit
return EnumInteractionResult.sidedSuccess(this.level().isClientSide());
} else {
if (item instanceof ItemDye) {
@@ -377,7 +387,7 @@
this.setOrderedToSit(!this.isOrderedToSit());
this.jumping = false;
this.navigation.stop();
- this.setTarget((EntityLiving) null);
+ this.setTarget((EntityLiving) null, EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
return EnumInteractionResult.SUCCESS;
} else {
return enuminteractionresult;
@@ -388,7 +398,8 @@
itemstack.shrink(1);
}
@@ -476,7 +486,7 @@
this.setOrderedToSit(!this.isOrderedToSit());
this.jumping = false;
this.navigation.stop();
- this.setTarget((EntityLiving) null);
+ this.setTarget((EntityLiving) null, EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
return EnumInteractionResult.SUCCESS_NO_ITEM_USED;
} else {
return enuminteractionresult;
@@ -494,7 +504,8 @@
}
- if (this.random.nextInt(3) == 0) {
+ // CraftBukkit - added event call and isCancelled check.
+ if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
this.tame(entityhuman);
this.navigation.stop();
this.setTarget((EntityLiving) null);
private void tryToTame(EntityHuman entityhuman) {
- if (this.random.nextInt(3) == 0) {
+ // CraftBukkit - added event call and isCancelled check.
+ if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
this.tame(entityhuman);
this.navigation.stop();
this.setTarget((EntityLiving) null);

View File

@@ -9,7 +9,7 @@
public Allay(EntityTypes<? extends Allay> entitytypes, World world) {
super(entitytypes, world);
@@ -110,6 +111,12 @@
this.dynamicJukeboxListener = new DynamicGameEventListener<>(new Allay.a(this.vibrationUser.getPositionSource(), GameEvent.JUKEBOX_PLAY.getNotificationRadius()));
this.dynamicJukeboxListener = new DynamicGameEventListener<>(new Allay.a(this.vibrationUser.getPositionSource(), ((GameEvent) GameEvent.JUKEBOX_PLAY.value()).notificationRadius()));
}
+ // CraftBukkit start
@@ -30,7 +30,7 @@
}
public static AttributeProvider.Builder createAttributes() {
@@ -229,7 +236,7 @@
@@ -223,7 +230,7 @@
public void aiStep() {
super.aiStep();
if (!this.level().isClientSide && this.isAlive() && this.tickCount % 10 == 0) {
@@ -39,7 +39,7 @@
}
if (this.isDancing() && this.shouldStopDancing() && this.tickCount % 20 == 0) {
@@ -299,7 +306,12 @@
@@ -293,7 +300,12 @@
ItemStack itemstack1 = this.getItemInHand(EnumHand.MAIN_HAND);
if (this.isDancing() && this.isDuplicationItem(itemstack) && this.canDuplicate()) {
@@ -53,7 +53,7 @@
this.level().broadcastEntityEvent(this, (byte) 18);
this.level().playSound(entityhuman, (Entity) this, SoundEffects.AMETHYST_BLOCK_CHIME, SoundCategory.NEUTRAL, 2.0F, 1.0F);
this.removeInteractionItem(entityhuman, itemstack);
@@ -310,7 +322,7 @@
@@ -304,7 +316,7 @@
this.setItemInHand(EnumHand.MAIN_HAND, itemstack2);
this.removeInteractionItem(entityhuman, itemstack);
this.level().playSound(entityhuman, (Entity) this, SoundEffects.ALLAY_ITEM_GIVEN, SoundCategory.NEUTRAL, 2.0F, 1.0F);
@@ -62,33 +62,33 @@
return EnumInteractionResult.SUCCESS;
} else if (!itemstack1.isEmpty() && enumhand == EnumHand.MAIN_HAND && itemstack.isEmpty()) {
this.setItemSlot(EnumItemSlot.MAINHAND, ItemStack.EMPTY);
@@ -427,6 +439,7 @@
@@ -405,6 +417,7 @@
}
private boolean shouldStopDancing() {
+ if (this.forceDancing) {return false;} // CraftBukkit
return this.jukeboxPos == null || !this.jukeboxPos.closerToCenterThan(this.position(), (double) GameEvent.JUKEBOX_PLAY.getNotificationRadius()) || !this.level().getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
return this.jukeboxPos == null || !this.jukeboxPos.closerToCenterThan(this.position(), (double) ((GameEvent) GameEvent.JUKEBOX_PLAY.value()).notificationRadius()) || !this.level().getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
}
@@ -471,7 +484,7 @@
@@ -449,7 +462,7 @@
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
this.writeInventoryToTag(nbttagcompound);
this.writeInventoryToTag(nbttagcompound, this.registryAccess());
- DataResult dataresult = VibrationSystem.a.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.vibrationData);
+ DataResult<net.minecraft.nbt.NBTBase> dataresult = VibrationSystem.a.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.vibrationData); // CraftBukkit - decompile error
Logger logger = Allay.LOGGER;
Objects.requireNonNull(logger);
@@ -487,7 +500,7 @@
@@ -465,7 +478,7 @@
super.readAdditionalSaveData(nbttagcompound);
this.readInventoryFromTag(nbttagcompound);
this.readInventoryFromTag(nbttagcompound, this.registryAccess());
if (nbttagcompound.contains("listener", 10)) {
- DataResult dataresult = VibrationSystem.a.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener")));
+ DataResult<VibrationSystem.a> dataresult = VibrationSystem.a.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener"))); // CraftBukkit - decompile error
Logger logger = Allay.LOGGER;
Objects.requireNonNull(logger);
@@ -520,7 +533,7 @@
@@ -498,7 +511,7 @@
return Allay.DUPLICATION_ITEM.test(itemstack);
}
@@ -97,7 +97,7 @@
Allay allay = (Allay) EntityTypes.ALLAY.create(this.level());
if (allay != null) {
@@ -528,9 +541,9 @@
@@ -506,9 +519,9 @@
allay.setPersistenceRequired();
allay.resetDuplicationCooldown();
this.resetDuplicationCooldown();

View File

@@ -0,0 +1,54 @@
--- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java
+++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
@@ -131,14 +131,16 @@
@Override
protected void customServerAiStep() {
this.level().getProfiler().push("armadilloBrain");
- this.brain.tick((WorldServer) this.level(), this);
+ ((BehaviorController<Armadillo>) this.brain).tick((WorldServer) this.level(), this); // CraftBukkit - decompile error
this.level().getProfiler().pop();
this.level().getProfiler().push("armadilloActivityUpdate");
ArmadilloAi.updateActivity(this);
this.level().getProfiler().pop();
if (this.isAlive() && !this.isBaby() && --this.scuteTime <= 0) {
this.playSound(SoundEffects.ARMADILLO_SCUTE_DROP, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
+ this.forceDrops = true; // CraftBukkit
this.spawnAtLocation((IMaterial) Items.ARMADILLO_SCUTE);
+ this.forceDrops = false; // CraftBukkit
this.gameEvent(GameEvent.ENTITY_PLACE);
this.scuteTime = this.pickNextScuteDropTime();
}
@@ -285,8 +287,13 @@
}
@Override
- protected void actuallyHurt(DamageSource damagesource, float f) {
- super.actuallyHurt(damagesource, f);
+ // CraftBukkit start - void -> boolean
+ public boolean actuallyHurt(DamageSource damagesource, float f) {
+ boolean hurt = super.actuallyHurt(damagesource, f);
+ if (!hurt) {
+ return hurt;
+ }
+ // CraftBukkit end
if (!this.isNoAi() && !this.isDeadOrDying()) {
if (damagesource.getEntity() instanceof EntityLiving) {
this.getBrain().setMemoryWithExpiry(MemoryModuleType.DANGER_DETECTED_RECENTLY, true, 80L);
@@ -298,6 +305,7 @@
}
}
+ return hurt; // CraftBukkit
}
public boolean shouldPanic() {
@@ -329,7 +337,9 @@
if (this.isBaby()) {
return false;
} else {
+ this.forceDrops = true; // CraftBukkit
this.spawnAtLocation(new ItemStack(Items.ARMADILLO_SCUTE));
+ this.forceDrops = false; // CraftBukkit
this.gameEvent(GameEvent.ENTITY_INTERACT);
this.playSound(SoundEffects.ARMADILLO_BRUSH);
return true;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
@@ -68,9 +68,16 @@
@@ -67,9 +67,16 @@
public class Axolotl extends EntityAnimal implements LerpingModel, VariantHolder<Axolotl.Variant>, Bucketable {
@@ -18,7 +18,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);
@@ -188,7 +195,7 @@
@@ -186,7 +193,7 @@
@Override
public int getMaxAirSupply() {
@@ -27,7 +27,7 @@
}
@Override
@@ -409,7 +416,7 @@
@@ -397,7 +404,7 @@
int i = mobeffect != null ? mobeffect.getDuration() : 0;
int j = Math.min(2400, 100 + i);
@@ -36,7 +36,7 @@
}
entityhuman.removeEffect(MobEffects.DIG_SLOWDOWN);
@@ -459,7 +466,7 @@
@@ -447,7 +454,7 @@
@Override
public BehaviorController<Axolotl> getBrain() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/net/minecraft/world/entity/animal/camel/Camel.java
@@ -150,7 +150,7 @@
@@ -141,7 +141,7 @@
@Override
protected void customServerAiStep() {
this.level().getProfiler().push("camelBrain");
@@ -9,13 +9,13 @@
behaviorcontroller.tick((WorldServer) this.level(), this);
this.level().getProfiler().pop();
@@ -462,9 +462,15 @@
@@ -451,9 +451,15 @@
}
@Override
- protected void actuallyHurt(DamageSource damagesource, float f) {
+ // CraftBukkit start - void -> boolean
+ protected boolean actuallyHurt(DamageSource damagesource, float f) {
+ public boolean actuallyHurt(DamageSource damagesource, float f) {
+ boolean hurt = super.actuallyHurt(damagesource, f);
+ if (!hurt) {
+ return hurt;

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/net/minecraft/world/entity/animal/frog/Tadpole.java
@@ -35,6 +35,10 @@
import net.minecraft.world.item.Items;
@@ -38,6 +38,10 @@
import net.minecraft.world.item.component.CustomData;
import net.minecraft.world.level.World;
+// CraftBukkit start
@@ -11,7 +11,7 @@
public class Tadpole extends EntityFish {
@VisibleForTesting
@@ -68,7 +72,7 @@
@@ -71,7 +75,7 @@
@Override
public BehaviorController<Tadpole> getBrain() {
@@ -20,7 +20,7 @@
}
@Override
@@ -233,9 +237,15 @@
@@ -232,9 +236,15 @@
}
frog.setPersistenceRequired();

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
@@ -55,6 +55,12 @@
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -22,7 +22,7 @@
}
@Override
@@ -220,8 +226,15 @@
@@ -225,8 +231,15 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {

View File

@@ -1,27 +1,79 @@
--- a/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
+++ b/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
@@ -79,6 +79,12 @@
@@ -79,6 +79,18 @@
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
import net.minecraft.world.ticks.ContainerSingleItem;
+// CraftBukkit start
+import java.util.Arrays;
+import java.util.List;
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.entity.AbstractHorse;
+import org.bukkit.entity.HumanEntity;
+import org.bukkit.event.entity.EntityRegainHealthEvent;
+import org.bukkit.inventory.InventoryHolder;
+// CraftBukkit end
+
public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, HasCustomInventoryScreen, OwnableEntity, IJumpable, ISaddleable {
public static final int EQUIPMENT_SLOT_OFFSET = 400;
@@ -140,6 +146,7 @@
protected int gallopSoundCounter;
@Nullable
private UUID owner;
@@ -156,7 +168,53 @@
public boolean stillValid(EntityHuman entityhuman) {
return entityhuman.getVehicle() == EntityHorseAbstract.this || entityhuman.canInteractWithEntity((Entity) EntityHorseAbstract.this, 4.0D);
}
+
+ // CraftBukkit start - add fields and methods
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+ private int maxStack = MAX_STACK;
+
+ @Override
+ public List<ItemStack> getContents() {
+ return Arrays.asList(this.getTheItem());
+ }
+
+ @Override
+ public void onOpen(CraftHumanEntity who) {
+ transaction.add(who);
+ }
+
+ @Override
+ public void onClose(CraftHumanEntity who) {
+ transaction.remove(who);
+ }
+
+ @Override
+ public List<HumanEntity> getViewers() {
+ return transaction;
+ }
+
+ @Override
+ public int getMaxStackSize() {
+ return maxStack;
+ }
+
+ @Override
+ public void setMaxStackSize(int size) {
+ maxStack = size;
+ }
+
+ @Override
+ public InventoryHolder getOwner() {
+ return (AbstractHorse) EntityHorseAbstract.this.getBukkitEntity();
+ }
+
+ @Override
+ public Location getLocation() {
+ return EntityHorseAbstract.this.getBukkitEntity().getLocation();
+ }
+ // CraftBukkit end
};
+ public int maxDomestication = 100; // CraftBukkit - store max domestication value
protected EntityHorseAbstract(EntityTypes<? extends EntityHorseAbstract> entitytypes, World world) {
super(entitytypes, world);
@@ -335,7 +342,7 @@
@@ -346,7 +404,7 @@
public void createInventory() {
InventorySubcontainer inventorysubcontainer = this.inventory;
@@ -30,7 +82,7 @@
if (inventorysubcontainer != null) {
inventorysubcontainer.removeListener(this);
int i = Math.min(inventorysubcontainer.getContainerSize(), this.inventory.getContainerSize());
@@ -443,7 +450,7 @@
@@ -450,7 +508,7 @@
}
public int getMaxTemper() {
@@ -39,7 +91,7 @@
}
@Override
@@ -514,7 +521,7 @@
@@ -521,7 +579,7 @@
}
if (this.getHealth() < this.getMaxHealth() && f > 0.0F) {
@@ -48,7 +100,7 @@
flag = true;
}
@@ -588,7 +595,7 @@
@@ -595,7 +653,7 @@
super.aiStep();
if (!this.level().isClientSide && this.isAlive()) {
if (this.random.nextInt(900) == 0 && this.deathTime == 0) {
@@ -57,15 +109,15 @@
}
if (this.canEatGrass()) {
@@ -855,6 +862,7 @@
@@ -857,6 +915,7 @@
if (this.getOwnerUUID() != null) {
nbttagcompound.putUUID("Owner", this.getOwnerUUID());
}
+ nbttagcompound.putInt("Bukkit.MaxDomestication", this.maxDomestication); // CraftBukkit
if (!this.inventory.getItem(0).isEmpty()) {
nbttagcompound.put("SaddleItem", this.inventory.getItem(0).save(new NBTTagCompound()));
@@ -882,6 +890,11 @@
nbttagcompound.put("SaddleItem", this.inventory.getItem(0).save(this.registryAccess()));
@@ -884,6 +943,11 @@
if (uuid != null) {
this.setOwnerUUID(uuid);
}
@@ -76,8 +128,8 @@
+ // CraftBukkit end
if (nbttagcompound.contains("SaddleItem", 10)) {
ItemStack itemstack = ItemStack.of(nbttagcompound.getCompound("SaddleItem"));
@@ -984,6 +997,17 @@
ItemStack itemstack = (ItemStack) ItemStack.parse(this.registryAccess(), nbttagcompound.getCompound("SaddleItem")).orElse(ItemStack.EMPTY);
@@ -986,6 +1050,17 @@
@Override
public void handleStartJump(int i) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/animal/horse/EntityHorseSkeleton.java
+++ b/net/minecraft/world/entity/animal/horse/EntityHorseSkeleton.java
@@ -27,6 +27,10 @@
import net.minecraft.world.level.GeneratorAccess;
import net.minecraft.world.level.World;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.event.entity.EntityRemoveEvent;
@@ -11,7 +11,7 @@
public class EntityHorseSkeleton extends EntityHorseAbstract {
private final PathfinderGoalHorseTrap skeletonTrapGoal = new PathfinderGoalHorseTrap(this);
@@ -126,7 +130,7 @@
@@ -122,7 +126,7 @@
public void aiStep() {
super.aiStep();
if (this.isTrap() && this.trapTime++ >= 18000) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/horse/PathfinderGoalHorseTrap.java
+++ b/net/minecraft/world/entity/animal/horse/PathfinderGoalHorseTrap.java
@@ -41,12 +41,12 @@
@@ -43,12 +43,12 @@
if (entitylightning != null) {
entitylightning.moveTo(this.horse.getX(), this.horse.getY(), this.horse.getZ());
entitylightning.setVisualOnly(true);
@@ -15,7 +15,7 @@
for (int i = 0; i < 3; ++i) {
EntityHorseAbstract entityhorseabstract = this.createHorse(difficultydamagescaler);
@@ -57,7 +57,7 @@
@@ -59,7 +59,7 @@
if (entityskeleton1 != null) {
entityskeleton1.startRiding(entityhorseabstract);
entityhorseabstract.push(this.horse.getRandom().triangle(0.0D, 1.1485D), 0.0D, this.horse.getRandom().triangle(0.0D, 1.1485D));

View File

@@ -1,32 +1,6 @@
--- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java
+++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java
@@ -83,14 +83,23 @@
public Sniffer(EntityTypes<? extends EntityAnimal> entitytypes, World world) {
super(entitytypes, world);
- this.entityData.define(Sniffer.DATA_STATE, Sniffer.State.IDLING);
- this.entityData.define(Sniffer.DATA_DROP_SEED_AT_TICK, 0);
+ // this.entityData.define(Sniffer.DATA_STATE, Sniffer.State.IDLING); // CraftBukkit - moved down to appropriate location
+ // this.entityData.define(Sniffer.DATA_DROP_SEED_AT_TICK, 0); // CraftBukkit - moved down to appropriate location
this.getNavigation().setCanFloat(true);
this.setPathfindingMalus(PathType.WATER, -1.0F);
this.setPathfindingMalus(PathType.DANGER_POWDER_SNOW, -1.0F);
this.setPathfindingMalus(PathType.DAMAGE_CAUTIOUS, -1.0F);
}
+ // CraftBukkit start - SPIGOT-7295: moved from constructor to appropriate location
+ @Override
+ protected void defineSynchedData() {
+ super.defineSynchedData();
+ this.entityData.define(Sniffer.DATA_STATE, Sniffer.State.IDLING);
+ this.entityData.define(Sniffer.DATA_DROP_SEED_AT_TICK, 0);
+ }
+ // CraftBukkit end
+
@Override
protected float getStandingEyeHeight(EntityPose entitypose, EntitySize entitysize) {
return this.getDimensions(entitypose).height * 0.6F;
@@ -267,6 +276,13 @@
@@ -274,6 +274,13 @@
ItemStack itemstack = (ItemStack) iterator.next();
EntityItem entityitem = new EntityItem(worldserver, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack);
@@ -40,7 +14,7 @@
entityitem.setDefaultPickUpDelay();
worldserver.addFreshEntity(entityitem);
}
@@ -306,7 +322,7 @@
@@ -313,7 +320,7 @@
List<GlobalPos> list = (List) this.getExploredPositions().limit(20L).collect(Collectors.toList());
list.add(0, GlobalPos.of(this.level().dimension(), blockposition));
@@ -49,7 +23,7 @@
return this;
}
@@ -458,7 +474,7 @@
@@ -454,7 +461,7 @@
@Override
public BehaviorController<Sniffer> getBrain() {

View File

@@ -26,7 +26,7 @@
}
}
@@ -95,12 +105,26 @@
@@ -92,12 +102,26 @@
return false;
} else {
if (!this.isRemoved() && !this.level().isClientSide) {

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
@@ -53,6 +53,20 @@
import org.joml.Vector3f;
@@ -51,6 +51,20 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
+// CraftBukkit start
@@ -21,7 +21,7 @@
public class EntityEnderDragon extends EntityInsentient implements IMonster {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -90,6 +104,7 @@
@@ -88,6 +102,7 @@
private final PathPoint[] nodes;
private final int[] nodeAdjacency;
private final Path openSet;
@@ -29,7 +29,7 @@
public EntityEnderDragon(EntityTypes<? extends EntityEnderDragon> entitytypes, World world) {
super(EntityTypes.ENDER_DRAGON, world);
@@ -111,6 +126,7 @@
@@ -109,6 +124,7 @@
this.noPhysics = true;
this.noCulling = true;
this.phaseManager = new DragonControllerManager(this);
@@ -37,7 +37,7 @@
}
public void setDragonFight(EnderDragonBattle enderdragonbattle) {
@@ -258,7 +274,7 @@
@@ -256,7 +272,7 @@
Vec3D vec3d1 = idragoncontroller.getFlyTargetLocation();
@@ -46,7 +46,7 @@
double d0 = vec3d1.x - this.getX();
double d1 = vec3d1.y - this.getY();
double d2 = vec3d1.z - this.getZ();
@@ -399,7 +415,14 @@
@@ -397,7 +413,14 @@
if (this.nearestCrystal.isRemoved()) {
this.nearestCrystal = null;
} else if (this.tickCount % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
@@ -62,7 +62,7 @@
}
}
@@ -474,6 +497,9 @@
@@ -472,6 +495,9 @@
int j1 = MathHelper.floor(axisalignedbb.maxZ);
boolean flag = false;
boolean flag1 = false;
@@ -72,7 +72,7 @@
for (int k1 = i; k1 <= l; ++k1) {
for (int l1 = j; l1 <= i1; ++l1) {
@@ -483,7 +509,11 @@
@@ -481,7 +507,11 @@
if (!iblockdata.isAir() && !iblockdata.is(TagsBlock.DRAGON_TRANSPARENT)) {
if (this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.is(TagsBlock.DRAGON_IMMUNE)) {
@@ -85,7 +85,7 @@
} else {
flag = true;
}
@@ -492,6 +522,51 @@
@@ -490,6 +520,51 @@
}
}
@@ -137,7 +137,7 @@
if (flag1) {
BlockPosition blockposition1 = new BlockPosition(i + this.random.nextInt(l - i + 1), j + this.random.nextInt(i1 - j + 1), k + this.random.nextInt(j1 - k + 1));
@@ -547,7 +622,7 @@
@@ -545,7 +620,7 @@
@Override
public void kill() {
@@ -146,7 +146,7 @@
this.gameEvent(GameEvent.ENTITY_DIE);
if (this.dragonFight != null) {
this.dragonFight.updateDragon(this);
@@ -556,6 +631,21 @@
@@ -554,6 +629,21 @@
}
@@ -168,7 +168,7 @@
@Override
protected void tickDeath() {
if (this.dragonFight != null) {
@@ -571,15 +661,20 @@
@@ -569,15 +659,20 @@
this.level().addParticle(Particles.EXPLOSION_EMITTER, this.getX() + (double) f, this.getY() + 2.0D + (double) f1, this.getZ() + (double) f2, 0.0D, 0.0D, 0.0D);
}
@@ -190,7 +190,7 @@
EntityExperienceOrb.award((WorldServer) this.level(), this.position(), MathHelper.floor((float) short0 * 0.08F));
}
@@ -590,7 +685,7 @@
@@ -588,7 +683,7 @@
this.move(EnumMoveType.SELF, new Vec3D(0.0D, 0.10000000149011612D, 0.0D));
if (this.dragonDeathTime == 200 && this.level() instanceof WorldServer) {
@@ -199,7 +199,7 @@
EntityExperienceOrb.award((WorldServer) this.level(), this.position(), MathHelper.floor((float) short0 * 0.2F));
}
@@ -598,7 +693,7 @@
@@ -596,7 +691,7 @@
this.dragonFight.setDragonKilled(this);
}
@@ -208,7 +208,7 @@
this.gameEvent(GameEvent.ENTITY_DIE);
}
@@ -811,6 +906,7 @@
@@ -809,6 +904,7 @@
super.addAdditionalSaveData(nbttagcompound);
nbttagcompound.putInt("DragonPhase", this.phaseManager.getCurrentPhase().getPhase().getId());
nbttagcompound.putInt("DragonDeathTime", this.dragonDeathTime);
@@ -216,7 +216,7 @@
}
@Override
@@ -824,6 +920,11 @@
@@ -822,6 +918,11 @@
this.dragonDeathTime = nbttagcompound.getInt("DragonDeathTime");
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/wither/EntityWither.java
+++ b/net/minecraft/world/entity/boss/wither/EntityWither.java
@@ -55,6 +55,18 @@
@@ -58,6 +58,18 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.Vec3D;
@@ -19,7 +19,7 @@
public class EntityWither extends EntityMonster implements PowerableMob, IRangedEntity {
private static final DataWatcherObject<Integer> DATA_TARGET_A = DataWatcher.defineId(EntityWither.class, DataWatcherRegistry.INT);
@@ -248,15 +260,40 @@
@@ -254,15 +266,40 @@
i = this.getInvulnerableTicks() - 1;
this.bossEvent.setProgress(1.0F - (float) i / 220.0F);
if (i <= 0) {
@@ -63,7 +63,7 @@
}
} else {
@@ -301,6 +338,7 @@
@@ -307,6 +344,7 @@
if (!list.isEmpty()) {
EntityLiving entityliving1 = (EntityLiving) list.get(this.random.nextInt(list.size()));
@@ -71,18 +71,18 @@
this.setAlternativeTarget(i, entityliving1.getId());
}
}
@@ -331,6 +369,11 @@
IBlockData iblockdata = this.level().getBlockState(blockposition);
@@ -333,6 +371,11 @@
IBlockData iblockdata = this.level().getBlockState(blockposition);
if (canDestroy(iblockdata)) {
+ // CraftBukkit start
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState())) {
+ continue;
+ }
+ // CraftBukkit end
flag = this.level().destroyBlock(blockposition, true, this) || flag;
}
}
if (canDestroy(iblockdata)) {
+ // CraftBukkit start
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState())) {
+ continue;
+ }
+ // CraftBukkit end
flag = this.level().destroyBlock(blockposition, true, this) || flag;
}
}
@@ -344,7 +387,7 @@
}
@@ -92,7 +92,7 @@
}
this.bossEvent.setProgress(this.getHealth() / this.getMaxHealth());
@@ -498,7 +541,7 @@
@@ -500,7 +543,7 @@
@Override
public void checkDespawn() {
if (this.level().getDifficulty() == EnumDifficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/decoration/EntityArmorStand.java
+++ b/net/minecraft/world/entity/decoration/EntityArmorStand.java
@@ -44,6 +44,16 @@
@@ -47,6 +47,16 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
@@ -17,8 +17,8 @@
public class EntityArmorStand extends EntityLiving {
public static final int WOBBLE_TIME = 5;
@@ -106,6 +116,13 @@
this.setPos(d0, d1, d2);
@@ -112,6 +122,13 @@
return createLivingAttributes().add(GenericAttributes.STEP_HEIGHT, 0.0D);
}
+ // CraftBukkit start - SPIGOT-3607, SPIGOT-3637
@@ -31,7 +31,7 @@
@Override
public void refreshDimensions() {
double d0 = this.getX();
@@ -161,13 +178,20 @@
@@ -172,13 +189,20 @@
@Override
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
@@ -54,11 +54,11 @@
}
}
@@ -402,7 +426,25 @@
@@ -408,7 +432,25 @@
return false;
} else if (itemstack1.isEmpty() && (this.disabledSlots & 1 << enumitemslot.getFilterFlag() + 16) != 0) {
return false;
- } else if (entityhuman.getAbilities().instabuild && itemstack1.isEmpty() && !itemstack.isEmpty()) {
- } else if (entityhuman.hasInfiniteMaterials() && itemstack1.isEmpty() && !itemstack.isEmpty()) {
+ // CraftBukkit start
+ } else {
+ org.bukkit.inventory.ItemStack armorStandItem = CraftItemStack.asCraftMirror(itemstack1);
@@ -76,12 +76,12 @@
+ return true;
+ }
+
+ if (entityhuman.getAbilities().instabuild && itemstack1.isEmpty() && !itemstack.isEmpty()) {
+ if (entityhuman.hasInfiniteMaterials() && itemstack1.isEmpty() && !itemstack.isEmpty()) {
+ // CraftBukkit end
this.setItemSlot(enumitemslot, itemstack.copyWithCount(1));
return true;
} else if (!itemstack.isEmpty() && itemstack.getCount() > 1) {
@@ -417,15 +459,26 @@
@@ -423,15 +465,26 @@
entityhuman.setItemInHand(enumhand, itemstack1);
return true;
}
@@ -109,7 +109,7 @@
if (damagesource.is(DamageTypeTags.IS_EXPLOSION)) {
this.brokenByAnything(damagesource);
this.kill();
@@ -473,7 +526,7 @@
@@ -479,7 +532,7 @@
} else {
this.brokenByPlayer(damagesource);
this.showBreakingParticles();
@@ -118,10 +118,10 @@
}
return true;
@@ -541,13 +594,13 @@
itemstack.setHoverName(this.getCustomName());
}
@@ -544,13 +597,13 @@
ItemStack itemstack = new ItemStack(Items.ARMOR_STAND);
itemstack.set(DataComponents.CUSTOM_NAME, this.getCustomName());
- Block.popResource(this.level(), this.blockPosition(), itemstack);
+ drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
this.brokenByAnything(damagesource);
@@ -134,7 +134,7 @@
ItemStack itemstack;
int i;
@@ -555,7 +608,7 @@
@@ -558,7 +611,7 @@
for (i = 0; i < this.handItems.size(); ++i) {
itemstack = (ItemStack) this.handItems.get(i);
if (!itemstack.isEmpty()) {
@@ -143,7 +143,7 @@
this.handItems.set(i, ItemStack.EMPTY);
}
}
@@ -563,10 +616,11 @@
@@ -566,10 +619,11 @@
for (i = 0; i < this.armorItems.size(); ++i) {
itemstack = (ItemStack) this.armorItems.get(i);
if (!itemstack.isEmpty()) {
@@ -156,7 +156,7 @@
}
@@ -662,9 +716,17 @@
@@ -660,9 +714,17 @@
return this.isSmall();
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/decoration/EntityHanging.java
+++ b/net/minecraft/world/entity/decoration/EntityHanging.java
@@ -26,6 +26,14 @@
@@ -27,6 +27,14 @@
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
@@ -15,7 +15,7 @@
public abstract class EntityHanging extends Entity {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -60,26 +68,37 @@
@@ -61,26 +69,37 @@
protected void recalculateBoundingBox() {
if (this.direction != null) {
@@ -66,7 +66,7 @@
d8 = 1.0D;
} else {
d6 = 1.0D;
@@ -88,11 +107,12 @@
@@ -89,11 +108,12 @@
d6 /= 32.0D;
d7 /= 32.0D;
d8 /= 32.0D;
@@ -81,7 +81,7 @@
return i % 32 == 0 ? 0.5D : 0.0D;
}
@@ -103,7 +123,25 @@
@@ -104,7 +124,25 @@
if (this.checkInterval++ == 100) {
this.checkInterval = 0;
if (!this.isRemoved() && !this.survives()) {
@@ -108,7 +108,7 @@
this.dropItem((Entity) null);
}
}
@@ -166,6 +204,22 @@
@@ -165,6 +203,22 @@
return false;
} else {
if (!this.isRemoved() && !this.level().isClientSide) {
@@ -131,7 +131,7 @@
this.kill();
this.markHurt();
this.dropItem(damagesource.getEntity());
@@ -178,6 +232,18 @@
@@ -177,6 +231,18 @@
@Override
public void move(EnumMoveType enummovetype, Vec3D vec3d) {
if (!this.level().isClientSide && !this.isRemoved() && vec3d.lengthSqr() > 0.0D) {
@@ -150,7 +150,7 @@
this.kill();
this.dropItem((Entity) null);
}
@@ -186,13 +252,22 @@
@@ -185,13 +251,22 @@
@Override
public void push(double d0, double d1, double d2) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/decoration/EntityItemFrame.java
+++ b/net/minecraft/world/entity/decoration/EntityItemFrame.java
@@ -96,16 +96,27 @@
@@ -90,16 +90,27 @@
@Override
protected void recalculateBoundingBox() {
if (this.direction != null) {
@@ -36,7 +36,7 @@
switch (enumdirection_enumaxis) {
case X:
@@ -121,9 +132,10 @@
@@ -115,9 +126,10 @@
d4 /= 32.0D;
d5 /= 32.0D;
d6 /= 32.0D;
@@ -48,7 +48,7 @@
@Override
public boolean survives() {
@@ -168,6 +180,11 @@
@@ -162,6 +174,11 @@
return false;
} else if (!damagesource.is(DamageTypeTags.IS_EXPLOSION) && !this.getItem().isEmpty()) {
if (!this.level().isClientSide) {
@@ -60,7 +60,7 @@
this.dropItem(damagesource.getEntity(), false);
this.gameEvent(GameEvent.BLOCK_CHANGE, damagesource.getEntity());
this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F);
@@ -297,13 +314,19 @@
@@ -284,13 +301,19 @@
}
public void setItem(ItemStack itemstack, boolean flag) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/decoration/EntityLeash.java
+++ b/net/minecraft/world/entity/decoration/EntityLeash.java
@@ -26,6 +26,13 @@
@@ -24,6 +24,13 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
@@ -14,7 +14,7 @@
public class EntityLeash extends EntityHanging {
public static final double OFFSET_Y = 0.375D;
@@ -96,6 +103,12 @@
@@ -89,6 +96,12 @@
EntityInsentient entityinsentient = (EntityInsentient) iterator.next();
if (entityinsentient.getLeashHolder() == entityhuman) {
@@ -27,7 +27,7 @@
entityinsentient.setLeashedTo(this, true);
flag = true;
}
@@ -104,18 +117,32 @@
@@ -97,18 +110,32 @@
boolean flag1 = false;
if (!flag) {

View File

@@ -31,7 +31,7 @@
return entityfallingblock;
}
@@ -121,7 +133,7 @@
@@ -126,7 +138,7 @@
@Override
public void tick() {
if (this.blockState.isAir()) {
@@ -40,7 +40,7 @@
} else {
Block block = this.blockState.getBlock();
@@ -152,7 +164,7 @@
@@ -154,7 +166,7 @@
this.spawnAtLocation((IMaterial) block);
}
@@ -49,7 +49,7 @@
}
} else {
IBlockData iblockdata = this.level().getBlockState(blockposition);
@@ -169,9 +181,15 @@
@@ -171,9 +183,15 @@
this.blockState = (IBlockData) this.blockState.setValue(BlockProperties.WATERLOGGED, true);
}
@@ -66,7 +66,7 @@
if (block instanceof Fallable) {
((Fallable) block).onLand(this.level(), blockposition, this.blockState, iblockdata, this);
}
@@ -199,19 +217,19 @@
@@ -201,19 +219,19 @@
}
}
} else if (this.dropItem && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/item/EntityItem.java
+++ b/net/minecraft/world/entity/item/EntityItem.java
@@ -31,6 +31,15 @@
@@ -33,6 +33,15 @@
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.phys.Vec3D;
@@ -16,7 +16,7 @@
public class EntityItem extends Entity implements TraceableEntity {
private static final DataWatcherObject<ItemStack> DATA_ITEM = DataWatcher.defineId(EntityItem.class, DataWatcherRegistry.ITEM_STACK);
@@ -47,6 +56,7 @@
@@ -51,6 +60,7 @@
@Nullable
public UUID target;
public final float bobOffs;
@@ -24,7 +24,7 @@
public EntityItem(EntityTypes<? extends EntityItem> entitytypes, World world) {
super(entitytypes, world);
@@ -125,12 +135,15 @@
@@ -132,12 +142,15 @@
@Override
public void tick() {
if (this.getItem().isEmpty()) {
@@ -44,7 +44,7 @@
this.xo = this.getX();
this.yo = this.getY();
@@ -180,9 +193,11 @@
@@ -186,9 +199,11 @@
this.mergeWithNeighbours();
}
@@ -56,7 +56,7 @@
this.hasImpulse |= this.updateInWaterStateAndDoFluidPushing();
if (!this.level().isClientSide) {
@@ -194,7 +209,13 @@
@@ -200,7 +215,13 @@
}
if (!this.level().isClientSide && this.age >= 6000) {
@@ -71,7 +71,7 @@
}
}
@@ -277,11 +298,16 @@
@@ -283,11 +304,16 @@
}
private static void merge(EntityItem entityitem, ItemStack itemstack, EntityItem entityitem1, ItemStack itemstack1) {
@@ -89,7 +89,7 @@
}
}
@@ -302,12 +328,17 @@
@@ -308,12 +334,17 @@
} else if (this.level().isClientSide) {
return true;
} else {
@@ -108,16 +108,16 @@
}
return true;
@@ -354,7 +385,7 @@
@@ -365,7 +396,7 @@
}
this.setItem(ItemStack.of(nbttagcompound1));
if (this.getItem().isEmpty()) {
- this.discard();
+ this.discard(null); // CraftBukkit - add Bukkit remove cause
}
}
@@ -366,10 +397,50 @@
@@ -377,10 +408,50 @@
Item item = itemstack.getItem();
int i = itemstack.getCount();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/item/EntityTNTPrimed.java
+++ b/net/minecraft/world/entity/item/EntityTNTPrimed.java
@@ -19,6 +19,12 @@
@@ -17,6 +17,12 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.IBlockData;
@@ -13,7 +13,7 @@
public class EntityTNTPrimed extends Entity implements TraceableEntity {
private static final DataWatcherObject<Integer> DATA_FUSE_ID = DataWatcher.defineId(EntityTNTPrimed.class, DataWatcherRegistry.INT);
@@ -28,6 +34,8 @@
@@ -26,6 +32,8 @@
public static final String TAG_FUSE = "fuse";
@Nullable
public EntityLiving owner;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityCaveSpider.java
+++ b/net/minecraft/world/entity/monster/EntityCaveSpider.java
@@ -42,7 +42,7 @@
@@ -39,7 +39,7 @@
}
if (b0 > 0) {

View File

@@ -22,7 +22,7 @@
public EntityCreeper(EntityTypes<? extends EntityCreeper> entitytypes, World world) {
super(entitytypes, world);
@@ -218,9 +226,20 @@
@@ -216,9 +224,20 @@
@Override
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
super.thunderHit(worldserver, entitylightning);
@@ -43,18 +43,18 @@
@Override
protected EnumInteractionResult mobInteract(EntityHuman entityhuman, EnumHand enumhand) {
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
@@ -230,8 +249,9 @@
@@ -228,8 +247,9 @@
this.level().playSound(entityhuman, this.getX(), this.getY(), this.getZ(), soundeffect, this.getSoundSource(), 1.0F, this.random.nextFloat() * 0.4F + 0.8F);
if (!this.level().isClientSide) {
+ this.entityIgniter = entityhuman; // CraftBukkit
this.ignite();
- if (!itemstack.isDamageableItem()) {
+ if (itemstack.getItem().getMaxDamage() == 0) { // CraftBukkit - fix MC-264285: unbreakable flint and steels are completely consumed when igniting a creeper
+ if (itemstack.getMaxDamage() == 0) { // CraftBukkit - fix MC-264285: unbreakable flint and steels are completely consumed when igniting a creeper
itemstack.shrink(1);
} else {
itemstack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
@@ -250,10 +270,19 @@
itemstack.hurtAndBreak(1, entityhuman, getSlotForHand(enumhand));
@@ -246,10 +266,19 @@
if (!this.level().isClientSide) {
float f = this.isPowered() ? 2.0F : 1.0F;
@@ -76,7 +76,7 @@
}
}
@@ -264,6 +293,7 @@
@@ -260,6 +289,7 @@
if (!collection.isEmpty()) {
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ());
@@ -84,7 +84,7 @@
entityareaeffectcloud.setRadius(2.5F);
entityareaeffectcloud.setRadiusOnUse(-0.5F);
entityareaeffectcloud.setWaitTime(10);
@@ -277,7 +307,7 @@
@@ -273,7 +303,7 @@
entityareaeffectcloud.addEffect(new MobEffect(mobeffect));
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityDrowned.java
+++ b/net/minecraft/world/entity/monster/EntityDrowned.java
@@ -244,7 +244,7 @@
@@ -247,7 +247,7 @@
@Override
public void performRangedAttack(EntityLiving entityliving, float f) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntityEnderman.java
+++ b/net/minecraft/world/entity/monster/EntityEnderman.java
@@ -71,6 +71,11 @@
@@ -68,6 +68,11 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -12,7 +12,7 @@
public class EntityEnderman extends EntityMonster implements IEntityAngerable {
private static final UUID SPEED_MODIFIER_ATTACKING_UUID = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0");
@@ -115,7 +120,17 @@
@@ -111,7 +116,17 @@
@Override
public void setTarget(@Nullable EntityLiving entityliving) {
@@ -31,7 +31,7 @@
AttributeModifiable attributemodifiable = this.getAttribute(GenericAttributes.MOVEMENT_SPEED);
if (entityliving == null) {
@@ -130,6 +145,7 @@
@@ -126,6 +141,7 @@
attributemodifiable.addTransientModifier(EntityEnderman.SPEED_MODIFIER_ATTACKING);
}
}
@@ -39,25 +39,25 @@
}
@@ -493,9 +509,11 @@
@@ -477,9 +493,11 @@
if (iblockdata2 != null) {
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level(), blockposition);
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
+ if (CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, iblockdata2)) { // CraftBukkit - Place event
world.setBlock(blockposition, iblockdata2, 3);
world.gameEvent(GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(this.enderman, iblockdata2));
world.gameEvent((Holder) GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(this.enderman, iblockdata2));
this.enderman.setCarriedBlock((IBlockData) null);
+ } // CraftBukkit
}
}
@@ -534,9 +552,11 @@
@@ -518,9 +536,11 @@
boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition);
if (iblockdata.is(TagsBlock.ENDERMAN_HOLDABLE) && flag) {
+ if (CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.defaultBlockState())) { // CraftBukkit - Place event
world.removeBlock(blockposition, false);
world.gameEvent(GameEvent.BLOCK_DESTROY, blockposition, GameEvent.a.of(this.enderman, iblockdata));
world.gameEvent((Holder) GameEvent.BLOCK_DESTROY, blockposition, GameEvent.a.of(this.enderman, iblockdata));
this.enderman.setCarriedBlock(iblockdata.getBlock().defaultBlockState());
+ } // CraftBukkit
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntityEndermite.java
+++ b/net/minecraft/world/entity/monster/EntityEndermite.java
@@ -29,6 +29,10 @@
@@ -25,6 +25,10 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.state.IBlockData;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.event.entity.EntityRemoveEvent;
@@ -11,7 +11,7 @@
public class EntityEndermite extends EntityMonster {
private static final int MAX_LIFE = 2400;
@@ -122,7 +126,7 @@
@@ -113,7 +117,7 @@
}
if (this.life >= 2400) {

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/entity/monster/EntityEvoker.java
+++ b/net/minecraft/world/entity/monster/EntityEvoker.java
@@ -200,7 +200,7 @@
@@ -213,7 +213,7 @@
worldserver.getScoreboard().addPlayerToTeam(entityvex.getScoreboardName(), scoreboardteam);
}
- worldserver.addFreshEntityWithPassengers(entityvex);
+ worldserver.addFreshEntityWithPassengers(entityvex, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPELL); // CraftBukkit - Add SpawnReason
worldserver.gameEvent(GameEvent.ENTITY_PLACE, blockposition, GameEvent.a.of((Entity) EntityEvoker.this));
worldserver.gameEvent((Holder) GameEvent.ENTITY_PLACE, blockposition, GameEvent.a.of((Entity) EntityEvoker.this));
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityGhast.java
+++ b/net/minecraft/world/entity/monster/EntityGhast.java
@@ -348,6 +348,8 @@
@@ -331,6 +331,8 @@
EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.ghast, d2, d3, d4, this.ghast.getExplosionPower());

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityGuardian.java
+++ b/net/minecraft/world/entity/monster/EntityGuardian.java
@@ -63,6 +63,7 @@
@@ -59,6 +59,7 @@
private boolean clientSideTouchedGround;
@Nullable
public PathfinderGoalRandomStroll randomStrollGoal;
@@ -8,7 +8,7 @@
public EntityGuardian(EntityTypes<? extends EntityGuardian> entitytypes, World world) {
super(entitytypes, world);
@@ -78,7 +79,7 @@
@@ -74,7 +75,7 @@
PathfinderGoalMoveTowardsRestriction pathfindergoalmovetowardsrestriction = new PathfinderGoalMoveTowardsRestriction(this, 1.0D);
this.randomStrollGoal = new PathfinderGoalRandomStroll(this, 1.0D, 80);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityGuardianElder.java
+++ b/net/minecraft/world/entity/monster/EntityGuardianElder.java
@@ -70,7 +70,7 @@
@@ -67,7 +67,7 @@
super.customServerAiStep();
if ((this.tickCount + this.getId()) % 1200 == 0) {
MobEffect mobeffect = new MobEffect(MobEffects.DIG_SLOWDOWN, 6000, 2);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java
+++ b/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java
@@ -228,7 +228,7 @@
@@ -215,7 +215,7 @@
@Override
protected void performSpellCasting() {
@@ -9,7 +9,7 @@
}
@Nullable
@@ -279,7 +279,7 @@
@@ -266,7 +266,7 @@
@Override
protected void performSpellCasting() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityIllagerWizard.java
+++ b/net/minecraft/world/entity/monster/EntityIllagerWizard.java
@@ -16,6 +16,10 @@
@@ -17,6 +17,10 @@
import net.minecraft.world.entity.ai.goal.PathfinderGoal;
import net.minecraft.world.level.World;
@@ -11,7 +11,7 @@
public abstract class EntityIllagerWizard extends EntityIllagerAbstract {
private static final DataWatcherObject<Byte> DATA_SPELL_CASTING_ID = DataWatcher.defineId(EntityIllagerWizard.class, DataWatcherRegistry.BYTE);
@@ -155,6 +159,11 @@
@@ -158,6 +162,11 @@
public void tick() {
--this.attackWarmupDelay;
if (this.attackWarmupDelay == 0) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityPhantom.java
+++ b/net/minecraft/world/entity/monster/EntityPhantom.java
@@ -543,14 +543,14 @@
@@ -521,14 +521,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()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityPigZombie.java
+++ b/net/minecraft/world/entity/monster/EntityPigZombie.java
@@ -150,7 +150,7 @@
@@ -148,7 +148,7 @@
}).filter((entitypigzombie) -> {
return !entitypigzombie.isAlliedTo((Entity) this.getTarget());
}).forEach((entitypigzombie) -> {
@@ -9,7 +9,7 @@
});
}
@@ -159,7 +159,7 @@
@@ -157,7 +157,7 @@
}
@Override
@@ -18,7 +18,7 @@
if (this.getTarget() == null && entityliving != null) {
this.playFirstAngerSoundIn = EntityPigZombie.FIRST_ANGER_SOUND_DELAY.sample(this.random);
this.ticksUntilNextAlert = EntityPigZombie.ALERT_INTERVAL.sample(this.random);
@@ -169,12 +169,21 @@
@@ -167,12 +167,21 @@
this.setLastHurtByPlayer((EntityHuman) entityliving);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityPillager.java
+++ b/net/minecraft/world/entity/monster/EntityPillager.java
@@ -51,6 +51,10 @@
@@ -44,6 +44,10 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.WorldAccess;
@@ -11,7 +11,7 @@
public class EntityPillager extends EntityIllagerAbstract implements ICrossbow, InventoryCarrier {
private static final DataWatcherObject<Boolean> IS_CHARGING_CROSSBOW = DataWatcher.defineId(EntityPillager.class, DataWatcherRegistry.BOOLEAN);
@@ -213,7 +217,7 @@
@@ -192,7 +196,7 @@
ItemStack itemstack1 = this.inventory.addItem(itemstack);
if (itemstack1.isEmpty()) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntityRavager.java
+++ b/net/minecraft/world/entity/monster/EntityRavager.java
@@ -43,6 +43,10 @@
@@ -42,6 +42,10 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -11,7 +11,7 @@
public class EntityRavager extends EntityRaider {
private static final Predicate<Entity> NO_RAVAGER_AND_ALIVE = (entity) -> {
@@ -153,6 +157,11 @@
@@ -146,6 +150,11 @@
Block block = iblockdata.getBlock();
if (block instanceof BlockLeaves) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityShulker.java
+++ b/net/minecraft/world/entity/monster/EntityShulker.java
@@ -59,6 +59,12 @@
@@ -58,6 +58,12 @@
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
@@ -13,7 +13,7 @@
public class EntityShulker extends EntityGolem implements VariantHolder<Optional<EnumColor>>, IMonster {
private static final UUID COVERED_ARMOR_MODIFIER_UUID = UUID.fromString("7E0292F2-9434-48D5-A29F-9583AF7DF27F");
@@ -400,6 +406,14 @@
@@ -401,6 +407,14 @@
EnumDirection enumdirection = this.findAttachableSurface(blockposition1);
if (enumdirection != null) {
@@ -28,7 +28,7 @@
this.unRide();
this.setAttachFace(enumdirection);
this.playSound(SoundEffects.SHULKER_TELEPORT, 1.0F, 1.0F);
@@ -470,7 +484,7 @@
@@ -471,7 +485,7 @@
if (entityshulker != null) {
entityshulker.setVariant(this.getVariant());
entityshulker.moveTo(vec3d);

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntitySilverfish.java
+++ b/net/minecraft/world/entity/monster/EntitySilverfish.java
@@ -34,6 +34,11 @@
@@ -30,6 +30,11 @@
import net.minecraft.world.level.block.BlockMonsterEggs;
import net.minecraft.world.level.block.state.IBlockData;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -12,7 +12,7 @@
public class EntitySilverfish extends EntityMonster {
@Nullable
@@ -176,6 +181,11 @@
@@ -157,6 +162,11 @@
Block block = iblockdata.getBlock();
if (block instanceof BlockMonsterEggs) {
@@ -24,7 +24,7 @@
if (world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
world.destroyBlock(blockposition1, true, this.silverfish);
} else {
@@ -245,9 +255,14 @@
@@ -226,9 +236,14 @@
IBlockData iblockdata = world.getBlockState(blockposition);
if (BlockMonsterEggs.isCompatibleHostBlock(iblockdata)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntitySkeletonWither.java
+++ b/net/minecraft/world/entity/monster/EntitySkeletonWither.java
@@ -111,7 +111,7 @@
@@ -96,7 +96,7 @@
return false;
} else {
if (entity instanceof EntityLiving) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntitySlime.java
+++ b/net/minecraft/world/entity/monster/EntitySlime.java
@@ -44,6 +44,15 @@
@@ -43,6 +43,15 @@
import net.minecraft.world.level.levelgen.SeededRandom;
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start
+import java.util.ArrayList;
@@ -16,7 +16,7 @@
public class EntitySlime extends EntityInsentient implements IMonster {
private static final DataWatcherObject<Integer> ID_SIZE = DataWatcher.defineId(EntitySlime.class, DataWatcherRegistry.INT);
@@ -192,11 +201,18 @@
@@ -193,11 +202,18 @@
@Override
public EntityTypes<? extends EntitySlime> getType() {
@@ -36,7 +36,7 @@
int i = this.getSize();
if (!this.level().isClientSide && i > 1 && this.isDeadOrDying()) {
@@ -206,6 +222,19 @@
@@ -208,6 +224,19 @@
int j = i / 2;
int k = 2 + this.random.nextInt(3);
@@ -54,12 +54,12 @@
+ // CraftBukkit end
+
for (int l = 0; l < k; ++l) {
float f1 = ((float) (l % 2) - 0.5F) * f;
float f2 = ((float) (l / 2) - 0.5F) * f;
@@ -221,12 +250,21 @@
float f2 = ((float) (l % 2) - 0.5F) * f1;
float f3 = ((float) (l / 2) - 0.5F) * f1;
@@ -223,12 +252,21 @@
entityslime.setInvulnerable(this.isInvulnerable());
entityslime.setSize(j, true);
entityslime.moveTo(this.getX() + (double) f1, this.getY() + 0.5D, this.getZ() + (double) f2, this.random.nextFloat() * 360.0F, 0.0F);
entityslime.moveTo(this.getX() + (double) f2, this.getY() + 0.5D, this.getZ() + (double) f3, this.random.nextFloat() * 360.0F, 0.0F);
- this.level().addFreshEntity(entityslime);
+ slimes.add(entityslime); // CraftBukkit
}

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/entity/monster/EntitySpider.java
+++ b/net/minecraft/world/entity/monster/EntitySpider.java
@@ -182,7 +182,7 @@
MobEffectList mobeffectlist = entityspider_groupdataspider.effect;
@@ -172,7 +172,7 @@
Holder<MobEffectList> holder = entityspider_groupdataspider.effect;
if (mobeffectlist != null) {
- this.addEffect(new MobEffect(mobeffectlist, -1));
+ this.addEffect(new MobEffect(mobeffectlist, -1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN); // CraftBukkit
if (holder != null) {
- this.addEffect(new MobEffect(holder, -1));
+ this.addEffect(new MobEffect(holder, -1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN); // CraftBukkit
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityVex.java
+++ b/net/minecraft/world/entity/monster/EntityVex.java
@@ -404,7 +404,7 @@
@@ -383,7 +383,7 @@
@Override
public void start() {

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/entity/monster/EntityWitch.java
+++ b/net/minecraft/world/entity/monster/EntityWitch.java
@@ -134,7 +134,7 @@
while (iterator.hasNext()) {
MobEffect mobeffect = (MobEffect) iterator.next();
@@ -124,7 +124,7 @@
PotionContents potioncontents = (PotionContents) itemstack.get(DataComponents.POTION_CONTENTS);
- this.addEffect(new MobEffect(mobeffect));
+ this.addEffect(new MobEffect(mobeffect), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
}
}
if (itemstack.is(Items.POTION) && potioncontents != null) {
- potioncontents.forEachEffect(this::addEffect);
+ potioncontents.forEachEffect((effect) -> this.addEffect(effect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK)); // CraftBukkit
}
this.gameEvent(GameEvent.DRINK);

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntityZombie.java
+++ b/net/minecraft/world/entity/monster/EntityZombie.java
@@ -67,6 +67,15 @@
@@ -64,6 +64,15 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.IBlockData;
import org.joml.Vector3f;
+// CraftBukkit start
+import net.minecraft.server.MinecraftServer;
@@ -16,7 +16,7 @@
public class EntityZombie extends EntityMonster {
private static final UUID SPEED_MODIFIER_BABY_UUID = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");
@@ -87,6 +96,7 @@
@@ -84,6 +93,7 @@
private boolean canBreakDoors;
private int inWaterTime;
public int conversionTime;
@@ -24,7 +24,7 @@
public EntityZombie(EntityTypes<? extends EntityZombie> entitytypes, World world) {
super(entitytypes, world);
@@ -203,7 +213,10 @@
@@ -200,7 +210,10 @@
public void tick() {
if (!this.level().isClientSide && this.isAlive() && !this.isNoAi()) {
if (this.isUnderWaterConverting()) {
@@ -36,7 +36,7 @@
if (this.conversionTime < 0) {
this.doUnderWaterConversion();
}
@@ -220,6 +233,7 @@
@@ -217,6 +230,7 @@
}
super.tick();
@@ -44,7 +44,7 @@
}
@Override
@@ -252,6 +266,7 @@
@@ -249,6 +263,7 @@
}
public void startUnderWaterConversion(int i) {
@@ -52,7 +52,7 @@
this.conversionTime = i;
this.getEntityData().set(EntityZombie.DATA_DROWNED_CONVERSION_ID, true);
}
@@ -265,11 +280,15 @@
@@ -262,11 +277,15 @@
}
protected void convertToZombieType(EntityTypes<? extends EntityZombie> entitytypes) {
@@ -69,35 +69,35 @@
}
}
@@ -309,9 +328,9 @@
if (SpawnerCreature.isSpawnPositionOk(entitypositiontypes_surface, this.level(), blockposition, entitytypes) && EntityPositionTypes.checkSpawnRules(entitytypes, worldserver, EnumMobSpawn.REINFORCEMENT, blockposition, this.level().random)) {
@@ -305,9 +324,9 @@
if (EntityPositionTypes.isSpawnPositionOk(entitytypes, this.level(), blockposition) && EntityPositionTypes.checkSpawnRules(entitytypes, worldserver, EnumMobSpawn.REINFORCEMENT, blockposition, this.level().random)) {
entityzombie.setPos((double) i1, (double) j1, (double) k1);
if (!this.level().hasNearbyAlivePlayer((double) i1, (double) j1, (double) k1, 7.0D) && this.level().isUnobstructed(entityzombie) && this.level().noCollision((Entity) entityzombie) && !this.level().containsAnyLiquid(entityzombie.getBoundingBox())) {
- entityzombie.setTarget(entityliving);
+ entityzombie.setTarget(entityliving, EntityTargetEvent.TargetReason.REINFORCEMENT_TARGET, true); // CraftBukkit
entityzombie.finalizeSpawn(worldserver, this.level().getCurrentDifficultyAt(entityzombie.blockPosition()), EnumMobSpawn.REINFORCEMENT, (GroupDataEntity) null, (NBTTagCompound) null);
entityzombie.finalizeSpawn(worldserver, this.level().getCurrentDifficultyAt(entityzombie.blockPosition()), EnumMobSpawn.REINFORCEMENT, (GroupDataEntity) null);
- worldserver.addFreshEntityWithPassengers(entityzombie);
+ worldserver.addFreshEntityWithPassengers(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
this.getAttribute(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE).addPermanentModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, AttributeModifier.Operation.ADDITION));
entityzombie.getAttribute(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE).addPermanentModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, AttributeModifier.Operation.ADDITION));
this.getAttribute(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE).addPermanentModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, AttributeModifier.Operation.ADD_VALUE));
entityzombie.getAttribute(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE).addPermanentModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, AttributeModifier.Operation.ADD_VALUE));
break;
@@ -332,7 +351,14 @@
@@ -328,7 +347,14 @@
float f = this.level().getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty();
if (this.getMainHandItem().isEmpty() && this.isOnFire() && this.random.nextFloat() < f * 0.3F) {
- entity.setSecondsOnFire(2 * (int) f);
- entity.igniteForSeconds(2 * (int) f);
+ // CraftBukkit start
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * (int) f); // PAIL: fixme
+ this.level().getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ entity.setSecondsOnFire(event.getDuration(), false);
+ entity.igniteForSeconds(event.getDuration(), false);
+ }
+ // CraftBukkit end
}
}
@@ -414,8 +440,17 @@
@@ -403,8 +429,17 @@
if (worldserver.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) {
return flag;
}
@@ -115,10 +115,10 @@
+ // CraftBukkit end
if (entityzombievillager != null) {
entityzombievillager.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityzombievillager.blockPosition()), EnumMobSpawn.CONVERSION, new EntityZombie.GroupDataZombie(false, true), (NBTTagCompound) null);
@@ -423,15 +458,17 @@
entityzombievillager.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityzombievillager.blockPosition()), EnumMobSpawn.CONVERSION, new EntityZombie.GroupDataZombie(false, true));
@@ -412,15 +447,17 @@
entityzombievillager.setGossips((NBTBase) entityvillager.getGossips().store(DynamicOpsNBT.INSTANCE));
entityzombievillager.setTradeOffers(entityvillager.getOffers().createTag());
entityzombievillager.setTradeOffers(entityvillager.getOffers().copy());
entityzombievillager.setVillagerXp(entityvillager.getVillagerXp());
- if (!this.isSilent()) {
- worldserver.levelEvent((EntityHuman) null, 1026, this.blockPosition(), 0);
@@ -139,8 +139,8 @@
}
@Override
@@ -484,7 +521,7 @@
entitychicken1.finalizeSpawn(worldaccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null, (NBTTagCompound) null);
@@ -471,7 +508,7 @@
entitychicken1.finalizeSpawn(worldaccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null);
entitychicken1.setChickenJockey(true);
this.startRiding(entitychicken1);
- worldaccess.addFreshEntity(entitychicken1);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityZombieHusk.java
+++ b/net/minecraft/world/entity/monster/EntityZombieHusk.java
@@ -60,7 +60,7 @@
@@ -58,7 +58,7 @@
if (flag && this.getMainHandItem().isEmpty() && entity instanceof EntityLiving) {
float f = this.level().getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty();

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/monster/EntityZombieVillager.java
+++ b/net/minecraft/world/entity/monster/EntityZombieVillager.java
@@ -50,6 +50,13 @@
import org.joml.Vector3f;
@@ -48,6 +48,13 @@
import net.minecraft.world.level.block.state.IBlockData;
import org.slf4j.Logger;
+// CraftBukkit start
@@ -14,15 +14,15 @@
public class EntityZombieVillager extends EntityZombie implements VillagerDataHolder {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -67,6 +74,7 @@
@@ -65,6 +72,7 @@
@Nullable
private NBTTagCompound tradeOffers;
private MerchantRecipeList tradeOffers;
private int villagerXp;
+ private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
public EntityZombieVillager(EntityTypes<? extends EntityZombieVillager> entitytypes, World world) {
super(entitytypes, world);
@@ -85,7 +93,7 @@
@@ -83,7 +91,7 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@@ -31,7 +31,16 @@
Logger logger = EntityZombieVillager.LOGGER;
Objects.requireNonNull(logger);
@@ -141,6 +149,10 @@
@@ -118,7 +126,7 @@
}
if (nbttagcompound.contains("Offers")) {
- DataResult dataresult1 = MerchantRecipeList.CODEC.parse(this.registryAccess().createSerializationContext(DynamicOpsNBT.INSTANCE), nbttagcompound.get("Offers"));
+ DataResult<MerchantRecipeList> dataresult1 = MerchantRecipeList.CODEC.parse(this.registryAccess().createSerializationContext(DynamicOpsNBT.INSTANCE), nbttagcompound.get("Offers")); // CraftBukkit - decompile error
Logger logger1 = EntityZombieVillager.LOGGER;
Objects.requireNonNull(logger1);
@@ -145,6 +153,10 @@
public void tick() {
if (!this.level().isClientSide && this.isAlive() && this.isConverting()) {
int i = this.getConversionProgress();
@@ -42,7 +51,7 @@
this.villagerConversionTime -= i;
if (this.villagerConversionTime <= 0) {
@@ -149,6 +161,7 @@
@@ -153,6 +165,7 @@
}
super.tick();
@@ -50,7 +59,7 @@
}
@Override
@@ -192,8 +205,10 @@
@@ -193,8 +206,10 @@
this.conversionStarter = uuid;
this.villagerConversionTime = i;
this.getEntityData().set(EntityZombieVillager.DATA_CONVERTING_ID, true);
@@ -63,7 +72,7 @@
this.level().broadcastEntityEvent(this, (byte) 16);
}
@@ -210,7 +225,13 @@
@@ -211,7 +226,13 @@
}
private void finishConversion(WorldServer worldserver) {
@@ -78,7 +87,7 @@
EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
int i = aenumitemslot.length;
@@ -225,7 +246,9 @@
@@ -226,7 +247,9 @@
double d0 = (double) this.getEquipmentDropChance(enumitemslot);
if (d0 > 1.0D) {
@@ -88,7 +97,7 @@
}
}
}
@@ -252,7 +275,7 @@
@@ -253,7 +276,7 @@
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/piglin/EntityPiglin.java
+++ b/net/minecraft/world/entity/monster/piglin/EntityPiglin.java
@@ -55,6 +55,18 @@
@@ -54,6 +54,18 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.IBlockData;
@@ -19,7 +19,7 @@
public class EntityPiglin extends EntityPiglinAbstract implements ICrossbow, InventoryCarrier {
private static final DataWatcherObject<Boolean> DATA_BABY_ID = DataWatcher.defineId(EntityPiglin.class, DataWatcherRegistry.BOOLEAN);
@@ -75,6 +87,10 @@
@@ -73,6 +85,10 @@
public boolean cannotHunt;
protected static final ImmutableList<SensorType<? extends Sensor<? super EntityPiglin>>> SENSOR_TYPES = ImmutableList.of(SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_PLAYERS, SensorType.NEAREST_ITEMS, SensorType.HURT_BY, SensorType.PIGLIN_SPECIFIC_SENSOR);
protected static final ImmutableList<MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.LOOK_TARGET, MemoryModuleType.DOORS_TO_CLOSE, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLINS, MemoryModuleType.NEARBY_ADULT_PIGLINS, MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, MemoryModuleType.ITEM_PICKUP_COOLDOWN_TICKS, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, new MemoryModuleType[]{MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.INTERACTION_TARGET, MemoryModuleType.PATH, MemoryModuleType.ANGRY_AT, MemoryModuleType.UNIVERSAL_ANGER, MemoryModuleType.AVOID_TARGET, MemoryModuleType.ADMIRING_ITEM, MemoryModuleType.TIME_TRYING_TO_REACH_ADMIRE_ITEM, MemoryModuleType.ADMIRING_DISABLED, MemoryModuleType.DISABLE_WALK_TO_ADMIRE_ITEM, MemoryModuleType.CELEBRATE_LOCATION, MemoryModuleType.DANCING, MemoryModuleType.HUNTED_RECENTLY, MemoryModuleType.NEAREST_VISIBLE_BABY_HOGLIN, MemoryModuleType.NEAREST_VISIBLE_NEMESIS, MemoryModuleType.NEAREST_VISIBLE_ZOMBIFIED, MemoryModuleType.RIDE_TARGET, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_VISIBLE_HUNTABLE_HOGLIN, MemoryModuleType.NEAREST_TARGETABLE_PLAYER_NOT_WEARING_GOLD, MemoryModuleType.NEAREST_PLAYER_HOLDING_WANTED_ITEM, MemoryModuleType.ATE_RECENTLY, MemoryModuleType.NEAREST_REPELLENT});
@@ -30,10 +30,10 @@
public EntityPiglin(EntityTypes<? extends EntityPiglinAbstract> entitytypes, World world) {
super(entitytypes, world);
@@ -93,6 +109,14 @@
@@ -91,6 +107,14 @@
}
this.writeInventoryToTag(nbttagcompound);
this.writeInventoryToTag(nbttagcompound, this.registryAccess());
+ // CraftBukkit start
+ NBTTagList barterList = new NBTTagList();
+ allowedBarterItems.stream().map(BuiltInRegistries.ITEM::getKey).map(MinecraftKey::toString).map(NBTTagString::valueOf).forEach(barterList::add);
@@ -45,10 +45,10 @@
}
@Override
@@ -101,6 +125,10 @@
@@ -99,6 +123,10 @@
this.setBaby(nbttagcompound.getBoolean("IsBaby"));
this.setCannotHunt(nbttagcompound.getBoolean("CannotHunt"));
this.readInventoryFromTag(nbttagcompound);
this.readInventoryFromTag(nbttagcompound, this.registryAccess());
+ // CraftBukkit start
+ this.allowedBarterItems = nbttagcompound.getList("Bukkit.BarterList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(BuiltInRegistries.ITEM::get).collect(Collectors.toCollection(HashSet::new));
+ this.interestItems = nbttagcompound.getList("Bukkit.InterestList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(BuiltInRegistries.ITEM::get).collect(Collectors.toCollection(HashSet::new));
@@ -56,7 +56,7 @@
}
@VisibleForDebug
@@ -220,7 +248,7 @@
@@ -216,7 +244,7 @@
@Override
public BehaviorController<EntityPiglin> getBrain() {
@@ -65,7 +65,7 @@
}
@Override
@@ -360,7 +388,7 @@
@@ -349,7 +377,7 @@
}
protected void holdInOffHand(ItemStack itemstack) {
@@ -74,7 +74,7 @@
this.setItemSlot(EnumItemSlot.OFFHAND, itemstack);
this.setGuaranteedDrop(EnumItemSlot.OFFHAND);
} else {
@@ -386,8 +414,8 @@
@@ -375,8 +403,8 @@
if (EnchantmentManager.hasBindingCurse(itemstack1)) {
return false;
} else {
@@ -85,7 +85,7 @@
return flag && !flag1 ? true : (!flag && flag1 ? false : (this.isAdult() && !itemstack.is(Items.CROSSBOW) && itemstack1.is(Items.CROSSBOW) ? false : super.canReplaceCurrentItem(itemstack, itemstack1)));
}
@@ -416,7 +444,7 @@
@@ -405,7 +433,7 @@
@Override
protected SoundEffect getAmbientSound() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/piglin/EntityPiglinAbstract.java
+++ b/net/minecraft/world/entity/monster/piglin/EntityPiglinAbstract.java
@@ -115,7 +115,7 @@
@@ -94,7 +94,7 @@
}
protected void finishConversion(WorldServer worldserver) {
@@ -9,12 +9,3 @@
if (entitypigzombie != null) {
entitypigzombie.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0));
@@ -132,7 +132,7 @@
@Nullable
@Override
public EntityLiving getTarget() {
- return (EntityLiving) this.brain.getMemory(MemoryModuleType.ATTACK_TARGET).orElse((Object) null);
+ return (EntityLiving) this.brain.getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null); // CraftBukkit - decompile error
}
protected boolean isHoldingMeleeWeapon() {

View File

@@ -50,7 +50,7 @@
+ Optional<SoundEffect> optional = getSoundForCurrentActivity(entitypiglin); // CraftBukkit - decompile error
Objects.requireNonNull(entitypiglin);
optional.ifPresent(entitypiglin::playSoundEvent);
optional.ifPresent(entitypiglin::makeSound);
@@ -233,23 +242,27 @@
stopWalking(entitypiglin);
ItemStack itemstack;
@@ -141,7 +141,7 @@
protected static boolean isLovedItem(ItemStack itemstack) {
return itemstack.is(TagsItem.PIGLIN_LOVED);
}
@@ -481,7 +505,7 @@
@@ -479,7 +503,7 @@
}
protected static boolean canAdmire(EntityPiglin entitypiglin, ItemStack itemstack) {
@@ -150,7 +150,7 @@
}
protected static void wasHurtBy(EntityPiglin entitypiglin, EntityLiving entityliving) {
@@ -738,6 +762,12 @@
@@ -736,6 +760,12 @@
return entitypiglin.getBrain().hasMemoryValue(MemoryModuleType.ADMIRING_ITEM);
}
@@ -163,7 +163,7 @@
private static boolean isBarterCurrency(ItemStack itemstack) {
return itemstack.is(PiglinAI.BARTERING_ITEM);
}
@@ -775,7 +805,7 @@
@@ -773,7 +803,7 @@
}
private static boolean isNotHoldingLovedItemInOffHand(EntityPiglin entitypiglin) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/warden/Warden.java
+++ b/net/minecraft/world/entity/monster/warden/Warden.java
@@ -373,7 +373,7 @@
@@ -371,7 +371,7 @@
@Override
public BehaviorController<Warden> getBrain() {
@@ -9,7 +9,7 @@
}
@Override
@@ -414,13 +414,13 @@
@@ -408,13 +408,13 @@
public static void applyDarknessAround(WorldServer worldserver, Vec3D vec3d, @Nullable Entity entity, int i) {
MobEffect mobeffect = new MobEffect(MobEffects.DARKNESS, 260, 0, false, false);
@@ -25,7 +25,7 @@
Logger logger = Warden.LOGGER;
Objects.requireNonNull(logger);
@@ -445,7 +445,7 @@
@@ -439,7 +439,7 @@
dataresult = AngerManagement.codec(this::canTargetEntity).parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("anger")));
logger = Warden.LOGGER;
Objects.requireNonNull(logger);
@@ -34,7 +34,7 @@
this.angerManagement = angermanagement;
});
this.syncClientAngerLevel();
@@ -455,7 +455,7 @@
@@ -449,7 +449,7 @@
dataresult = VibrationSystem.a.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener")));
logger = Warden.LOGGER;
Objects.requireNonNull(logger);
@@ -43,25 +43,7 @@
this.vibrationData = vibrationsystem_a;
});
}
@@ -489,7 +489,7 @@
public void increaseAngerAt(@Nullable Entity entity, int i, boolean flag) {
if (!this.isNoAi() && this.canTargetEntity(entity)) {
WardenAi.setDigCooldown(this);
- boolean flag1 = !(this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse((Object) null) instanceof EntityHuman);
+ boolean flag1 = !(this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null) instanceof EntityHuman); // CraftBukkit - decompile error
int j = this.angerManagement.increaseAnger(entity, i);
if (entity instanceof EntityHuman && flag1 && AngerLevel.byAnger(j).isAngry()) {
@@ -510,7 +510,7 @@
@Nullable
@Override
public EntityLiving getTarget() {
- return (EntityLiving) this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse((Object) null);
+ return (EntityLiving) this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null); // CraftBukkit - decompile error
}
@Override
@@ -553,7 +553,7 @@
@@ -547,7 +547,7 @@
public void setAttackTarget(EntityLiving entityliving) {
this.getBrain().eraseMemory(MemoryModuleType.ROAR_TARGET);
@@ -70,3 +52,18 @@
this.getBrain().eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
SonicBoom.setCooldown(this, 200);
}
@@ -582,12 +582,12 @@
@Override
protected NavigationAbstract createNavigation(World world) {
- return new Navigation(this, this, world) {
+ return new Navigation(this, world) { // CraftBukkit - decompile error
@Override
protected Pathfinder createPathFinder(int i) {
this.nodeEvaluator = new PathfinderNormal();
this.nodeEvaluator.setCanPassDoors(true);
- return new Pathfinder(this, this.nodeEvaluator, i) {
+ return new Pathfinder(this.nodeEvaluator, i) { // CraftBukkit - decompile error
@Override
protected float distance(PathPoint pathpoint, PathPoint pathpoint1) {
return pathpoint.distanceToXZ(pathpoint1);

View File

@@ -73,7 +73,16 @@
Logger logger = EntityVillager.LOGGER;
Objects.requireNonNull(logger);
@@ -834,9 +855,14 @@
@@ -513,7 +534,7 @@
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.readAdditionalSaveData(nbttagcompound);
if (nbttagcompound.contains("VillagerData", 10)) {
- DataResult dataresult = VillagerData.CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("VillagerData"));
+ DataResult<VillagerData> dataresult = VillagerData.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("VillagerData")));
Logger logger = EntityVillager.LOGGER;
Objects.requireNonNull(logger);
@@ -826,9 +847,14 @@
}
entitywitch.setPersistenceRequired();
@@ -90,7 +99,7 @@
} else {
super.thunderHit(worldserver, entitylightning);
}
@@ -933,7 +959,7 @@
@@ -925,7 +951,7 @@
}).limit(5L).collect(Collectors.toList());
if (list1.size() >= j) {
@@ -99,7 +108,7 @@
list.forEach(SensorGolemLastSeen::golemDetected);
}
}
@@ -990,7 +1016,7 @@
@@ -982,7 +1008,7 @@
@Override
public void startSleeping(BlockPosition blockposition) {
super.startSleeping(blockposition);
@@ -108,7 +117,7 @@
this.brain.eraseMemory(MemoryModuleType.WALK_TARGET);
this.brain.eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
}
@@ -998,7 +1024,7 @@
@@ -990,7 +1016,7 @@
@Override
public void stopSleeping() {
super.stopSleeping();

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/npc/EntityVillagerAbstract.java
+++ b/net/minecraft/world/entity/npc/EntityVillagerAbstract.java
@@ -35,8 +35,24 @@
import net.minecraft.world.level.pathfinder.PathType;
@@ -40,8 +40,24 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
+// CraftBukkit start
+import org.bukkit.Bukkit;
@@ -23,9 +23,9 @@
+ }
+ // CraftBukkit end
private static final DataWatcherObject<Integer> DATA_UNHAPPY_COUNTER = DataWatcher.defineId(EntityVillagerAbstract.class, DataWatcherRegistry.INT);
private static final Logger LOGGER = LogUtils.getLogger();
public static final int VILLAGER_SLOT_OFFSET = 300;
private static final int VILLAGER_INVENTORY_SIZE = 8;
@@ -44,7 +60,7 @@
@@ -50,7 +66,7 @@
private EntityHuman tradingPlayer;
@Nullable
protected MerchantRecipeList offers;
@@ -34,7 +34,16 @@
public EntityVillagerAbstract(EntityTypes<? extends EntityVillagerAbstract> entitytypes, World world) {
super(entitytypes, world);
@@ -233,7 +249,16 @@
@@ -173,7 +189,7 @@
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.readAdditionalSaveData(nbttagcompound);
if (nbttagcompound.contains("Offers")) {
- DataResult dataresult = MerchantRecipeList.CODEC.parse(this.registryAccess().createSerializationContext(DynamicOpsNBT.INSTANCE), nbttagcompound.get("Offers"));
+ DataResult<MerchantRecipeList> dataresult = MerchantRecipeList.CODEC.parse(this.registryAccess().createSerializationContext(DynamicOpsNBT.INSTANCE), nbttagcompound.get("Offers")); // CraftBukkit - decompile error
Logger logger = EntityVillagerAbstract.LOGGER;
Objects.requireNonNull(logger);
@@ -240,7 +256,16 @@
MerchantRecipe merchantrecipe = ((VillagerTrades.IMerchantRecipeOption) arraylist.remove(this.random.nextInt(arraylist.size()))).getOffer(this, this.random);
if (merchantrecipe != null) {

View File

@@ -41,7 +41,7 @@
}
}
@@ -244,7 +262,7 @@
@@ -243,7 +261,7 @@
private void maybeDespawn() {
if (this.despawnDelay > 0 && !this.isTrading() && --this.despawnDelay == 0) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/npc/InventoryCarrier.java
+++ b/net/minecraft/world/entity/npc/InventoryCarrier.java
@@ -6,6 +6,10 @@
@@ -7,6 +7,10 @@
import net.minecraft.world.entity.item.EntityItem;
import net.minecraft.world.item.ItemStack;
@@ -11,7 +11,7 @@
public interface InventoryCarrier {
String TAG_INVENTORY = "Inventory";
@@ -23,13 +27,20 @@
@@ -24,13 +28,20 @@
return;
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/player/EntityHuman.java
+++ b/net/minecraft/world/entity/player/EntityHuman.java
@@ -112,6 +112,22 @@
@@ -116,6 +116,22 @@
import net.minecraft.world.scores.ScoreboardTeam;
import org.slf4j.Logger;
@@ -23,20 +23,20 @@
public abstract class EntityHuman extends EntityLiving {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -127,7 +143,8 @@
public static final float SWIMMING_BB_HEIGHT = 0.6F;
@@ -135,7 +151,8 @@
public static final float DEFAULT_EYE_HEIGHT = 1.62F;
public static final EntitySize STANDING_DIMENSIONS = EntitySize.scalable(0.6F, 1.8F);
- private static final Map<EntityPose, EntitySize> POSES = ImmutableMap.builder().put(EntityPose.STANDING, EntityHuman.STANDING_DIMENSIONS).put(EntityPose.SLEEPING, EntityHuman.SLEEPING_DIMENSIONS).put(EntityPose.FALL_FLYING, EntitySize.scalable(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.scalable(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.scalable(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.scalable(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.fixed(0.2F, 0.2F)).build();
public static final Vec3D DEFAULT_VEHICLE_ATTACHMENT = new Vec3D(0.0D, 0.6D, 0.0D);
public static final EntitySize STANDING_DIMENSIONS = EntitySize.scalable(0.6F, 1.8F).withEyeHeight(1.62F).withAttachments(EntityAttachments.builder().attach(EntityAttachment.VEHICLE, EntityHuman.DEFAULT_VEHICLE_ATTACHMENT));
- private static final Map<EntityPose, EntitySize> POSES = ImmutableMap.builder().put(EntityPose.STANDING, EntityHuman.STANDING_DIMENSIONS).put(EntityPose.SLEEPING, EntityHuman.SLEEPING_DIMENSIONS).put(EntityPose.FALL_FLYING, EntitySize.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(EntityPose.SWIMMING, EntitySize.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(EntityPose.SPIN_ATTACK, EntitySize.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(EntityPose.CROUCHING, EntitySize.scalable(0.6F, 1.5F).withEyeHeight(1.27F).withAttachments(EntityAttachments.builder().attach(EntityAttachment.VEHICLE, EntityHuman.DEFAULT_VEHICLE_ATTACHMENT))).put(EntityPose.DYING, EntitySize.fixed(0.2F, 0.2F).withEyeHeight(1.62F)).build();
+ // CraftBukkit - decompile error
+ private static final Map<EntityPose, EntitySize> POSES = ImmutableMap.<EntityPose, EntitySize>builder().put(EntityPose.STANDING, EntityHuman.STANDING_DIMENSIONS).put(EntityPose.SLEEPING, EntityHuman.SLEEPING_DIMENSIONS).put(EntityPose.FALL_FLYING, EntitySize.scalable(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.scalable(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.scalable(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.scalable(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.fixed(0.2F, 0.2F)).build();
+ private static final Map<EntityPose, EntitySize> POSES = ImmutableMap.<EntityPose, EntitySize>builder().put(EntityPose.STANDING, EntityHuman.STANDING_DIMENSIONS).put(EntityPose.SLEEPING, EntityHuman.SLEEPING_DIMENSIONS).put(EntityPose.FALL_FLYING, EntitySize.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(EntityPose.SWIMMING, EntitySize.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(EntityPose.SPIN_ATTACK, EntitySize.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(EntityPose.CROUCHING, EntitySize.scalable(0.6F, 1.5F).withEyeHeight(1.27F).withAttachments(EntityAttachments.builder().attach(EntityAttachment.VEHICLE, EntityHuman.DEFAULT_VEHICLE_ATTACHMENT))).put(EntityPose.DYING, EntitySize.fixed(0.2F, 0.2F).withEyeHeight(1.62F)).build();
private static final DataWatcherObject<Float> DATA_PLAYER_ABSORPTION_ID = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.FLOAT);
private static final DataWatcherObject<Integer> DATA_SCORE_ID = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.INT);
protected static final DataWatcherObject<Byte> DATA_PLAYER_MODE_CUSTOMISATION = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.BYTE);
@@ -136,10 +153,10 @@
@@ -144,10 +161,10 @@
protected static final DataWatcherObject<NBTTagCompound> DATA_SHOULDER_RIGHT = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.COMPOUND_TAG);
private long timeEntitySatOnShoulder;
private final PlayerInventory inventory = new PlayerInventory(this);
final PlayerInventory inventory = new PlayerInventory(this);
- protected InventoryEnderChest enderChestInventory = new InventoryEnderChest();
+ protected InventoryEnderChest enderChestInventory = new InventoryEnderChest(this); // CraftBukkit - add "this" to constructor
public final ContainerPlayer inventoryMenu;
@@ -46,9 +46,9 @@
protected int jumpTriggerTime;
public float oBob;
public float bob;
@@ -168,6 +185,16 @@
public EntityFishingHook fishing;
protected float hurtDir;
@@ -181,6 +198,16 @@
public Entity currentExplosionCause;
public boolean ignoreFallDamageFromCurrentImpulse;
+ // CraftBukkit start
+ public boolean fauxSleeping;
@@ -63,7 +63,7 @@
public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile) {
super(EntityTypes.PLAYER, world);
this.lastItemInMainHand = ItemStack.EMPTY;
@@ -312,7 +339,7 @@
@@ -325,7 +352,7 @@
ItemStack itemstack = this.getItemBySlot(EnumItemSlot.HEAD);
if (itemstack.is(Items.TURTLE_HELMET) && !this.isEyeInFluid(TagsFluid.WATER)) {
@@ -147,7 +147,7 @@
return entityitem;
}
}
@@ -789,7 +857,7 @@
@@ -790,7 +858,7 @@
}
if (nbttagcompound.contains("LastDeathLocation", 10)) {
@@ -156,7 +156,16 @@
Logger logger = EntityHuman.LOGGER;
Objects.requireNonNull(logger);
@@ -822,7 +890,7 @@
@@ -798,7 +866,7 @@
}
if (nbttagcompound.contains("current_explosion_impact_pos", 9)) {
- DataResult dataresult1 = Vec3D.CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("current_explosion_impact_pos"));
+ DataResult<Vec3D> dataresult1 = Vec3D.CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("current_explosion_impact_pos")); // CraftBukkit - decompile error
Logger logger1 = EntityHuman.LOGGER;
Objects.requireNonNull(logger1);
@@ -834,7 +902,7 @@
}
this.getLastDeathLocation().flatMap((globalpos) -> {
@@ -165,7 +174,7 @@
Logger logger = EntityHuman.LOGGER;
Objects.requireNonNull(logger);
@@ -849,12 +917,12 @@
@@ -866,12 +934,12 @@
return false;
} else {
if (!this.level().isClientSide) {
@@ -180,7 +189,7 @@
}
if (this.level().getDifficulty() == EnumDifficulty.EASY) {
@@ -866,7 +934,13 @@
@@ -883,7 +951,13 @@
}
}
@@ -195,7 +204,7 @@
}
}
}
@@ -886,10 +960,29 @@
@@ -903,10 +977,29 @@
}
public boolean canHarmPlayer(EntityHuman entityhuman) {
@@ -228,7 +237,7 @@
}
@Override
@@ -931,8 +1024,13 @@
@@ -946,8 +1039,13 @@
}
}
@@ -243,7 +252,7 @@
if (!this.isInvulnerableTo(damagesource)) {
f = this.getDamageAfterArmorAbsorb(damagesource, f);
f = this.getDamageAfterMagicAbsorb(damagesource, f);
@@ -947,7 +1045,7 @@
@@ -962,7 +1060,7 @@
}
if (f != 0.0F) {
@@ -252,7 +261,7 @@
this.getCombatTracker().recordDamage(damagesource, f);
this.setHealth(this.getHealth() - f);
if (f < 3.4028235E37F) {
@@ -957,6 +1055,7 @@
@@ -972,6 +1070,7 @@
this.gameEvent(GameEvent.ENTITY_DAMAGE);
}
}
@@ -260,119 +269,128 @@
}
@Override
@@ -1121,7 +1220,7 @@
@@ -1127,10 +1226,16 @@
f *= 0.2F + f2 * f2 * 0.8F;
f1 *= f2;
- this.resetAttackStrengthTicker();
+ // this.resetAttackCooldown(); // CraftBukkit - Moved to EntityLiving to reset the cooldown after the damage is dealt
if (f > 0.0F || f1 > 0.0F) {
boolean flag = f2 > 0.9F;
boolean flag1 = false;
@@ -1160,8 +1259,15 @@
if (entity instanceof EntityLiving) {
f3 = ((EntityLiving) entity).getHealth();
if (j > 0 && !entity.isOnFire()) {
- flag4 = true;
- entity.setSecondsOnFire(1);
+ // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 1);
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
+
+ if (!combustEvent.isCancelled()) {
+ flag4 = true;
+ entity.setSecondsOnFire(combustEvent.getDuration(), false);
+ }
+ // CraftBukkit end
}
}
+ // this.resetAttackStrengthTicker(); // CraftBukkit - Moved to EntityLiving to reset the cooldown after the damage is dealt
if (entity.getType().is(TagsEntity.REDIRECTABLE_PROJECTILE) && entity instanceof IProjectile) {
IProjectile iprojectile = (IProjectile) entity;
@@ -1171,7 +1277,7 @@
if (flag5) {
if (i > 0) {
if (entity instanceof EntityLiving) {
- ((EntityLiving) entity).knockback((double) ((float) i * 0.5F), (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)));
+ ((EntityLiving) entity).knockback((double) ((float) i * 0.5F), (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit
} else {
entity.push((double) (-MathHelper.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F));
}
@@ -1189,8 +1295,11 @@
EntityLiving entityliving = (EntityLiving) iterator.next();
if (entityliving != this && entityliving != entity && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
- entityliving.knockback(0.4000000059604645D, (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)));
- entityliving.hurt(this.damageSources().playerAttack(this), f4);
+ // CraftBukkit start - Only apply knockback if the damage hits
+ if (entityliving.hurt(this.damageSources().playerAttack(this).sweep(), f4)) {
+ entityliving.knockback(0.4000000059604645D, (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.SWEEP_ATTACK); // CraftBukkit
+ }
+ // CraftBukkit end
}
}
@@ -1199,9 +1308,26 @@
}
if (entity instanceof EntityPlayer && entity.hurtMarked) {
+ // CraftBukkit start - Add Velocity Event
+ boolean cancelled = false;
+ Player player = (Player) entity.getBukkitEntity();
+ org.bukkit.util.Vector velocity = CraftVector.toBukkit(vec3d);
+
+ PlayerVelocityEvent event = new PlayerVelocityEvent(player, velocity.clone());
+ this.level().getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ cancelled = true;
+ } else if (!velocity.equals(event.getVelocity())) {
+ player.setVelocity(event.getVelocity());
+ }
+
+ if (!cancelled) {
((EntityPlayer) entity).connection.send(new PacketPlayOutEntityVelocity(entity));
entity.hurtMarked = false;
entity.setDeltaMovement(vec3d);
+ }
+ // CraftBukkit end
}
if (flag2) {
@@ -1246,7 +1372,14 @@
this.awardStat(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F));
if (j > 0) {
- entity.setSecondsOnFire(j * 4);
+ // CraftBukkit start
+ DamageSource damagesource = this.damageSources().playerAttack(this);
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f1, false)) {
+ return;
+ }
+ // CraftBukkit end
iprojectile.deflect(ProjectileDeflection.AIM_DEFLECT, this, this, true);
} else {
if (f > 0.0F || f1 > 0.0F) {
@@ -1171,8 +1276,15 @@
if (entity instanceof EntityLiving) {
f3 = ((EntityLiving) entity).getHealth();
if (j > 0 && !entity.isOnFire()) {
- flag4 = true;
- entity.igniteForSeconds(1);
+ // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), j * 4);
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 1);
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
+
+ if (!combustEvent.isCancelled()) {
+ entity.setSecondsOnFire(combustEvent.getDuration(), false);
+ flag4 = true;
+ entity.igniteForSeconds(combustEvent.getDuration(), false);
+ }
+ // CraftBukkit end
}
}
@@ -1182,7 +1294,7 @@
if (flag5) {
if (i > 0) {
if (entity instanceof EntityLiving) {
- ((EntityLiving) entity).knockback((double) ((float) i * 0.5F), (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)));
+ ((EntityLiving) entity).knockback((double) ((float) i * 0.5F), (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit
} else {
entity.push((double) (-MathHelper.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F));
}
@@ -1200,8 +1312,11 @@
EntityLiving entityliving = (EntityLiving) iterator.next();
if (entityliving != this && entityliving != entity && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
- entityliving.knockback(0.4000000059604645D, (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)));
- entityliving.hurt(this.damageSources().playerAttack(this), f4);
+ // CraftBukkit start - Only apply knockback if the damage hits
+ if (entityliving.hurt(this.damageSources().playerAttack(this).sweep(), f4)) {
+ entityliving.knockback(0.4000000059604645D, (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.SWEEP_ATTACK); // CraftBukkit
+ }
+ // CraftBukkit end
}
}
@@ -1210,9 +1325,26 @@
}
if (entity instanceof EntityPlayer && entity.hurtMarked) {
+ // CraftBukkit start - Add Velocity Event
+ boolean cancelled = false;
+ Player player = (Player) entity.getBukkitEntity();
+ org.bukkit.util.Vector velocity = CraftVector.toBukkit(vec3d);
+
+ PlayerVelocityEvent event = new PlayerVelocityEvent(player, velocity.clone());
+ this.level().getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ cancelled = true;
+ } else if (!velocity.equals(event.getVelocity())) {
+ player.setVelocity(event.getVelocity());
+ }
+
+ if (!cancelled) {
((EntityPlayer) entity).connection.send(new PacketPlayOutEntityVelocity(entity));
entity.hurtMarked = false;
entity.setDeltaMovement(vec3d);
+ }
+ // CraftBukkit end
}
if (this.level() instanceof WorldServer && f5 > 2.0F) {
@@ -1256,12 +1389,17 @@
if (flag2) {
@@ -1257,7 +1389,14 @@
this.awardStat(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F));
if (j > 0) {
- entity.igniteForSeconds(j * 4);
+ // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), j * 4);
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
+
+ if (!combustEvent.isCancelled()) {
+ entity.igniteForSeconds(combustEvent.getDuration(), false);
+ }
+ // CraftBukkit end
}
if (this.level() instanceof WorldServer && f5 > 2.0F) {
@@ -1267,12 +1406,17 @@
}
}
}
- this.causeFoodExhaustion(0.1F);
+ this.causeFoodExhaustion(0.1F, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent
} else {
this.level().playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), SoundEffects.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F);
if (flag4) {
entity.clearFire();
- this.causeFoodExhaustion(0.1F);
+ this.causeFoodExhaustion(0.1F, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent
} else {
this.level().playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), SoundEffects.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F);
if (flag4) {
entity.clearFire();
}
+ // CraftBukkit start - resync on cancelled event
+ if (this instanceof EntityPlayer) {
+ ((EntityPlayer) this).getBukkitEntity().updateInventory();
+ }
+ // CraftBukkit end
}
+ // CraftBukkit start - resync on cancelled event
+ if (this instanceof EntityPlayer) {
+ ((EntityPlayer) this).getBukkitEntity().updateInventory();
+ }
+ // CraftBukkit end
}
}
@@ -1307,7 +1445,14 @@
@@ -1310,7 +1454,14 @@
@Override
public void remove(Entity.RemovalReason entity_removalreason) {
@@ -388,7 +406,7 @@
this.inventoryMenu.removed(this);
if (this.containerMenu != null && this.hasContainerOpen()) {
this.doCloseContainer();
@@ -1338,6 +1483,12 @@
@@ -1346,6 +1497,12 @@
}
public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition) {
@@ -401,7 +419,7 @@
this.startSleeping(blockposition);
this.sleepCounter = 0;
return Either.right(Unit.INSTANCE);
@@ -1425,9 +1576,9 @@
@@ -1433,9 +1590,9 @@
super.jumpFromGround();
this.awardStat(StatisticList.JUMP);
if (this.isSprinting()) {
@@ -413,7 +431,7 @@
}
}
@@ -1454,7 +1605,11 @@
@@ -1462,7 +1619,11 @@
this.setDeltaMovement(vec3d2.x, d0 * 0.6D, vec3d2.z);
this.resetFallDistance();
@@ -426,7 +444,7 @@
} else {
super.travel(vec3d);
}
@@ -1507,12 +1662,24 @@
@@ -1522,12 +1683,24 @@
}
public void startFallFlying() {
@@ -452,7 +470,7 @@
}
@Override
@@ -1626,10 +1793,21 @@
@@ -1642,10 +1815,21 @@
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
}
@@ -475,7 +493,7 @@
}
}
@@ -1715,13 +1893,20 @@
@@ -1731,13 +1915,20 @@
@Override
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
@@ -499,7 +517,7 @@
}
}
@@ -1760,26 +1945,31 @@
@@ -1781,26 +1972,31 @@
protected void removeEntitiesOnShoulder() {
if (this.timeEntitySatOnShoulder + 20L < this.level().getGameTime()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/player/PlayerInventory.java
+++ b/net/minecraft/world/entity/player/PlayerInventory.java
@@ -26,6 +26,13 @@
@@ -23,6 +23,13 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.state.IBlockData;
@@ -14,7 +14,7 @@
public class PlayerInventory implements IInventory, INamableTileEntity {
public static final int POP_TIME_DURATION = 5;
@@ -43,6 +50,54 @@
@@ -40,6 +47,54 @@
public final EntityHuman player;
private int timesChanged;
@@ -69,8 +69,8 @@
public PlayerInventory(EntityHuman entityhuman) {
this.items = NonNullList.withSize(36, ItemStack.EMPTY);
this.armor = NonNullList.withSize(4, ItemStack.EMPTY);
@@ -63,6 +118,28 @@
return !itemstack.isEmpty() && ItemStack.isSameItemSameTags(itemstack, itemstack1) && itemstack.isStackable() && itemstack.getCount() < itemstack.getMaxStackSize() && itemstack.getCount() < this.getMaxStackSize();
@@ -60,6 +115,28 @@
return !itemstack.isEmpty() && ItemStack.isSameItemSameComponents(itemstack, itemstack1) && itemstack.isStackable() && itemstack.getCount() < this.getMaxStackSize(itemstack);
}
+ // CraftBukkit start - Watch method above! :D

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityArrow.java
+++ b/net/minecraft/world/entity/projectile/EntityArrow.java
@@ -47,6 +47,13 @@
@@ -49,6 +49,13 @@
import net.minecraft.world.phys.Vec3D;
import net.minecraft.world.phys.shapes.VoxelShape;
@@ -14,16 +14,16 @@
public abstract class EntityArrow extends IProjectile {
private static final double ARROW_BASE_DAMAGE = 2.0D;
@@ -219,7 +226,7 @@
@@ -225,7 +232,7 @@
}
if (object != null && !flag) {
- this.onHit((MovingObjectPosition) object);
+ this.preOnHit((MovingObjectPosition) object); // CraftBukkit - projectile hit event
this.hasImpulse = true;
}
- ProjectileDeflection projectiledeflection = this.hitTargetOrDeflectSelf((MovingObjectPosition) object);
+ ProjectileDeflection projectiledeflection = this.preHitTargetOrDeflectSelf((MovingObjectPosition) object); // CraftBukkit - projectile hit event
@@ -304,7 +311,7 @@
this.hasImpulse = true;
if (projectiledeflection != ProjectileDeflection.NONE) {
@@ -316,7 +323,7 @@
protected void tickDespawn() {
++this.life;
if (this.life >= 1200) {
@@ -32,7 +32,7 @@
}
}
@@ -337,7 +344,7 @@
@@ -349,7 +356,7 @@
}
if (this.piercingIgnoreEntityIds.size() >= this.getPierceLevel() + 1) {
@@ -41,31 +41,31 @@
return;
}
@@ -367,7 +374,13 @@
boolean flag1 = entity.getType().is(TagsEntity.DEFLECTS_ARROWS);
@@ -378,7 +385,13 @@
int k = entity.getRemainingFireTicks();
if (this.isOnFire() && !flag && !flag1) {
- entity.setSecondsOnFire(5);
if (this.isOnFire() && !flag) {
- entity.igniteForSeconds(5);
+ // CraftBukkit start
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
+ if (!combustEvent.isCancelled()) {
+ entity.setSecondsOnFire(combustEvent.getDuration(), false);
+ entity.igniteForSeconds(combustEvent.getDuration(), false);
+ }
+ // CraftBukkit end
}
if (entity.hurt(damagesource, (float) i)) {
@@ -418,7 +431,7 @@
@@ -429,7 +442,7 @@
this.playSound(this.soundEvent, 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
if (this.getPierceLevel() <= 0) {
- this.discard();
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
}
} else if (flag1) {
this.deflect();
@@ -432,7 +445,7 @@
} else {
entity.setRemainingFireTicks(k);
@@ -440,7 +453,7 @@
this.spawnAtLocation(this.getPickupItem(), 0.1F);
}
@@ -74,7 +74,7 @@
}
}
@@ -545,9 +558,24 @@
@@ -547,9 +560,24 @@
@Override
public void playerTouch(EntityHuman entityhuman) {
if (!this.level().isClientSide && (this.inGround || this.isNoPhysics()) && this.shakeTime <= 0) {

View File

@@ -11,16 +11,7 @@
public class EntityEnderSignal extends Entity implements ItemSupplier {
private static final DataWatcherObject<ItemStack> DATA_ITEM_STACK = DataWatcher.defineId(EntityEnderSignal.class, DataWatcherRegistry.ITEM_STACK);
@@ -35,7 +39,7 @@
}
public void setItem(ItemStack itemstack) {
- if (!itemstack.is(Items.ENDER_EYE) || itemstack.hasTag()) {
+ if (true || !itemstack.is(Items.ENDER_EYE) || itemstack.hasTag()) { // CraftBukkit - always allow item changing
this.getEntityData().set(EntityEnderSignal.DATA_ITEM_STACK, itemstack.copyWithCount(1));
}
@@ -150,7 +154,7 @@
@@ -146,7 +150,7 @@
++this.life;
if (this.life > 80 && !this.level().isClientSide) {
this.playSound(SoundEffects.ENDER_EYE_DEATH, 1.0F, 1.0F);
@@ -29,12 +20,17 @@
if (this.surviveAfterDeath) {
this.level().addFreshEntity(new EntityItem(this.level(), this.getX(), this.getY(), this.getZ(), this.getItem()));
} else {
@@ -177,7 +181,7 @@
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
ItemStack itemstack = ItemStack.of(nbttagcompound.getCompound("Item"));
- this.setItem(itemstack);
+ if (!itemstack.isEmpty()) this.setItem(itemstack); // CraftBukkit - SPIGOT-6103 summon, see also SPIGOT-5474
}
@@ -167,7 +171,12 @@
@Override
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
if (nbttagcompound.contains("Item", 10)) {
- this.setItem((ItemStack) ItemStack.parse(this.registryAccess(), nbttagcompound.getCompound("Item")).orElse(this.getDefaultItem()));
+ // CraftBukkit start - SPIGOT-6103 summon, see also SPIGOT-5474
+ ItemStack itemstack = (ItemStack) ItemStack.parse(this.registryAccess(), nbttagcompound.getCompound("Item")).orElse(this.getDefaultItem());
+ if (!itemstack.isEmpty()) {
+ this.setItem(itemstack);
+ }
+ // CraftBukkit end
} else {
this.setItem(this.getDefaultItem());
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
+++ b/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
@@ -14,6 +14,10 @@
@@ -15,6 +15,10 @@
import net.minecraft.world.entity.TraceableEntity;
import net.minecraft.world.level.World;
@@ -11,7 +11,7 @@
public class EntityEvokerFangs extends Entity implements TraceableEntity {
public static final int ATTACK_DURATION = 20;
@@ -118,7 +122,7 @@
@@ -119,7 +123,7 @@
}
if (--this.lifeTicks < 0) {
@@ -20,7 +20,7 @@
}
}
@@ -129,7 +133,7 @@
@@ -130,7 +134,7 @@
if (entityliving.isAlive() && !entityliving.isInvulnerable() && entityliving != entityliving1) {
if (entityliving1 == null) {

Some files were not shown because too many files have changed in this diff Show More