Update to Minecraft 1.19

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2022-06-08 02:00:00 +10:00
parent 91d9aa9a89
commit 25f3b50f6b
332 changed files with 3628 additions and 2559 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -119,8 +119,64 @@
@@ -122,8 +122,64 @@
import net.minecraft.world.scores.ScoreboardTeamBase;
import org.slf4j.Logger;
@@ -65,7 +65,7 @@
private static final Logger LOGGER = LogUtils.getLogger();
public static final String ID_TAG = "id";
public static final String PASSENGERS_TAG = "Passengers";
@@ -231,6 +287,24 @@
@@ -234,6 +290,24 @@
public boolean hasVisualFire;
@Nullable
private IBlockData feetBlockState;
@@ -90,7 +90,7 @@
public Entity(EntityTypes<?> entitytypes, World world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
@@ -369,6 +443,12 @@
@@ -365,6 +439,12 @@
public void onClientRemoval() {}
public void setPose(EntityPose entitypose) {
@@ -103,7 +103,7 @@
this.entityData.set(Entity.DATA_POSE, entitypose);
}
@@ -385,6 +465,33 @@
@@ -389,6 +469,33 @@
}
protected void setRot(float f, float f1) {
@@ -137,7 +137,7 @@
this.setYRot(f % 360.0F);
this.setXRot(f1 % 360.0F);
}
@@ -426,6 +533,15 @@
@@ -430,6 +537,15 @@
this.baseTick();
}
@@ -153,7 +153,7 @@
public void baseTick() {
this.level.getProfiler().push("entityBaseTick");
this.feetBlockState = null;
@@ -440,7 +556,7 @@
@@ -444,7 +560,7 @@
this.walkDistO = this.walkDist;
this.xRotO = this.getXRot();
this.yRotO = this.getYRot();
@@ -162,7 +162,7 @@
if (this.canSpawnSprintParticle()) {
this.spawnSprintParticle();
}
@@ -475,6 +591,10 @@
@@ -479,6 +595,10 @@
if (this.isInLava()) {
this.lavaHurt();
this.fallDistance *= 0.5F;
@@ -173,7 +173,7 @@
}
this.checkOutOfWorld();
@@ -518,15 +638,48 @@
@@ -522,15 +642,48 @@
public void lavaHurt() {
if (!this.fireImmune()) {
@@ -223,7 +223,7 @@
int j = i * 20;
if (this instanceof EntityLiving) {
@@ -640,6 +793,28 @@
@@ -644,6 +797,28 @@
block.updateEntityAfterFallOn(this.level, this);
}
@@ -249,10 +249,10 @@
+ }
+ // CraftBukkit end
+
if (this.onGround && !this.isSteppingCarefully()) {
if (this.onGround) {
block.stepOn(this.level, blockposition, iblockdata, this);
}
@@ -1265,6 +1440,7 @@
@@ -1295,6 +1470,7 @@
this.yo = d1;
this.zo = d4;
this.setPos(d3, d1, d4);
@@ -260,7 +260,7 @@
}
public void moveTo(Vec3D vec3d) {
@@ -1455,6 +1631,12 @@
@@ -1485,6 +1661,12 @@
return false;
}
@@ -273,7 +273,7 @@
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
if (entity instanceof EntityPlayer) {
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
@@ -1488,7 +1670,7 @@
@@ -1518,7 +1700,7 @@
} else {
String s = this.getEncodeId();
@@ -282,7 +282,7 @@
return false;
} else {
nbttagcompound.putString("id", s);
@@ -1513,6 +1695,18 @@
@@ -1543,6 +1725,18 @@
Vec3D vec3d = this.getDeltaMovement();
nbttagcompound.put("Motion", this.newDoubleList(vec3d.x, vec3d.y, vec3d.z));
@@ -301,7 +301,7 @@
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
nbttagcompound.putFloat("FallDistance", this.fallDistance);
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
@@ -1521,6 +1715,22 @@
@@ -1551,6 +1745,22 @@
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
nbttagcompound.putUUID("UUID", this.getUUID());
@@ -324,7 +324,7 @@
IChatBaseComponent ichatbasecomponent = this.getCustomName();
if (ichatbasecomponent != null) {
@@ -1588,6 +1798,11 @@
@@ -1618,6 +1828,11 @@
}
}
@@ -336,7 +336,7 @@
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -1669,6 +1884,44 @@
@@ -1699,6 +1914,44 @@
} else {
throw new IllegalStateException("Entity has invalid position");
}
@@ -381,7 +381,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
@@ -1744,9 +1997,22 @@
@@ -1774,9 +2027,22 @@
} else if (this.level.isClientSide) {
return null;
} else {
@@ -404,7 +404,7 @@
this.level.addFreshEntity(entityitem);
return entityitem;
}
@@ -1840,7 +2106,7 @@
@@ -1870,7 +2136,7 @@
this.setPose(EntityPose.STANDING);
this.vehicle = entity;
@@ -413,7 +413,7 @@
entity.getIndirectPassengersStream().filter((entity2) -> {
return entity2 instanceof EntityPlayer;
}).forEach((entity2) -> {
@@ -1871,7 +2137,7 @@
@@ -1901,7 +2167,7 @@
Entity entity = this.vehicle;
this.vehicle = null;
@@ -422,7 +422,7 @@
}
}
@@ -1880,10 +2146,31 @@
@@ -1910,10 +2176,31 @@
this.removeVehicle();
}
@@ -455,7 +455,7 @@
if (this.passengers.isEmpty()) {
this.passengers = ImmutableList.of(entity);
} else {
@@ -1899,12 +2186,32 @@
@@ -1929,12 +2216,32 @@
}
}
@@ -489,7 +489,7 @@
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
this.passengers = ImmutableList.of();
} else {
@@ -1915,6 +2222,7 @@
@@ -1945,6 +2252,7 @@
entity.boardingCooldown = 60;
}
@@ -497,7 +497,7 @@
}
protected boolean canAddPassenger(Entity entity) {
@@ -1977,14 +2285,20 @@
@@ -2007,14 +2315,20 @@
if (this.isInsidePortal) {
MinecraftServer minecraftserver = worldserver.getServer();
@@ -521,7 +521,7 @@
this.level.getProfiler().pop();
}
@@ -2102,6 +2416,13 @@
@@ -2132,6 +2446,13 @@
}
public void setSwimming(boolean flag) {
@@ -535,7 +535,7 @@
this.setSharedFlag(4, flag);
}
@@ -2150,8 +2471,12 @@
@@ -2177,8 +2498,12 @@
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
}
@@ -549,7 +549,7 @@
}
public boolean getSharedFlag(int i) {
@@ -2170,7 +2495,7 @@
@@ -2197,7 +2522,7 @@
}
public int getMaxAirSupply() {
@@ -558,7 +558,7 @@
}
public int getAirSupply() {
@@ -2178,7 +2503,18 @@
@@ -2205,7 +2530,18 @@
}
public void setAirSupply(int i) {
@@ -578,7 +578,7 @@
}
public int getTicksFrozen() {
@@ -2205,11 +2541,41 @@
@@ -2232,11 +2568,41 @@
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
this.setRemainingFireTicks(this.remainingFireTicks + 1);
@@ -622,7 +622,7 @@
}
public void onAboveBubbleCol(boolean flag) {
@@ -2365,15 +2731,38 @@
@@ -2394,15 +2760,38 @@
@Nullable
public Entity changeDimension(WorldServer worldserver) {
@@ -663,7 +663,7 @@
this.level.getProfiler().popPush("reloading");
Entity entity = this.getType().create(worldserver);
@@ -2382,9 +2771,17 @@
@@ -2411,9 +2800,17 @@
entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
entity.setDeltaMovement(shapedetectorshape.speed);
worldserver.addDuringTeleport(entity);
@@ -683,7 +683,7 @@
}
this.removeAfterChangingDimensions();
@@ -2405,20 +2802,34 @@
@@ -2434,20 +2831,34 @@
@Nullable
protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) {
@@ -723,7 +723,7 @@
IBlockData iblockdata = this.level.getBlockState(this.portalEntrancePos);
EnumDirection.EnumAxis enumdirection_enumaxis;
Vec3D vec3d;
@@ -2435,8 +2846,8 @@
@@ -2464,8 +2875,8 @@
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
}
@@ -734,7 +734,7 @@
}
} else {
BlockPosition blockposition1;
@@ -2446,8 +2857,15 @@
@@ -2475,8 +2886,15 @@
} else {
blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos());
}
@@ -751,7 +751,7 @@
}
}
@@ -2455,8 +2873,23 @@
@@ -2484,8 +2902,23 @@
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
}
@@ -777,7 +777,7 @@
}
public boolean canChangeDimensions() {
@@ -2665,7 +3098,26 @@
@@ -2694,7 +3127,26 @@
}
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
@@ -805,7 +805,7 @@
}
protected float getEyeHeight(EntityPose entitypose, EntitySize entitysize) {
@@ -2949,6 +3401,11 @@
@@ -2982,6 +3434,11 @@
vec3d = vec3d.add(vec3d1);
++k1;
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityInsentient.java
+++ b/net/minecraft/world/entity/EntityInsentient.java
@@ -72,6 +72,19 @@
@@ -75,6 +75,19 @@
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.level.storage.loot.LootTableInfo;
@@ -20,7 +20,7 @@
public abstract class EntityInsentient extends EntityLiving {
private static final DataWatcherObject<Byte> DATA_MOB_FLAGS_ID = DataWatcher.defineId(EntityInsentient.class, DataWatcherRegistry.BYTE);
@@ -116,6 +129,8 @@
@@ -121,6 +134,8 @@
private BlockPosition restrictCenter;
private float restrictRadius;
@@ -29,7 +29,7 @@
protected EntityInsentient(EntityTypes<? extends EntityInsentient> entitytypes, World world) {
super(entitytypes, world);
this.handItems = NonNullList.withSize(2, ItemStack.EMPTY);
@@ -141,6 +156,12 @@
@@ -146,6 +161,12 @@
}
@@ -42,7 +42,7 @@
protected void registerGoals() {}
public static AttributeProvider.Builder createMobAttributes() {
@@ -219,7 +240,38 @@
@@ -224,7 +245,38 @@
}
public void setTarget(@Nullable EntityLiving entityliving) {
@@ -81,7 +81,7 @@
}
@Override
@@ -446,16 +498,26 @@
@@ -453,16 +505,26 @@
nbttagcompound.putBoolean("NoAI", this.isNoAi());
}
@@ -110,7 +110,7 @@
NBTTagList nbttaglist;
int i;
@@ -502,6 +564,11 @@
@@ -509,6 +571,11 @@
}
this.setNoAi(nbttagcompound.getBoolean("NoAI"));
@@ -122,7 +122,7 @@
}
@Override
@@ -565,7 +632,7 @@
@@ -577,7 +644,7 @@
protected void pickUpItem(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItem();
@@ -131,7 +131,7 @@
this.onItemPickup(entityitem);
this.take(entityitem, itemstack.getCount());
entityitem.discard();
@@ -574,15 +641,29 @@
@@ -586,15 +653,29 @@
}
public boolean equipItemIfPossible(ItemStack itemstack) {
@@ -162,7 +162,7 @@
}
this.setItemSlotAndDropWhenKilled(enumitemslot, itemstack);
@@ -721,6 +802,7 @@
@@ -732,6 +813,7 @@
@Override
protected final void serverAiStep() {
++this.noActionTime;
@@ -170,7 +170,7 @@
this.level.getProfiler().push("sensing");
this.sensing.tick();
this.level.getProfiler().pop();
@@ -1116,6 +1198,12 @@
@@ -1125,6 +1207,12 @@
if (!this.isAlive()) {
return EnumInteractionResult.PASS;
} else if (this.getLeashHolder() == entityhuman) {
@@ -183,7 +183,7 @@
this.dropLeash(true, !entityhuman.getAbilities().instabuild);
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
} else {
@@ -1134,6 +1222,12 @@
@@ -1148,6 +1236,12 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.LEAD) && this.canBeLeashed(entityhuman)) {
@@ -196,7 +196,7 @@
this.setLeashedTo(entityhuman, true);
itemstack.shrink(1);
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
@@ -1149,7 +1243,7 @@
@@ -1163,7 +1257,7 @@
if (itemstack.getItem() instanceof ItemMonsterEgg) {
if (this.level instanceof WorldServer) {
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
@@ -205,7 +205,7 @@
optional.ifPresent((entityinsentient) -> {
this.onOffspringSpawnedFromEgg(entityhuman, entityinsentient);
@@ -1199,12 +1293,19 @@
@@ -1213,12 +1307,19 @@
return this.restrictRadius != -1.0F;
}
@@ -226,7 +226,7 @@
t0.copyPosition(this);
t0.setBaby(this.isBaby());
@@ -1236,7 +1337,12 @@
@@ -1250,7 +1351,12 @@
}
}
@@ -240,7 +240,7 @@
if (this.isPassenger()) {
Entity entity = this.getVehicle();
@@ -1256,6 +1362,7 @@
@@ -1270,6 +1376,7 @@
if (this.leashHolder != null) {
if (!this.isAlive() || !this.leashHolder.isAlive()) {
@@ -248,7 +248,7 @@
this.dropLeash(true, true);
}
@@ -1267,7 +1374,9 @@
@@ -1281,7 +1388,9 @@
this.leashHolder = null;
this.leashInfoTag = null;
if (!this.level.isClientSide && flag1) {
@@ -258,7 +258,7 @@
}
if (!this.level.isClientSide && flag && this.level instanceof WorldServer) {
@@ -1317,6 +1426,7 @@
@@ -1331,6 +1440,7 @@
boolean flag1 = super.startRiding(entity, flag);
if (flag1 && this.isLeashed()) {
@@ -266,7 +266,7 @@
this.dropLeash(true, true);
}
@@ -1341,7 +1451,9 @@
@@ -1355,7 +1465,9 @@
}
if (this.tickCount > 100) {
@@ -276,7 +276,7 @@
this.leashInfoTag = null;
}
}
@@ -1412,7 +1524,14 @@
@@ -1432,7 +1544,14 @@
int i = EnchantmentManager.getFireAspect(this);
if (i > 0) {
@@ -292,7 +292,7 @@
}
boolean flag = entity.hurt(DamageSource.mobAttack(this), f);
@@ -1480,9 +1599,10 @@
@@ -1500,9 +1619,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
@@ -117,6 +117,30 @@
@@ -118,6 +118,30 @@
import net.minecraft.world.scores.ScoreboardTeam;
import org.slf4j.Logger;
@@ -31,10 +31,10 @@
public abstract class EntityLiving extends Entity {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -226,6 +250,20 @@
private float swimAmount;
@@ -228,6 +252,20 @@
private float swimAmountO;
protected BehaviorController<?> brain;
private boolean skipDropExperience;
+ // CraftBukkit start
+ public int expToDrop;
+ public boolean forceDrops;
@@ -52,7 +52,7 @@
protected EntityLiving(EntityTypes<? extends EntityLiving> entitytypes, World world) {
super(entitytypes, world);
@@ -238,7 +276,9 @@
@@ -240,7 +278,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();
@@ -305,7 +345,13 @@
@@ -307,7 +347,13 @@
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
int i = (int) (150.0D * d1);
@@ -78,24 +78,25 @@
}
}
@@ -655,9 +701,15 @@
@@ -661,10 +707,16 @@
}
protected void equipEventAndSound(ItemStack itemstack) {
public void onEquipItem(EnumItemSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1) {
+ // CraftBukkit start
+ this.equipEventAndSound(itemstack, false);
+ onEquipItem(enumitemslot, itemstack, itemstack1, false);
+ }
+
+ protected void equipEventAndSound(ItemStack itemstack, boolean silent) {
SoundEffect soundeffect = itemstack.getEquipSound();
+ public void onEquipItem(EnumItemSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1, boolean silent) {
+ // CraftBukkit end
boolean flag = itemstack1.isEmpty() && itemstack.isEmpty();
- if (!itemstack.isEmpty() && soundeffect != null && !this.isSpectator()) {
+ if (!itemstack.isEmpty() && soundeffect != null && !this.isSpectator() && !silent) {
+ // CraftBukkit end
this.gameEvent(GameEvent.EQUIP);
this.playSound(soundeffect, 1.0F, 1.0F);
}
@@ -719,6 +771,17 @@
if (!flag && !ItemStack.isSameIgnoreDurability(itemstack, itemstack1)) {
- if (enumitemslot.getType() == EnumItemSlot.Function.ARMOR) {
+ if (enumitemslot.getType() == EnumItemSlot.Function.ARMOR && !silent) { // CraftBukkit
this.playEquipSound(itemstack1);
}
@@ -742,6 +794,17 @@
}
}
@@ -113,7 +114,7 @@
if (nbttagcompound.contains("Health", 99)) {
this.setHealth(nbttagcompound.getFloat("Health"));
}
@@ -756,9 +819,32 @@
@@ -779,9 +842,32 @@
}
@@ -146,7 +147,7 @@
try {
while (iterator.hasNext()) {
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
@@ -768,6 +854,12 @@
@@ -791,6 +877,12 @@
this.onEffectUpdated(mobeffect, true, (Entity) null);
})) {
if (!this.level.isClientSide) {
@@ -159,7 +160,7 @@
iterator.remove();
this.onEffectRemoved(mobeffect);
}
@@ -778,6 +870,17 @@
@@ -801,6 +893,17 @@
} catch (ConcurrentModificationException concurrentmodificationexception) {
;
}
@@ -177,7 +178,7 @@
if (this.effectsDirty) {
if (!this.level.isClientSide) {
@@ -904,7 +1007,13 @@
@@ -927,7 +1030,13 @@
this.entityData.set(EntityLiving.DATA_EFFECT_COLOR_ID, 0);
}
@@ -191,7 +192,7 @@
if (this.level.isClientSide) {
return false;
} else {
@@ -913,7 +1022,14 @@
@@ -936,7 +1045,14 @@
boolean flag;
for (flag = false; iterator.hasNext(); flag = true) {
@@ -207,7 +208,7 @@
iterator.remove();
}
@@ -942,18 +1058,48 @@
@@ -965,18 +1081,48 @@
return this.addEffect(mobeffect, (Entity) null);
}
@@ -257,7 +258,7 @@
return true;
} else {
return false;
@@ -990,13 +1136,39 @@
@@ -1013,13 +1159,39 @@
return this.getMobType() == EnumMonsterType.UNDEAD;
}
@@ -298,7 +299,7 @@
if (mobeffect != null) {
this.onEffectRemoved(mobeffect);
@@ -1033,20 +1205,55 @@
@@ -1056,20 +1228,55 @@
}
@@ -355,7 +356,7 @@
this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.clamp(f, 0.0F, this.getMaxHealth()));
}
@@ -1060,7 +1267,7 @@
@@ -1083,7 +1290,7 @@
return false;
} else if (this.level.isClientSide) {
return false;
@@ -364,7 +365,7 @@
return false;
} else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
return false;
@@ -1071,10 +1278,11 @@
@@ -1094,10 +1301,11 @@
this.noActionTime = 0;
float f1 = f;
@@ -378,7 +379,7 @@
this.hurtCurrentlyUsedShield(f);
f2 = f;
f = 0.0F;
@@ -1092,27 +1300,46 @@
@@ -1115,27 +1323,46 @@
this.animationSpeed = 1.5F;
boolean flag1 = true;
@@ -430,7 +431,7 @@
this.hurtDir = 0.0F;
Entity entity1 = damagesource.getEntity();
@@ -1235,19 +1462,29 @@
@@ -1258,19 +1485,29 @@
EnumHand[] aenumhand = EnumHand.values();
int i = aenumhand.length;
@@ -464,7 +465,7 @@
EntityPlayer entityplayer = (EntityPlayer) this;
entityplayer.awardStat(StatisticList.ITEM_USED.get(Items.TOTEM_OF_UNDYING));
@@ -1255,14 +1492,16 @@
@@ -1278,14 +1515,16 @@
}
this.setHealth(1.0F);
@@ -486,7 +487,7 @@
}
}
@@ -1367,14 +1606,22 @@
@@ -1390,14 +1629,22 @@
IBlockData iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
@@ -511,7 +512,7 @@
this.level.addFreshEntity(entityitem);
}
}
@@ -1394,21 +1641,40 @@
@@ -1417,21 +1664,40 @@
boolean flag = this.lastHurtByPlayerTime > 0;
@@ -535,9 +536,9 @@
- protected void dropExperience() {
+ // CraftBukkit start
+ public int getExpReward() {
if (this.level instanceof WorldServer && (this.isAlwaysExperienceDropper() || this.lastHurtByPlayerTime > 0 && this.shouldDropExperience() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT))) {
- EntityExperienceOrb.award((WorldServer) this.level, this.position(), this.getExperienceReward(this.lastHurtByPlayer));
+ int i = this.getExperienceReward(this.lastHurtByPlayer);
if (this.level instanceof WorldServer && !this.wasExperienceConsumed() && (this.isAlwaysExperienceDropper() || this.lastHurtByPlayerTime > 0 && this.shouldDropExperience() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT))) {
- EntityExperienceOrb.award((WorldServer) this.level, this.position(), this.getExperienceReward());
+ int i = this.getExperienceReward();
+ return i;
+ } else {
+ return 0;
@@ -555,7 +556,7 @@
}
@@ -1528,9 +1794,14 @@
@@ -1559,9 +1825,14 @@
int i = this.calculateFallDamage(f, f1);
if (i > 0) {
@@ -571,7 +572,7 @@
return true;
} else {
return flag;
@@ -1579,7 +1850,7 @@
@@ -1610,7 +1881,7 @@
protected float getDamageAfterArmorAbsorb(DamageSource damagesource, float f) {
if (!damagesource.isBypassArmor()) {
@@ -580,7 +581,7 @@
f = CombatMath.getDamageAfterAbsorb(f, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
}
@@ -1592,7 +1863,8 @@
@@ -1623,7 +1894,8 @@
} else {
int i;
@@ -590,7 +591,7 @@
i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
@@ -1623,29 +1895,172 @@
@@ -1656,29 +1928,172 @@
}
}
@@ -744,7 +745,7 @@
+ if (!human) {
+ this.setAbsorptionAmount(this.getAbsorptionAmount() - f);
+ }
this.gameEvent(GameEvent.ENTITY_DAMAGED, damagesource.getEntity());
this.gameEvent(GameEvent.ENTITY_DAMAGE);
+
+ return true;
+ } else {
@@ -773,7 +774,7 @@
}
public CombatTracker getCombatTracker() {
@@ -1666,8 +2081,18 @@
@@ -1699,8 +2114,18 @@
}
public final void setArrowCount(int i) {
@@ -793,7 +794,7 @@
public final int getStingerCount() {
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
@@ -1963,6 +2388,12 @@
@@ -1996,6 +2421,12 @@
public abstract ItemStack getItemBySlot(EnumItemSlot enumitemslot);
@@ -806,7 +807,7 @@
@Override
public abstract void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
@@ -2206,6 +2637,7 @@
@@ -2239,6 +2670,7 @@
}
if (this.onGround && !this.level.isClientSide) {
@@ -814,7 +815,7 @@
this.setSharedFlag(7, false);
}
} else {
@@ -2736,6 +3168,7 @@
@@ -2769,6 +3201,7 @@
}
if (!this.level.isClientSide) {
@@ -822,7 +823,7 @@
this.setSharedFlag(7, flag);
}
@@ -2895,14 +3328,21 @@
@@ -2928,14 +3361,21 @@
@Override
public boolean isPickable() {
@@ -846,7 +847,7 @@
@Override
public float getYHeadRot() {
return this.yHeadRot;
@@ -3096,7 +3536,25 @@
@@ -3130,7 +3570,25 @@
} else {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
this.triggerItemUseEffects(this.useItem, 16);
@@ -873,7 +874,7 @@
if (itemstack != this.useItem) {
this.setItemInHand(enumhand, itemstack);
@@ -3169,6 +3627,12 @@
@@ -3208,6 +3666,12 @@
}
public boolean randomTeleport(double d0, double d1, double d2, boolean flag) {
@@ -886,7 +887,7 @@
double d3 = this.getX();
double d4 = this.getY();
double d5 = this.getZ();
@@ -3193,16 +3657,41 @@
@@ -3232,16 +3696,41 @@
}
if (flag2) {
@@ -931,7 +932,7 @@
} else {
if (flag) {
world.broadcastEntityEvent(this, (byte) 46);
@@ -3212,7 +3701,7 @@
@@ -3251,7 +3740,7 @@
((EntityCreature) this).getNavigation().stop();
}
@@ -940,7 +941,7 @@
}
}
@@ -3295,7 +3784,7 @@
@@ -3334,7 +3823,7 @@
}
public void stopSleeping() {
@@ -949,7 +950,7 @@
World world = this.level;
java.util.Objects.requireNonNull(this.level);
@@ -3327,7 +3816,7 @@
@@ -3366,7 +3855,7 @@
@Nullable
public EnumDirection getBedOrientation() {
@@ -958,7 +959,7 @@
return blockposition != null ? BlockBed.getBedOrientation(this.level, blockposition) : null;
}
@@ -3376,7 +3865,7 @@
@@ -3414,7 +3903,7 @@
Pair<MobEffect, Float> pair = (Pair) iterator.next();
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {
@@ -967,23 +968,3 @@
}
}
}
@@ -3479,8 +3968,10 @@
this.setDeltaMovement((double) ((float) packetplayoutspawnentityliving.getXd() / 8000.0F), (double) ((float) packetplayoutspawnentityliving.getYd() / 8000.0F), (double) ((float) packetplayoutspawnentityliving.getZd() / 8000.0F));
}
- public static record a(SoundEffect a, SoundEffect b) {
+ // CraftBukkit start - decompile error
+ public static record a(SoundEffect small, SoundEffect big) {
+ /*
private final SoundEffect small;
private final SoundEffect big;
@@ -3496,5 +3987,7 @@
public SoundEffect big() {
return this.big;
}
+ */
+ // CraftBukkit end
}
}

View File

@@ -1,15 +1,15 @@
--- a/net/minecraft/world/entity/EntityTypes.java
+++ b/net/minecraft/world/entity/EntityTypes.java
@@ -154,7 +154,7 @@
public static final String ENTITY_TAG = "EntityTag";
@@ -159,7 +159,7 @@
private final Holder.c<EntityTypes<?>> builtInRegistryHolder;
private static final float MAGIC_HORSE_WIDTH = 1.3964844F;
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));
@@ -284,8 +284,8 @@
@@ -293,8 +293,8 @@
private MinecraftKey lootTable;
private final EntitySize dimensions;
@@ -20,7 +20,7 @@
}
public static MinecraftKey getKey(EntityTypes<?> entitytypes) {
@@ -317,10 +317,18 @@
@@ -326,10 +326,18 @@
@Nullable
public T spawn(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
@@ -40,7 +40,7 @@
}
return t0;
@@ -356,7 +364,7 @@
@@ -365,7 +373,7 @@
t0.setCustomName(ichatbasecomponent);
}
@@ -49,7 +49,7 @@
return t0;
}
}
@@ -513,7 +521,7 @@
@@ -512,7 +520,7 @@
}
return entity;
@@ -58,7 +58,7 @@
}
public static Stream<Entity> loadEntitiesRecursive(final List<? extends NBTBase> list, final World world) {
@@ -570,7 +578,7 @@
@@ -569,7 +577,7 @@
@Nullable
public T tryCast(Entity entity) {
@@ -67,7 +67,7 @@
}
@Override
@@ -603,7 +611,7 @@
@@ -602,7 +610,7 @@
this.canSpawnFarFromPlayer = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC;
}

View File

@@ -1,11 +0,0 @@
--- a/net/minecraft/world/entity/ai/attributes/AttributeRanged.java
+++ b/net/minecraft/world/entity/ai/attributes/AttributeRanged.java
@@ -30,6 +30,8 @@
@Override
public double sanitizeValue(double d0) {
+ if (d0 != d0) return getDefaultValue(); // CraftBukkit
+
d0 = MathHelper.clamp(d0, this.minValue, this.maxValue);
return d0;
}

View File

@@ -13,7 +13,7 @@
public class BehaviorAttackTargetForget<E extends EntityInsentient> extends Behavior<E> {
private static final int TIMEOUT_TO_GET_WITHIN_ATTACK_RANGE = 200;
@@ -77,6 +83,17 @@
@@ -83,6 +89,17 @@
}
protected void clearAttackTarget(E e0) {
@@ -28,6 +28,6 @@
+ return;
+ }
+ // CraftBukkit end
this.onTargetErased.accept(e0);
this.onTargetErased.accept(e0, this.getAttackTarget(e0));
e0.getBrain().eraseMemory(MemoryModuleType.ATTACK_TARGET);
}

View File

@@ -14,17 +14,17 @@
public class BehaviorAttackTargetSet<E extends EntityInsentient> extends Behavior<E> {
private final Predicate<E> canAttackPredicate;
@@ -38,13 +45,21 @@
@@ -42,13 +49,21 @@
}
protected void start(WorldServer worldserver, E e0, long i) {
- ((Optional) this.targetFinderFunction.apply(e0)).ifPresent((entityliving) -> {
+ (this.targetFinderFunction.apply(e0)).ifPresent((entityliving) -> { // CraftBukkit - decompile error
this.setAttackTarget(e0, entityliving);
setAttackTarget(e0, entityliving);
});
}
private void setAttackTarget(E e0, EntityLiving entityliving) {
public static <E extends EntityInsentient> void setAttackTarget(E e0, EntityLiving entityliving) {
- e0.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, (Object) entityliving);
+ // CraftBukkit start
+ EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(e0, entityliving, (entityliving instanceof EntityPlayer) ? EntityTargetEvent.TargetReason.CLOSEST_PLAYER : EntityTargetEvent.TargetReason.CLOSEST_ENTITY);

View File

@@ -23,7 +23,7 @@
if (entityvillager.getVillagerData().getProfession() == VillagerProfession.NONE) {
MinecraftServer minecraftserver = worldserver.getServer();
@@ -40,7 +46,14 @@
return villagerprofession.getJobPoiType() == villageplacetype;
return villagerprofession.heldJobSite().test(holder);
}).findFirst();
}).ifPresent((villagerprofession) -> {
- entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(villagerprofession));

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/behavior/BehaviorFarm.java
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorFarm.java
@@ -79,8 +79,8 @@
@@ -80,8 +80,8 @@
protected void start(WorldServer worldserver, EntityVillager entityvillager, long i) {
if (i > this.nextOkStartTime && this.aboveFarmlandPos != null) {
@@ -11,7 +11,7 @@
}
}
@@ -100,7 +100,11 @@
@@ -101,7 +101,11 @@
Block block1 = worldserver.getBlockState(this.aboveFarmlandPos.below()).getBlock();
if (block instanceof BlockCrops && ((BlockCrops) block).isMaxAge(iblockdata)) {
@@ -24,40 +24,45 @@
}
if (iblockdata.isAir() && block1 instanceof BlockSoil && entityvillager.hasFarmSeeds()) {
@@ -111,19 +115,28 @@
boolean flag = false;
@@ -114,27 +118,30 @@
if (!itemstack.isEmpty()) {
IBlockData iblockdata1;
+ // CraftBukkit start
+ Block planted = null;
if (itemstack.is(Items.WHEAT_SEEDS)) {
- worldserver.setBlock(this.aboveFarmlandPos, Blocks.WHEAT.defaultBlockState(), 3);
+ planted = Blocks.WHEAT;
iblockdata1 = Blocks.WHEAT.defaultBlockState();
- worldserver.setBlockAndUpdate(this.aboveFarmlandPos, iblockdata1);
- worldserver.gameEvent(GameEvent.BLOCK_PLACE, this.aboveFarmlandPos, GameEvent.a.of(entityvillager, iblockdata1));
flag = true;
} else if (itemstack.is(Items.POTATO)) {
- worldserver.setBlock(this.aboveFarmlandPos, Blocks.POTATOES.defaultBlockState(), 3);
+ planted = Blocks.POTATOES;
iblockdata1 = Blocks.POTATOES.defaultBlockState();
- worldserver.setBlockAndUpdate(this.aboveFarmlandPos, iblockdata1);
- worldserver.gameEvent(GameEvent.BLOCK_PLACE, this.aboveFarmlandPos, GameEvent.a.of(entityvillager, iblockdata1));
flag = true;
} else if (itemstack.is(Items.CARROT)) {
- worldserver.setBlock(this.aboveFarmlandPos, Blocks.CARROTS.defaultBlockState(), 3);
+ planted = Blocks.CARROTS;
iblockdata1 = Blocks.CARROTS.defaultBlockState();
- worldserver.setBlockAndUpdate(this.aboveFarmlandPos, iblockdata1);
- worldserver.gameEvent(GameEvent.BLOCK_PLACE, this.aboveFarmlandPos, GameEvent.a.of(entityvillager, iblockdata1));
flag = true;
} else if (itemstack.is(Items.BEETROOT_SEEDS)) {
- worldserver.setBlock(this.aboveFarmlandPos, Blocks.BEETROOTS.defaultBlockState(), 3);
+ planted = Blocks.BEETROOTS;
flag = true;
}
iblockdata1 = Blocks.BEETROOTS.defaultBlockState();
+ flag = true;
+ } else {
+ iblockdata1 = null;
+ }
+
+ if (planted != null && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.aboveFarmlandPos, planted.defaultBlockState()).isCancelled()) {
+ worldserver.setBlock(this.aboveFarmlandPos, planted.defaultBlockState(), 3);
+ if (iblockdata1 != null && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.aboveFarmlandPos, iblockdata1).isCancelled()) {
worldserver.setBlockAndUpdate(this.aboveFarmlandPos, iblockdata1);
worldserver.gameEvent(GameEvent.BLOCK_PLACE, this.aboveFarmlandPos, GameEvent.a.of(entityvillager, iblockdata1));
- flag = true;
+ } else {
+ flag = false;
+ }
}
+ // CraftBukkit end
}
if (flag) {
@@ -142,8 +155,8 @@
@@ -153,8 +160,8 @@
this.aboveFarmlandPos = this.getValidFarmland(worldserver);
if (this.aboveFarmlandPos != null) {
this.nextOkStartTime = i + 20L;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/behavior/BehaviorMakeLove.java
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorMakeLove.java
@@ -112,11 +112,16 @@
@@ -116,11 +116,16 @@
if (entityvillager2 == null) {
return Optional.empty();
} else {
@@ -20,7 +20,7 @@
worldserver.broadcastEntityEvent(entityvillager2, (byte) 12);
return Optional.of(entityvillager2);
}
@@ -125,6 +130,6 @@
@@ -129,6 +134,6 @@
private void giveBedToChild(WorldServer worldserver, EntityVillager entityvillager, BlockPosition blockposition) {
GlobalPos globalpos = GlobalPos.of(worldserver.dimension(), blockposition);

View File

@@ -9,33 +9,28 @@
}
private static void setWalkAndLookTargetMemoriesToEachOther(EntityLiving entityliving, EntityLiving entityliving1, float f) {
@@ -74,18 +74,19 @@
public static void setWalkAndLookTargetMemories(EntityLiving entityliving, Entity entity, float f, int i) {
MemoryTarget memorytarget = new MemoryTarget(new BehaviorPositionEntity(entity, false), f, i);
@@ -82,8 +82,8 @@
public static void setWalkAndLookTargetMemories(EntityLiving entityliving, BehaviorPosition behaviorposition, float f, int i) {
MemoryTarget memorytarget = new MemoryTarget(behaviorposition, f, i);
- entityliving.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorPositionEntity(entity, true)));
- entityliving.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (Object) behaviorposition);
- entityliving.getBrain().setMemory(MemoryModuleType.WALK_TARGET, (Object) memorytarget);
+ entityliving.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorPositionEntity(entity, true))); // CraftBukkit - decompile error
+ entityliving.getBrain().setMemory(MemoryModuleType.WALK_TARGET, memorytarget); // CraftBukkit - decompile error
}
public static void setWalkAndLookTargetMemories(EntityLiving entityliving, BlockPosition blockposition, float f, int i) {
MemoryTarget memorytarget = new MemoryTarget(new BehaviorTarget(blockposition), f, i);
- entityliving.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(blockposition)));
- entityliving.getBrain().setMemory(MemoryModuleType.WALK_TARGET, (Object) memorytarget);
+ entityliving.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(blockposition))); // CraftBukkit - decompile error
+ entityliving.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, behaviorposition); // CraftBukkit - decompile error
+ entityliving.getBrain().setMemory(MemoryModuleType.WALK_TARGET, memorytarget); // CraftBukkit - decompile error
}
public static void throwItem(EntityLiving entityliving, ItemStack itemstack, Vec3D vec3d) {
@@ -93,6 +93,7 @@
}
public static void throwItem(EntityLiving entityliving, ItemStack itemstack, Vec3D vec3d, Vec3D vec3d1, float f) {
+ if (itemstack.isEmpty()) return; // CraftBukkit - SPIGOT-4940: no empty loot
double d0 = entityliving.getEyeY() - 0.30000001192092896D;
double d0 = entityliving.getEyeY() - (double) f;
EntityItem entityitem = new EntityItem(entityliving.level, entityliving.getX(), d0, entityliving.getZ(), itemstack);
float f = 0.3F;
@@ -94,12 +95,19 @@
vec3d1 = vec3d1.normalize().scale(0.30000001192092896D);
entityitem.setDeltaMovement(vec3d1);
@@ -102,12 +103,19 @@
vec3d2 = vec3d2.normalize().multiply(vec3d1.x, vec3d1.y, vec3d1.z);
entityitem.setDeltaMovement(vec3d2);
entityitem.setDefaultPickUpDelay();
+ // CraftBukkit start
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(entityliving.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalEatTile.java
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalEatTile.java
@@ -12,6 +12,10 @@
@@ -11,6 +11,10 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.block.state.predicate.BlockStatePredicate;
import net.minecraft.world.level.gameevent.GameEvent;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -11,7 +11,7 @@
public class PathfinderGoalEatTile extends PathfinderGoal {
private static final int EAT_ANIMATION_TICKS = 40;
@@ -65,7 +69,8 @@
@@ -64,7 +68,8 @@
BlockPosition blockposition = this.mob.blockPosition();
if (PathfinderGoalEatTile.IS_TALL_GRASS.test(this.level.getBlockState(blockposition))) {
@@ -21,7 +21,7 @@
this.level.destroyBlock(blockposition, false);
}
@@ -75,7 +80,8 @@
@@ -73,7 +78,8 @@
BlockPosition blockposition1 = blockposition.below();
if (this.level.getBlockState(blockposition1).is(Blocks.GRASS_BLOCK)) {

View File

@@ -6,7 +6,7 @@
+// CraftBukkit start
+import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
+import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntityLiving;
+import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.event.player.PlayerBucketEntityEvent;
@@ -30,7 +30,7 @@
+ itemstack1 = CraftItemStack.asNMSCopy(playerBucketFishEvent.getEntityBucket());
+ if (playerBucketFishEvent.isCancelled()) {
+ ((EntityPlayer) entityhuman).containerMenu.sendAllDataToRemote(); // We need to update inventory to resync client's bucket
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutSpawnEntityLiving(t0)); // We need to play out these packets as the client assumes the fish is gone
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutSpawnEntity(t0)); // We need to play out these packets as the client assumes the fish is gone
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutEntityMetadata(t0.getId(), t0.getEntityData(), true)); // Need to send data such as the display name to client
+ return Optional.of(EnumInteractionResult.FAIL);
+ }

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/animal/EntityAnimal.java
+++ b/net/minecraft/world/entity/animal/EntityAnimal.java
@@ -30,12 +30,19 @@
import net.minecraft.world.level.gameevent.GameEvent;
@@ -29,12 +29,19 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.pathfinder.PathType;
+// CraftBukkit start
@@ -12,7 +12,7 @@
+
public abstract class EntityAnimal extends EntityAgeable {
static final int PARENT_AGE_AFTER_BREEDING = 6000;
protected static final int PARENT_AGE_AFTER_BREEDING = 6000;
public int inLove;
@Nullable
public UUID loveCause;
@@ -20,7 +20,7 @@
protected EntityAnimal(EntityTypes<? extends EntityAnimal> entitytypes, World world) {
super(entitytypes, world);
@@ -72,6 +79,9 @@
@@ -71,6 +78,9 @@
}
@@ -30,7 +30,7 @@
@Override
public boolean hurt(DamageSource damagesource, float f) {
if (this.isInvulnerableTo(damagesource)) {
@@ -81,6 +91,7 @@
@@ -80,6 +90,7 @@
return super.hurt(damagesource, f);
}
}
@@ -38,7 +38,7 @@
@Override
public float getWalkTargetValue(BlockPosition blockposition, IWorldReader iworldreader) {
@@ -177,10 +188,17 @@
@@ -174,10 +185,17 @@
}
public void setInLove(@Nullable EntityHuman entityhuman) {
@@ -57,7 +57,7 @@
this.level.broadcastEntityEvent(this, (byte) 18);
}
@@ -225,6 +243,16 @@
@@ -222,6 +240,16 @@
if (entityplayer == null && entityanimal.getLoveCause() != null) {
entityplayer = entityanimal.getLoveCause();
}
@@ -74,7 +74,7 @@
if (entityplayer != null) {
entityplayer.awardStat(StatisticList.ANIMALS_BRED);
@@ -235,12 +263,14 @@
@@ -232,12 +260,14 @@
entityanimal.setAge(6000);
this.resetLove();
entityanimal.resetLove();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityBee.java
+++ b/net/minecraft/world/entity/animal/EntityBee.java
@@ -242,7 +242,7 @@
@@ -243,7 +243,7 @@
}
if (b0 > 0) {
@@ -9,7 +9,7 @@
}
}
@@ -642,11 +642,15 @@
@@ -643,11 +643,15 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {
@@ -27,7 +27,7 @@
}
}
@@ -1222,7 +1226,7 @@
@@ -1223,7 +1227,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();
@@ -1295,7 +1299,7 @@
@@ -1296,7 +1300,7 @@
@Override
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
if (entityinsentient instanceof EntityBee && this.mob.hasLineOfSight(entityliving)) {
@@ -45,7 +45,7 @@
}
}
@@ -1304,7 +1308,7 @@
@@ -1305,7 +1309,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
@@ -443,7 +443,7 @@
@@ -410,7 +410,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);
@@ -500,7 +500,7 @@
@@ -467,7 +467,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) {
@@ -641,7 +641,15 @@
@@ -608,7 +608,15 @@
while (iterator.hasNext()) {
ItemStack itemstack = (ItemStack) iterator.next();
@@ -35,7 +35,7 @@
}
}
@@ -673,10 +681,10 @@
@@ -640,10 +648,10 @@
private final EntityCat cat;
public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) {

View File

@@ -1,12 +1,12 @@
--- a/net/minecraft/world/entity/animal/EntityChicken.java
+++ b/net/minecraft/world/entity/animal/EntityChicken.java
@@ -94,7 +94,9 @@
@@ -95,7 +95,9 @@
this.flap += this.flapping * 2.0F;
if (!this.level.isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0) {
this.playSound(SoundEffects.CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
+ this.forceDrops = true; // CraftBukkit
this.spawnAtLocation((IMaterial) Items.EGG);
+ this.forceDrops = false; // CraftBukkit
this.gameEvent(GameEvent.ENTITY_PLACE);
this.eggTime = this.random.nextInt(6000) + 6000;
}

View File

@@ -34,7 +34,7 @@
+ // CraftBukkit end
this.onItemPickup(entityitem);
this.setItemSlot(EnumItemSlot.MAINHAND, itemstack);
this.handDropChances[EnumItemSlot.MAINHAND.getIndex()] = 2.0F;
this.setGuaranteedDrop(EnumItemSlot.MAINHAND);
@@ -389,7 +401,7 @@
@Override

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityFox.java
+++ b/net/minecraft/world/entity/animal/EntityFox.java
@@ -509,7 +509,8 @@
@@ -511,7 +511,8 @@
protected void pickUpItem(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItem();
@@ -10,7 +10,7 @@
int i = itemstack.getCount();
if (i > 1) {
@@ -864,6 +865,16 @@
@@ -866,6 +867,16 @@
if (entityplayer1 != null && entityplayer != entityplayer1) {
entityfox.addTrustedUUID(entityplayer1.getUUID());
}
@@ -27,7 +27,7 @@
if (entityplayer2 != null) {
entityplayer2.awardStat(StatisticList.ANIMALS_BRED);
@@ -874,12 +885,14 @@
@@ -876,12 +887,14 @@
this.partner.setAge(6000);
this.animal.resetLove();
this.partner.resetLove();
@@ -46,7 +46,7 @@
}
}
@@ -1270,13 +1283,18 @@
@@ -1272,13 +1285,18 @@
}
private void pickGlowBerry(IBlockData iblockdata) {
@@ -66,7 +66,7 @@
int j = 1 + EntityFox.this.level.random.nextInt(2) + (i == 3 ? 1 : 0);
ItemStack itemstack = EntityFox.this.getItemBySlot(EnumItemSlot.MAINHAND);
@@ -1433,7 +1451,7 @@
@@ -1435,7 +1453,7 @@
private EntityLiving trustedLastHurt;
private int timestamp;

View File

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

View File

@@ -24,7 +24,7 @@
+ }
+ // CraftBukkit end
this.shear(SoundCategory.PLAYERS);
this.gameEvent(GameEvent.SHEAR, (Entity) entityhuman);
this.gameEvent(GameEvent.SHEAR, entityhuman);
if (!this.level.isClientSide) {
@@ -163,7 +175,7 @@
this.level.playSound((EntityHuman) null, (Entity) this, SoundEffects.MOOSHROOM_SHEAR, soundcategory, 1.0F, 1.0F);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityParrot.java
+++ b/net/minecraft/world/entity/animal/EntityParrot.java
@@ -256,7 +256,7 @@
@@ -257,7 +257,7 @@
}
if (!this.level.isClientSide) {
@@ -9,7 +9,7 @@
this.tame(entityhuman);
this.level.broadcastEntityEvent(this, (byte) 7);
} else {
@@ -270,7 +270,7 @@
@@ -271,7 +271,7 @@
itemstack.shrink(1);
}
@@ -18,7 +18,7 @@
if (entityhuman.isCreative() || !this.isInvulnerable()) {
this.hurt(DamageSource.playerAttack(entityhuman), Float.MAX_VALUE);
}
@@ -382,7 +382,7 @@
@@ -383,7 +383,7 @@
@Override
public boolean isPushable() {
@@ -27,7 +27,7 @@
}
@Override
@@ -398,7 +398,7 @@
@@ -399,7 +399,7 @@
return false;
} else {
if (!this.level.isClientSide) {

View File

@@ -11,7 +11,7 @@
public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable {
private static final DataWatcherObject<Boolean> DATA_SADDLE_ID = DataWatcher.defineId(EntityPig.class, DataWatcherRegistry.BOOLEAN);
@@ -250,7 +254,13 @@
@@ -249,7 +253,13 @@
}
entitypigzombie.setPersistenceRequired();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityRabbit.java
+++ b/net/minecraft/world/entity/animal/EntityRabbit.java
@@ -89,8 +89,14 @@
@@ -90,8 +90,14 @@
super(entitytypes, world);
this.jumpControl = new EntityRabbit.ControllerJumpRabbit(this);
this.moveControl = new EntityRabbit.ControllerMoveRabbit(this);
@@ -15,7 +15,7 @@
@Override
public void registerGoals() {
@@ -558,9 +564,23 @@
@@ -559,9 +565,23 @@
int i = (Integer) iblockdata.getValue(BlockCarrots.AGE);
if (i == 0) {

View File

@@ -25,7 +25,7 @@
+ }
+ // CraftBukkit end
this.shear(SoundCategory.PLAYERS);
this.gameEvent(GameEvent.SHEAR, (Entity) entityhuman);
this.gameEvent(GameEvent.SHEAR, entityhuman);
itemstack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
@@ -243,7 +256,9 @@
int i = 1 + this.random.nextInt(3);
@@ -47,10 +47,10 @@
+
+ if (event.isCancelled()) return;
+ // CraftBukkit end
super.ate();
this.setSheared(false);
if (this.isBaby()) {
this.ageUp(60);
@@ -351,7 +372,7 @@
@@ -352,7 +373,7 @@
EnumColor enumcolor = ((EntitySheep) entityanimal).getColor();
EnumColor enumcolor1 = ((EntitySheep) entityanimal1).getColor();
InventoryCrafting inventorycrafting = makeContainer(enumcolor, enumcolor1);
@@ -59,7 +59,7 @@
return recipecrafting.assemble(inventorycrafting);
}).map(ItemStack::getItem);
@@ -369,10 +390,18 @@
@@ -375,10 +396,18 @@
public boolean stillValid(EntityHuman entityhuman) {
return false;
}

View File

@@ -20,16 +20,20 @@
}
if (!this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
@@ -119,7 +123,7 @@
@@ -119,7 +123,11 @@
BlockPosition blockposition1 = new BlockPosition(i, j, k);
if (this.level.getBlockState(blockposition1).isAir() && iblockdata.canSurvive(this.level, blockposition1)) {
- this.level.setBlockAndUpdate(blockposition1, iblockdata);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.level, blockposition1, iblockdata, this); // CraftBukkit
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.level, blockposition1, iblockdata, this)) {
+ continue;
+ }
+ // CraftBukkit end
this.level.gameEvent(GameEvent.BLOCK_PLACE, blockposition1, GameEvent.a.of(this, iblockdata));
}
}
}
@@ -150,6 +154,11 @@
@@ -151,6 +159,11 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
@@ -39,9 +43,9 @@
+ }
+ // CraftBukkit end
this.shear(SoundCategory.PLAYERS);
this.gameEvent(GameEvent.SHEAR, (Entity) entityhuman);
this.gameEvent(GameEvent.SHEAR, entityhuman);
if (!this.level.isClientSide) {
@@ -169,7 +178,9 @@
@@ -170,7 +183,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
@@ -309,7 +309,9 @@
@@ -307,7 +307,9 @@
protected void ageBoundaryReached() {
super.ageBoundaryReached();
if (!this.isBaby() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
@@ -10,7 +10,7 @@
}
}
@@ -336,7 +338,9 @@
@@ -334,7 +336,9 @@
@Override
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
@@ -20,7 +20,7 @@
}
private static class e extends ControllerMove {
@@ -482,8 +486,12 @@
@@ -480,8 +484,12 @@
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
World world = this.turtle.level;

View File

@@ -61,10 +61,10 @@
- this.heal((float) item.getFoodProperties().getNutrition());
+ this.heal((float) item.getFoodProperties().getNutrition(), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit
this.gameEvent(GameEvent.MOB_INTERACT, this.eyeBlockPosition());
return EnumInteractionResult.SUCCESS;
}
@@ -361,7 +384,7 @@
@@ -360,7 +383,7 @@
this.setOrderedToSit(!this.isOrderedToSit());
this.jumping = false;
this.navigation.stop();
@@ -73,7 +73,7 @@
return EnumInteractionResult.SUCCESS;
}
@@ -383,7 +406,8 @@
@@ -382,7 +405,8 @@
itemstack.shrink(1);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
@@ -68,10 +68,17 @@
@@ -66,10 +66,17 @@
public class Axolotl extends EntityAnimal implements LerpingModel, Bucketable {
@@ -13,9 +13,9 @@
private static final Logger LOGGER = LogUtils.getLogger();
public static final int TOTAL_PLAYDEAD_TIME = 200;
protected static final ImmutableList<? extends SensorType<? extends Sensor<? super Axolotl>>> SENSOR_TYPES = ImmutableList.of(SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_ADULT, SensorType.HURT_BY, SensorType.AXOLOTL_ATTACKABLES, SensorType.AXOLOTL_TEMPTATIONS);
- protected static final ImmutableList<? extends MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.BREED_TARGET, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.NEAREST_VISIBLE_ADULT, new MemoryModuleType[]{MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.PLAY_DEAD_TICKS, MemoryModuleType.NEAREST_ATTACKABLE, MemoryModuleType.TEMPTING_PLAYER, MemoryModuleType.TEMPTATION_COOLDOWN_TICKS, MemoryModuleType.IS_TEMPTED, MemoryModuleType.HAS_HUNTING_COOLDOWN});
- protected static final ImmutableList<? extends MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.BREED_TARGET, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.NEAREST_VISIBLE_ADULT, new MemoryModuleType[]{MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.PLAY_DEAD_TICKS, MemoryModuleType.NEAREST_ATTACKABLE, MemoryModuleType.TEMPTING_PLAYER, MemoryModuleType.TEMPTATION_COOLDOWN_TICKS, MemoryModuleType.IS_TEMPTED, MemoryModuleType.HAS_HUNTING_COOLDOWN, MemoryModuleType.IS_PANICKING});
+ // CraftBukkit - decompile error
+ protected static final ImmutableList<? extends MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.<MemoryModuleType<?>>of(MemoryModuleType.BREED_TARGET, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.NEAREST_VISIBLE_ADULT, new MemoryModuleType[]{MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.PLAY_DEAD_TICKS, MemoryModuleType.NEAREST_ATTACKABLE, MemoryModuleType.TEMPTING_PLAYER, MemoryModuleType.TEMPTATION_COOLDOWN_TICKS, MemoryModuleType.IS_TEMPTED, MemoryModuleType.HAS_HUNTING_COOLDOWN});
+ protected static final ImmutableList<? extends MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.<MemoryModuleType<?>>of(MemoryModuleType.BREED_TARGET, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.NEAREST_VISIBLE_ADULT, new MemoryModuleType[]{MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.PLAY_DEAD_TICKS, MemoryModuleType.NEAREST_ATTACKABLE, MemoryModuleType.TEMPTING_PLAYER, MemoryModuleType.TEMPTATION_COOLDOWN_TICKS, MemoryModuleType.IS_TEMPTED, MemoryModuleType.HAS_HUNTING_COOLDOWN, MemoryModuleType.IS_PANICKING});
private static final DataWatcherObject<Integer> DATA_VARIANT = DataWatcher.defineId(Axolotl.class, DataWatcherRegistry.INT);
private static final DataWatcherObject<Boolean> DATA_PLAYING_DEAD = DataWatcher.defineId(Axolotl.class, DataWatcherRegistry.BOOLEAN);
private static final DataWatcherObject<Boolean> FROM_BUCKET = DataWatcher.defineId(Axolotl.class, DataWatcherRegistry.BOOLEAN);
@@ -28,7 +28,7 @@
}
public Axolotl.Variant getVariant() {
@@ -428,7 +435,7 @@
@@ -423,7 +430,7 @@
if (i < 2400) {
i = Math.min(2400, 100 + i);
@@ -37,7 +37,7 @@
}
entityhuman.removeEffect(MobEffects.DIG_SLOWDOWN);
@@ -478,7 +485,7 @@
@@ -473,7 +480,7 @@
@Override
public BehaviorController<Axolotl> getBrain() {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
@@ -45,6 +45,11 @@
import net.minecraft.world.level.block.state.IBlockData;
@@ -54,6 +54,11 @@
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -12,7 +12,7 @@
public class Goat extends EntityAnimal {
public static final EntitySize LONG_JUMPING_DIMENSIONS = EntitySize.scalable(0.9F, 1.3F).scale(0.7F);
@@ -134,7 +139,7 @@
@@ -156,7 +161,7 @@
@Override
public BehaviorController<Goat> getBrain() {
@@ -21,7 +21,7 @@
}
@Override
@@ -172,8 +177,15 @@
@@ -194,8 +199,15 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {

View File

@@ -1,15 +1,15 @@
--- a/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
+++ b/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
@@ -70,6 +70,8 @@
@@ -72,6 +72,8 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
+import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; // CraftBukkit
+
public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, IJumpable, ISaddleable {
public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, HasCustomInventoryScreen, IJumpable, ISaddleable {
public static final int EQUIPMENT_SLOT_OFFSET = 400;
@@ -109,6 +111,7 @@
@@ -111,6 +113,7 @@
private float mouthAnimO;
protected boolean canGallop = true;
protected int gallopSoundCounter;
@@ -17,7 +17,7 @@
protected EntityHorseAbstract(EntityTypes<? extends EntityHorseAbstract> entitytypes, World world) {
super(entitytypes, world);
@@ -294,7 +297,7 @@
@@ -296,7 +299,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());
@@ -410,7 +413,7 @@
@@ -412,7 +415,7 @@
}
public int getMaxTemper() {
@@ -35,7 +35,7 @@
}
@Override
@@ -480,7 +483,7 @@
@@ -483,7 +486,7 @@
}
if (this.getHealth() < this.getMaxHealth() && f > 0.0F) {
@@ -44,7 +44,7 @@
flag = true;
}
@@ -557,7 +560,7 @@
@@ -560,7 +563,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()) {
@@ -788,6 +791,7 @@
@@ -791,6 +794,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()));
@@ -815,6 +819,11 @@
@@ -818,6 +822,11 @@
if (uuid != null) {
this.setOwnerUUID(uuid);
}
@@ -73,7 +73,7 @@
if (nbttagcompound.contains("SaddleItem", 10)) {
ItemStack itemstack = ItemStack.of(nbttagcompound.getCompound("SaddleItem"));
@@ -897,6 +906,18 @@
@@ -895,6 +904,18 @@
@Override
public void handleStartJump(int i) {

View File

@@ -1,11 +0,0 @@
--- a/net/minecraft/world/entity/animal/horse/EntityHorseSkeleton.java
+++ b/net/minecraft/world/entity/animal/horse/EntityHorseSkeleton.java
@@ -24,7 +24,7 @@
private final PathfinderGoalHorseTrap skeletonTrapGoal = new PathfinderGoalHorseTrap(this);
private static final int TRAP_MAX_LIFE = 18000;
private boolean isTrap;
- private int trapTime;
+ public int trapTime; // PAIL
public EntityHorseSkeleton(EntityTypes<? extends EntityHorseSkeleton> entitytypes, World world) {
super(entitytypes, world);

View File

@@ -20,7 +20,7 @@
- entityskeleton1.startRiding(entityhorseabstract);
+ if (entityskeleton1 != null) entityskeleton1.startRiding(entityhorseabstract); // CraftBukkit
entityhorseabstract.push(this.horse.getRandom().nextGaussian() * 0.5D, 0.0D, this.horse.getRandom().nextGaussian() * 0.5D);
entityhorseabstract.push(this.horse.getRandom().triangle(0.0D, 1.1485D), 0.0D, this.horse.getRandom().triangle(0.0D, 1.1485D));
- worldserver.addFreshEntityWithPassengers(entityhorseabstract);
+ worldserver.addFreshEntityWithPassengers(entityhorseabstract, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.JOCKEY); // CraftBukkit
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
@@ -51,6 +51,18 @@
@@ -50,6 +50,18 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
@@ -19,7 +19,7 @@
public class EntityEnderDragon extends EntityInsentient implements IMonster {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -87,6 +99,7 @@
@@ -86,6 +98,7 @@
private final PathPoint[] nodes = new PathPoint[24];
private final int[] nodeAdjacency = new int[24];
private final Path openSet = new Path();
@@ -27,7 +27,7 @@
public EntityEnderDragon(EntityTypes<? extends EntityEnderDragon> entitytypes, World world) {
super(EntityTypes.ENDER_DRAGON, world);
@@ -234,7 +247,7 @@
@@ -233,7 +246,7 @@
Vec3D vec3d1 = idragoncontroller.getFlyTargetLocation();
@@ -36,7 +36,7 @@
d0 = vec3d1.x - this.getX();
d1 = vec3d1.y - this.getY();
d2 = vec3d1.z - this.getZ();
@@ -375,7 +388,14 @@
@@ -374,7 +387,14 @@
if (this.nearestCrystal.isRemoved()) {
this.nearestCrystal = null;
} else if (this.tickCount % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
@@ -52,7 +52,7 @@
}
}
@@ -450,6 +470,9 @@
@@ -449,6 +469,9 @@
int j1 = MathHelper.floor(axisalignedbb.maxZ);
boolean flag = false;
boolean flag1 = false;
@@ -62,9 +62,9 @@
for (int k1 = i; k1 <= l; ++k1) {
for (int l1 = j; l1 <= i1; ++l1) {
@@ -459,7 +482,11 @@
@@ -458,7 +481,11 @@
if (!iblockdata.isAir() && iblockdata.getMaterial() != Material.FIRE) {
if (!iblockdata.isAir() && !iblockdata.is(TagsBlock.DRAGON_TRANSPARENT)) {
if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.is(TagsBlock.DRAGON_IMMUNE)) {
- flag1 = this.level.removeBlock(blockposition, false) || flag1;
+ // CraftBukkit start - Add blocks to list rather than destroying them
@@ -75,7 +75,7 @@
} else {
flag = true;
}
@@ -468,6 +495,51 @@
@@ -467,6 +494,51 @@
}
}
@@ -115,7 +115,7 @@
+ craftBlock.getNMS().getDrops(loottableinfo_builder).forEach((itemstack) -> {
+ Block.popResource(level, blockposition, itemstack);
+ });
+ craftBlock.getNMS().spawnAfterBreak((WorldServer) level, blockposition, ItemStack.EMPTY);
+ craftBlock.getNMS().spawnAfterBreak((WorldServer) level, blockposition, ItemStack.EMPTY, false);
+ }
+ nmsBlock.wasExploded(level, blockposition, explosionSource);
+

View File

@@ -30,7 +30,7 @@
@Override
public void refreshDimensions() {
double d0 = this.getX();
@@ -160,14 +176,21 @@
@@ -160,13 +176,20 @@
@Override
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
@@ -44,17 +44,16 @@
this.verifyEquippedItem(itemstack);
switch (enumitemslot.getType()) {
case HAND:
- this.equipEventAndSound(itemstack);
+ this.equipEventAndSound(itemstack, silent); // CraftBukkit
this.handItems.set(enumitemslot.getIndex(), itemstack);
- this.onEquipItem(enumitemslot, (ItemStack) this.handItems.set(enumitemslot.getIndex(), itemstack), itemstack);
+ this.onEquipItem(enumitemslot, (ItemStack) this.handItems.set(enumitemslot.getIndex(), itemstack), itemstack, silent); // CraftBukkit
break;
case ARMOR:
- this.equipEventAndSound(itemstack);
+ this.equipEventAndSound(itemstack, silent); // CraftBukkit
this.armorItems.set(enumitemslot.getIndex(), itemstack);
- this.onEquipItem(enumitemslot, (ItemStack) this.armorItems.set(enumitemslot.getIndex(), itemstack), itemstack);
+ this.onEquipItem(enumitemslot, (ItemStack) this.armorItems.set(enumitemslot.getIndex(), itemstack), itemstack, silent); // CraftBukkit
}
@@ -404,6 +427,21 @@
}
@@ -402,6 +425,21 @@
return false;
} else {
ItemStack itemstack2;
@@ -76,7 +75,7 @@
if (entityhuman.getAbilities().instabuild && itemstack1.isEmpty() && !itemstack.isEmpty()) {
itemstack2 = itemstack.copy();
@@ -432,9 +470,19 @@
@@ -430,9 +468,19 @@
public boolean hurt(DamageSource damagesource, float f) {
if (!this.level.isClientSide && !this.isRemoved()) {
if (DamageSource.OUT_OF_WORLD.equals(damagesource)) {
@@ -97,7 +96,7 @@
if (damagesource.isExplosion()) {
this.brokenByAnything(damagesource);
this.kill();
@@ -474,7 +522,7 @@
@@ -472,7 +520,7 @@
} else {
this.brokenByPlayer(damagesource);
this.showBreakingParticles();
@@ -106,7 +105,7 @@
}
return true;
@@ -535,13 +583,13 @@
@@ -533,13 +581,13 @@
}
private void brokenByPlayer(DamageSource damagesource) {
@@ -122,7 +121,7 @@
ItemStack itemstack;
int i;
@@ -549,7 +597,7 @@
@@ -547,7 +595,7 @@
for (i = 0; i < this.handItems.size(); ++i) {
itemstack = (ItemStack) this.handItems.get(i);
if (!itemstack.isEmpty()) {
@@ -131,7 +130,7 @@
this.handItems.set(i, ItemStack.EMPTY);
}
}
@@ -557,10 +605,11 @@
@@ -555,10 +603,11 @@
for (i = 0; i < this.armorItems.size(); ++i) {
itemstack = (ItemStack) this.armorItems.get(i);
if (!itemstack.isEmpty()) {
@@ -144,13 +143,13 @@
}
@@ -661,8 +710,16 @@
@@ -659,8 +708,16 @@
return this.isSmall();
}
+ // CraftBukkit start
+ @Override
+ protected boolean shouldDropExperience() {
+ public boolean shouldDropExperience() {
+ return true; // MC-157395, SPIGOT-5193 even baby (small) armor stands should drop
+ }
+ // CraftBukkit end
@@ -159,5 +158,5 @@
public void kill() {
+ org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, drops); // CraftBukkit - call event
this.remove(Entity.RemovalReason.KILLED);
this.gameEvent(GameEvent.ENTITY_DIE);
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/decoration/EntityHanging.java
+++ b/net/minecraft/world/entity/decoration/EntityHanging.java
@@ -24,6 +24,14 @@
import net.minecraft.world.phys.Vec3D;
@@ -26,6 +26,14 @@
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.world.damagesource.EntityDamageSourceIndirect;
@@ -14,8 +14,8 @@
+
public abstract class EntityHanging extends Entity {
protected static final Predicate<Entity> HANGING_ENTITY = (entity) -> {
@@ -57,26 +65,37 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -60,26 +68,37 @@
protected void recalculateBoundingBox() {
if (this.direction != null) {
@@ -66,7 +66,7 @@
d8 = 1.0D;
} else {
d6 = 1.0D;
@@ -85,11 +104,12 @@
@@ -88,11 +107,12 @@
d6 /= 32.0D;
d7 /= 32.0D;
d8 /= 32.0D;
@@ -81,7 +81,7 @@
return i % 32 == 0 ? 0.5D : 0.0D;
}
@@ -100,6 +120,24 @@
@@ -103,6 +123,24 @@
if (this.checkInterval++ == 100) {
this.checkInterval = 0;
if (!this.isRemoved() && !this.survives()) {
@@ -106,7 +106,7 @@
this.discard();
this.dropItem((Entity) null);
}
@@ -163,6 +201,22 @@
@@ -166,6 +204,22 @@
return false;
} else {
if (!this.isRemoved() && !this.level.isClientSide) {
@@ -129,7 +129,7 @@
this.kill();
this.markHurt();
this.dropItem(damagesource.getEntity());
@@ -175,6 +229,18 @@
@@ -178,6 +232,18 @@
@Override
public void move(EnumMoveType enummovetype, Vec3D vec3d) {
if (!this.level.isClientSide && !this.isRemoved() && vec3d.lengthSqr() > 0.0D) {
@@ -148,7 +148,7 @@
this.kill();
this.dropItem((Entity) null);
}
@@ -183,7 +249,7 @@
@@ -186,7 +252,7 @@
@Override
public void push(double d0, double d1, double d2) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/decoration/EntityItemFrame.java
+++ b/net/minecraft/world/entity/decoration/EntityItemFrame.java
@@ -91,16 +91,27 @@
@@ -93,16 +93,27 @@
@Override
protected void recalculateBoundingBox() {
if (this.direction != null) {
@@ -37,7 +37,7 @@
switch (enumdirection_enumaxis) {
case X:
@@ -116,9 +127,10 @@
@@ -118,9 +129,10 @@
d4 /= 32.0D;
d5 /= 32.0D;
d6 /= 32.0D;
@@ -49,7 +49,7 @@
@Override
public boolean survives() {
@@ -168,6 +180,11 @@
@@ -170,6 +182,11 @@
return false;
} else if (!damagesource.isExplosion() && !this.getItem().isEmpty()) {
if (!this.level.isClientSide) {
@@ -61,7 +61,7 @@
this.dropItem(damagesource.getEntity(), false);
this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F);
}
@@ -277,6 +294,12 @@
@@ -297,6 +314,12 @@
}
public void setItem(ItemStack itemstack, boolean flag) {
@@ -74,9 +74,9 @@
if (!itemstack.isEmpty()) {
itemstack = itemstack.copy();
itemstack.setCount(1);
@@ -284,7 +307,7 @@
}
@@ -304,7 +327,7 @@
this.onItemChanged(itemstack);
this.getEntityData().set(EntityItemFrame.DATA_ITEM, itemstack);
- if (!itemstack.isEmpty()) {
+ if (!itemstack.isEmpty() && playSound) { // CraftBukkit

View File

@@ -21,7 +21,7 @@
public EntityItem(EntityTypes<? extends EntityItem> entitytypes, World world) {
super(entitytypes, world);
@@ -95,9 +102,12 @@
@@ -105,9 +112,12 @@
this.discard();
} else {
super.tick();
@@ -37,7 +37,7 @@
this.xo = this.getX();
this.yo = this.getY();
@@ -147,9 +157,11 @@
@@ -157,9 +167,11 @@
this.mergeWithNeighbours();
}
@@ -49,7 +49,7 @@
this.hasImpulse |= this.updateInWaterStateAndDoFluidPushing();
if (!this.level.isClientSide) {
@@ -161,6 +173,12 @@
@@ -171,6 +183,12 @@
}
if (!this.level.isClientSide && this.age >= 6000) {
@@ -62,7 +62,7 @@
this.discard();
}
@@ -236,10 +254,11 @@
@@ -246,10 +264,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);
@@ -265,6 +284,11 @@
@@ -275,6 +294,11 @@
} else if (this.level.isClientSide) {
return true;
} else {
@@ -86,8 +86,8 @@
+ // CraftBukkit end
this.markHurt();
this.health = (int) ((float) this.health - f);
this.gameEvent(GameEvent.ENTITY_DAMAGED, damagesource.getEntity());
@@ -328,6 +352,46 @@
this.gameEvent(GameEvent.ENTITY_DAMAGE, damagesource.getEntity());
@@ -338,6 +362,46 @@
Item item = itemstack.getItem();
int i = itemstack.getCount();
@@ -134,7 +134,7 @@
if (this.pickupDelay == 0 && (this.owner == null || this.owner.equals(entityhuman.getUUID())) && entityhuman.getInventory().add(itemstack)) {
entityhuman.take(this, i);
if (itemstack.isEmpty()) {
@@ -371,7 +435,9 @@
@@ -381,7 +445,9 @@
}
public void setItem(ItemStack itemstack) {

View File

@@ -27,31 +27,31 @@
}
@@ -470,9 +481,13 @@
@@ -474,9 +485,13 @@
if (iblockdata2 != null) {
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level, blockposition);
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
+ // CraftBukkit start - Place event
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, iblockdata2).isCancelled()) {
world.setBlock(blockposition, iblockdata2, 3);
world.gameEvent(this.enderman, GameEvent.BLOCK_PLACE, blockposition);
world.gameEvent(GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(this.enderman, iblockdata2));
this.enderman.setCarriedBlock((IBlockData) null);
+ }
+ // CraftBukkit end
}
}
@@ -511,9 +526,13 @@
@@ -515,9 +530,13 @@
boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition);
if (iblockdata.is(TagsBlock.ENDERMAN_HOLDABLE) && flag) {
- world.removeBlock(blockposition, false);
- world.gameEvent(this.enderman, GameEvent.BLOCK_DESTROY, blockposition);
- world.gameEvent(GameEvent.BLOCK_DESTROY, blockposition, GameEvent.a.of(this.enderman, iblockdata));
- this.enderman.setCarriedBlock(iblockdata.getBlock().defaultBlockState());
+ // CraftBukkit start - Pickup event
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
+ world.removeBlock(blockposition, false);
+ world.gameEvent(this.enderman, GameEvent.BLOCK_DESTROY, blockposition);
+ world.gameEvent(GameEvent.BLOCK_DESTROY, blockposition, GameEvent.a.of(this.enderman, iblockdata));
+ this.enderman.setCarriedBlock(iblockdata.getBlock().defaultBlockState());
+ }
+ // CraftBukkit end

View File

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

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/entity/monster/EntityGuardianElder.java
+++ b/net/minecraft/world/entity/monster/EntityGuardianElder.java
@@ -79,7 +79,7 @@
@@ -67,7 +67,7 @@
super.customServerAiStep();
if ((this.tickCount + this.getId()) % 1200 == 0) {
MobEffect mobeffect = new MobEffect(MobEffects.DIG_SLOWDOWN, 6000, 2);
- List<EntityPlayer> list = MobEffectUtil.addEffectToPlayersAround((WorldServer) this.level, this, this.position(), 50.0D, mobeffect, 1200);
+ List<EntityPlayer> list = MobEffectUtil.addEffectToPlayersAround((WorldServer) this.level, this, this.position(), 50.0D, mobeffect, 1200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
if (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < 2 || entityplayer.getEffect(mobeffectlist).getDuration() < 1200) {
entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.GUARDIAN_ELDER_EFFECT, this.isSilent() ? 0.0F : 1.0F));
- entityplayer.addEffect(new MobEffect(mobeffectlist, 6000, 2), this);
+ entityplayer.addEffect(new MobEffect(mobeffectlist, 6000, 2), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
}
}
}
list.forEach((entityplayer) -> {
entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.GUARDIAN_ELDER_EFFECT, this.isSilent() ? 0.0F : 1.0F));

View File

@@ -41,4 +41,4 @@
+ // CraftBukkit end
}
public static boolean checkZombifiedPiglinSpawnRules(EntityTypes<EntityPigZombie> entitytypes, GeneratorAccess generatoraccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, Random random) {
public static boolean checkZombifiedPiglinSpawnRules(EntityTypes<EntityPigZombie> entitytypes, GeneratorAccess generatoraccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, RandomSource randomsource) {

View File

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

View File

@@ -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 @@
}
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
@@ -194,8 +194,19 @@
@@ -197,8 +197,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,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntitySkeletonWither.java
+++ b/net/minecraft/world/entity/monster/EntitySkeletonWither.java
@@ -105,7 +105,7 @@
@@ -106,7 +106,7 @@
return false;
} else {
if (entity instanceof EntityLiving) {

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/monster/EntitySlime.java
+++ b/net/minecraft/world/entity/monster/EntitySlime.java
@@ -43,6 +43,14 @@
import net.minecraft.world.level.storage.loot.LootTables;
@@ -42,6 +42,14 @@
import net.minecraft.world.level.levelgen.SeededRandom;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntitySpider.java
+++ b/net/minecraft/world/entity/monster/EntitySpider.java
@@ -176,7 +176,7 @@
@@ -177,7 +177,7 @@
MobEffectList mobeffectlist = ((EntitySpider.GroupDataSpider) object).effect;
if (mobeffectlist != null) {

View File

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

View File

@@ -1,17 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityVex.java
+++ b/net/minecraft/world/entity/monster/EntityVex.java
@@ -49,8 +49,8 @@
EntityInsentient owner;
@Nullable
private BlockPosition boundOrigin;
- private boolean hasLimitedLife;
- private int limitedLifeTicks;
+ public boolean hasLimitedLife; // CraftBukkit - PAIL, private -> public
+ public int limitedLifeTicks; // CraftBukkit - PAIL, private -> public
public EntityVex(EntityTypes<? extends EntityVex> entitytypes, World world) {
super(entitytypes, world);
@@ -368,7 +368,7 @@
@@ -373,7 +373,7 @@
@Override
public void start() {

View File

@@ -1,11 +0,0 @@
--- a/net/minecraft/world/entity/monster/EntityVindicator.java
+++ b/net/minecraft/world/entity/monster/EntityVindicator.java
@@ -52,7 +52,7 @@
static final Predicate<EnumDifficulty> DOOR_BREAKING_PREDICATE = (enumdifficulty) -> {
return enumdifficulty == EnumDifficulty.NORMAL || enumdifficulty == EnumDifficulty.HARD;
};
- boolean isJohnny;
+ public boolean isJohnny; // PAIL
public EntityVindicator(EntityTypes<? extends EntityVindicator> entitytypes, World world) {
super(entitytypes, world);

View File

@@ -97,16 +97,18 @@
}
}
@@ -411,18 +437,28 @@
@@ -412,21 +438,30 @@
}
EntityVillager entityvillager = (EntityVillager) entityliving;
- EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.convertTo(EntityTypes.ZOMBIE_VILLAGER, false);
+ // CraftBukkit start
+ zombifyVillager(worldserver, entityvillager, this.blockPosition(), this.isSilent(), CreatureSpawnEvent.SpawnReason.INFECTION);
+ flag = zombifyVillager(worldserver, entityvillager, this.blockPosition(), this.isSilent(), CreatureSpawnEvent.SpawnReason.INFECTION) == null;
+ }
+ }
+ return flag;
+ }
+
+ public static EntityZombieVillager zombifyVillager(WorldServer worldserver, EntityVillager entityvillager, net.minecraft.core.BlockPosition blockPosition, boolean silent, CreatureSpawnEvent.SpawnReason spawnReason) {
+ EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.convertTo(EntityTypes.ZOMBIE_VILLAGER, false, EntityTransformEvent.TransformReason.INFECTION, spawnReason);
+ if (entityzombievillager != null) {
@@ -122,14 +124,17 @@
+ if (!silent) {
+ worldserver.levelEvent((EntityHuman) null, 1026, blockPosition, 0);
}
-
- flag = false;
+ // CraftBukkit end
}
- return flag;
+ return entityzombievillager; // CraftBukkit
}
@Override
@@ -473,7 +509,7 @@
@@ -478,7 +513,7 @@
entitychicken1.finalizeSpawn(worldaccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null, (NBTTagCompound) null);
entitychicken1.setChickenJockey(true);
this.startRiding(entitychicken1);

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/monster/EntityZombieVillager.java
+++ b/net/minecraft/world/entity/monster/EntityZombieVillager.java
@@ -48,6 +48,13 @@
import net.minecraft.world.level.gameevent.GameEvent;
@@ -47,6 +47,13 @@
import net.minecraft.world.level.block.state.IBlockData;
import org.slf4j.Logger;
+// CraftBukkit start
@@ -14,7 +14,7 @@
public class EntityZombieVillager extends EntityZombie implements VillagerDataHolder {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -65,6 +72,7 @@
@@ -64,6 +71,7 @@
@Nullable
private NBTTagCompound tradeOffers;
private int villagerXp;
@@ -22,7 +22,7 @@
public EntityZombieVillager(EntityTypes<? extends EntityZombieVillager> entitytypes, World world) {
super(entitytypes, world);
@@ -83,7 +91,7 @@
@@ -82,7 +90,7 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@@ -31,7 +31,7 @@
Logger logger = EntityZombieVillager.LOGGER;
Objects.requireNonNull(logger);
@@ -139,6 +147,10 @@
@@ -138,6 +146,10 @@
public void tick() {
if (!this.level.isClientSide && this.isAlive() && this.isConverting()) {
int i = this.getConversionProgress();
@@ -42,7 +42,7 @@
this.villagerConversionTime -= i;
if (this.villagerConversionTime <= 0) {
@@ -147,6 +159,7 @@
@@ -146,6 +158,7 @@
}
super.tick();
@@ -50,7 +50,7 @@
}
@Override
@@ -191,8 +204,10 @@
@@ -189,8 +202,10 @@
this.conversionStarter = uuid;
this.villagerConversionTime = i;
this.getEntityData().set(EntityZombieVillager.DATA_CONVERTING_ID, true);
@@ -63,7 +63,7 @@
this.level.broadcastEntityEvent(this, (byte) 16);
}
@@ -209,7 +224,13 @@
@@ -207,7 +222,13 @@
}
private void finishConversion(WorldServer worldserver) {
@@ -78,7 +78,7 @@
EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
int i = aenumitemslot.length;
@@ -224,7 +245,9 @@
@@ -222,7 +243,9 @@
double d0 = (double) this.getEquipmentDropChance(enumitemslot);
if (d0 > 1.0D) {
@@ -88,7 +88,7 @@
}
}
}
@@ -250,7 +273,7 @@
@@ -248,7 +271,7 @@
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/piglin/EntityPiglin.java
+++ b/net/minecraft/world/entity/monster/piglin/EntityPiglin.java
@@ -55,6 +55,18 @@
@@ -54,6 +54,18 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.IBlockData;
@@ -19,7 +19,7 @@
public class EntityPiglin extends EntityPiglinAbstract implements ICrossbow, InventoryCarrier {
private static final DataWatcherObject<Boolean> DATA_BABY_ID = DataWatcher.defineId(EntityPiglin.class, DataWatcherRegistry.BOOLEAN);
@@ -75,6 +87,10 @@
@@ -74,6 +86,10 @@
public boolean cannotHunt;
protected static final ImmutableList<SensorType<? extends Sensor<? super EntityPiglin>>> SENSOR_TYPES = ImmutableList.of(SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_PLAYERS, SensorType.NEAREST_ITEMS, SensorType.HURT_BY, SensorType.PIGLIN_SPECIFIC_SENSOR);
protected static final ImmutableList<MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.LOOK_TARGET, MemoryModuleType.DOORS_TO_CLOSE, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLINS, MemoryModuleType.NEARBY_ADULT_PIGLINS, MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.WALK_TARGET, new MemoryModuleType[]{MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.INTERACTION_TARGET, MemoryModuleType.PATH, MemoryModuleType.ANGRY_AT, MemoryModuleType.UNIVERSAL_ANGER, MemoryModuleType.AVOID_TARGET, MemoryModuleType.ADMIRING_ITEM, MemoryModuleType.TIME_TRYING_TO_REACH_ADMIRE_ITEM, MemoryModuleType.ADMIRING_DISABLED, MemoryModuleType.DISABLE_WALK_TO_ADMIRE_ITEM, MemoryModuleType.CELEBRATE_LOCATION, MemoryModuleType.DANCING, MemoryModuleType.HUNTED_RECENTLY, MemoryModuleType.NEAREST_VISIBLE_BABY_HOGLIN, MemoryModuleType.NEAREST_VISIBLE_NEMESIS, MemoryModuleType.NEAREST_VISIBLE_ZOMBIFIED, MemoryModuleType.RIDE_TARGET, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_VISIBLE_HUNTABLE_HOGLIN, MemoryModuleType.NEAREST_TARGETABLE_PLAYER_NOT_WEARING_GOLD, MemoryModuleType.NEAREST_PLAYER_HOLDING_WANTED_ITEM, MemoryModuleType.ATE_RECENTLY, MemoryModuleType.NEAREST_REPELLENT});
@@ -30,7 +30,7 @@
public EntityPiglin(EntityTypes<? extends EntityPiglinAbstract> entitytypes, World world) {
super(entitytypes, world);
@@ -93,6 +109,14 @@
@@ -92,6 +108,14 @@
}
nbttagcompound.put("Inventory", this.inventory.createTag());
@@ -45,7 +45,7 @@
}
@Override
@@ -101,6 +125,10 @@
@@ -100,6 +124,10 @@
this.setBaby(nbttagcompound.getBoolean("IsBaby"));
this.setCannotHunt(nbttagcompound.getBoolean("CannotHunt"));
this.inventory.fromTag(nbttagcompound.getList("Inventory", 10));
@@ -56,7 +56,7 @@
}
@VisibleForDebug
@@ -205,7 +233,7 @@
@@ -206,7 +234,7 @@
@Override
public BehaviorController<EntityPiglin> getBrain() {
@@ -65,7 +65,7 @@
}
@Override
@@ -348,7 +376,7 @@
@@ -349,7 +377,7 @@
}
protected void holdInOffHand(ItemStack itemstack) {
@@ -74,7 +74,7 @@
this.setItemSlot(EnumItemSlot.OFFHAND, itemstack);
this.setGuaranteedDrop(EnumItemSlot.OFFHAND);
} else {
@@ -374,8 +402,8 @@
@@ -375,8 +403,8 @@
if (EnchantmentManager.hasBindingCurse(itemstack1)) {
return false;
} else {
@@ -85,7 +85,7 @@
return flag && !flag1 ? true : (!flag && flag1 ? false : (this.isAdult() && !itemstack.is(Items.CROSSBOW) && itemstack1.is(Items.CROSSBOW) ? false : super.canReplaceCurrentItem(itemstack, itemstack1)));
}
@@ -404,7 +432,7 @@
@@ -405,7 +433,7 @@
@Override
protected SoundEffect getAmbientSound() {

View File

@@ -30,7 +30,7 @@
+ Optional<SoundEffect> optional = getSoundForCurrentActivity(entitypiglin); // CraftBukkit - decompile error
Objects.requireNonNull(entitypiglin);
optional.ifPresent(entitypiglin::playSound);
optional.ifPresent(entitypiglin::playSoundEvent);
@@ -224,23 +231,27 @@
stopWalking(entitypiglin);
ItemStack itemstack;

View File

@@ -86,30 +86,16 @@
this.releaseAllPois();
this.discard();
} else {
@@ -839,6 +864,13 @@
return;
@@ -904,7 +929,7 @@
}).limit(5L).collect(Collectors.toList());
if (list1.size() >= j) {
- if (SpawnUtil.trySpawnMob(EntityTypes.IRON_GOLEM, EnumMobSpawn.MOB_SUMMONED, worldserver, this.blockPosition(), 10, 8, 6, SpawnUtil.a.LEGACY_IRON_GOLEM).isPresent()) {
+ if (SpawnUtil.trySpawnMob(EntityTypes.IRON_GOLEM, EnumMobSpawn.MOB_SUMMONED, worldserver, this.blockPosition(), 10, 8, 6, SpawnUtil.a.LEGACY_IRON_GOLEM, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE).isPresent()) { // CraftBukkit
list.forEach(SensorGolemLastSeen::golemDetected);
}
}
+ // CraftBukkit start
+ ItemStack remaining = new InventorySubcontainer(inventorysubcontainer).addItem(itemstack);
+ if (CraftEventFactory.callEntityPickupItemEvent(this, entityitem, remaining.getCount(), false).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
+
this.onItemPickup(entityitem);
this.take(entityitem, itemstack.getCount());
ItemStack itemstack1 = inventorysubcontainer.addItem(itemstack);
@@ -951,7 +983,7 @@
if (entityirongolem != null) {
if (entityirongolem.checkSpawnRules(worldserver, EnumMobSpawn.MOB_SUMMONED) && entityirongolem.checkSpawnObstruction(worldserver)) {
- worldserver.addFreshEntityWithPassengers(entityirongolem);
+ worldserver.addFreshEntityWithPassengers(entityirongolem, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE); // CraftBukkit
return entityirongolem;
}
@@ -1029,7 +1061,7 @@
@@ -961,7 +986,7 @@
@Override
public void startSleeping(BlockPosition blockposition) {
super.startSleeping(blockposition);
@@ -118,7 +104,7 @@
this.brain.eraseMemory(MemoryModuleType.WALK_TARGET);
this.brain.eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
}
@@ -1037,7 +1069,7 @@
@@ -969,7 +994,7 @@
@Override
public void stopSleeping() {
super.stopSleeping();

View File

@@ -0,0 +1,16 @@
--- a/net/minecraft/world/entity/npc/InventoryCarrier.java
+++ b/net/minecraft/world/entity/npc/InventoryCarrier.java
@@ -20,6 +20,13 @@
return;
}
+ // CraftBukkit start
+ ItemStack remaining = new InventorySubcontainer(inventorysubcontainer).addItem(itemstack);
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(entityinsentient, entityitem, remaining.getCount(), false).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
+
entityinsentient.onItemPickup(entityitem);
int i = itemstack.getCount();
ItemStack itemstack1 = inventorysubcontainer.addItem(itemstack);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/npc/MobSpawnerTrader.java
+++ b/net/minecraft/world/entity/npc/MobSpawnerTrader.java
@@ -111,7 +111,7 @@
@@ -113,7 +113,7 @@
return false;
}
@@ -9,7 +9,7 @@
if (entityvillagertrader != null) {
for (int i = 0; i < 2; ++i) {
@@ -119,7 +119,7 @@
@@ -121,7 +121,7 @@
}
this.serverLevelData.setWanderingTraderId(entityvillagertrader.getUUID());
@@ -18,7 +18,7 @@
entityvillagertrader.setWanderTarget(blockposition1);
entityvillagertrader.restrictTo(blockposition1, 16);
return true;
@@ -134,7 +134,7 @@
@@ -136,7 +136,7 @@
BlockPosition blockposition = this.findSpawnPositionNear(worldserver, entityvillagertrader.blockPosition(), i);
if (blockposition != null) {

View File

@@ -1,10 +1,11 @@
--- a/net/minecraft/world/entity/player/EntityHuman.java
+++ b/net/minecraft/world/entity/player/EntityHuman.java
@@ -112,6 +112,19 @@
import net.minecraft.world.scores.ScoreboardTeam;
@@ -116,6 +116,20 @@
import net.minecraft.world.scores.ScoreboardTeamBase;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.nbt.NBTBase;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.util.CraftVector;
@@ -19,8 +20,8 @@
+
public abstract class EntityHuman extends EntityLiving {
public static final String UUID_PREFIX_OFFLINE_PLAYER = "OfflinePlayer:";
@@ -125,7 +138,8 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -129,7 +143,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);
@@ -30,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);
@@ -135,10 +149,10 @@
@@ -139,10 +154,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);
@@ -40,10 +41,10 @@
public Container containerMenu;
- protected FoodMetaData foodData = new FoodMetaData();
+ protected FoodMetaData foodData = new FoodMetaData(this); // CraftBukkit - add "this" to constructor
protected WardenSpawnTracker wardenSpawnTracker = new WardenSpawnTracker(0, 0, 0);
protected int jumpTriggerTime;
public float oBob;
public float bob;
@@ -165,6 +179,16 @@
@@ -173,6 +188,16 @@
@Nullable
public EntityFishingHook fishing;
@@ -57,10 +58,10 @@
+ }
+ // CraftBukkit end
+
public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile) {
public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile, @Nullable ProfilePublicKey profilepublickey) {
super(EntityTypes.PLAYER, world);
this.lastItemInMainHand = ItemStack.EMPTY;
@@ -303,7 +327,7 @@
@@ -314,7 +339,7 @@
ItemStack itemstack = this.getItemBySlot(EnumItemSlot.HEAD);
if (itemstack.is(Items.TURTLE_HELMET) && !this.isEyeInFluid(TagsFluid.WATER)) {
@@ -69,7 +70,7 @@
}
}
@@ -495,7 +519,8 @@
@@ -506,7 +531,8 @@
if (this.level.getDifficulty() == EnumDifficulty.PEACEFUL && this.level.getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION)) {
if (this.getHealth() < this.getMaxHealth() && this.tickCount % 20 == 0) {
@@ -79,7 +80,7 @@
}
if (this.foodData.needsFood() && this.tickCount % 10 == 0) {
@@ -658,6 +683,13 @@
@@ -670,6 +696,13 @@
@Nullable
public EntityItem drop(ItemStack itemstack, boolean flag, boolean flag1) {
@@ -93,7 +94,7 @@
if (itemstack.isEmpty()) {
return null;
} else {
@@ -692,6 +724,33 @@
@@ -704,6 +737,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);
}
@@ -127,7 +128,43 @@
return entityitem;
}
}
@@ -825,12 +884,12 @@
@@ -780,7 +840,7 @@
this.setScore(nbttagcompound.getInt("Score"));
this.foodData.readAdditionalSaveData(nbttagcompound);
if (nbttagcompound.contains("warden_spawn_tracker", 10)) {
- DataResult dataresult = WardenSpawnTracker.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("warden_spawn_tracker")));
+ DataResult<WardenSpawnTracker> dataresult = WardenSpawnTracker.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("warden_spawn_tracker"))); // CraftBukkit - decompile error
Logger logger = EntityHuman.LOGGER;
Objects.requireNonNull(logger);
@@ -804,7 +864,7 @@
}
if (nbttagcompound.contains("LastDeathLocation", 10)) {
- DataResult dataresult1 = GlobalPos.CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("LastDeathLocation"));
+ DataResult<GlobalPos> dataresult1 = GlobalPos.CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("LastDeathLocation")); // CraftBukkit - decompile error
Logger logger1 = EntityHuman.LOGGER;
Objects.requireNonNull(logger1);
@@ -826,7 +886,7 @@
nbttagcompound.putInt("XpSeed", this.enchantmentSeed);
nbttagcompound.putInt("Score", this.getScore());
this.foodData.addAdditionalSaveData(nbttagcompound);
- DataResult dataresult = WardenSpawnTracker.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.wardenSpawnTracker);
+ DataResult<NBTBase> dataresult = WardenSpawnTracker.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.wardenSpawnTracker); // CraftBukkit - decompile error
Logger logger = EntityHuman.LOGGER;
Objects.requireNonNull(logger);
@@ -844,7 +904,7 @@
}
this.getLastDeathLocation().flatMap((globalpos) -> {
- DataResult dataresult1 = GlobalPos.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, globalpos);
+ DataResult<NBTBase> dataresult1 = GlobalPos.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, globalpos); // CraftBukkit - decompile error
Logger logger1 = EntityHuman.LOGGER;
Objects.requireNonNull(logger1);
@@ -871,12 +931,12 @@
return false;
} else {
if (!this.level.isClientSide) {
@@ -142,7 +179,7 @@
}
if (this.level.getDifficulty() == EnumDifficulty.EASY) {
@@ -842,7 +901,13 @@
@@ -888,7 +948,13 @@
}
}
@@ -157,7 +194,7 @@
}
}
}
@@ -862,10 +927,29 @@
@@ -908,10 +974,29 @@
}
public boolean canHarmPlayer(EntityHuman entityhuman) {
@@ -190,7 +227,7 @@
}
@Override
@@ -907,8 +991,13 @@
@@ -953,8 +1038,13 @@
}
}
@@ -205,7 +242,7 @@
if (!this.isInvulnerableTo(damagesource)) {
f = this.getDamageAfterArmorAbsorb(damagesource, f);
f = this.getDamageAfterMagicAbsorb(damagesource, f);
@@ -923,7 +1012,7 @@
@@ -969,7 +1059,7 @@
}
if (f != 0.0F) {
@@ -214,7 +251,7 @@
float f3 = this.getHealth();
this.setHealth(this.getHealth() - f);
@@ -934,6 +1023,7 @@
@@ -980,6 +1070,7 @@
}
}
@@ -222,7 +259,7 @@
}
@Override
@@ -1093,7 +1183,7 @@
@@ -1139,7 +1230,7 @@
f *= 0.2F + f2 * f2 * 0.8F;
f1 *= f2;
@@ -231,7 +268,7 @@
if (f > 0.0F || f1 > 0.0F) {
boolean flag = f2 > 0.9F;
boolean flag1 = false;
@@ -1132,8 +1222,15 @@
@@ -1178,8 +1269,15 @@
if (entity instanceof EntityLiving) {
f3 = ((EntityLiving) entity).getHealth();
if (j > 0 && !entity.isOnFire()) {
@@ -249,7 +286,7 @@
}
}
@@ -1161,8 +1258,11 @@
@@ -1207,8 +1305,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) {
@@ -262,7 +299,7 @@
}
}
@@ -1171,9 +1271,26 @@
@@ -1217,9 +1318,26 @@
}
if (entity instanceof EntityPlayer && entity.hurtMarked) {
@@ -289,7 +326,7 @@
}
if (flag2) {
@@ -1218,7 +1335,14 @@
@@ -1264,7 +1382,14 @@
this.awardStat(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F));
if (j > 0) {
@@ -305,7 +342,7 @@
}
if (this.level instanceof WorldServer && f5 > 2.0F) {
@@ -1228,12 +1352,17 @@
@@ -1274,12 +1399,17 @@
}
}
@@ -324,7 +361,7 @@
}
}
@@ -1306,6 +1435,12 @@
@@ -1357,6 +1487,12 @@
public void updateTutorialInventoryAction(ItemStack itemstack, ItemStack itemstack1, ClickAction clickaction) {}
public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition) {
@@ -337,7 +374,7 @@
this.startSleeping(blockposition);
this.sleepCounter = 0;
return Either.right(Unit.INSTANCE);
@@ -1390,9 +1525,9 @@
@@ -1441,9 +1577,9 @@
super.jumpFromGround();
this.awardStat(StatisticList.JUMP);
if (this.isSprinting()) {
@@ -349,7 +386,7 @@
}
}
@@ -1426,7 +1561,11 @@
@@ -1477,7 +1613,11 @@
this.setDeltaMovement(vec3d2.x, d3 * 0.6D, vec3d2.z);
this.flyingSpeed = f;
this.resetFallDistance();
@@ -362,7 +399,7 @@
} else {
super.travel(vec3d);
}
@@ -1461,19 +1600,19 @@
@@ -1512,19 +1652,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);
@@ -385,7 +422,7 @@
}
} else if (this.onClimbable()) {
if (d1 > 0.0D) {
@@ -1484,13 +1623,13 @@
@@ -1535,13 +1675,13 @@
if (i > 0) {
if (this.isSprinting()) {
this.awardStat(StatisticList.SPRINT_ONE_CM, i);
@@ -402,7 +439,7 @@
}
}
} else if (this.isFallFlying()) {
@@ -1556,12 +1695,24 @@
@@ -1607,12 +1747,24 @@
}
public void startFallFlying() {
@@ -428,7 +465,7 @@
}
@Override
@@ -1651,10 +1802,21 @@
@@ -1703,10 +1855,21 @@
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
}
@@ -451,12 +488,12 @@
}
}
@@ -1731,15 +1893,22 @@
@@ -1792,13 +1955,20 @@
@Override
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
+ // CraftBukkit start
+ this.setItemSlot(enumitemslot, itemstack, false);
+ setItemSlot(enumitemslot, itemstack, false);
+ }
+
+ @Override
@@ -464,20 +501,18 @@
+ // CraftBukkit end
this.verifyEquippedItem(itemstack);
if (enumitemslot == EnumItemSlot.MAINHAND) {
- this.equipEventAndSound(itemstack);
+ this.equipEventAndSound(itemstack, silent); // CraftBukkit
this.inventory.items.set(this.inventory.selected, itemstack);
- this.onEquipItem(enumitemslot, (ItemStack) this.inventory.items.set(this.inventory.selected, itemstack), itemstack);
+ this.onEquipItem(enumitemslot, (ItemStack) this.inventory.items.set(this.inventory.selected, itemstack), itemstack, silent); // CraftBukkit
} else if (enumitemslot == EnumItemSlot.OFFHAND) {
- this.equipEventAndSound(itemstack);
+ this.equipEventAndSound(itemstack, silent); // CraftBukkit
this.inventory.offhand.set(0, itemstack);
- this.onEquipItem(enumitemslot, (ItemStack) this.inventory.offhand.set(0, itemstack), itemstack);
+ this.onEquipItem(enumitemslot, (ItemStack) this.inventory.offhand.set(0, itemstack), itemstack, silent); // CraftBukkit
} else if (enumitemslot.getType() == EnumItemSlot.Function.ARMOR) {
- this.equipEventAndSound(itemstack);
+ this.equipEventAndSound(itemstack, silent); // CraftBukkit
this.inventory.armor.set(enumitemslot.getIndex(), itemstack);
- this.onEquipItem(enumitemslot, (ItemStack) this.inventory.armor.set(enumitemslot.getIndex(), itemstack), itemstack);
+ this.onEquipItem(enumitemslot, (ItemStack) this.inventory.armor.set(enumitemslot.getIndex(), itemstack), itemstack, silent); // CraftBukkit
}
@@ -1780,26 +1949,31 @@
}
@@ -1837,26 +2007,31 @@
protected void removeEntitiesOnShoulder() {
if (this.timeEntitySatOnShoulder + 20L < this.level.getGameTime()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/player/PlayerInventory.java
+++ b/net/minecraft/world/entity/player/PlayerInventory.java
@@ -26,6 +26,13 @@
@@ -25,6 +25,13 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.state.IBlockData;
@@ -14,7 +14,7 @@
public class PlayerInventory implements IInventory, INamableTileEntity {
public static final int POP_TIME_DURATION = 5;
@@ -43,6 +50,54 @@
@@ -42,6 +49,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);
@@ -63,6 +118,28 @@
@@ -62,6 +117,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/EntityArrow.java
+++ b/net/minecraft/world/entity/projectile/EntityArrow.java
@@ -44,6 +44,12 @@
@@ -45,6 +45,12 @@
import net.minecraft.world.phys.Vec3D;
import net.minecraft.world.phys.shapes.VoxelShape;
@@ -13,7 +13,7 @@
public abstract class EntityArrow extends IProjectile {
private static final double ARROW_BASE_DAMAGE = 2.0D;
@@ -210,7 +216,7 @@
@@ -211,7 +217,7 @@
}
if (object != null && !flag) {
@@ -22,7 +22,7 @@
this.hasImpulse = true;
}
@@ -357,7 +363,13 @@
@@ -358,7 +364,13 @@
int k = entity.getRemainingFireTicks();
if (this.isOnFire() && !flag) {
@@ -37,7 +37,7 @@
}
if (entity.hurt(damagesource, (float) i)) {
@@ -519,7 +531,22 @@
@@ -521,7 +533,22 @@
@Override
public void playerTouch(EntityHuman entityhuman) {
if (!this.level.isClientSide && (this.inGround || this.isNoPhysics()) && this.shakeTime <= 0) {

View File

@@ -25,7 +25,7 @@
+
private EntityFishingHook(EntityTypes<? extends EntityFishingHook> entitytypes, World world, int i, int j) {
super(entitytypes, world);
this.syncronizedRandom = new Random();
this.syncronizedRandom = RandomSource.create();
@@ -260,7 +272,7 @@
private void checkCollision() {
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);

View File

@@ -21,23 +21,23 @@
}
public EntitySmallFireball(World world, double d0, double d1, double d2, double d3, double d4, double d5) {
@@ -37,7 +44,14 @@
Entity entity1 = this.getOwner();
int i = entity.getRemainingFireTicks();
@@ -35,7 +42,14 @@
Entity entity1 = this.getOwner();
int i = entity.getRemainingFireTicks();
- entity.setSecondsOnFire(5);
+ // CraftBukkit start - Entity damage by entity event + combust event
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), entity.getBukkitEntity(), 5);
+ entity.level.getCraftServer().getPluginManager().callEvent(event);
- entity.setSecondsOnFire(5);
+ // CraftBukkit start - Entity damage by entity event + combust event
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), entity.getBukkitEntity(), 5);
+ entity.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ entity.setSecondsOnFire(event.getDuration(), false);
+ }
+ // CraftBukkit end
boolean flag = entity.hurt(DamageSource.fireball(this, entity1), 5.0F);
if (!flag) {
@@ -56,10 +70,10 @@
+ if (!event.isCancelled()) {
+ entity.setSecondsOnFire(event.getDuration(), false);
+ }
+ // CraftBukkit end
if (!entity.hurt(DamageSource.fireball(this, entity1), 5.0F)) {
entity.setRemainingFireTicks(i);
} else if (entity1 instanceof EntityLiving) {
@@ -51,10 +65,10 @@
if (!this.level.isClientSide) {
Entity entity = this.getOwner();

View File

@@ -47,7 +47,7 @@
protected void onHit(MovingObjectPosition movingobjectposition) {
MovingObjectPosition.EnumMovingObjectType movingobjectposition_enummovingobjecttype = movingobjectposition.getType();
@@ -161,6 +180,11 @@
@@ -163,6 +182,11 @@
protected void onHitEntity(MovingObjectPositionEntity movingobjectpositionentity) {}
protected void onHitBlock(MovingObjectPositionBlock movingobjectpositionblock) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/raid/PersistentRaid.java
+++ b/net/minecraft/world/entity/raid/PersistentRaid.java
@@ -110,19 +110,33 @@
@@ -112,19 +112,33 @@
boolean flag = false;
if (!raid.isStarted()) {

View File

@@ -74,7 +74,7 @@
this.stop();
return;
}
@@ -538,6 +553,10 @@
@@ -539,6 +554,10 @@
Raid.Wave[] araid_wave = Raid.Wave.VALUES;
int j = araid_wave.length;
@@ -85,7 +85,7 @@
for (int k = 0; k < j; ++k) {
Raid.Wave raid_wave = araid_wave[k];
int l = this.getDefaultNumSpawns(raid_wave, i, flag1) + this.getPotentialBonusSpawns(raid_wave, this.random, i, difficultydamagescaler, flag1);
@@ -550,9 +569,11 @@
@@ -551,9 +570,11 @@
entityraider.setPatrolLeader(true);
this.setLeader(i, entityraider);
flag = true;
@@ -97,7 +97,7 @@
if (raid_wave.entityType == EntityTypes.RAVAGER) {
EntityRaider entityraider1 = null;
@@ -571,6 +592,7 @@
@@ -572,6 +593,7 @@
this.joinRaid(i, entityraider1, blockposition, false);
entityraider1.moveTo(blockposition, 0.0F, 0.0F);
entityraider1.startRiding(entityraider);
@@ -105,7 +105,7 @@
}
}
}
@@ -580,6 +602,7 @@
@@ -581,6 +603,7 @@
++this.groupsSpawned;
this.updateBossbar();
this.setDirty();
@@ -113,7 +113,7 @@
}
public void joinRaid(int i, EntityRaider entityraider, @Nullable BlockPosition blockposition, boolean flag) {
@@ -595,7 +618,7 @@
@@ -596,7 +619,7 @@
entityraider.finalizeSpawn(this.level, this.level.getCurrentDifficultyAt(blockposition), EnumMobSpawn.EVENT, (GroupDataEntity) null, (NBTTagCompound) null);
entityraider.applyRaidBuffs(i, false);
entityraider.setOnGround(true);
@@ -122,7 +122,7 @@
}
}
@@ -845,6 +868,12 @@
@@ -846,6 +869,12 @@
this.heroesOfTheVillage.add(entity.getUUID());
}

View File

@@ -0,0 +1,68 @@
--- a/net/minecraft/world/entity/vehicle/ChestBoat.java
+++ b/net/minecraft/world/entity/vehicle/ChestBoat.java
@@ -23,6 +23,13 @@
import net.minecraft.world.item.Items;
import net.minecraft.world.level.World;
import net.minecraft.world.level.gameevent.GameEvent;
+// CraftBukkit start
+import java.util.List;
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+import org.bukkit.inventory.InventoryHolder;
+// CraftBukkit end
public class ChestBoat extends EntityBoat implements HasCustomInventoryScreen, ContainerEntity {
@@ -215,4 +222,51 @@
public void clearItemStacks() {
this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY);
}
+
+ // CraftBukkit start
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+ private int maxStack = MAX_STACK;
+
+ @Override
+ public List<ItemStack> getContents() {
+ return this.itemStacks;
+ }
+
+ @Override
+ public void onOpen(CraftHumanEntity who) {
+ transaction.add(who);
+ }
+
+ @Override
+ public void onClose(CraftHumanEntity who) {
+ transaction.remove(who);
+ }
+
+ @Override
+ public List<HumanEntity> getViewers() {
+ return transaction;
+ }
+
+ @Override
+ public InventoryHolder getOwner() {
+ org.bukkit.entity.Entity entity = getBukkitEntity();
+ if (entity instanceof InventoryHolder) return (InventoryHolder) entity;
+ return null;
+ }
+
+ @Override
+ public int getMaxStackSize() {
+ return maxStack;
+ }
+
+ @Override
+ public void setMaxStackSize(int size) {
+ maxStack = size;
+ }
+
+ @Override
+ public Location getLocation() {
+ return getBukkitEntity().getLocation();
+ }
+ // CraftBukkit end
}

View File

@@ -65,9 +65,9 @@
+ }
+ // CraftBukkit end
if (!flag && this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
this.spawnAtLocation((IMaterial) this.getDropItem());
this.destroy(damagesource);
}
@@ -203,9 +242,29 @@
@@ -207,9 +246,29 @@
public void push(Entity entity) {
if (entity instanceof EntityBoat) {
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
@@ -97,7 +97,7 @@
super.push(entity);
}
@@ -256,6 +315,7 @@
@@ -262,6 +321,7 @@
return this.getDirection().getClockWise();
}
@@ -105,7 +105,7 @@
@Override
public void tick() {
this.oldStatus = this.status;
@@ -296,6 +356,22 @@
@@ -302,6 +362,22 @@
this.setDeltaMovement(Vec3D.ZERO);
}
@@ -128,7 +128,7 @@
this.tickBubbleColumn();
for (int i = 0; i <= 1; ++i) {
@@ -800,6 +876,11 @@
@@ -809,6 +885,11 @@
this.causeFallDamage(this.fallDistance, 1.0F, DamageSource.FALL);
if (!this.level.isClientSide && !this.isRemoved()) {
@@ -140,7 +140,7 @@
this.kill();
if (this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
int i;
@@ -813,6 +894,7 @@
@@ -822,6 +903,7 @@
}
}
}

View File

@@ -70,7 +70,7 @@
this.ejectPassengers();
if (flag && !this.hasCustomName()) {
this.discard();
@@ -283,6 +325,14 @@
@@ -285,6 +327,14 @@
@Override
public void tick() {
@@ -85,7 +85,7 @@
if (this.getHurtTime() > 0) {
this.setHurtTime(this.getHurtTime() - 1);
}
@@ -292,7 +342,7 @@
@@ -294,7 +344,7 @@
}
this.checkOutOfWorld();
@@ -94,7 +94,7 @@
double d0;
if (this.level.isClientSide) {
@@ -358,6 +408,18 @@
@@ -360,6 +410,18 @@
}
this.setRot(this.getYRot(), this.getXRot());
@@ -113,7 +113,7 @@
if (this.getMinecartType() == EntityMinecartAbstract.EnumMinecartType.RIDEABLE && this.getDeltaMovement().horizontalDistanceSqr() > 0.01D) {
List<Entity> list = this.level.getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D), IEntitySelector.pushableBy(this));
@@ -366,8 +428,26 @@
@@ -368,8 +430,26 @@
Entity entity = (Entity) list.get(l);
if (!(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && !(entity instanceof EntityMinecartAbstract) && !this.isVehicle() && !entity.isPassenger()) {
@@ -140,7 +140,7 @@
entity.push(this);
}
}
@@ -379,6 +459,14 @@
@@ -381,6 +461,14 @@
Entity entity1 = (Entity) iterator.next();
if (!this.hasPassenger(entity1) && entity1.isPushable() && entity1 instanceof EntityMinecartAbstract) {
@@ -155,7 +155,7 @@
entity1.push(this);
}
}
@@ -395,7 +483,7 @@
@@ -397,7 +485,7 @@
}
protected double getMaxSpeed() {
@@ -164,7 +164,7 @@
}
public void activateMinecart(int i, int j, int k, boolean flag) {}
@@ -406,12 +494,16 @@
@@ -408,12 +496,16 @@
this.setDeltaMovement(MathHelper.clamp(vec3d.x, -d0, d0), vec3d.y, MathHelper.clamp(vec3d.z, -d0, d0));
if (this.onGround) {
@@ -183,7 +183,7 @@
}
}
@@ -602,7 +694,7 @@
@@ -604,7 +696,7 @@
}
protected void applyNaturalSlowdown() {
@@ -192,7 +192,7 @@
Vec3D vec3d = this.getDeltaMovement();
vec3d = vec3d.multiply(d0, 0.0D, d0);
@@ -741,6 +833,14 @@
@@ -743,6 +835,14 @@
if (!this.level.isClientSide) {
if (!entity.noPhysics && !this.noPhysics) {
if (!this.hasPassenger(entity)) {
@@ -207,7 +207,7 @@
double d0 = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ();
double d2 = d0 * d0 + d1 * d1;
@@ -920,4 +1020,26 @@
@@ -922,4 +1022,26 @@
private EnumMinecartType() {}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/vehicle/EntityMinecartCommandBlock.java
+++ b/net/minecraft/world/entity/vehicle/EntityMinecartCommandBlock.java
@@ -131,5 +131,12 @@
@@ -138,5 +138,12 @@
public CommandListenerWrapper createCommandSourceStack() {
return new CommandListenerWrapper(this, EntityMinecartCommandBlock.this.position(), EntityMinecartCommandBlock.this.getRotationVector(), this.getLevel(), 2, this.getName().getString(), EntityMinecartCommandBlock.this.getDisplayName(), this.getLevel().getServer(), EntityMinecartCommandBlock.this);
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/vehicle/EntityMinecartContainer.java
+++ b/net/minecraft/world/entity/vehicle/EntityMinecartContainer.java
@@ -31,6 +31,14 @@
import net.minecraft.world.level.storage.loot.parameters.LootContextParameterSets;
import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
@@ -18,6 +18,14 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.World;
+// CraftBukkit start
+import java.util.List;
@@ -12,10 +12,10 @@
+import org.bukkit.inventory.InventoryHolder;
+// CraftBukkit end
+
public abstract class EntityMinecartContainer extends EntityMinecartAbstract implements IInventory, ITileInventory {
public abstract class EntityMinecartContainer extends EntityMinecartAbstract implements ContainerEntity {
private NonNullList<ItemStack> itemStacks;
@@ -38,14 +46,55 @@
@@ -25,14 +33,55 @@
public MinecraftKey lootTable;
public long lootTableSeed;