@@ -1,18 +1,17 @@
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -128,8 +128,69 @@
|
||||
@@ -131,8 +131,72 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeamBase;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutAttachEntity;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.Server;
|
||||
+import org.bukkit.block.BlockFace;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+import org.bukkit.craftbukkit.event.CraftPortalEvent;
|
||||
+import org.bukkit.entity.Hanging;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.entity.Vehicle;
|
||||
@@ -25,6 +24,7 @@
|
||||
+import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.craftbukkit.event.CraftPortalEvent;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.entity.Pose;
|
||||
+import org.bukkit.event.entity.EntityAirChangeEvent;
|
||||
@@ -35,6 +35,9 @@
|
||||
+import org.bukkit.event.entity.EntityPortalEvent;
|
||||
+import org.bukkit.event.entity.EntityPoseChangeEvent;
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
+import org.bukkit.event.entity.EntityUnleashEvent;
|
||||
+import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+import org.bukkit.plugin.PluginManager;
|
||||
+// CraftBukkit end
|
||||
@@ -70,11 +73,12 @@
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
public static final String ID_TAG = "id";
|
||||
public static final String PASSENGERS_TAG = "Passengers";
|
||||
@@ -243,6 +304,29 @@
|
||||
@@ -245,6 +309,30 @@
|
||||
public boolean hasVisualFire;
|
||||
@Nullable
|
||||
private IBlockData inBlockState;
|
||||
+ // CraftBukkit start
|
||||
+ public boolean forceDrops;
|
||||
+ public boolean persist = true;
|
||||
+ public boolean visibleByDefault = true;
|
||||
+ public boolean valid;
|
||||
@@ -100,7 +104,7 @@
|
||||
|
||||
public Entity(EntityTypes<?> entitytypes, World world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -349,12 +433,18 @@
|
||||
@@ -351,12 +439,18 @@
|
||||
}
|
||||
|
||||
public void kill() {
|
||||
@@ -121,7 +125,7 @@
|
||||
}
|
||||
|
||||
protected abstract void defineSynchedData(DataWatcher.a datawatcher_a);
|
||||
@@ -363,6 +453,16 @@
|
||||
@@ -365,6 +459,16 @@
|
||||
return this.entityData;
|
||||
}
|
||||
|
||||
@@ -138,7 +142,7 @@
|
||||
public boolean equals(Object object) {
|
||||
return object instanceof Entity ? ((Entity) object).id == this.id : false;
|
||||
}
|
||||
@@ -372,12 +472,24 @@
|
||||
@@ -374,12 +478,24 @@
|
||||
}
|
||||
|
||||
public void remove(Entity.RemovalReason entity_removalreason) {
|
||||
@@ -164,7 +168,7 @@
|
||||
this.entityData.set(Entity.DATA_POSE, entitypose);
|
||||
}
|
||||
|
||||
@@ -402,6 +514,33 @@
|
||||
@@ -404,6 +520,33 @@
|
||||
}
|
||||
|
||||
protected void setRot(float f, float f1) {
|
||||
@@ -198,7 +202,7 @@
|
||||
this.setYRot(f % 360.0F);
|
||||
this.setXRot(f1 % 360.0F);
|
||||
}
|
||||
@@ -443,6 +582,15 @@
|
||||
@@ -445,6 +588,15 @@
|
||||
this.baseTick();
|
||||
}
|
||||
|
||||
@@ -206,7 +210,7 @@
|
||||
+ public void postTick() {
|
||||
+ // No clean way to break out of ticking once the entity has been copied to a new world, so instead we move the portalling later in the tick cycle
|
||||
+ if (!(this instanceof EntityPlayer)) {
|
||||
+ this.handleNetherPortal();
|
||||
+ this.handlePortal();
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
@@ -214,16 +218,16 @@
|
||||
public void baseTick() {
|
||||
this.level().getProfiler().push("entityBaseTick");
|
||||
this.inBlockState = null;
|
||||
@@ -457,7 +605,7 @@
|
||||
@@ -459,7 +611,7 @@
|
||||
this.walkDistO = this.walkDist;
|
||||
this.xRotO = this.getXRot();
|
||||
this.yRotO = this.getYRot();
|
||||
- this.handleNetherPortal();
|
||||
+ if (this instanceof EntityPlayer) this.handleNetherPortal(); // CraftBukkit - // Moved up to postTick
|
||||
- this.handlePortal();
|
||||
+ if (this instanceof EntityPlayer) this.handlePortal(); // CraftBukkit - // Moved up to postTick
|
||||
if (this.canSpawnSprintParticle()) {
|
||||
this.spawnSprintParticle();
|
||||
}
|
||||
@@ -492,6 +640,10 @@
|
||||
@@ -494,6 +646,10 @@
|
||||
if (this.isInLava()) {
|
||||
this.lavaHurt();
|
||||
this.fallDistance *= 0.5F;
|
||||
@@ -234,11 +238,20 @@
|
||||
}
|
||||
|
||||
this.checkBelowWorld();
|
||||
@@ -543,15 +695,47 @@
|
||||
@@ -503,7 +659,7 @@
|
||||
|
||||
this.firstTick = false;
|
||||
if (!this.level().isClientSide && this instanceof Leashable) {
|
||||
- Leashable.tickLeash((Entity) ((Leashable) this));
|
||||
+ Leashable.tickLeash((Entity & Leashable) this); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
this.level().getProfiler().pop();
|
||||
@@ -545,15 +701,47 @@
|
||||
|
||||
public void lavaHurt() {
|
||||
if (!this.fireImmune()) {
|
||||
- this.igniteForSeconds(15);
|
||||
- this.igniteForSeconds(15.0F);
|
||||
- if (this.hurt(this.damageSources().lava(), 4.0F)) {
|
||||
+ // CraftBukkit start - Fallen in lava TODO: this event spams!
|
||||
+ if (this instanceof EntityLiving && remainingFireTicks <= 0) {
|
||||
@@ -253,7 +266,7 @@
|
||||
+ }
|
||||
+ } else {
|
||||
+ // This will be called every single tick the entity is in lava, so don't throw an event
|
||||
+ this.igniteForSeconds(15, false);
|
||||
+ this.igniteForSeconds(15.0F, false);
|
||||
+ }
|
||||
+
|
||||
+ if (this.hurt(this.damageSources().lava().directBlock(level, lastLavaContact), 4.0F)) {
|
||||
@@ -264,27 +277,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
public final void igniteForSeconds(int i) {
|
||||
public final void igniteForSeconds(float f) {
|
||||
+ // CraftBukkit start
|
||||
+ this.igniteForSeconds(i, true);
|
||||
+ this.igniteForSeconds(f, true);
|
||||
+ }
|
||||
+
|
||||
+ public final void igniteForSeconds(int i, boolean callEvent) {
|
||||
+ public final void igniteForSeconds(float f, boolean callEvent) {
|
||||
+ if (callEvent) {
|
||||
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), i);
|
||||
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), f);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ i = event.getDuration();
|
||||
+ f = event.getDuration();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.igniteForTicks(i * 20);
|
||||
this.igniteForTicks(MathHelper.floor(f * 20.0F));
|
||||
}
|
||||
|
||||
@@ -575,7 +759,7 @@
|
||||
@@ -577,7 +765,7 @@
|
||||
}
|
||||
|
||||
protected void onBelowWorld() {
|
||||
@@ -293,7 +306,7 @@
|
||||
}
|
||||
|
||||
public boolean isFree(double d0, double d1, double d2) {
|
||||
@@ -700,6 +884,28 @@
|
||||
@@ -702,6 +890,28 @@
|
||||
block.updateEntityAfterFallOn(this.level(), this);
|
||||
}
|
||||
|
||||
@@ -322,7 +335,7 @@
|
||||
if (this.onGround()) {
|
||||
block.stepOn(this.level(), blockposition, iblockdata, this);
|
||||
}
|
||||
@@ -1027,6 +1233,20 @@
|
||||
@@ -1073,6 +1283,20 @@
|
||||
return SoundEffects.GENERIC_SPLASH;
|
||||
}
|
||||
|
||||
@@ -343,7 +356,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);
|
||||
@@ -1454,6 +1674,7 @@
|
||||
@@ -1512,6 +1736,7 @@
|
||||
this.yo = d1;
|
||||
this.zo = d4;
|
||||
this.setPos(d3, d1, d4);
|
||||
@@ -351,7 +364,7 @@
|
||||
}
|
||||
|
||||
public void moveTo(Vec3D vec3d) {
|
||||
@@ -1652,6 +1873,12 @@
|
||||
@@ -1718,6 +1943,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -364,7 +377,7 @@
|
||||
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
|
||||
@@ -1680,16 +1907,22 @@
|
||||
@@ -1746,16 +1977,22 @@
|
||||
}
|
||||
|
||||
public boolean saveAsPassenger(NBTTagCompound nbttagcompound) {
|
||||
@@ -389,7 +402,7 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1700,16 +1933,38 @@
|
||||
@@ -1766,16 +2003,38 @@
|
||||
}
|
||||
|
||||
public NBTTagCompound saveWithoutId(NBTTagCompound nbttagcompound) {
|
||||
@@ -432,7 +445,7 @@
|
||||
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
|
||||
nbttagcompound.putFloat("FallDistance", this.fallDistance);
|
||||
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
|
||||
@@ -1717,7 +1972,28 @@
|
||||
@@ -1783,7 +2042,28 @@
|
||||
nbttagcompound.putBoolean("OnGround", this.onGround());
|
||||
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
|
||||
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
|
||||
@@ -462,7 +475,7 @@
|
||||
IChatBaseComponent ichatbasecomponent = this.getCustomName();
|
||||
|
||||
if (ichatbasecomponent != null) {
|
||||
@@ -1766,7 +2042,7 @@
|
||||
@@ -1832,7 +2112,7 @@
|
||||
nbttagcompound.put("Tags", nbttaglist);
|
||||
}
|
||||
|
||||
@@ -471,7 +484,7 @@
|
||||
if (this.isVehicle()) {
|
||||
nbttaglist = new NBTTagList();
|
||||
iterator = this.getPassengers().iterator();
|
||||
@@ -1775,7 +2051,7 @@
|
||||
@@ -1841,7 +2121,7 @@
|
||||
Entity entity = (Entity) iterator.next();
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
@@ -480,7 +493,7 @@
|
||||
nbttaglist.add(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
@@ -1785,6 +2061,11 @@
|
||||
@@ -1851,6 +2131,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -492,7 +505,7 @@
|
||||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -1868,6 +2149,45 @@
|
||||
@@ -1934,6 +2219,45 @@
|
||||
} else {
|
||||
throw new IllegalStateException("Entity has invalid position");
|
||||
}
|
||||
@@ -538,7 +551,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
|
||||
@@ -1889,6 +2209,12 @@
|
||||
@@ -1955,6 +2279,12 @@
|
||||
return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null;
|
||||
}
|
||||
|
||||
@@ -551,7 +564,7 @@
|
||||
protected abstract void readAdditionalSaveData(NBTTagCompound nbttagcompound);
|
||||
|
||||
protected abstract void addAdditionalSaveData(NBTTagCompound nbttagcompound);
|
||||
@@ -1943,9 +2269,22 @@
|
||||
@@ -2009,9 +2339,22 @@
|
||||
} else if (this.level().isClientSide) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -574,7 +587,34 @@
|
||||
this.level().addFreshEntity(entityitem);
|
||||
return entityitem;
|
||||
}
|
||||
@@ -2046,6 +2385,27 @@
|
||||
@@ -2040,6 +2383,12 @@
|
||||
if (this.isAlive() && this instanceof Leashable leashable) {
|
||||
if (leashable.getLeashHolder() == entityhuman) {
|
||||
if (!this.level().isClientSide()) {
|
||||
+ // CraftBukkit start - fire PlayerUnleashEntityEvent
|
||||
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman, enumhand).isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutAttachEntity(this, leashable.getLeashHolder()));
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
leashable.dropLeash(true, !entityhuman.hasInfiniteMaterials());
|
||||
this.gameEvent(GameEvent.ENTITY_INTERACT, entityhuman);
|
||||
}
|
||||
@@ -2051,6 +2400,13 @@
|
||||
|
||||
if (itemstack.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) {
|
||||
if (!this.level().isClientSide()) {
|
||||
+ // CraftBukkit start - fire PlayerLeashEntityEvent
|
||||
+ if (CraftEventFactory.callPlayerLeashEntityEvent(this, entityhuman, entityhuman, enumhand).isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).resendItemInHands(); // SPIGOT-7615: Resend to fix client desync with used item
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutAttachEntity(this, leashable.getLeashHolder()));
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
leashable.setLeashedTo(entityhuman, true);
|
||||
}
|
||||
|
||||
@@ -2134,6 +2490,27 @@
|
||||
if (!flag && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -602,7 +642,7 @@
|
||||
if (this.isPassenger()) {
|
||||
this.stopRiding();
|
||||
}
|
||||
@@ -2079,7 +2439,7 @@
|
||||
@@ -2167,7 +2544,7 @@
|
||||
Entity entity = this.vehicle;
|
||||
|
||||
this.vehicle = null;
|
||||
@@ -611,7 +651,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2110,10 +2470,38 @@
|
||||
@@ -2198,10 +2575,38 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -651,7 +691,7 @@
|
||||
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
|
||||
this.passengers = ImmutableList.of();
|
||||
} else {
|
||||
@@ -2125,6 +2513,7 @@
|
||||
@@ -2213,6 +2618,7 @@
|
||||
entity.boardingCooldown = 60;
|
||||
this.gameEvent(GameEvent.ENTITY_DISMOUNT, entity);
|
||||
}
|
||||
@@ -659,31 +699,16 @@
|
||||
}
|
||||
|
||||
protected boolean canAddPassenger(Entity entity) {
|
||||
@@ -2210,14 +2599,20 @@
|
||||
@@ -2307,7 +2713,7 @@
|
||||
if (dimensiontransition != null) {
|
||||
WorldServer worldserver1 = dimensiontransition.newLevel();
|
||||
|
||||
if (this.isInsidePortal) {
|
||||
MinecraftServer minecraftserver = worldserver.getServer();
|
||||
- ResourceKey<World> resourcekey = this.level().dimension() == World.NETHER ? World.OVERWORLD : World.NETHER;
|
||||
+ ResourceKey<World> resourcekey = this.level().getTypeKey() == WorldDimension.NETHER ? World.OVERWORLD : World.NETHER; // CraftBukkit
|
||||
WorldServer worldserver1 = minecraftserver.getLevel(resourcekey);
|
||||
|
||||
- if (worldserver1 != null && minecraftserver.isNetherEnabled() && !this.isPassenger() && this.portalTime++ >= i) {
|
||||
+ if (true && !this.isPassenger() && this.portalTime++ >= i) { // CraftBukkit
|
||||
this.level().getProfiler().push("portal");
|
||||
this.portalTime = i;
|
||||
this.setPortalCooldown();
|
||||
- this.changeDimension(worldserver1);
|
||||
+ // CraftBukkit start
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) this).changeDimension(worldserver1, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL);
|
||||
+ } else {
|
||||
+ this.changeDimension(worldserver1);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level().getProfiler().pop();
|
||||
}
|
||||
|
||||
@@ -2327,6 +2722,13 @@
|
||||
- if (worldserver.getServer().isLevelEnabled(worldserver1) && (worldserver1.dimension() == worldserver.dimension() || this.canChangeDimensions(worldserver, worldserver1))) {
|
||||
+ if (this instanceof EntityPlayer || (worldserver1 != null && (worldserver1.dimension() == worldserver.dimension() || this.canChangeDimensions(worldserver, worldserver1)))) { // CraftBukkit - always call event for players
|
||||
this.changeDimension(dimensiontransition);
|
||||
}
|
||||
}
|
||||
@@ -2414,6 +2820,13 @@
|
||||
}
|
||||
|
||||
public void setSwimming(boolean flag) {
|
||||
@@ -697,7 +722,7 @@
|
||||
this.setSharedFlag(4, flag);
|
||||
}
|
||||
|
||||
@@ -2376,8 +2778,12 @@
|
||||
@@ -2463,8 +2876,12 @@
|
||||
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
|
||||
}
|
||||
|
||||
@@ -711,7 +736,7 @@
|
||||
}
|
||||
|
||||
public boolean getSharedFlag(int i) {
|
||||
@@ -2396,7 +2802,7 @@
|
||||
@@ -2483,7 +2900,7 @@
|
||||
}
|
||||
|
||||
public int getMaxAirSupply() {
|
||||
@@ -720,7 +745,7 @@
|
||||
}
|
||||
|
||||
public int getAirSupply() {
|
||||
@@ -2404,7 +2810,18 @@
|
||||
@@ -2491,7 +2908,18 @@
|
||||
}
|
||||
|
||||
public void setAirSupply(int i) {
|
||||
@@ -740,7 +765,7 @@
|
||||
}
|
||||
|
||||
public int getTicksFrozen() {
|
||||
@@ -2431,11 +2848,40 @@
|
||||
@@ -2518,11 +2946,40 @@
|
||||
|
||||
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
||||
@@ -751,9 +776,9 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.remainingFireTicks == 0) {
|
||||
- this.igniteForSeconds(8);
|
||||
- this.igniteForSeconds(8.0F);
|
||||
+ // CraftBukkit start - Call a combust event when lightning strikes
|
||||
+ EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8);
|
||||
+ EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8.0F);
|
||||
+ pluginManager.callEvent(entityCombustEvent);
|
||||
+ if (!entityCombustEvent.isCancelled()) {
|
||||
+ this.igniteForSeconds(entityCombustEvent.getDuration(), false);
|
||||
@@ -783,157 +808,58 @@
|
||||
}
|
||||
|
||||
public void onAboveBubbleCol(boolean flag) {
|
||||
@@ -2600,15 +3046,38 @@
|
||||
@@ -2691,6 +3148,15 @@
|
||||
|
||||
@Nullable
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
+ // CraftBukkit start
|
||||
+ return teleportTo(worldserver, null);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public Entity teleportTo(WorldServer worldserver, Vec3D location) {
|
||||
+ // CraftBukkit end
|
||||
if (this.level() instanceof WorldServer && !this.isRemoved()) {
|
||||
this.level().getProfiler().push("changeDimension");
|
||||
- this.unRide();
|
||||
+ // CraftBukkit start
|
||||
+ // this.unRide();
|
||||
+ if (worldserver == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level().getProfiler().push("reposition");
|
||||
- ShapeDetectorShape shapedetectorshape = this.findDimensionEntryPoint(worldserver);
|
||||
+ ShapeDetectorShape shapedetectorshape = (location == null) ? this.findDimensionEntryPoint(worldserver) : new ShapeDetectorShape(new Vec3D(location.x(), location.y(), location.z()), Vec3D.ZERO, this.yRot, this.xRot, worldserver, null); // CraftBukkit
|
||||
|
||||
if (shapedetectorshape == null) {
|
||||
return null;
|
||||
} else {
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
if (!this.isRemoved()) {
|
||||
+ // CraftBukkit start
|
||||
+ worldserver = shapedetectorshape.world;
|
||||
+ if (worldserver == level) {
|
||||
+ // SPIGOT-6782: Just move the entity if a plugin changed the world to the one the entity is already in
|
||||
+ moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, shapedetectorshape.xRot);
|
||||
+ setDeltaMovement(shapedetectorshape.speed);
|
||||
+ return this;
|
||||
+ Location to = new Location(dimensiontransition.newLevel().getWorld(), dimensiontransition.pos().x, dimensiontransition.pos().y, dimensiontransition.pos().z, dimensiontransition.yRot(), dimensiontransition.xRot());
|
||||
+ EntityTeleportEvent teleEvent = CraftEventFactory.callEntityTeleportEvent(this, to);
|
||||
+ if (teleEvent.isCancelled()) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ this.unRide();
|
||||
+ to = teleEvent.getTo();
|
||||
+ dimensiontransition = new DimensionTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), dimensiontransition.speed(), to.getYaw(), to.getPitch(), dimensiontransition.missingRespawnBlock(), dimensiontransition.postDimensionTransition(), dimensiontransition.cause());
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.level().getProfiler().popPush("reloading");
|
||||
Entity entity = this.getType().create(worldserver);
|
||||
WorldServer worldserver1 = dimensiontransition.newLevel();
|
||||
List<Entity> list = this.getPassengers();
|
||||
|
||||
@@ -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);
|
||||
- worldserver.addDuringTeleport(entity);
|
||||
- if (worldserver.dimension() == World.END) {
|
||||
- WorldServer.makeObsidianPlatform(worldserver);
|
||||
+ // CraftBukkit start - Don't spawn the new entity if the current entity isn't spawned
|
||||
+ if (this.inWorld) {
|
||||
+ worldserver.addDuringTeleport(entity);
|
||||
+ if (worldserver.getTypeKey() == WorldDimension.END) { // CraftBukkit
|
||||
+ WorldServer.makeObsidianPlatform(worldserver, this); // CraftBukkit
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ // CraftBukkit start - Forward the CraftEntity to the new entity
|
||||
+ this.getBukkitEntity().setHandle(entity);
|
||||
+ entity.bukkitEntity = this.getBukkitEntity();
|
||||
+
|
||||
+ if (this instanceof EntityInsentient) {
|
||||
+ ((EntityInsentient) this).dropLeash(true, false); // Unleash to prevent duping of leads.
|
||||
@@ -2716,11 +3182,15 @@
|
||||
if (this != entity2) {
|
||||
entity2.restoreFrom(this);
|
||||
this.removeAfterChangingDimensions();
|
||||
+ // CraftBukkit start - Forward the CraftEntity to the new entity
|
||||
+ this.getBukkitEntity().setHandle(entity2);
|
||||
+ entity2.bukkitEntity = this.getBukkitEntity();
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
this.removeAfterChangingDimensions();
|
||||
@@ -2635,25 +3116,39 @@
|
||||
entity2.moveTo(dimensiontransition.pos().x, dimensiontransition.pos().y, dimensiontransition.pos().z, dimensiontransition.yRot(), entity2.getXRot());
|
||||
entity2.setDeltaMovement(dimensiontransition.speed());
|
||||
- if (this != entity2) {
|
||||
+ if (this != entity2 && this.inWorld) { // CraftBukkit - Don't spawn the new entity if the current entity isn't spawned
|
||||
worldserver1.addDuringTeleport(entity2);
|
||||
}
|
||||
|
||||
@@ -2754,8 +3224,9 @@
|
||||
}
|
||||
|
||||
protected void removeAfterChangingDimensions() {
|
||||
- this.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
+ this.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION, null); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) {
|
||||
- boolean flag = this.level().dimension() == World.END && worldserver.dimension() == World.OVERWORLD;
|
||||
- boolean flag1 = worldserver.dimension() == World.END;
|
||||
+ // CraftBukkit start
|
||||
+ if (worldserver == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ boolean flag = this.level().getTypeKey() == WorldDimension.END && worldserver.getTypeKey() == WorldDimension.OVERWORLD; // fromEndToOverworld
|
||||
+ boolean flag1 = worldserver.getTypeKey() == WorldDimension.END; // targetIsEnd
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (!flag && !flag1) {
|
||||
- boolean flag2 = worldserver.dimension() == World.NETHER;
|
||||
+ boolean flag2 = worldserver.getTypeKey() == WorldDimension.NETHER; // CraftBukkit
|
||||
|
||||
- if (this.level().dimension() != World.NETHER && !flag2) {
|
||||
+ if (this.level().getTypeKey() != WorldDimension.NETHER && !flag2) { // CraftBukkit
|
||||
return null;
|
||||
} else {
|
||||
WorldBorder worldborder = worldserver.getWorldBorder();
|
||||
double d0 = DimensionManager.getTeleportationScale(this.level().dimensionType(), worldserver.dimensionType());
|
||||
BlockPosition blockposition = worldborder.clampToBounds(this.getX() * d0, this.getY(), this.getZ() * d0);
|
||||
+ // CraftBukkit start
|
||||
+ CraftPortalEvent event = callPortalEvent(this, worldserver, new Vec3D(blockposition.getX(), blockposition.getY(), blockposition.getZ()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16);
|
||||
+ if (event == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ final WorldServer worldserverFinal = worldserver = ((CraftWorld) event.getTo().getWorld()).getHandle();
|
||||
+ worldborder = worldserverFinal.getWorldBorder();
|
||||
+ blockposition = worldborder.clampToBounds(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
|
||||
|
||||
- return (ShapeDetectorShape) this.getExitPortal(worldserver, blockposition, flag2, worldborder).map((blockutil_rectangle) -> {
|
||||
+ return (ShapeDetectorShape) this.getExitPortal(worldserver, blockposition, flag2, worldborder, event.getSearchRadius(), event.getCanCreatePortal(), event.getCreationRadius()).map((blockutil_rectangle) -> {
|
||||
+ // CraftBukkit end
|
||||
IBlockData iblockdata = this.level().getBlockState(this.portalEntrancePos);
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis;
|
||||
Vec3D vec3d;
|
||||
@@ -2670,8 +3165,8 @@
|
||||
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
- return BlockPortalShape.createPortalInfo(worldserver, blockutil_rectangle, enumdirection_enumaxis, vec3d, this, this.getDeltaMovement(), this.getYRot(), this.getXRot());
|
||||
- }).orElse((Object) null);
|
||||
+ return BlockPortalShape.createPortalInfo(worldserverFinal, blockutil_rectangle, enumdirection_enumaxis, vec3d, this, this.getDeltaMovement(), this.getYRot(), this.getXRot(), event); // CraftBukkit
|
||||
+ }).orElse(null); // CraftBukkit - decompile error
|
||||
}
|
||||
} else {
|
||||
BlockPosition blockposition1 = flag1 ? WorldServer.END_SPAWN_POINT : worldserver.getSharedSpawnPos();
|
||||
@@ -2684,8 +3179,14 @@
|
||||
} else {
|
||||
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, 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) 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
|
||||
if (this instanceof Leashable leashable) {
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
|
||||
leashable.dropLeash(true, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2693,8 +3194,23 @@
|
||||
@@ -2765,6 +3236,20 @@
|
||||
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
|
||||
}
|
||||
|
||||
- protected Optional<BlockUtil.Rectangle> getExitPortal(WorldServer worldserver, BlockPosition blockposition, boolean flag, WorldBorder worldborder) {
|
||||
- return worldserver.getPortalForcer().findPortalAround(blockposition, flag, worldborder);
|
||||
+ // CraftBukkit start
|
||||
+ protected CraftPortalEvent callPortalEvent(Entity entity, WorldServer exitWorldServer, Vec3D exitPosition, PlayerTeleportEvent.TeleportCause cause, int searchRadius, int creationRadius) {
|
||||
+ public CraftPortalEvent callPortalEvent(Entity entity, Location exit, PlayerTeleportEvent.TeleportCause cause, int searchRadius, int creationRadius) {
|
||||
+ org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
|
||||
+ Location enter = bukkitEntity.getLocation();
|
||||
+ Location exit = CraftLocation.toBukkit(exitPosition, exitWorldServer.getWorld());
|
||||
+
|
||||
+ EntityPortalEvent event = new EntityPortalEvent(bukkitEntity, enter, exit, searchRadius);
|
||||
+ event.getEntity().getServer().getPluginManager().callEvent(event);
|
||||
@@ -942,15 +868,13 @@
|
||||
+ }
|
||||
+ return new CraftPortalEvent(event);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ protected Optional<BlockUtil.Rectangle> getExitPortal(WorldServer worldserver, BlockPosition blockposition, boolean flag, WorldBorder worldborder, int searchRadius, boolean canCreatePortal, int createRadius) {
|
||||
+ return worldserver.getPortalForcer().findPortalAround(blockposition, worldborder, searchRadius);
|
||||
+ // CraftBukkit end
|
||||
public boolean canUsePortal(boolean flag) {
|
||||
return (flag || !this.isPassenger()) && this.isAlive();
|
||||
}
|
||||
|
||||
public boolean canChangeDimensions() {
|
||||
@@ -2815,6 +3331,12 @@
|
||||
}
|
||||
@@ -2877,6 +3362,12 @@
|
||||
return (Boolean) this.entityData.get(Entity.DATA_CUSTOM_NAME_VISIBLE);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@@ -962,7 +886,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);
|
||||
|
||||
@@ -2833,8 +3355,12 @@
|
||||
@@ -2895,8 +3386,12 @@
|
||||
entity.restoreFrom(this);
|
||||
entity.moveTo(d0, d1, d2, f, f2);
|
||||
entity.setYHeadRot(f);
|
||||
@@ -977,7 +901,7 @@
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -2942,7 +3468,26 @@
|
||||
@@ -3023,7 +3518,26 @@
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
|
||||
@@ -1005,7 +929,7 @@
|
||||
}
|
||||
|
||||
public final float getEyeHeight(EntityPose entitypose) {
|
||||
@@ -3263,6 +3808,11 @@
|
||||
@@ -3332,6 +3846,11 @@
|
||||
vec3d = vec3d.add(vec3d1);
|
||||
++k1;
|
||||
}
|
||||
@@ -1017,7 +941,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3532,6 +4082,14 @@
|
||||
@@ -3601,6 +4120,14 @@
|
||||
|
||||
@Override
|
||||
public final void setRemoved(Entity.RemovalReason entity_removalreason) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/EntityAreaEffectCloud.java
|
||||
+++ b/net/minecraft/world/entity/EntityAreaEffectCloud.java
|
||||
@@ -30,6 +30,12 @@
|
||||
@@ -32,6 +32,12 @@
|
||||
import net.minecraft.world.level.material.EnumPistonReaction;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
public class EntityAreaEffectCloud extends Entity implements TraceableEntity {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -186,7 +192,7 @@
|
||||
@@ -188,7 +194,7 @@
|
||||
}
|
||||
} else {
|
||||
if (this.tickCount >= this.waitTime + this.duration) {
|
||||
@@ -22,7 +22,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -203,7 +209,7 @@
|
||||
@@ -205,7 +211,7 @@
|
||||
if (this.radiusPerTick != 0.0F) {
|
||||
f += this.radiusPerTick;
|
||||
if (f < 0.5F) {
|
||||
@@ -31,7 +31,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -237,6 +243,7 @@
|
||||
@@ -239,11 +245,12 @@
|
||||
if (!list1.isEmpty()) {
|
||||
Iterator iterator1 = list1.iterator();
|
||||
|
||||
@@ -39,47 +39,55 @@
|
||||
while (iterator1.hasNext()) {
|
||||
EntityLiving entityliving = (EntityLiving) iterator1.next();
|
||||
|
||||
@@ -246,6 +253,17 @@
|
||||
double d5 = d3 * d3 + d4 * d4;
|
||||
if (!this.victims.containsKey(entityliving) && entityliving.isAffectedByPotions()) {
|
||||
- Stream stream = list.stream();
|
||||
+ Stream<MobEffect> stream = list.stream(); // CraftBukkit - decompile error
|
||||
|
||||
if (d5 <= (double) (f * f)) {
|
||||
+ // CraftBukkit start
|
||||
+ entities.add((LivingEntity) entityliving.getBukkitEntity());
|
||||
Objects.requireNonNull(entityliving);
|
||||
if (!stream.noneMatch(entityliving::canBeAffected)) {
|
||||
@@ -252,6 +259,19 @@
|
||||
double d5 = d3 * d3 + d4 * d4;
|
||||
|
||||
if (d5 <= (double) (f * f)) {
|
||||
+ // CraftBukkit start
|
||||
+ entities.add((LivingEntity) entityliving.getBukkitEntity());
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ org.bukkit.event.entity.AreaEffectCloudApplyEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callAreaEffectCloudApplyEvent(this, entities);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ for (LivingEntity entity : event.getAffectedEntities()) {
|
||||
+ if (entity instanceof CraftLivingEntity) {
|
||||
+ EntityLiving entityliving = ((CraftLivingEntity) entity).getHandle();
|
||||
+ // CraftBukkit end
|
||||
this.victims.put(entityliving, this.tickCount + this.reapplicationDelay);
|
||||
Iterator iterator2 = list.iterator();
|
||||
+ {
|
||||
+ org.bukkit.event.entity.AreaEffectCloudApplyEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callAreaEffectCloudApplyEvent(this, entities);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ for (LivingEntity entity : event.getAffectedEntities()) {
|
||||
+ if (entity instanceof CraftLivingEntity) {
|
||||
+ EntityLiving entityliving = ((CraftLivingEntity) entity).getHandle();
|
||||
+ // CraftBukkit end
|
||||
this.victims.put(entityliving, this.tickCount + this.reapplicationDelay);
|
||||
Iterator iterator2 = list.iterator();
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
if (this.radiusOnUse != 0.0F) {
|
||||
f += this.radiusOnUse;
|
||||
if (f < 0.5F) {
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
return;
|
||||
@@ -261,14 +281,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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,7 +290,7 @@
|
||||
if (this.durationOnUse != 0) {
|
||||
this.duration += this.durationOnUse;
|
||||
if (this.duration <= 0) {
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
return;
|
||||
if (this.radiusOnUse != 0.0F) {
|
||||
f += this.radiusOnUse;
|
||||
if (f < 0.5F) {
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -278,7 +298,7 @@
|
||||
if (this.durationOnUse != 0) {
|
||||
this.duration += this.durationOnUse;
|
||||
if (this.duration <= 0) {
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,19 +11,3 @@
|
||||
public abstract class EntityCreature extends EntityInsentient {
|
||||
|
||||
protected static final float DEFAULT_WALK_TARGET_VALUE = 0.0F;
|
||||
@@ -67,6 +71,7 @@
|
||||
|
||||
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isInSittingPose()) {
|
||||
if (f > 10.0F) {
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
|
||||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
@@ -75,6 +80,7 @@
|
||||
|
||||
this.onLeashDistance(f);
|
||||
if (f > 10.0F) {
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
|
||||
this.dropLeash(true, true);
|
||||
this.goalSelector.disableControlFlag(PathfinderGoal.Type.MOVE);
|
||||
} else if (f > 6.0F) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/EntityExperienceOrb.java
|
||||
+++ b/net/minecraft/world/entity/EntityExperienceOrb.java
|
||||
@@ -22,6 +22,14 @@
|
||||
@@ -25,6 +25,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;
|
||||
@@ -65,6 +73,7 @@
|
||||
@@ -68,6 +76,7 @@
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
@@ -23,7 +23,7 @@
|
||||
this.xo = this.getX();
|
||||
this.yo = this.getY();
|
||||
this.zo = this.getZ();
|
||||
@@ -90,7 +99,22 @@
|
||||
@@ -93,7 +102,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();
|
||||
|
||||
@@ -115,7 +139,7 @@
|
||||
@@ -118,7 +142,7 @@
|
||||
|
||||
++this.age;
|
||||
if (this.age >= 6000) {
|
||||
@@ -56,7 +56,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -184,7 +208,7 @@
|
||||
@@ -187,7 +211,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() {
|
||||
@@ -206,7 +230,7 @@
|
||||
@@ -209,7 +233,7 @@
|
||||
this.markHurt();
|
||||
this.health = (int) ((float) this.health - f);
|
||||
if (this.health <= 0) {
|
||||
@@ -74,14 +74,14 @@
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -233,17 +257,17 @@
|
||||
@@ -236,17 +260,17 @@
|
||||
public void playerTouch(EntityHuman entityhuman) {
|
||||
if (!this.level().isClientSide) {
|
||||
if (entityhuman instanceof EntityPlayer entityplayer) {
|
||||
if (entityhuman.takeXpDelay == 0) {
|
||||
- entityhuman.takeXpDelay = 2;
|
||||
+ entityhuman.takeXpDelay = CraftEventFactory.callPlayerXpCooldownEvent(entityhuman, 2, PlayerExpCooldownChangeEvent.ChangeReason.PICKUP_ORB).getNewCooldown(); // CraftBukkit - entityhuman.takeXpDelay = 2;
|
||||
entityhuman.take(this, 1);
|
||||
int i = this.repairPlayerItems(entityhuman, this.value);
|
||||
int i = this.repairPlayerItems(entityplayer, this.value);
|
||||
|
||||
if (i > 0) {
|
||||
- entityhuman.giveExperiencePoints(i);
|
||||
@@ -95,25 +95,28 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,9 +280,17 @@
|
||||
if (entry != null) {
|
||||
ItemStack itemstack = (ItemStack) entry.getValue();
|
||||
int j = Math.min(this.xpToDurability(i), itemstack.getDamageValue());
|
||||
@@ -260,12 +284,20 @@
|
||||
ItemStack itemstack = ((EnchantedItemInUse) optional.get()).itemStack();
|
||||
int j = EnchantmentManager.modifyDurabilityToRepairFromXp(entityplayer.serverLevel(), itemstack, i);
|
||||
int k = Math.min(j, itemstack.getDamageValue());
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.player.PlayerItemMendEvent event = CraftEventFactory.callPlayerItemMendEvent(entityhuman, this, itemstack, entry.getKey(), j);
|
||||
+ j = event.getRepairAmount();
|
||||
+ org.bukkit.event.player.PlayerItemMendEvent event = CraftEventFactory.callPlayerItemMendEvent(entityplayer, this, itemstack, optional.get().inSlot(), k);
|
||||
+ k = event.getRepairAmount();
|
||||
+ if (event.isCancelled()) {
|
||||
+ return i;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
itemstack.setDamageValue(itemstack.getDamageValue() - j);
|
||||
int k = i - this.durabilityToXp(j);
|
||||
+ this.value = k; // CraftBukkit - update exp value of orb for PlayerItemMendEvent calls
|
||||
itemstack.setDamageValue(itemstack.getDamageValue() - k);
|
||||
if (k > 0) {
|
||||
int l = i - k * i / j;
|
||||
|
||||
return k > 0 ? this.repairPlayerItems(entityhuman, k) : 0;
|
||||
} else {
|
||||
@@ -283,6 +315,24 @@
|
||||
if (l > 0) {
|
||||
+ this.value = l; // CraftBukkit - update exp value of orb for PlayerItemMendEvent calls
|
||||
return this.repairPlayerItems(entityplayer, l);
|
||||
}
|
||||
}
|
||||
@@ -285,6 +317,24 @@
|
||||
}
|
||||
|
||||
public static int getExperienceValue(int i) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/EntityInsentient.java
|
||||
+++ b/net/minecraft/world/entity/EntityInsentient.java
|
||||
@@ -89,6 +89,20 @@
|
||||
@@ -87,6 +87,20 @@
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
+import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class EntityInsentient extends EntityLiving implements EquipmentUser, Targeting {
|
||||
public abstract class EntityInsentient extends EntityLiving implements EquipmentUser, Leashable, Targeting {
|
||||
|
||||
private static final DataWatcherObject<Byte> DATA_MOB_FLAGS_ID = DataWatcher.defineId(EntityInsentient.class, DataWatcherRegistry.BYTE);
|
||||
@@ -138,6 +152,8 @@
|
||||
@@ -134,6 +148,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);
|
||||
@@ -165,6 +181,12 @@
|
||||
@@ -161,6 +177,12 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
protected void registerGoals() {}
|
||||
|
||||
public static AttributeProvider.Builder createMobAttributes() {
|
||||
@@ -269,11 +291,42 @@
|
||||
@@ -265,11 +287,42 @@
|
||||
|
||||
@Nullable
|
||||
protected final EntityLiving getTargetFromBrain() {
|
||||
@@ -87,7 +87,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -412,6 +465,12 @@
|
||||
@@ -405,6 +458,12 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -100,19 +100,7 @@
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
@@ -486,7 +545,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (either != null) {
|
||||
+ // CraftBukkit start - SPIGOT-7487: Don't save (and possible drop) leash, when the holder was removed by a plugin
|
||||
+ Entity leashHolder = this.leashHolder;
|
||||
+ if (either != null && (leashHolder == null || !leashHolder.pluginRemoved)) {
|
||||
+ // CraftBukkit end
|
||||
nbttagcompound.put("leash", (NBTBase) either.map((uuid) -> {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
@@ -507,16 +569,26 @@
|
||||
@@ -478,16 +537,26 @@
|
||||
nbttagcompound.putBoolean("NoAI", this.isNoAi());
|
||||
}
|
||||
|
||||
@@ -141,16 +129,7 @@
|
||||
NBTTagList nbttaglist;
|
||||
NBTTagCompound nbttagcompound1;
|
||||
int i;
|
||||
@@ -565,7 +637,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 +649,11 @@
|
||||
@@ -541,6 +610,11 @@
|
||||
}
|
||||
|
||||
this.setNoAi(nbttagcompound.getBoolean("NoAI"));
|
||||
@@ -162,7 +141,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -651,20 +728,26 @@
|
||||
@@ -615,20 +689,26 @@
|
||||
|
||||
protected void pickUpItem(EntityItem entityitem) {
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
@@ -188,10 +167,10 @@
|
||||
+
|
||||
+ public ItemStack equipItemIfPossible(ItemStack itemstack, EntityItem entityitem) {
|
||||
+ // CraftBukkit end
|
||||
EnumItemSlot enumitemslot = getEquipmentSlotForItem(itemstack);
|
||||
EnumItemSlot enumitemslot = this.getEquipmentSlotForItem(itemstack);
|
||||
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
|
||||
boolean flag = this.canReplaceCurrentItem(itemstack, itemstack1);
|
||||
@@ -675,11 +758,19 @@
|
||||
@@ -639,11 +719,19 @@
|
||||
flag = itemstack1.isEmpty();
|
||||
}
|
||||
|
||||
@@ -211,8 +190,8 @@
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
}
|
||||
|
||||
if (enumitemslot.isArmor() && itemstack.getCount() > 1) {
|
||||
@@ -813,7 +904,7 @@
|
||||
ItemStack itemstack2 = enumitemslot.limit(itemstack);
|
||||
@@ -772,7 +860,7 @@
|
||||
@Override
|
||||
public void checkDespawn() {
|
||||
if (this.level().getDifficulty() == EnumDifficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
|
||||
@@ -221,7 +200,7 @@
|
||||
} else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) {
|
||||
EntityHuman entityhuman = this.level().getNearestPlayer(this, -1.0D);
|
||||
|
||||
@@ -823,14 +914,14 @@
|
||||
@@ -782,14 +870,14 @@
|
||||
int j = i * i;
|
||||
|
||||
if (d0 > (double) j && this.removeWhenFarAway(d0)) {
|
||||
@@ -238,7 +217,7 @@
|
||||
} else if (d0 < (double) l) {
|
||||
this.noActionTime = 0;
|
||||
}
|
||||
@@ -844,6 +935,7 @@
|
||||
@@ -803,6 +891,7 @@
|
||||
@Override
|
||||
protected final void serverAiStep() {
|
||||
++this.noActionTime;
|
||||
@@ -246,43 +225,16 @@
|
||||
GameProfilerFiller gameprofilerfiller = this.level().getProfiler();
|
||||
|
||||
gameprofilerfiller.push("sensing");
|
||||
@@ -1311,6 +1403,12 @@
|
||||
if (!this.isAlive()) {
|
||||
return EnumInteractionResult.PASS;
|
||||
} else if (this.getLeashHolder() == entityhuman) {
|
||||
+ // CraftBukkit start - fire PlayerUnleashEntityEvent
|
||||
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman, enumhand).isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutAttachEntity(this, this.getLeashHolder()));
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.dropLeash(true, !entityhuman.hasInfiniteMaterials());
|
||||
this.gameEvent(GameEvent.ENTITY_INTERACT, entityhuman);
|
||||
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
|
||||
@@ -1336,6 +1434,13 @@
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
@@ -1354,7 +1443,7 @@
|
||||
if (itemstack.getItem() instanceof ItemMonsterEgg) {
|
||||
if (this.level() instanceof WorldServer) {
|
||||
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
|
||||
- Optional<EntityInsentient> optional = itemmonsteregg.spawnOffspringFromSpawnEgg(entityhuman, this, this.getType(), (WorldServer) this.level(), this.position(), itemstack);
|
||||
+ Optional<EntityInsentient> optional = itemmonsteregg.spawnOffspringFromSpawnEgg(entityhuman, this, (EntityTypes<? extends EntityInsentient>) this.getType(), (WorldServer) this.level(), this.position(), itemstack); // CraftBukkit - decompile error
|
||||
|
||||
if (itemstack.is(Items.LEAD) && this.canBeLeashed(entityhuman)) {
|
||||
+ // CraftBukkit start - fire PlayerLeashEntityEvent
|
||||
+ if (CraftEventFactory.callPlayerLeashEntityEvent(this, entityhuman, entityhuman, enumhand).isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).resendItemInHands(); // SPIGOT-7615: Resend to fix client desync with used item
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutAttachEntity(this, this.getLeashHolder()));
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.setLeashedTo(entityhuman, true);
|
||||
itemstack.shrink(1);
|
||||
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
|
||||
@@ -1351,7 +1456,7 @@
|
||||
if (itemstack.getItem() instanceof ItemMonsterEgg) {
|
||||
if (this.level() instanceof WorldServer) {
|
||||
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
|
||||
- Optional<EntityInsentient> optional = itemmonsteregg.spawnOffspringFromSpawnEgg(entityhuman, this, this.getType(), (WorldServer) this.level(), this.position(), itemstack);
|
||||
+ Optional<EntityInsentient> optional = itemmonsteregg.spawnOffspringFromSpawnEgg(entityhuman, this, (EntityTypes<? extends EntityInsentient>) this.getType(), (WorldServer) this.level(), this.position(), itemstack); // CraftBukkit - decompile error
|
||||
|
||||
optional.ifPresent((entityinsentient) -> {
|
||||
this.onOffspringSpawnedFromEgg(entityhuman, entityinsentient);
|
||||
@@ -1401,12 +1506,19 @@
|
||||
optional.ifPresent((entityinsentient) -> {
|
||||
this.onOffspringSpawnedFromEgg(entityhuman, entityinsentient);
|
||||
@@ -1403,12 +1492,19 @@
|
||||
return this.restrictRadius != -1.0F;
|
||||
}
|
||||
|
||||
@@ -303,7 +255,7 @@
|
||||
|
||||
if (t0 == null) {
|
||||
return null;
|
||||
@@ -1440,7 +1552,12 @@
|
||||
@@ -1442,7 +1538,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +269,7 @@
|
||||
if (this.isPassenger()) {
|
||||
Entity entity = this.getVehicle();
|
||||
|
||||
@@ -1448,7 +1565,7 @@
|
||||
@@ -1450,7 +1551,7 @@
|
||||
t0.startRiding(entity, true);
|
||||
}
|
||||
|
||||
@@ -326,27 +278,7 @@
|
||||
return t0;
|
||||
}
|
||||
}
|
||||
@@ -1461,7 +1578,8 @@
|
||||
|
||||
if (this.leashHolder != null) {
|
||||
if (!this.isAlive() || !this.leashHolder.isAlive()) {
|
||||
- this.dropLeash(true, true);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit
|
||||
+ this.dropLeash(true, !this.leashHolder.pluginRemoved);// CraftBukkit - SPIGOT-7487: Don't drop leash, when the holder was removed by a plugin
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1473,7 +1591,9 @@
|
||||
this.delayedLeashInfo = null;
|
||||
this.clearRestriction();
|
||||
if (!this.level().isClientSide && flag1) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.spawnAtLocation((IMaterial) Items.LEAD);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
}
|
||||
|
||||
if (!this.level().isClientSide && flag && this.level() instanceof WorldServer) {
|
||||
@@ -1527,6 +1647,7 @@
|
||||
@@ -1492,6 +1593,7 @@
|
||||
boolean flag1 = super.startRiding(entity, flag);
|
||||
|
||||
if (flag1 && this.isLeashed()) {
|
||||
@@ -354,45 +286,12 @@
|
||||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
@@ -1555,7 +1676,9 @@
|
||||
}
|
||||
|
||||
if (this.tickCount > 100) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.spawnAtLocation((IMaterial) Items.LEAD);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
this.delayedLeashInfo = null;
|
||||
}
|
||||
}
|
||||
@@ -1638,14 +1761,21 @@
|
||||
int i = EnchantmentManager.getFireAspect(this);
|
||||
|
||||
if (i > 0) {
|
||||
- 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.igniteForSeconds(combustEvent.getDuration(), false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
boolean flag = entity.hurt(this.damageSources().mobAttack(this), f);
|
||||
|
||||
if (flag) {
|
||||
@@ -1578,7 +1680,7 @@
|
||||
if (f1 > 0.0F && entity instanceof EntityLiving) {
|
||||
- ((EntityLiving) entity).knockback((double) (f1 * 0.5F), (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)));
|
||||
+ ((EntityLiving) entity).knockback((double) (f1 * 0.5F), (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot())) * 0.017453292F, this, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit
|
||||
EntityLiving entityliving = (EntityLiving) entity;
|
||||
|
||||
- entityliving.knockback((double) (f1 * 0.5F), (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)));
|
||||
+ entityliving.knockback((double) (f1 * 0.5F), (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)), this, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
|
||||
}
|
||||
|
||||
@@ -1695,6 +1825,7 @@
|
||||
@Override
|
||||
protected void removeAfterChangingDimensions() {
|
||||
super.removeAfterChangingDimensions();
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
|
||||
this.dropLeash(true, false);
|
||||
this.getAllSlots().forEach((itemstack) -> {
|
||||
if (!itemstack.isEmpty()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/EntityLiving.java
|
||||
+++ b/net/minecraft/world/entity/EntityLiving.java
|
||||
@@ -126,6 +126,32 @@
|
||||
@@ -132,6 +132,32 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeam;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
+import java.util.HashSet;
|
||||
+import java.util.Set;
|
||||
+import com.google.common.base.Function;
|
||||
+import java.util.UUID;
|
||||
+import net.minecraft.nbt.NBTTagFloat;
|
||||
+import net.minecraft.nbt.NBTTagInt;
|
||||
+import net.minecraft.world.entity.animal.EntityAnimal;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.attribute.CraftAttributeMap;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
@@ -33,13 +33,12 @@
|
||||
public abstract class EntityLiving extends Entity implements Attackable {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -237,6 +263,20 @@
|
||||
protected BehaviorController<?> brain;
|
||||
@@ -249,6 +275,19 @@
|
||||
protected boolean skipDropExperience;
|
||||
private final Reference2ObjectMap<Enchantment, Set<EnchantmentLocationBasedEffect>> activeLocationDependentEnchantments;
|
||||
protected float appliedScale;
|
||||
+ // CraftBukkit start
|
||||
+ public int expToDrop;
|
||||
+ public boolean forceDrops;
|
||||
+ public ArrayList<org.bukkit.inventory.ItemStack> drops = new ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
+ public final org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes;
|
||||
+ public boolean collides = true;
|
||||
@@ -54,8 +53,8 @@
|
||||
|
||||
protected EntityLiving(EntityTypes<? extends EntityLiving> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -251,7 +291,9 @@
|
||||
this.lastClimbablePos = Optional.empty();
|
||||
@@ -264,7 +303,9 @@
|
||||
this.activeLocationDependentEnchantments = new Reference2ObjectArrayMap();
|
||||
this.appliedScale = 1.0F;
|
||||
this.attributes = new AttributeMapBase(AttributeDefaults.getSupplier(entitytypes));
|
||||
- this.setHealth(this.getMaxHealth());
|
||||
@@ -65,22 +64,22 @@
|
||||
this.blocksBuilding = true;
|
||||
this.rotA = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
|
||||
this.reapplyPosition();
|
||||
@@ -329,7 +371,13 @@
|
||||
double d8 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
|
||||
int i = (int) (150.0D * d8);
|
||||
@@ -344,7 +385,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), 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
|
||||
- ((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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -594,7 +642,7 @@
|
||||
@@ -555,7 +602,7 @@
|
||||
++this.deathTime;
|
||||
if (this.deathTime >= 20 && !this.level().isClientSide() && !this.isRemoved()) {
|
||||
this.level().broadcastEntityEvent(this, (byte) 60);
|
||||
@@ -89,7 +88,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -693,13 +741,19 @@
|
||||
@@ -661,13 +708,19 @@
|
||||
}
|
||||
|
||||
public void onEquipItem(EnumItemSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1) {
|
||||
@@ -110,7 +109,7 @@
|
||||
this.level().playSeededSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), equipable.getEquipSound(), this.getSoundSource(), 1.0F, 1.0F, this.random.nextLong());
|
||||
}
|
||||
|
||||
@@ -713,6 +767,13 @@
|
||||
@@ -681,11 +734,18 @@
|
||||
|
||||
@Override
|
||||
public void remove(Entity.RemovalReason entity_removalreason) {
|
||||
@@ -122,10 +121,7 @@
|
||||
+ public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) {
|
||||
+ // CraftBukkit end
|
||||
if (entity_removalreason == Entity.RemovalReason.KILLED || entity_removalreason == Entity.RemovalReason.DISCARDED) {
|
||||
Iterator iterator = this.getActiveEffects().iterator();
|
||||
|
||||
@@ -723,7 +784,7 @@
|
||||
}
|
||||
this.triggerOnDeathMobEffects(entity_removalreason);
|
||||
}
|
||||
|
||||
- super.remove(entity_removalreason);
|
||||
@@ -133,7 +129,7 @@
|
||||
this.brain.clearMemories();
|
||||
}
|
||||
|
||||
@@ -783,6 +844,17 @@
|
||||
@@ -757,6 +817,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +147,7 @@
|
||||
if (nbttagcompound.contains("Health", 99)) {
|
||||
this.setHealth(nbttagcompound.getFloat("Health"));
|
||||
}
|
||||
@@ -821,9 +893,32 @@
|
||||
@@ -795,9 +866,32 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -184,7 +180,7 @@
|
||||
try {
|
||||
while (iterator.hasNext()) {
|
||||
Holder<MobEffectList> holder = (Holder) iterator.next();
|
||||
@@ -833,6 +928,12 @@
|
||||
@@ -807,6 +901,12 @@
|
||||
this.onEffectUpdated(mobeffect, true, (Entity) null);
|
||||
})) {
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -197,7 +193,7 @@
|
||||
iterator.remove();
|
||||
this.onEffectRemoved(mobeffect);
|
||||
}
|
||||
@@ -843,6 +944,17 @@
|
||||
@@ -817,6 +917,17 @@
|
||||
} catch (ConcurrentModificationException concurrentmodificationexception) {
|
||||
;
|
||||
}
|
||||
@@ -215,7 +211,7 @@
|
||||
|
||||
if (this.effectsDirty) {
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -958,7 +1070,13 @@
|
||||
@@ -932,7 +1043,13 @@
|
||||
this.entityData.set(EntityLiving.DATA_EFFECT_PARTICLES, List.of());
|
||||
}
|
||||
|
||||
@@ -229,7 +225,7 @@
|
||||
if (this.level().isClientSide) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -967,7 +1085,14 @@
|
||||
@@ -941,7 +1058,14 @@
|
||||
boolean flag;
|
||||
|
||||
for (flag = false; iterator.hasNext(); flag = true) {
|
||||
@@ -245,7 +241,7 @@
|
||||
iterator.remove();
|
||||
}
|
||||
|
||||
@@ -996,20 +1121,50 @@
|
||||
@@ -970,20 +1094,50 @@
|
||||
return this.addEffect(mobeffect, (Entity) null);
|
||||
}
|
||||
|
||||
@@ -297,7 +293,7 @@
|
||||
flag = true;
|
||||
}
|
||||
|
||||
@@ -1040,13 +1195,39 @@
|
||||
@@ -1014,13 +1168,39 @@
|
||||
return this.getType().is(TagsEntity.INVERTED_HEALING_AND_HARM);
|
||||
}
|
||||
|
||||
@@ -338,7 +334,7 @@
|
||||
|
||||
if (mobeffect != null) {
|
||||
this.onEffectRemoved(mobeffect);
|
||||
@@ -1142,20 +1323,55 @@
|
||||
@@ -1118,20 +1298,55 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -395,7 +391,7 @@
|
||||
this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.clamp(f, 0.0F, this.getMaxHealth()));
|
||||
}
|
||||
|
||||
@@ -1169,7 +1385,7 @@
|
||||
@@ -1145,7 +1360,7 @@
|
||||
return false;
|
||||
} else if (this.level().isClientSide) {
|
||||
return false;
|
||||
@@ -404,7 +400,7 @@
|
||||
return false;
|
||||
} else if (damagesource.is(DamageTypeTags.IS_FIRE) && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
|
||||
return false;
|
||||
@@ -1180,10 +1396,11 @@
|
||||
@@ -1156,10 +1371,11 @@
|
||||
|
||||
this.noActionTime = 0;
|
||||
float f1 = f;
|
||||
@@ -418,7 +414,7 @@
|
||||
this.hurtCurrentlyUsedShield(f);
|
||||
f2 = f;
|
||||
f = 0.0F;
|
||||
@@ -1204,7 +1421,8 @@
|
||||
@@ -1180,7 +1396,8 @@
|
||||
f *= 5.0F;
|
||||
}
|
||||
|
||||
@@ -428,7 +424,7 @@
|
||||
this.hurtHelmet(damagesource, f);
|
||||
f *= 0.75F;
|
||||
}
|
||||
@@ -1212,18 +1430,27 @@
|
||||
@@ -1188,18 +1405,27 @@
|
||||
this.walkAnimation.setSpeed(1.5F);
|
||||
boolean flag1 = true;
|
||||
|
||||
@@ -460,7 +456,7 @@
|
||||
this.hurtDuration = 10;
|
||||
this.hurtTime = this.hurtDuration;
|
||||
}
|
||||
@@ -1269,7 +1496,7 @@
|
||||
@@ -1245,7 +1471,7 @@
|
||||
this.level().broadcastDamageEvent(this, damagesource);
|
||||
}
|
||||
|
||||
@@ -469,8 +465,8 @@
|
||||
this.markHurt();
|
||||
}
|
||||
|
||||
@@ -1282,7 +1509,7 @@
|
||||
d0 = (Math.random() - Math.random()) * 0.01D;
|
||||
@@ -1265,7 +1491,7 @@
|
||||
d1 = damagesource.getSourcePosition().z() - this.getZ();
|
||||
}
|
||||
|
||||
- this.knockback(0.4000000059604645D, d0, d1);
|
||||
@@ -478,7 +474,7 @@
|
||||
if (!flag) {
|
||||
this.indicateDamage(d0, d1);
|
||||
}
|
||||
@@ -1301,7 +1528,7 @@
|
||||
@@ -1284,7 +1510,7 @@
|
||||
this.playHurtSound(damagesource);
|
||||
}
|
||||
|
||||
@@ -487,7 +483,7 @@
|
||||
|
||||
if (flag2) {
|
||||
this.lastDamageSource = damagesource;
|
||||
@@ -1335,7 +1562,7 @@
|
||||
@@ -1318,7 +1544,7 @@
|
||||
}
|
||||
|
||||
protected void blockedByShield(EntityLiving entityliving) {
|
||||
@@ -496,7 +492,7 @@
|
||||
}
|
||||
|
||||
private boolean checkTotemDeathProtection(DamageSource damagesource) {
|
||||
@@ -1346,19 +1573,32 @@
|
||||
@@ -1329,19 +1555,32 @@
|
||||
EnumHand[] aenumhand = EnumHand.values();
|
||||
int i = aenumhand.length;
|
||||
|
||||
@@ -533,7 +529,7 @@
|
||||
EntityPlayer entityplayer = (EntityPlayer) this;
|
||||
|
||||
entityplayer.awardStat(StatisticList.ITEM_USED.get(Items.TOTEM_OF_UNDYING));
|
||||
@@ -1367,14 +1607,16 @@
|
||||
@@ -1350,14 +1589,16 @@
|
||||
}
|
||||
|
||||
this.setHealth(1.0F);
|
||||
@@ -555,7 +551,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1481,14 +1723,22 @@
|
||||
@@ -1464,14 +1705,22 @@
|
||||
IBlockData iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
|
||||
|
||||
if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
|
||||
@@ -580,14 +576,14 @@
|
||||
this.level().addFreshEntity(entityitem);
|
||||
}
|
||||
}
|
||||
@@ -1508,21 +1758,40 @@
|
||||
|
||||
@@ -1482,26 +1731,41 @@
|
||||
protected void dropAllDeathLoot(WorldServer worldserver, DamageSource damagesource) {
|
||||
boolean flag = this.lastHurtByPlayerTime > 0;
|
||||
|
||||
+ this.dropEquipment(); // CraftBukkit - from below
|
||||
if (this.shouldDropLoot() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
if (this.shouldDropLoot() && worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
this.dropFromLootTable(damagesource, flag);
|
||||
this.dropCustomDeathLoot(damagesource, i, flag);
|
||||
this.dropCustomDeathLoot(worldserver, damagesource, flag);
|
||||
}
|
||||
+ // CraftBukkit start - Call death event
|
||||
+ CraftEventFactory.callEntityDeathEvent(this, damagesource, this.drops);
|
||||
@@ -595,36 +591,37 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
- this.dropEquipment();
|
||||
+ // this.dropInventory();// CraftBukkit - moved up
|
||||
this.dropExperience();
|
||||
+ // this.dropEquipment();// CraftBukkit - moved up
|
||||
this.dropExperience(damagesource.getEntity());
|
||||
}
|
||||
|
||||
protected void dropEquipment() {}
|
||||
|
||||
- protected void dropExperience() {
|
||||
+ // CraftBukkit start
|
||||
+ public int getExpReward() {
|
||||
if (this.level() instanceof WorldServer && !this.wasExperienceConsumed() && (this.isAlwaysExperienceDropper() || this.lastHurtByPlayerTime > 0 && this.shouldDropExperience() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT))) {
|
||||
- EntityExperienceOrb.award((WorldServer) this.level(), this.position(), this.getExperienceReward());
|
||||
+ int i = this.getExperienceReward();
|
||||
+ return i;
|
||||
+ } else {
|
||||
+ return 0;
|
||||
- protected void dropExperience(@Nullable Entity entity) {
|
||||
+ public int getExpReward(@Nullable Entity entity) { // CraftBukkit
|
||||
World world = this.level();
|
||||
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
if (!this.wasExperienceConsumed() && (this.isAlwaysExperienceDropper() || this.lastHurtByPlayerTime > 0 && this.shouldDropExperience() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT))) {
|
||||
- EntityExperienceOrb.award(worldserver, this.position(), this.getExperienceReward(worldserver, entity));
|
||||
+ return this.getExperienceReward(worldserver, entity); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
+ return 0; // CraftBukkit
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ protected void dropExperience() {
|
||||
+ protected void dropExperience(@Nullable Entity entity) {
|
||||
+ // CraftBukkit start - Update getExpReward() above if the removed if() changes!
|
||||
+ if (true && !(this instanceof net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon)) { // CraftBukkit - SPIGOT-2420: Special case ender dragon will drop the xp over time
|
||||
+ if (!(this instanceof net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon)) { // CraftBukkit - SPIGOT-2420: Special case ender dragon will drop the xp over time
|
||||
+ EntityExperienceOrb.award((WorldServer) this.level(), this.position(), this.expToDrop);
|
||||
+ this.expToDrop = 0;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
}
|
||||
|
||||
@@ -1551,13 +1820,25 @@
|
||||
protected void dropCustomDeathLoot(WorldServer worldserver, DamageSource damagesource, boolean flag) {}
|
||||
@@ -1540,9 +1804,14 @@
|
||||
}
|
||||
|
||||
public void knockback(double d0, double d1, double d2) {
|
||||
@@ -638,7 +635,11 @@
|
||||
- this.hasImpulse = true;
|
||||
+ if (true || d0 > 0.0D) { // CraftBukkit - Call event even when force is 0
|
||||
+ //this.hasImpulse = true; // CraftBukkit - Move down
|
||||
Vec3D vec3d = this.getDeltaMovement();
|
||||
|
||||
Vec3D vec3d;
|
||||
|
||||
@@ -1552,7 +1821,14 @@
|
||||
|
||||
Vec3D vec3d1 = (new Vec3D(d1, 0.0D, d2)).normalize().scale(d0);
|
||||
|
||||
- this.setDeltaMovement(vec3d.x / 2.0D - vec3d1.x, this.onGround() ? Math.min(0.4D, vec3d.y / 2.0D + d0) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);
|
||||
@@ -653,7 +654,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1614,6 +1895,28 @@
|
||||
@@ -1613,6 +1889,28 @@
|
||||
return itemstack.getEatingSound();
|
||||
}
|
||||
|
||||
@@ -682,7 +683,7 @@
|
||||
public Optional<BlockPosition> getLastClimbablePos() {
|
||||
return this.lastClimbablePos;
|
||||
}
|
||||
@@ -1669,9 +1972,14 @@
|
||||
@@ -1666,9 +1964,14 @@
|
||||
int i = this.calculateFallDamage(f, f1);
|
||||
|
||||
if (i > 0) {
|
||||
@@ -698,26 +699,26 @@
|
||||
return true;
|
||||
} else {
|
||||
return flag;
|
||||
@@ -1741,7 +2049,7 @@
|
||||
@@ -1738,7 +2041,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, damagesource, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
|
||||
f = CombatMath.getDamageAfterAbsorb(this, f, damagesource, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
|
||||
}
|
||||
|
||||
@@ -1754,7 +2062,8 @@
|
||||
@@ -1749,7 +2052,8 @@
|
||||
if (damagesource.is(DamageTypeTags.BYPASSES_EFFECTS)) {
|
||||
return f;
|
||||
} else {
|
||||
int i;
|
||||
|
||||
- if (this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && !damagesource.is(DamageTypeTags.BYPASSES_RESISTANCE)) {
|
||||
+ // CraftBukkit - Moved to actuallyHurt(DamageSource, float)
|
||||
+ if (false && this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && !damagesource.is(DamageTypeTags.BYPASSES_RESISTANCE)) {
|
||||
i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
|
||||
int i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
|
||||
int j = 25 - i;
|
||||
float f1 = f * (float) j;
|
||||
@@ -1787,16 +2096,125 @@
|
||||
@@ -1792,16 +2096,125 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -764,7 +765,7 @@
|
||||
+ };
|
||||
+ float armorModifier = armor.apply((double) f).floatValue();
|
||||
+ f += armorModifier;
|
||||
+
|
||||
|
||||
+ Function<Double, Double> resistance = new Function<Double, Double>() {
|
||||
+ @Override
|
||||
+ public Double apply(Double f) {
|
||||
@@ -823,7 +824,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));
|
||||
@@ -851,7 +852,7 @@
|
||||
if (f2 > 0.0F && f2 < 3.4028235E37F) {
|
||||
Entity entity = damagesource.getEntity();
|
||||
|
||||
@@ -1807,13 +2225,47 @@
|
||||
@@ -1812,13 +2225,47 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -901,7 +902,7 @@
|
||||
}
|
||||
|
||||
public CombatTracker getCombatTracker() {
|
||||
@@ -1838,8 +2290,18 @@
|
||||
@@ -1843,8 +2290,18 @@
|
||||
}
|
||||
|
||||
public final void setArrowCount(int i) {
|
||||
@@ -921,7 +922,7 @@
|
||||
|
||||
public final int getStingerCount() {
|
||||
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
|
||||
@@ -2075,6 +2537,12 @@
|
||||
@@ -2086,6 +2543,12 @@
|
||||
|
||||
public abstract ItemStack getItemBySlot(EnumItemSlot enumitemslot);
|
||||
|
||||
@@ -934,7 +935,7 @@
|
||||
public abstract void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
|
||||
|
||||
public Iterable<ItemStack> getHandSlots() {
|
||||
@@ -2328,6 +2796,7 @@
|
||||
@@ -2336,6 +2799,7 @@
|
||||
}
|
||||
|
||||
if (this.onGround() && !this.level().isClientSide) {
|
||||
@@ -942,7 +943,7 @@
|
||||
this.setSharedFlag(7, false);
|
||||
}
|
||||
} else {
|
||||
@@ -2498,7 +2967,7 @@
|
||||
@@ -2506,7 +2970,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -951,7 +952,7 @@
|
||||
if (this.tickCount % 20 == 0) {
|
||||
this.getCombatTracker().recheckStatus();
|
||||
}
|
||||
@@ -2602,7 +3071,7 @@
|
||||
@@ -2610,7 +3074,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -960,7 +961,7 @@
|
||||
Map<EnumItemSlot, ItemStack> map = this.collectEquipmentChanges();
|
||||
|
||||
if (map != null) {
|
||||
@@ -2924,6 +3393,7 @@
|
||||
@@ -2949,6 +3413,7 @@
|
||||
}
|
||||
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -968,7 +969,7 @@
|
||||
this.setSharedFlag(7, flag);
|
||||
}
|
||||
|
||||
@@ -3114,14 +3584,21 @@
|
||||
@@ -3141,14 +3606,21 @@
|
||||
|
||||
@Override
|
||||
public boolean isPickable() {
|
||||
@@ -992,7 +993,7 @@
|
||||
@Override
|
||||
public float getYHeadRot() {
|
||||
return this.yHeadRot;
|
||||
@@ -3314,7 +3791,26 @@
|
||||
@@ -3346,7 +3818,26 @@
|
||||
} else {
|
||||
if (!this.useItem.isEmpty() && this.isUsingItem()) {
|
||||
this.triggerItemUseEffects(this.useItem, 16);
|
||||
@@ -1020,7 +1021,7 @@
|
||||
|
||||
if (itemstack != this.useItem) {
|
||||
this.setItemInHand(enumhand, itemstack);
|
||||
@@ -3392,6 +3888,12 @@
|
||||
@@ -3424,6 +3915,12 @@
|
||||
}
|
||||
|
||||
public boolean randomTeleport(double d0, double d1, double d2, boolean flag) {
|
||||
@@ -1033,7 +1034,7 @@
|
||||
double d3 = this.getX();
|
||||
double d4 = this.getY();
|
||||
double d5 = this.getZ();
|
||||
@@ -3416,16 +3918,41 @@
|
||||
@@ -3448,16 +3945,41 @@
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
@@ -1078,7 +1079,7 @@
|
||||
} else {
|
||||
if (flag) {
|
||||
world.broadcastEntityEvent(this, (byte) 46);
|
||||
@@ -3437,7 +3964,7 @@
|
||||
@@ -3469,7 +3991,7 @@
|
||||
entitycreature.getNavigation().stop();
|
||||
}
|
||||
|
||||
@@ -1087,7 +1088,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3530,7 +4057,7 @@
|
||||
@@ -3562,7 +4084,7 @@
|
||||
}
|
||||
|
||||
public void stopSleeping() {
|
||||
@@ -1096,7 +1097,7 @@
|
||||
World world = this.level();
|
||||
|
||||
java.util.Objects.requireNonNull(world);
|
||||
@@ -3564,7 +4091,7 @@
|
||||
@@ -3596,7 +4118,7 @@
|
||||
|
||||
@Nullable
|
||||
public EnumDirection getBedOrientation() {
|
||||
@@ -1105,7 +1106,7 @@
|
||||
|
||||
return blockposition != null ? BlockBed.getBedOrientation(this.level(), blockposition) : null;
|
||||
}
|
||||
@@ -3600,7 +4127,7 @@
|
||||
@@ -3633,7 +4155,7 @@
|
||||
FoodInfo.b foodinfo_b = (FoodInfo.b) iterator.next();
|
||||
|
||||
if (this.random.nextFloat() < foodinfo_b.probability()) {
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
--- a/net/minecraft/world/entity/EntityTameableAnimal.java
|
||||
+++ b/net/minecraft/world/entity/EntityTameableAnimal.java
|
||||
@@ -27,6 +27,12 @@
|
||||
import net.minecraft.world.level.pathfinder.PathfinderNormal;
|
||||
import net.minecraft.world.scores.ScoreboardTeam;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class EntityTameableAnimal extends EntityAnimal implements OwnableEntity {
|
||||
|
||||
public static final int TELEPORT_WHEN_DISTANCE_IS_SQ = 144;
|
||||
@@ -281,7 +287,14 @@
|
||||
if (!this.canTeleportTo(new BlockPosition(i, j, k))) {
|
||||
return false;
|
||||
} else {
|
||||
- this.moveTo((double) i + 0.5D, (double) j, (double) k + 0.5D, this.getYRot(), this.getXRot());
|
||||
+ // CraftBukkit start
|
||||
+ EntityTeleportEvent event = CraftEventFactory.callEntityTeleportEvent(this, (double) i + 0.5D, (double) j, (double) k + 0.5D);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ Location to = event.getTo();
|
||||
+ this.moveTo(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
|
||||
+ // CraftBukkit end
|
||||
this.navigation.stop();
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
--- a/net/minecraft/world/entity/Leashable.java
|
||||
+++ b/net/minecraft/world/entity/Leashable.java
|
||||
@@ -15,6 +15,11 @@
|
||||
import net.minecraft.world.level.IMaterial;
|
||||
import net.minecraft.world.level.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityUnleashEvent;
|
||||
+import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public interface Leashable {
|
||||
|
||||
String LEASH_TAG = "leash";
|
||||
@@ -44,7 +49,7 @@
|
||||
|
||||
default void setDelayedLeashHolderId(int i) {
|
||||
this.setLeashData(new Leashable.a(i));
|
||||
- dropLeash((Entity) this, false, false);
|
||||
+ dropLeash((Entity & Leashable) this, false, false); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -53,7 +58,7 @@
|
||||
return new Leashable.a(Either.left(nbttagcompound.getCompound("leash").getUUID("UUID")));
|
||||
} else {
|
||||
if (nbttagcompound.contains("leash", 11)) {
|
||||
- Either<UUID, BlockPosition> either = (Either) GameProfileSerializer.readBlockPos(nbttagcompound, "leash").map(Either::right).orElse((Object) null);
|
||||
+ Either<UUID, BlockPosition> either = (Either) GameProfileSerializer.readBlockPos(nbttagcompound, "leash").map(Either::right).orElse(null); // CraftBukkit - decompile error
|
||||
|
||||
if (either != null) {
|
||||
return new Leashable.a(either);
|
||||
@@ -68,6 +73,11 @@
|
||||
if (leashable_a != null) {
|
||||
Either<UUID, BlockPosition> either = leashable_a.delayedLeashInfo;
|
||||
Entity entity = leashable_a.leashHolder;
|
||||
+ // CraftBukkit start - SPIGOT-7487: Don't save (and possible drop) leash, when the holder was removed by a plugin
|
||||
+ if (entity != null && entity.pluginRemoved) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (entity instanceof EntityLeash) {
|
||||
EntityLeash entityleash = (EntityLeash) entity;
|
||||
@@ -110,7 +120,9 @@
|
||||
}
|
||||
|
||||
if (e0.tickCount > 100) {
|
||||
+ e0.forceDrops = true; // CraftBukkit
|
||||
e0.spawnAtLocation((IMaterial) Items.LEAD);
|
||||
+ e0.forceDrops = false; // CraftBukkit
|
||||
((Leashable) e0).setLeashData((Leashable.a) null);
|
||||
}
|
||||
}
|
||||
@@ -119,7 +131,7 @@
|
||||
}
|
||||
|
||||
default void dropLeash(boolean flag, boolean flag1) {
|
||||
- dropLeash((Entity) this, flag, flag1);
|
||||
+ dropLeash((Entity & Leashable) this, flag, flag1); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
private static <E extends Entity & Leashable> void dropLeash(E e0, boolean flag, boolean flag1) {
|
||||
@@ -128,7 +140,9 @@
|
||||
if (leashable_a != null && leashable_a.leashHolder != null) {
|
||||
((Leashable) e0).setLeashData((Leashable.a) null);
|
||||
if (!e0.level().isClientSide && flag1) {
|
||||
+ e0.forceDrops = true; // CraftBukkit
|
||||
e0.spawnAtLocation((IMaterial) Items.LEAD);
|
||||
+ e0.forceDrops = false; // CraftBukkit
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
@@ -153,7 +167,8 @@
|
||||
|
||||
if (leashable_a != null && leashable_a.leashHolder != null) {
|
||||
if (!e0.isAlive() || !leashable_a.leashHolder.isAlive()) {
|
||||
- dropLeash(e0, true, true);
|
||||
+ e0.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(e0.getBukkitEntity(), (!e0.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit
|
||||
+ dropLeash(e0, true, !e0.pluginRemoved); // CraftBukkit - SPIGOT-7487: Don't drop leash, when the holder was removed by a plugin
|
||||
}
|
||||
|
||||
Entity entity = ((Leashable) e0).getLeashHolder();
|
||||
@@ -183,13 +198,18 @@
|
||||
}
|
||||
|
||||
default void leashTooFarBehaviour() {
|
||||
+ // CraftBukkit start
|
||||
+ if (this instanceof Entity entity) {
|
||||
+ entity.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(entity.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
default void closeRangeLeashBehaviour(Entity entity) {}
|
||||
|
||||
default void elasticRangeLeashBehaviour(Entity entity, float f) {
|
||||
- legacyElasticRangeLeashBehaviour((Entity) this, entity, f);
|
||||
+ legacyElasticRangeLeashBehaviour((Entity & Leashable) this, entity, f); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
private static <E extends Entity & Leashable> void legacyElasticRangeLeashBehaviour(E e0, Entity entity, float f) {
|
||||
@@ -201,7 +221,7 @@
|
||||
}
|
||||
|
||||
default void setLeashedTo(Entity entity, boolean flag) {
|
||||
- setLeashedTo((Entity) this, entity, flag);
|
||||
+ setLeashedTo((Entity & Leashable) this, entity, flag); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
private static <E extends Entity & Leashable> void setLeashedTo(E e0, Entity entity, boolean flag) {
|
||||
@@ -232,7 +252,7 @@
|
||||
|
||||
@Nullable
|
||||
default Entity getLeashHolder() {
|
||||
- return getLeashHolder((Entity) this);
|
||||
+ return getLeashHolder((Entity & Leashable) this); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1,31 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalFollowOwner.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalFollowOwner.java
|
||||
@@ -15,6 +15,12 @@
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
import net.minecraft.world.level.pathfinder.PathfinderNormal;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class PathfinderGoalFollowOwner extends PathfinderGoal {
|
||||
|
||||
public static final int TELEPORT_WHEN_DISTANCE_IS = 12;
|
||||
@@ -123,7 +129,14 @@
|
||||
} else if (!this.canTeleportTo(new BlockPosition(i, j, k))) {
|
||||
return false;
|
||||
} else {
|
||||
- this.tamable.moveTo((double) i + 0.5D, (double) j, (double) k + 0.5D, this.tamable.getYRot(), this.tamable.getXRot());
|
||||
+ // CraftBukkit start
|
||||
+ EntityTeleportEvent event = CraftEventFactory.callEntityTeleportEvent(this.tamable, (double) i + 0.5D, (double) j, (double) k + 0.5D);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ Location to = event.getTo();
|
||||
+ this.tamable.moveTo(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
|
||||
+ // CraftBukkit end
|
||||
this.navigation.stop();
|
||||
return true;
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
--- a/net/minecraft/world/entity/animal/Bucketable.java
|
||||
+++ b/net/minecraft/world/entity/animal/Bucketable.java
|
||||
@@ -17,6 +17,15 @@
|
||||
@@ -17,6 +17,14 @@
|
||||
import net.minecraft.world.item.component.CustomData;
|
||||
import net.minecraft.world.level.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
@@ -16,7 +15,7 @@
|
||||
public interface Bucketable {
|
||||
|
||||
boolean fromBucket();
|
||||
@@ -93,10 +102,22 @@
|
||||
@@ -93,10 +101,22 @@
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack.getItem() == Items.WATER_BUCKET && t0.isAlive()) {
|
||||
@@ -31,7 +30,7 @@
|
||||
+ itemstack1 = CraftItemStack.asNMSCopy(playerBucketFishEvent.getEntityBucket());
|
||||
+ 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.getBukkitEntity().update((EntityPlayer) entityhuman); // We need to play out these packets as the client assumes the fish is gone
|
||||
+ t0.refreshEntityData((EntityPlayer) entityhuman); // Need to send data such as the display name to client
|
||||
+ return Optional.of(EnumInteractionResult.FAIL);
|
||||
+ }
|
||||
@@ -40,7 +39,7 @@
|
||||
ItemStack itemstack2 = ItemLiquidUtil.createFilledResult(itemstack, entityhuman, itemstack1, false);
|
||||
|
||||
entityhuman.setItemInHand(enumhand, itemstack2);
|
||||
@@ -106,7 +127,7 @@
|
||||
@@ -106,7 +126,7 @@
|
||||
CriterionTriggers.FILLED_BUCKET.trigger((EntityPlayer) entityhuman, itemstack1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityBee.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityBee.java
|
||||
@@ -86,6 +86,12 @@
|
||||
@@ -87,6 +87,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;
|
||||
@@ -185,12 +191,19 @@
|
||||
@@ -186,12 +192,19 @@
|
||||
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
@@ -35,7 +35,7 @@
|
||||
nbttagcompound.put("flower_pos", GameProfileSerializer.writeBlockPos(this.getSavedFlowerPos()));
|
||||
}
|
||||
|
||||
@@ -204,8 +217,8 @@
|
||||
@@ -205,8 +218,8 @@
|
||||
|
||||
@Override
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
@@ -46,16 +46,16 @@
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
this.setHasNectar(nbttagcompound.getBoolean("HasNectar"));
|
||||
this.setHasStung(nbttagcompound.getBoolean("HasStung"));
|
||||
@@ -232,7 +245,7 @@
|
||||
@@ -243,7 +256,7 @@
|
||||
}
|
||||
|
||||
if (b0 > 0) {
|
||||
- ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.POISON, b0 * 20, 0), this);
|
||||
+ ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.POISON, b0 * 20, 0), this, EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
- entityliving.addEffect(new MobEffect(MobEffects.POISON, b0 * 20, 0), this);
|
||||
+ entityliving.addEffect(new MobEffect(MobEffects.POISON, b0 * 20, 0), this, EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -625,11 +638,14 @@
|
||||
@@ -636,11 +649,14 @@
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -72,7 +72,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -981,7 +997,7 @@
|
||||
@@ -992,7 +1008,7 @@
|
||||
|
||||
e() {
|
||||
super();
|
||||
@@ -81,7 +81,7 @@
|
||||
this.blacklistedTargets = Lists.newArrayList();
|
||||
this.setFlags(EnumSet.of(PathfinderGoal.Type.MOVE));
|
||||
}
|
||||
@@ -1098,7 +1114,7 @@
|
||||
@@ -1109,7 +1125,7 @@
|
||||
|
||||
f() {
|
||||
super();
|
||||
@@ -90,7 +90,7 @@
|
||||
this.setFlags(EnumSet.of(PathfinderGoal.Type.MOVE));
|
||||
}
|
||||
|
||||
@@ -1198,7 +1214,7 @@
|
||||
@@ -1209,7 +1225,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
EntityBee.this.level().levelEvent(2011, blockposition, 15);
|
||||
EntityBee.this.level().setBlockAndUpdate(blockposition, iblockdata1);
|
||||
EntityBee.this.incrementNumCropsGrownSincePollination();
|
||||
@@ -1271,7 +1287,7 @@
|
||||
@@ -1282,7 +1298,7 @@
|
||||
@Override
|
||||
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
if (entityinsentient instanceof EntityBee && this.mob.hasLineOfSight(entityliving)) {
|
||||
@@ -108,7 +108,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1280,7 +1296,7 @@
|
||||
@@ -1291,7 +1307,7 @@
|
||||
private static class c extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
|
||||
|
||||
c(EntityBee entitybee) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityCat.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityCat.java
|
||||
@@ -182,10 +182,10 @@
|
||||
@@ -181,10 +181,10 @@
|
||||
@Override
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
Objects.requireNonNull(iregistry);
|
||||
optional.flatMap(iregistry::getHolder).ifPresent(this::setVariant);
|
||||
@@ -462,7 +462,7 @@
|
||||
@@ -452,7 +452,7 @@
|
||||
}
|
||||
|
||||
private void tryToTame(EntityHuman entityhuman) {
|
||||
@@ -22,7 +22,7 @@
|
||||
this.tame(entityhuman);
|
||||
this.setOrderedToSit(true);
|
||||
this.level().broadcastEntityEvent(this, (byte) 7);
|
||||
@@ -480,7 +480,7 @@
|
||||
@@ -470,7 +470,7 @@
|
||||
private static class PathfinderGoalTemptChance extends PathfinderGoalTempt {
|
||||
|
||||
@Nullable
|
||||
@@ -31,7 +31,7 @@
|
||||
private final EntityCat cat;
|
||||
|
||||
public PathfinderGoalTemptChance(EntityCat entitycat, double d0, Predicate<ItemStack> predicate, boolean flag) {
|
||||
@@ -621,7 +621,15 @@
|
||||
@@ -611,7 +611,15 @@
|
||||
while (iterator.hasNext()) {
|
||||
ItemStack itemstack = (ItemStack) iterator.next();
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -653,10 +661,10 @@
|
||||
@@ -643,10 +651,10 @@
|
||||
private final EntityCat cat;
|
||||
|
||||
public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) {
|
||||
|
||||
@@ -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);
|
||||
@@ -183,7 +195,7 @@
|
||||
@@ -176,7 +188,7 @@
|
||||
|
||||
@Override
|
||||
public int getMaxAirSupply() {
|
||||
@@ -30,7 +30,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -219,11 +231,17 @@
|
||||
@@ -212,11 +224,17 @@
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
|
||||
if (this.canHoldItem(itemstack)) {
|
||||
@@ -49,7 +49,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,7 +492,7 @@
|
||||
@@ -467,7 +485,7 @@
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
@@ -58,7 +58,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -493,7 +511,7 @@
|
||||
@@ -486,7 +504,7 @@
|
||||
}
|
||||
|
||||
if (this.player.isSwimming() && this.player.level().random.nextInt(6) == 0) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityIronGolem.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityIronGolem.java
|
||||
@@ -97,7 +97,7 @@
|
||||
@@ -98,7 +98,7 @@
|
||||
@Override
|
||||
protected void doPush(Entity entity) {
|
||||
if (entity instanceof IMonster && !(entity instanceof EntityCreeper) && this.getRandom().nextInt(20) == 0) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityOcelot.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityOcelot.java
|
||||
@@ -177,7 +177,7 @@
|
||||
@@ -168,7 +168,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);
|
||||
@@ -308,10 +308,10 @@
|
||||
@@ -299,10 +299,10 @@
|
||||
private final EntityOcelot ocelot;
|
||||
|
||||
public a(EntityOcelot entityocelot, Class<T> oclass, float f, double d0, double d1) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityPanda.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityPanda.java
|
||||
@@ -72,6 +72,12 @@
|
||||
@@ -73,6 +73,12 @@
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
public class EntityPanda extends EntityAnimal {
|
||||
|
||||
private static final DataWatcherObject<Integer> UNHAPPY_COUNTER = DataWatcher.defineId(EntityPanda.class, DataWatcherRegistry.INT);
|
||||
@@ -553,14 +559,14 @@
|
||||
@@ -558,14 +564,14 @@
|
||||
|
||||
@Override
|
||||
protected void pickUpItem(EntityItem entityitem) {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
if (entityhuman.isCreative() || !this.isInvulnerable()) {
|
||||
this.hurt(this.damageSources().playerAttack(entityhuman), Float.MAX_VALUE);
|
||||
}
|
||||
@@ -368,7 +368,7 @@
|
||||
@@ -363,7 +363,7 @@
|
||||
|
||||
@Override
|
||||
public boolean isPushable() {
|
||||
@@ -27,7 +27,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -383,11 +383,14 @@
|
||||
@@ -378,11 +378,14 @@
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityRabbit.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityRabbit.java
|
||||
@@ -66,6 +66,10 @@
|
||||
@@ -67,6 +67,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;
|
||||
@@ -88,7 +92,6 @@
|
||||
@@ -91,7 +95,6 @@
|
||||
super(entitytypes, world);
|
||||
this.jumpControl = new EntityRabbit.ControllerJumpRabbit(this);
|
||||
this.moveControl = new EntityRabbit.ControllerMoveRabbit(this);
|
||||
@@ -19,7 +19,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -574,9 +577,19 @@
|
||||
@@ -578,9 +581,19 @@
|
||||
int i = (Integer) iblockdata.getValue(BlockCarrots.AGE);
|
||||
|
||||
if (i == 0) {
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntitySheep.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntitySheep.java
|
||||
@@ -64,6 +64,14 @@
|
||||
@@ -63,6 +63,12 @@
|
||||
import net.minecraft.world.level.storage.loot.LootTable;
|
||||
import net.minecraft.world.level.storage.loot.LootTables;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.inventory.InventoryCraftResult;
|
||||
+import net.minecraft.world.item.Item;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.entity.SheepRegrowWoolEvent;
|
||||
+import org.bukkit.inventory.InventoryView;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntitySheep extends EntityAnimal implements IShearable {
|
||||
|
||||
private static final int EAT_ANIMATION_TICKS = 40;
|
||||
@@ -251,6 +259,11 @@
|
||||
@@ -250,6 +256,11 @@
|
||||
|
||||
if (itemstack.is(Items.SHEARS)) {
|
||||
if (!this.level().isClientSide && this.readyForShearing()) {
|
||||
@@ -27,7 +25,7 @@
|
||||
this.shear(SoundCategory.PLAYERS);
|
||||
this.gameEvent(GameEvent.SHEAR, entityhuman);
|
||||
itemstack.hurtAndBreak(1, entityhuman, getSlotForHand(enumhand));
|
||||
@@ -270,7 +283,9 @@
|
||||
@@ -269,7 +280,9 @@
|
||||
int i = 1 + this.random.nextInt(3);
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
@@ -37,7 +35,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)));
|
||||
@@ -363,6 +378,12 @@
|
||||
@@ -362,6 +375,12 @@
|
||||
|
||||
@Override
|
||||
public void ate() {
|
||||
@@ -50,31 +48,12 @@
|
||||
super.ate();
|
||||
this.setSheared(false);
|
||||
if (this.isBaby()) {
|
||||
@@ -382,7 +403,7 @@
|
||||
@@ -381,7 +400,7 @@
|
||||
EnumColor enumcolor = ((EntitySheep) entityanimal).getColor();
|
||||
EnumColor enumcolor1 = ((EntitySheep) entityanimal1).getColor();
|
||||
InventoryCrafting inventorycrafting = makeContainer(enumcolor, enumcolor1);
|
||||
- Optional optional = this.level().getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level()).map((recipeholder) -> {
|
||||
+ Optional<Item> optional = this.level().getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level()).map((recipeholder) -> { // CraftBukkit - decompile error
|
||||
return ((RecipeCrafting) recipeholder.value()).assemble(inventorycrafting, this.level().registryAccess());
|
||||
CraftingInput craftinginput = makeCraftInput(enumcolor, enumcolor1);
|
||||
- Optional optional = this.level().getRecipeManager().getRecipeFor(Recipes.CRAFTING, craftinginput, this.level()).map((recipeholder) -> {
|
||||
+ Optional<Item> optional = this.level().getRecipeManager().getRecipeFor(Recipes.CRAFTING, craftinginput, this.level()).map((recipeholder) -> { // CraftBukkit - decompile error
|
||||
return ((RecipeCrafting) recipeholder.value()).assemble(craftinginput, this.level().registryAccess());
|
||||
}).map(ItemStack::getItem);
|
||||
|
||||
@@ -405,10 +426,18 @@
|
||||
public boolean stillValid(EntityHuman entityhuman) {
|
||||
return false;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public InventoryView getBukkitView() {
|
||||
+ return null; // TODO: O.O
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}, 2, 1);
|
||||
|
||||
transientcraftingcontainer.setItem(0, new ItemStack(ItemDye.byColor(enumcolor)));
|
||||
transientcraftingcontainer.setItem(1, new ItemStack(ItemDye.byColor(enumcolor1)));
|
||||
+ transientcraftingcontainer.resultInventory = new InventoryCraftResult(); // CraftBukkit - add result slot for event
|
||||
return transientcraftingcontainer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityWolf.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityWolf.java
|
||||
@@ -88,6 +88,12 @@
|
||||
@@ -90,6 +90,12 @@
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
public class EntityWolf extends EntityTameableAnimal implements IEntityAngerable, VariantHolder<Holder<WolfVariant>> {
|
||||
|
||||
private static final DataWatcherObject<Boolean> DATA_INTERESTED_ID = DataWatcher.defineId(EntityWolf.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -350,18 +356,21 @@
|
||||
@@ -360,11 +366,14 @@
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -30,6 +30,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,9 +383,9 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
- protected void actuallyHurt(DamageSource damagesource, float f) {
|
||||
+ public boolean actuallyHurt(DamageSource damagesource, float f) { // CraftBukkit - void -> boolean
|
||||
@@ -39,7 +42,7 @@
|
||||
} else {
|
||||
ItemStack itemstack = this.getBodyArmorItem();
|
||||
int i = itemstack.getDamageValue();
|
||||
@@ -380,6 +389,7 @@
|
||||
@@ -395,6 +404,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -47,7 +50,7 @@
|
||||
}
|
||||
|
||||
private boolean canArmorAbsorb(DamageSource damagesource) {
|
||||
@@ -401,7 +411,7 @@
|
||||
@@ -405,7 +415,7 @@
|
||||
protected void applyTamingSideEffects() {
|
||||
if (this.isTame()) {
|
||||
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(40.0D);
|
||||
@@ -56,7 +59,7 @@
|
||||
} else {
|
||||
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(8.0D);
|
||||
}
|
||||
@@ -428,7 +438,7 @@
|
||||
@@ -432,7 +442,7 @@
|
||||
FoodInfo foodinfo = (FoodInfo) itemstack.get(DataComponents.FOOD);
|
||||
float f = foodinfo != null ? (float) foodinfo.nutrition() : 1.0F;
|
||||
|
||||
@@ -65,7 +68,7 @@
|
||||
return EnumInteractionResult.sidedSuccess(this.level().isClientSide());
|
||||
} else {
|
||||
if (item instanceof ItemDye) {
|
||||
@@ -476,7 +486,7 @@
|
||||
@@ -480,7 +490,7 @@
|
||||
this.setOrderedToSit(!this.isOrderedToSit());
|
||||
this.jumping = false;
|
||||
this.navigation.stop();
|
||||
@@ -74,7 +77,7 @@
|
||||
return EnumInteractionResult.SUCCESS_NO_ITEM_USED;
|
||||
} else {
|
||||
return enuminteractionresult;
|
||||
@@ -494,7 +504,8 @@
|
||||
@@ -498,7 +508,8 @@
|
||||
}
|
||||
|
||||
private void tryToTame(EntityHuman entityhuman) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
+++ b/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
@@ -99,6 +99,7 @@
|
||||
@@ -101,6 +101,7 @@
|
||||
private float dancingAnimationTicks;
|
||||
private float spinningAnimationTicks;
|
||||
private float spinningAnimationTicks0;
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
public Allay(EntityTypes<? extends Allay> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -110,6 +111,12 @@
|
||||
@@ -112,6 +113,12 @@
|
||||
this.dynamicJukeboxListener = new DynamicGameEventListener<>(new Allay.a(this.vibrationUser.getPositionSource(), ((GameEvent) GameEvent.JUKEBOX_PLAY.value()).notificationRadius()));
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
@Override
|
||||
protected BehaviorController.b<Allay> brainProvider() {
|
||||
return BehaviorController.provider(Allay.MEMORY_TYPES, Allay.SENSOR_TYPES);
|
||||
@@ -122,7 +129,7 @@
|
||||
@@ -124,7 +131,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<Allay> getBrain() {
|
||||
@@ -30,7 +30,7 @@
|
||||
}
|
||||
|
||||
public static AttributeProvider.Builder createAttributes() {
|
||||
@@ -223,7 +230,7 @@
|
||||
@@ -225,7 +232,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) {
|
||||
@@ -293,7 +300,12 @@
|
||||
@@ -295,7 +302,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);
|
||||
@@ -304,7 +316,7 @@
|
||||
@@ -306,7 +318,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,7 +62,7 @@
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else if (!itemstack1.isEmpty() && enumhand == EnumHand.MAIN_HAND && itemstack.isEmpty()) {
|
||||
this.setItemSlot(EnumItemSlot.MAINHAND, ItemStack.EMPTY);
|
||||
@@ -405,6 +417,7 @@
|
||||
@@ -407,6 +419,7 @@
|
||||
}
|
||||
|
||||
private boolean shouldStopDancing() {
|
||||
@@ -70,25 +70,7 @@
|
||||
return this.jukeboxPos == null || !this.jukeboxPos.closerToCenterThan(this.position(), (double) ((GameEvent) GameEvent.JUKEBOX_PLAY.value()).notificationRadius()) || !this.level().getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
|
||||
}
|
||||
|
||||
@@ -449,7 +462,7 @@
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(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);
|
||||
@@ -465,7 +478,7 @@
|
||||
super.readAdditionalSaveData(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);
|
||||
@@ -498,7 +511,7 @@
|
||||
@@ -500,7 +513,7 @@
|
||||
return Allay.DUPLICATION_ITEM.test(itemstack);
|
||||
}
|
||||
|
||||
@@ -97,7 +79,7 @@
|
||||
Allay allay = (Allay) EntityTypes.ALLAY.create(this.level());
|
||||
|
||||
if (allay != null) {
|
||||
@@ -506,9 +519,9 @@
|
||||
@@ -508,9 +521,9 @@
|
||||
allay.setPersistenceRequired();
|
||||
allay.resetDuplicationCooldown();
|
||||
this.resetDuplicationCooldown();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||
+++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||
@@ -131,14 +131,16 @@
|
||||
@@ -132,14 +132,16 @@
|
||||
@Override
|
||||
protected void customServerAiStep() {
|
||||
this.level().getProfiler().push("armadilloBrain");
|
||||
@@ -18,7 +18,7 @@
|
||||
this.gameEvent(GameEvent.ENTITY_PLACE);
|
||||
this.scuteTime = this.pickNextScuteDropTime();
|
||||
}
|
||||
@@ -285,8 +287,13 @@
|
||||
@@ -286,8 +288,13 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,15 +34,15 @@
|
||||
if (!this.isNoAi() && !this.isDeadOrDying()) {
|
||||
if (damagesource.getEntity() instanceof EntityLiving) {
|
||||
this.getBrain().setMemoryWithExpiry(MemoryModuleType.DANGER_DETECTED_RECENTLY, true, 80L);
|
||||
@@ -298,6 +305,7 @@
|
||||
@@ -299,6 +306,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
+ return hurt; // CraftBukkit
|
||||
}
|
||||
|
||||
public boolean shouldPanic() {
|
||||
@@ -329,7 +337,9 @@
|
||||
@Override
|
||||
@@ -326,7 +334,9 @@
|
||||
if (this.isBaby()) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
||||
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
||||
@@ -67,9 +67,16 @@
|
||||
@@ -68,9 +68,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);
|
||||
@@ -186,7 +193,7 @@
|
||||
@@ -187,7 +194,7 @@
|
||||
|
||||
@Override
|
||||
public int getMaxAirSupply() {
|
||||
@@ -27,7 +27,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -397,7 +404,7 @@
|
||||
@@ -391,7 +398,7 @@
|
||||
int i = mobeffect != null ? mobeffect.getDuration() : 0;
|
||||
int j = Math.min(2400, 100 + i);
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
}
|
||||
|
||||
entityhuman.removeEffect(MobEffects.DIG_SLOWDOWN);
|
||||
@@ -447,7 +454,7 @@
|
||||
@@ -441,7 +448,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<Axolotl> getBrain() {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
behaviorcontroller.tick((WorldServer) this.level(), this);
|
||||
this.level().getProfiler().pop();
|
||||
@@ -451,9 +451,15 @@
|
||||
@@ -452,9 +452,15 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -232,9 +236,15 @@
|
||||
@@ -232,10 +236,16 @@
|
||||
}
|
||||
|
||||
frog.setPersistenceRequired();
|
||||
@@ -30,6 +30,7 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
frog.fudgePositionAfterSizeChange(this.getDimensions(this.getPose()));
|
||||
this.playSound(SoundEffects.TADPOLE_GROW_UP, 0.15F, 1.0F);
|
||||
- worldserver.addFreshEntityWithPassengers(frog);
|
||||
- this.discard();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
|
||||
@@ -79,6 +79,18 @@
|
||||
@@ -81,6 +81,18 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import net.minecraft.world.ticks.ContainerSingleItem;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, HasCustomInventoryScreen, OwnableEntity, IJumpable, ISaddleable {
|
||||
|
||||
public static final int EQUIPMENT_SLOT_OFFSET = 400;
|
||||
@@ -156,7 +168,53 @@
|
||||
@@ -158,7 +170,53 @@
|
||||
public boolean stillValid(EntityHuman entityhuman) {
|
||||
return entityhuman.getVehicle() == EntityHorseAbstract.this || entityhuman.canInteractWithEntity((Entity) EntityHorseAbstract.this, 4.0D);
|
||||
}
|
||||
@@ -73,7 +73,7 @@
|
||||
|
||||
protected EntityHorseAbstract(EntityTypes<? extends EntityHorseAbstract> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -346,7 +404,7 @@
|
||||
@@ -353,7 +411,7 @@
|
||||
public void createInventory() {
|
||||
InventorySubcontainer inventorysubcontainer = this.inventory;
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
if (inventorysubcontainer != null) {
|
||||
inventorysubcontainer.removeListener(this);
|
||||
int i = Math.min(inventorysubcontainer.getContainerSize(), this.inventory.getContainerSize());
|
||||
@@ -450,7 +508,7 @@
|
||||
@@ -457,7 +515,7 @@
|
||||
}
|
||||
|
||||
public int getMaxTemper() {
|
||||
@@ -91,7 +91,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -521,7 +579,7 @@
|
||||
@@ -528,7 +586,7 @@
|
||||
}
|
||||
|
||||
if (this.getHealth() < this.getMaxHealth() && f > 0.0F) {
|
||||
@@ -100,7 +100,7 @@
|
||||
flag = true;
|
||||
}
|
||||
|
||||
@@ -595,7 +653,7 @@
|
||||
@@ -602,7 +660,7 @@
|
||||
super.aiStep();
|
||||
if (!this.level().isClientSide && this.isAlive()) {
|
||||
if (this.random.nextInt(900) == 0 && this.deathTime == 0) {
|
||||
@@ -109,7 +109,7 @@
|
||||
}
|
||||
|
||||
if (this.canEatGrass()) {
|
||||
@@ -857,6 +915,7 @@
|
||||
@@ -864,6 +922,7 @@
|
||||
if (this.getOwnerUUID() != null) {
|
||||
nbttagcompound.putUUID("Owner", this.getOwnerUUID());
|
||||
}
|
||||
@@ -117,7 +117,7 @@
|
||||
|
||||
if (!this.inventory.getItem(0).isEmpty()) {
|
||||
nbttagcompound.put("SaddleItem", this.inventory.getItem(0).save(this.registryAccess()));
|
||||
@@ -884,6 +943,11 @@
|
||||
@@ -891,6 +950,11 @@
|
||||
if (uuid != null) {
|
||||
this.setOwnerUUID(uuid);
|
||||
}
|
||||
@@ -129,7 +129,7 @@
|
||||
|
||||
if (nbttagcompound.contains("SaddleItem", 10)) {
|
||||
ItemStack itemstack = (ItemStack) ItemStack.parse(this.registryAccess(), nbttagcompound.getCompound("SaddleItem")).orElse(ItemStack.EMPTY);
|
||||
@@ -986,6 +1050,17 @@
|
||||
@@ -993,6 +1057,17 @@
|
||||
|
||||
@Override
|
||||
public void handleStartJump(int i) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
public class EntityEnderCrystal extends Entity {
|
||||
|
||||
private static final DataWatcherObject<Optional<BlockPosition>> DATA_BEAM_TARGET = DataWatcher.defineId(EntityEnderCrystal.class, DataWatcherRegistry.OPTIONAL_BLOCK_POS);
|
||||
@@ -55,7 +61,11 @@
|
||||
@@ -57,7 +63,11 @@
|
||||
BlockPosition blockposition = this.blockPosition();
|
||||
|
||||
if (((WorldServer) this.level()).getDragonFight() != null && this.level().getBlockState(blockposition).isAir()) {
|
||||
@@ -26,7 +26,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,12 +102,26 @@
|
||||
@@ -94,12 +104,26 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.isRemoved() && !this.level().isClientSide) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
||||
+++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
||||
@@ -51,6 +51,20 @@
|
||||
@@ -52,6 +52,20 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -88,6 +102,7 @@
|
||||
@@ -89,6 +103,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);
|
||||
@@ -109,6 +124,7 @@
|
||||
@@ -110,6 +125,7 @@
|
||||
this.noPhysics = true;
|
||||
this.noCulling = true;
|
||||
this.phaseManager = new DragonControllerManager(this);
|
||||
@@ -37,7 +37,7 @@
|
||||
}
|
||||
|
||||
public void setDragonFight(EnderDragonBattle enderdragonbattle) {
|
||||
@@ -256,7 +272,7 @@
|
||||
@@ -257,7 +273,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();
|
||||
@@ -397,7 +413,14 @@
|
||||
@@ -404,7 +420,14 @@
|
||||
if (this.nearestCrystal.isRemoved()) {
|
||||
this.nearestCrystal = null;
|
||||
} else if (this.tickCount % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
|
||||
@@ -62,7 +62,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,6 +495,9 @@
|
||||
@@ -489,6 +512,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) {
|
||||
@@ -481,7 +507,11 @@
|
||||
@@ -498,7 +524,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;
|
||||
}
|
||||
@@ -490,6 +520,51 @@
|
||||
@@ -507,6 +537,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));
|
||||
|
||||
@@ -545,7 +620,7 @@
|
||||
@@ -562,7 +637,7 @@
|
||||
|
||||
@Override
|
||||
public void kill() {
|
||||
@@ -146,13 +146,13 @@
|
||||
this.gameEvent(GameEvent.ENTITY_DIE);
|
||||
if (this.dragonFight != null) {
|
||||
this.dragonFight.updateDragon(this);
|
||||
@@ -554,6 +629,21 @@
|
||||
@@ -571,6 +646,21 @@
|
||||
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - SPIGOT-2420: Special case, the ender dragon drops 12000 xp for the first kill and 500 xp for every other kill and this over time.
|
||||
+ @Override
|
||||
+ public int getExpReward() {
|
||||
+ public int getExpReward(Entity entity) {
|
||||
+ // CraftBukkit - Moved from #tickDeath method
|
||||
+ boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT);
|
||||
+ short short0 = 500;
|
||||
@@ -168,7 +168,7 @@
|
||||
@Override
|
||||
protected void tickDeath() {
|
||||
if (this.dragonFight != null) {
|
||||
@@ -569,15 +659,20 @@
|
||||
@@ -586,15 +676,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));
|
||||
}
|
||||
|
||||
@@ -588,7 +683,7 @@
|
||||
@@ -605,7 +700,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));
|
||||
}
|
||||
|
||||
@@ -596,7 +691,7 @@
|
||||
@@ -613,7 +708,7 @@
|
||||
this.dragonFight.setDragonKilled(this);
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@
|
||||
this.gameEvent(GameEvent.ENTITY_DIE);
|
||||
}
|
||||
|
||||
@@ -809,6 +904,7 @@
|
||||
@@ -826,6 +921,7 @@
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
nbttagcompound.putInt("DragonPhase", this.phaseManager.getCurrentPhase().getPhase().getId());
|
||||
nbttagcompound.putInt("DragonDeathTime", this.dragonDeathTime);
|
||||
@@ -216,7 +216,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -822,6 +918,11 @@
|
||||
@@ -839,6 +935,11 @@
|
||||
this.dragonDeathTime = nbttagcompound.getInt("DragonDeathTime");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/boss/wither/EntityWither.java
|
||||
+++ b/net/minecraft/world/entity/boss/wither/EntityWither.java
|
||||
@@ -58,6 +58,18 @@
|
||||
@@ -59,6 +59,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);
|
||||
@@ -254,15 +266,40 @@
|
||||
@@ -255,15 +267,40 @@
|
||||
i = this.getInvulnerableTicks() - 1;
|
||||
this.bossEvent.setProgress(1.0F - (float) i / 220.0F);
|
||||
if (i <= 0) {
|
||||
@@ -63,7 +63,7 @@
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -307,6 +344,7 @@
|
||||
@@ -308,6 +345,7 @@
|
||||
if (!list.isEmpty()) {
|
||||
EntityLiving entityliving1 = (EntityLiving) list.get(this.random.nextInt(list.size()));
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
this.setAlternativeTarget(i, entityliving1.getId());
|
||||
}
|
||||
}
|
||||
@@ -333,6 +371,11 @@
|
||||
@@ -334,6 +372,11 @@
|
||||
IBlockData iblockdata = this.level().getBlockState(blockposition);
|
||||
|
||||
if (canDestroy(iblockdata)) {
|
||||
@@ -83,7 +83,7 @@
|
||||
flag = this.level().destroyBlock(blockposition, true, this) || flag;
|
||||
}
|
||||
}
|
||||
@@ -344,7 +387,7 @@
|
||||
@@ -345,7 +388,7 @@
|
||||
}
|
||||
|
||||
if (this.tickCount % 20 == 0) {
|
||||
@@ -92,7 +92,7 @@
|
||||
}
|
||||
|
||||
this.bossEvent.setProgress(this.getHealth() / this.getMaxHealth());
|
||||
@@ -500,7 +543,7 @@
|
||||
@@ -502,7 +545,7 @@
|
||||
@Override
|
||||
public void checkDespawn() {
|
||||
if (this.level().getDifficulty() == EnumDifficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
|
||||
|
||||
@@ -1,87 +1,22 @@
|
||||
--- a/net/minecraft/world/entity/decoration/EntityHanging.java
|
||||
+++ b/net/minecraft/world/entity/decoration/EntityHanging.java
|
||||
@@ -27,6 +27,14 @@
|
||||
import org.apache.commons.lang3.Validate;
|
||||
--- a/net/minecraft/world/entity/decoration/BlockAttachedEntity.java
|
||||
+++ b/net/minecraft/world/entity/decoration/BlockAttachedEntity.java
|
||||
@@ -15,6 +15,15 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.tags.DamageTypeTags;
|
||||
+import net.minecraft.world.level.block.state.IBlockData;
|
||||
+import org.bukkit.entity.Hanging;
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||
+import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class EntityHanging extends Entity {
|
||||
public abstract class BlockAttachedEntity extends Entity {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -61,26 +69,37 @@
|
||||
|
||||
protected void recalculateBoundingBox() {
|
||||
if (this.direction != null) {
|
||||
- double d0 = (double) this.pos.getX() + 0.5D;
|
||||
- double d1 = (double) this.pos.getY() + 0.5D;
|
||||
- double d2 = (double) this.pos.getZ() + 0.5D;
|
||||
+ // CraftBukkit start code moved in to calculateBoundingBox
|
||||
+ this.setBoundingBox(calculateBoundingBox(this, this.pos, this.direction, this.getWidth(), this.getHeight()));
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start - break out BB calc into own method
|
||||
+ public static AxisAlignedBB calculateBoundingBox(@Nullable Entity entity, BlockPosition blockPosition, EnumDirection direction, int width, int height) {
|
||||
+ {
|
||||
+ double d0 = (double) blockPosition.getX() + 0.5D;
|
||||
+ double d1 = (double) blockPosition.getY() + 0.5D;
|
||||
+ double d2 = (double) blockPosition.getZ() + 0.5D;
|
||||
double d3 = 0.46875D;
|
||||
- double d4 = this.offs(this.getWidth());
|
||||
- double d5 = this.offs(this.getHeight());
|
||||
+ double d4 = offs(width);
|
||||
+ double d5 = offs(height);
|
||||
|
||||
- d0 -= (double) this.direction.getStepX() * 0.46875D;
|
||||
- d2 -= (double) this.direction.getStepZ() * 0.46875D;
|
||||
+ d0 -= (double) direction.getStepX() * 0.46875D;
|
||||
+ d2 -= (double) direction.getStepZ() * 0.46875D;
|
||||
d1 += d5;
|
||||
- EnumDirection enumdirection = this.direction.getCounterClockWise();
|
||||
+ EnumDirection enumdirection = direction.getCounterClockWise();
|
||||
|
||||
d0 += d4 * (double) enumdirection.getStepX();
|
||||
d2 += d4 * (double) enumdirection.getStepZ();
|
||||
- this.setPosRaw(d0, d1, d2);
|
||||
- double d6 = (double) this.getWidth();
|
||||
- double d7 = (double) this.getHeight();
|
||||
- double d8 = (double) this.getWidth();
|
||||
+ if (entity != null) {
|
||||
+ entity.setPosRaw(d0, d1, d2);
|
||||
+ }
|
||||
+ double d6 = (double) width;
|
||||
+ double d7 = (double) height;
|
||||
+ double d8 = (double) width;
|
||||
|
||||
- if (this.direction.getAxis() == EnumDirection.EnumAxis.Z) {
|
||||
+ if (direction.getAxis() == EnumDirection.EnumAxis.Z) {
|
||||
d8 = 1.0D;
|
||||
} else {
|
||||
d6 = 1.0D;
|
||||
@@ -89,11 +108,12 @@
|
||||
d6 /= 32.0D;
|
||||
d7 /= 32.0D;
|
||||
d8 /= 32.0D;
|
||||
- this.setBoundingBox(new AxisAlignedBB(d0 - d6, d1 - d7, d2 - d8, d0 + d6, d1 + d7, d2 + d8));
|
||||
+ return new AxisAlignedBB(d0 - d6, d1 - d7, d2 - d8, d0 + d6, d1 + d7, d2 + d8);
|
||||
}
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
- private double offs(int i) {
|
||||
+ private static double offs(int i) { // CraftBukkit - static
|
||||
return i % 32 == 0 ? 0.5D : 0.0D;
|
||||
}
|
||||
|
||||
@@ -104,7 +124,25 @@
|
||||
@@ -39,7 +48,25 @@
|
||||
if (this.checkInterval++ == 100) {
|
||||
this.checkInterval = 0;
|
||||
if (!this.isRemoved() && !this.survives()) {
|
||||
@@ -108,12 +43,12 @@
|
||||
this.dropItem((Entity) null);
|
||||
}
|
||||
}
|
||||
@@ -165,6 +203,22 @@
|
||||
@@ -69,6 +96,22 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.isRemoved() && !this.level().isClientSide) {
|
||||
+ // CraftBukkit start - fire break events
|
||||
+ Entity damager = (damagesource.isIndirect()) ? damagesource.getEntity() : damagesource.getDirectEntity();
|
||||
+ Entity damager = (damagesource.isDirect()) ? damagesource.getDirectEntity() : damagesource.getEntity();
|
||||
+ HangingBreakEvent event;
|
||||
+ if (damager != null) {
|
||||
+ event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damager.getBukkitEntity(), damagesource.is(DamageTypeTags.IS_EXPLOSION) ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.ENTITY);
|
||||
@@ -131,7 +66,7 @@
|
||||
this.kill();
|
||||
this.markHurt();
|
||||
this.dropItem(damagesource.getEntity());
|
||||
@@ -177,6 +231,18 @@
|
||||
@@ -81,6 +124,18 @@
|
||||
@Override
|
||||
public void move(EnumMoveType enummovetype, Vec3D vec3d) {
|
||||
if (!this.level().isClientSide && !this.isRemoved() && vec3d.lengthSqr() > 0.0D) {
|
||||
@@ -150,7 +85,7 @@
|
||||
this.kill();
|
||||
this.dropItem((Entity) null);
|
||||
}
|
||||
@@ -185,13 +251,22 @@
|
||||
@@ -89,13 +144,22 @@
|
||||
|
||||
@Override
|
||||
public void push(double d0, double d1, double d2) {
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/decoration/EntityArmorStand.java
|
||||
+++ b/net/minecraft/world/entity/decoration/EntityArmorStand.java
|
||||
@@ -47,6 +47,16 @@
|
||||
@@ -46,6 +46,16 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
public class EntityArmorStand extends EntityLiving {
|
||||
|
||||
public static final int WOBBLE_TIME = 5;
|
||||
@@ -112,6 +122,13 @@
|
||||
@@ -111,6 +121,13 @@
|
||||
return createLivingAttributes().add(GenericAttributes.STEP_HEIGHT, 0.0D);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
@Override
|
||||
public void refreshDimensions() {
|
||||
double d0 = this.getX();
|
||||
@@ -172,13 +189,20 @@
|
||||
@@ -171,13 +188,20 @@
|
||||
|
||||
@Override
|
||||
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||
@@ -48,13 +48,13 @@
|
||||
- this.onEquipItem(enumitemslot, (ItemStack) this.handItems.set(enumitemslot.getIndex(), itemstack), itemstack);
|
||||
+ this.onEquipItem(enumitemslot, (ItemStack) this.handItems.set(enumitemslot.getIndex(), itemstack), itemstack, silent); // CraftBukkit
|
||||
break;
|
||||
case ARMOR:
|
||||
case HUMANOID_ARMOR:
|
||||
- this.onEquipItem(enumitemslot, (ItemStack) this.armorItems.set(enumitemslot.getIndex(), itemstack), itemstack);
|
||||
+ this.onEquipItem(enumitemslot, (ItemStack) this.armorItems.set(enumitemslot.getIndex(), itemstack), itemstack, silent); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -408,7 +432,25 @@
|
||||
@@ -407,7 +431,25 @@
|
||||
return false;
|
||||
} else if (itemstack1.isEmpty() && (this.disabledSlots & 1 << enumitemslot.getFilterFlag() + 16) != 0) {
|
||||
return false;
|
||||
@@ -81,7 +81,7 @@
|
||||
this.setItemSlot(enumitemslot, itemstack.copyWithCount(1));
|
||||
return true;
|
||||
} else if (!itemstack.isEmpty() && itemstack.getCount() > 1) {
|
||||
@@ -423,18 +465,29 @@
|
||||
@@ -422,6 +464,7 @@
|
||||
entityhuman.setItemInHand(enumhand, itemstack1);
|
||||
return true;
|
||||
}
|
||||
@@ -89,75 +89,76 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hurt(DamageSource damagesource, float f) {
|
||||
if (!this.level().isClientSide && !this.isRemoved()) {
|
||||
if (damagesource.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) {
|
||||
- this.kill();
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ this.kill(damagesource); // CraftBukkit
|
||||
+ // CraftBukkit end
|
||||
return false;
|
||||
- } else if (!this.isInvulnerableTo(damagesource) && !this.invisible && !this.isMarker()) {
|
||||
+ } else if (!this.isInvulnerableTo(damagesource) && (true || !this.invisible) && !this.isMarker()) { // CraftBukkit
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, true, this.invisible)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (damagesource.is(DamageTypeTags.IS_EXPLOSION)) {
|
||||
this.brokenByAnything(damagesource);
|
||||
@@ -435,12 +478,22 @@
|
||||
WorldServer worldserver = (WorldServer) world;
|
||||
|
||||
if (damagesource.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) {
|
||||
- this.kill();
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ this.kill(damagesource); // CraftBukkit
|
||||
+ // CraftBukkit end
|
||||
return false;
|
||||
} else if (damagesource.is(DamageTypeTags.IGNITES_ARMOR_STANDS)) {
|
||||
if (this.isOnFire()) {
|
||||
@@ -467,7 +520,7 @@
|
||||
if (damagesource.isCreativePlayer()) {
|
||||
this.playBrokenSound();
|
||||
this.showBreakingParticles();
|
||||
- this.kill();
|
||||
+ this.kill(damagesource); // CraftBukkit
|
||||
return true;
|
||||
} else {
|
||||
long i = this.level().getGameTime();
|
||||
@@ -479,7 +532,7 @@
|
||||
} else {
|
||||
this.brokenByPlayer(damagesource);
|
||||
- } else if (!this.isInvulnerableTo(damagesource) && !this.invisible && !this.isMarker()) {
|
||||
+ } else if (!this.isInvulnerableTo(damagesource) && (true || !this.invisible) && !this.isMarker()) { // CraftBukkit
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, true, this.invisible)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (damagesource.is(DamageTypeTags.IS_EXPLOSION)) {
|
||||
this.brokenByAnything(worldserver, damagesource);
|
||||
- this.kill();
|
||||
+ this.kill(damagesource); // CraftBukkit
|
||||
return false;
|
||||
} else if (damagesource.is(DamageTypeTags.IGNITES_ARMOR_STANDS)) {
|
||||
if (this.isOnFire()) {
|
||||
@@ -473,7 +526,7 @@
|
||||
if (damagesource.isCreativePlayer()) {
|
||||
this.playBrokenSound();
|
||||
this.showBreakingParticles();
|
||||
- this.kill();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DEATH); // CraftBukkit - SPIGOT-4890: remain as this.discard() since above damagesource method will call death event
|
||||
}
|
||||
+ this.kill(damagesource); // CraftBukkit
|
||||
return true;
|
||||
} else {
|
||||
long i = worldserver.getGameTime();
|
||||
@@ -485,7 +538,7 @@
|
||||
} else {
|
||||
this.brokenByPlayer(worldserver, damagesource);
|
||||
this.showBreakingParticles();
|
||||
- this.kill();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DEATH); // CraftBukkit - SPIGOT-4890: remain as this.discard() since above damagesource method will call death event
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -532,7 +585,7 @@
|
||||
return true;
|
||||
@@ -539,7 +592,7 @@
|
||||
f1 -= f;
|
||||
if (f1 <= 0.5F) {
|
||||
this.brokenByAnything(damagesource);
|
||||
this.brokenByAnything(worldserver, damagesource);
|
||||
- this.kill();
|
||||
+ this.kill(damagesource); // CraftBukkit
|
||||
} else {
|
||||
this.setHealth(f1);
|
||||
this.gameEvent(GameEvent.ENTITY_DAMAGE, damagesource.getEntity());
|
||||
@@ -544,13 +597,13 @@
|
||||
@@ -551,13 +604,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);
|
||||
this.brokenByAnything(worldserver, damagesource);
|
||||
}
|
||||
|
||||
private void brokenByAnything(DamageSource damagesource) {
|
||||
private void brokenByAnything(WorldServer worldserver, DamageSource damagesource) {
|
||||
this.playBrokenSound();
|
||||
- this.dropAllDeathLoot(damagesource);
|
||||
+ // this.dropAllDeathLoot(damagesource); // CraftBukkit - moved down
|
||||
- this.dropAllDeathLoot(worldserver, damagesource);
|
||||
+ // this.dropAllDeathLoot(worldserver, damagesource); // CraftBukkit - moved down
|
||||
|
||||
ItemStack itemstack;
|
||||
int i;
|
||||
@@ -558,7 +611,7 @@
|
||||
@@ -565,7 +618,7 @@
|
||||
for (i = 0; i < this.handItems.size(); ++i) {
|
||||
itemstack = (ItemStack) this.handItems.get(i);
|
||||
if (!itemstack.isEmpty()) {
|
||||
@@ -166,7 +167,7 @@
|
||||
this.handItems.set(i, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
@@ -566,10 +619,11 @@
|
||||
@@ -573,10 +626,11 @@
|
||||
for (i = 0; i < this.armorItems.size(); ++i) {
|
||||
itemstack = (ItemStack) this.armorItems.get(i);
|
||||
if (!itemstack.isEmpty()) {
|
||||
@@ -175,11 +176,11 @@
|
||||
this.armorItems.set(i, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
+ this.dropAllDeathLoot(damagesource); // CraftBukkit - moved from above
|
||||
+ this.dropAllDeathLoot(worldserver, damagesource); // CraftBukkit - moved from above
|
||||
|
||||
}
|
||||
|
||||
@@ -660,9 +714,23 @@
|
||||
@@ -667,9 +721,23 @@
|
||||
return this.isSmall();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,54 +1,19 @@
|
||||
--- a/net/minecraft/world/entity/decoration/EntityItemFrame.java
|
||||
+++ b/net/minecraft/world/entity/decoration/EntityItemFrame.java
|
||||
@@ -90,16 +90,27 @@
|
||||
@@ -90,6 +90,12 @@
|
||||
|
||||
@Override
|
||||
protected void recalculateBoundingBox() {
|
||||
if (this.direction != null) {
|
||||
+ // CraftBukkit start code moved in to calculateBoundingBox
|
||||
+ this.setBoundingBox(calculateBoundingBox(this, this.pos, this.direction, this.getWidth(), this.getHeight()));
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
protected AxisAlignedBB calculateBoundingBox(BlockPosition blockposition, EnumDirection enumdirection) {
|
||||
+ // CraftBukkit start - break out BB calc into own method
|
||||
+ return calculateBoundingBoxStatic(blockposition, enumdirection);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start - break out BB calc into own method
|
||||
+ public static AxisAlignedBB calculateBoundingBox(@Nullable Entity entity, BlockPosition blockPosition, EnumDirection direction, int width, int height) {
|
||||
+ {
|
||||
double d0 = 0.46875D;
|
||||
- double d1 = (double) this.pos.getX() + 0.5D - (double) this.direction.getStepX() * 0.46875D;
|
||||
- double d2 = (double) this.pos.getY() + 0.5D - (double) this.direction.getStepY() * 0.46875D;
|
||||
- double d3 = (double) this.pos.getZ() + 0.5D - (double) this.direction.getStepZ() * 0.46875D;
|
||||
+ double d1 = (double) blockPosition.getX() + 0.5D - (double) direction.getStepX() * 0.46875D;
|
||||
+ double d2 = (double) blockPosition.getY() + 0.5D - (double) direction.getStepY() * 0.46875D;
|
||||
+ double d3 = (double) blockPosition.getZ() + 0.5D - (double) direction.getStepZ() * 0.46875D;
|
||||
|
||||
- this.setPosRaw(d1, d2, d3);
|
||||
- double d4 = (double) this.getWidth();
|
||||
- double d5 = (double) this.getHeight();
|
||||
- double d6 = (double) this.getWidth();
|
||||
- EnumDirection.EnumAxis enumdirection_enumaxis = this.direction.getAxis();
|
||||
+ if (entity != null) {
|
||||
+ entity.setPosRaw(d1, d2, d3);
|
||||
+ }
|
||||
+ double d4 = (double) width;
|
||||
+ double d5 = (double) height;
|
||||
+ double d6 = (double) width;
|
||||
+ EnumDirection.EnumAxis enumdirection_enumaxis = direction.getAxis();
|
||||
|
||||
switch (enumdirection_enumaxis) {
|
||||
case X:
|
||||
@@ -115,9 +126,10 @@
|
||||
d4 /= 32.0D;
|
||||
d5 /= 32.0D;
|
||||
d6 /= 32.0D;
|
||||
- this.setBoundingBox(new AxisAlignedBB(d1 - d4, d2 - d5, d3 - d6, d1 + d4, d2 + d5, d3 + d6));
|
||||
+ return new AxisAlignedBB(d1 - d4, d2 - d5, d3 - d6, d1 + d4, d2 + d5, d3 + d6);
|
||||
}
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
@Override
|
||||
public boolean survives() {
|
||||
@@ -162,6 +174,11 @@
|
||||
+ public static AxisAlignedBB calculateBoundingBoxStatic(BlockPosition blockposition, EnumDirection enumdirection) {
|
||||
+ // CraftBukkit end
|
||||
float f = 0.46875F;
|
||||
Vec3D vec3d = Vec3D.atCenterOf(blockposition).relative(enumdirection, -0.46875D);
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis = enumdirection.getAxis();
|
||||
@@ -143,6 +149,11 @@
|
||||
return false;
|
||||
} else if (!damagesource.is(DamageTypeTags.IS_EXPLOSION) && !this.getItem().isEmpty()) {
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -60,7 +25,7 @@
|
||||
this.dropItem(damagesource.getEntity(), false);
|
||||
this.gameEvent(GameEvent.BLOCK_CHANGE, damagesource.getEntity());
|
||||
this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F);
|
||||
@@ -284,13 +301,19 @@
|
||||
@@ -255,13 +266,19 @@
|
||||
}
|
||||
|
||||
public void setItem(ItemStack itemstack, boolean flag) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/decoration/EntityLeash.java
|
||||
+++ b/net/minecraft/world/entity/decoration/EntityLeash.java
|
||||
@@ -24,6 +24,13 @@
|
||||
@@ -26,6 +26,13 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -11,24 +11,26 @@
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityLeash extends EntityHanging {
|
||||
public class EntityLeash extends BlockAttachedEntity {
|
||||
|
||||
public static final double OFFSET_Y = 0.375D;
|
||||
@@ -89,6 +96,13 @@
|
||||
EntityInsentient entityinsentient = (EntityInsentient) iterator.next();
|
||||
@@ -84,6 +91,15 @@
|
||||
Leashable leashable = (Leashable) iterator.next();
|
||||
|
||||
if (entityinsentient.getLeashHolder() == entityhuman) {
|
||||
if (leashable.getLeashHolder() == entityhuman) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callPlayerLeashEntityEvent(entityinsentient, this, entityhuman, enumhand).isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutAttachEntity(entityinsentient, entityinsentient.getLeashHolder()));
|
||||
+ flag = true; // Also set true when the event is cancelled otherwise it tries to unleash the entities
|
||||
+ continue;
|
||||
+ if (leashable instanceof Entity leashed) {
|
||||
+ if (CraftEventFactory.callPlayerLeashEntityEvent(leashed, this, entityhuman, enumhand).isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutAttachEntity(leashed, leashable.getLeashHolder()));
|
||||
+ flag = true; // Also set true when the event is cancelled otherwise it tries to unleash the entities
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entityinsentient.setLeashedTo(this, true);
|
||||
leashable.setLeashedTo(this, true);
|
||||
flag = true;
|
||||
}
|
||||
@@ -97,18 +111,32 @@
|
||||
@@ -92,18 +108,34 @@
|
||||
boolean flag1 = false;
|
||||
|
||||
if (!flag) {
|
||||
@@ -42,16 +44,18 @@
|
||||
Iterator iterator1 = list.iterator();
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
EntityInsentient entityinsentient1 = (EntityInsentient) iterator1.next();
|
||||
Leashable leashable1 = (Leashable) iterator1.next();
|
||||
|
||||
if (entityinsentient1.isLeashed() && entityinsentient1.getLeashHolder() == this) {
|
||||
- entityinsentient1.dropLeash(true, false);
|
||||
if (leashable1.isLeashed() && leashable1.getLeashHolder() == this) {
|
||||
- leashable1.dropLeash(true, false);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient1, entityhuman, enumhand).isCancelled()) {
|
||||
+ die = false;
|
||||
+ continue;
|
||||
+ if (leashable1 instanceof Entity leashed) {
|
||||
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(leashed, entityhuman, enumhand).isCancelled()) {
|
||||
+ die = false;
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ entityinsentient1.dropLeash(true, !entityhuman.getAbilities().instabuild); // false -> survival mode boolean
|
||||
+ leashable1.dropLeash(true, !entityhuman.getAbilities().instabuild); // false -> survival mode boolean
|
||||
+ // CraftBukkit end
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
--- a/net/minecraft/world/entity/decoration/EntityPainting.java
|
||||
+++ b/net/minecraft/world/entity/decoration/EntityPainting.java
|
||||
@@ -71,7 +71,7 @@
|
||||
public static Optional<EntityPainting> create(World world, BlockPosition blockposition, EnumDirection enumdirection) {
|
||||
EntityPainting entitypainting = new EntityPainting(world, blockposition);
|
||||
List<Holder<PaintingVariant>> list = new ArrayList();
|
||||
- Iterable iterable = world.registryAccess().registryOrThrow(Registries.PAINTING_VARIANT).getTagOrEmpty(PaintingVariantTags.PLACEABLE);
|
||||
+ Iterable<Holder<PaintingVariant>> iterable = world.registryAccess().registryOrThrow(Registries.PAINTING_VARIANT).getTagOrEmpty(PaintingVariantTags.PLACEABLE); // CraftBukkit - decompile error
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
iterable.forEach(list::add);
|
||||
@@ -137,22 +137,32 @@
|
||||
|
||||
@Override
|
||||
protected AxisAlignedBB calculateBoundingBox(BlockPosition blockposition, EnumDirection enumdirection) {
|
||||
+ // CraftBukkit start
|
||||
+ PaintingVariant paintingvariant = (PaintingVariant) this.getVariant().value();
|
||||
+ return calculateBoundingBoxStatic(blockposition, enumdirection, paintingvariant.width(), paintingvariant.height());
|
||||
+ }
|
||||
+
|
||||
+ public static AxisAlignedBB calculateBoundingBoxStatic(BlockPosition blockposition, EnumDirection enumdirection, int width, int height) {
|
||||
+ // CraftBukkit end
|
||||
float f = 0.46875F;
|
||||
Vec3D vec3d = Vec3D.atCenterOf(blockposition).relative(enumdirection, -0.46875D);
|
||||
- PaintingVariant paintingvariant = (PaintingVariant) this.getVariant().value();
|
||||
- double d0 = this.offsetForPaintingSize(paintingvariant.width());
|
||||
- double d1 = this.offsetForPaintingSize(paintingvariant.height());
|
||||
+ // CraftBukkit start
|
||||
+ double d0 = offsetForPaintingSize(width);
|
||||
+ double d1 = offsetForPaintingSize(height);
|
||||
+ // CraftBukkit end
|
||||
EnumDirection enumdirection1 = enumdirection.getCounterClockWise();
|
||||
Vec3D vec3d1 = vec3d.relative(enumdirection1, d0).relative(EnumDirection.UP, d1);
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis = enumdirection.getAxis();
|
||||
- double d2 = enumdirection_enumaxis == EnumDirection.EnumAxis.X ? 0.0625D : (double) paintingvariant.width();
|
||||
- double d3 = (double) paintingvariant.height();
|
||||
- double d4 = enumdirection_enumaxis == EnumDirection.EnumAxis.Z ? 0.0625D : (double) paintingvariant.width();
|
||||
+ // CraftBukkit start
|
||||
+ double d2 = enumdirection_enumaxis == EnumDirection.EnumAxis.X ? 0.0625D : (double) width;
|
||||
+ double d3 = (double) height;
|
||||
+ double d4 = enumdirection_enumaxis == EnumDirection.EnumAxis.Z ? 0.0625D : (double) width;
|
||||
+ // CraftBukkit end
|
||||
|
||||
return AxisAlignedBB.ofSize(vec3d1, d2, d3, d4);
|
||||
}
|
||||
|
||||
- private double offsetForPaintingSize(int i) {
|
||||
+ private static double offsetForPaintingSize(int i) { // CraftBukkit - static
|
||||
return i % 2 == 0 ? 0.5D : 0.0D;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/item/EntityFallingBlock.java
|
||||
+++ b/net/minecraft/world/entity/item/EntityFallingBlock.java
|
||||
@@ -49,6 +49,11 @@
|
||||
@@ -52,6 +52,11 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class EntityFallingBlock extends Entity {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -83,10 +88,17 @@
|
||||
@@ -87,10 +92,17 @@
|
||||
}
|
||||
|
||||
public static EntityFallingBlock fall(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
@@ -31,7 +31,7 @@
|
||||
return entityfallingblock;
|
||||
}
|
||||
|
||||
@@ -126,7 +138,7 @@
|
||||
@@ -130,7 +142,7 @@
|
||||
@Override
|
||||
public void tick() {
|
||||
if (this.blockState.isAir()) {
|
||||
@@ -40,7 +40,7 @@
|
||||
} else {
|
||||
Block block = this.blockState.getBlock();
|
||||
|
||||
@@ -154,7 +166,7 @@
|
||||
@@ -159,7 +171,7 @@
|
||||
this.spawnAtLocation((IMaterial) block);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
}
|
||||
} else {
|
||||
IBlockData iblockdata = this.level().getBlockState(blockposition);
|
||||
@@ -171,9 +183,15 @@
|
||||
@@ -176,9 +188,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);
|
||||
}
|
||||
@@ -201,19 +219,19 @@
|
||||
@@ -206,19 +224,19 @@
|
||||
}
|
||||
}
|
||||
} else if (this.dropItem && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/entity/item/EntityItem.java
|
||||
+++ b/net/minecraft/world/entity/item/EntityItem.java
|
||||
@@ -33,6 +33,15 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
@@ -34,6 +34,15 @@
|
||||
import net.minecraft.world.level.portal.DimensionTransition;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
@@ -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);
|
||||
@@ -51,6 +60,7 @@
|
||||
@@ -52,6 +61,7 @@
|
||||
@Nullable
|
||||
public UUID target;
|
||||
public final float bobOffs;
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
public EntityItem(EntityTypes<? extends EntityItem> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -132,12 +142,15 @@
|
||||
@@ -133,12 +143,15 @@
|
||||
@Override
|
||||
public void tick() {
|
||||
if (this.getItem().isEmpty()) {
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
this.xo = this.getX();
|
||||
this.yo = this.getY();
|
||||
@@ -186,9 +199,11 @@
|
||||
@@ -187,9 +200,11 @@
|
||||
this.mergeWithNeighbours();
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
this.hasImpulse |= this.updateInWaterStateAndDoFluidPushing();
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -200,7 +215,13 @@
|
||||
@@ -201,7 +216,13 @@
|
||||
}
|
||||
|
||||
if (!this.level().isClientSide && this.age >= 6000) {
|
||||
@@ -71,7 +71,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -283,11 +304,16 @@
|
||||
@@ -284,11 +305,16 @@
|
||||
}
|
||||
|
||||
private static void merge(EntityItem entityitem, ItemStack itemstack, EntityItem entityitem1, ItemStack itemstack1) {
|
||||
@@ -89,7 +89,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -308,12 +334,17 @@
|
||||
@@ -309,12 +335,17 @@
|
||||
} else if (this.level().isClientSide) {
|
||||
return true;
|
||||
} else {
|
||||
@@ -108,7 +108,7 @@
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -365,7 +396,7 @@
|
||||
@@ -366,7 +397,7 @@
|
||||
}
|
||||
|
||||
if (this.getItem().isEmpty()) {
|
||||
@@ -117,7 +117,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -377,10 +408,50 @@
|
||||
@@ -378,10 +409,50 @@
|
||||
Item item = itemstack.getItem();
|
||||
int i = itemstack.getCount();
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
||||
+++ b/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
||||
@@ -17,6 +17,12 @@
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
@@ -24,6 +24,12 @@
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.portal.DimensionTransition;
|
||||
|
||||
+// CraftBukkit start;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
@@ -13,16 +13,16 @@
|
||||
public class EntityTNTPrimed extends Entity implements TraceableEntity {
|
||||
|
||||
private static final DataWatcherObject<Integer> DATA_FUSE_ID = DataWatcher.defineId(EntityTNTPrimed.class, DataWatcherRegistry.INT);
|
||||
@@ -26,6 +32,8 @@
|
||||
public static final String TAG_FUSE = "fuse";
|
||||
@@ -45,6 +51,8 @@
|
||||
@Nullable
|
||||
public EntityLiving owner;
|
||||
private boolean usedPortal;
|
||||
+ public float yield = 4; // CraftBukkit - add field
|
||||
+ public boolean isIncendiary = false; // CraftBukkit - add field
|
||||
|
||||
public EntityTNTPrimed(EntityTypes<? extends EntityTNTPrimed> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -79,10 +87,13 @@
|
||||
@@ -99,10 +107,13 @@
|
||||
|
||||
this.setFuse(i);
|
||||
if (i <= 0) {
|
||||
@@ -37,7 +37,7 @@
|
||||
} else {
|
||||
this.updateInWaterStateAndDoFluidPushing();
|
||||
if (this.level().isClientSide) {
|
||||
@@ -93,9 +104,14 @@
|
||||
@@ -113,9 +124,14 @@
|
||||
}
|
||||
|
||||
private void explode() {
|
||||
@@ -46,9 +46,9 @@
|
||||
+ // float f = 4.0F;
|
||||
+ ExplosionPrimeEvent event = CraftEventFactory.callExplosionPrimeEvent((org.bukkit.entity.Explosive)this.getBukkitEntity());
|
||||
|
||||
- this.level().explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 4.0F, World.a.TNT);
|
||||
- this.level().explode(this, Explosion.getDefaultDamageSource(this.level(), this), this.usedPortal ? EntityTNTPrimed.USED_PORTAL_DAMAGE_CALCULATOR : null, this.getX(), this.getY(0.0625D), this.getZ(), 4.0F, false, World.a.TNT);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.level().explode(this, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), World.a.TNT);
|
||||
+ this.level().explode(this, Explosion.getDefaultDamageSource(this.level(), this), this.usedPortal ? EntityTNTPrimed.USED_PORTAL_DAMAGE_CALCULATOR : null, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), World.a.TNT);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
itemstack.shrink(1);
|
||||
} else {
|
||||
itemstack.hurtAndBreak(1, entityhuman, getSlotForHand(enumhand));
|
||||
@@ -246,10 +266,19 @@
|
||||
@@ -246,11 +266,20 @@
|
||||
if (!this.level().isClientSide) {
|
||||
float f = this.isPowered() ? 2.0F : 1.0F;
|
||||
|
||||
@@ -64,10 +64,11 @@
|
||||
+ // CraftBukkit end
|
||||
this.dead = true;
|
||||
- this.level().explode(this, this.getX(), this.getY(), this.getZ(), (float) this.explosionRadius * f, World.a.MOB);
|
||||
- this.discard();
|
||||
+ this.level().explode(this, this.level().damageSources().explosion(this, this.entityIgniter, net.minecraft.world.damagesource.DamageTypes.EXPLOSION), null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB); // CraftBukkit
|
||||
+ this.discard(EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
|
||||
this.spawnLingeringCloud();
|
||||
this.triggerOnDeathMobEffects(Entity.RemovalReason.KILLED);
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
|
||||
+ // CraftBukkit start
|
||||
+ } else {
|
||||
+ swell = 0;
|
||||
@@ -76,7 +77,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -260,6 +289,7 @@
|
||||
@@ -261,6 +290,7 @@
|
||||
if (!collection.isEmpty()) {
|
||||
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ());
|
||||
|
||||
@@ -84,7 +85,7 @@
|
||||
entityareaeffectcloud.setRadius(2.5F);
|
||||
entityareaeffectcloud.setRadiusOnUse(-0.5F);
|
||||
entityareaeffectcloud.setWaitTime(10);
|
||||
@@ -273,7 +303,7 @@
|
||||
@@ -274,7 +304,7 @@
|
||||
entityareaeffectcloud.addEffect(new MobEffect(mobeffect));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityEnderman.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityEnderman.java
|
||||
@@ -68,6 +68,11 @@
|
||||
@@ -70,6 +70,11 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
+
|
||||
public class EntityEnderman extends EntityMonster implements IEntityAngerable {
|
||||
|
||||
private static final UUID SPEED_MODIFIER_ATTACKING_UUID = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0");
|
||||
@@ -111,7 +116,17 @@
|
||||
private static final MinecraftKey SPEED_MODIFIER_ATTACKING_ID = MinecraftKey.withDefaultNamespace("attacking");
|
||||
@@ -113,7 +118,17 @@
|
||||
|
||||
@Override
|
||||
public void setTarget(@Nullable EntityLiving entityliving) {
|
||||
@@ -31,7 +31,7 @@
|
||||
AttributeModifiable attributemodifiable = this.getAttribute(GenericAttributes.MOVEMENT_SPEED);
|
||||
|
||||
if (entityliving == null) {
|
||||
@@ -126,6 +141,7 @@
|
||||
@@ -128,6 +143,7 @@
|
||||
attributemodifiable.addTransientModifier(EntityEnderman.SPEED_MODIFIER_ATTACKING);
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -477,9 +493,11 @@
|
||||
@@ -479,9 +495,11 @@
|
||||
if (iblockdata2 != null) {
|
||||
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level(), blockposition);
|
||||
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
|
||||
@@ -51,7 +51,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -518,9 +536,11 @@
|
||||
@@ -520,9 +538,11 @@
|
||||
boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition);
|
||||
|
||||
if (iblockdata.is(TagsBlock.ENDERMAN_HOLDABLE) && flag) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityGhast.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityGhast.java
|
||||
@@ -331,6 +331,8 @@
|
||||
@@ -332,6 +332,8 @@
|
||||
|
||||
EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.ghast, d2, d3, d4, this.ghast.getExplosionPower());
|
||||
EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.ghast, vec3d1.normalize(), this.ghast.getExplosionPower());
|
||||
|
||||
+ // CraftBukkit - set bukkitYield when setting explosionpower
|
||||
+ entitylargefireball.bukkitYield = entitylargefireball.explosionPower = this.ghast.getExplosionPower();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java
|
||||
@@ -215,7 +215,7 @@
|
||||
@@ -217,7 +217,7 @@
|
||||
|
||||
@Override
|
||||
protected void performSpellCasting() {
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -266,7 +266,7 @@
|
||||
@@ -268,7 +268,7 @@
|
||||
|
||||
@Override
|
||||
protected void performSpellCasting() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityPigZombie.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityPigZombie.java
|
||||
@@ -148,7 +148,7 @@
|
||||
@@ -149,7 +149,7 @@
|
||||
}).filter((entitypigzombie) -> {
|
||||
return !entitypigzombie.isAlliedTo((Entity) this.getTarget());
|
||||
}).forEach((entitypigzombie) -> {
|
||||
@@ -9,7 +9,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
@@ -158,7 +158,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);
|
||||
@@ -167,12 +167,21 @@
|
||||
@@ -168,12 +168,21 @@
|
||||
this.setLastHurtByPlayer((EntityHuman) entityliving);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityPillager.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityPillager.java
|
||||
@@ -44,6 +44,10 @@
|
||||
@@ -48,6 +48,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);
|
||||
@@ -192,7 +196,7 @@
|
||||
@@ -195,7 +199,7 @@
|
||||
ItemStack itemstack1 = this.inventory.addItem(itemstack);
|
||||
|
||||
if (itemstack1.isEmpty()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityRavager.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityRavager.java
|
||||
@@ -42,6 +42,10 @@
|
||||
@@ -43,6 +43,10 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
public class EntityRavager extends EntityRaider {
|
||||
|
||||
private static final Predicate<Entity> NO_RAVAGER_AND_ALIVE = (entity) -> {
|
||||
@@ -146,6 +150,11 @@
|
||||
@@ -147,6 +151,11 @@
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
if (block instanceof BlockLeaves) {
|
||||
|
||||
@@ -12,7 +12,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");
|
||||
private static final MinecraftKey COVERED_ARMOR_MODIFIER_ID = MinecraftKey.withDefaultNamespace("covered");
|
||||
@@ -401,6 +407,14 @@
|
||||
EnumDirection enumdirection = this.findAttachableSurface(blockposition1);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntitySkeleton.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySkeleton.java
|
||||
@@ -90,7 +90,7 @@
|
||||
@@ -91,7 +91,7 @@
|
||||
}
|
||||
|
||||
protected void doFreezeConversion() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java
|
||||
@@ -200,8 +200,19 @@
|
||||
@@ -204,8 +204,19 @@
|
||||
double d3 = Math.sqrt(d0 * d0 + d2 * d2);
|
||||
|
||||
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4));
|
||||
@@ -20,4 +20,4 @@
|
||||
+ // this.level().addFreshEntity(entityarrow); // CraftBukkit - moved up
|
||||
}
|
||||
|
||||
protected EntityArrow getArrow(ItemStack itemstack, float f) {
|
||||
protected EntityArrow getArrow(ItemStack itemstack, float f, @Nullable ItemStack itemstack1) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntitySkeletonWither.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySkeletonWither.java
|
||||
@@ -96,7 +96,7 @@
|
||||
@@ -97,7 +97,7 @@
|
||||
return false;
|
||||
} else {
|
||||
if (entity instanceof EntityLiving) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntitySlime.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySlime.java
|
||||
@@ -43,6 +43,15 @@
|
||||
@@ -45,6 +45,15 @@
|
||||
import net.minecraft.world.level.levelgen.SeededRandom;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
public class EntitySlime extends EntityInsentient implements IMonster {
|
||||
|
||||
private static final DataWatcherObject<Integer> ID_SIZE = DataWatcher.defineId(EntitySlime.class, DataWatcherRegistry.INT);
|
||||
@@ -193,11 +202,18 @@
|
||||
@@ -195,11 +204,18 @@
|
||||
|
||||
@Override
|
||||
public EntityTypes<? extends EntitySlime> getType() {
|
||||
@@ -36,7 +36,7 @@
|
||||
int i = this.getSize();
|
||||
|
||||
if (!this.level().isClientSide && i > 1 && this.isDeadOrDying()) {
|
||||
@@ -208,6 +224,19 @@
|
||||
@@ -210,6 +226,19 @@
|
||||
int j = i / 2;
|
||||
int k = 2 + this.random.nextInt(3);
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
for (int l = 0; l < k; ++l) {
|
||||
float f2 = ((float) (l % 2) - 0.5F) * f1;
|
||||
float f3 = ((float) (l / 2) - 0.5F) * f1;
|
||||
@@ -223,12 +252,21 @@
|
||||
@@ -225,12 +254,21 @@
|
||||
entityslime.setInvulnerable(this.isInvulnerable());
|
||||
entityslime.setSize(j, true);
|
||||
entityslime.moveTo(this.getX() + (double) f2, this.getY() + 0.5D, this.getZ() + (double) f3, this.random.nextFloat() * 360.0F, 0.0F);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityWitch.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityWitch.java
|
||||
@@ -124,7 +124,7 @@
|
||||
@@ -125,7 +125,7 @@
|
||||
PotionContents potioncontents = (PotionContents) itemstack.get(DataComponents.POTION_CONTENTS);
|
||||
|
||||
if (itemstack.is(Items.POTION) && potioncontents != null) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityZombie.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityZombie.java
|
||||
@@ -64,6 +64,15 @@
|
||||
@@ -65,6 +65,15 @@
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
+
|
||||
public class EntityZombie extends EntityMonster {
|
||||
|
||||
private static final UUID SPEED_MODIFIER_BABY_UUID = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");
|
||||
@@ -84,6 +93,7 @@
|
||||
private static final MinecraftKey SPEED_MODIFIER_BABY_ID = MinecraftKey.withDefaultNamespace("baby");
|
||||
@@ -89,6 +98,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);
|
||||
@@ -200,7 +210,10 @@
|
||||
@@ -205,7 +215,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();
|
||||
}
|
||||
@@ -217,6 +230,7 @@
|
||||
@@ -222,6 +235,7 @@
|
||||
}
|
||||
|
||||
super.tick();
|
||||
@@ -44,7 +44,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -249,6 +263,7 @@
|
||||
@@ -256,6 +270,7 @@
|
||||
}
|
||||
|
||||
public void startUnderWaterConversion(int i) {
|
||||
@@ -52,7 +52,7 @@
|
||||
this.conversionTime = i;
|
||||
this.getEntityData().set(EntityZombie.DATA_DROWNED_CONVERSION_ID, true);
|
||||
}
|
||||
@@ -262,11 +277,15 @@
|
||||
@@ -269,11 +284,15 @@
|
||||
}
|
||||
|
||||
protected void convertToZombieType(EntityTypes<? extends EntityZombie> entitytypes) {
|
||||
@@ -69,7 +69,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -305,9 +324,9 @@
|
||||
@@ -312,9 +331,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())) {
|
||||
@@ -78,16 +78,16 @@
|
||||
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.ADD_VALUE));
|
||||
entityzombie.getAttribute(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE).addPermanentModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, AttributeModifier.Operation.ADD_VALUE));
|
||||
break;
|
||||
@@ -328,7 +347,14 @@
|
||||
AttributeModifiable attributemodifiable = this.getAttribute(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE);
|
||||
AttributeModifier attributemodifier = attributemodifiable.getModifier(EntityZombie.REINFORCEMENT_CALLER_CHARGE_ID);
|
||||
double d0 = attributemodifier != null ? attributemodifier.amount() : 0.0D;
|
||||
@@ -340,7 +359,14 @@
|
||||
float f = this.level().getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty();
|
||||
|
||||
if (this.getMainHandItem().isEmpty() && this.isOnFire() && this.random.nextFloat() < f * 0.3F) {
|
||||
- entity.igniteForSeconds(2 * (int) f);
|
||||
- entity.igniteForSeconds((float) (2 * (int) f));
|
||||
+ // CraftBukkit start
|
||||
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * (int) f); // PAIL: fixme
|
||||
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), (float) (2 * (int) f)); // PAIL: fixme
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
@@ -97,7 +97,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,8 +429,17 @@
|
||||
@@ -415,8 +441,17 @@
|
||||
if (worldserver.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) {
|
||||
return flag;
|
||||
}
|
||||
@@ -116,7 +116,7 @@
|
||||
|
||||
if (entityzombievillager != null) {
|
||||
entityzombievillager.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityzombievillager.blockPosition()), EnumMobSpawn.CONVERSION, new EntityZombie.GroupDataZombie(false, true));
|
||||
@@ -412,15 +447,17 @@
|
||||
@@ -424,15 +459,17 @@
|
||||
entityzombievillager.setGossips((NBTBase) entityvillager.getGossips().store(DynamicOpsNBT.INSTANCE));
|
||||
entityzombievillager.setTradeOffers(entityvillager.getOffers().copy());
|
||||
entityzombievillager.setVillagerXp(entityvillager.getVillagerXp());
|
||||
@@ -139,7 +139,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -471,7 +508,7 @@
|
||||
@@ -483,7 +520,7 @@
|
||||
entitychicken1.finalizeSpawn(worldaccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null);
|
||||
entitychicken1.setChickenJockey(true);
|
||||
this.startRiding(entitychicken1);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityZombieVillager.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityZombieVillager.java
|
||||
@@ -48,6 +48,13 @@
|
||||
@@ -51,6 +51,13 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
public class EntityZombieVillager extends EntityZombie implements VillagerDataHolder {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -65,6 +72,7 @@
|
||||
@@ -68,6 +75,7 @@
|
||||
@Nullable
|
||||
private MerchantRecipeList tradeOffers;
|
||||
private int villagerXp;
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
public EntityZombieVillager(EntityTypes<? extends EntityZombieVillager> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -83,7 +91,7 @@
|
||||
@@ -86,7 +94,7 @@
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
@@ -31,7 +31,7 @@
|
||||
Logger logger = EntityZombieVillager.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -118,7 +126,7 @@
|
||||
@@ -121,7 +129,7 @@
|
||||
}
|
||||
|
||||
if (nbttagcompound.contains("Offers")) {
|
||||
@@ -40,7 +40,7 @@
|
||||
Logger logger1 = EntityZombieVillager.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger1);
|
||||
@@ -145,6 +153,10 @@
|
||||
@@ -148,6 +156,10 @@
|
||||
public void tick() {
|
||||
if (!this.level().isClientSide && this.isAlive() && this.isConverting()) {
|
||||
int i = this.getConversionProgress();
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
this.villagerConversionTime -= i;
|
||||
if (this.villagerConversionTime <= 0) {
|
||||
@@ -153,6 +165,7 @@
|
||||
@@ -156,6 +168,7 @@
|
||||
}
|
||||
|
||||
super.tick();
|
||||
@@ -59,7 +59,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -193,8 +206,10 @@
|
||||
@@ -196,8 +209,10 @@
|
||||
this.conversionStarter = uuid;
|
||||
this.villagerConversionTime = i;
|
||||
this.getEntityData().set(EntityZombieVillager.DATA_CONVERTING_ID, true);
|
||||
@@ -72,7 +72,7 @@
|
||||
this.level().broadcastEntityEvent(this, (byte) 16);
|
||||
}
|
||||
|
||||
@@ -211,7 +226,13 @@
|
||||
@@ -214,12 +229,20 @@
|
||||
}
|
||||
|
||||
private void finishConversion(WorldServer worldserver) {
|
||||
@@ -84,25 +84,22 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
|
||||
int i = aenumitemslot.length;
|
||||
|
||||
@@ -226,7 +247,9 @@
|
||||
double d0 = (double) this.getEquipmentDropChance(enumitemslot);
|
||||
if (entityvillager != null) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
Iterator iterator = this.dropPreservedEquipment((itemstack) -> {
|
||||
return !EnchantmentManager.has(itemstack, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE);
|
||||
}).iterator();
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
|
||||
if (d0 > 1.0D) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.spawnAtLocation(itemstack);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
}
|
||||
while (iterator.hasNext()) {
|
||||
EnumItemSlot enumitemslot = (EnumItemSlot) iterator.next();
|
||||
@@ -249,7 +272,7 @@
|
||||
}
|
||||
}
|
||||
@@ -253,7 +276,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- entityvillager.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0));
|
||||
+ entityvillager.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION); // CraftBukkit
|
||||
if (!this.isSilent()) {
|
||||
worldserver.levelEvent((EntityHuman) null, 1027, this.blockPosition(), 0);
|
||||
}
|
||||
- entityvillager.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0));
|
||||
+ entityvillager.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION); // CraftBukkit
|
||||
if (!this.isSilent()) {
|
||||
worldserver.levelEvent((EntityHuman) null, 1027, this.blockPosition(), 0);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
this.setGuaranteedDrop(EnumItemSlot.OFFHAND);
|
||||
} else {
|
||||
@@ -375,8 +403,8 @@
|
||||
if (EnchantmentManager.hasBindingCurse(itemstack1)) {
|
||||
if (EnchantmentManager.has(itemstack1, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE)) {
|
||||
return false;
|
||||
} else {
|
||||
- boolean flag = PiglinAI.isLovedItem(itemstack) || itemstack.is(Items.CROSSBOW);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
+++ b/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
@@ -371,7 +371,7 @@
|
||||
@@ -372,7 +372,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<Warden> getBrain() {
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -408,13 +408,13 @@
|
||||
@@ -409,7 +409,7 @@
|
||||
public static void applyDarknessAround(WorldServer worldserver, Vec3D vec3d, @Nullable Entity entity, int i) {
|
||||
MobEffect mobeffect = new MobEffect(MobEffects.DARKNESS, 260, 0, false, false);
|
||||
|
||||
@@ -18,32 +18,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
- DataResult dataresult = AngerManagement.codec(this::canTargetEntity).encodeStart(DynamicOpsNBT.INSTANCE, this.angerManagement);
|
||||
+ DataResult<net.minecraft.nbt.NBTBase> dataresult = AngerManagement.codec(this::canTargetEntity).encodeStart(DynamicOpsNBT.INSTANCE, this.angerManagement); // CraftBukkit - decompile error
|
||||
Logger logger = Warden.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -439,7 +439,7 @@
|
||||
dataresult = AngerManagement.codec(this::canTargetEntity).parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("anger")));
|
||||
logger = Warden.LOGGER;
|
||||
Objects.requireNonNull(logger);
|
||||
- dataresult.resultOrPartial(logger::error).ifPresent((angermanagement) -> {
|
||||
+ ((DataResult<AngerManagement>) dataresult).resultOrPartial(logger::error).ifPresent((angermanagement) -> { // CraftBukkit - decompile error
|
||||
this.angerManagement = angermanagement;
|
||||
});
|
||||
this.syncClientAngerLevel();
|
||||
@@ -449,7 +449,7 @@
|
||||
dataresult = VibrationSystem.a.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener")));
|
||||
logger = Warden.LOGGER;
|
||||
Objects.requireNonNull(logger);
|
||||
- dataresult.resultOrPartial(logger::error).ifPresent((vibrationsystem_a) -> {
|
||||
+ ((DataResult<VibrationSystem.a>) dataresult).resultOrPartial(logger::error).ifPresent((vibrationsystem_a) -> { // CraftBukkit - decompile error
|
||||
this.vibrationData = vibrationsystem_a;
|
||||
});
|
||||
}
|
||||
@@ -547,7 +547,7 @@
|
||||
@@ -544,7 +544,7 @@
|
||||
|
||||
public void setAttackTarget(EntityLiving entityliving) {
|
||||
this.getBrain().eraseMemory(MemoryModuleType.ROAR_TARGET);
|
||||
@@ -52,7 +27,7 @@
|
||||
this.getBrain().eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
|
||||
SonicBoom.setCooldown(this, 200);
|
||||
}
|
||||
@@ -582,12 +582,12 @@
|
||||
@@ -579,12 +579,12 @@
|
||||
|
||||
@Override
|
||||
protected NavigationAbstract createNavigation(World world) {
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,7 +370,13 @@
|
||||
@@ -363,7 +372,13 @@
|
||||
while (iterator.hasNext()) {
|
||||
MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
}
|
||||
|
||||
this.resendOffersToTradingPlayer();
|
||||
@@ -430,7 +445,13 @@
|
||||
@@ -432,7 +447,13 @@
|
||||
while (iterator.hasNext()) {
|
||||
MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -490,7 +511,7 @@
|
||||
@@ -492,7 +513,7 @@
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
@@ -73,7 +73,7 @@
|
||||
Logger logger = EntityVillager.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -513,7 +534,7 @@
|
||||
@@ -515,7 +536,7 @@
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
if (nbttagcompound.contains("VillagerData", 10)) {
|
||||
@@ -82,7 +82,7 @@
|
||||
Logger logger = EntityVillager.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -826,9 +847,14 @@
|
||||
@@ -828,9 +849,14 @@
|
||||
}
|
||||
|
||||
entitywitch.setPersistenceRequired();
|
||||
@@ -99,7 +99,7 @@
|
||||
} else {
|
||||
super.thunderHit(worldserver, entitylightning);
|
||||
}
|
||||
@@ -925,7 +951,7 @@
|
||||
@@ -927,7 +953,7 @@
|
||||
}).limit(5L).collect(Collectors.toList());
|
||||
|
||||
if (list1.size() >= j) {
|
||||
@@ -108,7 +108,7 @@
|
||||
list.forEach(SensorGolemLastSeen::golemDetected);
|
||||
}
|
||||
}
|
||||
@@ -982,7 +1008,7 @@
|
||||
@@ -984,7 +1010,7 @@
|
||||
@Override
|
||||
public void startSleeping(BlockPosition blockposition) {
|
||||
super.startSleeping(blockposition);
|
||||
@@ -117,7 +117,7 @@
|
||||
this.brain.eraseMemory(MemoryModuleType.WALK_TARGET);
|
||||
this.brain.eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
|
||||
}
|
||||
@@ -990,7 +1016,7 @@
|
||||
@@ -992,7 +1018,7 @@
|
||||
@Override
|
||||
public void stopSleeping() {
|
||||
super.stopSleeping();
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
public EntityVillagerAbstract(EntityTypes<? extends EntityVillagerAbstract> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -173,7 +189,7 @@
|
||||
@@ -179,7 +195,7 @@
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
if (nbttagcompound.contains("Offers")) {
|
||||
@@ -43,7 +43,7 @@
|
||||
Logger logger = EntityVillagerAbstract.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -240,7 +256,16 @@
|
||||
@@ -246,7 +262,16 @@
|
||||
MerchantRecipe merchantrecipe = ((VillagerTrades.IMerchantRecipeOption) arraylist.remove(this.random.nextInt(arraylist.size()))).getOffer(this, this.random);
|
||||
|
||||
if (merchantrecipe != null) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/player/EntityHuman.java
|
||||
+++ b/net/minecraft/world/entity/player/EntityHuman.java
|
||||
@@ -116,6 +116,22 @@
|
||||
@@ -115,6 +115,22 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeam;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -135,7 +151,8 @@
|
||||
public static final float DEFAULT_EYE_HEIGHT = 1.62F;
|
||||
private static final int CURRENT_IMPULSE_CONTEXT_RESET_GRACE_TIME_TICKS = 40;
|
||||
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();
|
||||
@@ -46,9 +46,9 @@
|
||||
protected int jumpTriggerTime;
|
||||
public float oBob;
|
||||
public float bob;
|
||||
@@ -181,6 +198,16 @@
|
||||
public Entity currentExplosionCause;
|
||||
public boolean ignoreFallDamageFromCurrentImpulse;
|
||||
@@ -182,6 +199,16 @@
|
||||
private boolean ignoreFallDamageFromCurrentImpulse;
|
||||
private int currentImpulseContextResetGraceTime;
|
||||
|
||||
+ // 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;
|
||||
@@ -325,7 +352,7 @@
|
||||
@@ -330,7 +357,7 @@
|
||||
ItemStack itemstack = this.getItemBySlot(EnumItemSlot.HEAD);
|
||||
|
||||
if (itemstack.is(Items.TURTLE_HELMET) && !this.isEyeInFluid(TagsFluid.WATER)) {
|
||||
@@ -98,8 +98,8 @@
|
||||
+ this.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.REGEN);
|
||||
}
|
||||
|
||||
if (this.foodData.needsFood() && this.tickCount % 10 == 0) {
|
||||
@@ -665,6 +699,13 @@
|
||||
if (this.foodData.getSaturationLevel() < 20.0F && this.tickCount % 20 == 0) {
|
||||
@@ -683,6 +717,13 @@
|
||||
|
||||
@Nullable
|
||||
public EntityItem drop(ItemStack itemstack, boolean flag, boolean flag1) {
|
||||
@@ -113,7 +113,7 @@
|
||||
if (itemstack.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -699,6 +740,33 @@
|
||||
@@ -717,6 +758,33 @@
|
||||
entityitem.setDeltaMovement((double) (-f3 * f2 * 0.3F) + Math.cos((double) f5) * (double) f6, (double) (-f1 * 0.3F + 0.1F + (this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (f4 * f2 * 0.3F) + Math.sin((double) f5) * (double) f6);
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
return entityitem;
|
||||
}
|
||||
}
|
||||
@@ -790,7 +858,7 @@
|
||||
@@ -803,7 +871,7 @@
|
||||
}
|
||||
|
||||
if (nbttagcompound.contains("LastDeathLocation", 10)) {
|
||||
@@ -156,7 +156,7 @@
|
||||
Logger logger = EntityHuman.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -798,7 +866,7 @@
|
||||
@@ -811,7 +879,7 @@
|
||||
}
|
||||
|
||||
if (nbttagcompound.contains("current_explosion_impact_pos", 9)) {
|
||||
@@ -165,7 +165,7 @@
|
||||
Logger logger1 = EntityHuman.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger1);
|
||||
@@ -834,7 +902,7 @@
|
||||
@@ -848,7 +916,7 @@
|
||||
}
|
||||
|
||||
this.getLastDeathLocation().flatMap((globalpos) -> {
|
||||
@@ -174,7 +174,7 @@
|
||||
Logger logger = EntityHuman.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -866,12 +934,12 @@
|
||||
@@ -881,12 +949,12 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -189,7 +189,7 @@
|
||||
}
|
||||
|
||||
if (this.level().getDifficulty() == EnumDifficulty.EASY) {
|
||||
@@ -883,7 +951,13 @@
|
||||
@@ -898,7 +966,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -903,10 +977,29 @@
|
||||
@@ -918,10 +992,29 @@
|
||||
}
|
||||
|
||||
public boolean canHarmPlayer(EntityHuman entityhuman) {
|
||||
@@ -237,7 +237,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -946,8 +1039,13 @@
|
||||
@@ -961,8 +1054,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@
|
||||
if (!this.isInvulnerableTo(damagesource)) {
|
||||
f = this.getDamageAfterArmorAbsorb(damagesource, f);
|
||||
f = this.getDamageAfterMagicAbsorb(damagesource, f);
|
||||
@@ -962,7 +1060,7 @@
|
||||
@@ -977,7 +1075,7 @@
|
||||
}
|
||||
|
||||
if (f != 0.0F) {
|
||||
@@ -261,15 +261,15 @@
|
||||
this.getCombatTracker().recordDamage(damagesource, f);
|
||||
this.setHealth(this.getHealth() - f);
|
||||
if (f < 3.4028235E37F) {
|
||||
@@ -972,6 +1070,7 @@
|
||||
@@ -987,6 +1085,7 @@
|
||||
this.gameEvent(GameEvent.ENTITY_DAMAGE);
|
||||
}
|
||||
}
|
||||
+ return false; // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1127,10 +1226,16 @@
|
||||
public boolean isTextFilteringEnabled() {
|
||||
@@ -1139,10 +1238,15 @@
|
||||
|
||||
f *= 0.2F + f2 * f2 * 0.8F;
|
||||
f1 *= f2;
|
||||
@@ -279,118 +279,71 @@
|
||||
IProjectile iprojectile = (IProjectile) entity;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ DamageSource damagesource = this.damageSources().playerAttack(this);
|
||||
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(entity, 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(), 1);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
|
||||
+
|
||||
+ if (!combustEvent.isCancelled()) {
|
||||
+ flag4 = true;
|
||||
+ entity.igniteForSeconds(combustEvent.getDuration(), false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
if (iprojectile.deflect(ProjectileDeflection.AIM_DEFLECT, this, this, true)) {
|
||||
this.level().playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), SoundEffects.PLAYER_ATTACK_NODAMAGE, this.getSoundSource());
|
||||
return;
|
||||
@@ -1218,8 +1322,11 @@
|
||||
if (entityliving2 != this && entityliving2 != entity && !this.isAlliedTo((Entity) entityliving2) && (!(entityliving2 instanceof EntityArmorStand) || !((EntityArmorStand) entityliving2).isMarker()) && this.distanceToSqr((Entity) entityliving2) < 9.0D) {
|
||||
float f7 = this.getEnchantedDamage(entityliving2, f6, damagesource) * f2;
|
||||
|
||||
@@ -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 (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);
|
||||
- entityliving2.knockback(0.4000000059604645D, (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)));
|
||||
- entityliving2.hurt(damagesource, f7);
|
||||
+ // CraftBukkit start - Only apply knockback if the damage hits
|
||||
+ if (entityliving2.hurt(this.damageSources().playerAttack(this).sweep(), f7)) {
|
||||
+ entityliving2.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
|
||||
}
|
||||
World world = this.level();
|
||||
|
||||
if (this.level() instanceof WorldServer && f5 > 2.0F) {
|
||||
@@ -1267,12 +1406,17 @@
|
||||
}
|
||||
}
|
||||
if (world instanceof WorldServer) {
|
||||
@@ -1235,9 +1342,26 @@
|
||||
}
|
||||
|
||||
- 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();
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1310,7 +1454,14 @@
|
||||
if (flag2) {
|
||||
@@ -1303,9 +1427,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
- 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);
|
||||
+ // CraftBukkit start - resync on cancelled event
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) this).getBukkitEntity().updateInventory();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1346,7 +1475,14 @@
|
||||
|
||||
@Override
|
||||
public void remove(Entity.RemovalReason entity_removalreason) {
|
||||
@@ -406,7 +359,7 @@
|
||||
this.inventoryMenu.removed(this);
|
||||
if (this.containerMenu != null && this.hasContainerOpen()) {
|
||||
this.doCloseContainer();
|
||||
@@ -1346,6 +1497,12 @@
|
||||
@@ -1382,6 +1518,12 @@
|
||||
}
|
||||
|
||||
public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition) {
|
||||
@@ -419,7 +372,7 @@
|
||||
this.startSleeping(blockposition);
|
||||
this.sleepCounter = 0;
|
||||
return Either.right(Unit.INSTANCE);
|
||||
@@ -1433,9 +1590,9 @@
|
||||
@@ -1444,9 +1586,9 @@
|
||||
super.jumpFromGround();
|
||||
this.awardStat(StatisticList.JUMP);
|
||||
if (this.isSprinting()) {
|
||||
@@ -431,7 +384,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1462,7 +1619,11 @@
|
||||
@@ -1473,7 +1615,11 @@
|
||||
|
||||
this.setDeltaMovement(vec3d2.x, d0 * 0.6D, vec3d2.z);
|
||||
this.resetFallDistance();
|
||||
@@ -444,7 +397,7 @@
|
||||
} else {
|
||||
super.travel(vec3d);
|
||||
}
|
||||
@@ -1522,12 +1683,24 @@
|
||||
@@ -1547,12 +1693,24 @@
|
||||
}
|
||||
|
||||
public void startFallFlying() {
|
||||
@@ -470,7 +423,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1642,10 +1815,21 @@
|
||||
@@ -1667,10 +1825,21 @@
|
||||
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
|
||||
}
|
||||
|
||||
@@ -493,7 +446,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1731,13 +1915,20 @@
|
||||
@@ -1756,13 +1925,20 @@
|
||||
|
||||
@Override
|
||||
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||
@@ -511,13 +464,13 @@
|
||||
} else if (enumitemslot == EnumItemSlot.OFFHAND) {
|
||||
- this.onEquipItem(enumitemslot, (ItemStack) this.inventory.offhand.set(0, itemstack), itemstack);
|
||||
+ this.onEquipItem(enumitemslot, (ItemStack) this.inventory.offhand.set(0, itemstack), itemstack, silent); // CraftBukkit
|
||||
} else if (enumitemslot.getType() == EnumItemSlot.Function.ARMOR) {
|
||||
} else if (enumitemslot.getType() == EnumItemSlot.Function.HUMANOID_ARMOR) {
|
||||
- this.onEquipItem(enumitemslot, (ItemStack) this.inventory.armor.set(enumitemslot.getIndex(), itemstack), itemstack);
|
||||
+ this.onEquipItem(enumitemslot, (ItemStack) this.inventory.armor.set(enumitemslot.getIndex(), itemstack), itemstack, silent); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1781,26 +1972,31 @@
|
||||
@@ -1806,26 +1982,31 @@
|
||||
|
||||
protected void removeEntitiesOnShoulder() {
|
||||
if (this.timeEntitySatOnShoulder + 20L < this.level().getGameTime()) {
|
||||
@@ -557,3 +510,12 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2040,7 +2221,7 @@
|
||||
|
||||
@Override
|
||||
public ItemStack eat(World world, ItemStack itemstack, FoodInfo foodinfo) {
|
||||
- this.getFoodData().eat(foodinfo);
|
||||
+ this.getFoodData().eat(itemstack, foodinfo); // CraftBukkit
|
||||
this.awardStat(StatisticList.ITEM_USED.get(itemstack.getItem()));
|
||||
world.playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), SoundEffects.PLAYER_BURP, SoundCategory.PLAYERS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
|
||||
if (this instanceof EntityPlayer) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityArrow.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityArrow.java
|
||||
@@ -49,6 +49,13 @@
|
||||
@@ -52,6 +52,13 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
public abstract class EntityArrow extends IProjectile {
|
||||
|
||||
private static final double ARROW_BASE_DAMAGE = 2.0D;
|
||||
@@ -225,7 +232,7 @@
|
||||
@@ -242,7 +249,7 @@
|
||||
}
|
||||
|
||||
if (object != null && !flag) {
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
this.hasImpulse = true;
|
||||
if (projectiledeflection != ProjectileDeflection.NONE) {
|
||||
@@ -316,7 +323,7 @@
|
||||
@@ -333,7 +340,7 @@
|
||||
protected void tickDespawn() {
|
||||
++this.life;
|
||||
if (this.life >= 1200) {
|
||||
@@ -32,7 +32,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -349,7 +356,7 @@
|
||||
@@ -380,7 +387,7 @@
|
||||
}
|
||||
|
||||
if (this.piercingIgnoreEntityIds.size() >= this.getPierceLevel() + 1) {
|
||||
@@ -41,13 +41,13 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -378,7 +385,13 @@
|
||||
@@ -401,7 +408,13 @@
|
||||
int k = entity.getRemainingFireTicks();
|
||||
|
||||
if (this.isOnFire() && !flag) {
|
||||
- entity.igniteForSeconds(5);
|
||||
- entity.igniteForSeconds(5.0F);
|
||||
+ // CraftBukkit start
|
||||
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
|
||||
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5.0F);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
|
||||
+ if (!combustEvent.isCancelled()) {
|
||||
+ entity.igniteForSeconds(combustEvent.getDuration(), false);
|
||||
@@ -56,7 +56,7 @@
|
||||
}
|
||||
|
||||
if (entity.hurt(damagesource, (float) i)) {
|
||||
@@ -429,7 +442,7 @@
|
||||
@@ -447,7 +460,7 @@
|
||||
|
||||
this.playSound(this.soundEvent, 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
|
||||
if (this.getPierceLevel() <= 0) {
|
||||
@@ -65,7 +65,7 @@
|
||||
}
|
||||
} else {
|
||||
entity.setRemainingFireTicks(k);
|
||||
@@ -440,7 +453,7 @@
|
||||
@@ -458,7 +471,7 @@
|
||||
this.spawnAtLocation(this.getPickupItem(), 0.1F);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,56 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -547,9 +560,24 @@
|
||||
@@ -614,7 +627,7 @@
|
||||
}
|
||||
|
||||
if (nbttagcompound.contains("weapon", 10)) {
|
||||
- this.firedFromWeapon = (ItemStack) ItemStack.parse(this.registryAccess(), nbttagcompound.getCompound("weapon")).orElse((Object) null);
|
||||
+ this.firedFromWeapon = (ItemStack) ItemStack.parse(this.registryAccess(), nbttagcompound.getCompound("weapon")).orElse(null); // CraftBukkit - decompile error
|
||||
} else {
|
||||
this.firedFromWeapon = null;
|
||||
}
|
||||
@@ -630,17 +643,10 @@
|
||||
EntityArrow.PickupStatus entityarrow_pickupstatus;
|
||||
|
||||
label16:
|
||||
- while(true) {
|
||||
- //$FF: b0->value
|
||||
- //0->net/minecraft/world/entity/player/EntityHuman
|
||||
- //1->net/minecraft/world/entity/OminousItemSpawner
|
||||
- switch (entity1.typeSwitch<invokedynamic>(entity1, b0)) {
|
||||
- case -1:
|
||||
- default:
|
||||
- entityarrow_pickupstatus = this.pickup;
|
||||
- break label16;
|
||||
- case 0:
|
||||
- EntityHuman entityhuman = (EntityHuman)entity1;
|
||||
+ // CraftBukkit start - decompile error
|
||||
+ while (true) {
|
||||
+ switch (entity1) {
|
||||
+ case EntityHuman entityhuman:
|
||||
|
||||
if (this.pickup != EntityArrow.PickupStatus.DISALLOWED) {
|
||||
b0 = 1;
|
||||
@@ -649,12 +655,15 @@
|
||||
|
||||
entityarrow_pickupstatus = EntityArrow.PickupStatus.ALLOWED;
|
||||
break label16;
|
||||
- case 1:
|
||||
- OminousItemSpawner ominousitemspawner = (OminousItemSpawner)entity1;
|
||||
+ case OminousItemSpawner ominousitemspawner:
|
||||
|
||||
entityarrow_pickupstatus = EntityArrow.PickupStatus.DISALLOWED;
|
||||
break label16;
|
||||
+ default:
|
||||
+ entityarrow_pickupstatus = this.pickup;
|
||||
+ break label16;
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
this.pickup = entityarrow_pickupstatus;
|
||||
@@ -663,9 +672,24 @@
|
||||
@Override
|
||||
public void playerTouch(EntityHuman entityhuman) {
|
||||
if (!this.level().isClientSide && (this.inGround || this.isNoPhysics()) && this.shakeTime <= 0) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityDragonFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityDragonFireball.java
|
||||
@@ -15,6 +15,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
@@ -16,6 +16,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
@@ -11,7 +11,7 @@
|
||||
public class EntityDragonFireball extends EntityFireball {
|
||||
|
||||
public static final float SPLASH_RANGE = 4.0F;
|
||||
@@ -61,7 +65,7 @@
|
||||
@@ -62,7 +66,7 @@
|
||||
|
||||
this.level().levelEvent(2006, this.blockPosition(), this.isSilent() ? -1 : 1);
|
||||
this.level().addFreshEntity(entityareaeffectcloud);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityEgg.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityEgg.java
|
||||
@@ -11,6 +11,16 @@
|
||||
@@ -12,6 +12,16 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
+
|
||||
public class EntityEgg extends EntityProjectileThrowable {
|
||||
|
||||
public EntityEgg(EntityTypes<? extends EntityEgg> entitytypes, World world) {
|
||||
@@ -47,26 +57,53 @@
|
||||
private static final EntitySize ZERO_SIZED_DIMENSIONS = EntitySize.fixed(0.0F, 0.0F);
|
||||
@@ -50,30 +60,58 @@
|
||||
protected void onHit(MovingObjectPosition movingobjectposition) {
|
||||
super.onHit(movingobjectposition);
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -59,14 +59,18 @@
|
||||
|
||||
if (entitychicken != null) {
|
||||
- entitychicken.setAge(-24000);
|
||||
- entitychicken.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F);
|
||||
- this.level().addFreshEntity(entitychicken);
|
||||
+ // CraftBukkit start
|
||||
+ if (entitychicken.getBukkitEntity() instanceof Ageable) {
|
||||
+ ((Ageable) entitychicken.getBukkitEntity()).setBaby();
|
||||
+ }
|
||||
+ this.level().addFreshEntity(entitychicken, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG);
|
||||
+ // CraftBukkit end
|
||||
entitychicken.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F);
|
||||
if (!entitychicken.fudgePositionAfterSizeChange(EntityEgg.ZERO_SIZED_DIMENSIONS)) {
|
||||
break;
|
||||
}
|
||||
|
||||
- this.level().addFreshEntity(entitychicken);
|
||||
+ this.level().addFreshEntity(entitychicken, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityEnderPearl.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityEnderPearl.java
|
||||
@@ -18,6 +18,13 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
@@ -21,6 +21,13 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Bukkit;
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
@@ -14,64 +14,51 @@
|
||||
public class EntityEnderPearl extends EntityProjectileThrowable {
|
||||
|
||||
public EntityEnderPearl(EntityTypes<? extends EntityEnderPearl> entitytypes, World world) {
|
||||
@@ -54,23 +61,34 @@
|
||||
EntityPlayer entityplayer = (EntityPlayer) entity;
|
||||
@@ -65,19 +72,26 @@
|
||||
EntityPlayer entityplayer = (EntityPlayer) entity;
|
||||
|
||||
if (entityplayer.connection.isAcceptingMessages() && entityplayer.level() == this.level() && !entityplayer.isSleeping()) {
|
||||
- if (this.random.nextFloat() < 0.05F && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
|
||||
- EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.create(this.level());
|
||||
+ // CraftBukkit start - Fire PlayerTeleportEvent
|
||||
+ org.bukkit.craftbukkit.entity.CraftPlayer player = entityplayer.getBukkitEntity();
|
||||
+ org.bukkit.Location location = getBukkitEntity().getLocation();
|
||||
+ location.setPitch(player.getLocation().getPitch());
|
||||
+ location.setYaw(player.getLocation().getYaw());
|
||||
|
||||
- if (entityendermite != null) {
|
||||
- entityendermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
|
||||
- this.level().addFreshEntity(entityendermite);
|
||||
+ PlayerTeleportEvent teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.ENDER_PEARL);
|
||||
+ Bukkit.getPluginManager().callEvent(teleEvent);
|
||||
+
|
||||
+ if (!teleEvent.isCancelled() && entityplayer.connection.isAcceptingMessages()) {
|
||||
+ if (this.random.nextFloat() < 0.05F && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
|
||||
+ EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.create(this.level());
|
||||
+
|
||||
+ if (entityendermite != null) {
|
||||
+ entityendermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
|
||||
+ this.level().addFreshEntity(entityendermite, CreatureSpawnEvent.SpawnReason.ENDER_PEARL);
|
||||
if (entityplayer.connection.isAcceptingMessages()) {
|
||||
+ // CraftBukkit start
|
||||
+ Entity tp = entity.changeDimension(new DimensionTransition(worldserver, this.position(), entity.getDeltaMovement(), entity.getYRot(), entity.getXRot(), DimensionTransition.DO_NOTHING, PlayerTeleportEvent.TeleportCause.ENDER_PEARL));
|
||||
+ if (tp == null) {
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT);
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (this.random.nextFloat() < 0.05F && worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
|
||||
EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.create(worldserver);
|
||||
|
||||
if (entityendermite != null) {
|
||||
entityendermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
|
||||
- worldserver.addFreshEntity(entityendermite);
|
||||
+ worldserver.addFreshEntity(entityendermite, CreatureSpawnEvent.SpawnReason.ENDER_PEARL);
|
||||
}
|
||||
}
|
||||
|
||||
- entity.changeDimension(new DimensionTransition(worldserver, this.position(), entity.getDeltaMovement(), entity.getYRot(), entity.getXRot(), DimensionTransition.DO_NOTHING));
|
||||
+ // entity.changeDimension(new DimensionTransition(worldserver, this.position(), entity.getDeltaMovement(), entity.getYRot(), entity.getXRot(), DimensionTransition.DO_NOTHING)); // CraftBukkit - moved up
|
||||
entity.resetFallDistance();
|
||||
entityplayer.resetCurrentImpulseContext();
|
||||
- entity.hurt(this.damageSources().fall(), 5.0F);
|
||||
+ entity.hurt(this.damageSources().fall().customEntityDamager(this), 5.0F); // CraftBukkit
|
||||
this.playSound(worldserver, this.position());
|
||||
}
|
||||
- }
|
||||
} else {
|
||||
@@ -86,11 +100,11 @@
|
||||
this.playSound(worldserver, this.position());
|
||||
}
|
||||
|
||||
- if (entity.isPassenger()) {
|
||||
- entityplayer.dismountTo(this.getX(), this.getY(), this.getZ());
|
||||
- } else {
|
||||
- entity.teleportTo(this.getX(), this.getY(), this.getZ());
|
||||
- }
|
||||
+ if (entity.isPassenger()) {
|
||||
+ entity.stopRiding();
|
||||
+ }
|
||||
|
||||
- entity.resetFallDistance();
|
||||
- entity.hurt(this.damageSources().fall(), 5.0F);
|
||||
+ entityplayer.connection.teleport(teleEvent.getTo());
|
||||
+ entity.resetFallDistance();
|
||||
+ entity.hurt(this.damageSources().fall().customEntityDamager(this), 5.0F); // CraftBukkit
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level().playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), SoundEffects.PLAYER_TELEPORT, SoundCategory.PLAYERS);
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
return;
|
||||
}
|
||||
} else if (entity != null) {
|
||||
@@ -78,7 +96,7 @@
|
||||
entity.resetFallDistance();
|
||||
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
return;
|
||||
}
|
||||
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
}
|
||||
@@ -88,7 +106,7 @@
|
||||
@@ -116,7 +130,7 @@
|
||||
Entity entity = this.getOwner();
|
||||
|
||||
if (entity instanceof EntityPlayer && !entity.isAlive() && this.level().getGameRules().getBoolean(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH)) {
|
||||
@@ -80,12 +67,12 @@
|
||||
} else {
|
||||
super.tick();
|
||||
}
|
||||
@@ -100,7 +118,7 @@
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
Entity entity = this.getOwner();
|
||||
@@ -129,7 +143,7 @@
|
||||
|
||||
- if (entity != null && entity.level().dimension() != worldserver.dimension()) {
|
||||
+ if (entity != null && worldserver != null && entity.level().dimension() != worldserver.dimension()) { // CraftBukkit - SPIGOT-6113
|
||||
this.setOwner((Entity) null);
|
||||
}
|
||||
@Override
|
||||
public boolean canChangeDimensions(World world, World world1) {
|
||||
- if (world.dimension() == World.END) {
|
||||
+ if (world.getTypeKey() == WorldDimension.END) { // CraftBukkit
|
||||
Entity entity = this.getOwner();
|
||||
|
||||
if (entity instanceof EntityPlayer) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
|
||||
@@ -15,6 +15,10 @@
|
||||
import net.minecraft.world.entity.TraceableEntity;
|
||||
@@ -17,6 +17,10 @@
|
||||
import net.minecraft.world.item.enchantment.EnchantmentManager;
|
||||
import net.minecraft.world.level.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
@@ -11,7 +11,7 @@
|
||||
public class EntityEvokerFangs extends Entity implements TraceableEntity {
|
||||
|
||||
public static final int ATTACK_DURATION = 20;
|
||||
@@ -119,7 +123,7 @@
|
||||
@@ -121,7 +125,7 @@
|
||||
}
|
||||
|
||||
if (--this.lifeTicks < 0) {
|
||||
@@ -20,7 +20,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +134,7 @@
|
||||
@@ -132,7 +136,7 @@
|
||||
|
||||
if (entityliving.isAlive() && !entityliving.isInvulnerable() && entityliving != entityliving1) {
|
||||
if (entityliving1 == null) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityFireball.java
|
||||
@@ -18,6 +18,11 @@
|
||||
@@ -18,11 +18,18 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -11,17 +11,15 @@
|
||||
+
|
||||
public abstract class EntityFireball extends IProjectile {
|
||||
|
||||
public static final double ATTACK_DEFLECTION_SCALE = 0.1D;
|
||||
@@ -25,6 +30,8 @@
|
||||
public double xPower;
|
||||
public double yPower;
|
||||
public double zPower;
|
||||
public static final double INITAL_ACCELERATION_POWER = 0.1D;
|
||||
public static final double DEFLECTION_SCALE = 0.5D;
|
||||
public double accelerationPower;
|
||||
+ public float bukkitYield = 1; // CraftBukkit
|
||||
+ public boolean isIncendiary = true; // CraftBukkit
|
||||
|
||||
protected EntityFireball(EntityTypes<? extends EntityFireball> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -72,7 +79,7 @@
|
||||
@@ -71,7 +78,7 @@
|
||||
Entity entity = this.getOwner();
|
||||
|
||||
if (!this.level().isClientSide && (entity != null && entity.isRemoved() || !this.level().hasChunkAt(this.blockPosition()))) {
|
||||
@@ -30,7 +28,7 @@
|
||||
} else {
|
||||
super.tick();
|
||||
if (this.shouldBurn()) {
|
||||
@@ -82,7 +89,13 @@
|
||||
@@ -81,7 +88,13 @@
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType());
|
||||
|
||||
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityFireballFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityFireballFireball.java
|
||||
@@ -56,7 +56,12 @@
|
||||
@@ -58,7 +58,12 @@
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
if (nbttagcompound.contains("Item", 10)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityFireworks.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityFireworks.java
|
||||
@@ -30,6 +30,10 @@
|
||||
@@ -32,6 +32,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
public class EntityFireworks extends IProjectile implements ItemSupplier {
|
||||
|
||||
public static final DataWatcherObject<ItemStack> DATA_ID_FIREWORKS_ITEM = DataWatcher.defineId(EntityFireworks.class, DataWatcherRegistry.ITEM_STACK);
|
||||
@@ -146,7 +150,7 @@
|
||||
@@ -148,7 +152,7 @@
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity);
|
||||
|
||||
if (!this.noPhysics) {
|
||||
@@ -20,7 +20,7 @@
|
||||
this.hasImpulse = true;
|
||||
}
|
||||
|
||||
@@ -161,7 +165,11 @@
|
||||
@@ -163,7 +167,11 @@
|
||||
}
|
||||
|
||||
if (!this.level().isClientSide && this.life > this.lifetime) {
|
||||
@@ -33,7 +33,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -170,14 +178,18 @@
|
||||
@@ -172,14 +180,18 @@
|
||||
this.level().broadcastEntityEvent(this, (byte) 17);
|
||||
this.gameEvent(GameEvent.EXPLODE, this.getOwner());
|
||||
this.dealExplosionDamage();
|
||||
@@ -54,7 +54,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +199,11 @@
|
||||
@@ -189,7 +201,11 @@
|
||||
|
||||
this.level().getBlockState(blockposition).entityInside(this.level(), blockposition, this);
|
||||
if (!this.level().isClientSide() && this.hasExplosion()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityFishingHook.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityFishingHook.java
|
||||
@@ -46,6 +46,13 @@
|
||||
@@ -47,6 +47,13 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
public class EntityFishingHook extends IProjectile {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -67,6 +74,18 @@
|
||||
@@ -68,6 +75,18 @@
|
||||
private final int luck;
|
||||
private final int lureSpeed;
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
private EntityFishingHook(EntityTypes<? extends EntityFishingHook> entitytypes, World world, int i, int j) {
|
||||
super(entitytypes, world);
|
||||
this.syncronizedRandom = RandomSource.create();
|
||||
@@ -147,12 +166,12 @@
|
||||
@@ -148,12 +167,12 @@
|
||||
EntityHuman entityhuman = this.getPlayerOwner();
|
||||
|
||||
if (entityhuman == null) {
|
||||
@@ -48,7 +48,7 @@
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -253,7 +272,7 @@
|
||||
@@ -254,7 +273,7 @@
|
||||
if (!entityhuman.isRemoved() && entityhuman.isAlive() && (flag || flag1) && this.distanceToSqr((Entity) entityhuman) <= 1024.0D) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -57,7 +57,7 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -261,7 +280,7 @@
|
||||
@@ -262,7 +281,7 @@
|
||||
private void checkCollision() {
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity);
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -294,11 +313,11 @@
|
||||
@@ -295,11 +314,11 @@
|
||||
int i = 1;
|
||||
BlockPosition blockposition1 = blockposition.above();
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
--i;
|
||||
}
|
||||
|
||||
@@ -308,6 +327,10 @@
|
||||
@@ -309,6 +328,10 @@
|
||||
this.timeUntilLured = 0;
|
||||
this.timeUntilHooked = 0;
|
||||
this.getEntityData().set(EntityFishingHook.DATA_BITING, false);
|
||||
@@ -91,7 +91,7 @@
|
||||
}
|
||||
} else {
|
||||
float f;
|
||||
@@ -341,6 +364,13 @@
|
||||
@@ -342,6 +365,13 @@
|
||||
worldserver.sendParticles(Particles.FISHING, d0, d1, d2, 0, (double) (-f4), 0.01D, (double) f3, 1.0D);
|
||||
}
|
||||
} else {
|
||||
@@ -105,7 +105,7 @@
|
||||
this.playSound(SoundEffects.FISHING_BOBBER_SPLASH, 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
|
||||
double d3 = this.getY() + 0.5D;
|
||||
|
||||
@@ -373,12 +403,16 @@
|
||||
@@ -374,12 +404,16 @@
|
||||
}
|
||||
|
||||
if (this.timeUntilLured <= 0) {
|
||||
@@ -118,15 +118,15 @@
|
||||
}
|
||||
} else {
|
||||
- this.timeUntilLured = MathHelper.nextInt(this.random, 100, 600);
|
||||
- this.timeUntilLured -= this.lureSpeed * 20 * 5;
|
||||
- this.timeUntilLured -= this.lureSpeed;
|
||||
+ // CraftBukkit start - logic to modify fishing wait time
|
||||
+ this.timeUntilLured = MathHelper.nextInt(this.random, this.minWaitTime, this.maxWaitTime);
|
||||
+ this.timeUntilLured -= (this.applyLure) ? this.lureSpeed * 20 * 5 : 0;
|
||||
+ this.timeUntilLured -= (this.applyLure) ? this.lureSpeed : 0;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -446,6 +480,14 @@
|
||||
@@ -447,6 +481,14 @@
|
||||
int i = 0;
|
||||
|
||||
if (this.hookedIn != null) {
|
||||
@@ -141,7 +141,7 @@
|
||||
this.pullEntity(this.hookedIn);
|
||||
CriterionTriggers.FISHING_ROD_HOOKED.trigger((EntityPlayer) entityhuman, itemstack, this, Collections.emptyList());
|
||||
this.level().broadcastEntityEvent(this, (byte) 31);
|
||||
@@ -461,6 +503,15 @@
|
||||
@@ -462,6 +504,15 @@
|
||||
while (iterator.hasNext()) {
|
||||
ItemStack itemstack1 = (ItemStack) iterator.next();
|
||||
EntityItem entityitem = new EntityItem(this.level(), this.getX(), this.getY(), this.getZ(), itemstack1);
|
||||
@@ -157,7 +157,7 @@
|
||||
double d0 = entityhuman.getX() - this.getX();
|
||||
double d1 = entityhuman.getY() - this.getY();
|
||||
double d2 = entityhuman.getZ() - this.getZ();
|
||||
@@ -468,7 +519,11 @@
|
||||
@@ -469,7 +520,11 @@
|
||||
|
||||
entityitem.setDeltaMovement(d0 * 0.1D, d1 * 0.1D + Math.sqrt(Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2)) * 0.08D, d2 * 0.1D);
|
||||
this.level().addFreshEntity(entityitem);
|
||||
@@ -170,7 +170,7 @@
|
||||
if (itemstack1.is(TagsItem.FISHES)) {
|
||||
entityhuman.awardStat(StatisticList.FISH_CAUGHT, 1);
|
||||
}
|
||||
@@ -478,10 +533,27 @@
|
||||
@@ -479,10 +534,27 @@
|
||||
}
|
||||
|
||||
if (this.onGround()) {
|
||||
@@ -199,7 +199,7 @@
|
||||
return i;
|
||||
} else {
|
||||
return 0;
|
||||
@@ -514,8 +586,15 @@
|
||||
@@ -515,8 +587,15 @@
|
||||
|
||||
@Override
|
||||
public void remove(Entity.RemovalReason entity_removalreason) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityLargeFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityLargeFireball.java
|
||||
@@ -9,17 +9,24 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
@@ -13,17 +13,24 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
@@ -18,14 +18,14 @@
|
||||
+ isIncendiary = this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // CraftBukkit
|
||||
}
|
||||
|
||||
public EntityLargeFireball(World world, EntityLiving entityliving, double d0, double d1, double d2, int i) {
|
||||
super(EntityTypes.FIREBALL, entityliving, d0, d1, d2, world);
|
||||
public EntityLargeFireball(World world, EntityLiving entityliving, Vec3D vec3d, int i) {
|
||||
super(EntityTypes.FIREBALL, entityliving, vec3d, world);
|
||||
this.explosionPower = i;
|
||||
+ isIncendiary = this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -28,8 +35,16 @@
|
||||
@@ -32,8 +39,16 @@
|
||||
if (!this.level().isClientSide) {
|
||||
boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -59,7 +74,8 @@
|
||||
@@ -63,7 +78,8 @@
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
if (nbttagcompound.contains("ExplosionPower", 99)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityLlamaSpit.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityLlamaSpit.java
|
||||
@@ -15,6 +15,10 @@
|
||||
@@ -18,6 +18,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
public class EntityLlamaSpit extends IProjectile {
|
||||
|
||||
public EntityLlamaSpit(EntityTypes<? extends EntityLlamaSpit> entitytypes, World world) {
|
||||
@@ -38,7 +42,7 @@
|
||||
@@ -41,7 +45,7 @@
|
||||
Vec3D vec3d = this.getDeltaMovement();
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
double d0 = this.getX() + vec3d.x;
|
||||
double d1 = this.getY() + vec3d.y;
|
||||
double d2 = this.getZ() + vec3d.z;
|
||||
@@ -47,9 +51,9 @@
|
||||
@@ -50,9 +54,9 @@
|
||||
float f = 0.99F;
|
||||
|
||||
if (this.level().getBlockStates(this.getBoundingBox()).noneMatch(BlockBase.BlockData::isAir)) {
|
||||
@@ -32,7 +32,7 @@
|
||||
} else {
|
||||
this.setDeltaMovement(vec3d.scale(0.9900000095367432D));
|
||||
this.applyGravity();
|
||||
@@ -72,7 +76,7 @@
|
||||
@@ -86,7 +90,7 @@
|
||||
protected void onHitBlock(MovingObjectPositionBlock movingobjectpositionblock) {
|
||||
super.onHitBlock(movingobjectpositionblock);
|
||||
if (!this.level().isClientSide) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityPotion.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityPotion.java
|
||||
@@ -32,6 +32,18 @@
|
||||
@@ -34,6 +34,18 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
public class EntityPotion extends EntityProjectileThrowable implements ItemSupplier {
|
||||
|
||||
public static final double SPLASH_RANGE = 4.0D;
|
||||
@@ -96,18 +108,18 @@
|
||||
@@ -98,18 +110,18 @@
|
||||
|
||||
if (potioncontents.is(Potions.WATER)) {
|
||||
this.applyWater();
|
||||
@@ -42,7 +42,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,9 +154,10 @@
|
||||
@@ -144,9 +156,10 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
Entity entity1 = this.getEffectSource();
|
||||
@@ -165,24 +178,50 @@
|
||||
@@ -167,24 +180,50 @@
|
||||
d1 = 1.0D - Math.sqrt(d0) / 4.0D;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -191,7 +230,7 @@
|
||||
@@ -193,7 +232,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ());
|
||||
Entity entity = this.getOwner();
|
||||
|
||||
@@ -204,7 +243,14 @@
|
||||
@@ -206,7 +245,14 @@
|
||||
entityareaeffectcloud.setWaitTime(10);
|
||||
entityareaeffectcloud.setRadiusPerTick(-entityareaeffectcloud.getRadius() / (float) entityareaeffectcloud.getDuration());
|
||||
entityareaeffectcloud.setPotionContents(potioncontents);
|
||||
@@ -145,7 +145,7 @@
|
||||
}
|
||||
|
||||
public boolean isLingering() {
|
||||
@@ -215,13 +261,25 @@
|
||||
@@ -217,13 +263,25 @@
|
||||
IBlockData iblockdata = this.level().getBlockState(blockposition);
|
||||
|
||||
if (iblockdata.is(TagsBlock.FIRE)) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityProjectile.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityProjectile.java
|
||||
@@ -66,7 +66,7 @@
|
||||
}
|
||||
@@ -46,7 +46,7 @@
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity);
|
||||
|
||||
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS && !flag) {
|
||||
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
|
||||
- this.hitTargetOrDeflectSelf(movingobjectposition);
|
||||
+ this.preHitTargetOrDeflectSelf(movingobjectposition); // CraftBukkit - projectile hit event
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityShulkerBullet.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityShulkerBullet.java
|
||||
@@ -31,6 +31,10 @@
|
||||
@@ -32,6 +32,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
public class EntityShulkerBullet extends IProjectile {
|
||||
|
||||
private static final double SPEED = 0.15D;
|
||||
@@ -59,8 +63,21 @@
|
||||
@@ -60,8 +64,21 @@
|
||||
this.finalTarget = entity;
|
||||
this.currentMoveDirection = EnumDirection.UP;
|
||||
this.selectNextMoveDirection(enumdirection_enumaxis);
|
||||
@@ -33,7 +33,7 @@
|
||||
@Override
|
||||
public SoundCategory getSoundSource() {
|
||||
return SoundCategory.HOSTILE;
|
||||
@@ -193,7 +210,7 @@
|
||||
@@ -194,7 +211,7 @@
|
||||
@Override
|
||||
public void checkDespawn() {
|
||||
if (this.level().getDifficulty() == EnumDifficulty.PEACEFUL) {
|
||||
@@ -42,7 +42,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -229,7 +246,7 @@
|
||||
@@ -230,7 +247,7 @@
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity);
|
||||
|
||||
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
|
||||
@@ -51,7 +51,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +315,7 @@
|
||||
@@ -307,7 +324,7 @@
|
||||
if (entity instanceof EntityLiving) {
|
||||
EntityLiving entityliving1 = (EntityLiving) entity;
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,14 +329,20 @@
|
||||
@@ -321,14 +338,20 @@
|
||||
}
|
||||
|
||||
private void destroy() {
|
||||
@@ -83,7 +83,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -329,10 +352,15 @@
|
||||
@@ -338,10 +361,15 @@
|
||||
|
||||
@Override
|
||||
public boolean hurt(DamageSource damagesource, float f) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntitySmallFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntitySmallFireball.java
|
||||
@@ -13,6 +13,11 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
@@ -16,6 +16,11 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
||||
@@ -12,10 +12,10 @@
|
||||
public class EntitySmallFireball extends EntityFireballFireball {
|
||||
|
||||
public EntitySmallFireball(EntityTypes<? extends EntitySmallFireball> entitytypes, World world) {
|
||||
@@ -21,6 +26,11 @@
|
||||
@@ -24,6 +29,11 @@
|
||||
|
||||
public EntitySmallFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
|
||||
super(EntityTypes.SMALL_FIREBALL, entityliving, d0, d1, d2, world);
|
||||
public EntitySmallFireball(World world, EntityLiving entityliving, Vec3D vec3d) {
|
||||
super(EntityTypes.SMALL_FIREBALL, entityliving, vec3d, world);
|
||||
+ // CraftBukkit start
|
||||
+ if (this.getOwner() != null && this.getOwner() instanceof EntityInsentient) {
|
||||
+ isIncendiary = this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
@@ -23,24 +23,24 @@
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public EntitySmallFireball(World world, double d0, double d1, double d2, double d3, double d4, double d5) {
|
||||
@@ -35,7 +45,14 @@
|
||||
public EntitySmallFireball(World world, double d0, double d1, double d2, Vec3D vec3d) {
|
||||
@@ -40,7 +50,14 @@
|
||||
Entity entity1 = this.getOwner();
|
||||
int i = entity.getRemainingFireTicks();
|
||||
|
||||
- entity.igniteForSeconds(5);
|
||||
- entity.igniteForSeconds(5.0F);
|
||||
+ // CraftBukkit start - Entity damage by entity event + combust event
|
||||
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), entity.getBukkitEntity(), 5);
|
||||
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), entity.getBukkitEntity(), 5.0F);
|
||||
+ entity.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ entity.igniteForSeconds(event.getDuration(), false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (!entity.hurt(this.damageSources().fireball(this, entity1), 5.0F)) {
|
||||
entity.setRemainingFireTicks(i);
|
||||
} else if (entity1 instanceof EntityLiving) {
|
||||
@@ -51,10 +68,10 @@
|
||||
DamageSource damagesource = this.damageSources().fireball(this, entity1);
|
||||
|
||||
if (!entity.hurt(damagesource, 5.0F)) {
|
||||
@@ -58,10 +75,10 @@
|
||||
if (!this.level().isClientSide) {
|
||||
Entity entity = this.getOwner();
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
this.level().setBlockAndUpdate(blockposition, BlockFireAbstract.getState(this.level(), blockposition));
|
||||
}
|
||||
}
|
||||
@@ -66,7 +83,7 @@
|
||||
@@ -73,7 +90,7 @@
|
||||
protected void onHit(MovingObjectPosition movingobjectposition) {
|
||||
super.onHit(movingobjectposition);
|
||||
if (!this.level().isClientSide) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntitySpectralArrow.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntitySpectralArrow.java
|
||||
@@ -40,7 +40,7 @@
|
||||
@@ -41,7 +41,7 @@
|
||||
super.doPostHurtEffects(entityliving);
|
||||
MobEffect mobeffect = new MobEffect(MobEffects.GLOWING, this.duration, 0);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityThrownTrident.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityThrownTrident.java
|
||||
@@ -23,6 +23,10 @@
|
||||
@@ -24,6 +24,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
public class EntityThrownTrident extends EntityArrow {
|
||||
|
||||
private static final DataWatcherObject<Byte> ID_LOYALTY = DataWatcher.defineId(EntityThrownTrident.class, DataWatcherRegistry.BYTE);
|
||||
@@ -68,7 +72,7 @@
|
||||
@@ -69,7 +73,7 @@
|
||||
this.spawnAtLocation(this.getPickupItem(), 0.1F);
|
||||
}
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
} else {
|
||||
this.setNoPhysics(true);
|
||||
Vec3D vec3d = entity.getEyePosition().subtract(this.position());
|
||||
@@ -152,7 +156,7 @@
|
||||
if (entitylightning != null) {
|
||||
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
|
||||
entitylightning.setCause(entity1 instanceof EntityPlayer ? (EntityPlayer) entity1 : null);
|
||||
- this.level().addFreshEntity(entitylightning);
|
||||
+ ((WorldServer) this.level()).strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRIDENT); // CraftBukkit
|
||||
soundeffect = SoundEffects.TRIDENT_THUNDER;
|
||||
f1 = 5.0F;
|
||||
}
|
||||
@@ -129,7 +133,7 @@
|
||||
|
||||
world = this.level();
|
||||
if (world instanceof WorldServer) {
|
||||
- worldserver = (WorldServer) world;
|
||||
+ WorldServer worldserver = (WorldServer) world; // CraftBukkit - decompile error
|
||||
EnchantmentManager.doPostAttackEffectsWithItemSource(worldserver, entity, damagesource, this.getWeaponItem());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityTippedArrow.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityTippedArrow.java
|
||||
@@ -118,7 +118,7 @@
|
||||
@@ -119,7 +119,7 @@
|
||||
mobeffect = (MobEffect) iterator.next();
|
||||
entityliving.addEffect(new MobEffect(mobeffect.getEffect(), Math.max(mobeffect.mapDuration((i) -> {
|
||||
return i / 8;
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
@@ -127,7 +127,7 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
mobeffect = (MobEffect) iterator.next();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityWitherSkull.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityWitherSkull.java
|
||||
@@ -21,6 +21,11 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
@@ -24,6 +24,11 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
@@ -12,16 +12,16 @@
|
||||
public class EntityWitherSkull extends EntityFireball {
|
||||
|
||||
private static final DataWatcherObject<Boolean> DATA_DANGEROUS = DataWatcher.defineId(EntityWitherSkull.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -64,7 +69,7 @@
|
||||
@@ -69,7 +74,7 @@
|
||||
if (entity.isAlive()) {
|
||||
this.doEnchantDamageEffects(entityliving, entity);
|
||||
EnchantmentManager.doPostAttackEffects(worldserver, entity, damagesource);
|
||||
} else {
|
||||
- entityliving.heal(5.0F);
|
||||
+ entityliving.heal(5.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -82,7 +87,7 @@
|
||||
@@ -86,7 +91,7 @@
|
||||
}
|
||||
|
||||
if (b0 > 0) {
|
||||
@@ -30,7 +30,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,8 +98,16 @@
|
||||
@@ -97,8 +102,16 @@
|
||||
protected void onHit(MovingObjectPosition movingobjectposition) {
|
||||
super.onHit(movingobjectposition);
|
||||
if (!this.level().isClientSide) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/IProjectile.java
|
||||
+++ b/net/minecraft/world/entity/projectile/IProjectile.java
|
||||
@@ -26,6 +26,10 @@
|
||||
@@ -30,6 +30,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
public abstract class IProjectile extends Entity implements TraceableEntity {
|
||||
|
||||
@Nullable
|
||||
@@ -35,6 +39,10 @@
|
||||
private boolean leftOwner;
|
||||
private boolean hasBeenShot;
|
||||
@@ -41,6 +45,10 @@
|
||||
@Nullable
|
||||
private Entity lastDeflectedBy;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ private boolean hitCancelled = false;
|
||||
@@ -22,7 +22,7 @@
|
||||
IProjectile(EntityTypes<? extends IProjectile> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
}
|
||||
@@ -44,6 +52,7 @@
|
||||
@@ -50,6 +58,7 @@
|
||||
this.ownerUUID = entity.getUUID();
|
||||
this.cachedOwner = entity;
|
||||
}
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -170,6 +179,17 @@
|
||||
@@ -177,6 +186,17 @@
|
||||
this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, entity.onGround() ? 0.0D : vec3d.y, vec3d.z));
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
protected ProjectileDeflection hitTargetOrDeflectSelf(MovingObjectPosition movingobjectposition) {
|
||||
if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.ENTITY) {
|
||||
MovingObjectPositionEntity movingobjectpositionentity = (MovingObjectPositionEntity) movingobjectposition;
|
||||
@@ -225,6 +245,11 @@
|
||||
@@ -237,6 +257,11 @@
|
||||
protected void onHitEntity(MovingObjectPositionEntity movingobjectpositionentity) {}
|
||||
|
||||
protected void onHitBlock(MovingObjectPositionBlock movingobjectpositionblock) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java
|
||||
+++ b/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java
|
||||
@@ -22,6 +22,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
@@ -25,6 +25,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
@@ -10,17 +10,17 @@
|
||||
+
|
||||
public abstract class AbstractWindCharge extends EntityFireball implements ItemSupplier {
|
||||
|
||||
public static final AbstractWindCharge.a EXPLOSION_DAMAGE_CALCULATOR = new AbstractWindCharge.a();
|
||||
@@ -95,7 +99,7 @@
|
||||
super.onHitBlock(movingobjectpositionblock);
|
||||
if (!this.level().isClientSide) {
|
||||
this.explode();
|
||||
public static final ExplosionDamageCalculator EXPLOSION_DAMAGE_CALCULATOR = new SimpleExplosionDamageCalculator(true, false, Optional.empty(), BuiltInRegistries.BLOCK.getTag(TagsBlock.BLOCKS_WIND_CHARGE_EXPLOSIONS).map(Function.identity()));
|
||||
@@ -113,7 +117,7 @@
|
||||
Vec3D vec3d1 = movingobjectpositionblock.getLocation().add(vec3d);
|
||||
|
||||
this.explode(vec3d1);
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
}
|
||||
@@ -104,7 +108,7 @@
|
||||
@@ -122,7 +126,7 @@
|
||||
protected void onHit(MovingObjectPosition movingobjectposition) {
|
||||
super.onHit(movingobjectposition);
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -29,10 +29,10 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -139,7 +143,7 @@
|
||||
@@ -157,7 +161,7 @@
|
||||
public void tick() {
|
||||
if (!this.level().isClientSide && this.getBlockY() > this.level().getMaxBuildHeight() + 30) {
|
||||
this.explode();
|
||||
this.explode(this.position());
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.OUT_OF_WORLD); // CraftBukkit - add Bukkit remove cause
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/raid/EntityRaider.java
|
||||
+++ b/net/minecraft/world/entity/raid/EntityRaider.java
|
||||
@@ -45,6 +45,10 @@
|
||||
@@ -38,6 +38,10 @@
|
||||
import net.minecraft.world.level.WorldAccess;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -11,16 +11,7 @@
|
||||
public abstract class EntityRaider extends EntityMonsterPatrolling {
|
||||
|
||||
protected static final DataWatcherObject<Boolean> IS_CELEBRATING = DataWatcher.defineId(EntityRaider.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -166,7 +170,7 @@
|
||||
MobEffect mobeffect1 = new MobEffect(MobEffects.BAD_OMEN, 120000, i, false, false, true);
|
||||
|
||||
if (!this.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_RAIDS)) {
|
||||
- entityhuman.addEffect(mobeffect1);
|
||||
+ entityhuman.addEffect(mobeffect1, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.PATROL_CAPTAIN); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -275,7 +279,7 @@
|
||||
@@ -233,7 +237,7 @@
|
||||
this.onItemPickup(entityitem);
|
||||
this.setItemSlot(enumitemslot, itemstack);
|
||||
this.take(entityitem, itemstack.getCount());
|
||||
@@ -29,7 +20,7 @@
|
||||
this.getCurrentRaid().setLeader(this.getWave(), this);
|
||||
this.setPatrolLeader(true);
|
||||
} else {
|
||||
@@ -324,7 +328,7 @@
|
||||
@@ -282,7 +286,7 @@
|
||||
|
||||
private final T mob;
|
||||
|
||||
@@ -38,7 +29,7 @@
|
||||
this.mob = entityraider1;
|
||||
this.setFlags(EnumSet.of(PathfinderGoal.Type.MOVE));
|
||||
}
|
||||
@@ -517,7 +521,7 @@
|
||||
@@ -475,7 +479,7 @@
|
||||
private final float hostileRadiusSqr;
|
||||
public final PathfinderTargetCondition shoutTargeting = PathfinderTargetCondition.forNonCombat().range(8.0D).ignoreLineOfSight().ignoreInvisibilityTesting();
|
||||
|
||||
@@ -47,7 +38,7 @@
|
||||
this.mob = entityillagerabstract;
|
||||
this.hostileRadiusSqr = f * f;
|
||||
this.setFlags(EnumSet.of(PathfinderGoal.Type.MOVE, PathfinderGoal.Type.LOOK));
|
||||
@@ -540,7 +544,7 @@
|
||||
@@ -498,7 +502,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityRaider entityraider = (EntityRaider) iterator.next();
|
||||
|
||||
@@ -56,7 +47,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -557,7 +561,7 @@
|
||||
@@ -515,7 +519,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityRaider entityraider = (EntityRaider) iterator.next();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/raid/Raid.java
|
||||
+++ b/net/minecraft/world/entity/raid/Raid.java
|
||||
@@ -180,6 +180,12 @@
|
||||
@@ -177,6 +177,12 @@
|
||||
return this.status == Raid.Status.LOSS;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
public float getTotalHealth() {
|
||||
return this.totalHealth;
|
||||
}
|
||||
@@ -284,6 +290,7 @@
|
||||
@@ -281,6 +287,7 @@
|
||||
|
||||
this.active = this.level.hasChunkAt(this.center);
|
||||
if (this.level.getDifficulty() == EnumDifficulty.PEACEFUL) {
|
||||
@@ -21,7 +21,7 @@
|
||||
this.stop();
|
||||
return;
|
||||
}
|
||||
@@ -303,13 +310,16 @@
|
||||
@@ -300,13 +307,16 @@
|
||||
if (!this.level.isVillage(this.center)) {
|
||||
if (this.groupsSpawned > 0) {
|
||||
this.status = Raid.Status.LOSS;
|
||||
@@ -38,7 +38,7 @@
|
||||
this.stop();
|
||||
return;
|
||||
}
|
||||
@@ -383,6 +393,7 @@
|
||||
@@ -380,6 +390,7 @@
|
||||
}
|
||||
|
||||
if (j > 3) {
|
||||
@@ -46,7 +46,7 @@
|
||||
this.stop();
|
||||
break;
|
||||
}
|
||||
@@ -395,6 +406,7 @@
|
||||
@@ -392,6 +403,7 @@
|
||||
this.status = Raid.Status.VICTORY;
|
||||
Iterator iterator = this.heroesOfTheVillage.iterator();
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
UUID uuid = (UUID) iterator.next();
|
||||
Entity entity = this.level.getEntity(uuid);
|
||||
@@ -409,10 +421,12 @@
|
||||
@@ -406,10 +418,12 @@
|
||||
|
||||
entityplayer.awardStat(StatisticList.RAID_WIN);
|
||||
CriterionTriggers.RAID_WIN.trigger(entityplayer);
|
||||
@@ -67,7 +67,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -420,6 +434,7 @@
|
||||
@@ -417,6 +431,7 @@
|
||||
} else if (this.isOver()) {
|
||||
++this.celebrationTicks;
|
||||
if (this.celebrationTicks >= 600) {
|
||||
@@ -75,7 +75,7 @@
|
||||
this.stop();
|
||||
return;
|
||||
}
|
||||
@@ -556,6 +571,10 @@
|
||||
@@ -553,6 +568,10 @@
|
||||
int j = araid_wave.length;
|
||||
int k = 0;
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
while (k < j) {
|
||||
Raid.Wave raid_wave = araid_wave[k];
|
||||
int l = this.getDefaultNumSpawns(raid_wave, i, flag1) + this.getPotentialBonusSpawns(raid_wave, this.random, i, difficultydamagescaler, flag1);
|
||||
@@ -571,9 +590,11 @@
|
||||
@@ -568,9 +587,11 @@
|
||||
entityraider.setPatrolLeader(true);
|
||||
this.setLeader(i, entityraider);
|
||||
flag = true;
|
||||
@@ -98,7 +98,7 @@
|
||||
if (raid_wave.entityType == EntityTypes.RAVAGER) {
|
||||
EntityRaider entityraider1 = null;
|
||||
|
||||
@@ -592,6 +613,7 @@
|
||||
@@ -589,6 +610,7 @@
|
||||
this.joinRaid(i, entityraider1, blockposition, false);
|
||||
entityraider1.moveTo(blockposition, 0.0F, 0.0F);
|
||||
entityraider1.startRiding(entityraider);
|
||||
@@ -106,7 +106,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -609,6 +631,7 @@
|
||||
@@ -606,6 +628,7 @@
|
||||
++this.groupsSpawned;
|
||||
this.updateBossbar();
|
||||
this.setDirty();
|
||||
@@ -114,16 +114,16 @@
|
||||
}
|
||||
|
||||
public void joinRaid(int i, EntityRaider entityraider, @Nullable BlockPosition blockposition, boolean flag) {
|
||||
@@ -624,7 +647,7 @@
|
||||
@@ -621,7 +644,7 @@
|
||||
entityraider.finalizeSpawn(this.level, this.level.getCurrentDifficultyAt(blockposition), EnumMobSpawn.EVENT, (GroupDataEntity) null);
|
||||
entityraider.applyRaidBuffs(i, false);
|
||||
entityraider.applyRaidBuffs(this.level, i, false);
|
||||
entityraider.setOnGround(true);
|
||||
- this.level.addFreshEntityWithPassengers(entityraider);
|
||||
+ this.level.addFreshEntityWithPassengers(entityraider, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.RAID); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -873,6 +896,12 @@
|
||||
@@ -870,6 +893,12 @@
|
||||
this.heroesOfTheVillage.add(entity.getUUID());
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -240,4 +256,51 @@
|
||||
@@ -248,4 +264,51 @@
|
||||
public void stopOpen(EntityHuman entityhuman) {
|
||||
this.level().gameEvent((Holder) GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.a.of((Entity) entityhuman));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/vehicle/EntityBoat.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/EntityBoat.java
|
||||
@@ -54,6 +54,15 @@
|
||||
@@ -55,6 +55,16 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
@@ -8,17 +8,18 @@
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.entity.Vehicle;
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+import org.bukkit.event.vehicle.VehicleDestroyEvent;
|
||||
+import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
||||
+import org.bukkit.event.vehicle.VehicleMoveEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityBoat extends VehicleEntity implements VariantHolder<EntityBoat.EnumBoatType> {
|
||||
public class EntityBoat extends VehicleEntity implements Leashable, VariantHolder<EntityBoat.EnumBoatType> {
|
||||
|
||||
private static final DataWatcherObject<Integer> DATA_ID_TYPE = DataWatcher.defineId(EntityBoat.class, DataWatcherRegistry.INT);
|
||||
@@ -91,6 +100,14 @@
|
||||
private float bubbleAngle;
|
||||
private float bubbleAngleO;
|
||||
@@ -94,6 +104,14 @@
|
||||
@Nullable
|
||||
private Leashable.a leashData;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ // PAIL: Some of these haven't worked since a few updates, and since 1.9 they are less and less applicable.
|
||||
@@ -31,7 +32,7 @@
|
||||
public EntityBoat(EntityTypes<? extends EntityBoat> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
this.paddlePositions = new float[2];
|
||||
@@ -186,9 +203,29 @@
|
||||
@@ -189,9 +207,29 @@
|
||||
public void push(Entity entity) {
|
||||
if (entity instanceof EntityBoat) {
|
||||
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
|
||||
@@ -61,7 +62,7 @@
|
||||
super.push(entity);
|
||||
}
|
||||
|
||||
@@ -282,6 +319,7 @@
|
||||
@@ -285,6 +323,7 @@
|
||||
return this.getDirection().getClockWise();
|
||||
}
|
||||
|
||||
@@ -69,7 +70,7 @@
|
||||
@Override
|
||||
public void tick() {
|
||||
this.oldStatus = this.status;
|
||||
@@ -322,6 +360,22 @@
|
||||
@@ -325,6 +364,22 @@
|
||||
this.setDeltaMovement(Vec3D.ZERO);
|
||||
}
|
||||
|
||||
@@ -92,7 +93,27 @@
|
||||
this.tickBubbleColumn();
|
||||
|
||||
for (int i = 0; i <= 1; ++i) {
|
||||
@@ -811,6 +865,11 @@
|
||||
@@ -837,11 +892,18 @@
|
||||
|
||||
@Override
|
||||
public void remove(Entity.RemovalReason entity_removalreason) {
|
||||
+ // CraftBukkit start - add Bukkit remove cause
|
||||
+ this.remove(entity_removalreason, null);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) {
|
||||
+ // CraftBukkit end
|
||||
if (!this.level().isClientSide && entity_removalreason.shouldDestroy() && this.isLeashed()) {
|
||||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
- super.remove(entity_removalreason);
|
||||
+ super.remove(entity_removalreason, cause); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -857,6 +919,11 @@
|
||||
|
||||
this.causeFallDamage(this.fallDistance, 1.0F, this.damageSources().fall());
|
||||
if (!this.level().isClientSide && !this.isRemoved()) {
|
||||
@@ -104,7 +125,7 @@
|
||||
this.kill();
|
||||
if (this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
|
||||
int i;
|
||||
@@ -824,6 +883,7 @@
|
||||
@@ -870,6 +937,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,8 +61,8 @@
|
||||
}
|
||||
|
||||
this.checkBelowWorld();
|
||||
- this.handleNetherPortal();
|
||||
+ // this.handleNetherPortal(); // CraftBukkit - handled in postTick
|
||||
- this.handlePortal();
|
||||
+ // this.handlePortal(); // CraftBukkit - handled in postTick
|
||||
if (this.level().isClientSide) {
|
||||
if (this.lerpSteps > 0) {
|
||||
this.lerpPositionAndRotationStep(this.lerpSteps, this.lerpX, this.lerpY, this.lerpZ, this.lerpYRot, this.lerpXRot);
|
||||
@@ -109,7 +109,7 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entity.push(this);
|
||||
entity.push((Entity) this);
|
||||
}
|
||||
}
|
||||
@@ -355,6 +412,14 @@
|
||||
@@ -124,7 +124,7 @@
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entity1.push(this);
|
||||
entity1.push((Entity) this);
|
||||
}
|
||||
}
|
||||
@@ -371,7 +436,7 @@
|
||||
|
||||
Reference in New Issue
Block a user