mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-02 11:22:01 +01:00
SPIGOT-6907: Oxygen does not restore up to value set by LivingEntity#setMaximumAir()
By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
parent
cf4feec6b5
commit
b80113b447
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -116,8 +116,59 @@
|
||||
@@ -116,8 +116,64 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -55,12 +55,17 @@
|
||||
+ public CommandSender getBukkitSender(CommandListenerWrapper wrapper) {
|
||||
+ return getBukkitEntity();
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
|
||||
+ public int getDefaultMaxAirSupply() {
|
||||
+ return TOTAL_AIR_SUPPLY;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
protected static final Logger LOGGER = LogManager.getLogger();
|
||||
public static final String ID_TAG = "id";
|
||||
public static final String PASSENGERS_TAG = "Passengers";
|
||||
@@ -228,6 +279,23 @@
|
||||
@@ -228,6 +284,24 @@
|
||||
public boolean hasVisualFire;
|
||||
@Nullable
|
||||
private IBlockData feetBlockState;
|
||||
@ -68,6 +73,7 @@
|
||||
+ public boolean persist = true;
|
||||
+ public boolean valid;
|
||||
+ public boolean generation;
|
||||
+ public int maxAirTicks = getDefaultMaxAirSupply(); // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
|
||||
+ public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only
|
||||
+ public boolean lastDamageCancelled; // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Keep track if the event was canceled
|
||||
+ public boolean persistentInvisibility = false;
|
||||
@ -84,7 +90,7 @@
|
||||
|
||||
public Entity(EntityTypes<?> entitytypes, World world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -365,6 +433,12 @@
|
||||
@@ -365,6 +439,12 @@
|
||||
public void onClientRemoval() {}
|
||||
|
||||
public void setPose(EntityPose entitypose) {
|
||||
@ -97,7 +103,7 @@
|
||||
this.entityData.set(Entity.DATA_POSE, entitypose);
|
||||
}
|
||||
|
||||
@@ -381,6 +455,33 @@
|
||||
@@ -381,6 +461,33 @@
|
||||
}
|
||||
|
||||
protected void setRot(float f, float f1) {
|
||||
@ -131,7 +137,7 @@
|
||||
this.setYRot(f % 360.0F);
|
||||
this.setXRot(f1 % 360.0F);
|
||||
}
|
||||
@@ -422,6 +523,15 @@
|
||||
@@ -422,6 +529,15 @@
|
||||
this.baseTick();
|
||||
}
|
||||
|
||||
@ -147,7 +153,7 @@
|
||||
public void baseTick() {
|
||||
this.level.getProfiler().push("entityBaseTick");
|
||||
this.feetBlockState = null;
|
||||
@@ -436,7 +546,7 @@
|
||||
@@ -436,7 +552,7 @@
|
||||
this.walkDistO = this.walkDist;
|
||||
this.xRotO = this.getXRot();
|
||||
this.yRotO = this.getYRot();
|
||||
@ -156,7 +162,7 @@
|
||||
if (this.canSpawnSprintParticle()) {
|
||||
this.spawnSprintParticle();
|
||||
}
|
||||
@@ -471,6 +581,10 @@
|
||||
@@ -471,6 +587,10 @@
|
||||
if (this.isInLava()) {
|
||||
this.lavaHurt();
|
||||
this.fallDistance *= 0.5F;
|
||||
@ -167,7 +173,7 @@
|
||||
}
|
||||
|
||||
this.checkOutOfWorld();
|
||||
@@ -514,15 +628,48 @@
|
||||
@@ -514,15 +634,48 @@
|
||||
|
||||
public void lavaHurt() {
|
||||
if (!this.fireImmune()) {
|
||||
@ -217,7 +223,7 @@
|
||||
int j = i * 20;
|
||||
|
||||
if (this instanceof EntityLiving) {
|
||||
@@ -627,6 +774,28 @@
|
||||
@@ -627,6 +780,28 @@
|
||||
block.updateEntityAfterFallOn(this.level, this);
|
||||
}
|
||||
|
||||
@ -246,7 +252,7 @@
|
||||
if (this.onGround && !this.isSteppingCarefully()) {
|
||||
block.stepOn(this.level, blockposition, iblockdata, this);
|
||||
}
|
||||
@@ -1260,6 +1429,7 @@
|
||||
@@ -1260,6 +1435,7 @@
|
||||
this.yo = d1;
|
||||
this.zo = d4;
|
||||
this.setPos(d3, d1, d4);
|
||||
@ -254,7 +260,7 @@
|
||||
}
|
||||
|
||||
public void moveTo(Vec3D vec3d) {
|
||||
@@ -1450,6 +1620,12 @@
|
||||
@@ -1450,6 +1626,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -267,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);
|
||||
@@ -1483,7 +1659,7 @@
|
||||
@@ -1483,7 +1665,7 @@
|
||||
} else {
|
||||
String s = this.getEncodeId();
|
||||
|
||||
@ -276,7 +282,7 @@
|
||||
return false;
|
||||
} else {
|
||||
nbttagcompound.putString("id", s);
|
||||
@@ -1508,6 +1684,18 @@
|
||||
@@ -1508,6 +1690,18 @@
|
||||
Vec3D vec3d = this.getDeltaMovement();
|
||||
|
||||
nbttagcompound.put("Motion", this.newDoubleList(vec3d.x, vec3d.y, vec3d.z));
|
||||
@ -295,7 +301,7 @@
|
||||
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
|
||||
nbttagcompound.putFloat("FallDistance", this.fallDistance);
|
||||
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
|
||||
@@ -1516,6 +1704,18 @@
|
||||
@@ -1516,6 +1710,22 @@
|
||||
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
|
||||
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
|
||||
nbttagcompound.putUUID("UUID", this.getUUID());
|
||||
@ -310,11 +316,15 @@
|
||||
+ if (this.persistentInvisibility) {
|
||||
+ nbttagcompound.putBoolean("Bukkit.invisible", this.persistentInvisibility);
|
||||
+ }
|
||||
+ // SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
|
||||
+ if (maxAirTicks != getDefaultMaxAirSupply()) {
|
||||
+ nbttagcompound.putInt("Bukkit.MaxAirSupply", getMaxAirSupply());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
IChatBaseComponent ichatbasecomponent = this.getCustomName();
|
||||
|
||||
if (ichatbasecomponent != null) {
|
||||
@@ -1583,6 +1783,11 @@
|
||||
@@ -1583,6 +1793,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -326,7 +336,7 @@
|
||||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -1664,6 +1869,49 @@
|
||||
@@ -1664,6 +1879,53 @@
|
||||
} else {
|
||||
throw new IllegalStateException("Entity has invalid position");
|
||||
}
|
||||
@ -342,6 +352,10 @@
|
||||
+ }
|
||||
+ }
|
||||
+ this.persist = !nbttagcompound.contains("Bukkit.persist") || nbttagcompound.getBoolean("Bukkit.persist");
|
||||
+ // SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
|
||||
+ if (nbttagcompound.contains("Bukkit.MaxAirSupply")) {
|
||||
+ maxAirTicks = nbttagcompound.getInt("Bukkit.MaxAirSupply");
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ // CraftBukkit start - Reset world
|
||||
@ -376,7 +390,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
|
||||
@@ -1739,9 +1987,22 @@
|
||||
@@ -1739,9 +2001,22 @@
|
||||
} else if (this.level.isClientSide) {
|
||||
return null;
|
||||
} else {
|
||||
@ -399,7 +413,7 @@
|
||||
this.level.addFreshEntity(entityitem);
|
||||
return entityitem;
|
||||
}
|
||||
@@ -1836,7 +2097,7 @@
|
||||
@@ -1836,7 +2111,7 @@
|
||||
|
||||
this.setPose(EntityPose.STANDING);
|
||||
this.vehicle = entity;
|
||||
@ -408,7 +422,7 @@
|
||||
entity.getIndirectPassengersStream().filter((entity2) -> {
|
||||
return entity2 instanceof EntityPlayer;
|
||||
}).forEach((entity2) -> {
|
||||
@@ -1867,7 +2128,7 @@
|
||||
@@ -1867,7 +2142,7 @@
|
||||
Entity entity = this.vehicle;
|
||||
|
||||
this.vehicle = null;
|
||||
@ -417,7 +431,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1876,10 +2137,31 @@
|
||||
@@ -1876,10 +2151,31 @@
|
||||
this.removeVehicle();
|
||||
}
|
||||
|
||||
@ -450,7 +464,7 @@
|
||||
if (this.passengers.isEmpty()) {
|
||||
this.passengers = ImmutableList.of(entity);
|
||||
} else {
|
||||
@@ -1895,12 +2177,32 @@
|
||||
@@ -1895,12 +2191,32 @@
|
||||
}
|
||||
|
||||
}
|
||||
@ -484,7 +498,7 @@
|
||||
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
|
||||
this.passengers = ImmutableList.of();
|
||||
} else {
|
||||
@@ -1911,6 +2213,7 @@
|
||||
@@ -1911,6 +2227,7 @@
|
||||
|
||||
entity.boardingCooldown = 60;
|
||||
}
|
||||
@ -492,7 +506,7 @@
|
||||
}
|
||||
|
||||
protected boolean canAddPassenger(Entity entity) {
|
||||
@@ -1961,14 +2264,20 @@
|
||||
@@ -1961,14 +2278,20 @@
|
||||
|
||||
if (this.isInsidePortal) {
|
||||
MinecraftServer minecraftserver = worldserver.getServer();
|
||||
@ -516,7 +530,7 @@
|
||||
this.level.getProfiler().pop();
|
||||
}
|
||||
|
||||
@@ -2086,6 +2395,13 @@
|
||||
@@ -2086,6 +2409,13 @@
|
||||
}
|
||||
|
||||
public void setSwimming(boolean flag) {
|
||||
@ -530,7 +544,7 @@
|
||||
this.setSharedFlag(4, flag);
|
||||
}
|
||||
|
||||
@@ -2134,8 +2450,12 @@
|
||||
@@ -2134,8 +2464,12 @@
|
||||
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
|
||||
}
|
||||
|
||||
@ -544,7 +558,16 @@
|
||||
}
|
||||
|
||||
public boolean getSharedFlag(int i) {
|
||||
@@ -2162,7 +2482,17 @@
|
||||
@@ -2154,7 +2488,7 @@
|
||||
}
|
||||
|
||||
public int getMaxAirSupply() {
|
||||
- return 300;
|
||||
+ return maxAirTicks; // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
|
||||
}
|
||||
|
||||
public int getAirSupply() {
|
||||
@@ -2162,7 +2496,17 @@
|
||||
}
|
||||
|
||||
public void setAirSupply(int i) {
|
||||
@ -563,7 +586,7 @@
|
||||
}
|
||||
|
||||
public int getTicksFrozen() {
|
||||
@@ -2189,11 +2519,41 @@
|
||||
@@ -2189,11 +2533,41 @@
|
||||
|
||||
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
||||
@ -607,7 +630,7 @@
|
||||
}
|
||||
|
||||
public void onAboveBubbleCol(boolean flag) {
|
||||
@@ -2349,15 +2709,32 @@
|
||||
@@ -2349,15 +2723,32 @@
|
||||
|
||||
@Nullable
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
@ -642,7 +665,7 @@
|
||||
this.level.getProfiler().popPush("reloading");
|
||||
Entity entity = this.getType().create(worldserver);
|
||||
|
||||
@@ -2366,9 +2743,17 @@
|
||||
@@ -2366,9 +2757,17 @@
|
||||
entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
|
||||
entity.setDeltaMovement(shapedetectorshape.speed);
|
||||
worldserver.addDuringTeleport(entity);
|
||||
@ -662,7 +685,7 @@
|
||||
}
|
||||
|
||||
this.removeAfterChangingDimensions();
|
||||
@@ -2389,20 +2774,34 @@
|
||||
@@ -2389,20 +2788,34 @@
|
||||
|
||||
@Nullable
|
||||
protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) {
|
||||
@ -702,7 +725,7 @@
|
||||
IBlockData iblockdata = this.level.getBlockState(this.portalEntrancePos);
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis;
|
||||
Vec3D vec3d;
|
||||
@@ -2419,8 +2818,8 @@
|
||||
@@ -2419,8 +2832,8 @@
|
||||
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
@ -713,7 +736,7 @@
|
||||
}
|
||||
} else {
|
||||
BlockPosition blockposition1;
|
||||
@@ -2430,8 +2829,15 @@
|
||||
@@ -2430,8 +2843,15 @@
|
||||
} else {
|
||||
blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos());
|
||||
}
|
||||
@ -730,7 +753,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2439,8 +2845,23 @@
|
||||
@@ -2439,8 +2859,23 @@
|
||||
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
|
||||
}
|
||||
|
||||
@ -756,7 +779,7 @@
|
||||
}
|
||||
|
||||
public boolean canChangeDimensions() {
|
||||
@@ -2649,7 +3070,26 @@
|
||||
@@ -2649,7 +3084,26 @@
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
|
||||
@ -784,7 +807,7 @@
|
||||
}
|
||||
|
||||
protected float getEyeHeight(EntityPose entitypose, EntitySize entitysize) {
|
||||
@@ -2933,6 +3373,11 @@
|
||||
@@ -2933,6 +3387,11 @@
|
||||
vec3d = vec3d.add(vec3d1);
|
||||
++k1;
|
||||
}
|
||||
|
@ -31,13 +31,12 @@
|
||||
public abstract class EntityLiving extends Entity {
|
||||
|
||||
private static final UUID SPEED_MODIFIER_SPRINTING_UUID = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
|
||||
@@ -224,6 +248,21 @@
|
||||
@@ -224,6 +248,20 @@
|
||||
private float swimAmount;
|
||||
private float swimAmountO;
|
||||
protected BehaviorController<?> brain;
|
||||
+ // CraftBukkit start
|
||||
+ public int expToDrop;
|
||||
+ public int maxAirTicks = 300;
|
||||
+ public boolean forceDrops;
|
||||
+ public ArrayList<org.bukkit.inventory.ItemStack> drops = new ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
+ public final org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes;
|
||||
@ -53,7 +52,7 @@
|
||||
|
||||
protected EntityLiving(EntityTypes<? extends EntityLiving> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -236,7 +275,9 @@
|
||||
@@ -236,7 +274,9 @@
|
||||
this.useItem = ItemStack.EMPTY;
|
||||
this.lastClimbablePos = Optional.empty();
|
||||
this.attributes = new AttributeMapBase(AttributeDefaults.getSupplier(entitytypes));
|
||||
@ -64,7 +63,7 @@
|
||||
this.blocksBuilding = true;
|
||||
this.rotA = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
|
||||
this.reapplyPosition();
|
||||
@@ -303,7 +344,13 @@
|
||||
@@ -303,7 +343,13 @@
|
||||
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
|
||||
int i = (int) (150.0D * d1);
|
||||
|
||||
@ -79,7 +78,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -561,7 +608,7 @@
|
||||
@@ -561,7 +607,7 @@
|
||||
|
||||
protected void tickDeath() {
|
||||
++this.deathTime;
|
||||
@ -88,7 +87,7 @@
|
||||
this.level.broadcastEntityEvent(this, (byte) 60);
|
||||
this.remove(Entity.RemovalReason.KILLED);
|
||||
}
|
||||
@@ -653,9 +700,15 @@
|
||||
@@ -653,9 +699,15 @@
|
||||
}
|
||||
|
||||
protected void equipEventAndSound(ItemStack itemstack) {
|
||||
@ -105,7 +104,7 @@
|
||||
this.gameEvent(GameEvent.EQUIP);
|
||||
this.playSound(soundeffect, 1.0F, 1.0F);
|
||||
}
|
||||
@@ -717,6 +770,17 @@
|
||||
@@ -717,6 +769,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,7 +122,7 @@
|
||||
if (nbttagcompound.contains("Health", 99)) {
|
||||
this.setHealth(nbttagcompound.getFloat("Health"));
|
||||
}
|
||||
@@ -754,9 +818,32 @@
|
||||
@@ -754,9 +817,32 @@
|
||||
|
||||
}
|
||||
|
||||
@ -156,7 +155,7 @@
|
||||
try {
|
||||
while (iterator.hasNext()) {
|
||||
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
|
||||
@@ -766,6 +853,12 @@
|
||||
@@ -766,6 +852,12 @@
|
||||
this.onEffectUpdated(mobeffect, true, (Entity) null);
|
||||
})) {
|
||||
if (!this.level.isClientSide) {
|
||||
@ -169,7 +168,7 @@
|
||||
iterator.remove();
|
||||
this.onEffectRemoved(mobeffect);
|
||||
}
|
||||
@@ -776,6 +869,17 @@
|
||||
@@ -776,6 +868,17 @@
|
||||
} catch (ConcurrentModificationException concurrentmodificationexception) {
|
||||
;
|
||||
}
|
||||
@ -187,7 +186,7 @@
|
||||
|
||||
if (this.effectsDirty) {
|
||||
if (!this.level.isClientSide) {
|
||||
@@ -902,7 +1006,13 @@
|
||||
@@ -902,7 +1005,13 @@
|
||||
this.entityData.set(EntityLiving.DATA_EFFECT_COLOR_ID, 0);
|
||||
}
|
||||
|
||||
@ -201,7 +200,7 @@
|
||||
if (this.level.isClientSide) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -911,7 +1021,14 @@
|
||||
@@ -911,7 +1020,14 @@
|
||||
boolean flag;
|
||||
|
||||
for (flag = false; iterator.hasNext(); flag = true) {
|
||||
@ -217,7 +216,7 @@
|
||||
iterator.remove();
|
||||
}
|
||||
|
||||
@@ -940,18 +1057,48 @@
|
||||
@@ -940,18 +1056,48 @@
|
||||
return this.addEffect(mobeffect, (Entity) null);
|
||||
}
|
||||
|
||||
@ -267,7 +266,7 @@
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -988,13 +1135,39 @@
|
||||
@@ -988,13 +1134,39 @@
|
||||
return this.getMobType() == EnumMonsterType.UNDEAD;
|
||||
}
|
||||
|
||||
@ -308,7 +307,7 @@
|
||||
|
||||
if (mobeffect != null) {
|
||||
this.onEffectRemoved(mobeffect);
|
||||
@@ -1031,20 +1204,55 @@
|
||||
@@ -1031,20 +1203,55 @@
|
||||
|
||||
}
|
||||
|
||||
@ -365,7 +364,7 @@
|
||||
this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.clamp(f, 0.0F, this.getMaxHealth()));
|
||||
}
|
||||
|
||||
@@ -1058,7 +1266,7 @@
|
||||
@@ -1058,7 +1265,7 @@
|
||||
return false;
|
||||
} else if (this.level.isClientSide) {
|
||||
return false;
|
||||
@ -374,7 +373,7 @@
|
||||
return false;
|
||||
} else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
|
||||
return false;
|
||||
@@ -1069,10 +1277,11 @@
|
||||
@@ -1069,10 +1276,11 @@
|
||||
|
||||
this.noActionTime = 0;
|
||||
float f1 = f;
|
||||
@ -388,7 +387,7 @@
|
||||
this.hurtCurrentlyUsedShield(f);
|
||||
f2 = f;
|
||||
f = 0.0F;
|
||||
@@ -1090,27 +1299,46 @@
|
||||
@@ -1090,27 +1298,46 @@
|
||||
this.animationSpeed = 1.5F;
|
||||
boolean flag1 = true;
|
||||
|
||||
@ -440,7 +439,7 @@
|
||||
this.hurtDir = 0.0F;
|
||||
Entity entity1 = damagesource.getEntity();
|
||||
|
||||
@@ -1233,19 +1461,29 @@
|
||||
@@ -1233,19 +1460,29 @@
|
||||
EnumHand[] aenumhand = EnumHand.values();
|
||||
int i = aenumhand.length;
|
||||
|
||||
@ -474,7 +473,7 @@
|
||||
EntityPlayer entityplayer = (EntityPlayer) this;
|
||||
|
||||
entityplayer.awardStat(StatisticList.ITEM_USED.get(Items.TOTEM_OF_UNDYING));
|
||||
@@ -1253,14 +1491,16 @@
|
||||
@@ -1253,14 +1490,16 @@
|
||||
}
|
||||
|
||||
this.setHealth(1.0F);
|
||||
@ -496,7 +495,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1365,14 +1605,22 @@
|
||||
@@ -1365,14 +1604,22 @@
|
||||
IBlockData iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
|
||||
|
||||
if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
|
||||
@ -521,7 +520,7 @@
|
||||
this.level.addFreshEntity(entityitem);
|
||||
}
|
||||
}
|
||||
@@ -1392,21 +1640,40 @@
|
||||
@@ -1392,21 +1639,40 @@
|
||||
|
||||
boolean flag = this.lastHurtByPlayerTime > 0;
|
||||
|
||||
@ -565,7 +564,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -1526,9 +1793,14 @@
|
||||
@@ -1526,9 +1792,14 @@
|
||||
int i = this.calculateFallDamage(f, f1);
|
||||
|
||||
if (i > 0) {
|
||||
@ -581,7 +580,7 @@
|
||||
return true;
|
||||
} else {
|
||||
return flag;
|
||||
@@ -1577,7 +1849,7 @@
|
||||
@@ -1577,7 +1848,7 @@
|
||||
|
||||
protected float getDamageAfterArmorAbsorb(DamageSource damagesource, float f) {
|
||||
if (!damagesource.isBypassArmor()) {
|
||||
@ -590,7 +589,7 @@
|
||||
f = CombatMath.getDamageAfterAbsorb(f, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
|
||||
}
|
||||
|
||||
@@ -1590,7 +1862,8 @@
|
||||
@@ -1590,7 +1861,8 @@
|
||||
} else {
|
||||
int i;
|
||||
|
||||
@ -600,7 +599,7 @@
|
||||
i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
|
||||
int j = 25 - i;
|
||||
float f1 = f * (float) j;
|
||||
@@ -1621,29 +1894,172 @@
|
||||
@@ -1621,29 +1893,172 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -783,7 +782,7 @@
|
||||
}
|
||||
|
||||
public CombatTracker getCombatTracker() {
|
||||
@@ -1664,8 +2080,18 @@
|
||||
@@ -1664,8 +2079,18 @@
|
||||
}
|
||||
|
||||
public final void setArrowCount(int i) {
|
||||
@ -803,7 +802,7 @@
|
||||
|
||||
public final int getStingerCount() {
|
||||
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
|
||||
@@ -1961,6 +2387,12 @@
|
||||
@@ -1961,6 +2386,12 @@
|
||||
|
||||
public abstract ItemStack getItemBySlot(EnumItemSlot enumitemslot);
|
||||
|
||||
@ -816,7 +815,7 @@
|
||||
@Override
|
||||
public abstract void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
|
||||
|
||||
@@ -2204,6 +2636,7 @@
|
||||
@@ -2204,6 +2635,7 @@
|
||||
}
|
||||
|
||||
if (this.onGround && !this.level.isClientSide) {
|
||||
@ -824,7 +823,7 @@
|
||||
this.setSharedFlag(7, false);
|
||||
}
|
||||
} else {
|
||||
@@ -2734,6 +3167,7 @@
|
||||
@@ -2734,6 +3166,7 @@
|
||||
}
|
||||
|
||||
if (!this.level.isClientSide) {
|
||||
@ -832,7 +831,7 @@
|
||||
this.setSharedFlag(7, flag);
|
||||
}
|
||||
|
||||
@@ -2901,14 +3335,21 @@
|
||||
@@ -2901,14 +3334,21 @@
|
||||
|
||||
@Override
|
||||
public boolean isPickable() {
|
||||
@ -856,7 +855,7 @@
|
||||
@Override
|
||||
protected void markHurt() {
|
||||
this.hurtMarked = this.random.nextDouble() >= this.getAttributeValue(GenericAttributes.KNOCKBACK_RESISTANCE);
|
||||
@@ -3107,7 +3548,25 @@
|
||||
@@ -3107,7 +3547,25 @@
|
||||
} else {
|
||||
if (!this.useItem.isEmpty() && this.isUsingItem()) {
|
||||
this.triggerItemUseEffects(this.useItem, 16);
|
||||
@ -883,7 +882,7 @@
|
||||
|
||||
if (itemstack != this.useItem) {
|
||||
this.setItemInHand(enumhand, itemstack);
|
||||
@@ -3180,6 +3639,12 @@
|
||||
@@ -3180,6 +3638,12 @@
|
||||
}
|
||||
|
||||
public boolean randomTeleport(double d0, double d1, double d2, boolean flag) {
|
||||
@ -896,7 +895,7 @@
|
||||
double d3 = this.getX();
|
||||
double d4 = this.getY();
|
||||
double d5 = this.getZ();
|
||||
@@ -3204,16 +3669,41 @@
|
||||
@@ -3204,16 +3668,41 @@
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
@ -941,7 +940,7 @@
|
||||
} else {
|
||||
if (flag) {
|
||||
world.broadcastEntityEvent(this, (byte) 46);
|
||||
@@ -3223,7 +3713,7 @@
|
||||
@@ -3223,7 +3712,7 @@
|
||||
((EntityCreature) this).getNavigation().stop();
|
||||
}
|
||||
|
||||
@ -950,7 +949,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3306,7 +3796,7 @@
|
||||
@@ -3306,7 +3795,7 @@
|
||||
}
|
||||
|
||||
public void stopSleeping() {
|
||||
@ -959,7 +958,7 @@
|
||||
World world = this.level;
|
||||
|
||||
java.util.Objects.requireNonNull(this.level);
|
||||
@@ -3338,7 +3828,7 @@
|
||||
@@ -3338,7 +3827,7 @@
|
||||
|
||||
@Nullable
|
||||
public EnumDirection getBedOrientation() {
|
||||
@ -968,7 +967,7 @@
|
||||
|
||||
return blockposition != null ? BlockBed.getBedOrientation(this.level, blockposition) : null;
|
||||
}
|
||||
@@ -3387,7 +3877,7 @@
|
||||
@@ -3387,7 +3876,7 @@
|
||||
Pair<MobEffect, Float> pair = (Pair) iterator.next();
|
||||
|
||||
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {
|
||||
@ -977,7 +976,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3490,8 +3980,10 @@
|
||||
@@ -3490,8 +3979,10 @@
|
||||
this.setDeltaMovement((double) ((float) packetplayoutspawnentityliving.getXd() / 8000.0F), (double) ((float) packetplayoutspawnentityliving.getYd() / 8000.0F), (double) ((float) packetplayoutspawnentityliving.getZd() / 8000.0F));
|
||||
}
|
||||
|
||||
@ -989,7 +988,7 @@
|
||||
private final SoundEffect small;
|
||||
private final SoundEffect big;
|
||||
|
||||
@@ -3507,5 +3999,7 @@
|
||||
@@ -3507,5 +3998,7 @@
|
||||
public SoundEffect big() {
|
||||
return this.big;
|
||||
}
|
||||
|
@ -1,6 +1,28 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityDolphin.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityDolphin.java
|
||||
@@ -233,6 +233,12 @@
|
||||
@@ -65,6 +65,12 @@
|
||||
|
||||
public class EntityDolphin extends EntityWaterAnimal {
|
||||
|
||||
+ // CraftBukkit start - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
|
||||
+ @Override
|
||||
+ public int getDefaultMaxAirSupply() {
|
||||
+ return TOTAL_AIR_SUPPLY;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
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);
|
||||
@@ -192,7 +198,7 @@
|
||||
|
||||
@Override
|
||||
public int getMaxAirSupply() {
|
||||
- return 4800;
|
||||
+ return maxAirTicks; // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -233,6 +239,12 @@
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
|
||||
if (this.canHoldItem(itemstack)) {
|
||||
@ -13,7 +35,7 @@
|
||||
this.onItemPickup(entityitem);
|
||||
this.setItemSlot(EnumItemSlot.MAINHAND, itemstack);
|
||||
this.handDropChances[EnumItemSlot.MAINHAND.getIndex()] = 2.0F;
|
||||
@@ -391,7 +397,7 @@
|
||||
@@ -391,7 +403,7 @@
|
||||
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
@ -22,7 +44,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -501,7 +507,7 @@
|
||||
@@ -501,7 +513,7 @@
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
@ -31,7 +53,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -520,7 +526,7 @@
|
||||
@@ -520,7 +532,7 @@
|
||||
}
|
||||
|
||||
if (this.player.isSwimming() && this.player.level.random.nextInt(6) == 0) {
|
||||
|
@ -1,7 +1,15 @@
|
||||
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
||||
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
||||
@@ -69,7 +69,8 @@
|
||||
@@ -67,9 +67,16 @@
|
||||
|
||||
public class Axolotl extends EntityAnimal implements LerpingModel, Bucketable {
|
||||
|
||||
+ // CraftBukkit start - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
|
||||
+ @Override
|
||||
+ public int getDefaultMaxAirSupply() {
|
||||
+ return AXOLOTL_TOTAL_AIR_SUPPLY;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
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});
|
||||
@ -10,7 +18,16 @@
|
||||
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);
|
||||
@@ -236,6 +237,7 @@
|
||||
@@ -185,7 +192,7 @@
|
||||
|
||||
@Override
|
||||
public int getMaxAirSupply() {
|
||||
- return 6000;
|
||||
+ return maxAirTicks; // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
|
||||
}
|
||||
|
||||
public Axolotl.Variant getVariant() {
|
||||
@@ -236,6 +243,7 @@
|
||||
@Override
|
||||
public void setFromBucket(boolean flag) {
|
||||
this.entityData.set(Axolotl.FROM_BUCKET, flag);
|
||||
@ -18,7 +35,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -419,7 +421,7 @@
|
||||
@@ -419,7 +427,7 @@
|
||||
|
||||
if (i < 2400) {
|
||||
i = Math.min(2400, 100 + i);
|
||||
@ -27,7 +44,7 @@
|
||||
}
|
||||
|
||||
entityhuman.removeEffect(MobEffects.DIG_SLOWDOWN);
|
||||
@@ -469,7 +471,7 @@
|
||||
@@ -469,7 +477,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<Axolotl> getBrain() {
|
||||
@ -36,7 +53,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -502,7 +504,7 @@
|
||||
@@ -502,7 +510,7 @@
|
||||
|
||||
@Override
|
||||
public boolean removeWhenFarAway(double d0) {
|
||||
|
Loading…
Reference in New Issue
Block a user