@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user