Update to Minecraft 1.18.2

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2022-03-01 02:00:00 +11:00
parent bd40300a4f
commit 9ee989ea81
184 changed files with 1785 additions and 1785 deletions

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -116,8 +116,64 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -119,8 +119,64 @@
import net.minecraft.world.scores.ScoreboardTeamBase;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.world.level.dimension.WorldDimension;
@@ -62,10 +62,10 @@
+ }
+ // CraftBukkit end
+
protected static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
public static final String ID_TAG = "id";
public static final String PASSENGERS_TAG = "Passengers";
@@ -228,6 +284,24 @@
@@ -231,6 +287,24 @@
public boolean hasVisualFire;
@Nullable
private IBlockData feetBlockState;
@@ -90,7 +90,7 @@
public Entity(EntityTypes<?> entitytypes, World world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
@@ -365,6 +439,12 @@
@@ -369,6 +443,12 @@
public void onClientRemoval() {}
public void setPose(EntityPose entitypose) {
@@ -103,7 +103,7 @@
this.entityData.set(Entity.DATA_POSE, entitypose);
}
@@ -381,6 +461,33 @@
@@ -385,6 +465,33 @@
}
protected void setRot(float f, float f1) {
@@ -137,7 +137,7 @@
this.setYRot(f % 360.0F);
this.setXRot(f1 % 360.0F);
}
@@ -422,6 +529,15 @@
@@ -426,6 +533,15 @@
this.baseTick();
}
@@ -153,7 +153,7 @@
public void baseTick() {
this.level.getProfiler().push("entityBaseTick");
this.feetBlockState = null;
@@ -436,7 +552,7 @@
@@ -440,7 +556,7 @@
this.walkDistO = this.walkDist;
this.xRotO = this.getXRot();
this.yRotO = this.getYRot();
@@ -162,7 +162,7 @@
if (this.canSpawnSprintParticle()) {
this.spawnSprintParticle();
}
@@ -471,6 +587,10 @@
@@ -475,6 +591,10 @@
if (this.isInLava()) {
this.lavaHurt();
this.fallDistance *= 0.5F;
@@ -173,7 +173,7 @@
}
this.checkOutOfWorld();
@@ -514,15 +634,48 @@
@@ -518,15 +638,48 @@
public void lavaHurt() {
if (!this.fireImmune()) {
@@ -223,7 +223,7 @@
int j = i * 20;
if (this instanceof EntityLiving) {
@@ -627,6 +780,28 @@
@@ -640,6 +793,28 @@
block.updateEntityAfterFallOn(this.level, this);
}
@@ -252,7 +252,7 @@
if (this.onGround && !this.isSteppingCarefully()) {
block.stepOn(this.level, blockposition, iblockdata, this);
}
@@ -1260,6 +1435,7 @@
@@ -1265,6 +1440,7 @@
this.yo = d1;
this.zo = d4;
this.setPos(d3, d1, d4);
@@ -260,7 +260,7 @@
}
public void moveTo(Vec3D vec3d) {
@@ -1450,6 +1626,12 @@
@@ -1455,6 +1631,12 @@
return false;
}
@@ -273,7 +273,7 @@
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
if (entity instanceof EntityPlayer) {
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
@@ -1483,7 +1665,7 @@
@@ -1488,7 +1670,7 @@
} else {
String s = this.getEncodeId();
@@ -282,7 +282,7 @@
return false;
} else {
nbttagcompound.putString("id", s);
@@ -1508,6 +1690,18 @@
@@ -1513,6 +1695,18 @@
Vec3D vec3d = this.getDeltaMovement();
nbttagcompound.put("Motion", this.newDoubleList(vec3d.x, vec3d.y, vec3d.z));
@@ -301,7 +301,7 @@
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
nbttagcompound.putFloat("FallDistance", this.fallDistance);
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
@@ -1516,6 +1710,22 @@
@@ -1521,6 +1715,22 @@
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
nbttagcompound.putUUID("UUID", this.getUUID());
@@ -324,7 +324,7 @@
IChatBaseComponent ichatbasecomponent = this.getCustomName();
if (ichatbasecomponent != null) {
@@ -1583,6 +1793,11 @@
@@ -1588,6 +1798,11 @@
}
}
@@ -336,7 +336,7 @@
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -1664,6 +1879,53 @@
@@ -1669,6 +1884,53 @@
} else {
throw new IllegalStateException("Entity has invalid position");
}
@@ -390,7 +390,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
@@ -1739,9 +2001,22 @@
@@ -1744,9 +2006,22 @@
} else if (this.level.isClientSide) {
return null;
} else {
@@ -413,7 +413,7 @@
this.level.addFreshEntity(entityitem);
return entityitem;
}
@@ -1836,7 +2111,7 @@
@@ -1840,7 +2115,7 @@
this.setPose(EntityPose.STANDING);
this.vehicle = entity;
@@ -422,7 +422,7 @@
entity.getIndirectPassengersStream().filter((entity2) -> {
return entity2 instanceof EntityPlayer;
}).forEach((entity2) -> {
@@ -1867,7 +2142,7 @@
@@ -1871,7 +2146,7 @@
Entity entity = this.vehicle;
this.vehicle = null;
@@ -431,7 +431,7 @@
}
}
@@ -1876,10 +2151,31 @@
@@ -1880,10 +2155,31 @@
this.removeVehicle();
}
@@ -464,7 +464,7 @@
if (this.passengers.isEmpty()) {
this.passengers = ImmutableList.of(entity);
} else {
@@ -1895,12 +2191,32 @@
@@ -1899,12 +2195,32 @@
}
}
@@ -498,7 +498,7 @@
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
this.passengers = ImmutableList.of();
} else {
@@ -1911,6 +2227,7 @@
@@ -1915,6 +2231,7 @@
entity.boardingCooldown = 60;
}
@@ -506,7 +506,7 @@
}
protected boolean canAddPassenger(Entity entity) {
@@ -1961,14 +2278,20 @@
@@ -1977,14 +2294,20 @@
if (this.isInsidePortal) {
MinecraftServer minecraftserver = worldserver.getServer();
@@ -530,7 +530,7 @@
this.level.getProfiler().pop();
}
@@ -2086,6 +2409,13 @@
@@ -2102,6 +2425,13 @@
}
public void setSwimming(boolean flag) {
@@ -544,7 +544,7 @@
this.setSharedFlag(4, flag);
}
@@ -2134,8 +2464,12 @@
@@ -2150,8 +2480,12 @@
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
}
@@ -558,7 +558,7 @@
}
public boolean getSharedFlag(int i) {
@@ -2154,7 +2488,7 @@
@@ -2170,7 +2504,7 @@
}
public int getMaxAirSupply() {
@@ -567,7 +567,7 @@
}
public int getAirSupply() {
@@ -2162,7 +2496,18 @@
@@ -2178,7 +2512,18 @@
}
public void setAirSupply(int i) {
@@ -587,7 +587,7 @@
}
public int getTicksFrozen() {
@@ -2189,11 +2534,41 @@
@@ -2205,11 +2550,41 @@
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
this.setRemainingFireTicks(this.remainingFireTicks + 1);
@@ -631,7 +631,7 @@
}
public void onAboveBubbleCol(boolean flag) {
@@ -2349,15 +2724,38 @@
@@ -2365,15 +2740,38 @@
@Nullable
public Entity changeDimension(WorldServer worldserver) {
@@ -672,7 +672,7 @@
this.level.getProfiler().popPush("reloading");
Entity entity = this.getType().create(worldserver);
@@ -2366,9 +2764,17 @@
@@ -2382,9 +2780,17 @@
entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
entity.setDeltaMovement(shapedetectorshape.speed);
worldserver.addDuringTeleport(entity);
@@ -692,7 +692,7 @@
}
this.removeAfterChangingDimensions();
@@ -2389,20 +2795,34 @@
@@ -2405,20 +2811,34 @@
@Nullable
protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) {
@@ -732,7 +732,7 @@
IBlockData iblockdata = this.level.getBlockState(this.portalEntrancePos);
EnumDirection.EnumAxis enumdirection_enumaxis;
Vec3D vec3d;
@@ -2419,8 +2839,8 @@
@@ -2435,8 +2855,8 @@
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
}
@@ -743,7 +743,7 @@
}
} else {
BlockPosition blockposition1;
@@ -2430,8 +2850,15 @@
@@ -2446,8 +2866,15 @@
} else {
blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos());
}
@@ -760,7 +760,7 @@
}
}
@@ -2439,8 +2866,23 @@
@@ -2455,8 +2882,23 @@
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
}
@@ -786,7 +786,7 @@
}
public boolean canChangeDimensions() {
@@ -2649,7 +3091,26 @@
@@ -2665,7 +3107,26 @@
}
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
@@ -814,12 +814,12 @@
}
protected float getEyeHeight(EntityPose entitypose, EntitySize entitysize) {
@@ -2933,6 +3394,11 @@
@@ -2949,6 +3410,11 @@
vec3d = vec3d.add(vec3d1);
++k1;
}
+ // CraftBukkit start - store last lava contact location
+ if (tag == TagsFluid.LAVA) {
+ if (tagkey == TagsFluid.LAVA) {
+ this.lastLavaContact = blockposition_mutableblockposition.immutable();
+ }
+ // CraftBukkit end

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/EntityAreaEffectCloud.java
+++ b/net/minecraft/world/entity/EntityAreaEffectCloud.java
@@ -32,6 +32,12 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.level.material.EnumPistonReaction;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.resources.MinecraftKey;
@@ -12,7 +12,7 @@
+
public class EntityAreaEffectCloud extends Entity {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
@@ -127,6 +133,22 @@
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityExperienceOrb.java
+++ b/net/minecraft/world/entity/EntityExperienceOrb.java
@@ -21,6 +21,12 @@
@@ -20,6 +20,12 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
@@ -13,7 +13,7 @@
public class EntityExperienceOrb extends Entity {
private static final int LIFETIME = 6000;
@@ -59,6 +65,7 @@
@@ -58,6 +64,7 @@
@Override
public void tick() {
super.tick();
@@ -21,7 +21,7 @@
this.xo = this.getX();
this.yo = this.getY();
this.zo = this.getZ();
@@ -84,7 +91,22 @@
@@ -83,7 +90,22 @@
this.followingPlayer = null;
}
@@ -45,7 +45,7 @@
Vec3D vec3d = new Vec3D(this.followingPlayer.getX() - this.getX(), this.followingPlayer.getY() + (double) this.followingPlayer.getEyeHeight() / 2.0D - this.getY(), this.followingPlayer.getZ() - this.getZ());
double d0 = vec3d.lengthSqr();
@@ -225,7 +247,7 @@
@@ -226,7 +248,7 @@
int i = this.repairPlayerItems(entityhuman, this.value);
if (i > 0) {
@@ -54,7 +54,7 @@
}
--this.count;
@@ -243,9 +265,17 @@
@@ -244,9 +266,17 @@
if (entry != null) {
ItemStack itemstack = (ItemStack) entry.getValue();
int j = Math.min(this.xpToDurability(this.value), itemstack.getDamageValue());
@@ -72,7 +72,7 @@
return k > 0 ? this.repairPlayerItems(entityhuman, k) : 0;
} else {
@@ -270,6 +300,24 @@
@@ -271,6 +301,24 @@
}
public static int getExperienceValue(int i) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/EntityLiving.java
+++ b/net/minecraft/world/entity/EntityLiving.java
@@ -116,6 +116,30 @@
@@ -117,6 +117,30 @@
import net.minecraft.world.scores.ScoreboardTeam;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
+// CraftBukkit start
+import java.util.ArrayList;
@@ -30,8 +30,8 @@
+
public abstract class EntityLiving extends Entity {
private static final UUID SPEED_MODIFIER_SPRINTING_UUID = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
@@ -224,6 +248,20 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -226,6 +250,20 @@
private float swimAmount;
private float swimAmountO;
protected BehaviorController<?> brain;
@@ -52,7 +52,7 @@
protected EntityLiving(EntityTypes<? extends EntityLiving> entitytypes, World world) {
super(entitytypes, world);
@@ -236,7 +274,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();
@@ -303,7 +343,13 @@
@@ -305,7 +345,13 @@
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
int i = (int) (150.0D * d1);
@@ -78,7 +78,7 @@
}
}
@@ -561,7 +607,7 @@
@@ -563,7 +609,7 @@
protected void tickDeath() {
++this.deathTime;
@@ -87,7 +87,7 @@
this.level.broadcastEntityEvent(this, (byte) 60);
this.remove(Entity.RemovalReason.KILLED);
}
@@ -653,9 +699,15 @@
@@ -655,9 +701,15 @@
}
protected void equipEventAndSound(ItemStack itemstack) {
@@ -104,7 +104,7 @@
this.gameEvent(GameEvent.EQUIP);
this.playSound(soundeffect, 1.0F, 1.0F);
}
@@ -717,6 +769,17 @@
@@ -719,6 +771,17 @@
}
}
@@ -122,7 +122,7 @@
if (nbttagcompound.contains("Health", 99)) {
this.setHealth(nbttagcompound.getFloat("Health"));
}
@@ -754,9 +817,32 @@
@@ -756,9 +819,32 @@
}
@@ -155,7 +155,7 @@
try {
while (iterator.hasNext()) {
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
@@ -766,6 +852,12 @@
@@ -768,6 +854,12 @@
this.onEffectUpdated(mobeffect, true, (Entity) null);
})) {
if (!this.level.isClientSide) {
@@ -168,7 +168,7 @@
iterator.remove();
this.onEffectRemoved(mobeffect);
}
@@ -776,6 +868,17 @@
@@ -778,6 +870,17 @@
} catch (ConcurrentModificationException concurrentmodificationexception) {
;
}
@@ -186,7 +186,7 @@
if (this.effectsDirty) {
if (!this.level.isClientSide) {
@@ -902,7 +1005,13 @@
@@ -904,7 +1007,13 @@
this.entityData.set(EntityLiving.DATA_EFFECT_COLOR_ID, 0);
}
@@ -200,7 +200,7 @@
if (this.level.isClientSide) {
return false;
} else {
@@ -911,7 +1020,14 @@
@@ -913,7 +1022,14 @@
boolean flag;
for (flag = false; iterator.hasNext(); flag = true) {
@@ -216,7 +216,7 @@
iterator.remove();
}
@@ -940,18 +1056,48 @@
@@ -942,18 +1058,48 @@
return this.addEffect(mobeffect, (Entity) null);
}
@@ -266,7 +266,7 @@
return true;
} else {
return false;
@@ -988,13 +1134,39 @@
@@ -990,13 +1136,39 @@
return this.getMobType() == EnumMonsterType.UNDEAD;
}
@@ -307,7 +307,7 @@
if (mobeffect != null) {
this.onEffectRemoved(mobeffect);
@@ -1031,20 +1203,55 @@
@@ -1033,20 +1205,55 @@
}
@@ -364,7 +364,7 @@
this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.clamp(f, 0.0F, this.getMaxHealth()));
}
@@ -1058,7 +1265,7 @@
@@ -1060,7 +1267,7 @@
return false;
} else if (this.level.isClientSide) {
return false;
@@ -373,7 +373,7 @@
return false;
} else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
return false;
@@ -1069,10 +1276,11 @@
@@ -1071,10 +1278,11 @@
this.noActionTime = 0;
float f1 = f;
@@ -387,7 +387,7 @@
this.hurtCurrentlyUsedShield(f);
f2 = f;
f = 0.0F;
@@ -1090,27 +1298,46 @@
@@ -1092,27 +1300,46 @@
this.animationSpeed = 1.5F;
boolean flag1 = true;
@@ -439,7 +439,7 @@
this.hurtDir = 0.0F;
Entity entity1 = damagesource.getEntity();
@@ -1233,19 +1460,29 @@
@@ -1235,19 +1462,29 @@
EnumHand[] aenumhand = EnumHand.values();
int i = aenumhand.length;
@@ -473,7 +473,7 @@
EntityPlayer entityplayer = (EntityPlayer) this;
entityplayer.awardStat(StatisticList.ITEM_USED.get(Items.TOTEM_OF_UNDYING));
@@ -1253,14 +1490,16 @@
@@ -1255,14 +1492,16 @@
}
this.setHealth(1.0F);
@@ -495,7 +495,7 @@
}
}
@@ -1365,14 +1604,22 @@
@@ -1367,14 +1606,22 @@
IBlockData iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
@@ -520,7 +520,7 @@
this.level.addFreshEntity(entityitem);
}
}
@@ -1392,21 +1639,40 @@
@@ -1394,21 +1641,40 @@
boolean flag = this.lastHurtByPlayerTime > 0;
@@ -564,7 +564,7 @@
}
@@ -1526,9 +1792,14 @@
@@ -1528,9 +1794,14 @@
int i = this.calculateFallDamage(f, f1);
if (i > 0) {
@@ -580,7 +580,7 @@
return true;
} else {
return flag;
@@ -1577,7 +1848,7 @@
@@ -1579,7 +1850,7 @@
protected float getDamageAfterArmorAbsorb(DamageSource damagesource, float f) {
if (!damagesource.isBypassArmor()) {
@@ -589,7 +589,7 @@
f = CombatMath.getDamageAfterAbsorb(f, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
}
@@ -1590,7 +1861,8 @@
@@ -1592,7 +1863,8 @@
} else {
int i;
@@ -599,7 +599,7 @@
i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
@@ -1621,29 +1893,172 @@
@@ -1623,29 +1895,172 @@
}
}
@@ -782,7 +782,7 @@
}
public CombatTracker getCombatTracker() {
@@ -1664,8 +2079,18 @@
@@ -1666,8 +2081,18 @@
}
public final void setArrowCount(int i) {
@@ -802,7 +802,7 @@
public final int getStingerCount() {
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
@@ -1961,6 +2386,12 @@
@@ -1963,6 +2388,12 @@
public abstract ItemStack getItemBySlot(EnumItemSlot enumitemslot);
@@ -815,7 +815,7 @@
@Override
public abstract void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
@@ -2204,6 +2635,7 @@
@@ -2206,6 +2637,7 @@
}
if (this.onGround && !this.level.isClientSide) {
@@ -823,7 +823,7 @@
this.setSharedFlag(7, false);
}
} else {
@@ -2734,6 +3166,7 @@
@@ -2736,6 +3168,7 @@
}
if (!this.level.isClientSide) {
@@ -831,7 +831,7 @@
this.setSharedFlag(7, flag);
}
@@ -2901,14 +3334,21 @@
@@ -2895,14 +3328,21 @@
@Override
public boolean isPickable() {
@@ -853,9 +853,9 @@
+ // CraftBukkit end
+
@Override
protected void markHurt() {
this.hurtMarked = this.random.nextDouble() >= this.getAttributeValue(GenericAttributes.KNOCKBACK_RESISTANCE);
@@ -3107,7 +3547,25 @@
public float getYHeadRot() {
return this.yHeadRot;
@@ -3096,7 +3536,25 @@
} else {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
this.triggerItemUseEffects(this.useItem, 16);
@@ -882,7 +882,7 @@
if (itemstack != this.useItem) {
this.setItemInHand(enumhand, itemstack);
@@ -3180,6 +3638,12 @@
@@ -3169,6 +3627,12 @@
}
public boolean randomTeleport(double d0, double d1, double d2, boolean flag) {
@@ -895,7 +895,7 @@
double d3 = this.getX();
double d4 = this.getY();
double d5 = this.getZ();
@@ -3204,16 +3668,41 @@
@@ -3193,16 +3657,41 @@
}
if (flag2) {
@@ -940,7 +940,7 @@
} else {
if (flag) {
world.broadcastEntityEvent(this, (byte) 46);
@@ -3223,7 +3712,7 @@
@@ -3212,7 +3701,7 @@
((EntityCreature) this).getNavigation().stop();
}
@@ -949,7 +949,7 @@
}
}
@@ -3306,7 +3795,7 @@
@@ -3295,7 +3784,7 @@
}
public void stopSleeping() {
@@ -958,7 +958,7 @@
World world = this.level;
java.util.Objects.requireNonNull(this.level);
@@ -3338,7 +3827,7 @@
@@ -3327,7 +3816,7 @@
@Nullable
public EnumDirection getBedOrientation() {
@@ -967,7 +967,7 @@
return blockposition != null ? BlockBed.getBedOrientation(this.level, blockposition) : null;
}
@@ -3387,7 +3876,7 @@
@@ -3376,7 +3865,7 @@
Pair<MobEffect, Float> pair = (Pair) iterator.next();
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {
@@ -976,7 +976,7 @@
}
}
}
@@ -3490,8 +3979,10 @@
@@ -3479,8 +3968,10 @@
this.setDeltaMovement((double) ((float) packetplayoutspawnentityliving.getXd() / 8000.0F), (double) ((float) packetplayoutspawnentityliving.getYd() / 8000.0F), (double) ((float) packetplayoutspawnentityliving.getZd() / 8000.0F));
}
@@ -988,7 +988,7 @@
private final SoundEffect small;
private final SoundEffect big;
@@ -3507,5 +3998,7 @@
@@ -3496,5 +3987,7 @@
public SoundEffect big() {
return this.big;
}

View File

@@ -1,15 +1,15 @@
--- a/net/minecraft/world/entity/EntityTypes.java
+++ b/net/minecraft/world/entity/EntityTypes.java
@@ -152,7 +152,7 @@
private static final Logger LOGGER = LogManager.getLogger();
@@ -154,7 +154,7 @@
public static final String ENTITY_TAG = "EntityTag";
private final Holder.c<EntityTypes<?>> builtInRegistryHolder;
private static final float MAGIC_HORSE_WIDTH = 1.3964844F;
- public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = register("area_effect_cloud", EntityTypes.Builder.of(EntityAreaEffectCloud::new, EnumCreatureType.MISC).fireImmune().sized(6.0F, 0.5F).clientTrackingRange(10).updateInterval(Integer.MAX_VALUE));
+ public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = register("area_effect_cloud", EntityTypes.Builder.of(EntityAreaEffectCloud::new, EnumCreatureType.MISC).fireImmune().sized(6.0F, 0.5F).clientTrackingRange(10).updateInterval(10)); // CraftBukkit - SPIGOT-3729: track area effect clouds
public static final EntityTypes<EntityArmorStand> ARMOR_STAND = register("armor_stand", EntityTypes.Builder.of(EntityArmorStand::new, EnumCreatureType.MISC).sized(0.5F, 1.975F).clientTrackingRange(10));
public static final EntityTypes<EntityTippedArrow> ARROW = register("arrow", EntityTypes.Builder.of(EntityTippedArrow::new, EnumCreatureType.MISC).sized(0.5F, 0.5F).clientTrackingRange(4).updateInterval(20));
public static final EntityTypes<Axolotl> AXOLOTL = register("axolotl", EntityTypes.Builder.of(Axolotl::new, EnumCreatureType.AXOLOTLS).sized(0.75F, 0.42F).clientTrackingRange(10));
@@ -282,8 +282,8 @@
@@ -284,8 +284,8 @@
private MinecraftKey lootTable;
private final EntitySize dimensions;
@@ -20,7 +20,7 @@
}
public static MinecraftKey getKey(EntityTypes<?> entitytypes) {
@@ -314,10 +314,18 @@
@@ -317,10 +317,18 @@
@Nullable
public T spawn(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
@@ -40,7 +40,7 @@
}
return t0;
@@ -353,7 +361,7 @@
@@ -356,7 +364,7 @@
t0.setCustomName(ichatbasecomponent);
}
@@ -49,7 +49,7 @@
return t0;
}
}
@@ -510,7 +518,7 @@
@@ -513,7 +521,7 @@
}
return entity;
@@ -58,7 +58,7 @@
}
public static Stream<Entity> loadEntitiesRecursive(final List<? extends NBTBase> list, final World world) {
@@ -567,7 +575,7 @@
@@ -570,7 +578,7 @@
@Nullable
public T tryCast(Entity entity) {
@@ -67,7 +67,7 @@
}
@Override
@@ -594,7 +602,7 @@
@@ -603,7 +611,7 @@
this.canSpawnFarFromPlayer = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC;
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/behavior/BehaviorCareer.java
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorCareer.java
@@ -13,6 +13,12 @@
@@ -12,6 +12,12 @@
import net.minecraft.world.entity.npc.EntityVillager;
import net.minecraft.world.entity.npc.VillagerProfession;
@@ -13,7 +13,7 @@
public class BehaviorCareer extends Behavior<EntityVillager> {
public BehaviorCareer() {
@@ -29,7 +35,7 @@
@@ -28,7 +34,7 @@
GlobalPos globalpos = (GlobalPos) entityvillager.getBrain().getMemory(MemoryModuleType.POTENTIAL_JOB_SITE).get();
entityvillager.getBrain().eraseMemory(MemoryModuleType.POTENTIAL_JOB_SITE);
@@ -22,7 +22,7 @@
worldserver.broadcastEntityEvent(entityvillager, (byte) 14);
if (entityvillager.getVillagerData().getProfession() == VillagerProfession.NONE) {
MinecraftServer minecraftserver = worldserver.getServer();
@@ -41,7 +47,14 @@
@@ -40,7 +46,14 @@
return villagerprofession.getJobPoiType() == villageplacetype;
}).findFirst();
}).ifPresent((villagerprofession) -> {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/behavior/BehaviorFarm.java
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorFarm.java
@@ -80,8 +80,8 @@
@@ -79,8 +79,8 @@
protected void start(WorldServer worldserver, EntityVillager entityvillager, long i) {
if (i > this.nextOkStartTime && this.aboveFarmlandPos != null) {
@@ -11,7 +11,7 @@
}
}
@@ -101,7 +101,11 @@
@@ -100,7 +100,11 @@
Block block1 = worldserver.getBlockState(this.aboveFarmlandPos.below()).getBlock();
if (block instanceof BlockCrops && ((BlockCrops) block).isMaxAge(iblockdata)) {
@@ -24,7 +24,7 @@
}
if (iblockdata.isAir() && block1 instanceof BlockSoil && entityvillager.hasFarmSeeds()) {
@@ -112,19 +116,28 @@
@@ -111,19 +115,28 @@
boolean flag = false;
if (!itemstack.isEmpty()) {
@@ -57,7 +57,7 @@
}
if (flag) {
@@ -143,8 +156,8 @@
@@ -142,8 +155,8 @@
this.aboveFarmlandPos = this.getValidFarmland(worldserver);
if (this.aboveFarmlandPos != null) {
this.nextOkStartTime = i + 20L;

View File

@@ -14,7 +14,7 @@
blockdoor.setOpen(entityliving, worldserver, iblockdata, blockposition, true);
}
@@ -82,6 +89,13 @@
@@ -84,6 +91,13 @@
BlockDoor blockdoor1 = (BlockDoor) iblockdata1.getBlock();
if (!blockdoor1.isOpen(iblockdata1)) {
@@ -28,7 +28,7 @@
blockdoor1.setOpen(entityliving, worldserver, iblockdata1, blockposition1, true);
this.rememberDoorToClose(worldserver, entityliving, blockposition1);
}
@@ -130,7 +144,7 @@
@@ -134,7 +148,7 @@
private static boolean areOtherMobsComingThroughDoor(WorldServer worldserver, EntityLiving entityliving, BlockPosition blockposition) {
BehaviorController<?> behaviorcontroller = entityliving.getBrain();
@@ -36,8 +36,8 @@
+ return !behaviorcontroller.hasMemoryValue(MemoryModuleType.NEAREST_LIVING_ENTITIES) ? false : (behaviorcontroller.getMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES).get()).stream().filter((entityliving1) -> { // CraftBukkit - decompile error
return entityliving1.getType() == entityliving.getType();
}).filter((entityliving1) -> {
return blockposition.closerThan((IPosition) entityliving1.position(), 2.0D);
@@ -172,7 +186,7 @@
return blockposition.closerToCenterThan(entityliving1.position(), 2.0D);
@@ -176,7 +190,7 @@
if (behaviorcontroller.getMemory(MemoryModuleType.DOORS_TO_CLOSE).isPresent()) {
((Set) behaviorcontroller.getMemory(MemoryModuleType.DOORS_TO_CLOSE).get()).add(globalpos);
} else {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalBreakDoor.java
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalBreakDoor.java
@@ -72,6 +72,12 @@
@@ -71,6 +71,12 @@
}
if (this.breakTime == this.getDoorBreakTime() && this.isValidDifficulty(this.mob.level.getDifficulty())) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalPanic.java
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalPanic.java
@@ -11,6 +11,10 @@
@@ -10,6 +10,10 @@
import net.minecraft.world.level.IBlockAccess;
import net.minecraft.world.phys.Vec3D;
@@ -11,7 +11,7 @@
public class PathfinderGoalPanic extends PathfinderGoal {
public static final int WATER_CHECK_DISTANCE_VERTICAL = 1;
@@ -77,6 +81,12 @@
@@ -80,6 +84,12 @@
@Override
public boolean canContinueToUse() {
@@ -24,10 +24,10 @@
return !this.mob.getNavigation().isDone();
}
@@ -86,6 +96,6 @@
@@ -89,6 +99,6 @@
return !iblockaccess.getBlockState(blockposition).getCollisionShape(iblockaccess, blockposition).isEmpty() ? null : (BlockPosition) BlockPosition.findClosestMatch(entity.blockPosition(), i, 1, (blockposition1) -> {
return iblockaccess.getFluidState(blockposition1).is((Tag) TagsFluid.WATER);
return iblockaccess.getFluidState(blockposition1).is(TagsFluid.WATER);
- }).orElse((Object) null);
+ }).orElse(null); // CraftBukkit - decompile error
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ambient/EntityBat.java
+++ b/net/minecraft/world/entity/ambient/EntityBat.java
@@ -29,6 +29,8 @@
@@ -28,6 +28,8 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.Vec3D;
@@ -9,7 +9,7 @@
public class EntityBat extends EntityAmbient {
public static final float FLAP_DEGREES_PER_TICK = 74.48451F;
@@ -138,16 +140,24 @@
@@ -137,16 +139,24 @@
}
if (this.level.getNearestPlayer(EntityBat.BAT_RESTING_TARGETING, this) != null) {
@@ -39,7 +39,7 @@
}
} else {
if (this.targetPosition != null && (!this.level.isEmptyBlock(this.targetPosition) || this.targetPosition.getY() <= this.level.getMinBuildHeight())) {
@@ -171,7 +181,11 @@
@@ -170,7 +180,11 @@
this.zza = 0.5F;
this.setYRot(this.getYRot() + f1);
if (this.random.nextInt(100) == 0 && this.level.getBlockState(blockposition1).isRedstoneConductor(this.level, blockposition1)) {
@@ -52,7 +52,7 @@
}
}
@@ -201,7 +215,11 @@
@@ -200,7 +214,11 @@
return false;
} else {
if (!this.level.isClientSide && this.isResting()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityAnimal.java
+++ b/net/minecraft/world/entity/animal/EntityAnimal.java
@@ -31,12 +31,19 @@
@@ -30,12 +30,19 @@
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.level.pathfinder.PathType;
@@ -20,7 +20,7 @@
protected EntityAnimal(EntityTypes<? extends EntityAnimal> entitytypes, World world) {
super(entitytypes, world);
@@ -73,6 +80,9 @@
@@ -72,6 +79,9 @@
}
@@ -30,7 +30,7 @@
@Override
public boolean hurt(DamageSource damagesource, float f) {
if (this.isInvulnerableTo(damagesource)) {
@@ -82,6 +92,7 @@
@@ -81,6 +91,7 @@
return super.hurt(damagesource, f);
}
}
@@ -38,7 +38,7 @@
@Override
public float getWalkTargetValue(BlockPosition blockposition, IWorldReader iworldreader) {
@@ -178,10 +189,17 @@
@@ -177,10 +188,17 @@
}
public void setInLove(@Nullable EntityHuman entityhuman) {
@@ -57,7 +57,7 @@
this.level.broadcastEntityEvent(this, (byte) 18);
}
@@ -221,11 +239,26 @@
@@ -220,11 +238,26 @@
EntityAgeable entityageable = this.getBreedOffspring(worldserver, entityanimal);
if (entityageable != null) {
@@ -84,7 +84,7 @@
if (entityplayer != null) {
entityplayer.awardStat(StatisticList.ANIMALS_BRED);
@@ -236,12 +269,14 @@
@@ -235,12 +268,14 @@
entityanimal.setAge(6000);
this.resetLove();
entityanimal.resetLove();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityBee.java
+++ b/net/minecraft/world/entity/animal/EntityBee.java
@@ -244,7 +244,7 @@
@@ -242,7 +242,7 @@
}
if (b0 > 0) {
@@ -9,7 +9,7 @@
}
}
@@ -644,11 +644,15 @@
@@ -642,11 +642,15 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {
@@ -27,7 +27,7 @@
}
}
@@ -1224,7 +1228,7 @@
@@ -1222,7 +1226,7 @@
}
}
@@ -36,7 +36,7 @@
EntityBee.this.level.levelEvent(2005, blockposition, 0);
EntityBee.this.level.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.setValue(blockstateinteger, (Integer) iblockdata.getValue(blockstateinteger) + 1));
EntityBee.this.incrementNumCropsGrownSincePollination();
@@ -1297,7 +1301,7 @@
@@ -1295,7 +1299,7 @@
@Override
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
if (entityinsentient instanceof EntityBee && this.mob.hasLineOfSight(entityliving)) {
@@ -45,7 +45,7 @@
}
}
@@ -1306,7 +1310,7 @@
@@ -1304,7 +1308,7 @@
private static class c extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
c(EntityBee entitybee) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityCat.java
+++ b/net/minecraft/world/entity/animal/EntityCat.java
@@ -434,7 +434,7 @@
@@ -443,7 +443,7 @@
}
} else if (this.isFood(itemstack)) {
this.usePlayerItem(entityhuman, enumhand, itemstack);
@@ -9,7 +9,7 @@
this.tame(entityhuman);
this.setOrderedToSit(true);
this.level.broadcastEntityEvent(this, (byte) 7);
@@ -491,7 +491,7 @@
@@ -500,7 +500,7 @@
private static class PathfinderGoalTemptChance extends PathfinderGoalTempt {
@Nullable
@@ -18,7 +18,7 @@
private final EntityCat cat;
public PathfinderGoalTemptChance(EntityCat entitycat, double d0, RecipeItemStack recipeitemstack, boolean flag) {
@@ -632,7 +632,15 @@
@@ -641,7 +641,15 @@
while (iterator.hasNext()) {
ItemStack itemstack = (ItemStack) iterator.next();
@@ -35,7 +35,7 @@
}
}
@@ -664,10 +672,10 @@
@@ -673,10 +681,10 @@
private final EntityCat cat;
public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityDolphin.java
+++ b/net/minecraft/world/entity/animal/EntityDolphin.java
@@ -65,6 +65,12 @@
@@ -63,6 +63,12 @@
public class EntityDolphin extends EntityWaterAnimal {
@@ -13,7 +13,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);
@@ -192,7 +198,7 @@
@@ -190,7 +196,7 @@
@Override
public int getMaxAirSupply() {
@@ -22,7 +22,7 @@
}
@Override
@@ -233,6 +239,12 @@
@@ -231,6 +237,12 @@
ItemStack itemstack = entityitem.getItem();
if (this.canHoldItem(itemstack)) {
@@ -35,7 +35,7 @@
this.onItemPickup(entityitem);
this.setItemSlot(EnumItemSlot.MAINHAND, itemstack);
this.handDropChances[EnumItemSlot.MAINHAND.getIndex()] = 2.0F;
@@ -391,7 +403,7 @@
@@ -389,7 +401,7 @@
@Override
public boolean canUse() {
@@ -44,7 +44,7 @@
}
@Override
@@ -501,7 +513,7 @@
@@ -489,7 +501,7 @@
@Override
public void start() {
@@ -53,7 +53,7 @@
}
@Override
@@ -520,7 +532,7 @@
@@ -508,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/EntityFox.java
+++ b/net/minecraft/world/entity/animal/EntityFox.java
@@ -507,7 +507,8 @@
@@ -509,7 +509,8 @@
protected void pickUpItem(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItem();
@@ -10,7 +10,7 @@
int i = itemstack.getCount();
if (i > 1) {
@@ -862,6 +863,16 @@
@@ -864,6 +865,16 @@
if (entityplayer1 != null && entityplayer != entityplayer1) {
entityfox.addTrustedUUID(entityplayer1.getUUID());
}
@@ -27,7 +27,7 @@
if (entityplayer2 != null) {
entityplayer2.awardStat(StatisticList.ANIMALS_BRED);
@@ -872,12 +883,14 @@
@@ -874,12 +885,14 @@
this.partner.setAge(6000);
this.animal.resetLove();
this.partner.resetLove();
@@ -46,7 +46,7 @@
}
}
@@ -1268,13 +1281,18 @@
@@ -1270,13 +1283,18 @@
}
private void pickGlowBerry(IBlockData iblockdata) {
@@ -66,7 +66,7 @@
int j = 1 + EntityFox.this.level.random.nextInt(2) + (i == 3 ? 1 : 0);
ItemStack itemstack = EntityFox.this.getItemBySlot(EnumItemSlot.MAINHAND);
@@ -1431,7 +1449,7 @@
@@ -1433,7 +1451,7 @@
private EntityLiving trustedLastHurt;
private int timestamp;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityMushroomCow.java
+++ b/net/minecraft/world/entity/animal/EntityMushroomCow.java
@@ -44,6 +44,13 @@
@@ -43,6 +43,13 @@
import net.minecraft.world.level.gameevent.GameEvent;
import org.apache.commons.lang3.tuple.Pair;
@@ -14,7 +14,7 @@
public class EntityMushroomCow extends EntityCow implements IShearable {
private static final DataWatcherObject<String> DATA_TYPE = DataWatcher.defineId(EntityMushroomCow.class, DataWatcherRegistry.STRING);
@@ -117,6 +124,11 @@
@@ -116,6 +123,11 @@
this.playSound(soundeffect, 1.0F, 1.0F);
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
} else if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
@@ -26,7 +26,7 @@
this.shear(SoundCategory.PLAYERS);
this.gameEvent(GameEvent.SHEAR, (Entity) entityhuman);
if (!this.level.isClientSide) {
@@ -164,7 +176,7 @@
@@ -163,7 +175,7 @@
this.level.playSound((EntityHuman) null, (Entity) this, SoundEffects.MOOSHROOM_SHEAR, soundcategory, 1.0F, 1.0F);
if (!this.level.isClientSide()) {
((WorldServer) this.level).sendParticles(Particles.EXPLOSION, this.getX(), this.getY(0.5D), this.getZ(), 1, 0.0D, 0.0D, 0.0D, 0.0D);
@@ -35,7 +35,7 @@
EntityCow entitycow = (EntityCow) EntityTypes.COW.create(this.level);
entitycow.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
@@ -180,10 +192,25 @@
@@ -179,10 +191,25 @@
}
entitycow.setInvulnerable(this.isInvulnerable());

View File

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

View File

@@ -18,7 +18,7 @@
this.onItemPickup(entityitem);
ItemStack itemstack = entityitem.getItem();
@@ -882,10 +884,10 @@
@@ -872,10 +874,10 @@
private final EntityPanda panda;
public c(EntityPanda entitypanda, Class<T> oclass, float f, double d0, double d1) {
@@ -32,7 +32,7 @@
this.panda = entitypanda;
}
@@ -1132,7 +1134,7 @@
@@ -1114,7 +1116,7 @@
@Override
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
if (entityinsentient instanceof EntityPanda && ((EntityPanda) entityinsentient).isAggressive()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityParrot.java
+++ b/net/minecraft/world/entity/animal/EntityParrot.java
@@ -258,7 +258,7 @@
@@ -256,7 +256,7 @@
}
if (!this.level.isClientSide) {
@@ -9,7 +9,7 @@
this.tame(entityhuman);
this.level.broadcastEntityEvent(this, (byte) 7);
} else {
@@ -272,7 +272,7 @@
@@ -270,7 +270,7 @@
itemstack.shrink(1);
}
@@ -18,7 +18,7 @@
if (entityhuman.isCreative() || !this.isInvulnerable()) {
this.hurt(DamageSource.playerAttack(entityhuman), Float.MAX_VALUE);
}
@@ -384,7 +384,7 @@
@@ -382,7 +382,7 @@
@Override
public boolean isPushable() {
@@ -27,12 +27,12 @@
}
@Override
@@ -399,7 +399,7 @@
if (this.isInvulnerableTo(damagesource)) {
@@ -398,7 +398,7 @@
return false;
} else {
- this.setOrderedToSit(false);
+ // this.setOrderedToSit(false); // CraftBukkit - moved into EntityLiving.damageEntity(DamageSource, float)
if (!this.level.isClientSide) {
- this.setOrderedToSit(false);
+ // this.setOrderedToSit(false); // CraftBukkit - moved into EntityLiving.damageEntity(DamageSource, float)
}
return super.hurt(damagesource, f);
}
}

View File

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

View File

@@ -12,7 +12,7 @@
private static final DataWatcherObject<Byte> DATA_PUMPKIN_ID = DataWatcher.defineId(EntitySnowman.class, DataWatcherRegistry.BYTE);
@@ -103,7 +107,7 @@
BiomeBase biomebase = this.level.getBiome(blockposition);
BiomeBase biomebase = (BiomeBase) this.level.getBiome(blockposition).value();
if (biomebase.shouldSnowGolemBurn(blockposition)) {
- this.hurt(DamageSource.ON_FIRE, 1.0F);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityTurtle.java
+++ b/net/minecraft/world/entity/animal/EntityTurtle.java
@@ -311,7 +311,9 @@
@@ -309,7 +309,9 @@
protected void ageBoundaryReached() {
super.ageBoundaryReached();
if (!this.isBaby() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
@@ -10,7 +10,7 @@
}
}
@@ -338,7 +340,9 @@
@@ -336,7 +338,9 @@
@Override
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
@@ -20,7 +20,7 @@
}
private static class e extends ControllerMove {
@@ -484,8 +488,12 @@
@@ -482,8 +486,12 @@
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
World world = this.turtle.level;

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/animal/EntityWolf.java
+++ b/net/minecraft/world/entity/animal/EntityWolf.java
@@ -68,6 +68,11 @@
import net.minecraft.world.level.gameevent.GameEvent;
@@ -69,6 +69,11 @@
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
@@ -12,7 +12,7 @@
public class EntityWolf extends EntityTameableAnimal implements IEntityAngerable {
private static final DataWatcherObject<Boolean> DATA_INTERESTED_ID = DataWatcher.defineId(EntityWolf.class, DataWatcherRegistry.BOOLEAN);
@@ -122,6 +127,24 @@
@@ -126,6 +131,24 @@
return EntityInsentient.createMobAttributes().add(GenericAttributes.MOVEMENT_SPEED, 0.30000001192092896D).add(GenericAttributes.MAX_HEALTH, 8.0D).add(GenericAttributes.ATTACK_DAMAGE, 2.0D);
}
@@ -37,16 +37,16 @@
@Override
protected void defineSynchedData() {
super.defineSynchedData();
@@ -293,7 +316,7 @@
} else {
@@ -298,7 +321,7 @@
Entity entity = damagesource.getEntity();
- this.setOrderedToSit(false);
+ // this.setWillSit(false); // CraftBukkit - moved into EntityLiving.damageEntity(DamageSource, float)
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
f = (f + 1.0F) / 2.0F;
if (!this.level.isClientSide) {
- this.setOrderedToSit(false);
+ // this.setOrderedToSit(false); // CraftBukkit - moved into EntityLiving.damageEntity(DamageSource, float)
}
@@ -318,7 +341,7 @@
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
@@ -325,7 +348,7 @@
super.setTame(flag);
if (flag) {
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(20.0D);
@@ -55,7 +55,7 @@
} else {
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(8.0D);
}
@@ -342,7 +365,7 @@
@@ -349,7 +372,7 @@
itemstack.shrink(1);
}
@@ -64,7 +64,7 @@
this.gameEvent(GameEvent.MOB_INTERACT, this.eyeBlockPosition());
return EnumInteractionResult.SUCCESS;
}
@@ -354,7 +377,7 @@
@@ -361,7 +384,7 @@
this.setOrderedToSit(!this.isOrderedToSit());
this.jumping = false;
this.navigation.stop();
@@ -73,7 +73,7 @@
return EnumInteractionResult.SUCCESS;
}
@@ -376,7 +399,8 @@
@@ -383,7 +406,8 @@
itemstack.shrink(1);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
@@ -67,9 +67,16 @@
@@ -68,10 +68,17 @@
public class Axolotl extends EntityAnimal implements LerpingModel, Bucketable {
@@ -10,6 +10,7 @@
+ return AXOLOTL_TOTAL_AIR_SUPPLY;
+ }
+ // CraftBukkit end
private static final Logger LOGGER = LogUtils.getLogger();
public static final int TOTAL_PLAYDEAD_TIME = 200;
protected static final ImmutableList<? extends SensorType<? extends Sensor<? super Axolotl>>> SENSOR_TYPES = ImmutableList.of(SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_ADULT, SensorType.HURT_BY, SensorType.AXOLOTL_ATTACKABLES, SensorType.AXOLOTL_TEMPTATIONS);
- protected static final ImmutableList<? extends MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.BREED_TARGET, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.NEAREST_VISIBLE_ADULT, new MemoryModuleType[]{MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.PLAY_DEAD_TICKS, MemoryModuleType.NEAREST_ATTACKABLE, MemoryModuleType.TEMPTING_PLAYER, MemoryModuleType.TEMPTATION_COOLDOWN_TICKS, MemoryModuleType.IS_TEMPTED, MemoryModuleType.HAS_HUNTING_COOLDOWN});
@@ -18,7 +19,7 @@
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);
@@ -185,7 +192,7 @@
@@ -187,7 +194,7 @@
@Override
public int getMaxAirSupply() {
@@ -27,7 +28,7 @@
}
public Axolotl.Variant getVariant() {
@@ -236,6 +243,7 @@
@@ -238,6 +245,7 @@
@Override
public void setFromBucket(boolean flag) {
this.entityData.set(Axolotl.FROM_BUCKET, flag);
@@ -35,7 +36,7 @@
}
@Nullable
@@ -419,7 +427,7 @@
@@ -428,7 +436,7 @@
if (i < 2400) {
i = Math.min(2400, 100 + i);
@@ -44,7 +45,7 @@
}
entityhuman.removeEffect(MobEffects.DIG_SLOWDOWN);
@@ -469,7 +477,7 @@
@@ -478,7 +486,7 @@
@Override
public BehaviorController<Axolotl> getBrain() {
@@ -53,7 +54,7 @@
}
@Override
@@ -502,7 +510,7 @@
@@ -511,7 +519,7 @@
@Override
public boolean removeWhenFarAway(double d0) {

View File

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

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/horse/EntityLlama.java
+++ b/net/minecraft/world/entity/animal/horse/EntityLlama.java
@@ -78,6 +78,12 @@
@@ -77,6 +77,12 @@
return false;
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
@@ -53,6 +53,18 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -51,6 +51,18 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.world.item.ItemStack;
@@ -18,8 +18,8 @@
+
public class EntityEnderDragon extends EntityInsentient implements IMonster {
private static final Logger LOGGER = LogManager.getLogger();
@@ -89,6 +101,7 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -87,6 +99,7 @@
private final PathPoint[] nodes = new PathPoint[24];
private final int[] nodeAdjacency = new int[24];
private final Path openSet = new Path();
@@ -27,7 +27,7 @@
public EntityEnderDragon(EntityTypes<? extends EntityEnderDragon> entitytypes, World world) {
super(EntityTypes.ENDER_DRAGON, world);
@@ -236,7 +249,7 @@
@@ -234,7 +247,7 @@
Vec3D vec3d1 = idragoncontroller.getFlyTargetLocation();
@@ -36,7 +36,7 @@
d0 = vec3d1.x - this.getX();
d1 = vec3d1.y - this.getY();
d2 = vec3d1.z - this.getZ();
@@ -378,7 +391,14 @@
@@ -375,7 +388,14 @@
if (this.nearestCrystal.isRemoved()) {
this.nearestCrystal = null;
} else if (this.tickCount % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
@@ -52,7 +52,7 @@
}
}
@@ -453,6 +473,9 @@
@@ -450,6 +470,9 @@
int j1 = MathHelper.floor(axisalignedbb.maxZ);
boolean flag = false;
boolean flag1 = false;
@@ -62,10 +62,10 @@
for (int k1 = i; k1 <= l; ++k1) {
for (int l1 = j; l1 <= i1; ++l1) {
@@ -462,7 +485,11 @@
@@ -459,7 +482,11 @@
if (!iblockdata.isAir() && iblockdata.getMaterial() != Material.FIRE) {
if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.is((Tag) TagsBlock.DRAGON_IMMUNE)) {
if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.is(TagsBlock.DRAGON_IMMUNE)) {
- flag1 = this.level.removeBlock(blockposition, false) || flag1;
+ // CraftBukkit start - Add blocks to list rather than destroying them
+ // flag1 = this.level.removeBlock(blockposition, false) || flag1;
@@ -75,7 +75,7 @@
} else {
flag = true;
}
@@ -471,6 +498,51 @@
@@ -468,6 +495,51 @@
}
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerManager.java
+++ b/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerManager.java
@@ -5,6 +5,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon;
import org.slf4j.Logger;
+// CraftBukkit start
+import org.bukkit.craftbukkit.entity.CraftEnderDragon;
@@ -11,7 +11,7 @@
+
public class DragonControllerManager {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
@@ -24,6 +29,19 @@
this.currentPhase.end();
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/wither/EntityWither.java
+++ b/net/minecraft/world/entity/boss/wither/EntityWither.java
@@ -56,6 +56,17 @@
@@ -55,6 +55,17 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.Vec3D;
@@ -18,7 +18,7 @@
public class EntityWither extends EntityMonster implements PowerableMob, IRangedEntity {
private static final DataWatcherObject<Integer> DATA_TARGET_A = DataWatcher.defineId(EntityWither.class, DataWatcherRegistry.INT);
@@ -250,16 +261,40 @@
@@ -249,16 +260,40 @@
this.bossEvent.setProgress(1.0F - (float) i / 220.0F);
if (i <= 0) {
Explosion.Effect explosion_effect = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
@@ -62,7 +62,7 @@
}
} else {
@@ -304,6 +339,7 @@
@@ -303,6 +338,7 @@
if (!list.isEmpty()) {
EntityLiving entityliving1 = (EntityLiving) list.get(this.random.nextInt(list.size()));
@@ -70,7 +70,7 @@
this.setAlternativeTarget(i, entityliving1.getId());
}
}
@@ -334,6 +370,11 @@
@@ -333,6 +369,11 @@
IBlockData iblockdata = this.level.getBlockState(blockposition);
if (canDestroy(iblockdata)) {
@@ -82,7 +82,7 @@
flag = this.level.destroyBlock(blockposition, true, this) || flag;
}
}
@@ -347,7 +388,7 @@
@@ -346,7 +387,7 @@
}
if (this.tickCount % 20 == 0) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/decoration/EntityLeash.java
+++ b/net/minecraft/world/entity/decoration/EntityLeash.java
@@ -25,6 +25,12 @@
@@ -24,6 +24,12 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
@@ -13,7 +13,7 @@
public class EntityLeash extends EntityHanging {
public static final double OFFSET_Y = 0.375D;
@@ -96,22 +102,42 @@
@@ -95,22 +101,42 @@
while (iterator.hasNext()) {
entityinsentient = (EntityInsentient) iterator.next();
if (entityinsentient.getLeashHolder() == entityhuman) {

View File

@@ -1,24 +1,15 @@
--- a/net/minecraft/world/entity/item/EntityFallingBlock.java
+++ b/net/minecraft/world/entity/item/EntityFallingBlock.java
@@ -45,6 +45,8 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
@@ -46,6 +46,8 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class EntityFallingBlock extends Entity {
private static final int REMOVAL_DELAY_MILLIS = 50;
@@ -122,7 +124,7 @@
if (this.time++ == 0) {
blockposition = this.blockPosition();
- if (this.level.getBlockState(blockposition).is(block)) {
+ if (this.level.getBlockState(blockposition).is(block) && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
this.level.removeBlock(blockposition, false);
} else if (!this.level.isClientSide) {
this.discard();
@@ -173,6 +175,12 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -166,6 +168,12 @@
this.blockState = (IBlockData) this.blockState.setValue(BlockProperties.WATERLOGGED, true);
}
@@ -31,7 +22,7 @@
if (this.level.setBlock(blockposition, this.blockState, 3)) {
((WorldServer) this.level).getChunkSource().chunkMap.broadcast(this, new PacketPlayOutBlockChange(blockposition, this.level.getBlockState(blockposition)));
this.discard();
@@ -252,7 +260,7 @@
@@ -236,7 +244,7 @@
if (i < 0) {
return false;
} else {
@@ -40,7 +31,7 @@
DamageSource damagesource1;
if (this.blockState.getBlock() instanceof Fallable) {
@@ -268,7 +276,9 @@
@@ -252,7 +260,9 @@
float f2 = (float) Math.min(MathHelper.floor((float) i * this.fallDamagePerDistance), this.fallDamageMax);
this.level.getEntities((Entity) this, this.getBoundingBox(), predicate).forEach((entity) -> {
@@ -48,5 +39,5 @@
entity.hurt(damagesource1, f2);
+ CraftEventFactory.entityDamage = null; // CraftBukkit
});
boolean flag = this.blockState.is((Tag) TagsBlock.ANVIL);
boolean flag = this.blockState.is(TagsBlock.ANVIL);

View File

@@ -75,9 +75,9 @@
merge(entityitem, itemstack, itemstack1);
entityitem.pickupDelay = Math.max(entityitem.pickupDelay, entityitem1.pickupDelay);
entityitem.age = Math.min(entityitem.age, entityitem1.age);
@@ -263,6 +282,11 @@
} else if (!this.getItem().getItem().canBeHurtBy(damagesource)) {
return false;
@@ -265,6 +284,11 @@
} else if (this.level.isClientSide) {
return true;
} else {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
@@ -87,7 +87,7 @@
this.markHurt();
this.health = (int) ((float) this.health - f);
this.gameEvent(GameEvent.ENTITY_DAMAGED, damagesource.getEntity());
@@ -326,6 +350,46 @@
@@ -328,6 +352,46 @@
Item item = itemstack.getItem();
int i = itemstack.getCount();
@@ -134,7 +134,7 @@
if (this.pickupDelay == 0 && (this.owner == null || this.owner.equals(entityhuman.getUUID())) && entityhuman.getInventory().add(itemstack)) {
entityhuman.take(this, i);
if (itemstack.isEmpty()) {
@@ -369,7 +433,9 @@
@@ -371,7 +435,9 @@
}
public void setItem(ItemStack itemstack) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityEnderman.java
+++ b/net/minecraft/world/entity/monster/EntityEnderman.java
@@ -110,7 +110,17 @@
@@ -109,7 +109,17 @@
@Override
public void setTarget(@Nullable EntityLiving entityliving) {
@@ -19,7 +19,7 @@
AttributeModifiable attributemodifiable = this.getAttribute(GenericAttributes.MOVEMENT_SPEED);
if (entityliving == null) {
@@ -125,6 +135,7 @@
@@ -124,6 +134,7 @@
attributemodifiable.addTransientModifier(EntityEnderman.SPEED_MODIFIER_ATTACKING);
}
}
@@ -27,7 +27,7 @@
}
@@ -471,9 +482,13 @@
@@ -470,9 +481,13 @@
if (iblockdata2 != null) {
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level, blockposition);
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
@@ -41,10 +41,10 @@
}
}
@@ -512,9 +527,13 @@
@@ -511,9 +526,13 @@
boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition);
if (iblockdata.is((Tag) TagsBlock.ENDERMAN_HOLDABLE) && flag) {
if (iblockdata.is(TagsBlock.ENDERMAN_HOLDABLE) && flag) {
- world.removeBlock(blockposition, false);
- world.gameEvent(this.enderman, GameEvent.BLOCK_DESTROY, blockposition);
- this.enderman.setCarriedBlock(iblockdata.getBlock().defaultBlockState());

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntitySilverfish.java
+++ b/net/minecraft/world/entity/monster/EntitySilverfish.java
@@ -173,6 +173,11 @@
@@ -175,6 +175,11 @@
Block block = iblockdata.getBlock();
if (block instanceof BlockMonsterEggs) {
@@ -12,7 +12,7 @@
if (world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
world.destroyBlock(blockposition1, true, this.silverfish);
} else {
@@ -242,6 +247,11 @@
@@ -244,6 +249,11 @@
IBlockData iblockdata = world.getBlockState(blockposition);
if (BlockMonsterEggs.isCompatibleHostBlock(iblockdata)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntitySlime.java
+++ b/net/minecraft/world/entity/monster/EntitySlime.java
@@ -45,6 +45,14 @@
@@ -43,6 +43,14 @@
import net.minecraft.world.level.storage.loot.LootTables;
import net.minecraft.world.phys.Vec3D;
@@ -15,7 +15,7 @@
public class EntitySlime extends EntityInsentient implements IMonster {
private static final DataWatcherObject<Integer> ID_SIZE = DataWatcher.defineId(EntitySlime.class, DataWatcherRegistry.INT);
@@ -186,7 +194,7 @@
@@ -184,7 +192,7 @@
@Override
public EntityTypes<? extends EntitySlime> getType() {
@@ -24,7 +24,7 @@
}
@Override
@@ -200,6 +208,19 @@
@@ -198,6 +206,19 @@
int j = i / 2;
int k = 2 + this.random.nextInt(3);
@@ -44,7 +44,7 @@
for (int l = 0; l < k; ++l) {
float f1 = ((float) (l % 2) - 0.5F) * f;
float f2 = ((float) (l / 2) - 0.5F) * f;
@@ -214,8 +235,18 @@
@@ -212,8 +233,18 @@
entityslime.setInvulnerable(this.isInvulnerable());
entityslime.setSize(j, true);
entityslime.moveTo(this.getX() + (double) f1, this.getY() + 0.5D, this.getZ() + (double) f2, this.random.nextFloat() * 360.0F, 0.0F);

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntityStrider.java
+++ b/net/minecraft/world/entity/monster/EntityStrider.java
@@ -321,7 +321,13 @@
@@ -320,7 +320,13 @@
IBlockData iblockdata1 = this.getBlockStateOn();
boolean flag = iblockdata.is((Tag) TagsBlock.STRIDER_WARM_BLOCKS) || iblockdata1.is((Tag) TagsBlock.STRIDER_WARM_BLOCKS) || this.getFluidHeight(TagsFluid.LAVA) > 0.0D;
boolean flag = iblockdata.is(TagsBlock.STRIDER_WARM_BLOCKS) || iblockdata1.is(TagsBlock.STRIDER_WARM_BLOCKS) || this.getFluidHeight(TagsFluid.LAVA) > 0.0D;
- this.setSuffocating(!flag);
+ // CraftBukkit start

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntityZombieVillager.java
+++ b/net/minecraft/world/entity/monster/EntityZombieVillager.java
@@ -47,6 +47,13 @@
@@ -48,6 +48,13 @@
import net.minecraft.world.level.gameevent.GameEvent;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.server.MinecraftServer;
@@ -13,8 +13,8 @@
+
public class EntityZombieVillager extends EntityZombie implements VillagerDataHolder {
public static final DataWatcherObject<Boolean> DATA_CONVERTING_ID = DataWatcher.defineId(EntityZombieVillager.class, DataWatcherRegistry.BOOLEAN);
@@ -63,6 +70,7 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -65,6 +72,7 @@
@Nullable
private NBTTagCompound tradeOffers;
private int villagerXp;
@@ -22,7 +22,7 @@
public EntityZombieVillager(EntityTypes<? extends EntityZombieVillager> entitytypes, World world) {
super(entitytypes, world);
@@ -79,7 +87,7 @@
@@ -83,7 +91,7 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@@ -31,7 +31,7 @@
Logger logger = EntityZombieVillager.LOGGER;
Objects.requireNonNull(logger);
@@ -135,6 +143,10 @@
@@ -139,6 +147,10 @@
public void tick() {
if (!this.level.isClientSide && this.isAlive() && this.isConverting()) {
int i = this.getConversionProgress();
@@ -42,7 +42,7 @@
this.villagerConversionTime -= i;
if (this.villagerConversionTime <= 0) {
@@ -143,6 +155,7 @@
@@ -147,6 +159,7 @@
}
super.tick();
@@ -50,7 +50,7 @@
}
@Override
@@ -187,8 +200,11 @@
@@ -191,8 +204,11 @@
this.conversionStarter = uuid;
this.villagerConversionTime = i;
this.getEntityData().set(EntityZombieVillager.DATA_CONVERTING_ID, true);
@@ -64,7 +64,7 @@
this.level.broadcastEntityEvent(this, (byte) 16);
}
@@ -205,7 +221,13 @@
@@ -209,7 +225,13 @@
}
private void finishConversion(WorldServer worldserver) {
@@ -79,7 +79,7 @@
EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
int i = aenumitemslot.length;
@@ -220,7 +242,9 @@
@@ -224,7 +246,9 @@
double d0 = (double) this.getEquipmentDropChance(enumitemslot);
if (d0 > 1.0D) {
@@ -89,7 +89,7 @@
}
}
}
@@ -246,7 +270,7 @@
@@ -250,7 +274,7 @@
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/piglin/PiglinAI.java
+++ b/net/minecraft/world/entity/monster/piglin/PiglinAI.java
@@ -72,6 +72,13 @@
@@ -71,6 +71,13 @@
import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
import net.minecraft.world.phys.Vec3D;
@@ -14,7 +14,7 @@
public class PiglinAI {
public static final int REPELLENT_DETECTION_RANGE_HORIZONTAL = 8;
@@ -187,13 +194,13 @@
@@ -186,13 +193,13 @@
protected static void updateActivity(EntityPiglin entitypiglin) {
BehaviorController<EntityPiglin> behaviorcontroller = entitypiglin.getBrain();
@@ -31,7 +31,7 @@
Objects.requireNonNull(entitypiglin);
optional.ifPresent(entitypiglin::playSound);
@@ -225,23 +232,27 @@
@@ -224,23 +231,27 @@
stopWalking(entitypiglin);
ItemStack itemstack;
@@ -63,7 +63,7 @@
if (!flag) {
putInInventory(entitypiglin, itemstack);
@@ -277,9 +288,14 @@
@@ -276,9 +287,14 @@
boolean flag1;
if (entitypiglin.isAdult()) {
@@ -80,7 +80,7 @@
} else if (!flag1) {
boolean flag2 = entitypiglin.equipItemIfPossible(itemstack);
@@ -292,7 +308,7 @@
@@ -291,7 +307,7 @@
if (!flag1) {
ItemStack itemstack1 = entitypiglin.getMainHandItem();
@@ -89,7 +89,7 @@
putInInventory(entitypiglin, itemstack1);
} else {
throwItems(entitypiglin, Collections.singletonList(itemstack1));
@@ -369,7 +385,7 @@
@@ -368,7 +384,7 @@
return false;
} else if (isAdmiringDisabled(entitypiglin) && entitypiglin.getBrain().hasMemoryValue(MemoryModuleType.ATTACK_TARGET)) {
return false;
@@ -98,7 +98,7 @@
return isNotHoldingLovedItemInOffHand(entitypiglin);
} else {
boolean flag = entitypiglin.canAddToInventory(itemstack);
@@ -378,6 +394,12 @@
@@ -377,6 +393,12 @@
}
}
@@ -109,9 +109,9 @@
+ // CraftBukkit end
+
protected static boolean isLovedItem(ItemStack itemstack) {
return itemstack.is((Tag) TagsItem.PIGLIN_LOVED);
return itemstack.is(TagsItem.PIGLIN_LOVED);
}
@@ -473,7 +495,7 @@
@@ -472,7 +494,7 @@
}
protected static boolean canAdmire(EntityPiglin entitypiglin, ItemStack itemstack) {
@@ -120,7 +120,7 @@
}
protected static void wasHurtBy(EntityPiglin entitypiglin, EntityLiving entityliving) {
@@ -740,6 +762,12 @@
@@ -739,6 +761,12 @@
return entitypiglin.getBrain().hasMemoryValue(MemoryModuleType.ADMIRING_ITEM);
}
@@ -133,7 +133,7 @@
private static boolean isBarterCurrency(ItemStack itemstack) {
return itemstack.is(PiglinAI.BARTERING_ITEM);
}
@@ -777,7 +805,7 @@
@@ -776,7 +804,7 @@
}
private static boolean isNotHoldingLovedItemInOffHand(EntityPiglin entitypiglin) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/npc/EntityVillager.java
+++ b/net/minecraft/world/entity/npc/EntityVillager.java
@@ -89,6 +89,14 @@
@@ -90,6 +90,14 @@
import net.minecraft.world.phys.AxisAlignedBB;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
+// CraftBukkit start
+import org.bukkit.Bukkit;
@@ -14,8 +14,8 @@
+
public class EntityVillager extends EntityVillagerAbstract implements ReputationHandler, VillagerDataHolder {
private static final DataWatcherObject<VillagerData> DATA_VILLAGER_DATA = DataWatcher.defineId(EntityVillager.class, DataWatcherRegistry.VILLAGER_DATA);
@@ -146,7 +154,7 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -148,7 +156,7 @@
@Override
public BehaviorController<EntityVillager> getBrain() {
@@ -24,7 +24,7 @@
}
@Override
@@ -229,7 +237,7 @@
@@ -231,7 +239,7 @@
this.increaseProfessionLevelOnUpdate = false;
}
@@ -33,7 +33,7 @@
}
}
@@ -357,7 +365,13 @@
@@ -359,7 +367,13 @@
while (iterator.hasNext()) {
MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
@@ -48,7 +48,7 @@
}
this.lastRestockGameTime = this.level.getGameTime();
@@ -415,7 +429,13 @@
@@ -417,7 +431,13 @@
while (iterator.hasNext()) {
MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
@@ -63,7 +63,7 @@
}
}
@@ -474,7 +494,7 @@
@@ -476,7 +496,7 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@@ -72,7 +72,7 @@
Logger logger = EntityVillager.LOGGER;
Objects.requireNonNull(logger);
@@ -816,7 +836,12 @@
@@ -818,7 +838,12 @@
}
entitywitch.setPersistenceRequired();
@@ -86,7 +86,7 @@
this.releaseAllPois();
this.discard();
} else {
@@ -837,6 +862,13 @@
@@ -839,6 +864,13 @@
return;
}
@@ -100,7 +100,7 @@
this.onItemPickup(entityitem);
this.take(entityitem, itemstack.getCount());
ItemStack itemstack1 = inventorysubcontainer.addItem(itemstack);
@@ -949,7 +981,7 @@
@@ -951,7 +983,7 @@
if (entityirongolem != null) {
if (entityirongolem.checkSpawnRules(worldserver, EnumMobSpawn.MOB_SUMMONED) && entityirongolem.checkSpawnObstruction(worldserver)) {
@@ -109,7 +109,7 @@
return entityirongolem;
}
@@ -1027,7 +1059,7 @@
@@ -1029,7 +1061,7 @@
@Override
public void startSleeping(BlockPosition blockposition) {
super.startSleeping(blockposition);
@@ -118,7 +118,7 @@
this.brain.eraseMemory(MemoryModuleType.WALK_TARGET);
this.brain.eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
}
@@ -1035,7 +1067,7 @@
@@ -1037,7 +1069,7 @@
@Override
public void stopSleeping() {
super.stopSleeping();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/npc/EntityVillagerTrader.java
+++ b/net/minecraft/world/entity/npc/EntityVillagerTrader.java
@@ -45,6 +45,13 @@
@@ -44,6 +44,13 @@
import net.minecraft.world.level.World;
import net.minecraft.world.phys.Vec3D;
@@ -14,7 +14,7 @@
public class EntityVillagerTrader extends EntityVillagerAbstract {
private static final int NUMBER_OF_TRADE_OFFERS = 5;
@@ -54,6 +61,7 @@
@@ -53,6 +60,7 @@
public EntityVillagerTrader(EntityTypes<? extends EntityVillagerTrader> entitytypes, World world) {
super(entitytypes, world);
@@ -22,7 +22,7 @@
}
@Override
@@ -131,7 +139,16 @@
@@ -130,7 +138,16 @@
MerchantRecipe merchantrecipe = villagertrades_imerchantrecipeoption.getOffer(this, this.random);
if (merchantrecipe != null) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/player/EntityHuman.java
+++ b/net/minecraft/world/entity/player/EntityHuman.java
@@ -111,6 +111,19 @@
@@ -112,6 +112,19 @@
import net.minecraft.world.scores.ScoreboardTeam;
import net.minecraft.world.scores.ScoreboardTeamBase;
@@ -20,7 +20,7 @@
public abstract class EntityHuman extends EntityLiving {
public static final String UUID_PREFIX_OFFLINE_PLAYER = "OfflinePlayer:";
@@ -124,7 +137,8 @@
@@ -125,7 +138,8 @@
public static final float SWIMMING_BB_HEIGHT = 0.6F;
public static final float DEFAULT_EYE_HEIGHT = 1.62F;
public static final EntitySize STANDING_DIMENSIONS = EntitySize.scalable(0.6F, 1.8F);
@@ -30,7 +30,7 @@
private static final int FLY_ACHIEVEMENT_SPEED = 25;
private static final DataWatcherObject<Float> DATA_PLAYER_ABSORPTION_ID = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.FLOAT);
private static final DataWatcherObject<Integer> DATA_SCORE_ID = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.INT);
@@ -134,10 +148,10 @@
@@ -135,10 +149,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);
@@ -43,7 +43,7 @@
protected int jumpTriggerTime;
public float oBob;
public float bob;
@@ -164,6 +178,16 @@
@@ -165,6 +179,16 @@
@Nullable
public EntityFishingHook fishing;
@@ -60,7 +60,7 @@
public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile) {
super(EntityTypes.PLAYER, world);
this.lastItemInMainHand = ItemStack.EMPTY;
@@ -302,7 +326,7 @@
@@ -303,7 +327,7 @@
ItemStack itemstack = this.getItemBySlot(EnumItemSlot.HEAD);
if (itemstack.is(Items.TURTLE_HELMET) && !this.isEyeInFluid(TagsFluid.WATER)) {
@@ -69,7 +69,7 @@
}
}
@@ -494,7 +518,8 @@
@@ -495,7 +519,8 @@
if (this.level.getDifficulty() == EnumDifficulty.PEACEFUL && this.level.getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION)) {
if (this.getHealth() < this.getMaxHealth() && this.tickCount % 20 == 0) {
@@ -79,7 +79,7 @@
}
if (this.foodData.needsFood() && this.tickCount % 10 == 0) {
@@ -682,6 +707,30 @@
@@ -692,6 +717,30 @@
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);
}
@@ -110,12 +110,14 @@
return entityitem;
}
}
@@ -814,10 +863,10 @@
if (this.isDeadOrDying()) {
@@ -825,12 +874,12 @@
return false;
} else {
- this.removeEntitiesOnShoulder();
+ // this.releaseShoulderEntities(); // CraftBukkit - moved down
if (!this.level.isClientSide) {
- this.removeEntitiesOnShoulder();
+ // this.removeEntitiesOnShoulder(); // CraftBukkit - moved down
}
if (damagesource.scalesWithDifficulty()) {
if (this.level.getDifficulty() == EnumDifficulty.PEACEFUL) {
- f = 0.0F;
@@ -123,7 +125,7 @@
}
if (this.level.getDifficulty() == EnumDifficulty.EASY) {
@@ -829,7 +878,13 @@
@@ -842,7 +891,13 @@
}
}
@@ -138,7 +140,7 @@
}
}
}
@@ -849,10 +904,29 @@
@@ -862,10 +917,29 @@
}
public boolean canHarmPlayer(EntityHuman entityhuman) {
@@ -171,7 +173,7 @@
}
@Override
@@ -894,8 +968,13 @@
@@ -907,8 +981,13 @@
}
}
@@ -186,7 +188,7 @@
if (!this.isInvulnerableTo(damagesource)) {
f = this.getDamageAfterArmorAbsorb(damagesource, f);
f = this.getDamageAfterMagicAbsorb(damagesource, f);
@@ -910,7 +989,7 @@
@@ -923,7 +1002,7 @@
}
if (f != 0.0F) {
@@ -195,7 +197,7 @@
float f3 = this.getHealth();
this.setHealth(this.getHealth() - f);
@@ -921,6 +1000,7 @@
@@ -934,6 +1013,7 @@
}
}
@@ -203,7 +205,7 @@
}
@Override
@@ -1080,7 +1160,7 @@
@@ -1093,7 +1173,7 @@
f *= 0.2F + f2 * f2 * 0.8F;
f1 *= f2;
@@ -212,7 +214,7 @@
if (f > 0.0F || f1 > 0.0F) {
boolean flag = f2 > 0.9F;
boolean flag1 = false;
@@ -1119,8 +1199,15 @@
@@ -1132,8 +1212,15 @@
if (entity instanceof EntityLiving) {
f3 = ((EntityLiving) entity).getHealth();
if (j > 0 && !entity.isOnFire()) {
@@ -230,7 +232,7 @@
}
}
@@ -1148,8 +1235,11 @@
@@ -1161,8 +1248,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) {
@@ -243,7 +245,7 @@
}
}
@@ -1158,9 +1248,26 @@
@@ -1171,9 +1261,26 @@
}
if (entity instanceof EntityPlayer && entity.hurtMarked) {
@@ -270,7 +272,7 @@
}
if (flag2) {
@@ -1205,7 +1312,14 @@
@@ -1218,7 +1325,14 @@
this.awardStat(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F));
if (j > 0) {
@@ -286,7 +288,7 @@
}
if (this.level instanceof WorldServer && f5 > 2.0F) {
@@ -1215,12 +1329,17 @@
@@ -1228,12 +1342,17 @@
}
}
@@ -305,7 +307,7 @@
}
}
@@ -1293,6 +1412,12 @@
@@ -1306,6 +1425,12 @@
public void updateTutorialInventoryAction(ItemStack itemstack, ItemStack itemstack1, ClickAction clickaction) {}
public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition) {
@@ -318,7 +320,7 @@
this.startSleeping(blockposition);
this.sleepCounter = 0;
return Either.right(Unit.INSTANCE);
@@ -1377,9 +1502,9 @@
@@ -1390,9 +1515,9 @@
super.jumpFromGround();
this.awardStat(StatisticList.JUMP);
if (this.isSprinting()) {
@@ -330,7 +332,7 @@
}
}
@@ -1413,7 +1538,11 @@
@@ -1426,7 +1551,11 @@
this.setDeltaMovement(vec3d2.x, d3 * 0.6D, vec3d2.z);
this.flyingSpeed = f;
this.resetFallDistance();
@@ -343,7 +345,7 @@
} else {
super.travel(vec3d);
}
@@ -1448,19 +1577,19 @@
@@ -1461,19 +1590,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);
@@ -366,7 +368,7 @@
}
} else if (this.onClimbable()) {
if (d1 > 0.0D) {
@@ -1471,13 +1600,13 @@
@@ -1484,13 +1613,13 @@
if (i > 0) {
if (this.isSprinting()) {
this.awardStat(StatisticList.SPRINT_ONE_CM, i);
@@ -383,7 +385,7 @@
}
}
} else if (this.isFallFlying()) {
@@ -1543,12 +1672,24 @@
@@ -1556,12 +1685,24 @@
}
public void startFallFlying() {
@@ -409,7 +411,7 @@
}
@Override
@@ -1638,10 +1779,21 @@
@@ -1651,10 +1792,21 @@
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
}
@@ -432,7 +434,7 @@
}
}
@@ -1718,15 +1870,22 @@
@@ -1731,15 +1883,22 @@
@Override
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
@@ -458,7 +460,7 @@
this.inventory.armor.set(enumitemslot.getIndex(), itemstack);
}
@@ -1767,26 +1926,31 @@
@@ -1780,26 +1939,31 @@
protected void removeEntitiesOnShoulder() {
if (this.timeEntitySatOnShoulder + 20L < this.level.getGameTime()) {

View File

@@ -44,15 +44,15 @@
}
this.checkInsideBlocks();
@@ -159,6 +175,11 @@
Entity entity = damagesource.getEntity();
@@ -160,6 +176,11 @@
if (entity != null) {
+ // CraftBukkit start
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false)) {
+ return false;
+ }
+ // CraftBukkit end
Vec3D vec3d = entity.getLookAngle();
if (!this.level.isClientSide) {
+ // CraftBukkit start
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false)) {
+ return false;
+ }
+ // CraftBukkit end
Vec3D vec3d = entity.getLookAngle();
this.setDeltaMovement(vec3d);
this.setDeltaMovement(vec3d);

View File

@@ -9,7 +9,7 @@
public class EntityFireworks extends IProjectile implements ItemSupplier {
public static final DataWatcherObject<ItemStack> DATA_ID_FIREWORKS_ITEM = DataWatcher.defineId(EntityFireworks.class, DataWatcherRegistry.ITEM_STACK);
@@ -141,7 +143,7 @@
@@ -144,7 +146,7 @@
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);
if (!this.noPhysics) {
@@ -18,7 +18,7 @@
this.hasImpulse = true;
}
@@ -156,7 +158,11 @@
@@ -159,7 +161,11 @@
}
if (!this.level.isClientSide && this.life > this.lifetime) {
@@ -31,7 +31,7 @@
}
}
@@ -172,7 +178,11 @@
@@ -175,7 +181,11 @@
protected void onHitEntity(MovingObjectPositionEntity movingobjectpositionentity) {
super.onHitEntity(movingobjectpositionentity);
if (!this.level.isClientSide) {
@@ -44,7 +44,7 @@
}
}
@@ -182,7 +192,11 @@
@@ -185,7 +195,11 @@
this.level.getBlockState(blockposition).entityInside(this.level, blockposition, this);
if (!this.level.isClientSide() && this.hasExplosion()) {
@@ -57,7 +57,7 @@
}
super.onHitBlock(movingobjectpositionblock);
@@ -208,7 +222,9 @@
@@ -211,7 +225,9 @@
if (f > 0.0F) {
if (this.attachedToEntity != null) {
@@ -67,7 +67,7 @@
}
double d0 = 5.0D;
@@ -235,7 +251,9 @@
@@ -238,7 +254,9 @@
if (flag) {
float f1 = f * (float) Math.sqrt((5.0D - (double) this.distanceTo(entityliving)) / 5.0D);

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/projectile/EntityFishingHook.java
+++ b/net/minecraft/world/entity/projectile/EntityFishingHook.java
@@ -44,6 +44,12 @@
import net.minecraft.world.phys.MovingObjectPositionEntity;
@@ -45,6 +45,12 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
+// CraftBukkit start
+import org.bukkit.entity.Player;
@@ -12,8 +12,8 @@
+
public class EntityFishingHook extends IProjectile {
private final Random syncronizedRandom;
@@ -64,6 +70,12 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -66,6 +72,12 @@
private final int luck;
private final int lureSpeed;
@@ -26,7 +26,7 @@
private EntityFishingHook(EntityTypes<? extends EntityFishingHook> entitytypes, World world, int i, int j) {
super(entitytypes, world);
this.syncronizedRandom = new Random();
@@ -258,7 +270,7 @@
@@ -260,7 +272,7 @@
private void checkCollision() {
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);
@@ -35,7 +35,7 @@
}
@Override
@@ -305,6 +317,10 @@
@@ -307,6 +319,10 @@
this.timeUntilLured = 0;
this.timeUntilHooked = 0;
this.getEntityData().set(EntityFishingHook.DATA_BITING, false);
@@ -46,7 +46,7 @@
}
} else {
float f;
@@ -338,6 +354,13 @@
@@ -340,6 +356,13 @@
worldserver.sendParticles(Particles.FISHING, d0, d1, d2, 0, (double) (-f4), 0.01D, (double) f3, 1.0D);
}
} else {
@@ -60,7 +60,7 @@
this.playSound(SoundEffects.FISHING_BOBBER_SPLASH, 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
double d3 = this.getY() + 0.5D;
@@ -374,8 +397,10 @@
@@ -376,8 +399,10 @@
this.timeUntilHooked = MathHelper.nextInt(this.random, 20, 80);
}
} else {
@@ -73,7 +73,7 @@
}
}
@@ -442,6 +467,14 @@
@@ -444,6 +469,14 @@
int i = 0;
if (this.hookedIn != null) {
@@ -88,7 +88,7 @@
this.pullEntity(this.hookedIn);
CriterionTriggers.FISHING_ROD_HOOKED.trigger((EntityPlayer) entityhuman, itemstack, this, Collections.emptyList());
this.level.broadcastEntityEvent(this, (byte) 31);
@@ -457,6 +490,15 @@
@@ -459,6 +492,15 @@
while (iterator.hasNext()) {
ItemStack itemstack1 = (ItemStack) iterator.next();
EntityItem entityitem = new EntityItem(this.level, this.getX(), this.getY(), this.getZ(), itemstack1);
@@ -104,7 +104,7 @@
double d0 = entityhuman.getX() - this.getX();
double d1 = entityhuman.getY() - this.getY();
double d2 = entityhuman.getZ() - this.getZ();
@@ -464,7 +506,11 @@
@@ -466,7 +508,11 @@
entityitem.setDeltaMovement(d0 * 0.1D, d1 * 0.1D + Math.sqrt(Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2)) * 0.08D, d2 * 0.1D);
this.level.addFreshEntity(entityitem);
@@ -114,10 +114,10 @@
+ entityhuman.level.addFreshEntity(new EntityExperienceOrb(entityhuman.level, entityhuman.getX(), entityhuman.getY() + 0.5D, entityhuman.getZ() + 0.5D, playerFishEvent.getExpToDrop()));
+ }
+ // CraftBukkit end
if (itemstack1.is((Tag) TagsItem.FISHES)) {
if (itemstack1.is(TagsItem.FISHES)) {
entityhuman.awardStat(StatisticList.FISH_CAUGHT, 1);
}
@@ -474,8 +520,25 @@
@@ -476,8 +522,25 @@
}
if (this.onGround) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityPotion.java
+++ b/net/minecraft/world/entity/projectile/EntityPotion.java
@@ -33,6 +33,16 @@
@@ -32,6 +32,16 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import net.minecraft.world.phys.MovingObjectPositionEntity;
@@ -17,7 +17,7 @@
public class EntityPotion extends EntityProjectileThrowable implements ItemSupplier {
public static final double SPLASH_RANGE = 4.0D;
@@ -99,7 +109,7 @@
@@ -98,7 +108,7 @@
if (flag) {
this.applyWater();
@@ -26,7 +26,7 @@
if (this.isLingering()) {
this.makeAreaOfEffectCloud(itemstack, potionregistry);
} else {
@@ -145,6 +155,7 @@
@@ -144,6 +154,7 @@
private void applySplash(List<MobEffect> list, @Nullable Entity entity) {
AxisAlignedBB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D);
List<EntityLiving> list1 = this.level.getEntitiesOfClass(EntityLiving.class, axisalignedbb);
@@ -34,7 +34,7 @@
if (!list1.isEmpty()) {
Entity entity1 = this.getEffectSource();
@@ -163,21 +174,47 @@
@@ -162,21 +173,47 @@
d1 = 1.0D;
}
@@ -96,7 +96,7 @@
}
}
}
@@ -213,7 +250,14 @@
@@ -212,7 +249,14 @@
entityareaeffectcloud.setFixedColor(nbttagcompound.getInt("CustomPotionColor"));
}
@@ -112,10 +112,10 @@
}
public boolean isLingering() {
@@ -224,13 +268,25 @@
@@ -223,13 +267,25 @@
IBlockData iblockdata = this.level.getBlockState(blockposition);
if (iblockdata.is((Tag) TagsBlock.FIRE)) {
if (iblockdata.is(TagsBlock.FIRE)) {
- this.level.removeBlock(blockposition, false);
+ // CraftBukkit start
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityShulkerBullet.java
+++ b/net/minecraft/world/entity/projectile/EntityShulkerBullet.java
@@ -60,8 +60,21 @@
@@ -59,8 +59,21 @@
this.finalTarget = entity;
this.currentMoveDirection = EnumDirection.UP;
this.selectNextMoveDirection(enumdirection_enumaxis);
@@ -22,7 +22,7 @@
@Override
public SoundCategory getSoundSource() {
return SoundCategory.HOSTILE;
@@ -225,7 +238,7 @@
@@ -224,7 +237,7 @@
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
@@ -31,7 +31,7 @@
}
}
@@ -292,7 +305,7 @@
@@ -291,7 +304,7 @@
if (flag) {
this.doEnchantDamageEffects(entityliving, entity);
if (entity instanceof EntityLiving) {
@@ -40,7 +40,7 @@
}
}
@@ -318,6 +331,11 @@
@@ -317,6 +330,11 @@
@Override
public boolean hurt(DamageSource damagesource, float f) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/raid/EntityRaider.java
+++ b/net/minecraft/world/entity/raid/EntityRaider.java
@@ -166,7 +166,7 @@
@@ -165,7 +165,7 @@
MobEffect mobeffect1 = new MobEffect(MobEffects.BAD_OMEN, 120000, i, false, false, true);
if (!this.level.getGameRules().getBoolean(GameRules.RULE_DISABLE_RAIDS)) {
@@ -9,7 +9,7 @@
}
}
}
@@ -306,7 +306,7 @@
@@ -305,7 +305,7 @@
private final T mob;
@@ -18,7 +18,7 @@
this.mob = entityraider;
this.setFlags(EnumSet.of(PathfinderGoal.Type.MOVE));
}
@@ -522,7 +522,7 @@
@@ -521,7 +521,7 @@
while (iterator.hasNext()) {
EntityRaider entityraider = (EntityRaider) iterator.next();
@@ -27,7 +27,7 @@
}
}
@@ -539,7 +539,7 @@
@@ -538,7 +538,7 @@
while (iterator.hasNext()) {
EntityRaider entityraider = (EntityRaider) iterator.next();

View File

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

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/vehicle/EntityBoat.java
+++ b/net/minecraft/world/entity/vehicle/EntityBoat.java
@@ -52,6 +52,15 @@
@@ -51,6 +51,15 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -16,7 +16,7 @@
public class EntityBoat extends Entity {
private static final DataWatcherObject<Integer> DATA_ID_HURT = DataWatcher.defineId(EntityBoat.class, DataWatcherRegistry.INT);
@@ -92,6 +101,14 @@
@@ -91,6 +100,14 @@
private float bubbleAngle;
private float bubbleAngleO;
@@ -31,7 +31,7 @@
public EntityBoat(EntityTypes<? extends EntityBoat> entitytypes, World world) {
super(entitytypes, world);
this.paddlePositions = new float[2];
@@ -161,6 +178,19 @@
@@ -160,6 +177,19 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else if (!this.level.isClientSide && !this.isRemoved()) {
@@ -51,7 +51,7 @@
this.setHurtDir(-this.getHurtDir());
this.setHurtTime(10);
this.setDamage(this.getDamage() + f * 10.0F);
@@ -169,6 +199,15 @@
@@ -168,6 +198,15 @@
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).getAbilities().instabuild;
if (flag || this.getDamage() > 40.0F) {
@@ -67,7 +67,7 @@
if (!flag && this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
this.spawnAtLocation((IMaterial) this.getDropItem());
}
@@ -204,9 +243,29 @@
@@ -203,9 +242,29 @@
public void push(Entity entity) {
if (entity instanceof EntityBoat) {
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
@@ -97,7 +97,7 @@
super.push(entity);
}
@@ -257,6 +316,7 @@
@@ -256,6 +315,7 @@
return this.getDirection().getClockWise();
}
@@ -105,7 +105,7 @@
@Override
public void tick() {
this.oldStatus = this.status;
@@ -297,6 +357,22 @@
@@ -296,6 +356,22 @@
this.setDeltaMovement(Vec3D.ZERO);
}
@@ -128,7 +128,7 @@
this.tickBubbleColumn();
for (int i = 0; i <= 1; ++i) {
@@ -801,6 +877,11 @@
@@ -800,6 +876,11 @@
this.causeFallDamage(this.fallDistance, 1.0F, DamageSource.FALL);
if (!this.level.isClientSide && !this.isRemoved()) {
@@ -140,7 +140,7 @@
this.kill();
if (this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
int i;
@@ -814,6 +895,7 @@
@@ -813,6 +894,7 @@
}
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
+++ b/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
@@ -49,6 +49,15 @@
@@ -48,6 +48,15 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
@@ -16,7 +16,7 @@
public abstract class EntityMinecartAbstract extends Entity {
private static final DataWatcherObject<Integer> DATA_ID_HURT = DataWatcher.defineId(EntityMinecartAbstract.class, DataWatcherRegistry.INT);
@@ -91,6 +100,17 @@
@@ -90,6 +99,17 @@
private double lyd;
private double lzd;
@@ -34,7 +34,7 @@
protected EntityMinecartAbstract(EntityTypes<?> entitytypes, World world) {
super(entitytypes, world);
this.blocksBuilding = true;
@@ -217,6 +237,19 @@
@@ -216,6 +236,19 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {
@@ -54,7 +54,7 @@
this.setHurtDir(-this.getHurtDir());
this.setHurtTime(10);
this.markHurt();
@@ -225,6 +258,15 @@
@@ -224,6 +257,15 @@
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).getAbilities().instabuild;
if (flag || this.getDamage() > 40.0F) {
@@ -70,7 +70,7 @@
this.ejectPassengers();
if (flag && !this.hasCustomName()) {
this.discard();
@@ -284,6 +326,14 @@
@@ -283,6 +325,14 @@
@Override
public void tick() {
@@ -85,7 +85,7 @@
if (this.getHurtTime() > 0) {
this.setHurtTime(this.getHurtTime() - 1);
}
@@ -293,7 +343,7 @@
@@ -292,7 +342,7 @@
}
this.checkOutOfWorld();
@@ -94,7 +94,7 @@
double d0;
if (this.level.isClientSide) {
@@ -359,6 +409,18 @@
@@ -358,6 +408,18 @@
}
this.setRot(this.getYRot(), this.getXRot());
@@ -113,7 +113,7 @@
if (this.getMinecartType() == EntityMinecartAbstract.EnumMinecartType.RIDEABLE && this.getDeltaMovement().horizontalDistanceSqr() > 0.01D) {
List<Entity> list = this.level.getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D), IEntitySelector.pushableBy(this));
@@ -367,8 +429,26 @@
@@ -366,8 +428,26 @@
Entity entity = (Entity) list.get(l);
if (!(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && !(entity instanceof EntityMinecartAbstract) && !this.isVehicle() && !entity.isPassenger()) {
@@ -140,7 +140,7 @@
entity.push(this);
}
}
@@ -380,6 +460,14 @@
@@ -379,6 +459,14 @@
Entity entity1 = (Entity) iterator.next();
if (!this.hasPassenger(entity1) && entity1.isPushable() && entity1 instanceof EntityMinecartAbstract) {
@@ -155,7 +155,7 @@
entity1.push(this);
}
}
@@ -396,7 +484,7 @@
@@ -395,7 +483,7 @@
}
protected double getMaxSpeed() {
@@ -164,7 +164,7 @@
}
public void activateMinecart(int i, int j, int k, boolean flag) {}
@@ -407,12 +495,16 @@
@@ -406,12 +494,16 @@
this.setDeltaMovement(MathHelper.clamp(vec3d.x, -d0, d0), vec3d.y, MathHelper.clamp(vec3d.z, -d0, d0));
if (this.onGround) {
@@ -183,7 +183,7 @@
}
}
@@ -603,7 +695,7 @@
@@ -602,7 +694,7 @@
}
protected void applyNaturalSlowdown() {
@@ -192,7 +192,7 @@
Vec3D vec3d = this.getDeltaMovement();
vec3d = vec3d.multiply(d0, 0.0D, d0);
@@ -742,6 +834,14 @@
@@ -741,6 +833,14 @@
if (!this.level.isClientSide) {
if (!entity.noPhysics && !this.noPhysics) {
if (!this.hasPassenger(entity)) {
@@ -207,7 +207,7 @@
double d0 = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ();
double d2 = d0 * d0 + d1 * d1;
@@ -921,4 +1021,26 @@
@@ -920,4 +1020,26 @@
private EnumMinecartType() {}
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/inventory/Container.java
+++ b/net/minecraft/world/inventory/Container.java
@@ -30,6 +30,20 @@
import net.minecraft.world.level.block.Block;
@@ -32,6 +32,20 @@
import net.minecraft.world.level.block.entity.TileEntity;
import org.slf4j.Logger;
+// CraftBukkit start
+import com.google.common.base.Preconditions;
@@ -20,8 +20,8 @@
+
public abstract class Container {
public static final int SLOT_CLICKED_OUTSIDE = -999;
@@ -59,6 +73,27 @@
private static Logger LOGGER = LogUtils.getLogger();
@@ -62,6 +76,27 @@
private ContainerSynchronizer synchronizer;
private boolean suppressRemoteUpdates;
@@ -49,7 +49,7 @@
protected Container(@Nullable Containers<?> containers, int i) {
this.carried = ItemStack.EMPTY;
this.remoteSlots = NonNullList.create();
@@ -156,6 +191,15 @@
@@ -163,6 +198,15 @@
}
@@ -65,7 +65,7 @@
public void removeSlotListener(ICrafting icrafting) {
this.containerListeners.remove(icrafting);
}
@@ -370,7 +414,7 @@
@@ -381,7 +425,7 @@
}
} else if (this.quickcraftStatus == 2) {
if (!this.quickcraftSlots.isEmpty()) {
@@ -74,7 +74,7 @@
k = ((Slot) this.quickcraftSlots.iterator().next()).index;
this.resetQuickCraft();
this.doClick(k, this.quickcraftType, InventoryClickType.PICKUP, entityhuman);
@@ -381,6 +425,7 @@
@@ -392,6 +436,7 @@
l = this.getCarried().getCount();
Iterator iterator = this.quickcraftSlots.iterator();
@@ -82,7 +82,7 @@
while (iterator.hasNext()) {
Slot slot1 = (Slot) iterator.next();
ItemStack itemstack2 = this.getCarried();
@@ -397,12 +442,48 @@
@@ -408,12 +453,48 @@
}
l -= itemstack3.getCount() - j1;
@@ -134,7 +134,7 @@
}
this.resetQuickCraft();
@@ -420,8 +501,11 @@
@@ -431,8 +512,11 @@
if (i == -999) {
if (!this.getCarried().isEmpty()) {
if (clickaction == ClickAction.PRIMARY) {
@@ -147,7 +147,7 @@
} else {
entityhuman.drop(this.getCarried().split(1), true);
}
@@ -484,6 +568,15 @@
@@ -495,6 +579,15 @@
}
slot.setChanged();
@@ -163,7 +163,7 @@
}
} else {
Slot slot2;
@@ -591,13 +684,14 @@
@@ -602,13 +695,14 @@
ItemStack itemstack = this.getCarried();
if (!itemstack.isEmpty()) {
@@ -179,7 +179,7 @@
}
}
@@ -811,6 +905,11 @@
@@ -822,6 +916,11 @@
}
public ItemStack getCarried() {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/inventory/ContainerAnvil.java
+++ b/net/minecraft/world/inventory/ContainerAnvil.java
@@ -18,12 +18,16 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -17,12 +17,16 @@
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
@@ -10,7 +10,7 @@
+
public class ContainerAnvil extends ContainerAnvilAbstract {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
private static final boolean DEBUG_COST = false;
public static final int MAX_NAME_LENGTH = 50;
- private int repairItemCountCost;
@@ -18,7 +18,7 @@
public String itemName;
public final ContainerProperty cost;
private static final int COST_FAIL = 0;
@@ -33,6 +37,10 @@
@@ -32,6 +36,10 @@
private static final int COST_REPAIR_SACRIFICE = 2;
private static final int COST_INCOMPATIBLE_PENALTY = 1;
private static final int COST_RENAME = 1;
@@ -29,7 +29,7 @@
public ContainerAnvil(int i, PlayerInventory playerinventory) {
this(i, playerinventory, ContainerAccess.NULL);
@@ -105,7 +113,7 @@
@@ -104,7 +112,7 @@
byte b1 = 0;
if (itemstack.isEmpty()) {
@@ -38,7 +38,7 @@
this.cost.set(0);
} else {
ItemStack itemstack1 = itemstack.copy();
@@ -123,7 +131,7 @@
@@ -122,7 +130,7 @@
if (itemstack1.isDamageableItem() && itemstack1.getItem().isValidRepairItem(itemstack, itemstack2)) {
k = Math.min(itemstack1.getDamageValue(), itemstack1.getMaxDamage() / 4);
if (k <= 0) {
@@ -47,7 +47,7 @@
this.cost.set(0);
return;
}
@@ -138,7 +146,7 @@
@@ -137,7 +145,7 @@
this.repairItemCountCost = i1;
} else {
if (!flag && (!itemstack1.is(itemstack2.getItem()) || !itemstack1.isDamageableItem())) {
@@ -56,7 +56,7 @@
this.cost.set(0);
return;
}
@@ -228,7 +236,7 @@
@@ -227,7 +235,7 @@
}
if (flag2 && !flag1) {
@@ -65,7 +65,7 @@
this.cost.set(0);
return;
}
@@ -252,11 +260,11 @@
@@ -251,11 +259,11 @@
itemstack1 = ItemStack.EMPTY;
}
@@ -80,7 +80,7 @@
itemstack1 = ItemStack.EMPTY;
}
@@ -275,7 +283,8 @@
@@ -274,7 +282,8 @@
EnchantmentManager.setEnchantments(map, itemstack1);
}
@@ -90,7 +90,7 @@
this.broadcastChanges();
}
}
@@ -302,4 +311,18 @@
@@ -301,4 +310,18 @@
public int getCost() {
return this.cost.get();
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerBeacon.java
+++ b/net/minecraft/world/inventory/ContainerBeacon.java
@@ -11,6 +11,11 @@
@@ -10,6 +10,11 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.Blocks;
@@ -12,7 +12,7 @@
public class ContainerBeacon extends Container {
private static final int PAYMENT_SLOT = 0;
@@ -24,6 +29,10 @@
@@ -23,6 +28,10 @@
private final ContainerBeacon.SlotBeacon paymentSlot;
private final ContainerAccess access;
private final IContainerProperties beaconData;
@@ -23,7 +23,7 @@
public ContainerBeacon(int i, IInventory iinventory) {
this(i, iinventory, new ContainerProperties(3), ContainerAccess.NULL);
@@ -31,6 +40,7 @@
@@ -30,6 +39,7 @@
public ContainerBeacon(int i, IInventory iinventory, IContainerProperties icontainerproperties, ContainerAccess containeraccess) {
super(Containers.BEACON, i);
@@ -31,7 +31,7 @@
this.beacon = new InventorySubcontainer(1) {
@Override
public boolean canPlaceItem(int j, ItemStack itemstack) {
@@ -80,6 +90,7 @@
@@ -79,6 +89,7 @@
@Override
public boolean stillValid(EntityHuman entityhuman) {
@@ -39,7 +39,7 @@
return stillValid(this.access, entityhuman, Blocks.BEACON);
}
@@ -180,4 +191,17 @@
@@ -179,4 +190,17 @@
return 1;
}
}

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/inventory/ContainerEnchantTable.java
+++ b/net/minecraft/world/inventory/ContainerEnchantTable.java
@@ -20,6 +20,21 @@
import net.minecraft.world.item.enchantment.WeightedRandomEnchant;
@@ -25,6 +25,21 @@
import net.minecraft.world.level.block.BlockEnchantmentTable;
import net.minecraft.world.level.block.Blocks;
+// CraftBukkit start
@@ -22,7 +22,7 @@
public class ContainerEnchantTable extends Container {
private final IInventory enchantSlots;
@@ -29,6 +44,10 @@
@@ -34,6 +49,10 @@
public final int[] costs;
public final int[] enchantClue;
public final int[] levelClue;
@@ -33,7 +33,7 @@
public ContainerEnchantTable(int i, PlayerInventory playerinventory) {
this(i, playerinventory, ContainerAccess.NULL);
@@ -42,6 +61,13 @@
@@ -47,6 +66,13 @@
super.setChanged();
ContainerEnchantTable.this.slotsChanged(this);
}
@@ -47,7 +47,7 @@
};
this.random = new Random();
this.enchantmentSeed = ContainerProperty.standalone();
@@ -89,6 +115,9 @@
@@ -94,6 +120,9 @@
this.addDataSlot(ContainerProperty.shared(this.levelClue, 0));
this.addDataSlot(ContainerProperty.shared(this.levelClue, 1));
this.addDataSlot(ContainerProperty.shared(this.levelClue, 2));
@@ -57,7 +57,7 @@
}
@Override
@@ -96,7 +125,7 @@
@@ -101,7 +130,7 @@
if (iinventory == this.enchantSlots) {
ItemStack itemstack = iinventory.getItem(0);
@@ -65,8 +65,8 @@
+ if (!itemstack.isEmpty()) { // CraftBukkit - relax condition
this.access.execute((world, blockposition) -> {
int i = 0;
@@ -158,6 +187,41 @@
Iterator iterator = BlockEnchantmentTable.BOOKSHELF_OFFSETS.iterator();
@@ -140,6 +169,41 @@
}
}
@@ -108,70 +108,71 @@
this.broadcastChanges();
});
} else {
@@ -184,9 +248,24 @@
ItemStack itemstack2 = itemstack;
List<WeightedRandomEnchant> list = this.getEnchantmentList(itemstack, i, this.costs[i]);
@@ -167,9 +231,24 @@
ItemStack itemstack2 = itemstack;
List<WeightedRandomEnchant> list = this.getEnchantmentList(itemstack, i, this.costs[i]);
- if (!list.isEmpty()) {
- entityhuman.onEnchantmentPerformed(itemstack, j);
+ // CraftBukkit start
+ if (true || !list.isEmpty()) {
+ // entityhuman.onEnchantmentPerformed(itemstack, j); // Moved down
boolean flag = itemstack.is(Items.BOOK);
+ Map<org.bukkit.enchantments.Enchantment, Integer> enchants = new java.util.HashMap<org.bukkit.enchantments.Enchantment, Integer>();
+ for (Object obj : list) {
+ WeightedRandomEnchant instance = (WeightedRandomEnchant) obj;
+ enchants.put(org.bukkit.enchantments.Enchantment.getByKey(CraftNamespacedKey.fromMinecraft(IRegistry.ENCHANTMENT.getKey(instance.enchantment))), instance.level);
+ }
+ CraftItemStack item = CraftItemStack.asCraftMirror(itemstack2);
- if (!list.isEmpty()) {
- entityhuman.onEnchantmentPerformed(itemstack, j);
+ // CraftBukkit start
+ if (true || !list.isEmpty()) {
+ // entityhuman.onEnchantmentPerformed(itemstack, j); // Moved down
boolean flag = itemstack.is(Items.BOOK);
+ Map<org.bukkit.enchantments.Enchantment, Integer> enchants = new java.util.HashMap<org.bukkit.enchantments.Enchantment, Integer>();
+ for (Object obj : list) {
+ WeightedRandomEnchant instance = (WeightedRandomEnchant) obj;
+ enchants.put(org.bukkit.enchantments.Enchantment.getByKey(CraftNamespacedKey.fromMinecraft(IRegistry.ENCHANTMENT.getKey(instance.enchantment))), instance.level);
+ }
+ CraftItemStack item = CraftItemStack.asCraftMirror(itemstack2);
+
+ EnchantItemEvent event = new EnchantItemEvent((Player) entityhuman.getBukkitEntity(), this.getBukkitView(), access.getLocation().getBlock(), item, this.costs[i], enchants, i);
+ world.getCraftServer().getPluginManager().callEvent(event);
+ EnchantItemEvent event = new EnchantItemEvent((Player) entityhuman.getBukkitEntity(), this.getBukkitView(), access.getLocation().getBlock(), item, this.costs[i], enchants, i);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ int level = event.getExpLevelCost();
+ if (event.isCancelled() || (level > entityhuman.experienceLevel && !entityhuman.getAbilities().instabuild) || event.getEnchantsToAdd().isEmpty()) {
+ return;
+ }
+ int level = event.getExpLevelCost();
+ if (event.isCancelled() || (level > entityhuman.experienceLevel && !entityhuman.getAbilities().instabuild) || event.getEnchantsToAdd().isEmpty()) {
+ return;
+ }
if (flag) {
itemstack2 = new ItemStack(Items.ENCHANTED_BOOK);
@@ -199,16 +278,29 @@
this.enchantSlots.setItem(0, itemstack2);
}
- for (int k = 0; k < list.size(); ++k) {
- WeightedRandomEnchant weightedrandomenchant = (WeightedRandomEnchant) list.get(k);
+ for (Map.Entry<org.bukkit.enchantments.Enchantment, Integer> entry : event.getEnchantsToAdd().entrySet()) {
+ try {
+ if (flag) {
+ NamespacedKey enchantId = entry.getKey().getKey();
+ Enchantment nms = IRegistry.ENCHANTMENT.get(CraftNamespacedKey.toMinecraft(enchantId));
+ if (nms == null) {
+ continue;
+ }
- if (flag) {
- ItemEnchantedBook.addEnchantment(itemstack2, weightedrandomenchant);
- } else {
- itemstack2.enchant(weightedrandomenchant.enchantment, weightedrandomenchant.level);
+ WeightedRandomEnchant weightedrandomenchant = new WeightedRandomEnchant(nms, entry.getValue());
+ ItemEnchantedBook.addEnchantment(itemstack2, weightedrandomenchant);
+ } else {
+ item.addUnsafeEnchantment(entry.getKey(), entry.getValue());
+ }
+ } catch (IllegalArgumentException e) {
+ /* Just swallow invalid enchantments */
if (flag) {
itemstack2 = new ItemStack(Items.ENCHANTED_BOOK);
@@ -182,16 +261,29 @@
this.enchantSlots.setItem(0, itemstack2);
}
}
+ entityhuman.onEnchantmentPerformed(itemstack, j);
+ // CraftBukkit end
- for (int k = 0; k < list.size(); ++k) {
- WeightedRandomEnchant weightedrandomenchant = (WeightedRandomEnchant) list.get(k);
-
- if (flag) {
- ItemEnchantedBook.addEnchantment(itemstack2, weightedrandomenchant);
- } else {
- itemstack2.enchant(weightedrandomenchant.enchantment, weightedrandomenchant.level);
+ for (Map.Entry<org.bukkit.enchantments.Enchantment, Integer> entry : event.getEnchantsToAdd().entrySet()) {
+ try {
+ if (flag) {
+ NamespacedKey enchantId = entry.getKey().getKey();
+ Enchantment nms = IRegistry.ENCHANTMENT.get(CraftNamespacedKey.toMinecraft(enchantId));
+ if (nms == null) {
+ continue;
+ }
+
+ // CraftBukkit - TODO: let plugins change this
if (!entityhuman.getAbilities().instabuild) {
itemstack1.shrink(j);
if (itemstack1.isEmpty()) {
@@ -265,6 +357,7 @@
+ WeightedRandomEnchant weightedrandomenchant = new WeightedRandomEnchant(nms, entry.getValue());
+ ItemEnchantedBook.addEnchantment(itemstack2, weightedrandomenchant);
+ } else {
+ item.addUnsafeEnchantment(entry.getKey(), entry.getValue());
+ }
+ } catch (IllegalArgumentException e) {
+ /* Just swallow invalid enchantments */
}
}
+ entityhuman.onEnchantmentPerformed(itemstack, j);
+ // CraftBukkit end
+
+ // CraftBukkit - TODO: let plugins change this
if (!entityhuman.getAbilities().instabuild) {
itemstack1.shrink(j);
if (itemstack1.isEmpty()) {
@@ -254,6 +346,7 @@
@Override
public boolean stillValid(EntityHuman entityhuman) {
@@ -179,7 +180,7 @@
return stillValid(this.access, entityhuman, Blocks.ENCHANTING_TABLE);
}
@@ -316,4 +409,17 @@
@@ -305,4 +398,17 @@
return itemstack;
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemBoneMeal.java
+++ b/net/minecraft/world/item/ItemBoneMeal.java
@@ -35,6 +35,12 @@
@@ -33,6 +33,12 @@
@Override
public EnumInteractionResult useOn(ItemActionContext itemactioncontext) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemEnderEye.java
+++ b/net/minecraft/world/item/ItemEnderEye.java
@@ -85,7 +85,11 @@
@@ -86,7 +86,11 @@
entityendersignal.setItem(itemstack);
entityendersignal.signalTo(blockposition);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemLeash.java
+++ b/net/minecraft/world/item/ItemLeash.java
@@ -14,6 +14,8 @@
@@ -13,6 +13,8 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.AxisAlignedBB;
@@ -9,7 +9,7 @@
public class ItemLeash extends Item {
public ItemLeash(Item.Info item_info) {
@@ -55,9 +57,25 @@
@@ -54,9 +56,25 @@
if (entityinsentient.getLeashHolder() == entityhuman) {
if (entityleash == null) {
entityleash = EntityLeash.getOrCreateKnot(world, blockposition);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemMinecart.java
+++ b/net/minecraft/world/item/ItemMinecart.java
@@ -18,6 +18,11 @@
@@ -17,6 +17,11 @@
import net.minecraft.world.level.block.state.properties.BlockPropertyTrackPosition;
import net.minecraft.world.level.gameevent.GameEvent;
@@ -12,7 +12,7 @@
public class ItemMinecart extends Item {
private static final IDispenseBehavior DISPENSE_ITEM_BEHAVIOR = new DispenseBehaviorItem() {
@@ -56,14 +61,43 @@
@@ -55,14 +60,43 @@
}
}
@@ -59,7 +59,7 @@
return itemstack;
}
@@ -105,7 +139,12 @@
@@ -104,7 +138,12 @@
entityminecartabstract.setCustomName(itemstack.getHoverName());
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/item/ItemStack.java
+++ b/net/minecraft/world/item/ItemStack.java
@@ -72,6 +72,40 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -73,6 +73,40 @@
import net.minecraft.world.level.block.state.pattern.ShapeDetectorBlock;
import org.slf4j.Logger;
+// CraftBukkit start
+import com.mojang.serialization.Dynamic;
@@ -41,7 +41,7 @@
public final class ItemStack {
public static final Codec<ItemStack> CODEC = RecordCodecBuilder.create((instance) -> {
@@ -139,16 +173,30 @@
@@ -144,16 +178,30 @@
this.updateEmptyCacheFlag();
}
@@ -74,7 +74,7 @@
this.getItem().verifyTagAfterLoad(this.tag);
}
@@ -156,6 +204,11 @@
@@ -161,6 +209,11 @@
this.setDamageValue(this.getDamageValue());
}
@@ -86,8 +86,8 @@
this.updateEmptyCacheFlag();
}
@@ -193,7 +246,7 @@
return this.getItem() == item;
@@ -202,7 +255,7 @@
return this.getItem().builtInRegistryHolder().tags();
}
- public EnumInteractionResult useOn(ItemActionContext itemactioncontext) {
@@ -95,8 +95,8 @@
EntityHuman entityhuman = itemactioncontext.getPlayer();
BlockPosition blockposition = itemactioncontext.getClickedPos();
ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getLevel(), blockposition, false);
@@ -201,12 +254,157 @@
if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.hasAdventureModePlaceTagForBlock(itemactioncontext.getLevel().getTagManager(), shapedetectorblock)) {
@@ -210,12 +263,157 @@
if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.hasAdventureModePlaceTagForBlock(itemactioncontext.getLevel().registryAccess().registryOrThrow(IRegistry.BLOCK_REGISTRY), shapedetectorblock)) {
return EnumInteractionResult.PASS;
} else {
+ // CraftBukkit start - handle all block place event logic here
@@ -254,7 +254,7 @@
return enuminteractionresult;
}
@@ -287,6 +485,21 @@
@@ -296,6 +494,21 @@
}
i -= k;
@@ -276,7 +276,7 @@
if (i <= 0) {
return false;
}
@@ -308,6 +521,11 @@
@@ -317,6 +530,11 @@
if (this.hurt(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) {
consumer.accept(t0);
Item item = this.getItem();
@@ -288,7 +288,7 @@
this.shrink(1);
if (t0 instanceof EntityHuman) {
@@ -463,6 +681,17 @@
@@ -472,6 +690,17 @@
return this.tag;
}
@@ -306,7 +306,7 @@
public NBTTagCompound getOrCreateTag() {
if (this.tag == null) {
this.setTag(new NBTTagCompound());
@@ -843,6 +1072,12 @@
@@ -850,6 +1079,12 @@
}
public void setRepairCost(int i) {
@@ -319,7 +319,7 @@
this.getOrCreateTag().putInt("RepairCost", i);
}
@@ -892,6 +1127,13 @@
@@ -899,6 +1134,13 @@
nbttaglist.add(nbttagcompound);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemWorldMap.java
+++ b/net/minecraft/world/item/ItemWorldMap.java
@@ -33,6 +33,11 @@
@@ -32,6 +32,11 @@
import net.minecraft.world.level.material.MaterialMapColor;
import net.minecraft.world.level.saveddata.maps.WorldMap;
@@ -12,7 +12,7 @@
public class ItemWorldMap extends ItemWorldMapBase {
public static final int IMAGE_WIDTH = 128;
@@ -67,7 +72,7 @@
@@ -66,7 +71,7 @@
public static Integer getMapId(ItemStack itemstack) {
NBTTagCompound nbttagcompound = itemstack.getTag();
@@ -21,7 +21,7 @@
}
public static int createNewSavedData(World world, int i, int j, int k, boolean flag, boolean flag1, ResourceKey<World> resourcekey) {
@@ -75,6 +80,10 @@
@@ -74,6 +79,10 @@
int l = world.getFreeMapId();
world.setMapData(makeKey(l), worldmap);

View File

@@ -1,21 +1,21 @@
--- a/net/minecraft/world/item/crafting/CraftingManager.java
+++ b/net/minecraft/world/item/crafting/CraftingManager.java
@@ -33,11 +33,13 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -32,11 +32,13 @@
import net.minecraft.world.level.World;
import org.slf4j.Logger;
+import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; // CraftBukkit
+
public class CraftingManager extends ResourceDataJson {
private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().disableHtmlEscaping().create();
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
- public Map<Recipes<?>, Map<MinecraftKey, IRecipe<?>>> recipes = ImmutableMap.of();
+ public Map<Recipes<?>, Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>>> recipes = ImmutableMap.of(); // CraftBukkit
private Map<MinecraftKey, IRecipe<?>> byName = ImmutableMap.of();
private boolean hasErrors;
@@ -47,7 +49,12 @@
@@ -46,7 +48,12 @@
protected void apply(Map<MinecraftKey, JsonElement> map, IResourceManager iresourcemanager, GameProfilerFiller gameprofilerfiller) {
this.hasErrors = false;
@@ -29,7 +29,7 @@
Builder<MinecraftKey, IRecipe<?>> builder = ImmutableMap.builder();
Iterator iterator = map.entrySet().iterator();
@@ -58,8 +65,10 @@
@@ -57,8 +64,10 @@
try {
IRecipe<?> irecipe = fromJson(minecraftkey, ChatDeserializer.convertToJsonObject((JsonElement) entry.getValue(), "top element"));
@@ -42,7 +42,7 @@
})).put(minecraftkey, irecipe);
builder.put(minecraftkey, irecipe);
} catch (IllegalArgumentException | JsonParseException jsonparseexception) {
@@ -68,20 +77,37 @@
@@ -67,20 +76,37 @@
}
this.recipes = (Map) map1.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry1) -> {
@@ -75,7 +75,7 @@
- return this.byType(recipes).values().stream().flatMap((irecipe) -> {
+ // CraftBukkit start
+ Optional<T> recipe = this.byType(recipes).values().stream().flatMap((irecipe) -> {
return SystemUtils.toStream(recipes.tryMatch(irecipe, world, c0));
return recipes.tryMatch(irecipe, world, c0).stream();
}).findFirst();
+ c0.setCurrentRecipe(recipe.orElse(null)); // CraftBukkit - Clear recipe when no recipe is found
+ // CraftBukkit end
@@ -83,7 +83,7 @@
}
public <C extends IInventory, T extends IRecipe<C>> List<T> getAllRecipesFor(Recipes<T> recipes) {
@@ -99,7 +125,7 @@
@@ -98,7 +124,7 @@
}
private <C extends IInventory, T extends IRecipe<C>> Map<MinecraftKey, IRecipe<C>> byType(Recipes<T> recipes) {
@@ -92,7 +92,7 @@
}
public <C extends IInventory, T extends IRecipe<C>> NonNullList<ItemStack> getRemainingItemsFor(Recipes<T> recipes, C c0, World world) {
@@ -119,7 +145,7 @@
@@ -118,7 +144,7 @@
}
public Optional<? extends IRecipe<?>> byKey(MinecraftKey minecraftkey) {
@@ -101,7 +101,7 @@
}
public Collection<IRecipe<?>> getRecipes() {
@@ -144,12 +170,12 @@
@@ -143,12 +169,12 @@
public void replaceRecipes(Iterable<IRecipe<?>> iterable) {
this.hasErrors = false;
@@ -116,7 +116,7 @@
});
MinecraftKey minecraftkey = irecipe.getId();
IRecipe<?> irecipe1 = (IRecipe) map1.put(minecraftkey, irecipe);
@@ -160,6 +186,26 @@
@@ -159,6 +185,26 @@
}
});
this.recipes = ImmutableMap.copyOf(map);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/enchantment/EnchantmentFrostWalker.java
+++ b/net/minecraft/world/item/enchantment/EnchantmentFrostWalker.java
@@ -57,8 +57,11 @@
@@ -56,8 +56,11 @@
IBlockData iblockdata2 = world.getBlockState(blockposition1);
if (iblockdata2.getMaterial() == Material.WATER && (Integer) iblockdata2.getValue(BlockFluids.LEVEL) == 0 && iblockdata.canSurvive(world, blockposition1) && world.isUnobstructed(iblockdata, blockposition1, VoxelShapeCollision.empty())) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/RayTrace.java
+++ b/net/minecraft/world/level/RayTrace.java
@@ -24,7 +24,7 @@
@@ -26,7 +26,7 @@
this.to = vec3d1;
this.block = raytrace_blockcollisionoption;
this.fluid = raytrace_fluidcollisionoption;
@@ -9,7 +9,7 @@
}
public Vec3D getTo() {
@@ -69,7 +69,7 @@
@@ -75,7 +75,7 @@
private final Predicate<Fluid> canPick;

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/level/SpawnerCreature.java
+++ b/net/minecraft/world/level/SpawnerCreature.java
@@ -47,6 +47,13 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.world.level.storage.WorldData;
@@ -13,7 +13,7 @@
+
public final class SpawnerCreature {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
@@ -73,7 +80,8 @@
if (entity instanceof EntityInsentient) {
EntityInsentient entityinsentient = (EntityInsentient) entity;
@@ -70,7 +70,7 @@
if (j >= entityinsentient.getMaxSpawnClusterSize()) {
return;
}
@@ -377,7 +404,7 @@
@@ -383,7 +410,7 @@
if (entityinsentient.checkSpawnRules(worldaccess, EnumMobSpawn.CHUNK_GENERATION) && entityinsentient.checkSpawnObstruction(worldaccess)) {
groupdataentity = entityinsentient.finalizeSpawn(worldaccess, worldaccess.getCurrentDifficultyAt(entityinsentient.blockPosition()), EnumMobSpawn.CHUNK_GENERATION, groupdataentity, (NBTTagCompound) null);
@@ -79,7 +79,7 @@
flag = true;
}
}
@@ -498,8 +525,10 @@
@@ -504,8 +531,10 @@
return this.unmodifiableMobCategoryCounts;
}

View File

@@ -1,7 +0,0 @@
--- a/net/minecraft/world/level/StructureManager.java
+++ b/net/minecraft/world/level/StructureManager.java
@@ -1,3 +1,4 @@
+// mc-dev import
package net.minecraft.world.level;
import com.google.common.collect.ImmutableList;

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/level/World.java
+++ b/net/minecraft/world/level/World.java
@@ -67,6 +67,31 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -65,6 +65,31 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.scores.Scoreboard;
+// CraftBukkit start
+import java.util.HashMap;
@@ -31,12 +31,12 @@
+
public abstract class World implements GeneratorAccess, AutoCloseable {
protected static final Logger LOGGER = LogManager.getLogger();
@@ -104,7 +129,43 @@
public static final Codec<ResourceKey<World>> RESOURCE_KEY_CODEC = MinecraftKey.CODEC.xmap(ResourceKey.elementKey(IRegistry.DIMENSION_REGISTRY), ResourceKey::location);
@@ -102,7 +127,43 @@
private final ResourceKey<World> dimension;
private long subTickCount;
- protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, final DimensionManager dimensionmanager, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i) {
- protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, Holder<DimensionManager> holder, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i) {
+ // CraftBukkit start Added the following
+ private final CraftWorld world;
+ public boolean pvpMode;
@@ -62,7 +62,7 @@
+
+ public abstract ResourceKey<WorldDimension> getTypeKey();
+
+ protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, final DimensionManager dimensionmanager, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) {
+ protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, Holder<DimensionManager> holder, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) {
+ this.generator = gen;
+ this.world = new CraftWorld((WorldServer) this, gen, biomeProvider, env);
+
@@ -76,23 +76,23 @@
+ // CraftBukkit end
this.profiler = supplier;
this.levelData = worlddatamutable;
this.dimensionType = dimensionmanager;
@@ -114,12 +175,12 @@
this.dimensionTypeRegistration = holder;
@@ -113,12 +174,12 @@
this.worldBorder = new WorldBorder() {
@Override
public double getCenterX() {
- return super.getCenterX() / dimensionmanager.coordinateScale();
- return super.getCenterX() / World.this.dimensionType.coordinateScale();
+ return super.getCenterX(); // CraftBukkit
}
@Override
public double getCenterZ() {
- return super.getCenterZ() / dimensionmanager.coordinateScale();
- return super.getCenterZ() / World.this.dimensionType.coordinateScale();
+ return super.getCenterZ(); // CraftBukkit
}
};
} else {
@@ -129,6 +190,42 @@
@@ -128,6 +189,42 @@
this.thread = Thread.currentThread();
this.biomeManager = new BiomeManager(this, i);
this.isDebug = flag1;
@@ -135,7 +135,7 @@
}
@Override
@@ -186,6 +283,17 @@
@@ -185,6 +282,17 @@
@Override
public boolean setBlock(BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
@@ -153,7 +153,7 @@
if (this.isOutsideBuildHeight(blockposition)) {
return false;
} else if (!this.isClientSide && this.isDebug()) {
@@ -193,9 +301,24 @@
@@ -192,9 +300,24 @@
} else {
Chunk chunk = this.getChunkAt(blockposition);
Block block = iblockdata.getBlock();
@@ -179,7 +179,7 @@
return false;
} else {
IBlockData iblockdata2 = this.getBlockState(blockposition);
@@ -206,6 +329,7 @@
@@ -205,6 +328,7 @@
this.getProfiler().pop();
}
@@ -187,7 +187,7 @@
if (iblockdata2 == iblockdata) {
if (iblockdata1 != iblockdata2) {
this.setBlocksDirty(blockposition, iblockdata1, iblockdata2);
@@ -232,12 +356,69 @@
@@ -231,12 +355,69 @@
this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
}
@@ -257,7 +257,7 @@
public void onBlockStateChange(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
@Override
@@ -327,6 +508,17 @@
@@ -326,6 +507,17 @@
IBlockData iblockdata = this.getBlockState(blockposition);
try {
@@ -275,7 +275,7 @@
iblockdata.neighborChanged(this, blockposition, block, blockposition1, false);
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception while updating neighbours");
@@ -369,6 +561,14 @@
@@ -368,6 +560,14 @@
@Override
public IBlockData getBlockState(BlockPosition blockposition) {
@@ -290,7 +290,7 @@
if (this.isOutsideBuildHeight(blockposition)) {
return Blocks.VOID_AIR.defaultBlockState();
} else {
@@ -494,6 +694,16 @@
@@ -493,6 +693,16 @@
@Nullable
@Override
public TileEntity getBlockEntity(BlockPosition blockposition) {
@@ -307,7 +307,7 @@
return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && Thread.currentThread() != this.thread ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, Chunk.EnumTileEntityState.IMMEDIATE));
}
@@ -501,6 +711,12 @@
@@ -500,6 +710,12 @@
BlockPosition blockposition = tileentity.getBlockPos();
if (!this.isOutsideBuildHeight(blockposition)) {
@@ -320,7 +320,7 @@
this.getChunkAt(blockposition).addAndRegisterBlockEntity(tileentity);
}
}
@@ -605,7 +821,7 @@
@@ -604,7 +820,7 @@
for (int j = 0; j < i; ++j) {
EntityComplexPart entitycomplexpart = aentitycomplexpart[j];
@@ -329,7 +329,7 @@
if (t0 != null && predicate.test(t0)) {
list.add(t0);
@@ -931,6 +1147,14 @@
@@ -932,6 +1148,14 @@
public abstract LevelEntityGetter<Entity> getEntities();
protected void postGameEventInRadius(@Nullable Entity entity, GameEvent gameevent, BlockPosition blockposition, int i) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/AbstractCandleBlock.java
+++ b/net/minecraft/world/level/block/AbstractCandleBlock.java
@@ -38,6 +38,11 @@
@@ -37,6 +37,11 @@
@Override
public void onProjectileHit(World world, IBlockData iblockdata, MovingObjectPositionBlock movingobjectpositionblock, IProjectile iprojectile) {
if (!world.isClientSide && iprojectile.isOnFire() && this.canBeLit(iblockdata)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BigDripleafBlock.java
+++ b/net/minecraft/world/level/block/BigDripleafBlock.java
@@ -42,6 +42,11 @@
@@ -41,6 +41,11 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -12,7 +12,7 @@
public class BigDripleafBlock extends BlockFacingHorizontal implements IBlockFragilePlantElement, IBlockWaterlogged {
private static final BlockStateBoolean WATERLOGGED = BlockProperties.WATERLOGGED;
@@ -110,7 +115,7 @@
@@ -109,7 +114,7 @@
@Override
public void onProjectileHit(World world, IBlockData iblockdata, MovingObjectPositionBlock movingobjectpositionblock, IProjectile iprojectile) {
@@ -21,7 +21,7 @@
}
@Override
@@ -169,7 +174,20 @@
@@ -168,7 +173,20 @@
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if (!world.isClientSide) {
if (iblockdata.getValue(BigDripleafBlock.TILT) == Tilt.NONE && canEntityTilt(blockposition, entity) && !world.hasNeighborSignal(blockposition)) {
@@ -43,7 +43,7 @@
}
}
@@ -183,9 +201,9 @@
@@ -182,9 +200,9 @@
Tilt tilt = (Tilt) iblockdata.getValue(BigDripleafBlock.TILT);
if (tilt == Tilt.UNSTABLE) {
@@ -55,7 +55,7 @@
} else if (tilt == Tilt.FULL) {
resetTilt(iblockdata, worldserver, blockposition);
}
@@ -211,8 +229,10 @@
@@ -210,8 +228,10 @@
return entity.isOnGround() && entity.position().y > (double) ((float) blockposition.getY() + 0.6875F);
}
@@ -68,7 +68,7 @@
if (soundeffect != null) {
playTiltSound(world, blockposition, soundeffect);
}
@@ -226,19 +246,27 @@
@@ -225,19 +245,27 @@
}
private static void resetTilt(IBlockData iblockdata, World world, BlockPosition blockposition) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/Block.java
+++ b/net/minecraft/world/level/block/Block.java
@@ -352,7 +352,13 @@
@@ -354,7 +354,13 @@
EntityItem entityitem = (EntityItem) supplier.get();
entityitem.setDefaultPickUpDelay();
@@ -15,7 +15,7 @@
}
}
@@ -378,7 +384,7 @@
@@ -380,7 +386,7 @@
public void playerDestroy(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, @Nullable TileEntity tileentity, ItemStack itemstack) {
entityhuman.awardStat(StatisticList.BLOCK_MINED.get(this));
@@ -24,8 +24,8 @@
dropResources(iblockdata, world, blockposition, tileentity, entityhuman, itemstack);
}
@@ -512,6 +518,12 @@
return (ImmutableMap) this.stateDefinition.getPossibleStates().stream().collect(ImmutableMap.toImmutableMap(Function.identity(), function));
@@ -520,6 +526,12 @@
return this.builtInRegistryHolder;
}
+ // CraftBukkit start

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockBamboo.java
+++ b/net/minecraft/world/level/block/BlockBamboo.java
@@ -186,7 +186,7 @@
@@ -185,7 +185,7 @@
BlockPosition blockposition1 = blockposition.above(i);
IBlockData iblockdata1 = worldserver.getBlockState(blockposition1);
@@ -9,7 +9,7 @@
return;
}
@@ -207,14 +207,18 @@
@@ -206,14 +206,18 @@
BlockPosition blockposition1 = blockposition.below(2);
IBlockData iblockdata2 = world.getBlockState(blockposition1);
BlockPropertyBambooSize blockpropertybamboosize = BlockPropertyBambooSize.NONE;
@@ -30,7 +30,7 @@
}
}
} else {
@@ -225,7 +229,14 @@
@@ -224,7 +228,14 @@
int j = (Integer) iblockdata.getValue(BlockBamboo.AGE) != 1 && !iblockdata2.is(Blocks.BAMBOO) ? 0 : 1;
int k = (i < 11 || random.nextFloat() >= 0.25F) && i != 15 ? 0 : 1;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockBambooSapling.java
+++ b/net/minecraft/world/level/block/BlockBambooSapling.java
@@ -94,6 +94,6 @@
@@ -93,6 +93,6 @@
}
protected void growBamboo(World world, BlockPosition blockposition) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockBeehive.java
+++ b/net/minecraft/world/level/block/BlockBeehive.java
@@ -108,7 +108,7 @@
@@ -105,7 +105,7 @@
EntityBee entitybee = (EntityBee) iterator.next();
if (entitybee.getTarget() == null) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCactus.java
+++ b/net/minecraft/world/level/block/BlockCactus.java
@@ -23,6 +23,8 @@
@@ -22,6 +22,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -9,7 +9,7 @@
public class BlockCactus extends Block {
public static final BlockStateInteger AGE = BlockProperties.AGE_15;
@@ -59,7 +61,7 @@
@@ -58,7 +60,7 @@
int j = (Integer) iblockdata.getValue(BlockCactus.AGE);
if (j == 15) {
@@ -18,7 +18,7 @@
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockCactus.AGE, 0);
worldserver.setBlock(blockposition, iblockdata1, 4);
@@ -116,7 +118,9 @@
@@ -115,7 +117,9 @@
@Override
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCake.java
+++ b/net/minecraft/world/level/block/BlockCake.java
@@ -85,7 +85,18 @@
@@ -84,7 +84,18 @@
return EnumInteractionResult.PASS;
} else {
entityhuman.awardStat(StatisticList.EAT_CAKE_SLICE);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCampfire.java
+++ b/net/minecraft/world/level/block/BlockCampfire.java
@@ -48,6 +48,10 @@
@@ -47,6 +47,10 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -11,7 +11,7 @@
public class BlockCampfire extends BlockTileEntity implements IBlockWaterlogged {
protected static final VoxelShape SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 7.0D, 16.0D);
@@ -92,7 +96,9 @@
@@ -91,7 +95,9 @@
@Override
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if (!entity.fireImmune() && (Boolean) iblockdata.getValue(BlockCampfire.LIT) && entity instanceof EntityLiving && !EnchantmentManager.hasFrostWalker((EntityLiving) entity)) {
@@ -21,7 +21,7 @@
}
super.entityInside(iblockdata, world, blockposition, entity);
@@ -202,6 +208,11 @@
@@ -201,6 +207,11 @@
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
if (!world.isClientSide && iprojectile.isOnFire() && iprojectile.mayInteract(world, blockposition) && !(Boolean) iblockdata.getValue(BlockCampfire.LIT) && !(Boolean) iblockdata.getValue(BlockCampfire.WATERLOGGED)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCocoa.java
+++ b/net/minecraft/world/level/block/BlockCocoa.java
@@ -21,6 +21,8 @@
@@ -20,6 +20,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -9,7 +9,7 @@
public class BlockCocoa extends BlockFacingHorizontal implements IBlockFragilePlantElement {
public static final int MAX_AGE = 2;
@@ -55,7 +57,7 @@
@@ -54,7 +56,7 @@
int i = (Integer) iblockdata.getValue(BlockCocoa.AGE);
if (i < 2) {
@@ -18,7 +18,7 @@
}
}
@@ -125,7 +127,7 @@
@@ -124,7 +126,7 @@
@Override
public void performBonemeal(WorldServer worldserver, Random random, BlockPosition blockposition, IBlockData iblockdata) {

View File

@@ -1,14 +1,14 @@
--- a/net/minecraft/world/level/block/BlockCommand.java
+++ b/net/minecraft/world/level/block/BlockCommand.java
@@ -27,6 +27,8 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.phys.MovingObjectPositionBlock;
import org.slf4j.Logger;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockCommand extends BlockTileEntity implements GameMasterBlock {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
@@ -57,6 +59,15 @@
TileEntityCommand tileentitycommand = (TileEntityCommand) tileentity;
boolean flag1 = world.hasNeighborSignal(blockposition);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockConcretePowder.java
+++ b/net/minecraft/world/level/block/BlockConcretePowder.java
@@ -12,6 +12,12 @@
@@ -11,6 +11,12 @@
import net.minecraft.world.level.block.state.BlockBase;
import net.minecraft.world.level.block.state.IBlockData;
@@ -13,7 +13,7 @@
public class BlockConcretePowder extends BlockFalling {
private final IBlockData concrete;
@@ -24,7 +30,7 @@
@@ -23,7 +29,7 @@
@Override
public void onLand(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1, EntityFallingBlock entityfallingblock) {
if (shouldSolidify(world, blockposition, iblockdata1)) {
@@ -22,7 +22,7 @@
}
}
@@ -35,7 +41,24 @@
@@ -34,7 +40,24 @@
BlockPosition blockposition = blockactioncontext.getClickedPos();
IBlockData iblockdata = world.getBlockState(blockposition);
@@ -48,7 +48,7 @@
}
private static boolean shouldSolidify(IBlockAccess iblockaccess, BlockPosition blockposition, IBlockData iblockdata) {
@@ -71,7 +94,25 @@
@@ -70,7 +93,25 @@
@Override
public IBlockData updateShape(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCoral.java
+++ b/net/minecraft/world/level/block/BlockCoral.java
@@ -26,6 +26,11 @@
@@ -25,6 +25,11 @@
@Override
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
if (!this.scanForWater(worldserver, blockposition)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java
+++ b/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java
@@ -41,6 +41,11 @@
@@ -40,6 +40,11 @@
@Override
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
if (!canBeGrass(iblockdata, worldserver, blockposition)) {
@@ -12,7 +12,7 @@
worldserver.setBlockAndUpdate(blockposition, Blocks.DIRT.defaultBlockState());
} else {
if (worldserver.getMaxLocalRawBrightness(blockposition.above()) >= 9) {
@@ -50,7 +55,7 @@
@@ -49,7 +54,7 @@
BlockPosition blockposition1 = blockposition.offset(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
if (worldserver.getBlockState(blockposition1).is(Blocks.DIRT) && canPropagate(iblockdata1, worldserver, blockposition1)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockFenceGate.java
+++ b/net/minecraft/world/level/block/BlockFenceGate.java
@@ -129,6 +129,17 @@
@@ -128,6 +128,17 @@
public void neighborChanged(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
if (!world.isClientSide) {
boolean flag1 = world.hasNeighborSignal(blockposition);

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/level/block/BlockFluids.java
+++ b/net/minecraft/world/level/block/BlockFluids.java
@@ -141,14 +141,20 @@
if (world.getFluidState(blockposition1).is((Tag) TagsFluid.WATER)) {
@@ -140,14 +140,20 @@
if (world.getFluidState(blockposition1).is(TagsFluid.WATER)) {
Block block = world.getFluidState(blockposition).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE;
- world.setBlockAndUpdate(blockposition, block.defaultBlockState());

View File

@@ -11,6 +11,6 @@
+ BlockSapling.treeType = org.bukkit.TreeType.CRIMSON_FUNGUS;
+ }
+ // CraftBukkit end
((WorldGenFeatureConfigured) this.feature.get()).place(worldserver, worldserver.getChunkSource().getGenerator(), random, blockposition);
((WorldGenFeatureConfigured) ((Holder) this.feature.get()).value()).place(worldserver, worldserver.getChunkSource().getGenerator(), random, blockposition);
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockLeaves.java
+++ b/net/minecraft/world/level/block/BlockLeaves.java
@@ -20,6 +20,8 @@
@@ -19,6 +19,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -9,7 +9,7 @@
public class BlockLeaves extends Block {
public static final int DECAY_DISTANCE = 7;
@@ -45,6 +47,14 @@
@@ -44,6 +46,14 @@
@Override
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
if (!(Boolean) iblockdata.getValue(BlockLeaves.PERSISTENT) && (Integer) iblockdata.getValue(BlockLeaves.DISTANCE) == 7) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockLectern.java
+++ b/net/minecraft/world/level/block/BlockLectern.java
@@ -198,12 +198,13 @@
@@ -197,12 +197,13 @@
}
private void popBook(IBlockData iblockdata, World world, BlockPosition blockposition) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockMagma.java
+++ b/net/minecraft/world/level/block/BlockMagma.java
@@ -30,7 +30,9 @@
@@ -29,7 +29,9 @@
@Override
public void stepOn(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
if (!entity.fireImmune() && entity instanceof EntityLiving && !EnchantmentManager.hasFrostWalker((EntityLiving) entity)) {

View File

@@ -25,6 +25,6 @@
public boolean growMushroom(WorldServer worldserver, BlockPosition blockposition, IBlockData iblockdata, Random random) {
worldserver.removeBlock(blockposition, false);
+ BlockSapling.treeType = (this == Blocks.BROWN_MUSHROOM) ? TreeType.BROWN_MUSHROOM : TreeType.BROWN_MUSHROOM; // CraftBukkit
if (((WorldGenFeatureConfigured) this.featureSupplier.get()).place(worldserver, worldserver.getChunkSource().getGenerator(), random, blockposition)) {
if (((WorldGenFeatureConfigured) ((Holder) this.featureSupplier.get()).value()).place(worldserver, worldserver.getChunkSource().getGenerator(), random, blockposition)) {
return true;
} else {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockNylium.java
+++ b/net/minecraft/world/level/block/BlockNylium.java
@@ -30,6 +30,11 @@
@@ -31,6 +31,11 @@
@Override
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
if (!canBeNylium(iblockdata, worldserver, blockposition)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockPlant.java
+++ b/net/minecraft/world/level/block/BlockPlant.java
@@ -23,7 +23,14 @@
@@ -22,7 +22,14 @@
@Override
public IBlockData updateShape(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockReed.java
+++ b/net/minecraft/world/level/block/BlockReed.java
@@ -57,7 +57,7 @@
@@ -56,7 +56,7 @@
int j = (Integer) iblockdata.getValue(BlockReed.AGE);
if (j == 15) {

View File

@@ -7,5 +7,5 @@
- if ((Integer) iblockdata1.getValue(BlockScaffolding.DISTANCE) == 7) {
+ if ((Integer) iblockdata1.getValue(BlockScaffolding.DISTANCE) == 7 && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) { // CraftBukkit - BlockFadeEvent
if ((Integer) iblockdata.getValue(BlockScaffolding.DISTANCE) == 7) {
worldserver.addFreshEntity(new EntityFallingBlock(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (IBlockData) iblockdata1.setValue(BlockScaffolding.WATERLOGGED, false)));
EntityFallingBlock.fall(worldserver, blockposition, iblockdata1);
} else {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockSoil.java
+++ b/net/minecraft/world/level/block/BlockSoil.java
@@ -26,6 +26,11 @@
@@ -25,6 +25,11 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -12,7 +12,7 @@
public class BlockSoil extends Block {
public static final BlockStateInteger MOISTURE = BlockProperties.MOISTURE;
@@ -82,26 +87,49 @@
@@ -81,26 +86,49 @@
if (!isNearWater(worldserver, blockposition) && !worldserver.isRainingAt(blockposition.above())) {
if (i > 0) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockSponge.java
+++ b/net/minecraft/world/level/block/BlockSponge.java
@@ -14,6 +14,13 @@
@@ -13,6 +13,13 @@
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.Material;
@@ -14,7 +14,7 @@
public class BlockSponge extends Block {
public static final int MAX_DEPTH = 6;
@@ -49,6 +56,7 @@
@@ -48,6 +55,7 @@
queue.add(new Tuple<>(blockposition, 0));
int i = 0;
@@ -22,7 +22,7 @@
while (!queue.isEmpty()) {
Tuple<BlockPosition, Integer> tuple = (Tuple) queue.poll();
@@ -60,27 +68,31 @@
@@ -59,27 +67,31 @@
for (int l = 0; l < k; ++l) {
EnumDirection enumdirection = aenumdirection[l];
BlockPosition blockposition2 = blockposition1.relative(enumdirection);
@@ -34,7 +34,7 @@
+ // CraftBukkit end
Material material = iblockdata.getMaterial();
if (fluid.is((Tag) TagsFluid.WATER)) {
if (fluid.is(TagsFluid.WATER)) {
- if (iblockdata.getBlock() instanceof IFluidSource && !((IFluidSource) iblockdata.getBlock()).pickupBlock(world, blockposition2, iblockdata).isEmpty()) {
+ if (iblockdata.getBlock() instanceof IFluidSource && !((IFluidSource) iblockdata.getBlock()).pickupBlock(blockList, blockposition2, iblockdata).isEmpty()) { // CraftBukkit
++i;
@@ -61,7 +61,7 @@
++i;
if (j < 6) {
queue.add(new Tuple<>(blockposition2, j + 1));
@@ -93,6 +105,39 @@
@@ -92,6 +104,39 @@
break;
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockStem.java
+++ b/net/minecraft/world/level/block/BlockStem.java
@@ -21,6 +21,8 @@
@@ -20,6 +20,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -9,7 +9,7 @@
public class BlockStem extends BlockPlant implements IBlockFragilePlantElement {
public static final int MAX_AGE = 7;
@@ -57,14 +59,18 @@
@@ -56,14 +58,18 @@
if (i < 7) {
iblockdata = (IBlockData) iblockdata.setValue(BlockStem.AGE, i + 1);
@@ -20,7 +20,7 @@
BlockPosition blockposition1 = blockposition.relative(enumdirection);
IBlockData iblockdata1 = worldserver.getBlockState(blockposition1.below());
if (worldserver.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is((Tag) TagsBlock.DIRT))) {
if (worldserver.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(TagsBlock.DIRT))) {
- worldserver.setBlockAndUpdate(blockposition1, this.fruit.defaultBlockState());
+ // CraftBukkit start
+ if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition1, this.fruit.defaultBlockState())) {
@@ -30,7 +30,7 @@
worldserver.setBlockAndUpdate(blockposition, (IBlockData) this.fruit.getAttachedStem().defaultBlockState().setValue(BlockFacingHorizontal.FACING, enumdirection));
}
}
@@ -93,7 +99,7 @@
@@ -92,7 +98,7 @@
int i = Math.min(7, (Integer) iblockdata.getValue(BlockStem.AGE) + MathHelper.nextInt(worldserver.random, 2, 5));
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockStem.AGE, i);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockTurtleEgg.java
+++ b/net/minecraft/world/level/block/BlockTurtleEgg.java
@@ -29,6 +29,12 @@
@@ -28,6 +28,12 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -13,7 +13,7 @@
public class BlockTurtleEgg extends Block {
public static final int MAX_HATCH_LEVEL = 2;
@@ -62,6 +68,19 @@
@@ -61,6 +67,19 @@
private void destroyEgg(World world, IBlockData iblockdata, BlockPosition blockposition, Entity entity, int i) {
if (this.canDestroyEgg(world, entity)) {
if (!world.isClientSide && world.random.nextInt(i) == 0 && iblockdata.is(Blocks.TURTLE_EGG)) {
@@ -33,7 +33,7 @@
this.decreaseEggs(world, blockposition, iblockdata);
}
@@ -87,9 +106,19 @@
@@ -86,9 +105,19 @@
int i = (Integer) iblockdata.getValue(BlockTurtleEgg.HATCH);
if (i < 2) {
@@ -54,7 +54,7 @@
worldserver.playSound((EntityHuman) null, blockposition, SoundEffects.TURTLE_EGG_HATCH, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F);
worldserver.removeBlock(blockposition, false);
@@ -100,7 +129,7 @@
@@ -99,7 +128,7 @@
entityturtle.setAge(-24000);
entityturtle.setHomePos(blockposition);
entityturtle.moveTo((double) blockposition.getX() + 0.3D + (double) j * 0.2D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.3D, 0.0F, 0.0F);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockWitherSkull.java
+++ b/net/minecraft/world/level/block/BlockWitherSkull.java
@@ -27,6 +27,11 @@
@@ -26,6 +26,11 @@
import net.minecraft.world.level.block.state.predicate.MaterialPredicate;
import net.minecraft.world.level.material.Material;
@@ -12,7 +12,7 @@
public class BlockWitherSkull extends BlockSkull {
@Nullable
@@ -50,6 +55,7 @@
@@ -49,6 +54,7 @@
}
public static void checkSpawn(World world, BlockPosition blockposition, TileEntitySkull tileentityskull) {
@@ -20,7 +20,7 @@
if (!world.isClientSide) {
IBlockData iblockdata = tileentityskull.getBlockState();
boolean flag = iblockdata.is(Blocks.WITHER_SKELETON_SKULL) || iblockdata.is(Blocks.WITHER_SKELETON_WALL_SKULL);
@@ -59,12 +65,14 @@
@@ -58,12 +64,14 @@
ShapeDetector.ShapeDetectorCollection shapedetector_shapedetectorcollection = shapedetector.find(world, blockposition);
if (shapedetector_shapedetectorcollection != null) {
@@ -37,7 +37,7 @@
}
}
@@ -74,6 +82,15 @@
@@ -73,6 +81,15 @@
entitywither.moveTo((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.55D, (double) blockposition1.getZ() + 0.5D, shapedetector_shapedetectorcollection.getForwards().getAxis() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F, 0.0F);
entitywither.yBodyRot = shapedetector_shapedetectorcollection.getForwards().getAxis() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F;
entitywither.makeInvulnerable();
@@ -53,7 +53,7 @@
Iterator iterator = world.getEntitiesOfClass(EntityPlayer.class, entitywither.getBoundingBox().inflate(50.0D)).iterator();
while (iterator.hasNext()) {
@@ -82,7 +99,7 @@
@@ -81,7 +98,7 @@
CriterionTriggers.SUMMONED_ENTITY.trigger(entityplayer, (Entity) entitywither);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/PointedDripstoneBlock.java
+++ b/net/minecraft/world/level/block/PointedDripstoneBlock.java
@@ -41,6 +41,11 @@
@@ -43,6 +43,11 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -12,7 +12,7 @@
public class PointedDripstoneBlock extends Block implements Fallable, IBlockWaterlogged {
public static final BlockStateDirection TIP_DIRECTION = BlockProperties.VERTICAL_DIRECTION;
@@ -123,6 +128,11 @@
@@ -125,6 +130,11 @@
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
if (!world.isClientSide && iprojectile.mayInteract(world, blockposition) && iprojectile instanceof EntityThrownTrident && iprojectile.getDeltaMovement().length() > 0.6D) {
@@ -24,7 +24,7 @@
world.destroyBlock(blockposition, true);
}
@@ -131,7 +141,9 @@
@@ -133,7 +143,9 @@
@Override
public void fallOn(World world, IBlockData iblockdata, BlockPosition blockposition, Entity entity, float f) {
if (iblockdata.getValue(PointedDripstoneBlock.TIP_DIRECTION) == EnumDirection.UP && iblockdata.getValue(PointedDripstoneBlock.THICKNESS) == DripstoneThickness.TIP) {
@@ -34,7 +34,7 @@
} else {
super.fallOn(world, iblockdata, blockposition, entity, f);
}
@@ -405,15 +417,15 @@
@@ -380,15 +392,15 @@
if (isUnmergedTipWithDirection(iblockdata, enumdirection.getOpposite())) {
createMergedTips(iblockdata, worldserver, blockposition1);
} else if (iblockdata.isAir() || iblockdata.is(Blocks.WATER)) {
@@ -53,7 +53,7 @@
}
private static void createMergedTips(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
@@ -428,8 +440,8 @@
@@ -403,8 +415,8 @@
blockposition1 = blockposition.below();
}
@@ -64,27 +64,30 @@
}
public static void spawnDripParticle(World world, BlockPosition blockposition, IBlockData iblockdata) {
@@ -462,7 +474,7 @@
@@ -437,7 +449,7 @@
return (BlockPosition) findBlockVertical(generatoraccess, blockposition, enumdirection.getAxisDirection(), predicate, (iblockdata1) -> {
return (BlockPosition) findBlockVertical(generatoraccess, blockposition, enumdirection.getAxisDirection(), bipredicate, (iblockdata1) -> {
return isTip(iblockdata1, flag);
- }, i).orElse((Object) null);
+ }, i).orElse(null); // CraftBukkit - decompile error
}
}
@@ -575,12 +587,12 @@
return iblockdata.getBlock() instanceof AbstractCauldronBlock && ((AbstractCauldronBlock) iblockdata.getBlock()).canReceiveStalactiteDrip(fluidtype);
@@ -553,7 +565,7 @@
return canDripThrough(world, blockposition1, iblockdata);
};
- return (BlockPosition) findBlockVertical(world, blockposition, EnumDirection.DOWN.getAxisDirection(), BlockBase.BlockData::isAir, predicate, 11).orElse((Object) null);
+ return (BlockPosition) findBlockVertical(world, blockposition, EnumDirection.DOWN.getAxisDirection(), BlockBase.BlockData::isAir, predicate, 11).orElse(null); // CraftBukkit - decompile error
- return (BlockPosition) findBlockVertical(world, blockposition, EnumDirection.DOWN.getAxisDirection(), bipredicate, predicate, 11).orElse((Object) null);
+ return (BlockPosition) findBlockVertical(world, blockposition, EnumDirection.DOWN.getAxisDirection(), bipredicate, predicate, 11).orElse(null); // CraftBukkit - decompile error
}
@Nullable
public static BlockPosition findStalactiteTipAboveCauldron(World world, BlockPosition blockposition) {
- return (BlockPosition) findBlockVertical(world, blockposition, EnumDirection.UP.getAxisDirection(), BlockBase.BlockData::isAir, PointedDripstoneBlock::canDrip, 11).orElse((Object) null);
+ return (BlockPosition) findBlockVertical(world, blockposition, EnumDirection.UP.getAxisDirection(), BlockBase.BlockData::isAir, PointedDripstoneBlock::canDrip, 11).orElse(null); // CraftBukkit - decompile error
@@ -562,7 +574,7 @@
return canDripThrough(world, blockposition1, iblockdata);
};
- return (BlockPosition) findBlockVertical(world, blockposition, EnumDirection.UP.getAxisDirection(), bipredicate, PointedDripstoneBlock::canDrip, 11).orElse((Object) null);
+ return (BlockPosition) findBlockVertical(world, blockposition, EnumDirection.UP.getAxisDirection(), bipredicate, PointedDripstoneBlock::canDrip, 11).orElse(null); // CraftBukkit - decompile error
}
public static FluidType getCauldronFillFluidType(World world, BlockPosition blockposition) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/level/block/entity/TileEntity.java
+++ b/net/minecraft/world/level/block/entity/TileEntity.java
@@ -15,8 +15,18 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.level.block.state.IBlockData;
import org.slf4j.Logger;
+// CraftBukkit start
+import org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer;
@@ -16,7 +16,7 @@
+ private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
+ public CraftPersistentDataContainer persistentDataContainer;
+ // CraftBukkit end
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
private final TileEntityTypes<?> type;
@Nullable
@@ -48,7 +58,16 @@

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityBeacon.java
+++ b/net/minecraft/world/level/block/entity/TileEntityBeacon.java
@@ -39,6 +39,11 @@
@@ -38,6 +38,11 @@
import net.minecraft.world.level.levelgen.HeightMap;
import net.minecraft.world.phys.AxisAlignedBB;
@@ -12,7 +12,7 @@
public class TileEntityBeacon extends TileEntity implements ITileInventory {
private static final int MAX_LEVELS = 4;
@@ -61,6 +66,15 @@
@@ -60,6 +65,15 @@
public IChatBaseComponent name;
public ChestLock lockKey;
private final IContainerProperties dataAccess;
@@ -28,7 +28,7 @@
public TileEntityBeacon(BlockPosition blockposition, IBlockData iblockdata) {
super(TileEntityTypes.BEACON, blockposition, iblockdata);
@@ -229,39 +243,78 @@
@@ -228,39 +242,78 @@
super.setRemoved();
}
@@ -117,7 +117,7 @@
public static void playSound(World world, BlockPosition blockposition, SoundEffect soundeffect) {
world.playSound((EntityHuman) null, blockposition, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
}
@@ -290,8 +343,11 @@
@@ -289,8 +342,11 @@
@Override
public void load(NBTTagCompound nbttagcompound) {
super.load(nbttagcompound);

Some files were not shown because too many files have changed in this diff Show More