Update to Minecraft 1.20.3

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2023-12-06 03:40:00 +11:00
parent afdb1d9bc3
commit 8398e12b34
256 changed files with 2745 additions and 1911 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -125,8 +125,65 @@
@@ -126,8 +126,65 @@
import org.joml.Vector3f;
import org.slf4j.Logger;
@@ -35,7 +35,7 @@
+import org.bukkit.plugin.PluginManager;
+// CraftBukkit end
+
public abstract class Entity implements INamableTileEntity, EntityAccess, ICommandListener {
public abstract class Entity implements INamableTileEntity, EntityAccess, ICommandListener, ScoreHolder {
+ // CraftBukkit start
+ private static final int CURRENT_LEVEL = 2;
@@ -66,16 +66,7 @@
private static final Logger LOGGER = LogUtils.getLogger();
public static final String ID_TAG = "id";
public static final String PASSENGERS_TAG = "Passengers";
@@ -189,7 +246,7 @@
public double zOld;
private float maxUpStep;
public boolean noPhysics;
- protected final RandomSource random;
+ public final RandomSource random;
public int tickCount;
private int remainingFireTicks;
public boolean wasTouchingWater;
@@ -241,6 +298,29 @@
@@ -242,6 +299,29 @@
public boolean hasVisualFire;
@Nullable
private IBlockData feetBlockState;
@@ -105,7 +96,7 @@
public Entity(EntityTypes<?> entitytypes, World world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
@@ -374,6 +454,12 @@
@@ -375,6 +455,12 @@
public void onClientRemoval() {}
public void setPose(EntityPose entitypose) {
@@ -118,7 +109,7 @@
this.entityData.set(Entity.DATA_POSE, entitypose);
}
@@ -398,6 +484,33 @@
@@ -399,6 +485,33 @@
}
protected void setRot(float f, float f1) {
@@ -152,7 +143,7 @@
this.setYRot(f % 360.0F);
this.setXRot(f1 % 360.0F);
}
@@ -439,6 +552,15 @@
@@ -440,6 +553,15 @@
this.baseTick();
}
@@ -168,7 +159,7 @@
public void baseTick() {
this.level().getProfiler().push("entityBaseTick");
this.feetBlockState = null;
@@ -453,7 +575,7 @@
@@ -454,7 +576,7 @@
this.walkDistO = this.walkDist;
this.xRotO = this.getXRot();
this.yRotO = this.getYRot();
@@ -177,7 +168,7 @@
if (this.canSpawnSprintParticle()) {
this.spawnSprintParticle();
}
@@ -488,6 +610,10 @@
@@ -489,6 +611,10 @@
if (this.isInLava()) {
this.lavaHurt();
this.fallDistance *= 0.5F;
@@ -188,7 +179,7 @@
}
this.checkBelowWorld();
@@ -539,15 +665,48 @@
@@ -540,15 +666,48 @@
public void lavaHurt() {
if (!this.fireImmune()) {
@@ -238,7 +229,7 @@
int j = i * 20;
if (this instanceof EntityLiving) {
@@ -698,6 +857,28 @@
@@ -699,6 +858,28 @@
block.updateEntityAfterFallOn(this.level(), this);
}
@@ -267,7 +258,7 @@
if (this.onGround()) {
block.stepOn(this.level(), blockposition, iblockdata, this);
}
@@ -1025,6 +1206,20 @@
@@ -1026,6 +1207,20 @@
return SoundEffects.GENERIC_SPLASH;
}
@@ -288,7 +279,7 @@
protected void checkInsideBlocks() {
AxisAlignedBB axisalignedbb = this.getBoundingBox();
BlockPosition blockposition = BlockPosition.containing(axisalignedbb.minX + 1.0E-7D, axisalignedbb.minY + 1.0E-7D, axisalignedbb.minZ + 1.0E-7D);
@@ -1439,6 +1634,7 @@
@@ -1440,6 +1635,7 @@
this.yo = d1;
this.zo = d4;
this.setPos(d3, d1, d4);
@@ -296,7 +287,7 @@
}
public void moveTo(Vec3D vec3d) {
@@ -1633,6 +1829,12 @@
@@ -1634,6 +1830,12 @@
return false;
}
@@ -309,7 +300,7 @@
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
if (entity instanceof EntityPlayer) {
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
@@ -1661,16 +1863,22 @@
@@ -1662,16 +1864,22 @@
}
public boolean saveAsPassenger(NBTTagCompound nbttagcompound) {
@@ -334,7 +325,7 @@
return true;
}
}
@@ -1681,16 +1889,38 @@
@@ -1682,16 +1890,38 @@
}
public NBTTagCompound saveWithoutId(NBTTagCompound nbttagcompound) {
@@ -377,7 +368,7 @@
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
nbttagcompound.putFloat("FallDistance", this.fallDistance);
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
@@ -1698,7 +1928,28 @@
@@ -1699,7 +1929,28 @@
nbttagcompound.putBoolean("OnGround", this.onGround());
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
@@ -407,7 +398,7 @@
IChatBaseComponent ichatbasecomponent = this.getCustomName();
if (ichatbasecomponent != null) {
@@ -1747,7 +1998,7 @@
@@ -1748,7 +1999,7 @@
nbttagcompound.put("Tags", nbttaglist);
}
@@ -416,7 +407,7 @@
if (this.isVehicle()) {
nbttaglist = new NBTTagList();
iterator = this.getPassengers().iterator();
@@ -1756,7 +2007,7 @@
@@ -1757,7 +2008,7 @@
Entity entity = (Entity) iterator.next();
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
@@ -425,7 +416,7 @@
nbttaglist.add(nbttagcompound1);
}
}
@@ -1766,6 +2017,11 @@
@@ -1767,6 +2018,11 @@
}
}
@@ -437,7 +428,7 @@
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -1849,6 +2105,45 @@
@@ -1850,6 +2106,45 @@
} else {
throw new IllegalStateException("Entity has invalid position");
}
@@ -483,7 +474,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
@@ -1870,6 +2165,12 @@
@@ -1871,6 +2166,12 @@
return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null;
}
@@ -496,7 +487,7 @@
protected abstract void readAdditionalSaveData(NBTTagCompound nbttagcompound);
protected abstract void addAdditionalSaveData(NBTTagCompound nbttagcompound);
@@ -1924,9 +2225,22 @@
@@ -1925,9 +2226,22 @@
} else if (this.level().isClientSide) {
return null;
} else {
@@ -519,7 +510,7 @@
this.level().addFreshEntity(entityitem);
return entityitem;
}
@@ -2024,6 +2338,18 @@
@@ -2025,6 +2339,18 @@
if (!flag && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
return false;
} else {
@@ -538,7 +529,7 @@
if (this.isPassenger()) {
this.stopRiding();
}
@@ -2057,7 +2383,7 @@
@@ -2058,7 +2384,7 @@
Entity entity = this.vehicle;
this.vehicle = null;
@@ -547,7 +538,7 @@
}
}
@@ -2088,10 +2414,29 @@
@@ -2089,10 +2415,29 @@
}
}
@@ -578,7 +569,7 @@
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
this.passengers = ImmutableList.of();
} else {
@@ -2103,6 +2448,7 @@
@@ -2104,6 +2449,7 @@
entity.boardingCooldown = 60;
this.gameEvent(GameEvent.ENTITY_DISMOUNT, entity);
}
@@ -586,7 +577,7 @@
}
protected boolean canAddPassenger(Entity entity) {
@@ -2189,14 +2535,20 @@
@@ -2190,14 +2536,20 @@
if (this.isInsidePortal) {
MinecraftServer minecraftserver = worldserver.getServer();
@@ -610,7 +601,7 @@
this.level().getProfiler().pop();
}
@@ -2320,6 +2672,13 @@
@@ -2321,6 +2673,13 @@
}
public void setSwimming(boolean flag) {
@@ -624,7 +615,7 @@
this.setSharedFlag(4, flag);
}
@@ -2369,8 +2728,12 @@
@@ -2370,8 +2729,12 @@
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
}
@@ -638,7 +629,7 @@
}
public boolean getSharedFlag(int i) {
@@ -2389,7 +2752,7 @@
@@ -2390,7 +2753,7 @@
}
public int getMaxAirSupply() {
@@ -647,7 +638,7 @@
}
public int getAirSupply() {
@@ -2397,7 +2760,18 @@
@@ -2398,7 +2761,18 @@
}
public void setAirSupply(int i) {
@@ -667,7 +658,7 @@
}
public int getTicksFrozen() {
@@ -2424,11 +2798,41 @@
@@ -2425,11 +2799,41 @@
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
this.setRemainingFireTicks(this.remainingFireTicks + 1);
@@ -711,7 +702,7 @@
}
public void onAboveBubbleCol(boolean flag) {
@@ -2593,15 +2997,38 @@
@@ -2594,15 +2998,38 @@
@Nullable
public Entity changeDimension(WorldServer worldserver) {
@@ -752,7 +743,7 @@
this.level().getProfiler().popPush("reloading");
Entity entity = this.getType().create(worldserver);
@@ -2609,10 +3036,22 @@
@@ -2610,10 +3037,22 @@
entity.restoreFrom(this);
entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
entity.setDeltaMovement(shapedetectorshape.speed);
@@ -778,7 +769,7 @@
}
this.removeAfterChangingDimensions();
@@ -2633,20 +3072,34 @@
@@ -2634,20 +3073,34 @@
@Nullable
protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) {
@@ -818,7 +809,7 @@
IBlockData iblockdata = this.level().getBlockState(this.portalEntrancePos);
EnumDirection.EnumAxis enumdirection_enumaxis;
Vec3D vec3d;
@@ -2663,8 +3116,8 @@
@@ -2664,8 +3117,8 @@
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
}
@@ -829,7 +820,7 @@
}
} else {
BlockPosition blockposition1;
@@ -2674,8 +3127,14 @@
@@ -2675,8 +3128,14 @@
} else {
blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos());
}
@@ -845,7 +836,7 @@
}
}
@@ -2683,8 +3142,23 @@
@@ -2684,8 +3143,23 @@
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
}
@@ -871,7 +862,7 @@
}
public boolean canChangeDimensions() {
@@ -2804,6 +3278,12 @@
@@ -2806,6 +3280,12 @@
}
}
@@ -884,7 +875,7 @@
public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<RelativeMovement> set, float f, float f1) {
float f2 = MathHelper.clamp(f1, -90.0F, 90.0F);
@@ -2823,7 +3303,11 @@
@@ -2825,7 +3305,11 @@
entity.moveTo(d0, d1, d2, f, f2);
entity.setYHeadRot(f);
this.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION);
@@ -897,7 +888,7 @@
}
return true;
@@ -2929,7 +3413,26 @@
@@ -2931,7 +3415,26 @@
}
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
@@ -925,7 +916,7 @@
}
protected float getEyeHeight(EntityPose entitypose, EntitySize entitysize) {
@@ -3240,6 +3743,11 @@
@@ -3246,6 +3749,11 @@
vec3d = vec3d.add(vec3d1);
++k1;
}

View File

@@ -64,7 +64,7 @@
@@ -250,9 +273,17 @@
if (entry != null) {
ItemStack itemstack = (ItemStack) entry.getValue();
int j = Math.min(this.xpToDurability(this.value), itemstack.getDamageValue());
int j = Math.min(this.xpToDurability(i), itemstack.getDamageValue());
+ // CraftBukkit start
+ org.bukkit.event.player.PlayerItemMendEvent event = CraftEventFactory.callPlayerItemMendEvent(entityhuman, this, itemstack, entry.getKey(), j);
+ j = event.getRepairAmount();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityInsentient.java
+++ b/net/minecraft/world/entity/EntityInsentient.java
@@ -75,6 +75,19 @@
@@ -76,6 +76,19 @@
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.phys.AxisAlignedBB;
@@ -20,7 +20,7 @@
public abstract class EntityInsentient extends EntityLiving implements Targeting {
private static final DataWatcherObject<Byte> DATA_MOB_FLAGS_ID = DataWatcher.defineId(EntityInsentient.class, DataWatcherRegistry.BYTE);
@@ -122,6 +135,8 @@
@@ -123,6 +136,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);
@@ -147,6 +162,12 @@
@@ -148,6 +163,12 @@
}
@@ -42,7 +42,7 @@
protected void registerGoals() {}
public static AttributeProvider.Builder createMobAttributes() {
@@ -258,7 +279,38 @@
@@ -259,7 +280,38 @@
}
public void setTarget(@Nullable EntityLiving entityliving) {
@@ -81,7 +81,7 @@
}
@Override
@@ -398,6 +450,12 @@
@@ -399,6 +451,12 @@
return null;
}
@@ -94,7 +94,7 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@@ -456,7 +514,7 @@
@@ -457,7 +515,7 @@
}
nbttagcompound.put("HandDropChances", nbttaglist3);
@@ -103,7 +103,7 @@
nbttagcompound2 = new NBTTagCompound();
if (this.leashHolder instanceof EntityLiving) {
UUID uuid = this.leashHolder.getUUID();
@@ -487,16 +545,26 @@
@@ -488,16 +546,26 @@
nbttagcompound.putBoolean("NoAI", this.isNoAi());
}
@@ -132,7 +132,7 @@
NBTTagList nbttaglist;
int i;
@@ -543,6 +611,11 @@
@@ -544,6 +612,11 @@
}
this.setNoAi(nbttagcompound.getBoolean("NoAI"));
@@ -144,7 +144,7 @@
}
@Override
@@ -610,7 +683,7 @@
@@ -611,7 +684,7 @@
protected void pickUpItem(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItem();
@@ -153,7 +153,7 @@
if (!itemstack1.isEmpty()) {
this.onItemPickup(entityitem);
@@ -624,6 +697,12 @@
@@ -625,6 +698,12 @@
}
public ItemStack equipItemIfPossible(ItemStack itemstack) {
@@ -166,7 +166,7 @@
EnumItemSlot enumitemslot = getEquipmentSlotForItem(itemstack);
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
boolean flag = this.canReplaceCurrentItem(itemstack, itemstack1);
@@ -634,11 +713,19 @@
@@ -635,11 +714,19 @@
flag = itemstack1.isEmpty();
}
@@ -187,7 +187,7 @@
}
if (enumitemslot.isArmor() && itemstack.getCount() > 1) {
@@ -790,6 +877,7 @@
@@ -791,6 +878,7 @@
@Override
protected final void serverAiStep() {
++this.noActionTime;
@@ -195,7 +195,7 @@
this.level().getProfiler().push("sensing");
this.sensing.tick();
this.level().getProfiler().pop();
@@ -1183,6 +1271,12 @@
@@ -1184,6 +1272,12 @@
if (!this.isAlive()) {
return EnumInteractionResult.PASS;
} else if (this.getLeashHolder() == entityhuman) {
@@ -208,7 +208,7 @@
this.dropLeash(true, !entityhuman.getAbilities().instabuild);
this.gameEvent(GameEvent.ENTITY_INTERACT, entityhuman);
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
@@ -1208,6 +1302,12 @@
@@ -1209,6 +1303,12 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.LEAD) && this.canBeLeashed(entityhuman)) {
@@ -221,7 +221,7 @@
this.setLeashedTo(entityhuman, true);
itemstack.shrink(1);
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
@@ -1223,7 +1323,7 @@
@@ -1224,7 +1324,7 @@
if (itemstack.getItem() instanceof ItemMonsterEgg) {
if (this.level() instanceof WorldServer) {
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
@@ -230,7 +230,7 @@
optional.ifPresent((entityinsentient) -> {
this.onOffspringSpawnedFromEgg(entityhuman, entityinsentient);
@@ -1273,12 +1373,19 @@
@@ -1274,12 +1374,19 @@
return this.restrictRadius != -1.0F;
}
@@ -251,7 +251,7 @@
if (t0 == null) {
return null;
@@ -1312,7 +1419,12 @@
@@ -1313,7 +1420,12 @@
}
}
@@ -265,7 +265,7 @@
if (this.isPassenger()) {
Entity entity = this.getVehicle();
@@ -1333,7 +1445,8 @@
@@ -1334,7 +1446,8 @@
if (this.leashHolder != null) {
if (!this.isAlive() || !this.leashHolder.isAlive()) {
@@ -275,7 +275,7 @@
}
}
@@ -1344,7 +1457,9 @@
@@ -1345,7 +1458,9 @@
this.leashHolder = null;
this.leashInfoTag = null;
if (!this.level().isClientSide && flag1) {
@@ -285,7 +285,7 @@
}
if (!this.level().isClientSide && flag && this.level() instanceof WorldServer) {
@@ -1394,6 +1509,7 @@
@@ -1395,6 +1510,7 @@
boolean flag1 = super.startRiding(entity, flag);
if (flag1 && this.isLeashed()) {
@@ -293,7 +293,7 @@
this.dropLeash(true, true);
}
@@ -1418,7 +1534,9 @@
@@ -1419,7 +1535,9 @@
}
if (this.tickCount > 100) {
@@ -303,7 +303,7 @@
this.leashInfoTag = null;
}
}
@@ -1500,7 +1618,14 @@
@@ -1501,7 +1619,14 @@
int i = EnchantmentManager.getFireAspect(this);
if (i > 0) {
@@ -319,7 +319,7 @@
}
boolean flag = entity.hurt(this.damageSources().mobAttack(this), f);
@@ -1574,6 +1699,7 @@
@@ -1576,6 +1701,7 @@
@Override
protected void removeAfterChangingDimensions() {
super.removeAfterChangingDimensions();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityLightning.java
+++ b/net/minecraft/world/entity/EntityLightning.java
@@ -29,14 +29,18 @@
@@ -29,6 +29,10 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
@@ -11,16 +11,6 @@
public class EntityLightning extends Entity {
private static final int START_LIFE = 2;
private static final double DAMAGE_RADIUS = 3.0D;
private static final double DETECTION_RADIUS = 15.0D;
- private int life;
+ public int life; // PAIL private -> public
public long seed;
- private int flashes;
+ public int flashes; // PAIL private -> public
public boolean visualOnly;
@Nullable
private EntityPlayer cause;
@@ -129,7 +133,7 @@
}
}

View File

@@ -31,7 +31,7 @@
public abstract class EntityLiving extends Entity implements Attackable {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -227,6 +251,20 @@
@@ -226,6 +250,20 @@
private float swimAmountO;
protected BehaviorController<?> brain;
private boolean skipDropExperience;
@@ -52,7 +52,7 @@
protected EntityLiving(EntityTypes<? extends EntityLiving> entitytypes, World world) {
super(entitytypes, world);
@@ -239,7 +277,9 @@
@@ -238,7 +276,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();
@@ -318,7 +358,13 @@
@@ -317,7 +357,13 @@
double d7 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
int i = (int) (150.0D * d7);
@@ -78,7 +78,7 @@
}
super.checkFallDamage(d0, flag, iblockdata, blockposition);
@@ -673,13 +719,19 @@
@@ -672,13 +718,19 @@
}
public void onEquipItem(EnumItemSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1) {
@@ -99,7 +99,7 @@
this.level().playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), equipable.getEquipSound(), this.getSoundSource(), 1.0F, 1.0F);
}
@@ -753,6 +805,17 @@
@@ -752,6 +804,17 @@
}
}
@@ -117,7 +117,7 @@
if (nbttagcompound.contains("Health", 99)) {
this.setHealth(nbttagcompound.getFloat("Health"));
}
@@ -790,9 +853,32 @@
@@ -789,9 +852,32 @@
}
@@ -150,7 +150,7 @@
try {
while (iterator.hasNext()) {
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
@@ -802,6 +888,12 @@
@@ -801,6 +887,12 @@
this.onEffectUpdated(mobeffect, true, (Entity) null);
})) {
if (!this.level().isClientSide) {
@@ -163,7 +163,7 @@
iterator.remove();
this.onEffectRemoved(mobeffect);
}
@@ -812,6 +904,17 @@
@@ -811,6 +903,17 @@
} catch (ConcurrentModificationException concurrentmodificationexception) {
;
}
@@ -181,7 +181,7 @@
if (this.effectsDirty) {
if (!this.level().isClientSide) {
@@ -938,7 +1041,13 @@
@@ -937,7 +1040,13 @@
this.entityData.set(EntityLiving.DATA_EFFECT_COLOR_ID, 0);
}
@@ -195,7 +195,7 @@
if (this.level().isClientSide) {
return false;
} else {
@@ -947,7 +1056,14 @@
@@ -946,7 +1055,14 @@
boolean flag;
for (flag = false; iterator.hasNext(); flag = true) {
@@ -211,7 +211,7 @@
iterator.remove();
}
@@ -976,19 +1092,49 @@
@@ -975,19 +1091,49 @@
return this.addEffect(mobeffect, (Entity) null);
}
@@ -262,7 +262,7 @@
flag = true;
}
@@ -1026,13 +1172,39 @@
@@ -1025,13 +1171,39 @@
return this.getMobType() == EnumMonsterType.UNDEAD;
}
@@ -303,7 +303,7 @@
if (mobeffect != null) {
this.onEffectRemoved(mobeffect);
@@ -1130,20 +1302,55 @@
@@ -1129,20 +1301,55 @@
}
@@ -360,7 +360,7 @@
this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.clamp(f, 0.0F, this.getMaxHealth()));
}
@@ -1157,7 +1364,7 @@
@@ -1156,7 +1363,7 @@
return false;
} else if (this.level().isClientSide) {
return false;
@@ -369,7 +369,7 @@
return false;
} else if (damagesource.is(DamageTypeTags.IS_FIRE) && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
return false;
@@ -1168,10 +1375,11 @@
@@ -1167,10 +1374,11 @@
this.noActionTime = 0;
float f1 = f;
@@ -383,7 +383,7 @@
this.hurtCurrentlyUsedShield(f);
f2 = f;
f = 0.0F;
@@ -1195,23 +1403,33 @@
@@ -1194,23 +1402,33 @@
this.walkAnimation.setSpeed(1.5F);
boolean flag1 = true;
@@ -422,7 +422,7 @@
this.hurtHelmet(damagesource, f);
f *= 0.75F;
}
@@ -1329,19 +1547,32 @@
@@ -1328,19 +1546,32 @@
EnumHand[] aenumhand = EnumHand.values();
int i = aenumhand.length;
@@ -459,7 +459,7 @@
EntityPlayer entityplayer = (EntityPlayer) this;
entityplayer.awardStat(StatisticList.ITEM_USED.get(Items.TOTEM_OF_UNDYING));
@@ -1350,14 +1581,16 @@
@@ -1349,14 +1580,16 @@
}
this.setHealth(1.0F);
@@ -481,7 +481,7 @@
}
}
@@ -1466,14 +1699,22 @@
@@ -1463,14 +1696,22 @@
IBlockData iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
@@ -506,7 +506,7 @@
this.level().addFreshEntity(entityitem);
}
}
@@ -1493,21 +1734,40 @@
@@ -1490,21 +1731,40 @@
boolean flag = this.lastHurtByPlayerTime > 0;
@@ -550,7 +550,7 @@
}
@@ -1599,6 +1859,28 @@
@@ -1596,6 +1856,28 @@
return itemstack.getEatingSound();
}
@@ -579,7 +579,7 @@
public Optional<BlockPosition> getLastClimbablePos() {
return this.lastClimbablePos;
}
@@ -1645,9 +1927,14 @@
@@ -1642,9 +1924,14 @@
int i = this.calculateFallDamage(f, f1);
if (i > 0) {
@@ -595,7 +595,7 @@
return true;
} else {
return flag;
@@ -1699,7 +1986,7 @@
@@ -1696,7 +1983,7 @@
protected float getDamageAfterArmorAbsorb(DamageSource damagesource, float f) {
if (!damagesource.is(DamageTypeTags.BYPASSES_ARMOR)) {
@@ -604,7 +604,7 @@
f = CombatMath.getDamageAfterAbsorb(f, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
}
@@ -1712,7 +1999,8 @@
@@ -1709,7 +1996,8 @@
} else {
int i;
@@ -614,7 +614,7 @@
i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
@@ -1745,16 +2033,125 @@
@@ -1742,16 +2030,125 @@
}
}
@@ -748,7 +748,7 @@
if (f2 > 0.0F && f2 < 3.4028235E37F) {
Entity entity = damagesource.getEntity();
@@ -1765,13 +2162,47 @@
@@ -1762,13 +2159,47 @@
}
}
@@ -798,7 +798,7 @@
}
public CombatTracker getCombatTracker() {
@@ -1796,8 +2227,18 @@
@@ -1793,8 +2224,18 @@
}
public final void setArrowCount(int i) {
@@ -818,7 +818,7 @@
public final int getStingerCount() {
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
@@ -2039,6 +2480,12 @@
@@ -2036,6 +2477,12 @@
public abstract ItemStack getItemBySlot(EnumItemSlot enumitemslot);
@@ -831,7 +831,7 @@
@Override
public abstract void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
@@ -2273,6 +2720,7 @@
@@ -2270,6 +2717,7 @@
}
if (this.onGround() && !this.level().isClientSide) {
@@ -839,7 +839,7 @@
this.setSharedFlag(7, false);
}
} else {
@@ -2443,7 +2891,7 @@
@@ -2440,7 +2888,7 @@
}
}
@@ -848,7 +848,7 @@
if (this.tickCount % 20 == 0) {
this.getCombatTracker().recheckStatus();
}
@@ -2540,7 +2988,7 @@
@@ -2537,7 +2985,7 @@
this.refreshDirtyAttributes();
}
@@ -857,7 +857,7 @@
Map<EnumItemSlot, ItemStack> map = this.collectEquipmentChanges();
if (map != null) {
@@ -2837,6 +3285,7 @@
@@ -2839,6 +3287,7 @@
}
if (!this.level().isClientSide) {
@@ -865,7 +865,7 @@
this.setSharedFlag(7, flag);
}
@@ -3027,13 +3476,20 @@
@@ -3029,13 +3478,20 @@
@Override
public boolean isPickable() {
@@ -888,7 +888,7 @@
@Override
public float getYHeadRot() {
@@ -3229,7 +3685,26 @@
@@ -3231,7 +3687,26 @@
} else {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
this.triggerItemUseEffects(this.useItem, 16);
@@ -916,7 +916,7 @@
if (itemstack != this.useItem) {
this.setItemInHand(enumhand, itemstack);
@@ -3307,6 +3782,12 @@
@@ -3309,6 +3784,12 @@
}
public boolean randomTeleport(double d0, double d1, double d2, boolean flag) {
@@ -929,7 +929,7 @@
double d3 = this.getX();
double d4 = this.getY();
double d5 = this.getZ();
@@ -3331,16 +3812,41 @@
@@ -3333,16 +3814,41 @@
}
if (flag2) {
@@ -974,8 +974,8 @@
} else {
if (flag) {
world.broadcastEntityEvent(this, (byte) 46);
@@ -3350,7 +3856,7 @@
((EntityCreature) this).getNavigation().stop();
@@ -3354,7 +3860,7 @@
entitycreature.getNavigation().stop();
}
- return true;
@@ -983,7 +983,7 @@
}
}
@@ -3439,7 +3945,7 @@
@@ -3443,7 +3949,7 @@
}
public void stopSleeping() {
@@ -992,7 +992,7 @@
World world = this.level();
java.util.Objects.requireNonNull(world);
@@ -3473,7 +3979,7 @@
@@ -3477,7 +3983,7 @@
@Nullable
public EnumDirection getBedOrientation() {
@@ -1001,7 +1001,7 @@
return blockposition != null ? BlockBed.getBedOrientation(this.level(), blockposition) : null;
}
@@ -3521,7 +4027,7 @@
@@ -3525,7 +4031,7 @@
Pair<MobEffect, Float> pair = (Pair) iterator.next();
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityTypes.java
+++ b/net/minecraft/world/entity/EntityTypes.java
@@ -158,6 +158,7 @@
@@ -160,6 +160,7 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -8,7 +8,7 @@
import org.slf4j.Logger;
public class EntityTypes<T extends Entity> implements FeatureElement, EntityTypeTest<Entity, T> {
@@ -168,7 +169,7 @@
@@ -170,7 +171,7 @@
private static final float MAGIC_HORSE_WIDTH = 1.3964844F;
private static final int DISPLAY_TRACKING_RANGE = 10;
public static final EntityTypes<Allay> ALLAY = register("allay", EntityTypes.Builder.of(Allay::new, EnumCreatureType.CREATURE).sized(0.35F, 0.6F).clientTrackingRange(8).updateInterval(2));
@@ -17,7 +17,7 @@
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));
@@ -309,8 +310,8 @@
@@ -313,8 +314,8 @@
private final EntitySize dimensions;
private final FeatureFlagSet requiredFeatures;
@@ -28,7 +28,7 @@
}
public static MinecraftKey getKey(EntityTypes<?> entitytypes) {
@@ -338,8 +339,15 @@
@@ -342,8 +343,15 @@
@Nullable
public T spawn(WorldServer worldserver, @Nullable ItemStack itemstack, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
@@ -45,7 +45,7 @@
if (itemstack != null) {
nbttagcompound = itemstack.getTag();
@@ -350,7 +358,7 @@
@@ -354,7 +362,7 @@
nbttagcompound = null;
}
@@ -54,7 +54,7 @@
}
public static <T extends Entity> Consumer<T> createDefaultStackConfig(WorldServer worldserver, ItemStack itemstack, @Nullable EntityHuman entityhuman) {
@@ -372,21 +380,37 @@
@@ -376,21 +384,37 @@
NBTTagCompound nbttagcompound = itemstack.getTag();
return nbttagcompound != null ? consumer.andThen((entity) -> {
@@ -95,7 +95,7 @@
}
return t0;
@@ -573,7 +597,7 @@
@@ -577,7 +601,7 @@
}
return entity;
@@ -104,7 +104,7 @@
}
public static Stream<Entity> loadEntitiesRecursive(final List<? extends NBTBase> list, final World world) {
@@ -634,7 +658,7 @@
@@ -638,7 +662,7 @@
@Nullable
public T tryCast(Entity entity) {
@@ -113,7 +113,7 @@
}
@Override
@@ -669,7 +693,7 @@
@@ -673,7 +697,7 @@
this.canSpawnFarFromPlayer = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC;
}

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/IEntitySelector.java
+++ b/net/minecraft/world/entity/IEntitySelector.java
@@ -43,7 +43,7 @@
ScoreboardTeamBase.EnumTeamPush scoreboardteambase_enumteampush = scoreboardteambase == null ? ScoreboardTeamBase.EnumTeamPush.ALWAYS : scoreboardteambase.getCollisionRule();
@@ -44,7 +44,7 @@
ScoreboardTeamBase.EnumTeamPush scoreboardteambase_enumteampush = scoreboardteam == null ? ScoreboardTeamBase.EnumTeamPush.ALWAYS : scoreboardteam.getCollisionRule();
return (Predicate) (scoreboardteambase_enumteampush == ScoreboardTeamBase.EnumTeamPush.NEVER ? Predicates.alwaysFalse() : IEntitySelector.NO_SPECTATORS.and((entity1) -> {
- if (!entity1.isPushable()) {

View File

@@ -2,7 +2,7 @@
+++ b/net/minecraft/world/entity/ai/goal/target/PathfinderGoalTarget.java
@@ -11,6 +11,10 @@
import net.minecraft.world.level.pathfinder.PathPoint;
import net.minecraft.world.scores.ScoreboardTeamBase;
import net.minecraft.world.scores.ScoreboardTeam;
+// CraftBukkit start
+import org.bukkit.event.entity.EntityTargetEvent;

View File

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

View File

@@ -35,7 +35,7 @@
}
}
@@ -170,10 +182,17 @@
@@ -172,10 +184,17 @@
}
public void setInLove(@Nullable EntityHuman entityhuman) {
@@ -54,7 +54,7 @@
this.level().broadcastEntityEvent(this, (byte) 18);
}
@@ -215,12 +234,29 @@
@@ -217,12 +236,29 @@
if (entityageable != null) {
entityageable.setBaby(true);
entityageable.moveTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F);
@@ -86,7 +86,7 @@
Optional.ofNullable(this.getLoveCause()).or(() -> {
return Optional.ofNullable(entityanimal.getLoveCause());
}).ifPresent((entityplayer) -> {
@@ -233,7 +269,11 @@
@@ -235,7 +271,11 @@
entityanimal.resetLove();
worldserver.broadcastEntityEvent(this, (byte) 18);
if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {

View File

@@ -20,7 +20,7 @@
private static final DataWatcherObject<BlockPosition> TREASURE_POS = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.BLOCK_POS);
private static final DataWatcherObject<Boolean> GOT_FISH = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.BOOLEAN);
private static final DataWatcherObject<Integer> MOISTNESS_LEVEL = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.INT);
@@ -190,7 +201,7 @@
@@ -185,7 +196,7 @@
@Override
public int getMaxAirSupply() {
@@ -29,7 +29,7 @@
}
@Override
@@ -231,6 +242,12 @@
@@ -226,6 +237,12 @@
ItemStack itemstack = entityitem.getItem();
if (this.canHoldItem(itemstack)) {
@@ -42,7 +42,7 @@
this.onItemPickup(entityitem);
this.setItemSlot(EnumItemSlot.MAINHAND, itemstack);
this.setGuaranteedDrop(EnumItemSlot.MAINHAND);
@@ -489,7 +506,7 @@
@@ -484,7 +501,7 @@
@Override
public void start() {
@@ -51,7 +51,7 @@
}
@Override
@@ -508,7 +525,7 @@
@@ -503,7 +520,7 @@
}
if (this.player.isSwimming() && this.player.level().random.nextInt(6) == 0) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityParrot.java
+++ b/net/minecraft/world/entity/animal/EntityParrot.java
@@ -262,7 +262,7 @@
@@ -263,7 +263,7 @@
}
if (!this.level().isClientSide) {
@@ -9,7 +9,7 @@
this.tame(entityhuman);
this.level().broadcastEntityEvent(this, (byte) 7);
} else {
@@ -276,7 +276,7 @@
@@ -277,7 +277,7 @@
itemstack.shrink(1);
}
@@ -18,7 +18,7 @@
if (entityhuman.isCreative() || !this.isInvulnerable()) {
this.hurt(this.damageSources().playerAttack(entityhuman), Float.MAX_VALUE);
}
@@ -383,7 +383,7 @@
@@ -384,7 +384,7 @@
@Override
public boolean isPushable() {
@@ -27,7 +27,7 @@
}
@Override
@@ -398,11 +398,14 @@
@@ -399,11 +399,14 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityTurtle.java
+++ b/net/minecraft/world/entity/animal/EntityTurtle.java
@@ -312,7 +312,9 @@
@@ -307,7 +307,9 @@
protected void ageBoundaryReached() {
super.ageBoundaryReached();
if (!this.isBaby() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
@@ -10,7 +10,7 @@
}
}
@@ -339,7 +341,9 @@
@@ -334,7 +336,9 @@
@Override
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
@@ -20,7 +20,7 @@
}
@Override
@@ -496,12 +500,14 @@
@@ -491,12 +495,14 @@
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
World world = this.turtle.level();

View File

@@ -27,7 +27,7 @@
}
@Override
@@ -414,7 +421,7 @@
@@ -409,7 +416,7 @@
int i = mobeffect != null ? mobeffect.getDuration() : 0;
int j = Math.min(2400, 100 + i);
@@ -36,7 +36,7 @@
}
entityhuman.removeEffect(MobEffects.DIG_SLOWDOWN);
@@ -464,7 +471,7 @@
@@ -459,7 +466,7 @@
@Override
public BehaviorController<Axolotl> getBrain() {

View File

@@ -48,7 +48,7 @@
flag = true;
}
@@ -591,7 +598,7 @@
@@ -588,7 +595,7 @@
super.aiStep();
if (!this.level().isClientSide && this.isAlive()) {
if (this.random.nextInt(900) == 0 && this.deathTime == 0) {
@@ -57,7 +57,7 @@
}
if (this.canEatGrass()) {
@@ -858,6 +865,7 @@
@@ -855,6 +862,7 @@
if (this.getOwnerUUID() != null) {
nbttagcompound.putUUID("Owner", this.getOwnerUUID());
}
@@ -65,7 +65,7 @@
if (!this.inventory.getItem(0).isEmpty()) {
nbttagcompound.put("SaddleItem", this.inventory.getItem(0).save(new NBTTagCompound()));
@@ -885,6 +893,11 @@
@@ -882,6 +890,11 @@
if (uuid != null) {
this.setOwnerUUID(uuid);
}
@@ -77,7 +77,7 @@
if (nbttagcompound.contains("SaddleItem", 10)) {
ItemStack itemstack = ItemStack.of(nbttagcompound.getCompound("SaddleItem"));
@@ -987,6 +1000,17 @@
@@ -984,6 +997,17 @@
@Override
public void handleStartJump(int i) {

View File

@@ -32,7 +32,7 @@
this.noPhysics = true;
this.noCulling = true;
this.phaseManager = new DragonControllerManager(this);
+ this.explosionSource = new Explosion(world, this, null, null, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, Explosion.Effect.DESTROY); // CraftBukkit
+ this.explosionSource = new Explosion(world, this, null, null, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, Explosion.Effect.DESTROY, Particles.EXPLOSION, Particles.EXPLOSION_EMITTER, SoundEffects.GENERIC_EXPLODE); // CraftBukkit
}
public void setDragonFight(EnderDragonBattle enderdragonbattle) {

View File

@@ -108,7 +108,7 @@
if (damagesource.is(DamageTypeTags.IS_EXPLOSION)) {
this.brokenByAnything(damagesource);
this.kill();
@@ -486,7 +538,7 @@
@@ -473,7 +525,7 @@
} else {
this.brokenByPlayer(damagesource);
this.showBreakingParticles();
@@ -117,7 +117,7 @@
}
return true;
@@ -554,13 +606,13 @@
@@ -541,13 +593,13 @@
itemstack.setHoverName(this.getCustomName());
}
@@ -133,7 +133,7 @@
ItemStack itemstack;
int i;
@@ -568,7 +620,7 @@
@@ -555,7 +607,7 @@
for (i = 0; i < this.handItems.size(); ++i) {
itemstack = (ItemStack) this.handItems.get(i);
if (!itemstack.isEmpty()) {
@@ -142,7 +142,7 @@
this.handItems.set(i, ItemStack.EMPTY);
}
}
@@ -576,10 +628,11 @@
@@ -563,10 +615,11 @@
for (i = 0; i < this.armorItems.size(); ++i) {
itemstack = (ItemStack) this.armorItems.get(i);
if (!itemstack.isEmpty()) {
@@ -155,7 +155,7 @@
}
@@ -675,8 +728,16 @@
@@ -662,8 +715,16 @@
return this.isSmall();
}

View File

@@ -48,7 +48,7 @@
@Override
public boolean survives() {
@@ -173,6 +185,11 @@
@@ -168,6 +180,11 @@
return false;
} else if (!damagesource.is(DamageTypeTags.IS_EXPLOSION) && !this.getItem().isEmpty()) {
if (!this.level().isClientSide) {
@@ -60,7 +60,7 @@
this.dropItem(damagesource.getEntity(), false);
this.gameEvent(GameEvent.BLOCK_CHANGE, damagesource.getEntity());
this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F);
@@ -302,13 +319,19 @@
@@ -297,13 +314,19 @@
}
public void setItem(ItemStack itemstack, boolean flag) {

View File

@@ -15,7 +15,7 @@
public class EntityItem extends Entity implements TraceableEntity {
private static final DataWatcherObject<ItemStack> DATA_ITEM = DataWatcher.defineId(EntityItem.class, DataWatcherRegistry.ITEM_STACK);
@@ -45,6 +53,7 @@
@@ -47,6 +55,7 @@
@Nullable
public UUID target;
public final float bobOffs;
@@ -23,7 +23,7 @@
public EntityItem(EntityTypes<? extends EntityItem> entitytypes, World world) {
super(entitytypes, world);
@@ -110,9 +119,12 @@
@@ -128,9 +137,12 @@
this.discard();
} else {
super.tick();
@@ -39,7 +39,7 @@
this.xo = this.getX();
this.yo = this.getY();
@@ -162,9 +174,11 @@
@@ -180,9 +192,11 @@
this.mergeWithNeighbours();
}
@@ -51,7 +51,7 @@
this.hasImpulse |= this.updateInWaterStateAndDoFluidPushing();
if (!this.level().isClientSide) {
@@ -176,6 +190,12 @@
@@ -194,6 +208,12 @@
}
if (!this.level().isClientSide && this.age >= 6000) {
@@ -64,7 +64,7 @@
this.discard();
}
@@ -259,6 +279,11 @@
@@ -277,6 +297,11 @@
}
private static void merge(EntityItem entityitem, ItemStack itemstack, EntityItem entityitem1, ItemStack itemstack1) {
@@ -76,7 +76,7 @@
merge(entityitem, itemstack, itemstack1);
entityitem.pickupDelay = Math.max(entityitem.pickupDelay, entityitem1.pickupDelay);
entityitem.age = Math.min(entityitem.age, entityitem1.age);
@@ -284,6 +309,11 @@
@@ -302,6 +327,11 @@
} else if (this.level().isClientSide) {
return true;
} else {
@@ -88,7 +88,7 @@
this.markHurt();
this.health = (int) ((float) this.health - f);
this.gameEvent(GameEvent.ENTITY_DAMAGE, damagesource.getEntity());
@@ -347,6 +377,46 @@
@@ -366,6 +396,46 @@
Item item = itemstack.getItem();
int i = itemstack.getCount();

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/item/EntityTNTPrimed.java
+++ b/net/minecraft/world/entity/item/EntityTNTPrimed.java
@@ -15,12 +15,19 @@
import net.minecraft.world.entity.TraceableEntity;
import net.minecraft.world.level.World;
@@ -19,6 +19,11 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.IBlockData;
+// CraftBukkit start;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -12,7 +12,8 @@
public class EntityTNTPrimed extends Entity implements TraceableEntity {
private static final DataWatcherObject<Integer> DATA_FUSE_ID = DataWatcher.defineId(EntityTNTPrimed.class, DataWatcherRegistry.INT);
private static final int DEFAULT_FUSE_TIME = 80;
@@ -28,6 +33,8 @@
public static final String TAG_FUSE = "fuse";
@Nullable
public EntityLiving owner;
+ public float yield = 4; // CraftBukkit - add field
@@ -20,7 +21,7 @@
public EntityTNTPrimed(EntityTypes<? extends EntityTNTPrimed> entitytypes, World world) {
super(entitytypes, world);
@@ -71,10 +78,13 @@
@@ -79,10 +86,13 @@
this.setFuse(i);
if (i <= 0) {
@@ -35,7 +36,7 @@
} else {
this.updateInWaterStateAndDoFluidPushing();
if (this.level().isClientSide) {
@@ -85,9 +95,14 @@
@@ -93,9 +103,14 @@
}
private void explode() {

View File

@@ -1,9 +1,9 @@
--- a/net/minecraft/world/entity/monster/EntityEvoker.java
+++ b/net/minecraft/world/entity/monster/EntityEvoker.java
@@ -194,7 +194,7 @@
entityvex.setOwner(EntityEvoker.this);
entityvex.setBoundOrigin(blockposition);
entityvex.setLimitedLife(20 * (30 + EntityEvoker.this.random.nextInt(90)));
@@ -200,7 +200,7 @@
worldserver.getScoreboard().addPlayerToTeam(entityvex.getScoreboardName(), scoreboardteam);
}
- worldserver.addFreshEntityWithPassengers(entityvex);
+ worldserver.addFreshEntityWithPassengers(entityvex, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPELL); // CraftBukkit - Add SpawnReason
worldserver.gameEvent(GameEvent.ENTITY_PLACE, blockposition, GameEvent.a.of((Entity) EntityEvoker.this));

View File

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

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/warden/Warden.java
+++ b/net/minecraft/world/entity/monster/warden/Warden.java
@@ -372,7 +372,7 @@
@@ -373,7 +373,7 @@
@Override
public BehaviorController<Warden> getBrain() {
@@ -9,7 +9,7 @@
}
@Override
@@ -413,13 +413,13 @@
@@ -414,13 +414,13 @@
public static void applyDarknessAround(WorldServer worldserver, Vec3D vec3d, @Nullable Entity entity, int i) {
MobEffect mobeffect = new MobEffect(MobEffects.DARKNESS, 260, 0, false, false);
@@ -25,7 +25,7 @@
Logger logger = Warden.LOGGER;
Objects.requireNonNull(logger);
@@ -444,7 +444,7 @@
@@ -445,7 +445,7 @@
dataresult = AngerManagement.codec(this::canTargetEntity).parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("anger")));
logger = Warden.LOGGER;
Objects.requireNonNull(logger);
@@ -34,7 +34,7 @@
this.angerManagement = angermanagement;
});
this.syncClientAngerLevel();
@@ -454,7 +454,7 @@
@@ -455,7 +455,7 @@
dataresult = VibrationSystem.a.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener")));
logger = Warden.LOGGER;
Objects.requireNonNull(logger);
@@ -43,7 +43,7 @@
this.vibrationData = vibrationsystem_a;
});
}
@@ -488,7 +488,7 @@
@@ -489,7 +489,7 @@
public void increaseAngerAt(@Nullable Entity entity, int i, boolean flag) {
if (!this.isNoAi() && this.canTargetEntity(entity)) {
WardenAi.setDigCooldown(this);
@@ -52,7 +52,7 @@
int j = this.angerManagement.increaseAnger(entity, i);
if (entity instanceof EntityHuman && flag1 && AngerLevel.byAnger(j).isAngry()) {
@@ -509,7 +509,7 @@
@@ -510,7 +510,7 @@
@Nullable
@Override
public EntityLiving getTarget() {
@@ -61,7 +61,7 @@
}
@Override
@@ -552,7 +552,7 @@
@@ -553,7 +553,7 @@
public void setAttackTarget(EntityLiving entityliving) {
this.getBrain().eraseMemory(MemoryModuleType.ROAR_TARGET);

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/player/EntityHuman.java
+++ b/net/minecraft/world/entity/player/EntityHuman.java
@@ -117,6 +117,20 @@
import net.minecraft.world.scores.ScoreboardTeamBase;
@@ -112,6 +112,20 @@
import net.minecraft.world.scores.ScoreboardTeam;
import org.slf4j.Logger;
+// CraftBukkit start
@@ -21,17 +21,17 @@
public abstract class EntityHuman extends EntityLiving {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -132,7 +146,8 @@
@@ -127,7 +141,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);
- private static final Map<EntityPose, EntitySize> POSES = ImmutableMap.builder().put(EntityPose.STANDING, EntityHuman.STANDING_DIMENSIONS).put(EntityPose.SLEEPING, EntityHuman.SLEEPING_DIMENSIONS).put(EntityPose.FALL_FLYING, EntitySize.scalable(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.scalable(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.scalable(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.scalable(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.fixed(0.2F, 0.2F)).build();
+ // CraftBukkit - decompile error
+ private static final Map<EntityPose, EntitySize> POSES = ImmutableMap.<EntityPose, EntitySize>builder().put(EntityPose.STANDING, EntityHuman.STANDING_DIMENSIONS).put(EntityPose.SLEEPING, EntityHuman.SLEEPING_DIMENSIONS).put(EntityPose.FALL_FLYING, EntitySize.scalable(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.scalable(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.scalable(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.scalable(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.fixed(0.2F, 0.2F)).build();
private static final 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);
@@ -142,10 +157,10 @@
protected static final DataWatcherObject<Byte> DATA_PLAYER_MODE_CUSTOMISATION = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.BYTE);
@@ -136,10 +151,10 @@
protected static final DataWatcherObject<NBTTagCompound> DATA_SHOULDER_RIGHT = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.COMPOUND_TAG);
private long timeEntitySatOnShoulder;
private final PlayerInventory inventory = new PlayerInventory(this);
@@ -44,7 +44,7 @@
protected int jumpTriggerTime;
public float oBob;
public float bob;
@@ -174,6 +189,16 @@
@@ -168,6 +183,16 @@
public EntityFishingHook fishing;
protected float hurtDir;
@@ -61,7 +61,7 @@
public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile) {
super(EntityTypes.PLAYER, world);
this.lastItemInMainHand = ItemStack.EMPTY;
@@ -313,7 +338,7 @@
@@ -312,7 +337,7 @@
ItemStack itemstack = this.getItemBySlot(EnumItemSlot.HEAD);
if (itemstack.is(Items.TURTLE_HELMET) && !this.isEyeInFluid(TagsFluid.WATER)) {
@@ -70,7 +70,7 @@
}
}
@@ -483,8 +508,14 @@
@@ -482,8 +507,14 @@
public void rideTick() {
if (!this.level().isClientSide && this.wantsToStopRiding() && this.isPassenger()) {
this.stopRiding();
@@ -84,10 +84,10 @@
+ }
+ {
+ // CraftBukkit end
double d0 = this.getX();
double d1 = this.getY();
double d2 = this.getZ();
@@ -511,7 +542,8 @@
super.rideTick();
this.oBob = this.bob;
this.bob = 0.0F;
@@ -505,7 +536,8 @@
if (this.level().getDifficulty() == EnumDifficulty.PEACEFUL && this.level().getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION)) {
if (this.getHealth() < this.getMaxHealth() && this.tickCount % 20 == 0) {
@@ -97,7 +97,7 @@
}
if (this.foodData.needsFood() && this.tickCount % 10 == 0) {
@@ -671,6 +703,13 @@
@@ -665,6 +697,13 @@
@Nullable
public EntityItem drop(ItemStack itemstack, boolean flag, boolean flag1) {
@@ -111,7 +111,7 @@
if (itemstack.isEmpty()) {
return null;
} else {
@@ -705,6 +744,33 @@
@@ -699,6 +738,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);
}
@@ -145,7 +145,7 @@
return entityitem;
}
}
@@ -795,7 +861,7 @@
@@ -789,7 +855,7 @@
}
if (nbttagcompound.contains("LastDeathLocation", 10)) {
@@ -154,7 +154,7 @@
Logger logger = EntityHuman.LOGGER;
Objects.requireNonNull(logger);
@@ -828,7 +894,7 @@
@@ -822,7 +888,7 @@
}
this.getLastDeathLocation().flatMap((globalpos) -> {
@@ -163,7 +163,7 @@
Logger logger = EntityHuman.LOGGER;
Objects.requireNonNull(logger);
@@ -855,12 +921,12 @@
@@ -849,12 +915,12 @@
return false;
} else {
if (!this.level().isClientSide) {
@@ -178,7 +178,7 @@
}
if (this.level().getDifficulty() == EnumDifficulty.EASY) {
@@ -872,7 +938,13 @@
@@ -866,7 +932,13 @@
}
}
@@ -193,12 +193,12 @@
}
}
}
@@ -892,10 +964,29 @@
@@ -886,10 +958,29 @@
}
public boolean canHarmPlayer(EntityHuman entityhuman) {
- ScoreboardTeamBase scoreboardteambase = this.getTeam();
- ScoreboardTeamBase scoreboardteambase1 = entityhuman.getTeam();
- ScoreboardTeam scoreboardteam = this.getTeam();
- ScoreboardTeam scoreboardteam1 = entityhuman.getTeam();
+ // CraftBukkit start - Change to check OTHER player's scoreboard team according to API
+ // To summarize this method's logic, it's "Can parameter hurt this"
+ org.bukkit.scoreboard.Team team;
@@ -217,7 +217,7 @@
+ }
+ }
- return scoreboardteambase == null ? true : (!scoreboardteambase.isAlliedTo(scoreboardteambase1) ? true : scoreboardteambase.isAllowFriendlyFire());
- return scoreboardteam == null ? true : (!scoreboardteam.isAlliedTo(scoreboardteam1) ? true : scoreboardteam.isAllowFriendlyFire());
+ if (this instanceof EntityPlayer) {
+ return !team.hasPlayer(((EntityPlayer) this).getBukkitEntity());
+ }
@@ -226,7 +226,7 @@
}
@Override
@@ -937,8 +1028,13 @@
@@ -931,8 +1022,13 @@
}
}
@@ -241,7 +241,7 @@
if (!this.isInvulnerableTo(damagesource)) {
f = this.getDamageAfterArmorAbsorb(damagesource, f);
f = this.getDamageAfterMagicAbsorb(damagesource, f);
@@ -953,7 +1049,7 @@
@@ -947,7 +1043,7 @@
}
if (f != 0.0F) {
@@ -250,7 +250,7 @@
this.getCombatTracker().recordDamage(damagesource, f);
this.setHealth(this.getHealth() - f);
if (f < 3.4028235E37F) {
@@ -963,6 +1059,7 @@
@@ -957,6 +1053,7 @@
this.gameEvent(GameEvent.ENTITY_DAMAGE);
}
}
@@ -258,7 +258,7 @@
}
@Override
@@ -1127,7 +1224,7 @@
@@ -1121,7 +1218,7 @@
f *= 0.2F + f2 * f2 * 0.8F;
f1 *= f2;
@@ -267,7 +267,7 @@
if (f > 0.0F || f1 > 0.0F) {
boolean flag = f2 > 0.9F;
boolean flag1 = false;
@@ -1166,8 +1263,15 @@
@@ -1160,8 +1257,15 @@
if (entity instanceof EntityLiving) {
f3 = ((EntityLiving) entity).getHealth();
if (j > 0 && !entity.isOnFire()) {
@@ -285,7 +285,7 @@
}
}
@@ -1195,8 +1299,11 @@
@@ -1189,8 +1293,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) {
@@ -298,7 +298,7 @@
}
}
@@ -1205,9 +1312,26 @@
@@ -1199,9 +1306,26 @@
}
if (entity instanceof EntityPlayer && entity.hurtMarked) {
@@ -325,7 +325,7 @@
}
if (flag2) {
@@ -1252,7 +1376,14 @@
@@ -1246,7 +1370,14 @@
this.awardStat(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F));
if (j > 0) {
@@ -341,7 +341,7 @@
}
if (this.level() instanceof WorldServer && f5 > 2.0F) {
@@ -1262,12 +1393,17 @@
@@ -1256,12 +1387,17 @@
}
}
@@ -360,7 +360,7 @@
}
}
@@ -1344,6 +1480,12 @@
@@ -1338,6 +1474,12 @@
}
public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition) {
@@ -373,7 +373,7 @@
this.startSleeping(blockposition);
this.sleepCounter = 0;
return Either.right(Unit.INSTANCE);
@@ -1431,9 +1573,9 @@
@@ -1425,9 +1567,9 @@
super.jumpFromGround();
this.awardStat(StatisticList.JUMP);
if (this.isSprinting()) {
@@ -385,9 +385,9 @@
}
}
@@ -1463,7 +1605,11 @@
@@ -1454,7 +1596,11 @@
this.setDeltaMovement(vec3d2.x, d3 * 0.6D, vec3d2.z);
this.setDeltaMovement(vec3d2.x, d0 * 0.6D, vec3d2.z);
this.resetFallDistance();
- this.setSharedFlag(7, false);
+ // CraftBukkit start
@@ -398,47 +398,7 @@
} else {
super.travel(vec3d);
}
@@ -1498,19 +1644,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);
- this.causeFoodExhaustion(0.01F * (float) i * 0.01F);
+ this.causeFoodExhaustion(0.01F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.SWIM); // CraftBukkit - EntityExhaustionEvent
}
} else if (this.isEyeInFluid(TagsFluid.WATER)) {
i = Math.round((float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
this.awardStat(StatisticList.WALK_UNDER_WATER_ONE_CM, i);
- this.causeFoodExhaustion(0.01F * (float) i * 0.01F);
+ this.causeFoodExhaustion(0.01F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK_UNDERWATER); // CraftBukkit - EntityExhaustionEvent
}
} else if (this.isInWater()) {
i = Math.round((float) Math.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) {
this.awardStat(StatisticList.WALK_ON_WATER_ONE_CM, i);
- this.causeFoodExhaustion(0.01F * (float) i * 0.01F);
+ this.causeFoodExhaustion(0.01F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK_ON_WATER); // CraftBukkit - EntityExhaustionEvent
}
} else if (this.onClimbable()) {
if (d1 > 0.0D) {
@@ -1521,13 +1667,13 @@
if (i > 0) {
if (this.isSprinting()) {
this.awardStat(StatisticList.SPRINT_ONE_CM, i);
- this.causeFoodExhaustion(0.1F * (float) i * 0.01F);
+ this.causeFoodExhaustion(0.1F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.SPRINT); // CraftBukkit - EntityExhaustionEvent
} else if (this.isCrouching()) {
this.awardStat(StatisticList.CROUCH_ONE_CM, i);
- this.causeFoodExhaustion(0.0F * (float) i * 0.01F);
+ this.causeFoodExhaustion(0.0F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.CROUCH); // CraftBukkit - EntityExhaustionEvent
} else {
this.awardStat(StatisticList.WALK_ONE_CM, i);
- this.causeFoodExhaustion(0.0F * (float) i * 0.01F);
+ this.causeFoodExhaustion(0.0F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK); // CraftBukkit - EntityExhaustionEvent
}
}
} else if (this.isFallFlying()) {
@@ -1593,12 +1739,24 @@
@@ -1507,12 +1653,24 @@
}
public void startFallFlying() {
@@ -464,7 +424,7 @@
}
@Override
@@ -1712,10 +1870,21 @@
@@ -1626,10 +1784,21 @@
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
}
@@ -487,7 +447,7 @@
}
}
@@ -1801,13 +1970,20 @@
@@ -1715,13 +1884,20 @@
@Override
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
@@ -511,7 +471,7 @@
}
}
@@ -1846,26 +2022,31 @@
@@ -1760,26 +1936,31 @@
protected void removeEntitiesOnShoulder() {
if (this.timeEntitySatOnShoulder + 20L < this.level().getGameTime()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityArrow.java
+++ b/net/minecraft/world/entity/projectile/EntityArrow.java
@@ -46,6 +46,12 @@
@@ -47,6 +47,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;
@@ -212,7 +218,7 @@
@@ -219,7 +225,7 @@
}
if (object != null && !flag) {
@@ -22,10 +22,10 @@
this.hasImpulse = true;
}
@@ -359,7 +365,13 @@
int k = entity.getRemainingFireTicks();
@@ -367,7 +373,13 @@
boolean flag1 = entity.getType().is(TagsEntity.DEFLECTS_ARROWS);
if (this.isOnFire() && !flag) {
if (this.isOnFire() && !flag && !flag1) {
- entity.setSecondsOnFire(5);
+ // CraftBukkit start
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
@@ -37,7 +37,7 @@
}
if (entity.hurt(damagesource, (float) i)) {
@@ -522,7 +534,22 @@
@@ -545,7 +557,22 @@
@Override
public void playerTouch(EntityHuman entityhuman) {
if (!this.level().isClientSide && (this.inGround || this.isNoPhysics()) && this.shakeTime <= 0) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityEnderPearl.java
+++ b/net/minecraft/world/entity/projectile/EntityEnderPearl.java
@@ -15,6 +15,13 @@
@@ -18,6 +18,13 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.MovingObjectPositionEntity;
@@ -14,7 +14,7 @@
public class EntityEnderPearl extends EntityProjectileThrowable {
public EntityEnderPearl(EntityTypes<? extends EntityEnderPearl> entitytypes, World world) {
@@ -51,23 +58,36 @@
@@ -54,23 +61,36 @@
EntityPlayer entityplayer = (EntityPlayer) entity;
if (entityplayer.connection.isAcceptingMessages() && entityplayer.level() == this.level() && !entityplayer.isSleeping()) {
@@ -61,10 +61,10 @@
+ CraftEventFactory.entityDamage = null;
+ }
+ // CraftBukkit end
this.level().playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), SoundEffects.PLAYER_TELEPORT, SoundCategory.PLAYERS);
}
} else if (entity != null) {
entity.teleportTo(this.getX(), this.getY(), this.getZ());
@@ -96,7 +116,7 @@
@@ -100,7 +120,7 @@
public Entity changeDimension(WorldServer worldserver) {
Entity entity = this.getOwner();

View File

@@ -1,14 +1,5 @@
--- a/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
+++ b/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
@@ -19,7 +19,7 @@
public static final int ATTACK_DURATION = 20;
public static final int LIFE_OFFSET = 2;
public static final int ATTACK_TRIGGER_TICKS = 14;
- private int warmupDelayTicks;
+ public int warmupDelayTicks;
private boolean sentSpikeEvent;
private int lifeTicks;
private boolean clientSideAttackStarted;
@@ -129,7 +129,9 @@
if (entityliving.isAlive() && !entityliving.isInvulnerable() && entityliving != entityliving1) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityFireball.java
+++ b/net/minecraft/world/entity/projectile/EntityFireball.java
@@ -15,11 +15,15 @@
@@ -17,11 +17,15 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.Vec3D;
@@ -16,7 +16,7 @@
protected EntityFireball(EntityTypes<? extends EntityFireball> entitytypes, World world) {
super(entitytypes, world);
@@ -29,6 +33,12 @@
@@ -36,6 +40,12 @@
this(entitytypes, world);
this.moveTo(d0, d1, d2, this.getYRot(), this.getXRot());
this.reapplyPosition();
@@ -29,8 +29,8 @@
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
if (d6 != 0.0D) {
@@ -75,7 +85,13 @@
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity);
@@ -86,7 +96,13 @@
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType());
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
- this.onHit(movingobjectposition);
@@ -44,7 +44,7 @@
}
this.checkInsideBlocks();
@@ -161,6 +177,11 @@
@@ -184,6 +200,11 @@
if (entity != null) {
if (!this.level().isClientSide) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntitySpectralArrow.java
+++ b/net/minecraft/world/entity/projectile/EntitySpectralArrow.java
@@ -45,7 +45,7 @@
@@ -41,7 +41,7 @@
super.doPostHurtEffects(entityliving);
MobEffect mobeffect = new MobEffect(MobEffects.GLOWING, this.duration, 0);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityThrownTrident.java
+++ b/net/minecraft/world/entity/projectile/EntityThrownTrident.java
@@ -157,7 +157,7 @@
@@ -153,7 +153,7 @@
if (entitylightning != null) {
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
entitylightning.setCause(entity1 instanceof EntityPlayer ? (EntityPlayer) entity1 : null);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityTippedArrow.java
+++ b/net/minecraft/world/entity/projectile/EntityTippedArrow.java
@@ -212,7 +212,7 @@
@@ -213,7 +213,7 @@
mobeffect = (MobEffect) iterator.next();
entityliving.addEffect(new MobEffect(mobeffect.getEffect(), Math.max(mobeffect.mapDuration((i) -> {
return i / 8;
@@ -9,7 +9,7 @@
}
if (!this.effects.isEmpty()) {
@@ -220,7 +220,7 @@
@@ -221,7 +221,7 @@
while (iterator.hasNext()) {
mobeffect = (MobEffect) iterator.next();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityWitherSkull.java
+++ b/net/minecraft/world/entity/projectile/EntityWitherSkull.java
@@ -20,6 +20,10 @@
@@ -21,6 +21,10 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.MovingObjectPositionEntity;
@@ -11,7 +11,7 @@
public class EntityWitherSkull extends EntityFireball {
private static final DataWatcherObject<Boolean> DATA_DANGEROUS = DataWatcher.defineId(EntityWitherSkull.class, DataWatcherRegistry.BOOLEAN);
@@ -63,7 +67,7 @@
@@ -64,7 +68,7 @@
if (entity.isAlive()) {
this.doEnchantDamageEffects(entityliving, entity);
} else {
@@ -20,7 +20,7 @@
}
}
} else {
@@ -81,7 +85,7 @@
@@ -82,7 +86,7 @@
}
if (b0 > 0) {
@@ -29,7 +29,7 @@
}
}
@@ -92,7 +96,15 @@
@@ -93,7 +97,15 @@
protected void onHit(MovingObjectPosition movingobjectposition) {
super.onHit(movingobjectposition);
if (!this.level().isClientSide) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/IProjectile.java
+++ b/net/minecraft/world/entity/projectile/IProjectile.java
@@ -24,6 +24,10 @@
@@ -25,6 +25,10 @@
import net.minecraft.world.phys.MovingObjectPositionEntity;
import net.minecraft.world.phys.Vec3D;
@@ -11,7 +11,7 @@
public abstract class IProjectile extends Entity implements TraceableEntity {
@Nullable
@@ -33,6 +37,10 @@
@@ -34,6 +38,10 @@
private boolean leftOwner;
private boolean hasBeenShot;
@@ -22,7 +22,7 @@
IProjectile(EntityTypes<? extends IProjectile> entitytypes, World world) {
super(entitytypes, world);
}
@@ -42,6 +50,7 @@
@@ -43,6 +51,7 @@
this.ownerUUID = entity.getUUID();
this.cachedOwner = entity;
}
@@ -30,7 +30,7 @@
}
@@ -147,6 +156,16 @@
@@ -167,6 +176,16 @@
this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, entity.onGround() ? 0.0D : vec3d.y, vec3d.z));
}
@@ -47,7 +47,7 @@
protected void onHit(MovingObjectPosition movingobjectposition) {
MovingObjectPosition.EnumMovingObjectType movingobjectposition_enummovingobjecttype = movingobjectposition.getType();
@@ -167,6 +186,11 @@
@@ -187,6 +206,11 @@
protected void onHitEntity(MovingObjectPositionEntity movingobjectpositionentity) {}
protected void onHitBlock(MovingObjectPositionBlock movingobjectpositionblock) {

View File

@@ -14,7 +14,7 @@
public class ChestBoat extends EntityBoat implements HasCustomInventoryScreen, ContainerEntity {
@@ -237,4 +244,51 @@
@@ -238,4 +245,51 @@
public void stopOpen(EntityHuman entityhuman) {
this.level().gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.a.of((Entity) entityhuman));
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/vehicle/EntityBoat.java
+++ b/net/minecraft/world/entity/vehicle/EntityBoat.java
@@ -55,6 +55,16 @@
@@ -55,6 +55,15 @@
import net.minecraft.world.phys.shapes.VoxelShapes;
import org.joml.Vector3f;
@@ -8,16 +8,15 @@
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.util.CraftLocation;
+import org.bukkit.entity.Vehicle;
+import org.bukkit.event.vehicle.VehicleDamageEvent;
+import org.bukkit.event.vehicle.VehicleDestroyEvent;
+import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
+import org.bukkit.event.vehicle.VehicleMoveEvent;
+// CraftBukkit end
+
public class EntityBoat extends Entity implements VariantHolder<EntityBoat.EnumBoatType> {
public class EntityBoat extends VehicleEntity implements VariantHolder<EntityBoat.EnumBoatType> {
private static final DataWatcherObject<Integer> DATA_ID_HURT = DataWatcher.defineId(EntityBoat.class, DataWatcherRegistry.INT);
@@ -95,6 +105,14 @@
private static final DataWatcherObject<Integer> DATA_ID_TYPE = DataWatcher.defineId(EntityBoat.class, DataWatcherRegistry.INT);
@@ -92,6 +101,14 @@
private float bubbleAngle;
private float bubbleAngleO;
@@ -32,43 +31,7 @@
public EntityBoat(EntityTypes<? extends EntityBoat> entitytypes, World world) {
super(entitytypes, world);
this.paddlePositions = new float[2];
@@ -180,6 +198,19 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else if (!this.level().isClientSide && !this.isRemoved()) {
+ // CraftBukkit start
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
+ org.bukkit.entity.Entity attacker = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
+
+ VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, (double) f);
+ this.level().getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return false;
+ }
+ // f = event.getDamage(); // TODO Why don't we do this?
+ // CraftBukkit end
+
this.setHurtDir(-this.getHurtDir());
this.setHurtTime(10);
this.setDamage(this.getDamage() + f * 10.0F);
@@ -188,6 +219,15 @@
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).getAbilities().instabuild;
if (flag || this.getDamage() > 40.0F) {
+ // CraftBukkit start
+ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
+ this.level().getCraftServer().getPluginManager().callEvent(destroyEvent);
+
+ if (destroyEvent.isCancelled()) {
+ this.setDamage(40F); // Maximize damage so this doesn't get triggered again right away
+ return true;
+ }
+ // CraftBukkit end
if (!flag && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
this.destroy(damagesource);
}
@@ -227,9 +267,29 @@
@@ -192,9 +209,29 @@
public void push(Entity entity) {
if (entity instanceof EntityBoat) {
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
@@ -98,7 +61,7 @@
super.push(entity);
}
@@ -322,6 +382,7 @@
@@ -288,6 +325,7 @@
return this.getDirection().getClockWise();
}
@@ -106,7 +69,7 @@
@Override
public void tick() {
this.oldStatus = this.status;
@@ -362,6 +423,22 @@
@@ -328,6 +366,22 @@
this.setDeltaMovement(Vec3D.ZERO);
}
@@ -129,7 +92,7 @@
this.tickBubbleColumn();
for (int i = 0; i <= 1; ++i) {
@@ -845,6 +922,11 @@
@@ -813,6 +867,11 @@
this.causeFallDamage(this.fallDistance, 1.0F, this.damageSources().fall());
if (!this.level().isClientSide && !this.isRemoved()) {
@@ -141,7 +104,7 @@
this.kill();
if (this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
int i;
@@ -858,6 +940,7 @@
@@ -826,6 +885,7 @@
}
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
+++ b/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
@@ -50,6 +50,16 @@
@@ -48,6 +48,14 @@
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
@@ -8,16 +8,14 @@
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.util.CraftLocation;
+import org.bukkit.entity.Vehicle;
+import org.bukkit.event.vehicle.VehicleDamageEvent;
+import org.bukkit.event.vehicle.VehicleDestroyEvent;
+import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
+import org.bukkit.util.Vector;
+// CraftBukkit end
+
public abstract class EntityMinecartAbstract extends Entity {
public abstract class EntityMinecartAbstract extends VehicleEntity {
private static final float LOWERED_PASSENGER_ATTACHMENT_Y = 0.0F;
@@ -93,6 +103,17 @@
@@ -88,6 +96,17 @@
enummap.put(BlockPropertyTrackPosition.NORTH_EAST, Pair.of(baseblockposition2, baseblockposition1));
});
@@ -35,43 +33,16 @@
protected EntityMinecartAbstract(EntityTypes<?> entitytypes, World world) {
super(entitytypes, world);
this.targetDeltaMovement = Vec3D.ZERO;
@@ -222,6 +243,19 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {
+ // CraftBukkit start - fire VehicleDamageEvent
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
+ org.bukkit.entity.Entity passenger = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
+
+ VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, f);
+ this.level().getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return false;
+ }
+
+ f = (float) event.getDamage();
+ // CraftBukkit end
this.setHurtDir(-this.getHurtDir());
this.setHurtTime(10);
this.markHurt();
@@ -230,6 +264,15 @@
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).getAbilities().instabuild;
@@ -128,7 +147,7 @@
object = new EntityMinecartRideable(worldserver, d0, d1, d2);
}
if (flag || this.getDamage() > 40.0F) {
+ // CraftBukkit start
+ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
+ this.level().getCraftServer().getPluginManager().callEvent(destroyEvent);
+
+ if (destroyEvent.isCancelled()) {
+ this.setDamage(40); // Maximize damage so this doesn't get triggered again right away
+ return true;
+ }
+ // CraftBukkit end
this.ejectPassengers();
if (flag && !this.hasCustomName()) {
this.discard();
@@ -291,6 +334,14 @@
- Object object1 = object;
+ EntityMinecartAbstract object1 = (EntityMinecartAbstract) object; // CraftBukkit- decompile error
EntityTypes.createDefaultStackConfig(worldserver, itemstack, entityhuman).accept(object1);
return (EntityMinecartAbstract) object1;
@@ -267,6 +286,14 @@
@Override
public void tick() {
@@ -86,7 +57,7 @@
if (this.getHurtTime() > 0) {
this.setHurtTime(this.getHurtTime() - 1);
}
@@ -300,7 +351,7 @@
@@ -276,7 +303,7 @@
}
this.checkBelowWorld();
@@ -95,7 +66,7 @@
if (this.level().isClientSide) {
if (this.lerpSteps > 0) {
this.lerpPositionAndRotationStep(this.lerpSteps, this.lerpX, this.lerpY, this.lerpZ, this.lerpYRot, this.lerpXRot);
@@ -358,6 +409,18 @@
@@ -334,6 +361,18 @@
}
this.setRot(this.getYRot(), this.getXRot());
@@ -114,7 +85,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));
@@ -368,8 +431,26 @@
@@ -344,8 +383,26 @@
Entity entity = (Entity) iterator.next();
if (!(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && !(entity instanceof EntityMinecartAbstract) && !this.isVehicle() && !entity.isPassenger()) {
@@ -141,7 +112,7 @@
entity.push(this);
}
}
@@ -381,6 +462,14 @@
@@ -357,6 +414,14 @@
Entity entity1 = (Entity) iterator1.next();
if (!this.hasPassenger(entity1) && entity1.isPushable() && entity1 instanceof EntityMinecartAbstract) {
@@ -156,7 +127,7 @@
entity1.push(this);
}
}
@@ -397,7 +486,7 @@
@@ -373,7 +438,7 @@
}
protected double getMaxSpeed() {
@@ -165,7 +136,7 @@
}
public void activateMinecart(int i, int j, int k, boolean flag) {}
@@ -408,12 +497,16 @@
@@ -384,12 +449,16 @@
this.setDeltaMovement(MathHelper.clamp(vec3d.x, -d0, d0), vec3d.y, MathHelper.clamp(vec3d.z, -d0, d0));
if (this.onGround()) {
@@ -184,7 +155,7 @@
}
}
@@ -609,7 +702,7 @@
@@ -585,7 +654,7 @@
}
protected void applyNaturalSlowdown() {
@@ -193,7 +164,7 @@
Vec3D vec3d = this.getDeltaMovement();
vec3d = vec3d.multiply(d0, 0.0D, d0);
@@ -748,6 +841,14 @@
@@ -724,6 +793,14 @@
if (!this.level().isClientSide) {
if (!entity.noPhysics && !this.noPhysics) {
if (!this.hasPassenger(entity)) {
@@ -208,7 +179,7 @@
double d0 = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ();
double d2 = d0 * d0 + d1 * d1;
@@ -945,4 +1046,26 @@
@@ -898,4 +975,26 @@
private EnumMinecartType() {}
}

View File

@@ -0,0 +1,62 @@
--- a/net/minecraft/world/entity/vehicle/VehicleEntity.java
+++ b/net/minecraft/world/entity/vehicle/VehicleEntity.java
@@ -13,6 +13,12 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.gameevent.GameEvent;
+// CraftBukkit start
+import org.bukkit.entity.Vehicle;
+import org.bukkit.event.vehicle.VehicleDamageEvent;
+import org.bukkit.event.vehicle.VehicleDestroyEvent;
+// CraftBukkit end
+
public abstract class VehicleEntity extends Entity {
protected static final DataWatcherObject<Integer> DATA_ID_HURT = DataWatcher.defineId(VehicleEntity.class, DataWatcherRegistry.INT);
@@ -29,6 +35,18 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {
+ // CraftBukkit start
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
+ org.bukkit.entity.Entity attacker = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
+
+ VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, (double) f);
+ this.level().getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return false;
+ }
+ f = (float) event.getDamage();
+ // CraftBukkit end
this.setHurtDir(-this.getHurtDir());
this.setHurtTime(10);
this.markHurt();
@@ -38,9 +56,27 @@
if ((flag || this.getDamage() <= 40.0F) && !this.shouldSourceDestroy(damagesource)) {
if (flag) {
+ // CraftBukkit start
+ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
+ this.level().getCraftServer().getPluginManager().callEvent(destroyEvent);
+
+ if (destroyEvent.isCancelled()) {
+ this.setDamage(40.0F); // Maximize damage so this doesn't get triggered again right away
+ return true;
+ }
+ // CraftBukkit end
this.discard();
}
} else {
+ // CraftBukkit start
+ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
+ this.level().getCraftServer().getPluginManager().callEvent(destroyEvent);
+
+ if (destroyEvent.isCancelled()) {
+ this.setDamage(40.0F); // Maximize damage so this doesn't get triggered again right away
+ return true;
+ }
+ // CraftBukkit end
this.destroy(damagesource);
}