Update to Minecraft 1.19.4

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2023-03-15 03:30:00 +11:00
parent 90a887a912
commit 40076782ed
227 changed files with 2788 additions and 1621 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -122,8 +122,65 @@
@@ -124,8 +124,65 @@
import net.minecraft.world.scores.ScoreboardTeamBase;
import org.slf4j.Logger;
@@ -66,7 +66,7 @@
private static final Logger LOGGER = LogUtils.getLogger();
public static final String ID_TAG = "id";
public static final String PASSENGERS_TAG = "Passengers";
@@ -234,6 +291,25 @@
@@ -236,6 +293,25 @@
public boolean hasVisualFire;
@Nullable
private IBlockData feetBlockState;
@@ -92,7 +92,7 @@
public Entity(EntityTypes<?> entitytypes, World world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
@@ -365,6 +441,12 @@
@@ -367,6 +443,12 @@
public void onClientRemoval() {}
public void setPose(EntityPose entitypose) {
@@ -105,7 +105,7 @@
this.entityData.set(Entity.DATA_POSE, entitypose);
}
@@ -389,6 +471,33 @@
@@ -391,6 +473,33 @@
}
protected void setRot(float f, float f1) {
@@ -139,7 +139,7 @@
this.setYRot(f % 360.0F);
this.setXRot(f1 % 360.0F);
}
@@ -430,6 +539,15 @@
@@ -432,6 +541,15 @@
this.baseTick();
}
@@ -155,7 +155,7 @@
public void baseTick() {
this.level.getProfiler().push("entityBaseTick");
this.feetBlockState = null;
@@ -444,7 +562,7 @@
@@ -446,7 +564,7 @@
this.walkDistO = this.walkDist;
this.xRotO = this.getXRot();
this.yRotO = this.getYRot();
@@ -164,7 +164,7 @@
if (this.canSpawnSprintParticle()) {
this.spawnSprintParticle();
}
@@ -479,6 +597,10 @@
@@ -481,6 +599,10 @@
if (this.isInLava()) {
this.lavaHurt();
this.fallDistance *= 0.5F;
@@ -175,7 +175,7 @@
}
this.checkOutOfWorld();
@@ -522,15 +644,48 @@
@@ -524,15 +646,48 @@
public void lavaHurt() {
if (!this.fireImmune()) {
@@ -196,7 +196,7 @@
+ this.setSecondsOnFire(15, false);
+ }
+ CraftEventFactory.blockDamage = (lastLavaContact) == null ? null : org.bukkit.craftbukkit.block.CraftBlock.at(level, lastLavaContact);
if (this.hurt(DamageSource.LAVA, 4.0F)) {
if (this.hurt(this.damageSources().lava(), 4.0F)) {
this.playSound(SoundEffects.GENERIC_BURN, 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
}
+ CraftEventFactory.blockDamage = null;
@@ -225,7 +225,7 @@
int j = i * 20;
if (this instanceof EntityLiving) {
@@ -644,6 +799,28 @@
@@ -646,6 +801,28 @@
block.updateEntityAfterFallOn(this.level, this);
}
@@ -254,7 +254,7 @@
if (this.onGround) {
block.stepOn(this.level, blockposition, iblockdata, this);
}
@@ -946,6 +1123,20 @@
@@ -948,6 +1125,20 @@
return SoundEffects.GENERIC_SPLASH;
}
@@ -274,8 +274,8 @@
+
protected void checkInsideBlocks() {
AxisAlignedBB axisalignedbb = this.getBoundingBox();
BlockPosition blockposition = new BlockPosition(axisalignedbb.minX + 1.0E-7D, axisalignedbb.minY + 1.0E-7D, axisalignedbb.minZ + 1.0E-7D);
@@ -1305,6 +1496,7 @@
BlockPosition blockposition = BlockPosition.containing(axisalignedbb.minX + 1.0E-7D, axisalignedbb.minY + 1.0E-7D, axisalignedbb.minZ + 1.0E-7D);
@@ -1311,6 +1502,7 @@
this.yo = d1;
this.zo = d4;
this.setPos(d3, d1, d4);
@@ -283,7 +283,7 @@
}
public void moveTo(Vec3D vec3d) {
@@ -1495,6 +1687,12 @@
@@ -1505,6 +1697,12 @@
return false;
}
@@ -296,7 +296,7 @@
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
if (entity instanceof EntityPlayer) {
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
@@ -1528,7 +1726,7 @@
@@ -1538,7 +1736,7 @@
} else {
String s = this.getEncodeId();
@@ -305,7 +305,7 @@
return false;
} else {
nbttagcompound.putString("id", s);
@@ -1553,6 +1751,18 @@
@@ -1563,6 +1761,18 @@
Vec3D vec3d = this.getDeltaMovement();
nbttagcompound.put("Motion", this.newDoubleList(vec3d.x, vec3d.y, vec3d.z));
@@ -324,7 +324,7 @@
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
nbttagcompound.putFloat("FallDistance", this.fallDistance);
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
@@ -1561,6 +1771,25 @@
@@ -1571,6 +1781,25 @@
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
nbttagcompound.putUUID("UUID", this.getUUID());
@@ -350,7 +350,7 @@
IChatBaseComponent ichatbasecomponent = this.getCustomName();
if (ichatbasecomponent != null) {
@@ -1628,6 +1857,11 @@
@@ -1638,6 +1867,11 @@
}
}
@@ -362,7 +362,7 @@
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -1711,6 +1945,45 @@
@@ -1721,6 +1955,45 @@
} else {
throw new IllegalStateException("Entity has invalid position");
}
@@ -408,7 +408,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
@@ -1786,9 +2059,22 @@
@@ -1796,9 +2069,22 @@
} else if (this.level.isClientSide) {
return null;
} else {
@@ -431,7 +431,7 @@
this.level.addFreshEntity(entityitem);
return entityitem;
}
@@ -1882,7 +2168,7 @@
@@ -1894,7 +2180,7 @@
this.setPose(EntityPose.STANDING);
this.vehicle = entity;
@@ -440,7 +440,7 @@
entity.getIndirectPassengersStream().filter((entity2) -> {
return entity2 instanceof EntityPlayer;
}).forEach((entity2) -> {
@@ -1913,7 +2199,7 @@
@@ -1925,7 +2211,7 @@
Entity entity = this.vehicle;
this.vehicle = null;
@@ -449,7 +449,7 @@
}
}
@@ -1926,10 +2212,31 @@
@@ -1934,10 +2220,31 @@
this.removeVehicle();
}
@@ -482,9 +482,9 @@
if (this.passengers.isEmpty()) {
this.passengers = ImmutableList.of(entity);
} else {
@@ -1945,12 +2252,32 @@
}
@@ -1954,12 +2261,32 @@
this.gameEvent(GameEvent.ENTITY_MOUNT, entity);
}
+ return true; // CraftBukkit
}
@@ -516,15 +516,15 @@
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
this.passengers = ImmutableList.of();
} else {
@@ -1961,6 +2288,7 @@
@@ -1971,6 +2298,7 @@
entity.boardingCooldown = 60;
this.gameEvent(GameEvent.ENTITY_DISMOUNT, entity);
}
+ return true; // CraftBukkit
}
protected boolean canAddPassenger(Entity entity) {
@@ -2023,14 +2351,20 @@
@@ -2037,14 +2365,20 @@
if (this.isInsidePortal) {
MinecraftServer minecraftserver = worldserver.getServer();
@@ -548,7 +548,7 @@
this.level.getProfiler().pop();
}
@@ -2148,6 +2482,13 @@
@@ -2164,6 +2498,13 @@
}
public void setSwimming(boolean flag) {
@@ -562,7 +562,7 @@
this.setSharedFlag(4, flag);
}
@@ -2193,8 +2534,12 @@
@@ -2209,8 +2550,12 @@
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
}
@@ -576,7 +576,7 @@
}
public boolean getSharedFlag(int i) {
@@ -2213,7 +2558,7 @@
@@ -2229,7 +2574,7 @@
}
public int getMaxAirSupply() {
@@ -585,7 +585,7 @@
}
public int getAirSupply() {
@@ -2221,7 +2566,18 @@
@@ -2237,7 +2582,18 @@
}
public void setAirSupply(int i) {
@@ -605,7 +605,7 @@
}
public int getTicksFrozen() {
@@ -2248,11 +2604,41 @@
@@ -2264,11 +2620,41 @@
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
this.setRemainingFireTicks(this.remainingFireTicks + 1);
@@ -624,9 +624,8 @@
+ this.setSecondsOnFire(entityCombustEvent.getDuration(), false);
+ }
+ // CraftBukkit end
}
- this.hurt(DamageSource.LIGHTNING_BOLT, 5.0F);
+ }
+
+ // CraftBukkit start
+ if (thisBukkitEntity instanceof Hanging) {
+ HangingBreakByEntityEvent hangingEvent = new HangingBreakByEntityEvent((Hanging) thisBukkitEntity, stormBukkitEntity);
@@ -635,13 +634,14 @@
+ if (hangingEvent.isCancelled()) {
+ return;
+ }
+ }
+
}
- this.hurt(this.damageSources().lightningBolt(), 5.0F);
+ if (this.fireImmune()) {
+ return;
+ }
+ CraftEventFactory.entityDamage = entitylightning;
+ if (!this.hurt(DamageSource.LIGHTNING_BOLT, 5.0F)) {
+ if (!this.hurt(this.damageSources().lightningBolt(), 5.0F)) {
+ CraftEventFactory.entityDamage = null;
+ return;
+ }
@@ -649,7 +649,7 @@
}
public void onAboveBubbleCol(boolean flag) {
@@ -2417,15 +2803,38 @@
@@ -2433,15 +2819,38 @@
@Nullable
public Entity changeDimension(WorldServer worldserver) {
@@ -690,7 +690,7 @@
this.level.getProfiler().popPush("reloading");
Entity entity = this.getType().create(worldserver);
@@ -2434,9 +2843,17 @@
@@ -2450,9 +2859,17 @@
entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
entity.setDeltaMovement(shapedetectorshape.speed);
worldserver.addDuringTeleport(entity);
@@ -710,7 +710,7 @@
}
this.removeAfterChangingDimensions();
@@ -2457,20 +2874,34 @@
@@ -2473,20 +2890,34 @@
@Nullable
protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) {
@@ -750,7 +750,7 @@
IBlockData iblockdata = this.level.getBlockState(this.portalEntrancePos);
EnumDirection.EnumAxis enumdirection_enumaxis;
Vec3D vec3d;
@@ -2487,8 +2918,8 @@
@@ -2503,8 +2934,8 @@
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
}
@@ -761,7 +761,7 @@
}
} else {
BlockPosition blockposition1;
@@ -2498,8 +2929,14 @@
@@ -2514,8 +2945,14 @@
} else {
blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos());
}
@@ -777,7 +777,7 @@
}
}
@@ -2507,8 +2944,23 @@
@@ -2523,8 +2960,23 @@
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
}
@@ -803,7 +803,7 @@
}
public boolean canChangeDimensions() {
@@ -2731,7 +3183,26 @@
@@ -2773,7 +3225,26 @@
}
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
@@ -831,7 +831,7 @@
}
protected float getEyeHeight(EntityPose entitypose, EntitySize entitysize) {
@@ -3023,6 +3494,11 @@
@@ -3084,6 +3555,11 @@
vec3d = vec3d.add(vec3d1);
++k1;
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityAgeable.java
+++ b/net/minecraft/world/entity/EntityAgeable.java
@@ -19,6 +19,7 @@
@@ -20,6 +20,7 @@
protected int age;
protected int forcedAge;
protected int forcedAgeTimer;
@@ -8,7 +8,7 @@
protected EntityAgeable(EntityTypes<? extends EntityAgeable> entitytypes, World world) {
super(entitytypes, world);
@@ -102,6 +103,7 @@
@@ -103,6 +104,7 @@
super.addAdditionalSaveData(nbttagcompound);
nbttagcompound.putInt("Age", this.getAge());
nbttagcompound.putInt("ForcedAge", this.forcedAge);
@@ -16,7 +16,7 @@
}
@Override
@@ -109,6 +111,7 @@
@@ -110,6 +112,7 @@
super.readAdditionalSaveData(nbttagcompound);
this.setAge(nbttagcompound.getInt("Age"));
this.forcedAge = nbttagcompound.getInt("ForcedAge");
@@ -24,7 +24,7 @@
}
@Override
@@ -123,7 +126,7 @@
@@ -124,7 +127,7 @@
@Override
public void aiStep() {
super.aiStep();

View File

@@ -10,7 +10,7 @@
+import org.bukkit.entity.LivingEntity;
+// CraftBukkit end
+
public class EntityAreaEffectCloud extends Entity {
public class EntityAreaEffectCloud extends Entity implements TraceableEntity {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -129,6 +135,22 @@
@@ -36,7 +36,7 @@
public int getColor() {
return (Integer) this.getEntityData().get(EntityAreaEffectCloud.DATA_COLOR);
}
@@ -261,6 +283,7 @@
@@ -263,6 +285,7 @@
if (!list1.isEmpty()) {
Iterator iterator1 = list1.iterator();
@@ -44,7 +44,7 @@
while (iterator1.hasNext()) {
EntityLiving entityliving = (EntityLiving) iterator1.next();
@@ -270,6 +293,17 @@
@@ -272,6 +295,17 @@
double d8 = d6 * d6 + d7 * d7;
if (d8 <= (double) (f * f)) {
@@ -62,7 +62,7 @@
this.victims.put(entityliving, this.tickCount + this.reapplicationDelay);
Iterator iterator2 = list.iterator();
@@ -279,7 +313,7 @@
@@ -281,7 +315,7 @@
if (mobeffect1.getEffect().isInstantenous()) {
mobeffect1.getEffect().applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect1.getAmplifier(), 0.5D);
} else {

View File

@@ -17,7 +17,7 @@
+import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
+// CraftBukkit end
+
public abstract class EntityInsentient extends EntityLiving {
public abstract class EntityInsentient extends EntityLiving implements Targeting {
private static final DataWatcherObject<Byte> DATA_MOB_FLAGS_ID = DataWatcher.defineId(EntityInsentient.class, DataWatcherRegistry.BYTE);
@@ -121,6 +134,8 @@
@@ -42,7 +42,7 @@
protected void registerGoals() {}
public static AttributeProvider.Builder createMobAttributes() {
@@ -224,7 +245,38 @@
@@ -254,7 +275,38 @@
}
public void setTarget(@Nullable EntityLiving entityliving) {
@@ -81,7 +81,7 @@
}
@Override
@@ -364,6 +416,12 @@
@@ -394,6 +446,12 @@
return null;
}
@@ -94,7 +94,7 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@@ -453,16 +511,26 @@
@@ -483,16 +541,26 @@
nbttagcompound.putBoolean("NoAI", this.isNoAi());
}
@@ -123,7 +123,7 @@
NBTTagList nbttaglist;
int i;
@@ -509,6 +577,11 @@
@@ -539,6 +607,11 @@
}
this.setNoAi(nbttagcompound.getBoolean("NoAI"));
@@ -135,7 +135,7 @@
}
@Override
@@ -576,7 +649,7 @@
@@ -606,7 +679,7 @@
protected void pickUpItem(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItem();
@@ -144,7 +144,7 @@
if (!itemstack1.isEmpty()) {
this.onItemPickup(entityitem);
@@ -590,15 +663,29 @@
@@ -620,6 +693,12 @@
}
public ItemStack equipItemIfPossible(ItemStack itemstack) {
@@ -154,9 +154,12 @@
+
+ public ItemStack equipItemIfPossible(ItemStack itemstack, EntityItem entityitem) {
+ // CraftBukkit end
EnumItemSlot enumitemslot = this.getEquipmentSlotForItemStack(itemstack);
EnumItemSlot enumitemslot = getEquipmentSlotForItem(itemstack);
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
boolean flag = this.canReplaceCurrentItem(itemstack, itemstack1);
@@ -630,11 +709,19 @@
flag = this.canReplaceCurrentItem(itemstack, itemstack1);
}
- if (flag && this.canHoldItem(itemstack)) {
+ // CraftBukkit start
@@ -175,7 +178,7 @@
}
if (enumitemslot.isArmor() && itemstack.getCount() > 1) {
@@ -750,6 +837,7 @@
@@ -779,6 +866,7 @@
@Override
protected final void serverAiStep() {
++this.noActionTime;
@@ -183,7 +186,7 @@
this.level.getProfiler().push("sensing");
this.sensing.tick();
this.level.getProfiler().pop();
@@ -1143,6 +1231,12 @@
@@ -1172,6 +1260,12 @@
if (!this.isAlive()) {
return EnumInteractionResult.PASS;
} else if (this.getLeashHolder() == entityhuman) {
@@ -194,9 +197,9 @@
+ }
+ // CraftBukkit end
this.dropLeash(true, !entityhuman.getAbilities().instabuild);
this.gameEvent(GameEvent.ENTITY_INTERACT, entityhuman);
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
} else {
@@ -1166,6 +1260,12 @@
@@ -1197,6 +1291,12 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.LEAD) && this.canBeLeashed(entityhuman)) {
@@ -209,7 +212,7 @@
this.setLeashedTo(entityhuman, true);
itemstack.shrink(1);
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
@@ -1181,7 +1281,7 @@
@@ -1212,7 +1312,7 @@
if (itemstack.getItem() instanceof ItemMonsterEgg) {
if (this.level instanceof WorldServer) {
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
@@ -218,7 +221,7 @@
optional.ifPresent((entityinsentient) -> {
this.onOffspringSpawnedFromEgg(entityhuman, entityinsentient);
@@ -1231,12 +1331,19 @@
@@ -1262,12 +1362,19 @@
return this.restrictRadius != -1.0F;
}
@@ -239,7 +242,7 @@
if (t0 == null) {
return null;
@@ -1271,7 +1378,12 @@
@@ -1302,7 +1409,12 @@
}
}
@@ -253,7 +256,7 @@
if (this.isPassenger()) {
Entity entity = this.getVehicle();
@@ -1292,6 +1404,7 @@
@@ -1323,6 +1435,7 @@
if (this.leashHolder != null) {
if (!this.isAlive() || !this.leashHolder.isAlive()) {
@@ -261,7 +264,7 @@
this.dropLeash(true, true);
}
@@ -1303,7 +1416,9 @@
@@ -1334,7 +1447,9 @@
this.leashHolder = null;
this.leashInfoTag = null;
if (!this.level.isClientSide && flag1) {
@@ -271,7 +274,7 @@
}
if (!this.level.isClientSide && flag && this.level instanceof WorldServer) {
@@ -1353,6 +1468,7 @@
@@ -1384,6 +1499,7 @@
boolean flag1 = super.startRiding(entity, flag);
if (flag1 && this.isLeashed()) {
@@ -279,7 +282,7 @@
this.dropLeash(true, true);
}
@@ -1377,7 +1493,9 @@
@@ -1408,7 +1524,9 @@
}
if (this.tickCount > 100) {
@@ -289,7 +292,7 @@
this.leashInfoTag = null;
}
}
@@ -1458,7 +1576,14 @@
@@ -1484,7 +1602,14 @@
int i = EnchantmentManager.getFireAspect(this);
if (i > 0) {
@@ -304,8 +307,8 @@
+ // CraftBukkit end
}
boolean flag = entity.hurt(DamageSource.mobAttack(this), f);
@@ -1532,9 +1657,10 @@
boolean flag = entity.hurt(this.damageSources().mobAttack(this), f);
@@ -1558,9 +1683,10 @@
@Override
protected void removeAfterChangingDimensions() {
super.removeAfterChangingDimensions();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityLiving.java
+++ b/net/minecraft/world/entity/EntityLiving.java
@@ -119,6 +119,30 @@
@@ -117,6 +117,30 @@
import net.minecraft.world.scores.ScoreboardTeam;
import org.slf4j.Logger;
@@ -28,10 +28,10 @@
+import org.bukkit.event.player.PlayerItemConsumeEvent;
+// CraftBukkit end
+
public abstract class EntityLiving extends Entity {
public abstract class EntityLiving extends Entity implements Attackable {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -229,6 +253,20 @@
@@ -224,6 +248,20 @@
private float swimAmountO;
protected BehaviorController<?> brain;
private boolean skipDropExperience;
@@ -52,7 +52,7 @@
protected EntityLiving(EntityTypes<? extends EntityLiving> entitytypes, World world) {
super(entitytypes, world);
@@ -241,7 +279,9 @@
@@ -236,7 +274,9 @@
this.useItem = ItemStack.EMPTY;
this.lastClimbablePos = Optional.empty();
this.attributes = new AttributeMapBase(AttributeDefaults.getSupplier(entitytypes));
@@ -63,7 +63,7 @@
this.blocksBuilding = true;
this.rotA = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
this.reapplyPosition();
@@ -308,7 +348,13 @@
@@ -303,7 +343,13 @@
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
int i = (int) (150.0D * d1);
@@ -78,7 +78,7 @@
}
}
@@ -660,10 +706,16 @@
@@ -655,13 +701,19 @@
}
public void onEquipItem(EnumItemSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1) {
@@ -90,13 +90,16 @@
+ // CraftBukkit end
boolean flag = itemstack1.isEmpty() && itemstack.isEmpty();
if (!flag && !ItemStack.isSame(itemstack, itemstack1) && !this.firstTick) {
- if (enumitemslot.getType() == EnumItemSlot.Function.ARMOR) {
+ if (enumitemslot.getType() == EnumItemSlot.Function.ARMOR && !silent) { // CraftBukkit
this.playEquipSound(itemstack1);
}
if (!flag && !ItemStack.isSameItemSameTags(itemstack, itemstack1) && !this.firstTick) {
Equipable equipable = Equipable.get(itemstack1);
@@ -741,6 +793,17 @@
if (equipable != null && !this.isSpectator() && equipable.getEquipmentSlot() == enumitemslot) {
- if (!this.level.isClientSide() && !this.isSilent()) {
+ if (!this.level.isClientSide() && !this.isSilent() && !silent) { // CraftBukkit
this.level.playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), equipable.getEquipSound(), this.getSoundSource(), 1.0F, 1.0F);
}
@@ -735,6 +787,17 @@
}
}
@@ -114,7 +117,7 @@
if (nbttagcompound.contains("Health", 99)) {
this.setHealth(nbttagcompound.getFloat("Health"));
}
@@ -778,9 +841,32 @@
@@ -772,9 +835,32 @@
}
@@ -147,7 +150,7 @@
try {
while (iterator.hasNext()) {
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
@@ -790,6 +876,12 @@
@@ -784,6 +870,12 @@
this.onEffectUpdated(mobeffect, true, (Entity) null);
})) {
if (!this.level.isClientSide) {
@@ -160,7 +163,7 @@
iterator.remove();
this.onEffectRemoved(mobeffect);
}
@@ -800,6 +892,17 @@
@@ -794,6 +886,17 @@
} catch (ConcurrentModificationException concurrentmodificationexception) {
;
}
@@ -178,7 +181,7 @@
if (this.effectsDirty) {
if (!this.level.isClientSide) {
@@ -926,7 +1029,13 @@
@@ -920,7 +1023,13 @@
this.entityData.set(EntityLiving.DATA_EFFECT_COLOR_ID, 0);
}
@@ -192,7 +195,7 @@
if (this.level.isClientSide) {
return false;
} else {
@@ -935,7 +1044,14 @@
@@ -929,7 +1038,14 @@
boolean flag;
for (flag = false; iterator.hasNext(); flag = true) {
@@ -208,7 +211,7 @@
iterator.remove();
}
@@ -964,18 +1080,48 @@
@@ -958,18 +1074,48 @@
return this.addEffect(mobeffect, (Entity) null);
}
@@ -258,7 +261,7 @@
return true;
} else {
return false;
@@ -1012,13 +1158,39 @@
@@ -1006,13 +1152,39 @@
return this.getMobType() == EnumMonsterType.UNDEAD;
}
@@ -299,7 +302,7 @@
if (mobeffect != null) {
this.onEffectRemoved(mobeffect);
@@ -1055,20 +1227,55 @@
@@ -1049,20 +1221,55 @@
}
@@ -356,16 +359,16 @@
this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.clamp(f, 0.0F, this.getMaxHealth()));
}
@@ -1082,7 +1289,7 @@
@@ -1076,7 +1283,7 @@
return false;
} else if (this.level.isClientSide) {
return false;
- } else if (this.isDeadOrDying()) {
+ } else if (this.isRemoved() || this.dead || this.getHealth() <= 0.0F) { // CraftBukkit - Don't allow entities that got set to dead/killed elsewhere to get damaged and die
return false;
} else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
} else if (damagesource.is(DamageTypeTags.IS_FIRE) && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
return false;
@@ -1093,10 +1300,11 @@
@@ -1087,10 +1294,11 @@
this.noActionTime = 0;
float f1 = f;
@@ -379,12 +382,12 @@
this.hurtCurrentlyUsedShield(f);
f2 = f;
f = 0.0F;
@@ -1116,27 +1324,46 @@
this.animationSpeed = 1.5F;
@@ -1114,27 +1322,46 @@
this.walkAnimation.setSpeed(1.5F);
boolean flag1 = true;
- if ((float) this.invulnerableTime > 10.0F) {
+ if ((float) this.invulnerableTime > (float) this.invulnerableDuration / 2.0F) { // CraftBukkit - restore use of maxNoDamageTicks
- if ((float) this.invulnerableTime > 10.0F && !damagesource.is(DamageTypeTags.BYPASSES_COOLDOWN)) {
+ if ((float) this.invulnerableTime > (float) this.invulnerableDuration / 2.0F && !damagesource.is(DamageTypeTags.BYPASSES_COOLDOWN)) { // CraftBukkit - restore use of maxNoDamageTicks
if (f <= this.lastHurt) {
return false;
}
@@ -412,9 +415,9 @@
this.hurtTime = this.hurtDuration;
}
- if (damagesource.isDamageHelmet() && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
- if (damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
+ // CraftBukkit - Moved into damageEntity0(DamageSource, float)
+ if (false && damagesource.isDamageHelmet() && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
+ if (false && damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
this.hurtHelmet(damagesource, f);
f *= 0.75F;
}
@@ -428,10 +431,10 @@
+ }
+ // CraftBukkit end
+
this.hurtDir = 0.0F;
Entity entity1 = damagesource.getEntity();
@@ -1259,19 +1486,32 @@
if (entity1 != null) {
@@ -1248,19 +1475,32 @@
EnumHand[] aenumhand = EnumHand.values();
int i = aenumhand.length;
@@ -468,7 +471,7 @@
EntityPlayer entityplayer = (EntityPlayer) this;
entityplayer.awardStat(StatisticList.ITEM_USED.get(Items.TOTEM_OF_UNDYING));
@@ -1279,14 +1519,16 @@
@@ -1268,14 +1508,16 @@
}
this.setHealth(1.0F);
@@ -490,7 +493,7 @@
}
}
@@ -1391,14 +1633,22 @@
@@ -1380,14 +1622,22 @@
IBlockData iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
@@ -515,7 +518,7 @@
this.level.addFreshEntity(entityitem);
}
}
@@ -1418,21 +1668,40 @@
@@ -1407,21 +1657,40 @@
boolean flag = this.lastHurtByPlayerTime > 0;
@@ -559,7 +562,7 @@
}
@@ -1517,6 +1786,28 @@
@@ -1512,6 +1781,28 @@
return itemstack.getEatingSound();
}
@@ -588,7 +591,7 @@
@Override
public void setOnGround(boolean flag) {
super.setOnGround(flag);
@@ -1572,9 +1863,14 @@
@@ -1567,9 +1858,14 @@
int i = this.calculateFallDamage(f, f1);
if (i > 0) {
@@ -604,26 +607,26 @@
return true;
} else {
return flag;
@@ -1623,7 +1919,7 @@
@@ -1621,7 +1917,7 @@
protected float getDamageAfterArmorAbsorb(DamageSource damagesource, float f) {
if (!damagesource.isBypassArmor()) {
if (!damagesource.is(DamageTypeTags.BYPASSES_ARMOR)) {
- this.hurtArmor(damagesource, f);
+ // this.damageArmor(damagesource, f); // CraftBukkit - Moved into damageEntity0(DamageSource, float)
+ // this.hurtArmor(damagesource, f); // CraftBukkit - Moved into damageEntity0(DamageSource, float)
f = CombatMath.getDamageAfterAbsorb(f, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
}
@@ -1636,7 +1932,8 @@
@@ -1634,7 +1930,8 @@
} else {
int i;
- if (this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) {
- if (this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && !damagesource.is(DamageTypeTags.BYPASSES_RESISTANCE)) {
+ // CraftBukkit - Moved to damageEntity0(DamageSource, float)
+ if (false && this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) {
+ if (false && this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && !damagesource.is(DamageTypeTags.BYPASSES_RESISTANCE)) {
i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
@@ -1669,29 +1966,172 @@
@@ -1667,16 +1964,125 @@
}
}
@@ -640,7 +643,7 @@
+ Function<Double, Double> hardHat = new Function<Double, Double>() {
+ @Override
+ public Double apply(Double f) {
+ if (damagesource.isDamageHelmet() && !EntityLiving.this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
+ if (damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !EntityLiving.this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
+ return -(f - (f * 0.75F));
+
+ }
@@ -671,7 +674,7 @@
+ Function<Double, Double> resistance = new Function<Double, Double>() {
+ @Override
+ public Double apply(Double f) {
+ if (!damagesource.isBypassMagic() && EntityLiving.this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) {
+ if (!damagesource.is(DamageTypeTags.BYPASSES_EFFECTS) && EntityLiving.this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && !damagesource.is(DamageTypeTags.BYPASSES_RESISTANCE)) {
+ int i = (EntityLiving.this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
+ int j = 25 - i;
+ float f1 = f.floatValue() * (float) j;
@@ -723,12 +726,12 @@
+ }
+
+ // Apply damage to helmet
+ if (damagesource.isDamageHelmet() && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
+ if (damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
+ this.hurtHelmet(damagesource, f);
+ }
+
+ // Apply damage to armor
+ if (!damagesource.isBypassArmor()) {
+ if (!damagesource.is(DamageTypeTags.BYPASSES_ARMOR)) {
+ float armorDamage = (float) (event.getDamage() + event.getDamage(DamageModifier.BLOCKING) + event.getDamage(DamageModifier.HARD_HAT));
+ this.hurtArmor(damagesource, armorDamage);
+ }
@@ -754,8 +757,11 @@
+ if (f2 > 0.0F && f2 < 3.4028235E37F && this instanceof EntityHuman) {
+ ((EntityHuman) this).awardStat(StatisticList.DAMAGE_ABSORBED, Math.round(f2 * 10.0F));
+ }
if (f2 > 0.0F && f2 < 3.4028235E37F && damagesource.getEntity() instanceof EntityPlayer) {
((EntityPlayer) damagesource.getEntity()).awardStat(StatisticList.DAMAGE_DEALT_ABSORBED, Math.round(f2 * 10.0F));
if (f2 > 0.0F && f2 < 3.4028235E37F) {
Entity entity = damagesource.getEntity();
@@ -1687,15 +2093,49 @@
}
}
- if (f != 0.0F) {
@@ -770,8 +776,8 @@
+ // CraftBukkit end
float f3 = this.getHealth();
this.setHealth(f3 - f);
this.getCombatTracker().recordDamage(damagesource, f3, f);
this.setHealth(f3 - f);
- this.setAbsorptionAmount(this.getAbsorptionAmount() - f);
+ // CraftBukkit start
+ if (!human) {
@@ -806,7 +812,7 @@
}
public CombatTracker getCombatTracker() {
@@ -1712,9 +2152,19 @@
@@ -1716,9 +2156,19 @@
}
public final void setArrowCount(int i) {
@@ -827,7 +833,7 @@
public final int getStingerCount() {
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
}
@@ -2017,6 +2467,12 @@
@@ -1959,6 +2409,12 @@
public abstract ItemStack getItemBySlot(EnumItemSlot enumitemslot);
@@ -840,7 +846,7 @@
@Override
public abstract void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
@@ -2256,6 +2712,7 @@
@@ -2198,6 +2654,7 @@
}
if (this.onGround && !this.level.isClientSide) {
@@ -848,7 +854,7 @@
this.setSharedFlag(7, false);
}
} else {
@@ -2793,6 +3250,7 @@
@@ -2757,6 +3214,7 @@
}
if (!this.level.isClientSide) {
@@ -856,7 +862,7 @@
this.setSharedFlag(7, flag);
}
@@ -2956,14 +3414,21 @@
@@ -2916,14 +3374,21 @@
@Override
public boolean isPickable() {
@@ -880,7 +886,7 @@
@Override
public float getYHeadRot() {
return this.yHeadRot;
@@ -3158,7 +3623,26 @@
@@ -3118,7 +3583,26 @@
} else {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
this.triggerItemUseEffects(this.useItem, 16);
@@ -908,7 +914,7 @@
if (itemstack != this.useItem) {
this.setItemInHand(enumhand, itemstack);
@@ -3236,6 +3720,12 @@
@@ -3196,6 +3680,12 @@
}
public boolean randomTeleport(double d0, double d1, double d2, boolean flag) {
@@ -921,7 +927,7 @@
double d3 = this.getX();
double d4 = this.getY();
double d5 = this.getZ();
@@ -3260,16 +3750,41 @@
@@ -3220,16 +3710,41 @@
}
if (flag2) {
@@ -949,7 +955,7 @@
+ }
+ } else {
+ // player teleport event is called in the underlining code
+ if (((EntityPlayer) this).connection.teleport(d0, d6, d2, this.getYRot(), this.getXRot(), java.util.Collections.emptySet(), false, cause)) {
+ if (((EntityPlayer) this).connection.teleport(d0, d6, d2, this.getYRot(), this.getXRot(), java.util.Collections.emptySet(), cause)) {
+ return Optional.empty();
+ }
+ }
@@ -966,7 +972,7 @@
} else {
if (flag) {
world.broadcastEntityEvent(this, (byte) 46);
@@ -3279,7 +3794,7 @@
@@ -3239,7 +3754,7 @@
((EntityCreature) this).getNavigation().stop();
}
@@ -975,7 +981,7 @@
}
}
@@ -3357,7 +3872,7 @@
@@ -3322,7 +3837,7 @@
}
public void stopSleeping() {
@@ -984,7 +990,7 @@
World world = this.level;
java.util.Objects.requireNonNull(this.level);
@@ -3391,7 +3906,7 @@
@@ -3356,7 +3871,7 @@
@Nullable
public EnumDirection getBedOrientation() {
@@ -993,7 +999,7 @@
return blockposition != null ? BlockBed.getBedOrientation(this.level, blockposition) : null;
}
@@ -3439,7 +3954,7 @@
@@ -3404,7 +3919,7 @@
Pair<MobEffect, Float> pair = (Pair) iterator.next();
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityTypes.java
+++ b/net/minecraft/world/entity/EntityTypes.java
@@ -156,6 +156,7 @@
@@ -157,6 +157,7 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -8,16 +8,16 @@
import org.slf4j.Logger;
public class EntityTypes<T extends Entity> implements FeatureElement, EntityTypeTest<Entity, T> {
@@ -165,7 +166,7 @@
private final Holder.c<EntityTypes<?>> builtInRegistryHolder;
@@ -167,7 +168,7 @@
private static final float MAGIC_HORSE_WIDTH = 1.3964844F;
private static final int DISPLAY_TRACKING_RANGE = 10;
public static final EntityTypes<Allay> ALLAY = register("allay", EntityTypes.Builder.of(Allay::new, EnumCreatureType.CREATURE).sized(0.35F, 0.6F).clientTrackingRange(8).updateInterval(2));
- public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = register("area_effect_cloud", EntityTypes.Builder.of(EntityAreaEffectCloud::new, EnumCreatureType.MISC).fireImmune().sized(6.0F, 0.5F).clientTrackingRange(10).updateInterval(Integer.MAX_VALUE));
+ public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = register("area_effect_cloud", EntityTypes.Builder.of(EntityAreaEffectCloud::new, EnumCreatureType.MISC).fireImmune().sized(6.0F, 0.5F).clientTrackingRange(10).updateInterval(10)); // CraftBukkit - SPIGOT-3729: track area effect clouds
public static final EntityTypes<EntityArmorStand> ARMOR_STAND = register("armor_stand", EntityTypes.Builder.of(EntityArmorStand::new, EnumCreatureType.MISC).sized(0.5F, 1.975F).clientTrackingRange(10));
public static final EntityTypes<EntityTippedArrow> ARROW = register("arrow", EntityTypes.Builder.of(EntityTippedArrow::new, EnumCreatureType.MISC).sized(0.5F, 0.5F).clientTrackingRange(4).updateInterval(20));
public static final EntityTypes<Axolotl> AXOLOTL = register("axolotl", EntityTypes.Builder.of(Axolotl::new, EnumCreatureType.AXOLOTLS).sized(0.75F, 0.42F).clientTrackingRange(10));
@@ -301,8 +302,8 @@
@@ -308,8 +309,8 @@
private final EntitySize dimensions;
private final FeatureFlagSet requiredFeatures;
@@ -28,7 +28,7 @@
}
public static MinecraftKey getKey(EntityTypes<?> entitytypes) {
@@ -330,8 +331,15 @@
@@ -337,8 +338,15 @@
@Nullable
public T spawn(WorldServer worldserver, @Nullable ItemStack itemstack, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
@@ -45,7 +45,7 @@
if (itemstack != null) {
nbttagcompound = itemstack.getTag();
@@ -342,7 +350,7 @@
@@ -349,7 +357,7 @@
nbttagcompound = null;
}
@@ -54,7 +54,7 @@
}
public static <T extends Entity> Consumer<T> createDefaultStackConfig(WorldServer worldserver, ItemStack itemstack, @Nullable EntityHuman entityhuman) {
@@ -363,21 +371,37 @@
@@ -371,21 +379,37 @@
NBTTagCompound nbttagcompound = itemstack.getTag();
return nbttagcompound != null ? consumer.andThen((entity) -> {
@@ -95,7 +95,7 @@
}
return t0;
@@ -564,7 +588,7 @@
@@ -572,7 +596,7 @@
}
return entity;
@@ -104,7 +104,7 @@
}
public static Stream<Entity> loadEntitiesRecursive(final List<? extends NBTBase> list, final World world) {
@@ -621,7 +645,7 @@
@@ -629,7 +653,7 @@
@Nullable
public T tryCast(Entity entity) {
@@ -113,7 +113,7 @@
}
@Override
@@ -656,7 +680,7 @@
@@ -664,7 +688,7 @@
this.canSpawnFarFromPlayer = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC;
}

View File

@@ -1,15 +1,14 @@
--- a/net/minecraft/world/entity/SaddleStorage.java
+++ b/net/minecraft/world/entity/SaddleStorage.java
@@ -40,6 +40,15 @@
}
@@ -53,6 +53,14 @@
return (Integer) this.entityData.get(this.boostTimeAccessor);
}
+ // CraftBukkit add setBoostTicks(int)
+ public void setBoostTicks(int ticks) {
+ this.boosting = true;
+ this.boostTime = 0;
+ this.boostTimeTotal = ticks;
+ this.entityData.set(this.boostTimeAccessor, this.boostTimeTotal);
+ this.entityData.set(this.boostTimeAccessor, ticks);
+ }
+ // CraftBukkit end
+

View File

@@ -1,20 +0,0 @@
--- a/net/minecraft/world/entity/ai/behavior/BehaviorWorkComposter.java
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorWorkComposter.java
@@ -42,7 +42,7 @@
BlockPosition blockposition = globalpos.pos();
if ((Integer) iblockdata.getValue(BlockComposter.LEVEL) == 8) {
- iblockdata = BlockComposter.extractProduce(iblockdata, worldserver, blockposition);
+ iblockdata = BlockComposter.extractProduce(iblockdata, worldserver, blockposition, entityvillager); // CraftBukkit
}
int i = 20;
@@ -67,7 +67,7 @@
i -= k1;
for (int l1 = 0; l1 < k1; ++l1) {
- iblockdata1 = BlockComposter.insertItem(iblockdata1, worldserver, itemstack, blockposition);
+ iblockdata1 = BlockComposter.insertItem(iblockdata1, worldserver, itemstack, blockposition, entityvillager); // CraftBukkit
if ((Integer) iblockdata1.getValue(BlockComposter.LEVEL) == 7) {
this.spawnComposterFillEffects(worldserver, iblockdata, blockposition, iblockdata1);
return;

View File

@@ -13,7 +13,7 @@
public class PathfinderGoalFollowOwner extends PathfinderGoal {
public static final int TELEPORT_WHEN_DISTANCE_IS = 12;
@@ -120,7 +126,18 @@
@@ -122,7 +128,18 @@
} else if (!this.canTeleportTo(new BlockPosition(i, j, k))) {
return false;
} else {

View File

@@ -12,7 +12,7 @@
public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget {
private final Block blockToRemove;
@@ -100,6 +105,14 @@
@@ -96,6 +101,14 @@
}
if (this.ticksSinceReachedGoal > 60) {

View File

@@ -52,7 +52,7 @@
}
}
@@ -203,7 +217,11 @@
@@ -198,7 +212,11 @@
return false;
} else {
if (!this.level.isClientSide && this.isResting()) {

View File

@@ -9,7 +9,7 @@
}
}
@@ -646,11 +646,15 @@
@@ -641,11 +641,15 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {
@@ -27,7 +27,7 @@
}
}
@@ -1226,7 +1230,7 @@
@@ -1221,7 +1225,7 @@
}
}
@@ -36,7 +36,7 @@
EntityBee.this.level.levelEvent(2005, blockposition, 0);
EntityBee.this.level.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.setValue(blockstateinteger, (Integer) iblockdata.getValue(blockstateinteger) + 1));
EntityBee.this.incrementNumCropsGrownSincePollination();
@@ -1299,7 +1303,7 @@
@@ -1294,7 +1298,7 @@
@Override
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
if (entityinsentient instanceof EntityBee && this.mob.hasLineOfSight(entityliving)) {
@@ -45,7 +45,7 @@
}
}
@@ -1308,7 +1312,7 @@
@@ -1303,7 +1307,7 @@
private static class c extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
c(EntityBee entitybee) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityCat.java
+++ b/net/minecraft/world/entity/animal/EntityCat.java
@@ -415,7 +415,7 @@
@@ -412,7 +412,7 @@
}
} else if (this.isFood(itemstack)) {
this.usePlayerItem(entityhuman, enumhand, itemstack);
@@ -9,7 +9,7 @@
this.tame(entityhuman);
this.setOrderedToSit(true);
this.level.broadcastEntityEvent(this, (byte) 7);
@@ -472,7 +472,7 @@
@@ -469,7 +469,7 @@
private static class PathfinderGoalTemptChance extends PathfinderGoalTempt {
@Nullable
@@ -18,7 +18,7 @@
private final EntityCat cat;
public PathfinderGoalTemptChance(EntityCat entitycat, double d0, RecipeItemStack recipeitemstack, boolean flag) {
@@ -613,7 +613,15 @@
@@ -610,7 +610,15 @@
while (iterator.hasNext()) {
ItemStack itemstack = (ItemStack) iterator.next();
@@ -35,7 +35,7 @@
}
}
@@ -645,10 +653,10 @@
@@ -642,10 +650,10 @@
private final EntityCat cat;
public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityFox.java
+++ b/net/minecraft/world/entity/animal/EntityFox.java
@@ -516,7 +516,8 @@
@@ -517,7 +517,8 @@
protected void pickUpItem(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItem();
@@ -10,7 +10,7 @@
int i = itemstack.getCount();
if (i > 1) {
@@ -871,6 +872,16 @@
@@ -872,6 +873,16 @@
if (entityplayer1 != null && entityplayer != entityplayer1) {
entityfox.addTrustedUUID(entityplayer1.getUUID());
}
@@ -27,7 +27,7 @@
if (entityplayer2 != null) {
entityplayer2.awardStat(StatisticList.ANIMALS_BRED);
@@ -881,12 +892,14 @@
@@ -882,12 +893,14 @@
this.partner.setAge(6000);
this.animal.resetLove();
this.partner.resetLove();
@@ -46,15 +46,7 @@
}
}
@@ -1277,13 +1290,18 @@
}
private void pickGlowBerry(IBlockData iblockdata) {
- CaveVines.use(iblockdata, EntityFox.this.level, this.blockPos);
+ CaveVines.use(iblockdata, EntityFox.this.level, this.blockPos, EntityFox.this); // CraftBukkit
}
private void pickSweetBerries(IBlockData iblockdata) {
@@ -1285,6 +1298,11 @@
int i = (Integer) iblockdata.getValue(BlockSweetBerryBush.AGE);
iblockdata.setValue(BlockSweetBerryBush.AGE, 1);
@@ -66,7 +58,7 @@
int j = 1 + EntityFox.this.level.random.nextInt(2) + (i == 3 ? 1 : 0);
ItemStack itemstack = EntityFox.this.getItemBySlot(EnumItemSlot.MAINHAND);
@@ -1440,7 +1458,7 @@
@@ -1441,7 +1459,7 @@
private EntityLiving trustedLastHurt;
private int timestamp;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityOcelot.java
+++ b/net/minecraft/world/entity/animal/EntityOcelot.java
@@ -182,7 +182,8 @@
@@ -177,7 +177,8 @@
if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemstack) && entityhuman.distanceToSqr((Entity) this) < 9.0D) {
this.usePlayerItem(entityhuman, enumhand, itemstack);
if (!this.level.isClientSide) {
@@ -10,7 +10,7 @@
this.setTrusting(true);
this.spawnTrustingParticles(true);
this.level.broadcastEntityEvent(this, (byte) 41);
@@ -313,10 +314,10 @@
@@ -308,10 +309,10 @@
private final EntityOcelot ocelot;
public a(EntityOcelot entityocelot, Class<T> oclass, float f, double d0, double d1) {

View File

@@ -16,9 +16,9 @@
- this.addEffect(new MobEffect(MobEffects.POISON, 900));
+ this.addEffect(new MobEffect(MobEffects.POISON, 900), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // CraftBukkit
if (entityhuman.isCreative() || !this.isInvulnerable()) {
this.hurt(DamageSource.playerAttack(entityhuman), Float.MAX_VALUE);
this.hurt(this.damageSources().playerAttack(entityhuman), Float.MAX_VALUE);
}
@@ -387,7 +387,7 @@
@@ -382,7 +382,7 @@
@Override
public boolean isPushable() {
@@ -27,7 +27,7 @@
}
@Override
@@ -403,7 +403,7 @@
@@ -398,7 +398,7 @@
return false;
} else {
if (!this.level.isClientSide) {

View File

@@ -3,7 +3,7 @@
@@ -144,7 +144,7 @@
int i = this.getPuffState();
if (entityinsentient.hurt(DamageSource.mobAttack(this), (float) (1 + i))) {
if (entityinsentient.hurt(this.damageSources().mobAttack(this), (float) (1 + i))) {
- entityinsentient.addEffect(new MobEffect(MobEffects.POISON, 60 * i, 0), this);
+ entityinsentient.addEffect(new MobEffect(MobEffects.POISON, 60 * i, 0), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
this.playSound(SoundEffects.PUFFER_FISH_STING, 1.0F, 1.0F);

View File

@@ -56,7 +56,7 @@
InventoryCrafting inventorycrafting = makeContainer(enumcolor, enumcolor1);
- Optional optional = this.level.getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level).map((recipecrafting) -> {
+ Optional<Item> optional = this.level.getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level).map((recipecrafting) -> { // CraftBukkit - decompile error
return recipecrafting.assemble(inventorycrafting);
return recipecrafting.assemble(inventorycrafting, this.level.registryAccess());
}).map(ItemStack::getItem);
@@ -399,10 +420,18 @@

View File

@@ -11,29 +11,29 @@
public class EntitySnowman extends EntityGolem implements IShearable, IRangedEntity {
private static final DataWatcherObject<Byte> DATA_PUMPKIN_ID = DataWatcher.defineId(EntitySnowman.class, DataWatcherRegistry.BYTE);
@@ -103,7 +107,7 @@
BiomeBase biomebase = (BiomeBase) this.level.getBiome(blockposition).value();
if (biomebase.shouldSnowGolemBurn(blockposition)) {
- this.hurt(DamageSource.ON_FIRE, 1.0F);
+ this.hurt(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
@@ -97,7 +101,7 @@
super.aiStep();
if (!this.level.isClientSide) {
if (this.level.getBiome(this.blockPosition()).is(BiomeTags.SNOW_GOLEM_MELTS)) {
- this.hurt(this.damageSources().onFire(), 1.0F);
+ this.hurt(this.damageSources().melting, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
}
if (!this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
@@ -119,7 +123,11 @@
BlockPosition blockposition1 = new BlockPosition(i, j, k);
@@ -113,7 +117,11 @@
BlockPosition blockposition = new BlockPosition(j, k, l);
if (this.level.getBlockState(blockposition1).isAir() && iblockdata.canSurvive(this.level, blockposition1)) {
- this.level.setBlockAndUpdate(blockposition1, iblockdata);
if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
- this.level.setBlockAndUpdate(blockposition, iblockdata);
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.level, blockposition1, iblockdata, this)) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.level, blockposition, iblockdata, this)) {
+ continue;
+ }
+ // CraftBukkit end
this.level.gameEvent(GameEvent.BLOCK_PLACE, blockposition1, GameEvent.a.of(this, iblockdata));
this.level.gameEvent(GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(this, iblockdata));
}
}
@@ -151,6 +159,11 @@
@@ -145,6 +153,11 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
@@ -45,7 +45,7 @@
this.shear(SoundCategory.PLAYERS);
this.gameEvent(GameEvent.SHEAR, entityhuman);
if (!this.level.isClientSide) {
@@ -170,7 +183,9 @@
@@ -164,7 +177,9 @@
this.level.playSound((EntityHuman) null, (Entity) this, SoundEffects.SNOW_GOLEM_SHEAR, soundcategory, 1.0F, 1.0F);
if (!this.level.isClientSide()) {
this.setPumpkin(false);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityTurtle.java
+++ b/net/minecraft/world/entity/animal/EntityTurtle.java
@@ -307,7 +307,9 @@
@@ -308,7 +308,9 @@
protected void ageBoundaryReached() {
super.ageBoundaryReached();
if (!this.isBaby() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
@@ -10,24 +10,28 @@
}
}
@@ -334,7 +336,9 @@
@@ -335,7 +337,9 @@
@Override
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = entitylightning; // CraftBukkit
this.hurt(DamageSource.LIGHTNING_BOLT, Float.MAX_VALUE);
this.hurt(this.damageSources().lightningBolt(), Float.MAX_VALUE);
+ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = null; // CraftBukkit
}
private static class e extends ControllerMove {
@@ -482,8 +486,12 @@
@@ -487,12 +491,16 @@
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
World world = this.turtle.level;
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), (IBlockData) Blocks.TURTLE_EGG.defaultBlockState().setValue(BlockTurtleEgg.EGGS, this.turtle.random.nextInt(4) + 1)).isCancelled()) {
world.playSound((EntityHuman) null, blockposition, SoundEffects.TURTLE_LAY_EGG, SoundCategory.BLOCKS, 0.3F, 0.9F + world.random.nextFloat() * 0.2F);
world.setBlock(this.blockPos.above(), (IBlockData) Blocks.TURTLE_EGG.defaultBlockState().setValue(BlockTurtleEgg.EGGS, this.turtle.random.nextInt(4) + 1), 3);
BlockPosition blockposition1 = this.blockPos.above();
IBlockData iblockdata = (IBlockData) Blocks.TURTLE_EGG.defaultBlockState().setValue(BlockTurtleEgg.EGGS, this.turtle.random.nextInt(4) + 1);
world.setBlock(blockposition1, iblockdata, 3);
world.gameEvent(GameEvent.BLOCK_PLACE, blockposition1, GameEvent.a.of(this.turtle, iblockdata));
+ }
+ // CraftBukkit end
this.turtle.setHasEgg(false);

View File

@@ -39,7 +39,7 @@
}
public static AttributeProvider.Builder createAttributes() {
@@ -236,7 +243,7 @@
@@ -231,7 +238,7 @@
public void aiStep() {
super.aiStep();
if (!this.level.isClientSide && this.isAlive() && this.tickCount % 10 == 0) {
@@ -48,7 +48,7 @@
}
if (this.isDancing() && this.shouldStopDancing() && this.tickCount % 20 == 0) {
@@ -306,7 +313,12 @@
@@ -301,7 +308,12 @@
ItemStack itemstack1 = this.getItemInHand(EnumHand.MAIN_HAND);
if (this.isDancing() && this.isDuplicationItem(itemstack) && this.canDuplicate()) {
@@ -62,7 +62,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);
@@ -318,7 +330,7 @@
@@ -313,7 +325,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);
@@ -71,7 +71,7 @@
return EnumInteractionResult.SUCCESS;
} else if (!itemstack1.isEmpty() && enumhand == EnumHand.MAIN_HAND && itemstack.isEmpty()) {
this.setItemSlot(EnumItemSlot.MAINHAND, ItemStack.EMPTY);
@@ -439,6 +451,7 @@
@@ -434,6 +446,7 @@
}
private boolean shouldStopDancing() {
@@ -79,7 +79,7 @@
return this.jukeboxPos == null || !this.jukeboxPos.closerToCenterThan(this.position(), (double) GameEvent.JUKEBOX_PLAY.getNotificationRadius()) || !this.level.getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
}
@@ -483,7 +496,7 @@
@@ -478,7 +491,7 @@
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
this.writeInventoryToTag(nbttagcompound);
@@ -88,7 +88,7 @@
Logger logger = Allay.LOGGER;
Objects.requireNonNull(logger);
@@ -499,7 +512,7 @@
@@ -494,7 +507,7 @@
super.readAdditionalSaveData(nbttagcompound);
this.readInventoryFromTag(nbttagcompound);
if (nbttagcompound.contains("listener", 10)) {
@@ -97,7 +97,7 @@
Logger logger = Allay.LOGGER;
Objects.requireNonNull(logger);
@@ -532,7 +545,7 @@
@@ -527,7 +540,7 @@
return Allay.DUPLICATION_ITEM.test(itemstack);
}
@@ -106,7 +106,7 @@
Allay allay = (Allay) EntityTypes.ALLAY.create(this.level);
if (allay != null) {
@@ -540,17 +553,17 @@
@@ -535,17 +548,17 @@
allay.setPersistenceRequired();
allay.resetDuplicationCooldown();
this.resetDuplicationCooldown();

View File

@@ -27,16 +27,16 @@
}
@Override
@@ -418,7 +425,7 @@
@@ -419,7 +426,7 @@
int i = mobeffect != null ? mobeffect.getDuration() : 0;
int j = Math.min(2400, 100 + i);
if (i < 2400) {
i = Math.min(2400, 100 + i);
- entityhuman.addEffect(new MobEffect(MobEffects.REGENERATION, i, 0), this);
+ entityhuman.addEffect(new MobEffect(MobEffects.REGENERATION, i, 0), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AXOLOTL); // CraftBukkit
- entityhuman.addEffect(new MobEffect(MobEffects.REGENERATION, j, 0), this);
+ entityhuman.addEffect(new MobEffect(MobEffects.REGENERATION, j, 0), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AXOLOTL); // CraftBukkit
}
entityhuman.removeEffect(MobEffects.DIG_SLOWDOWN);
@@ -468,7 +475,7 @@
@@ -469,7 +476,7 @@
@Override
public BehaviorController<Axolotl> getBrain() {

View File

@@ -1,23 +1,23 @@
--- a/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
+++ b/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
@@ -74,6 +74,8 @@
import net.minecraft.world.phys.AxisAlignedBB;
@@ -78,6 +78,8 @@
import net.minecraft.world.phys.Vec2F;
import net.minecraft.world.phys.Vec3D;
+import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; // CraftBukkit
+
public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, HasCustomInventoryScreen, IJumpable, ISaddleable {
public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, HasCustomInventoryScreen, OwnableEntity, IJumpable, ISaddleable {
public static final int EQUIPMENT_SLOT_OFFSET = 400;
@@ -113,6 +115,7 @@
private float mouthAnimO;
protected boolean canGallop = true;
@@ -139,6 +141,7 @@
protected int gallopSoundCounter;
@Nullable
private UUID owner;
+ public int maxDomestication = 100; // CraftBukkit - store max domestication value
protected EntityHorseAbstract(EntityTypes<? extends EntityHorseAbstract> entitytypes, World world) {
super(entitytypes, world);
@@ -312,7 +315,7 @@
@@ -338,7 +341,7 @@
public void createInventory() {
InventorySubcontainer inventorysubcontainer = this.inventory;
@@ -26,7 +26,7 @@
if (inventorysubcontainer != null) {
inventorysubcontainer.removeListener(this);
int i = Math.min(inventorysubcontainer.getContainerSize(), this.inventory.getContainerSize());
@@ -416,7 +419,7 @@
@@ -442,7 +445,7 @@
}
public int getMaxTemper() {
@@ -35,7 +35,7 @@
}
@Override
@@ -487,7 +490,7 @@
@@ -513,7 +516,7 @@
}
if (this.getHealth() < this.getMaxHealth() && f > 0.0F) {
@@ -44,7 +44,7 @@
flag = true;
}
@@ -564,7 +567,7 @@
@@ -590,7 +593,7 @@
super.aiStep();
if (!this.level.isClientSide && this.isAlive()) {
if (this.random.nextInt(900) == 0 && this.deathTime == 0) {
@@ -53,7 +53,7 @@
}
if (this.canEatGrass()) {
@@ -838,6 +841,7 @@
@@ -857,6 +860,7 @@
if (this.getOwnerUUID() != null) {
nbttagcompound.putUUID("Owner", this.getOwnerUUID());
}
@@ -61,7 +61,7 @@
if (!this.inventory.getItem(0).isEmpty()) {
nbttagcompound.put("SaddleItem", this.inventory.getItem(0).save(new NBTTagCompound()));
@@ -865,6 +869,11 @@
@@ -884,6 +888,11 @@
if (uuid != null) {
this.setOwnerUUID(uuid);
}
@@ -73,7 +73,7 @@
if (nbttagcompound.contains("SaddleItem", 10)) {
ItemStack itemstack = ItemStack.of(nbttagcompound.getCompound("SaddleItem"));
@@ -942,6 +951,18 @@
@@ -986,6 +995,18 @@
@Override
public void handleStartJump(int i) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java
@@ -19,6 +19,11 @@
@@ -20,6 +20,11 @@
import net.minecraft.world.level.block.BlockFireAbstract;
import net.minecraft.world.level.dimension.end.EnderDragonBattle;
@@ -12,7 +12,7 @@
public class EntityEnderCrystal extends Entity {
private static final DataWatcherObject<Optional<BlockPosition>> DATA_BEAM_TARGET = DataWatcher.defineId(EntityEnderCrystal.class, DataWatcherRegistry.OPTIONAL_BLOCK_POS);
@@ -54,7 +59,11 @@
@@ -55,7 +60,11 @@
BlockPosition blockposition = this.blockPosition();
if (((WorldServer) this.level).dragonFight() != null && this.level.getBlockState(blockposition).isAir()) {
@@ -25,7 +25,7 @@
}
}
@@ -94,11 +103,24 @@
@@ -95,11 +104,24 @@
return false;
} else {
if (!this.isRemoved() && !this.level.isClientSide) {
@@ -35,8 +35,8 @@
+ }
+ // CraftBukkit end
this.remove(Entity.RemovalReason.KILLED);
if (!damagesource.isExplosion()) {
DamageSource damagesource1 = damagesource.getEntity() != null ? DamageSource.explosion(this, damagesource.getEntity()) : null;
if (!damagesource.is(DamageTypeTags.IS_EXPLOSION)) {
DamageSource damagesource1 = damagesource.getEntity() != null ? this.damageSources().explosion(this, damagesource.getEntity()) : null;
- this.level.explode(this, damagesource1, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), 6.0F, false, World.a.BLOCK);
+ // CraftBukkit start

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
@@ -50,6 +50,18 @@
@@ -51,6 +51,18 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
@@ -19,15 +19,23 @@
public class EntityEnderDragon extends EntityInsentient implements IMonster {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -86,6 +98,7 @@
@@ -87,6 +99,7 @@
private final PathPoint[] nodes = new PathPoint[24];
private final int[] nodeAdjacency = new int[24];
private final Path openSet = new Path();
+ private Explosion explosionSource = new Explosion(null, this, null, null, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, Explosion.Effect.DESTROY); // CraftBukkit - reusable source for CraftTNTPrimed.getSource()
+ private final Explosion explosionSource; // CraftBukkit - reusable source for CraftTNTPrimed.getSource()
public EntityEnderDragon(EntityTypes<? extends EntityEnderDragon> entitytypes, World world) {
super(EntityTypes.ENDER_DRAGON, world);
@@ -233,7 +246,7 @@
@@ -101,6 +114,7 @@
}
this.phaseManager = new DragonControllerManager(this);
+ this.explosionSource = new Explosion(world, this, null, null, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, Explosion.Effect.DESTROY); // CraftBukkit
}
public static AttributeProvider.Builder createAttributes() {
@@ -234,7 +248,7 @@
Vec3D vec3d1 = idragoncontroller.getFlyTargetLocation();
@@ -36,7 +44,7 @@
d0 = vec3d1.x - this.getX();
d1 = vec3d1.y - this.getY();
d2 = vec3d1.z - this.getZ();
@@ -374,7 +387,14 @@
@@ -375,7 +389,14 @@
if (this.nearestCrystal.isRemoved()) {
this.nearestCrystal = null;
} else if (this.tickCount % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
@@ -52,7 +60,7 @@
}
}
@@ -449,6 +469,9 @@
@@ -450,6 +471,9 @@
int j1 = MathHelper.floor(axisalignedbb.maxZ);
boolean flag = false;
boolean flag1 = false;
@@ -62,7 +70,7 @@
for (int k1 = i; k1 <= l; ++k1) {
for (int l1 = j; l1 <= i1; ++l1) {
@@ -458,7 +481,11 @@
@@ -459,7 +483,11 @@
if (!iblockdata.isAir() && !iblockdata.is(TagsBlock.DRAGON_TRANSPARENT)) {
if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.is(TagsBlock.DRAGON_IMMUNE)) {
@@ -75,7 +83,7 @@
} else {
flag = true;
}
@@ -467,6 +494,51 @@
@@ -468,6 +496,51 @@
}
}
@@ -127,7 +135,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));
@@ -531,6 +603,21 @@
@@ -532,6 +605,21 @@
}
@@ -149,7 +157,7 @@
@Override
protected void tickDeath() {
if (this.dragonFight != null) {
@@ -546,15 +633,20 @@
@@ -547,15 +635,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);
}
@@ -171,16 +179,16 @@
EntityExperienceOrb.award((WorldServer) this.level, this.position(), MathHelper.floor((float) short0 * 0.08F));
}
@@ -567,7 +659,7 @@
this.setYRot(this.getYRot() + 20.0F);
this.yBodyRot = this.getYRot();
@@ -566,7 +659,7 @@
this.move(EnumMoveType.SELF, new Vec3D(0.0D, 0.10000000149011612D, 0.0D));
if (this.dragonDeathTime == 200 && this.level instanceof WorldServer) {
- if (flag) {
+ if (true) { // CraftBukkit - SPIGOT-2420: Already checked for the game rule when calculating the xp
EntityExperienceOrb.award((WorldServer) this.level, this.position(), MathHelper.floor((float) short0 * 0.2F));
}
@@ -788,6 +880,7 @@
@@ -787,6 +880,7 @@
super.addAdditionalSaveData(nbttagcompound);
nbttagcompound.putInt("DragonPhase", this.phaseManager.getCurrentPhase().getPhase().getId());
nbttagcompound.putInt("DragonDeathTime", this.dragonDeathTime);
@@ -188,7 +196,7 @@
}
@Override
@@ -801,6 +894,11 @@
@@ -800,6 +894,11 @@
this.dragonDeathTime = nbttagcompound.getInt("DragonDeathTime");
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/wither/EntityWither.java
+++ b/net/minecraft/world/entity/boss/wither/EntityWither.java
@@ -54,6 +54,17 @@
@@ -55,6 +55,17 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.Vec3D;
@@ -18,7 +18,7 @@
public class EntityWither extends EntityMonster implements PowerableMob, IRangedEntity {
private static final DataWatcherObject<Integer> DATA_TARGET_A = DataWatcher.defineId(EntityWither.class, DataWatcherRegistry.INT);
@@ -247,15 +258,40 @@
@@ -248,15 +259,40 @@
i = this.getInvulnerableTicks() - 1;
this.bossEvent.setProgress(1.0F - (float) i / 220.0F);
if (i <= 0) {
@@ -62,7 +62,7 @@
}
} else {
@@ -300,6 +336,7 @@
@@ -301,6 +337,7 @@
if (!list.isEmpty()) {
EntityLiving entityliving1 = (EntityLiving) list.get(this.random.nextInt(list.size()));
@@ -70,7 +70,7 @@
this.setAlternativeTarget(i, entityliving1.getId());
}
}
@@ -330,6 +367,11 @@
@@ -331,6 +368,11 @@
IBlockData iblockdata = this.level.getBlockState(blockposition);
if (canDestroy(iblockdata)) {
@@ -82,7 +82,7 @@
flag = this.level.destroyBlock(blockposition, true, this) || flag;
}
}
@@ -343,7 +385,7 @@
@@ -344,7 +386,7 @@
}
if (this.tickCount % 20 == 0) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/decoration/EntityArmorStand.java
+++ b/net/minecraft/world/entity/decoration/EntityArmorStand.java
@@ -43,6 +43,15 @@
@@ -44,6 +44,15 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
@@ -16,7 +16,7 @@
public class EntityArmorStand extends EntityLiving {
public static final int WOBBLE_TIME = 5;
@@ -105,6 +114,13 @@
@@ -106,6 +115,13 @@
this.setPos(d0, d1, d2);
}
@@ -30,7 +30,7 @@
@Override
public void refreshDimensions() {
double d0 = this.getX();
@@ -160,13 +176,20 @@
@@ -161,13 +177,20 @@
@Override
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
@@ -53,7 +53,7 @@
}
}
@@ -402,6 +425,22 @@
@@ -403,6 +426,22 @@
return false;
} else {
ItemStack itemstack2;
@@ -76,10 +76,10 @@
if (entityhuman.getAbilities().instabuild && itemstack1.isEmpty() && !itemstack.isEmpty()) {
itemstack2 = itemstack.copy();
@@ -430,9 +469,19 @@
@@ -431,9 +470,19 @@
public boolean hurt(DamageSource damagesource, float f) {
if (!this.level.isClientSide && !this.isRemoved()) {
if (DamageSource.OUT_OF_WORLD.equals(damagesource)) {
if (damagesource.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
+ return false;
@@ -94,24 +94,24 @@
+ return false;
+ }
+ // CraftBukkit end
if (damagesource.isExplosion()) {
if (damagesource.is(DamageTypeTags.IS_EXPLOSION)) {
this.brokenByAnything(damagesource);
this.kill();
@@ -472,7 +521,7 @@
} else {
this.brokenByPlayer(damagesource);
this.showBreakingParticles();
- this.kill();
+ this.discard(); // CraftBukkit - SPIGOT-4890: remain as this.die() since above damagesource method will call death event
}
@@ -482,7 +531,7 @@
} else {
this.brokenByPlayer(damagesource);
this.showBreakingParticles();
- this.kill();
+ this.discard(); // CraftBukkit - SPIGOT-4890: remain as this.discard() since above damagesource method will call death event
}
return true;
@@ -533,13 +582,13 @@
}
return true;
@@ -550,13 +599,13 @@
itemstack.setHoverName(this.getCustomName());
}
private void brokenByPlayer(DamageSource damagesource) {
- Block.popResource(this.level, this.blockPosition(), new ItemStack(Items.ARMOR_STAND));
+ drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(new ItemStack(Items.ARMOR_STAND))); // CraftBukkit - add to drops
- Block.popResource(this.level, this.blockPosition(), itemstack);
+ drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
this.brokenByAnything(damagesource);
}
@@ -122,7 +122,7 @@
ItemStack itemstack;
int i;
@@ -547,7 +596,7 @@
@@ -564,7 +613,7 @@
for (i = 0; i < this.handItems.size(); ++i) {
itemstack = (ItemStack) this.handItems.get(i);
if (!itemstack.isEmpty()) {
@@ -131,7 +131,7 @@
this.handItems.set(i, ItemStack.EMPTY);
}
}
@@ -555,10 +604,11 @@
@@ -572,10 +621,11 @@
for (i = 0; i < this.armorItems.size(); ++i) {
itemstack = (ItemStack) this.armorItems.get(i);
if (!itemstack.isEmpty()) {
@@ -144,7 +144,7 @@
}
@@ -659,8 +709,16 @@
@@ -676,8 +726,16 @@
return this.isSmall();
}

View File

@@ -5,7 +5,7 @@
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.world.damagesource.EntityDamageSourceIndirect;
+import net.minecraft.tags.DamageTypeTags;
+import net.minecraft.world.level.material.Material;
+import org.bukkit.entity.Hanging;
+import org.bukkit.event.hanging.HangingBreakByEntityEvent;
@@ -111,12 +111,12 @@
} else {
if (!this.isRemoved() && !this.level.isClientSide) {
+ // CraftBukkit start - fire break events
+ Entity damager = (damagesource instanceof EntityDamageSourceIndirect) ? ((EntityDamageSourceIndirect) damagesource).getProximateDamageSource() : damagesource.getEntity();
+ Entity damager = (damagesource.isIndirect()) ? damagesource.getEntity() : damagesource.getDirectEntity();
+ HangingBreakEvent event;
+ if (damager != null) {
+ event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damager.getBukkitEntity(), damagesource.isExplosion() ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.ENTITY);
+ event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damager.getBukkitEntity(), damagesource.is(DamageTypeTags.IS_EXPLOSION) ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.ENTITY);
+ } else {
+ event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), damagesource.isExplosion() ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.DEFAULT);
+ event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), damagesource.is(DamageTypeTags.IS_EXPLOSION) ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.DEFAULT);
+ }
+
+ this.level.getCraftServer().getPluginManager().callEvent(event);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/decoration/EntityItemFrame.java
+++ b/net/minecraft/world/entity/decoration/EntityItemFrame.java
@@ -94,16 +94,27 @@
@@ -96,16 +96,27 @@
@Override
protected void recalculateBoundingBox() {
if (this.direction != null) {
@@ -37,7 +37,7 @@
switch (enumdirection_enumaxis) {
case X:
@@ -119,9 +130,10 @@
@@ -121,9 +132,10 @@
d4 /= 32.0D;
d5 /= 32.0D;
d6 /= 32.0D;
@@ -49,9 +49,9 @@
@Override
public boolean survives() {
@@ -171,6 +183,11 @@
@@ -173,6 +185,11 @@
return false;
} else if (!damagesource.isExplosion() && !this.getItem().isEmpty()) {
} else if (!damagesource.is(DamageTypeTags.IS_EXPLOSION) && !this.getItem().isEmpty()) {
if (!this.level.isClientSide) {
+ // CraftBukkit start - fire EntityDamageEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false) || this.isRemoved()) {
@@ -59,9 +59,9 @@
+ }
+ // CraftBukkit end
this.dropItem(damagesource.getEntity(), false);
this.gameEvent(GameEvent.BLOCK_CHANGE, damagesource.getEntity());
this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F);
}
@@ -298,6 +315,12 @@
@@ -302,6 +319,12 @@
}
public void setItem(ItemStack itemstack, boolean flag) {
@@ -74,7 +74,7 @@
if (!itemstack.isEmpty()) {
itemstack = itemstack.copy();
itemstack.setCount(1);
@@ -305,7 +328,7 @@
@@ -309,7 +332,7 @@
this.onItemChanged(itemstack);
this.getEntityData().set(EntityItemFrame.DATA_ITEM, itemstack);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/decoration/EntityLeash.java
+++ b/net/minecraft/world/entity/decoration/EntityLeash.java
@@ -25,6 +25,12 @@
@@ -26,6 +26,12 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
@@ -13,9 +13,9 @@
public class EntityLeash extends EntityHanging {
public static final double OFFSET_Y = 0.375D;
@@ -96,22 +102,42 @@
while (iterator.hasNext()) {
entityinsentient = (EntityInsentient) iterator.next();
@@ -96,6 +102,12 @@
EntityInsentient entityinsentient = (EntityInsentient) iterator.next();
if (entityinsentient.getLeashHolder() == entityhuman) {
+ // CraftBukkit start
+ if (CraftEventFactory.callPlayerLeashEntityEvent(entityinsentient, this, entityhuman, enumhand).isCancelled()) {
@@ -26,7 +26,8 @@
entityinsentient.setLeashedTo(this, true);
flag = true;
}
}
@@ -104,18 +116,32 @@
boolean flag1 = false;
if (!flag) {
- this.discard();
@@ -36,19 +37,21 @@
+ boolean die = true;
+ // CraftBukkit end
+ if (true || entityhuman.getAbilities().instabuild) { // CraftBukkit - Process for non-creative as well
iterator = list.iterator();
Iterator iterator1 = list.iterator();
while (iterator.hasNext()) {
entityinsentient = (EntityInsentient) iterator.next();
if (entityinsentient.isLeashed() && entityinsentient.getLeashHolder() == this) {
- entityinsentient.dropLeash(true, false);
while (iterator1.hasNext()) {
EntityInsentient entityinsentient1 = (EntityInsentient) iterator1.next();
if (entityinsentient1.isLeashed() && entityinsentient1.getLeashHolder() == this) {
- entityinsentient1.dropLeash(true, false);
+ // CraftBukkit start
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient, entityhuman, enumhand).isCancelled()) {
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient1, entityhuman, enumhand).isCancelled()) {
+ die = false;
+ continue;
+ }
+ entityinsentient.dropLeash(true, !entityhuman.getAbilities().instabuild); // false -> survival mode boolean
+ entityinsentient1.dropLeash(true, !entityhuman.getAbilities().instabuild); // false -> survival mode boolean
+ // CraftBukkit end
flag1 = true;
}
}
+ // CraftBukkit start

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/item/EntityFallingBlock.java
+++ b/net/minecraft/world/entity/item/EntityFallingBlock.java
@@ -48,6 +48,8 @@
@@ -49,6 +49,8 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
@@ -9,7 +9,7 @@
public class EntityFallingBlock extends Entity {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -82,10 +84,17 @@
@@ -83,10 +85,17 @@
}
public static EntityFallingBlock fall(World world, BlockPosition blockposition, IBlockData iblockdata) {
@@ -28,7 +28,7 @@
return entityfallingblock;
}
@@ -168,6 +177,12 @@
@@ -169,6 +178,12 @@
this.blockState = (IBlockData) this.blockState.setValue(BlockProperties.WATERLOGGED, true);
}
@@ -41,7 +41,7 @@
if (this.level.setBlock(blockposition, this.blockState, 3)) {
((WorldServer) this.level).getChunkSource().chunkMap.broadcast(this, new PacketPlayOutBlockChange(blockposition, this.level.getBlockState(blockposition)));
this.discard();
@@ -238,7 +253,7 @@
@@ -239,7 +254,7 @@
if (i < 0) {
return false;
} else {
@@ -50,7 +50,7 @@
DamageSource damagesource1;
if (this.blockState.getBlock() instanceof Fallable) {
@@ -254,7 +269,9 @@
@@ -255,7 +270,9 @@
float f2 = (float) Math.min(MathHelper.floor((float) i * this.fallDamagePerDistance), this.fallDamageMax);
this.level.getEntities((Entity) this, this.getBoundingBox(), predicate).forEach((entity) -> {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/item/EntityItem.java
+++ b/net/minecraft/world/entity/item/EntityItem.java
@@ -30,6 +30,12 @@
@@ -31,6 +31,12 @@
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.phys.Vec3D;
@@ -10,18 +10,18 @@
+import org.bukkit.event.player.PlayerPickupItemEvent;
+// CraftBukkit end
+
public class EntityItem extends Entity {
public class EntityItem extends Entity implements TraceableEntity {
private static final DataWatcherObject<ItemStack> DATA_ITEM = DataWatcher.defineId(EntityItem.class, DataWatcherRegistry.ITEM_STACK);
@@ -44,6 +50,7 @@
@@ -45,6 +51,7 @@
@Nullable
private UUID owner;
public UUID target;
public final float bobOffs;
+ private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit
public EntityItem(EntityTypes<? extends EntityItem> entitytypes, World world) {
super(entitytypes, world);
@@ -101,9 +108,12 @@
@@ -110,9 +117,12 @@
this.discard();
} else {
super.tick();
@@ -37,7 +37,7 @@
this.xo = this.getX();
this.yo = this.getY();
@@ -153,9 +163,11 @@
@@ -162,9 +172,11 @@
this.mergeWithNeighbours();
}
@@ -49,7 +49,7 @@
this.hasImpulse |= this.updateInWaterStateAndDoFluidPushing();
if (!this.level.isClientSide) {
@@ -167,6 +179,12 @@
@@ -176,6 +188,12 @@
}
if (!this.level.isClientSide && this.age >= 6000) {
@@ -62,7 +62,7 @@
this.discard();
}
@@ -242,10 +260,11 @@
@@ -251,10 +269,11 @@
private static void merge(EntityItem entityitem, ItemStack itemstack, ItemStack itemstack1) {
ItemStack itemstack2 = merge(itemstack, itemstack1, 64);
@@ -75,7 +75,7 @@
merge(entityitem, itemstack, itemstack1);
entityitem.pickupDelay = Math.max(entityitem.pickupDelay, entityitem1.pickupDelay);
entityitem.age = Math.min(entityitem.age, entityitem1.age);
@@ -271,6 +290,11 @@
@@ -280,6 +299,11 @@
} else if (this.level.isClientSide) {
return true;
} else {
@@ -87,7 +87,7 @@
this.markHurt();
this.health = (int) ((float) this.health - f);
this.gameEvent(GameEvent.ENTITY_DAMAGE, damagesource.getEntity());
@@ -334,6 +358,46 @@
@@ -343,6 +367,46 @@
Item item = itemstack.getItem();
int i = itemstack.getCount();
@@ -131,10 +131,10 @@
+ }
+ // CraftBukkit end
+
if (this.pickupDelay == 0 && (this.owner == null || this.owner.equals(entityhuman.getUUID())) && entityhuman.getInventory().add(itemstack)) {
if (this.pickupDelay == 0 && (this.target == null || this.target.equals(entityhuman.getUUID())) && entityhuman.getInventory().add(itemstack)) {
entityhuman.take(this, i);
if (itemstack.isEmpty()) {
@@ -377,7 +441,9 @@
@@ -386,7 +450,9 @@
}
public void setItem(ItemStack itemstack) {

View File

@@ -1,12 +1,12 @@
--- a/net/minecraft/world/entity/item/EntityTNTPrimed.java
+++ b/net/minecraft/world/entity/item/EntityTNTPrimed.java
@@ -14,12 +14,16 @@
import net.minecraft.world.entity.EnumMoveType;
@@ -15,12 +15,16 @@
import net.minecraft.world.entity.TraceableEntity;
import net.minecraft.world.level.World;
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
+
public class EntityTNTPrimed extends Entity {
public class EntityTNTPrimed extends Entity implements TraceableEntity {
private static final DataWatcherObject<Integer> DATA_FUSE_ID = DataWatcher.defineId(EntityTNTPrimed.class, DataWatcherRegistry.INT);
private static final int DEFAULT_FUSE_TIME = 80;
@@ -17,7 +17,7 @@
public EntityTNTPrimed(EntityTypes<? extends EntityTNTPrimed> entitytypes, World world) {
super(entitytypes, world);
@@ -70,10 +74,13 @@
@@ -71,10 +75,13 @@
this.setFuse(i);
if (i <= 0) {
@@ -32,7 +32,7 @@
} else {
this.updateInWaterStateAndDoFluidPushing();
if (this.level.isClientSide) {
@@ -84,9 +91,16 @@
@@ -85,9 +92,16 @@
}
private void explode() {

View File

@@ -34,7 +34,7 @@
@Override
protected EnumInteractionResult mobInteract(EntityHuman entityhuman, EnumHand enumhand) {
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
@@ -246,10 +262,18 @@
@@ -250,10 +266,18 @@
if (!this.level.isClientSide) {
float f = this.isPowered() ? 2.0F : 1.0F;
@@ -57,7 +57,7 @@
}
}
@@ -260,6 +284,7 @@
@@ -264,6 +288,7 @@
if (!collection.isEmpty()) {
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.level, this.getX(), this.getY(), this.getZ());
@@ -65,7 +65,7 @@
entityareaeffectcloud.setRadius(2.5F);
entityareaeffectcloud.setRadiusOnUse(-0.5F);
entityareaeffectcloud.setWaitTime(10);
@@ -273,7 +298,7 @@
@@ -277,7 +302,7 @@
entityareaeffectcloud.addEffect(new MobEffect(mobeffect));
}

View File

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

View File

@@ -27,7 +27,7 @@
}
@@ -490,9 +501,13 @@
@@ -487,9 +498,13 @@
if (iblockdata2 != null) {
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level, blockposition);
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
@@ -41,7 +41,7 @@
}
}
@@ -531,9 +546,13 @@
@@ -528,9 +543,13 @@
boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition);
if (iblockdata.is(TagsBlock.ENDERMAN_HOLDABLE) && flag) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityPhantom.java
+++ b/net/minecraft/world/entity/monster/EntityPhantom.java
@@ -533,14 +533,14 @@
@@ -538,14 +538,14 @@
List<EntityHuman> list = EntityPhantom.this.level.getNearbyPlayers(this.attackTargeting, EntityPhantom.this, EntityPhantom.this.getBoundingBox().inflate(16.0D, 64.0D, 16.0D));
if (!list.isEmpty()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityRavager.java
+++ b/net/minecraft/world/entity/monster/EntityRavager.java
@@ -171,7 +171,7 @@
@@ -170,7 +170,7 @@
IBlockData iblockdata = this.level.getBlockState(blockposition);
Block block = iblockdata.getBlock();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityShulker.java
+++ b/net/minecraft/world/entity/monster/EntityShulker.java
@@ -59,6 +59,12 @@
@@ -60,6 +60,12 @@
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
@@ -13,7 +13,7 @@
public class EntityShulker extends EntityGolem implements VariantHolder<Optional<EnumColor>>, IMonster {
private static final UUID COVERED_ARMOR_MODIFIER_UUID = UUID.fromString("7E0292F2-9434-48D5-A29F-9583AF7DF27F");
@@ -407,6 +413,16 @@
@@ -408,6 +414,16 @@
EnumDirection enumdirection = this.findAttachableSurface(blockposition1);
if (enumdirection != null) {
@@ -22,7 +22,7 @@
+ this.level.getCraftServer().getPluginManager().callEvent(teleport);
+ if (!teleport.isCancelled()) {
+ Location to = teleport.getTo();
+ blockposition1 = new BlockPosition(to.getX(), to.getY(), to.getZ());
+ blockposition1 = BlockPosition.containing(to.getX(), to.getY(), to.getZ());
+ } else {
+ return false;
+ }
@@ -30,7 +30,7 @@
this.unRide();
this.setAttachFace(enumdirection);
this.playSound(SoundEffects.SHULKER_TELEPORT, 1.0F, 1.0F);
@@ -477,7 +493,7 @@
@@ -478,7 +494,7 @@
if (entityshulker != null) {
entityshulker.setVariant(this.getVariant());
entityshulker.moveTo(vec3d);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java
+++ b/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java
@@ -197,8 +197,19 @@
@@ -200,8 +200,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));

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/entity/monster/EntitySpider.java
+++ b/net/minecraft/world/entity/monster/EntitySpider.java
@@ -179,7 +179,7 @@
MobEffectList mobeffectlist = ((EntitySpider.GroupDataSpider) object).effect;
@@ -180,7 +180,7 @@
MobEffectList mobeffectlist = entityspider_groupdataspider.effect;
if (mobeffectlist != null) {
- this.addEffect(new MobEffect(mobeffectlist, Integer.MAX_VALUE));
+ this.addEffect(new MobEffect(mobeffectlist, Integer.MAX_VALUE), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN); // CraftBukkit
- this.addEffect(new MobEffect(mobeffectlist, -1));
+ this.addEffect(new MobEffect(mobeffectlist, -1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN); // CraftBukkit
}
}

View File

@@ -1,14 +1,15 @@
--- a/net/minecraft/world/entity/monster/EntityStrider.java
+++ b/net/minecraft/world/entity/monster/EntityStrider.java
@@ -320,7 +320,13 @@
IBlockData iblockdata1 = this.getBlockStateOnLegacy();
boolean flag = iblockdata.is(TagsBlock.STRIDER_WARM_BLOCKS) || iblockdata1.is(TagsBlock.STRIDER_WARM_BLOCKS) || this.getFluidHeight(TagsFluid.LAVA) > 0.0D;
@@ -349,7 +349,14 @@
- this.setSuffocating(!flag);
boolean flag2 = flag1;
- this.setSuffocating(!flag || flag2);
+ // CraftBukkit start
+ if (!flag ^ this.isSuffocating()) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callStriderTemperatureChangeEvent(this, !flag)) {
+ this.setSuffocating(!flag);
+ boolean suffocating = !flag || flag2;
+ if (suffocating ^ this.isSuffocating()) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callStriderTemperatureChangeEvent(this, suffocating)) {
+ this.setSuffocating(suffocating);
+ }
+ }
+ // CraftBukkit end

View File

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

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityWitch.java
+++ b/net/minecraft/world/entity/monster/EntityWitch.java
@@ -131,7 +131,7 @@
@@ -132,7 +132,7 @@
while (iterator.hasNext()) {
MobEffect mobeffect = (MobEffect) iterator.next();

View File

@@ -47,8 +47,8 @@
+ // CraftBukkit end
}
this.lastRestockGameTime = this.level.getGameTime();
@@ -417,7 +431,13 @@
this.resendOffersToTradingPlayer();
@@ -428,7 +442,13 @@
while (iterator.hasNext()) {
MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
@@ -63,7 +63,7 @@
}
}
@@ -476,7 +496,7 @@
@@ -488,7 +508,7 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@@ -72,7 +72,7 @@
Logger logger = EntityVillager.LOGGER;
Objects.requireNonNull(logger);
@@ -820,7 +840,12 @@
@@ -832,7 +852,12 @@
}
entitywitch.setPersistenceRequired();
@@ -86,7 +86,7 @@
this.releaseAllPois();
this.discard();
} else {
@@ -909,7 +934,7 @@
@@ -921,7 +946,7 @@
}).limit(5L).collect(Collectors.toList());
if (list1.size() >= j) {
@@ -95,7 +95,7 @@
list.forEach(SensorGolemLastSeen::golemDetected);
}
}
@@ -966,7 +991,7 @@
@@ -978,7 +1003,7 @@
@Override
public void startSleeping(BlockPosition blockposition) {
super.startSleeping(blockposition);
@@ -104,7 +104,7 @@
this.brain.eraseMemory(MemoryModuleType.WALK_TARGET);
this.brain.eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
}
@@ -974,7 +999,7 @@
@@ -986,7 +1011,7 @@
@Override
public void stopSleeping() {
super.stopSleeping();

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/npc/EntityVillagerTrader.java
+++ b/net/minecraft/world/entity/npc/EntityVillagerTrader.java
@@ -44,6 +44,13 @@
import net.minecraft.world.level.World;
@@ -46,6 +46,13 @@
import net.minecraft.world.phys.Vec3D;
import org.apache.commons.lang3.ArrayUtils;
+// CraftBukkit start
+import org.bukkit.Bukkit;
@@ -14,7 +14,7 @@
public class EntityVillagerTrader extends EntityVillagerAbstract {
private static final int NUMBER_OF_TRADE_OFFERS = 5;
@@ -53,6 +60,7 @@
@@ -55,6 +62,7 @@
public EntityVillagerTrader(EntityTypes<? extends EntityVillagerTrader> entitytypes, World world) {
super(entitytypes, world);
@@ -22,7 +22,7 @@
}
@Override
@@ -130,7 +138,16 @@
@@ -140,7 +148,16 @@
MerchantRecipe merchantrecipe = villagertrades_imerchantrecipeoption.getOffer(this, this.random);
if (merchantrecipe != null) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/player/EntityHuman.java
+++ b/net/minecraft/world/entity/player/EntityHuman.java
@@ -115,6 +115,20 @@
@@ -117,6 +117,20 @@
import net.minecraft.world.scores.ScoreboardTeamBase;
import org.slf4j.Logger;
@@ -21,7 +21,7 @@
public abstract class EntityHuman extends EntityLiving {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -128,7 +142,8 @@
@@ -130,7 +144,8 @@
public static final float SWIMMING_BB_HEIGHT = 0.6F;
public static final float DEFAULT_EYE_HEIGHT = 1.62F;
public static final EntitySize STANDING_DIMENSIONS = EntitySize.scalable(0.6F, 1.8F);
@@ -31,7 +31,7 @@
private static final int FLY_ACHIEVEMENT_SPEED = 25;
private static final DataWatcherObject<Float> DATA_PLAYER_ABSORPTION_ID = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.FLOAT);
private static final DataWatcherObject<Integer> DATA_SCORE_ID = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.INT);
@@ -138,10 +153,10 @@
@@ -140,10 +155,10 @@
protected static final DataWatcherObject<NBTTagCompound> DATA_SHOULDER_RIGHT = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.COMPOUND_TAG);
private long timeEntitySatOnShoulder;
private final PlayerInventory inventory = new PlayerInventory(this);
@@ -44,18 +44,9 @@
protected int jumpTriggerTime;
public float oBob;
public float bob;
@@ -158,7 +173,7 @@
public int experienceLevel;
public int totalExperience;
public float experienceProgress;
- protected int enchantmentSeed;
+ public int enchantmentSeed;
protected final float defaultFlySpeed = 0.02F;
private int lastLevelUpTime;
private final GameProfile gameProfile;
@@ -169,6 +184,16 @@
@Nullable
@@ -172,6 +187,16 @@
public EntityFishingHook fishing;
protected float hurtDir;
+ // CraftBukkit start
+ public boolean fauxSleeping;
@@ -70,7 +61,7 @@
public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile) {
super(EntityTypes.PLAYER, world);
this.lastItemInMainHand = ItemStack.EMPTY;
@@ -308,7 +333,7 @@
@@ -311,7 +336,7 @@
ItemStack itemstack = this.getItemBySlot(EnumItemSlot.HEAD);
if (itemstack.is(Items.TURTLE_HELMET) && !this.isEyeInFluid(TagsFluid.WATER)) {
@@ -79,7 +70,7 @@
}
}
@@ -502,7 +527,8 @@
@@ -505,7 +530,8 @@
if (this.level.getDifficulty() == EnumDifficulty.PEACEFUL && this.level.getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION)) {
if (this.getHealth() < this.getMaxHealth() && this.tickCount % 20 == 0) {
@@ -89,7 +80,7 @@
}
if (this.foodData.needsFood() && this.tickCount % 10 == 0) {
@@ -666,6 +692,13 @@
@@ -664,6 +690,13 @@
@Nullable
public EntityItem drop(ItemStack itemstack, boolean flag, boolean flag1) {
@@ -103,7 +94,7 @@
if (itemstack.isEmpty()) {
return null;
} else {
@@ -700,6 +733,33 @@
@@ -698,6 +731,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);
}
@@ -137,7 +128,7 @@
return entityitem;
}
}
@@ -790,7 +850,7 @@
@@ -788,7 +848,7 @@
}
if (nbttagcompound.contains("LastDeathLocation", 10)) {
@@ -146,7 +137,7 @@
Logger logger = EntityHuman.LOGGER;
Objects.requireNonNull(logger);
@@ -823,7 +883,7 @@
@@ -821,7 +881,7 @@
}
this.getLastDeathLocation().flatMap((globalpos) -> {
@@ -155,7 +146,7 @@
Logger logger = EntityHuman.LOGGER;
Objects.requireNonNull(logger);
@@ -850,12 +910,12 @@
@@ -848,12 +908,12 @@
return false;
} else {
if (!this.level.isClientSide) {
@@ -170,7 +161,7 @@
}
if (this.level.getDifficulty() == EnumDifficulty.EASY) {
@@ -867,7 +927,13 @@
@@ -865,7 +925,13 @@
}
}
@@ -185,7 +176,7 @@
}
}
}
@@ -887,10 +953,29 @@
@@ -885,10 +951,29 @@
}
public boolean canHarmPlayer(EntityHuman entityhuman) {
@@ -218,7 +209,7 @@
}
@Override
@@ -932,8 +1017,13 @@
@@ -930,8 +1015,13 @@
}
}
@@ -233,7 +224,7 @@
if (!this.isInvulnerableTo(damagesource)) {
f = this.getDamageAfterArmorAbsorb(damagesource, f);
f = this.getDamageAfterMagicAbsorb(damagesource, f);
@@ -948,7 +1038,7 @@
@@ -946,7 +1036,7 @@
}
if (f != 0.0F) {
@@ -241,8 +232,8 @@
+ this.causeFoodExhaustion(damagesource.getFoodExhaustion(), EntityExhaustionEvent.ExhaustionReason.DAMAGED); // CraftBukkit - EntityExhaustionEvent
float f3 = this.getHealth();
this.setHealth(this.getHealth() - f);
@@ -959,6 +1049,7 @@
this.getCombatTracker().recordDamage(damagesource, f3, f);
@@ -957,6 +1047,7 @@
}
}
@@ -250,7 +241,7 @@
}
@Override
@@ -1122,7 +1213,7 @@
@@ -1121,7 +1212,7 @@
f *= 0.2F + f2 * f2 * 0.8F;
f1 *= f2;
@@ -259,7 +250,7 @@
if (f > 0.0F || f1 > 0.0F) {
boolean flag = f2 > 0.9F;
boolean flag1 = false;
@@ -1161,8 +1252,15 @@
@@ -1160,8 +1251,15 @@
if (entity instanceof EntityLiving) {
f3 = ((EntityLiving) entity).getHealth();
if (j > 0 && !entity.isOnFire()) {
@@ -277,20 +268,20 @@
}
}
@@ -1190,8 +1288,11 @@
@@ -1189,8 +1287,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) {
+ // CraftBukkit start - Only apply knockback if the damage hits
+ if (entityliving.hurt(DamageSource.playerAttack(this).sweep(), f4)) {
+ 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)));
- entityliving.hurt(DamageSource.playerAttack(this), f4);
- entityliving.hurt(this.damageSources().playerAttack(this), f4);
+ }
+ // CraftBukkit end
}
}
@@ -1200,9 +1301,26 @@
@@ -1199,9 +1300,26 @@
}
if (entity instanceof EntityPlayer && entity.hurtMarked) {
@@ -317,7 +308,7 @@
}
if (flag2) {
@@ -1247,7 +1365,14 @@
@@ -1246,7 +1364,14 @@
this.awardStat(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F));
if (j > 0) {
@@ -333,7 +324,7 @@
}
if (this.level instanceof WorldServer && f5 > 2.0F) {
@@ -1257,12 +1382,17 @@
@@ -1256,12 +1381,17 @@
}
}
@@ -352,7 +343,7 @@
}
}
@@ -1339,6 +1469,12 @@
@@ -1338,6 +1468,12 @@
}
public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition) {
@@ -365,7 +356,7 @@
this.startSleeping(blockposition);
this.sleepCounter = 0;
return Either.right(Unit.INSTANCE);
@@ -1423,9 +1559,9 @@
@@ -1422,9 +1558,9 @@
super.jumpFromGround();
this.awardStat(StatisticList.JUMP);
if (this.isSprinting()) {
@@ -377,9 +368,9 @@
}
}
@@ -1459,7 +1595,11 @@
@@ -1454,7 +1590,11 @@
this.setDeltaMovement(vec3d2.x, d3 * 0.6D, vec3d2.z);
this.flyingSpeed = f;
this.resetFallDistance();
- this.setSharedFlag(7, false);
+ // CraftBukkit start
@@ -390,7 +381,7 @@
} else {
super.travel(vec3d);
}
@@ -1494,19 +1634,19 @@
@@ -1489,19 +1629,19 @@
i = Math.round((float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
this.awardStat(StatisticList.SWIM_ONE_CM, i);
@@ -413,7 +404,7 @@
}
} else if (this.onClimbable()) {
if (d1 > 0.0D) {
@@ -1517,13 +1657,13 @@
@@ -1512,13 +1652,13 @@
if (i > 0) {
if (this.isSprinting()) {
this.awardStat(StatisticList.SPRINT_ONE_CM, i);
@@ -430,7 +421,7 @@
}
}
} else if (this.isFallFlying()) {
@@ -1589,12 +1729,24 @@
@@ -1584,12 +1724,24 @@
}
public void startFallFlying() {
@@ -456,7 +447,7 @@
}
@Override
@@ -1685,10 +1837,21 @@
@@ -1680,10 +1832,21 @@
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
}
@@ -479,7 +470,7 @@
}
}
@@ -1774,13 +1937,20 @@
@@ -1769,13 +1932,20 @@
@Override
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
@@ -503,7 +494,7 @@
}
}
@@ -1819,26 +1989,31 @@
@@ -1814,26 +1984,31 @@
protected void removeEntitiesOnShoulder() {
if (this.timeEntitySatOnShoulder + 20L < this.level.getGameTime()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/player/PlayerInventory.java
+++ b/net/minecraft/world/entity/player/PlayerInventory.java
@@ -25,6 +25,13 @@
@@ -26,6 +26,13 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.state.IBlockData;
@@ -14,7 +14,7 @@
public class PlayerInventory implements IInventory, INamableTileEntity {
public static final int POP_TIME_DURATION = 5;
@@ -42,6 +49,54 @@
@@ -43,6 +50,54 @@
public final EntityHuman player;
private int timesChanged;
@@ -69,7 +69,7 @@
public PlayerInventory(EntityHuman entityhuman) {
this.items = NonNullList.withSize(36, ItemStack.EMPTY);
this.armor = NonNullList.withSize(4, ItemStack.EMPTY);
@@ -62,6 +117,28 @@
@@ -63,6 +118,28 @@
return !itemstack.isEmpty() && ItemStack.isSameItemSameTags(itemstack, itemstack1) && itemstack.isStackable() && itemstack.getCount() < itemstack.getMaxStackSize() && itemstack.getCount() < this.getMaxStackSize();
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityEgg.java
+++ b/net/minecraft/world/entity/projectile/EntityEgg.java
@@ -12,6 +12,15 @@
@@ -11,6 +11,15 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.MovingObjectPositionEntity;
@@ -16,7 +16,7 @@
public class EntityEgg extends EntityProjectileThrowable {
public EntityEgg(EntityTypes<? extends EntityEgg> entitytypes, World world) {
@@ -48,22 +57,42 @@
@@ -47,22 +56,42 @@
protected void onHit(MovingObjectPosition movingobjectposition) {
super.onHit(movingobjectposition);
if (!this.level.isClientSide) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityEnderPearl.java
+++ b/net/minecraft/world/entity/projectile/EntityEnderPearl.java
@@ -17,6 +17,13 @@
@@ -16,6 +16,13 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.MovingObjectPositionEntity;
@@ -14,10 +14,10 @@
public class EntityEnderPearl extends EntityProjectileThrowable {
public EntityEnderPearl(EntityTypes<? extends EntityEnderPearl> entitytypes, World world) {
@@ -53,23 +60,36 @@
@@ -52,23 +59,36 @@
EntityPlayer entityplayer = (EntityPlayer) entity;
if (entityplayer.connection.getConnection().isConnected() && entityplayer.level == this.level && !entityplayer.isSleeping()) {
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
@@ -29,7 +29,7 @@
+ PlayerTeleportEvent teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.ENDER_PEARL);
+ Bukkit.getPluginManager().callEvent(teleEvent);
+
+ if (!teleEvent.isCancelled() && !entityplayer.connection.isDisconnected()) {
+ 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);
+
@@ -54,17 +54,17 @@
+ entityplayer.connection.teleport(teleEvent.getTo());
+ entity.resetFallDistance();
+ CraftEventFactory.entityDamage = this;
+ entity.hurt(DamageSource.FALL, 5.0F);
+ entity.hurt(this.damageSources().fall(), 5.0F);
+ CraftEventFactory.entityDamage = null;
}
-
- entity.resetFallDistance();
- entity.hurt(DamageSource.FALL, 5.0F);
- entity.hurt(this.damageSources().fall(), 5.0F);
+ // CraftBukkit end
}
} else if (entity != null) {
entity.teleportTo(this.getX(), this.getY(), this.getZ());
@@ -98,7 +118,7 @@
@@ -97,7 +117,7 @@
public Entity changeDimension(WorldServer worldserver) {
Entity entity = this.getOwner();

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
+++ b/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
@@ -128,7 +128,9 @@
@@ -129,7 +129,9 @@
if (entityliving.isAlive() && !entityliving.isInvulnerable() && entityliving != entityliving1) {
if (entityliving1 == null) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = this; // CraftBukkit
entityliving.hurt(DamageSource.MAGIC, 6.0F);
entityliving.hurt(this.damageSources().magic(), 6.0F);
+ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = null; // CraftBukkit
} else {
if (entityliving1.isAlliedTo((Entity) entityliving)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityFireworks.java
+++ b/net/minecraft/world/entity/projectile/EntityFireworks.java
@@ -29,6 +29,8 @@
@@ -28,6 +28,8 @@
import net.minecraft.world.phys.MovingObjectPositionEntity;
import net.minecraft.world.phys.Vec3D;
@@ -9,7 +9,7 @@
public class EntityFireworks extends IProjectile implements ItemSupplier {
public static final DataWatcherObject<ItemStack> DATA_ID_FIREWORKS_ITEM = DataWatcher.defineId(EntityFireworks.class, DataWatcherRegistry.ITEM_STACK);
@@ -144,7 +146,7 @@
@@ -143,7 +145,7 @@
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);
if (!this.noPhysics) {
@@ -18,7 +18,7 @@
this.hasImpulse = true;
}
@@ -159,7 +161,11 @@
@@ -158,7 +160,11 @@
}
if (!this.level.isClientSide && this.life > this.lifetime) {
@@ -31,7 +31,7 @@
}
}
@@ -175,7 +181,11 @@
@@ -174,7 +180,11 @@
protected void onHitEntity(MovingObjectPositionEntity movingobjectpositionentity) {
super.onHitEntity(movingobjectpositionentity);
if (!this.level.isClientSide) {
@@ -44,7 +44,7 @@
}
}
@@ -185,7 +195,11 @@
@@ -184,7 +194,11 @@
this.level.getBlockState(blockposition).entityInside(this.level, blockposition, this);
if (!this.level.isClientSide() && this.hasExplosion()) {
@@ -57,22 +57,22 @@
}
super.onHitBlock(movingobjectpositionblock);
@@ -211,7 +225,9 @@
@@ -210,7 +224,9 @@
if (f > 0.0F) {
if (this.attachedToEntity != null) {
+ CraftEventFactory.entityDamage = this; // CraftBukkit
this.attachedToEntity.hurt(DamageSource.fireworks(this, this.getOwner()), 5.0F + (float) (nbttaglist.size() * 2));
this.attachedToEntity.hurt(this.damageSources().fireworks(this, this.getOwner()), 5.0F + (float) (nbttaglist.size() * 2));
+ CraftEventFactory.entityDamage = null; // CraftBukkit
}
double d0 = 5.0D;
@@ -238,7 +254,9 @@
@@ -237,7 +253,9 @@
if (flag) {
float f1 = f * (float) Math.sqrt((5.0D - (double) this.distanceTo(entityliving)) / 5.0D);
+ CraftEventFactory.entityDamage = this; // CraftBukkit
entityliving.hurt(DamageSource.fireworks(this, this.getOwner()), f1);
entityliving.hurt(this.damageSources().fireworks(this, this.getOwner()), f1);
+ CraftEventFactory.entityDamage = null; // CraftBukkit
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityLargeFireball.java
+++ b/net/minecraft/world/entity/projectile/EntityLargeFireball.java
@@ -10,17 +10,21 @@
@@ -9,17 +9,21 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.MovingObjectPositionEntity;
@@ -22,7 +22,7 @@
}
@Override
@@ -29,7 +33,15 @@
@@ -28,7 +32,15 @@
if (!this.level.isClientSide) {
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
@@ -39,7 +39,7 @@
this.discard();
}
@@ -60,7 +72,8 @@
@@ -59,7 +71,8 @@
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.readAdditionalSaveData(nbttagcompound);
if (nbttagcompound.contains("ExplosionPower", 99)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityLlamaSpit.java
+++ b/net/minecraft/world/entity/projectile/EntityLlamaSpit.java
@@ -33,7 +33,7 @@
@@ -32,7 +32,7 @@
Vec3D vec3d = this.getDeltaMovement();
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityPotion.java
+++ b/net/minecraft/world/entity/projectile/EntityPotion.java
@@ -32,6 +32,16 @@
@@ -31,6 +31,16 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import net.minecraft.world.phys.MovingObjectPositionEntity;
@@ -17,7 +17,7 @@
public class EntityPotion extends EntityProjectileThrowable implements ItemSupplier {
public static final double SPLASH_RANGE = 4.0D;
@@ -100,7 +110,7 @@
@@ -99,7 +109,7 @@
if (flag) {
this.applyWater();
@@ -26,7 +26,7 @@
if (this.isLingering()) {
this.makeAreaOfEffectCloud(itemstack, potionregistry);
} else {
@@ -149,6 +159,7 @@
@@ -148,6 +158,7 @@
private void applySplash(List<MobEffect> list, @Nullable Entity entity) {
AxisAlignedBB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D);
List<EntityLiving> list1 = this.level.getEntitiesOfClass(EntityLiving.class, axisalignedbb);
@@ -34,8 +34,8 @@
if (!list1.isEmpty()) {
Entity entity1 = this.getEffectSource();
@@ -167,21 +178,47 @@
d1 = 1.0D;
@@ -168,24 +179,50 @@
d1 = 1.0D - Math.sqrt(d0) / 4.0D;
}
- Iterator iterator1 = list.iterator();
@@ -76,7 +76,10 @@
+ if (mobeffectlist.isInstantenous()) {
+ mobeffectlist.applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect.getAmplifier(), d1);
+ } else {
+ int i = (int) (d1 * (double) mobeffect.getDuration() + 0.5D);
+ int i = mobeffect.mapDuration((j) -> {
+ return (int) (d1 * (double) j + 0.5D);
+ });
+ MobEffect mobeffect1 = new MobEffect(mobeffectlist, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible());
- while (iterator1.hasNext()) {
- MobEffect mobeffect = (MobEffect) iterator1.next();
@@ -85,18 +88,21 @@
- if (mobeffectlist.isInstantenous()) {
- mobeffectlist.applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect.getAmplifier(), d1);
- } else {
- int i = (int) (d1 * (double) mobeffect.getDuration() + 0.5D);
- int i = mobeffect.mapDuration((j) -> {
- return (int) (d1 * (double) j + 0.5D);
- });
- MobEffect mobeffect1 = new MobEffect(mobeffectlist, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible());
-
- if (i > 20) {
- entityliving.addEffect(new MobEffect(mobeffectlist, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible()), entity1);
- if (!mobeffect1.endsWithin(20)) {
- entityliving.addEffect(mobeffect1, entity1);
- }
- }
+ if (i > 20) {
+ entityliving.addEffect(new MobEffect(mobeffectlist, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible()), entity1, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.POTION_SPLASH); // CraftBukkit
+ if (!mobeffect1.endsWithin(20)) {
+ entityliving.addEffect(mobeffect1, entity1, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.POTION_SPLASH); // CraftBukkit
}
}
}
@@ -217,7 +254,14 @@
@@ -221,7 +258,14 @@
entityareaeffectcloud.setFixedColor(nbttagcompound.getInt("CustomPotionColor"));
}
@@ -112,7 +118,7 @@
}
public boolean isLingering() {
@@ -228,13 +272,25 @@
@@ -232,13 +276,25 @@
IBlockData iblockdata = this.level.getBlockState(blockposition);
if (iblockdata.is(TagsBlock.FIRE)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityShulkerBullet.java
+++ b/net/minecraft/world/entity/projectile/EntityShulkerBullet.java
@@ -59,8 +59,21 @@
@@ -60,8 +60,21 @@
this.finalTarget = entity;
this.currentMoveDirection = EnumDirection.UP;
this.selectNextMoveDirection(enumdirection_enumaxis);
@@ -22,7 +22,7 @@
@Override
public SoundCategory getSoundSource() {
return SoundCategory.HOSTILE;
@@ -224,7 +237,7 @@
@@ -225,7 +238,7 @@
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
@@ -31,16 +31,16 @@
}
}
@@ -291,7 +304,7 @@
if (flag) {
this.doEnchantDamageEffects(entityliving, entity);
@@ -294,7 +307,7 @@
if (entity instanceof EntityLiving) {
- ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.LEVITATION, 200), (Entity) MoreObjects.firstNonNull(entity1, this));
+ ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.LEVITATION, 200), (Entity) MoreObjects.firstNonNull(entity1, this), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
EntityLiving entityliving1 = (EntityLiving) entity;
- entityliving1.addEffect(new MobEffect(MobEffects.LEVITATION, 200), (Entity) MoreObjects.firstNonNull(entity1, this));
+ entityliving1.addEffect(new MobEffect(MobEffects.LEVITATION, 200), (Entity) MoreObjects.firstNonNull(entity1, this), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
}
}
@@ -317,6 +330,11 @@
@@ -325,6 +338,11 @@
@Override
public boolean hurt(DamageSource damagesource, float f) {

View File

@@ -34,7 +34,7 @@
+ entity.setSecondsOnFire(event.getDuration(), false);
+ }
+ // CraftBukkit end
if (!entity.hurt(DamageSource.fireball(this, entity1), 5.0F)) {
if (!entity.hurt(this.damageSources().fireball(this, entity1), 5.0F)) {
entity.setRemainingFireTicks(i);
} else if (entity1 instanceof EntityLiving) {
@@ -51,10 +65,10 @@

View File

@@ -26,16 +26,16 @@
public int getColor() {
return (Integer) this.entityData.get(EntityTippedArrow.ID_EFFECT_COLOR);
}
@@ -210,7 +229,7 @@
while (iterator.hasNext()) {
@@ -212,7 +231,7 @@
mobeffect = (MobEffect) iterator.next();
- entityliving.addEffect(new MobEffect(mobeffect.getEffect(), Math.max(mobeffect.getDuration() / 8, 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible()), entity);
+ entityliving.addEffect(new MobEffect(mobeffect.getEffect(), Math.max(mobeffect.getDuration() / 8, 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible()), entity, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
entityliving.addEffect(new MobEffect(mobeffect.getEffect(), Math.max(mobeffect.mapDuration((i) -> {
return i / 8;
- }), 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible()), entity);
+ }), 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible()), entity, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
}
if (!this.effects.isEmpty()) {
@@ -218,7 +237,7 @@
@@ -220,7 +239,7 @@
while (iterator.hasNext()) {
mobeffect = (MobEffect) iterator.next();

View File

@@ -18,16 +18,16 @@
}
}
} else {
@@ -80,7 +82,7 @@
@@ -81,7 +83,7 @@
}
if (b0 > 0) {
- ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.WITHER, 20 * b0, 1), this.getEffectSource());
+ ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.WITHER, 20 * b0, 1), this.getEffectSource(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
- entityliving.addEffect(new MobEffect(MobEffects.WITHER, 20 * b0, 1), this.getEffectSource());
+ entityliving.addEffect(new MobEffect(MobEffects.WITHER, 20 * b0, 1), this.getEffectSource(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
}
}
@@ -91,7 +93,15 @@
@@ -92,7 +94,15 @@
protected void onHit(MovingObjectPosition movingobjectposition) {
super.onHit(movingobjectposition);
if (!this.level.isClientSide) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/IProjectile.java
+++ b/net/minecraft/world/entity/projectile/IProjectile.java
@@ -23,6 +23,10 @@
@@ -24,6 +24,10 @@
import net.minecraft.world.phys.MovingObjectPositionEntity;
import net.minecraft.world.phys.Vec3D;
@@ -8,10 +8,10 @@
+import org.bukkit.projectiles.ProjectileSource;
+// CraftBukkit end
+
public abstract class IProjectile extends Entity {
public abstract class IProjectile extends Entity implements TraceableEntity {
@Nullable
@@ -32,6 +36,10 @@
@@ -33,6 +37,10 @@
private boolean leftOwner;
private boolean hasBeenShot;
@@ -22,7 +22,7 @@
IProjectile(EntityTypes<? extends IProjectile> entitytypes, World world) {
super(entitytypes, world);
}
@@ -41,6 +49,7 @@
@@ -42,6 +50,7 @@
this.ownerUUID = entity.getUUID();
this.cachedOwner = entity;
}
@@ -30,7 +30,7 @@
}
@@ -144,6 +153,16 @@
@@ -146,6 +155,16 @@
this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, entity.isOnGround() ? 0.0D : vec3d.y, vec3d.z));
}
@@ -47,7 +47,7 @@
protected void onHit(MovingObjectPosition movingobjectposition) {
MovingObjectPosition.EnumMovingObjectType movingobjectposition_enummovingobjecttype = movingobjectposition.getType();
@@ -164,6 +183,11 @@
@@ -166,6 +185,11 @@
protected void onHitEntity(MovingObjectPositionEntity movingobjectpositionentity) {}
protected void onHitBlock(MovingObjectPositionBlock movingobjectpositionblock) {

View File

@@ -14,9 +14,9 @@
public class ChestBoat extends EntityBoat implements HasCustomInventoryScreen, ContainerEntity {
@@ -218,4 +225,51 @@
public void clearItemStacks() {
this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY);
@@ -237,4 +244,51 @@
public void stopOpen(EntityHuman entityhuman) {
this.level.gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.a.of((Entity) entityhuman));
}
+
+ // CraftBukkit start

View File

@@ -97,7 +97,7 @@
super.push(entity);
}
@@ -276,6 +335,7 @@
@@ -279,6 +338,7 @@
return this.getDirection().getClockWise();
}
@@ -105,7 +105,7 @@
@Override
public void tick() {
this.oldStatus = this.status;
@@ -316,6 +376,22 @@
@@ -319,6 +379,22 @@
this.setDeltaMovement(Vec3D.ZERO);
}
@@ -128,9 +128,9 @@
this.tickBubbleColumn();
for (int i = 0; i <= 1; ++i) {
@@ -823,6 +899,11 @@
@@ -830,6 +906,11 @@
this.causeFallDamage(this.fallDistance, 1.0F, DamageSource.FALL);
this.causeFallDamage(this.fallDistance, 1.0F, this.damageSources().fall());
if (!this.level.isClientSide && !this.isRemoved()) {
+ // CraftBukkit start
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
@@ -140,7 +140,7 @@
this.kill();
if (this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
int i;
@@ -836,6 +917,7 @@
@@ -843,6 +924,7 @@
}
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java
+++ b/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java
@@ -22,6 +22,10 @@
@@ -23,6 +23,10 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.material.Fluid;
@@ -11,7 +11,7 @@
public class EntityMinecartTNT extends EntityMinecartAbstract {
private static final byte EVENT_PRIME = 10;
@@ -114,7 +118,15 @@
@@ -115,7 +119,15 @@
d1 = 5.0D;
}