@@ -253,7 +253,7 @@
|
||||
if (this.onGround) {
|
||||
block.stepOn(this.level, blockposition, iblockdata, this);
|
||||
}
|
||||
@@ -938,6 +1114,20 @@
|
||||
@@ -946,6 +1122,20 @@
|
||||
return SoundEffects.GENERIC_SPLASH;
|
||||
}
|
||||
|
||||
@@ -273,8 +273,8 @@
|
||||
+
|
||||
protected void checkInsideBlocks() {
|
||||
AxisAlignedBB axisalignedbb = this.getBoundingBox();
|
||||
BlockPosition blockposition = new BlockPosition(axisalignedbb.minX + 0.001D, axisalignedbb.minY + 0.001D, axisalignedbb.minZ + 0.001D);
|
||||
@@ -1290,6 +1480,7 @@
|
||||
BlockPosition blockposition = new BlockPosition(axisalignedbb.minX + 1.0E-7D, axisalignedbb.minY + 1.0E-7D, axisalignedbb.minZ + 1.0E-7D);
|
||||
@@ -1305,6 +1495,7 @@
|
||||
this.yo = d1;
|
||||
this.zo = d4;
|
||||
this.setPos(d3, d1, d4);
|
||||
@@ -282,7 +282,7 @@
|
||||
}
|
||||
|
||||
public void moveTo(Vec3D vec3d) {
|
||||
@@ -1480,6 +1671,12 @@
|
||||
@@ -1495,6 +1686,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@
|
||||
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
|
||||
@@ -1513,7 +1710,7 @@
|
||||
@@ -1528,7 +1725,7 @@
|
||||
} else {
|
||||
String s = this.getEncodeId();
|
||||
|
||||
@@ -304,7 +304,7 @@
|
||||
return false;
|
||||
} else {
|
||||
nbttagcompound.putString("id", s);
|
||||
@@ -1538,6 +1735,18 @@
|
||||
@@ -1553,6 +1750,18 @@
|
||||
Vec3D vec3d = this.getDeltaMovement();
|
||||
|
||||
nbttagcompound.put("Motion", this.newDoubleList(vec3d.x, vec3d.y, vec3d.z));
|
||||
@@ -323,7 +323,7 @@
|
||||
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
|
||||
nbttagcompound.putFloat("FallDistance", this.fallDistance);
|
||||
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
|
||||
@@ -1546,6 +1755,22 @@
|
||||
@@ -1561,6 +1770,22 @@
|
||||
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
|
||||
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
|
||||
nbttagcompound.putUUID("UUID", this.getUUID());
|
||||
@@ -346,7 +346,7 @@
|
||||
IChatBaseComponent ichatbasecomponent = this.getCustomName();
|
||||
|
||||
if (ichatbasecomponent != null) {
|
||||
@@ -1613,6 +1838,11 @@
|
||||
@@ -1628,6 +1853,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@
|
||||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -1696,6 +1926,44 @@
|
||||
@@ -1711,6 +1941,44 @@
|
||||
} else {
|
||||
throw new IllegalStateException("Entity has invalid position");
|
||||
}
|
||||
@@ -403,7 +403,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
|
||||
@@ -1771,9 +2039,22 @@
|
||||
@@ -1786,9 +2054,22 @@
|
||||
} else if (this.level.isClientSide) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -426,7 +426,7 @@
|
||||
this.level.addFreshEntity(entityitem);
|
||||
return entityitem;
|
||||
}
|
||||
@@ -1867,7 +2148,7 @@
|
||||
@@ -1882,7 +2163,7 @@
|
||||
|
||||
this.setPose(EntityPose.STANDING);
|
||||
this.vehicle = entity;
|
||||
@@ -435,7 +435,7 @@
|
||||
entity.getIndirectPassengersStream().filter((entity2) -> {
|
||||
return entity2 instanceof EntityPlayer;
|
||||
}).forEach((entity2) -> {
|
||||
@@ -1898,7 +2179,7 @@
|
||||
@@ -1913,7 +2194,7 @@
|
||||
Entity entity = this.vehicle;
|
||||
|
||||
this.vehicle = null;
|
||||
@@ -444,7 +444,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1907,10 +2188,31 @@
|
||||
@@ -1926,10 +2207,31 @@
|
||||
this.removeVehicle();
|
||||
}
|
||||
|
||||
@@ -477,7 +477,7 @@
|
||||
if (this.passengers.isEmpty()) {
|
||||
this.passengers = ImmutableList.of(entity);
|
||||
} else {
|
||||
@@ -1926,12 +2228,32 @@
|
||||
@@ -1945,12 +2247,32 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -511,7 +511,7 @@
|
||||
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
|
||||
this.passengers = ImmutableList.of();
|
||||
} else {
|
||||
@@ -1942,6 +2264,7 @@
|
||||
@@ -1961,6 +2283,7 @@
|
||||
|
||||
entity.boardingCooldown = 60;
|
||||
}
|
||||
@@ -519,7 +519,7 @@
|
||||
}
|
||||
|
||||
protected boolean canAddPassenger(Entity entity) {
|
||||
@@ -2004,14 +2327,20 @@
|
||||
@@ -2023,14 +2346,20 @@
|
||||
|
||||
if (this.isInsidePortal) {
|
||||
MinecraftServer minecraftserver = worldserver.getServer();
|
||||
@@ -543,7 +543,7 @@
|
||||
this.level.getProfiler().pop();
|
||||
}
|
||||
|
||||
@@ -2129,6 +2458,13 @@
|
||||
@@ -2148,6 +2477,13 @@
|
||||
}
|
||||
|
||||
public void setSwimming(boolean flag) {
|
||||
@@ -557,7 +557,7 @@
|
||||
this.setSharedFlag(4, flag);
|
||||
}
|
||||
|
||||
@@ -2174,8 +2510,12 @@
|
||||
@@ -2193,8 +2529,12 @@
|
||||
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
|
||||
}
|
||||
|
||||
@@ -571,7 +571,7 @@
|
||||
}
|
||||
|
||||
public boolean getSharedFlag(int i) {
|
||||
@@ -2194,7 +2534,7 @@
|
||||
@@ -2213,7 +2553,7 @@
|
||||
}
|
||||
|
||||
public int getMaxAirSupply() {
|
||||
@@ -580,7 +580,7 @@
|
||||
}
|
||||
|
||||
public int getAirSupply() {
|
||||
@@ -2202,7 +2542,18 @@
|
||||
@@ -2221,7 +2561,18 @@
|
||||
}
|
||||
|
||||
public void setAirSupply(int i) {
|
||||
@@ -600,7 +600,7 @@
|
||||
}
|
||||
|
||||
public int getTicksFrozen() {
|
||||
@@ -2229,11 +2580,41 @@
|
||||
@@ -2248,11 +2599,41 @@
|
||||
|
||||
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
||||
@@ -644,7 +644,7 @@
|
||||
}
|
||||
|
||||
public void onAboveBubbleCol(boolean flag) {
|
||||
@@ -2391,15 +2772,38 @@
|
||||
@@ -2417,15 +2798,38 @@
|
||||
|
||||
@Nullable
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
@@ -685,7 +685,7 @@
|
||||
this.level.getProfiler().popPush("reloading");
|
||||
Entity entity = this.getType().create(worldserver);
|
||||
|
||||
@@ -2408,9 +2812,17 @@
|
||||
@@ -2434,9 +2838,17 @@
|
||||
entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
|
||||
entity.setDeltaMovement(shapedetectorshape.speed);
|
||||
worldserver.addDuringTeleport(entity);
|
||||
@@ -705,7 +705,7 @@
|
||||
}
|
||||
|
||||
this.removeAfterChangingDimensions();
|
||||
@@ -2431,20 +2843,34 @@
|
||||
@@ -2457,20 +2869,34 @@
|
||||
|
||||
@Nullable
|
||||
protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) {
|
||||
@@ -745,18 +745,18 @@
|
||||
IBlockData iblockdata = this.level.getBlockState(this.portalEntrancePos);
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis;
|
||||
Vec3D vec3d;
|
||||
@@ -2461,8 +2887,8 @@
|
||||
@@ -2487,8 +2913,8 @@
|
||||
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
- return BlockPortalShape.createPortalInfo(worldserver, blockutil_rectangle, enumdirection_enumaxis, vec3d, this.getDimensions(this.getPose()), this.getDeltaMovement(), this.getYRot(), this.getXRot());
|
||||
- return BlockPortalShape.createPortalInfo(worldserver, blockutil_rectangle, enumdirection_enumaxis, vec3d, this, this.getDeltaMovement(), this.getYRot(), this.getXRot());
|
||||
- }).orElse((Object) null);
|
||||
+ return BlockPortalShape.createPortalInfo(worldserverFinal, blockutil_rectangle, enumdirection_enumaxis, vec3d, this.getDimensions(this.getPose()), this.getDeltaMovement(), this.getYRot(), this.getXRot(), event); // CraftBukkit
|
||||
+ return BlockPortalShape.createPortalInfo(worldserverFinal, blockutil_rectangle, enumdirection_enumaxis, vec3d, this, this.getDeltaMovement(), this.getYRot(), this.getXRot(), event); // CraftBukkit
|
||||
+ }).orElse(null); // CraftBukkit - decompile error
|
||||
}
|
||||
} else {
|
||||
BlockPosition blockposition1;
|
||||
@@ -2472,8 +2898,14 @@
|
||||
@@ -2498,8 +2924,14 @@
|
||||
} else {
|
||||
blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos());
|
||||
}
|
||||
@@ -772,7 +772,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2481,8 +2913,23 @@
|
||||
@@ -2507,8 +2939,23 @@
|
||||
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
|
||||
}
|
||||
|
||||
@@ -798,7 +798,7 @@
|
||||
}
|
||||
|
||||
public boolean canChangeDimensions() {
|
||||
@@ -2691,7 +3138,26 @@
|
||||
@@ -2731,7 +3178,26 @@
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
|
||||
@@ -826,7 +826,7 @@
|
||||
}
|
||||
|
||||
protected float getEyeHeight(EntityPose entitypose, EntitySize entitysize) {
|
||||
@@ -2979,6 +3445,11 @@
|
||||
@@ -3023,6 +3489,11 @@
|
||||
vec3d = vec3d.add(vec3d1);
|
||||
++k1;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/EntityAreaEffectCloud.java
|
||||
+++ b/net/minecraft/world/entity/EntityAreaEffectCloud.java
|
||||
@@ -32,6 +32,12 @@
|
||||
@@ -31,6 +31,12 @@
|
||||
import net.minecraft.world.level.material.EnumPistonReaction;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
public class EntityAreaEffectCloud extends Entity {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -127,6 +133,22 @@
|
||||
@@ -129,6 +135,22 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -25,18 +25,18 @@
|
||||
+ }
|
||||
+
|
||||
+ public String getPotionType() {
|
||||
+ return ((MinecraftKey) IRegistry.POTION.getKey(this.potion)).toString();
|
||||
+ return ((MinecraftKey) BuiltInRegistries.POTION.getKey(this.potion)).toString();
|
||||
+ }
|
||||
+
|
||||
+ public void setPotionType(String string) {
|
||||
+ setPotion(IRegistry.POTION.get(new MinecraftKey(string)));
|
||||
+ setPotion(BuiltInRegistries.POTION.get(new MinecraftKey(string)));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public int getColor() {
|
||||
return (Integer) this.getEntityData().get(EntityAreaEffectCloud.DATA_COLOR);
|
||||
}
|
||||
@@ -259,6 +281,7 @@
|
||||
@@ -261,6 +283,7 @@
|
||||
if (!list1.isEmpty()) {
|
||||
Iterator iterator1 = list1.iterator();
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
while (iterator1.hasNext()) {
|
||||
EntityLiving entityliving = (EntityLiving) iterator1.next();
|
||||
|
||||
@@ -268,6 +291,17 @@
|
||||
@@ -270,6 +293,17 @@
|
||||
double d8 = d6 * d6 + d7 * d7;
|
||||
|
||||
if (d8 <= (double) (f * f)) {
|
||||
@@ -62,7 +62,7 @@
|
||||
this.victims.put(entityliving, this.tickCount + this.reapplicationDelay);
|
||||
Iterator iterator2 = list.iterator();
|
||||
|
||||
@@ -277,7 +311,7 @@
|
||||
@@ -279,7 +313,7 @@
|
||||
if (mobeffect1.getEffect().isInstantenous()) {
|
||||
mobeffect1.getEffect().applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect1.getAmplifier(), 0.5D);
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/EntityExperienceOrb.java
|
||||
+++ b/net/minecraft/world/entity/EntityExperienceOrb.java
|
||||
@@ -20,6 +20,12 @@
|
||||
@@ -21,6 +21,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;
|
||||
@@ -58,6 +64,7 @@
|
||||
@@ -59,6 +65,7 @@
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
@@ -21,7 +21,7 @@
|
||||
this.xo = this.getX();
|
||||
this.yo = this.getY();
|
||||
this.zo = this.getZ();
|
||||
@@ -83,7 +90,22 @@
|
||||
@@ -84,7 +91,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();
|
||||
|
||||
@@ -226,7 +248,7 @@
|
||||
@@ -227,7 +249,7 @@
|
||||
int i = this.repairPlayerItems(entityhuman, this.value);
|
||||
|
||||
if (i > 0) {
|
||||
@@ -54,7 +54,7 @@
|
||||
}
|
||||
|
||||
--this.count;
|
||||
@@ -244,9 +266,17 @@
|
||||
@@ -245,9 +267,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 {
|
||||
@@ -271,6 +301,24 @@
|
||||
@@ -272,6 +302,24 @@
|
||||
}
|
||||
|
||||
public static int getExperienceValue(int i) {
|
||||
|
||||
@@ -135,26 +135,26 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -577,7 +650,7 @@
|
||||
@@ -576,7 +649,7 @@
|
||||
|
||||
protected void pickUpItem(EntityItem entityitem) {
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
- ItemStack itemstack1 = this.equipItemIfPossible(itemstack.copy());
|
||||
+ ItemStack itemstack1 = this.equipItemIfPossible(itemstack.copy(), entityitem); // CraftBukkit - add item
|
||||
|
||||
- if (this.equipItemIfPossible(itemstack)) {
|
||||
+ if (this.equipItemIfPossible(itemstack, entityitem)) { // CraftBukkit - add item
|
||||
if (!itemstack1.isEmpty()) {
|
||||
this.onItemPickup(entityitem);
|
||||
this.take(entityitem, itemstack.getCount());
|
||||
entityitem.discard();
|
||||
@@ -586,15 +659,29 @@
|
||||
@@ -590,15 +663,29 @@
|
||||
}
|
||||
|
||||
public boolean equipItemIfPossible(ItemStack itemstack) {
|
||||
public ItemStack equipItemIfPossible(ItemStack itemstack) {
|
||||
+ // CraftBukkit start - add item
|
||||
+ return this.equipItemIfPossible(itemstack, null);
|
||||
+ }
|
||||
+
|
||||
+ public boolean equipItemIfPossible(ItemStack itemstack, EntityItem entityitem) {
|
||||
+ public ItemStack equipItemIfPossible(ItemStack itemstack, EntityItem entityitem) {
|
||||
+ // CraftBukkit end
|
||||
EnumItemSlot enumitemslot = getEquipmentSlotForItem(itemstack);
|
||||
EnumItemSlot enumitemslot = this.getEquipmentSlotForItemStack(itemstack);
|
||||
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
|
||||
boolean flag = this.canReplaceCurrentItem(itemstack, itemstack1);
|
||||
|
||||
@@ -174,8 +174,8 @@
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
}
|
||||
|
||||
this.setItemSlotAndDropWhenKilled(enumitemslot, itemstack);
|
||||
@@ -732,6 +819,7 @@
|
||||
if (enumitemslot.isArmor() && itemstack.getCount() > 1) {
|
||||
@@ -750,6 +837,7 @@
|
||||
@Override
|
||||
protected final void serverAiStep() {
|
||||
++this.noActionTime;
|
||||
@@ -183,7 +183,7 @@
|
||||
this.level.getProfiler().push("sensing");
|
||||
this.sensing.tick();
|
||||
this.level.getProfiler().pop();
|
||||
@@ -1125,6 +1213,12 @@
|
||||
@@ -1143,6 +1231,12 @@
|
||||
if (!this.isAlive()) {
|
||||
return EnumInteractionResult.PASS;
|
||||
} else if (this.getLeashHolder() == entityhuman) {
|
||||
@@ -196,7 +196,7 @@
|
||||
this.dropLeash(true, !entityhuman.getAbilities().instabuild);
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
} else {
|
||||
@@ -1148,6 +1242,12 @@
|
||||
@@ -1166,6 +1260,12 @@
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack.is(Items.LEAD) && this.canBeLeashed(entityhuman)) {
|
||||
@@ -209,7 +209,7 @@
|
||||
this.setLeashedTo(entityhuman, true);
|
||||
itemstack.shrink(1);
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
@@ -1163,7 +1263,7 @@
|
||||
@@ -1181,7 +1281,7 @@
|
||||
if (itemstack.getItem() instanceof ItemMonsterEgg) {
|
||||
if (this.level instanceof WorldServer) {
|
||||
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
|
||||
@@ -218,7 +218,7 @@
|
||||
|
||||
optional.ifPresent((entityinsentient) -> {
|
||||
this.onOffspringSpawnedFromEgg(entityhuman, entityinsentient);
|
||||
@@ -1213,12 +1313,19 @@
|
||||
@@ -1231,12 +1331,19 @@
|
||||
return this.restrictRadius != -1.0F;
|
||||
}
|
||||
|
||||
@@ -237,23 +237,23 @@
|
||||
- T t0 = (EntityInsentient) entitytypes.create(this.level);
|
||||
+ T t0 = entitytypes.create(this.level); // CraftBukkit - decompile error
|
||||
|
||||
t0.copyPosition(this);
|
||||
t0.setBaby(this.isBaby());
|
||||
@@ -1250,7 +1357,12 @@
|
||||
if (t0 == null) {
|
||||
return null;
|
||||
@@ -1271,7 +1378,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- this.level.addFreshEntity(t0);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, t0, transformReason).isCancelled()) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ this.level.addFreshEntity(t0, spawnReason);
|
||||
+ // CraftBukkit end
|
||||
if (this.isPassenger()) {
|
||||
Entity entity = this.getVehicle();
|
||||
- this.level.addFreshEntity(t0);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, t0, transformReason).isCancelled()) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ this.level.addFreshEntity(t0, spawnReason);
|
||||
+ // CraftBukkit end
|
||||
if (this.isPassenger()) {
|
||||
Entity entity = this.getVehicle();
|
||||
|
||||
@@ -1270,6 +1382,7 @@
|
||||
@@ -1292,6 +1404,7 @@
|
||||
|
||||
if (this.leashHolder != null) {
|
||||
if (!this.isAlive() || !this.leashHolder.isAlive()) {
|
||||
@@ -261,7 +261,7 @@
|
||||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
@@ -1281,7 +1394,9 @@
|
||||
@@ -1303,7 +1416,9 @@
|
||||
this.leashHolder = null;
|
||||
this.leashInfoTag = null;
|
||||
if (!this.level.isClientSide && flag1) {
|
||||
@@ -271,7 +271,7 @@
|
||||
}
|
||||
|
||||
if (!this.level.isClientSide && flag && this.level instanceof WorldServer) {
|
||||
@@ -1331,6 +1446,7 @@
|
||||
@@ -1353,6 +1468,7 @@
|
||||
boolean flag1 = super.startRiding(entity, flag);
|
||||
|
||||
if (flag1 && this.isLeashed()) {
|
||||
@@ -279,7 +279,7 @@
|
||||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
@@ -1355,7 +1471,9 @@
|
||||
@@ -1377,7 +1493,9 @@
|
||||
}
|
||||
|
||||
if (this.tickCount > 100) {
|
||||
@@ -289,7 +289,7 @@
|
||||
this.leashInfoTag = null;
|
||||
}
|
||||
}
|
||||
@@ -1432,7 +1550,14 @@
|
||||
@@ -1458,7 +1576,14 @@
|
||||
int i = EnchantmentManager.getFireAspect(this);
|
||||
|
||||
if (i > 0) {
|
||||
@@ -305,7 +305,7 @@
|
||||
}
|
||||
|
||||
boolean flag = entity.hurt(DamageSource.mobAttack(this), f);
|
||||
@@ -1500,9 +1625,10 @@
|
||||
@@ -1532,9 +1657,10 @@
|
||||
@Override
|
||||
protected void removeAfterChangingDimensions() {
|
||||
super.removeAfterChangingDimensions();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/EntityLightning.java
|
||||
+++ b/net/minecraft/world/entity/EntityLightning.java
|
||||
@@ -31,6 +31,10 @@
|
||||
@@ -29,6 +29,10 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
public class EntityLightning extends Entity {
|
||||
|
||||
private static final int START_LIFE = 2;
|
||||
@@ -131,7 +135,7 @@
|
||||
@@ -129,7 +133,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
if (!(this.level instanceof WorldServer)) {
|
||||
this.level.setSkyFlashTime(2);
|
||||
} else if (!this.visualOnly) {
|
||||
@@ -165,8 +169,12 @@
|
||||
@@ -163,8 +167,12 @@
|
||||
IBlockData iblockdata = BlockFireAbstract.getState(this.level, blockposition);
|
||||
|
||||
if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
|
||||
@@ -35,7 +35,7 @@
|
||||
}
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
@@ -174,8 +182,12 @@
|
||||
@@ -172,8 +180,12 @@
|
||||
|
||||
iblockdata = BlockFireAbstract.getState(this.level, blockposition1);
|
||||
if (this.level.getBlockState(blockposition1).isAir() && iblockdata.canSurvive(this.level, blockposition1)) {
|
||||
@@ -50,7 +50,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,8 +251,9 @@
|
||||
@@ -237,8 +249,9 @@
|
||||
iblockdata = world.getBlockState(blockposition1);
|
||||
} while (!(iblockdata.getBlock() instanceof WeatheringCopper));
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/EntityLiving.java
|
||||
+++ b/net/minecraft/world/entity/EntityLiving.java
|
||||
@@ -118,6 +118,30 @@
|
||||
@@ -119,6 +119,30 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeam;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
public abstract class EntityLiving extends Entity {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -228,6 +252,20 @@
|
||||
@@ -229,6 +253,20 @@
|
||||
private float swimAmountO;
|
||||
protected BehaviorController<?> brain;
|
||||
private boolean skipDropExperience;
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
protected EntityLiving(EntityTypes<? extends EntityLiving> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -240,7 +278,9 @@
|
||||
@@ -241,7 +279,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();
|
||||
@@ -307,7 +347,13 @@
|
||||
@@ -308,7 +348,13 @@
|
||||
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
|
||||
int i = (int) (150.0D * d1);
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -661,10 +707,16 @@
|
||||
@@ -660,10 +706,16 @@
|
||||
}
|
||||
|
||||
public void onEquipItem(EnumItemSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1) {
|
||||
@@ -90,13 +90,13 @@
|
||||
+ // CraftBukkit end
|
||||
boolean flag = itemstack1.isEmpty() && itemstack.isEmpty();
|
||||
|
||||
if (!flag && !ItemStack.isSameIgnoreDurability(itemstack, itemstack1) && !this.firstTick) {
|
||||
if (!flag && !ItemStack.isSame(itemstack, itemstack1) && !this.firstTick) {
|
||||
- if (enumitemslot.getType() == EnumItemSlot.Function.ARMOR) {
|
||||
+ if (enumitemslot.getType() == EnumItemSlot.Function.ARMOR && !silent) { // CraftBukkit
|
||||
this.playEquipSound(itemstack1);
|
||||
}
|
||||
|
||||
@@ -742,6 +794,17 @@
|
||||
@@ -741,6 +793,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
if (nbttagcompound.contains("Health", 99)) {
|
||||
this.setHealth(nbttagcompound.getFloat("Health"));
|
||||
}
|
||||
@@ -779,9 +842,32 @@
|
||||
@@ -778,9 +841,32 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
try {
|
||||
while (iterator.hasNext()) {
|
||||
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
|
||||
@@ -791,6 +877,12 @@
|
||||
@@ -790,6 +876,12 @@
|
||||
this.onEffectUpdated(mobeffect, true, (Entity) null);
|
||||
})) {
|
||||
if (!this.level.isClientSide) {
|
||||
@@ -160,7 +160,7 @@
|
||||
iterator.remove();
|
||||
this.onEffectRemoved(mobeffect);
|
||||
}
|
||||
@@ -801,6 +893,17 @@
|
||||
@@ -800,6 +892,17 @@
|
||||
} catch (ConcurrentModificationException concurrentmodificationexception) {
|
||||
;
|
||||
}
|
||||
@@ -178,7 +178,7 @@
|
||||
|
||||
if (this.effectsDirty) {
|
||||
if (!this.level.isClientSide) {
|
||||
@@ -927,7 +1030,13 @@
|
||||
@@ -926,7 +1029,13 @@
|
||||
this.entityData.set(EntityLiving.DATA_EFFECT_COLOR_ID, 0);
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@
|
||||
if (this.level.isClientSide) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -936,7 +1045,14 @@
|
||||
@@ -935,7 +1044,14 @@
|
||||
boolean flag;
|
||||
|
||||
for (flag = false; iterator.hasNext(); flag = true) {
|
||||
@@ -208,7 +208,7 @@
|
||||
iterator.remove();
|
||||
}
|
||||
|
||||
@@ -965,18 +1081,48 @@
|
||||
@@ -964,18 +1080,48 @@
|
||||
return this.addEffect(mobeffect, (Entity) null);
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -1013,13 +1159,39 @@
|
||||
@@ -1012,13 +1158,39 @@
|
||||
return this.getMobType() == EnumMonsterType.UNDEAD;
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@
|
||||
|
||||
if (mobeffect != null) {
|
||||
this.onEffectRemoved(mobeffect);
|
||||
@@ -1056,20 +1228,55 @@
|
||||
@@ -1055,20 +1227,55 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@
|
||||
this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.clamp(f, 0.0F, this.getMaxHealth()));
|
||||
}
|
||||
|
||||
@@ -1083,7 +1290,7 @@
|
||||
@@ -1082,7 +1289,7 @@
|
||||
return false;
|
||||
} else if (this.level.isClientSide) {
|
||||
return false;
|
||||
@@ -365,7 +365,7 @@
|
||||
return false;
|
||||
} else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
|
||||
return false;
|
||||
@@ -1094,10 +1301,11 @@
|
||||
@@ -1093,10 +1300,11 @@
|
||||
|
||||
this.noActionTime = 0;
|
||||
float f1 = f;
|
||||
@@ -379,7 +379,7 @@
|
||||
this.hurtCurrentlyUsedShield(f);
|
||||
f2 = f;
|
||||
f = 0.0F;
|
||||
@@ -1115,27 +1323,46 @@
|
||||
@@ -1116,27 +1324,46 @@
|
||||
this.animationSpeed = 1.5F;
|
||||
boolean flag1 = true;
|
||||
|
||||
@@ -431,7 +431,7 @@
|
||||
this.hurtDir = 0.0F;
|
||||
Entity entity1 = damagesource.getEntity();
|
||||
|
||||
@@ -1258,19 +1485,32 @@
|
||||
@@ -1259,19 +1486,32 @@
|
||||
EnumHand[] aenumhand = EnumHand.values();
|
||||
int i = aenumhand.length;
|
||||
|
||||
@@ -468,7 +468,7 @@
|
||||
EntityPlayer entityplayer = (EntityPlayer) this;
|
||||
|
||||
entityplayer.awardStat(StatisticList.ITEM_USED.get(Items.TOTEM_OF_UNDYING));
|
||||
@@ -1278,14 +1518,16 @@
|
||||
@@ -1279,14 +1519,16 @@
|
||||
}
|
||||
|
||||
this.setHealth(1.0F);
|
||||
@@ -490,7 +490,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1390,14 +1632,22 @@
|
||||
@@ -1391,14 +1633,22 @@
|
||||
IBlockData iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
|
||||
|
||||
if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
|
||||
@@ -515,7 +515,7 @@
|
||||
this.level.addFreshEntity(entityitem);
|
||||
}
|
||||
}
|
||||
@@ -1417,21 +1667,40 @@
|
||||
@@ -1418,21 +1668,40 @@
|
||||
|
||||
boolean flag = this.lastHurtByPlayerTime > 0;
|
||||
|
||||
@@ -559,7 +559,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -1504,6 +1773,28 @@
|
||||
@@ -1517,6 +1786,28 @@
|
||||
return itemstack.getEatingSound();
|
||||
}
|
||||
|
||||
@@ -588,7 +588,7 @@
|
||||
@Override
|
||||
public void setOnGround(boolean flag) {
|
||||
super.setOnGround(flag);
|
||||
@@ -1559,9 +1850,14 @@
|
||||
@@ -1572,9 +1863,14 @@
|
||||
int i = this.calculateFallDamage(f, f1);
|
||||
|
||||
if (i > 0) {
|
||||
@@ -604,7 +604,7 @@
|
||||
return true;
|
||||
} else {
|
||||
return flag;
|
||||
@@ -1610,7 +1906,7 @@
|
||||
@@ -1623,7 +1919,7 @@
|
||||
|
||||
protected float getDamageAfterArmorAbsorb(DamageSource damagesource, float f) {
|
||||
if (!damagesource.isBypassArmor()) {
|
||||
@@ -613,7 +613,7 @@
|
||||
f = CombatMath.getDamageAfterAbsorb(f, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
|
||||
}
|
||||
|
||||
@@ -1623,7 +1919,8 @@
|
||||
@@ -1636,7 +1932,8 @@
|
||||
} else {
|
||||
int i;
|
||||
|
||||
@@ -623,7 +623,7 @@
|
||||
i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
|
||||
int j = 25 - i;
|
||||
float f1 = f * (float) j;
|
||||
@@ -1656,29 +1953,172 @@
|
||||
@@ -1669,29 +1966,172 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -806,7 +806,7 @@
|
||||
}
|
||||
|
||||
public CombatTracker getCombatTracker() {
|
||||
@@ -1699,9 +2139,19 @@
|
||||
@@ -1712,9 +2152,19 @@
|
||||
}
|
||||
|
||||
public final void setArrowCount(int i) {
|
||||
@@ -827,7 +827,7 @@
|
||||
public final int getStingerCount() {
|
||||
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
|
||||
}
|
||||
@@ -1996,6 +2446,12 @@
|
||||
@@ -2017,6 +2467,12 @@
|
||||
|
||||
public abstract ItemStack getItemBySlot(EnumItemSlot enumitemslot);
|
||||
|
||||
@@ -840,7 +840,7 @@
|
||||
@Override
|
||||
public abstract void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
|
||||
|
||||
@@ -2239,6 +2695,7 @@
|
||||
@@ -2256,6 +2712,7 @@
|
||||
}
|
||||
|
||||
if (this.onGround && !this.level.isClientSide) {
|
||||
@@ -848,7 +848,7 @@
|
||||
this.setSharedFlag(7, false);
|
||||
}
|
||||
} else {
|
||||
@@ -2772,6 +3229,7 @@
|
||||
@@ -2793,6 +3250,7 @@
|
||||
}
|
||||
|
||||
if (!this.level.isClientSide) {
|
||||
@@ -856,7 +856,7 @@
|
||||
this.setSharedFlag(7, flag);
|
||||
}
|
||||
|
||||
@@ -2931,14 +3389,21 @@
|
||||
@@ -2956,14 +3414,21 @@
|
||||
|
||||
@Override
|
||||
public boolean isPickable() {
|
||||
@@ -880,7 +880,7 @@
|
||||
@Override
|
||||
public float getYHeadRot() {
|
||||
return this.yHeadRot;
|
||||
@@ -3133,7 +3598,26 @@
|
||||
@@ -3158,7 +3623,26 @@
|
||||
} else {
|
||||
if (!this.useItem.isEmpty() && this.isUsingItem()) {
|
||||
this.triggerItemUseEffects(this.useItem, 16);
|
||||
@@ -908,7 +908,7 @@
|
||||
|
||||
if (itemstack != this.useItem) {
|
||||
this.setItemInHand(enumhand, itemstack);
|
||||
@@ -3211,6 +3695,12 @@
|
||||
@@ -3236,6 +3720,12 @@
|
||||
}
|
||||
|
||||
public boolean randomTeleport(double d0, double d1, double d2, boolean flag) {
|
||||
@@ -921,7 +921,7 @@
|
||||
double d3 = this.getX();
|
||||
double d4 = this.getY();
|
||||
double d5 = this.getZ();
|
||||
@@ -3235,16 +3725,41 @@
|
||||
@@ -3260,16 +3750,41 @@
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
@@ -966,7 +966,7 @@
|
||||
} else {
|
||||
if (flag) {
|
||||
world.broadcastEntityEvent(this, (byte) 46);
|
||||
@@ -3254,7 +3769,7 @@
|
||||
@@ -3279,7 +3794,7 @@
|
||||
((EntityCreature) this).getNavigation().stop();
|
||||
}
|
||||
|
||||
@@ -975,7 +975,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3337,7 +3852,7 @@
|
||||
@@ -3357,7 +3872,7 @@
|
||||
}
|
||||
|
||||
public void stopSleeping() {
|
||||
@@ -984,7 +984,7 @@
|
||||
World world = this.level;
|
||||
|
||||
java.util.Objects.requireNonNull(this.level);
|
||||
@@ -3369,7 +3884,7 @@
|
||||
@@ -3391,7 +3906,7 @@
|
||||
|
||||
@Nullable
|
||||
public EnumDirection getBedOrientation() {
|
||||
@@ -993,7 +993,7 @@
|
||||
|
||||
return blockposition != null ? BlockBed.getBedOrientation(this.level, blockposition) : null;
|
||||
}
|
||||
@@ -3417,7 +3932,7 @@
|
||||
@@ -3439,7 +3954,7 @@
|
||||
Pair<MobEffect, Float> pair = (Pair) iterator.next();
|
||||
|
||||
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
--- a/net/minecraft/world/entity/EntityTypes.java
|
||||
+++ b/net/minecraft/world/entity/EntityTypes.java
|
||||
@@ -159,7 +159,7 @@
|
||||
@@ -156,6 +156,7 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
public class EntityTypes<T extends Entity> implements FeatureElement, EntityTypeTest<Entity, T> {
|
||||
@@ -165,7 +166,7 @@
|
||||
private final Holder.c<EntityTypes<?>> builtInRegistryHolder;
|
||||
private static final float MAGIC_HORSE_WIDTH = 1.3964844F;
|
||||
public static final EntityTypes<Allay> ALLAY = register("allay", EntityTypes.Builder.of(Allay::new, EnumCreatureType.CREATURE).sized(0.35F, 0.6F).clientTrackingRange(8).updateInterval(2));
|
||||
@@ -9,28 +17,66 @@
|
||||
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));
|
||||
@@ -293,8 +293,8 @@
|
||||
private MinecraftKey lootTable;
|
||||
@@ -301,8 +302,8 @@
|
||||
private final EntitySize dimensions;
|
||||
private final FeatureFlagSet requiredFeatures;
|
||||
|
||||
- private static <T extends Entity> EntityTypes<T> register(String s, EntityTypes.Builder<T> entitytypes_builder) {
|
||||
- return (EntityTypes) IRegistry.register(IRegistry.ENTITY_TYPE, s, entitytypes_builder.build(s));
|
||||
- return (EntityTypes) IRegistry.register(BuiltInRegistries.ENTITY_TYPE, s, entitytypes_builder.build(s));
|
||||
+ private static <T extends Entity> EntityTypes<T> register(String s, EntityTypes.Builder entitytypes_builder) { // CraftBukkit - decompile error
|
||||
+ return (EntityTypes) IRegistry.register(IRegistry.ENTITY_TYPE, s, (EntityTypes<T>) entitytypes_builder.build(s)); // CraftBukkit - decompile error
|
||||
+ return (EntityTypes) IRegistry.register(BuiltInRegistries.ENTITY_TYPE, s, (EntityTypes<T>) entitytypes_builder.build(s)); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public static MinecraftKey getKey(EntityTypes<?> entitytypes) {
|
||||
@@ -326,10 +326,18 @@
|
||||
@@ -330,8 +331,15 @@
|
||||
|
||||
@Nullable
|
||||
public T spawn(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
|
||||
public T spawn(WorldServer worldserver, @Nullable ItemStack itemstack, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
|
||||
+ // CraftBukkit start
|
||||
+ return this.spawn(worldserver, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
|
||||
+ return this.spawn(worldserver, itemstack, entityhuman, blockposition, enummobspawn, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public T spawn(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
T t0 = this.create(worldserver, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1);
|
||||
+ public T spawn(WorldServer worldserver, @Nullable ItemStack itemstack, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ // CraftBukkit end
|
||||
NBTTagCompound nbttagcompound;
|
||||
- Consumer consumer;
|
||||
+ Consumer<T> consumer; // CraftBukkit - decompile error
|
||||
|
||||
if (itemstack != null) {
|
||||
nbttagcompound = itemstack.getTag();
|
||||
@@ -363,21 +371,37 @@
|
||||
NBTTagCompound nbttagcompound = itemstack.getTag();
|
||||
|
||||
return nbttagcompound != null ? consumer.andThen((entity) -> {
|
||||
- updateCustomEntityTag(worldserver, entityhuman, entity, nbttagcompound);
|
||||
+ try { updateCustomEntityTag(worldserver, entityhuman, entity, nbttagcompound); } catch (Throwable t) { LOGGER.warn("Error loading spawn egg NBT", t); } // CraftBukkit - SPIGOT-5665
|
||||
}) : consumer;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public T spawn(WorldServer worldserver, BlockPosition blockposition, EnumMobSpawn enummobspawn) {
|
||||
- return this.spawn(worldserver, (NBTTagCompound) null, (Consumer) null, blockposition, enummobspawn, false, false);
|
||||
+ // CraftBukkit start
|
||||
+ return this.spawn(worldserver, blockposition, enummobspawn, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public T spawn(WorldServer worldserver, BlockPosition blockposition, EnumMobSpawn enummobspawn, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ return this.spawn(worldserver, (NBTTagCompound) null, null, blockposition, enummobspawn, false, false, spawnReason); // CraftBukkit - decompile error
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public T spawn(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable Consumer<T> consumer, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
|
||||
+ // CraftBukkit start
|
||||
+ return this.spawn(worldserver, nbttagcompound, consumer, blockposition, enummobspawn, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public T spawn(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable Consumer<T> consumer, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ // CraftBukkit end
|
||||
T t0 = this.create(worldserver, nbttagcompound, consumer, blockposition, enummobspawn, flag, flag1);
|
||||
|
||||
if (t0 != null) {
|
||||
- worldserver.addFreshEntityWithPassengers(t0);
|
||||
@@ -40,16 +86,7 @@
|
||||
}
|
||||
|
||||
return t0;
|
||||
@@ -365,7 +373,7 @@
|
||||
t0.setCustomName(ichatbasecomponent);
|
||||
}
|
||||
|
||||
- updateCustomEntityTag(worldserver, entityhuman, t0, nbttagcompound);
|
||||
+ try { updateCustomEntityTag(worldserver, entityhuman, t0, nbttagcompound); } catch (Throwable t) { LOGGER.warn("Error loading spawn egg NBT", t); } // CraftBukkit - SPIGOT-5665
|
||||
return t0;
|
||||
}
|
||||
}
|
||||
@@ -512,7 +520,7 @@
|
||||
@@ -564,7 +588,7 @@
|
||||
}
|
||||
|
||||
return entity;
|
||||
@@ -58,7 +95,7 @@
|
||||
}
|
||||
|
||||
public static Stream<Entity> loadEntitiesRecursive(final List<? extends NBTBase> list, final World world) {
|
||||
@@ -569,7 +577,7 @@
|
||||
@@ -621,7 +645,7 @@
|
||||
|
||||
@Nullable
|
||||
public T tryCast(Entity entity) {
|
||||
@@ -67,7 +104,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -602,7 +610,7 @@
|
||||
@@ -656,7 +680,7 @@
|
||||
this.canSpawnFarFromPlayer = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetForget.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetForget.java
|
||||
@@ -10,6 +10,12 @@
|
||||
@@ -8,6 +8,12 @@
|
||||
import net.minecraft.world.entity.ai.behavior.declarative.BehaviorBuilder;
|
||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
|
||||
import net.minecraft.world.entity.ai.memory.MemoryStatus;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
@@ -10,24 +10,25 @@
|
||||
+import org.bukkit.event.entity.EntityTargetEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BehaviorAttackTargetForget<E extends EntityInsentient> extends Behavior<E> {
|
||||
public class BehaviorAttackTargetForget {
|
||||
|
||||
private static final int TIMEOUT_TO_GET_WITHIN_ATTACK_RANGE = 200;
|
||||
@@ -83,6 +89,17 @@
|
||||
}
|
||||
|
||||
protected void clearAttackTarget(E e0) {
|
||||
+ // CraftBukkit start
|
||||
+ EntityLiving old = e0.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null);
|
||||
+ EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(e0, null, (old != null && !old.isAlive()) ? EntityTargetEvent.TargetReason.TARGET_DIED : EntityTargetEvent.TargetReason.FORGOT_TARGET);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (event.getTarget() != null) {
|
||||
+ e0.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, ((CraftLivingEntity) event.getTarget()).getHandle());
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.onTargetErased.accept(e0, this.getAttackTarget(e0));
|
||||
e0.getBrain().eraseMemory(MemoryModuleType.ATTACK_TARGET);
|
||||
}
|
||||
@@ -41,6 +47,18 @@
|
||||
if (entityinsentient.canAttack(entityliving) && (!flag || !isTiredOfTryingToReachTarget(entityinsentient, behaviorbuilder_b.tryGet(memoryaccessor1))) && entityliving.isAlive() && entityliving.level == entityinsentient.level && !predicate.test(entityliving)) {
|
||||
return true;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ EntityLiving old = entityinsentient.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null);
|
||||
+ EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(entityinsentient, null, (old != null && !old.isAlive()) ? EntityTargetEvent.TargetReason.TARGET_DIED : EntityTargetEvent.TargetReason.FORGOT_TARGET);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (event.getTarget() == null) {
|
||||
+ memoryaccessor.erase();
|
||||
+ return true;
|
||||
+ }
|
||||
+ entityliving = ((CraftLivingEntity) event.getTarget()).getHandle();
|
||||
+ // CraftBukkit end
|
||||
biconsumer.accept(entityinsentient, entityliving);
|
||||
memoryaccessor.erase();
|
||||
return true;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetSet.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetSet.java
|
||||
@@ -10,6 +10,13 @@
|
||||
@@ -8,6 +8,13 @@
|
||||
import net.minecraft.world.entity.ai.behavior.declarative.BehaviorBuilder;
|
||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
|
||||
import net.minecraft.world.entity.ai.memory.MemoryStatus;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.server.level.EntityPlayer;
|
||||
@@ -11,30 +11,24 @@
|
||||
+import org.bukkit.event.entity.EntityTargetEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BehaviorAttackTargetSet<E extends EntityInsentient> extends Behavior<E> {
|
||||
public class BehaviorAttackTargetSet {
|
||||
|
||||
private final Predicate<E> canAttackPredicate;
|
||||
@@ -42,13 +49,21 @@
|
||||
}
|
||||
|
||||
protected void start(WorldServer worldserver, E e0, long i) {
|
||||
- ((Optional) this.targetFinderFunction.apply(e0)).ifPresent((entityliving) -> {
|
||||
+ (this.targetFinderFunction.apply(e0)).ifPresent((entityliving) -> { // CraftBukkit - decompile error
|
||||
setAttackTarget(e0, entityliving);
|
||||
});
|
||||
}
|
||||
|
||||
public static <E extends EntityInsentient> void setAttackTarget(E e0, EntityLiving entityliving) {
|
||||
- e0.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, (Object) entityliving);
|
||||
+ // CraftBukkit start
|
||||
+ EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(e0, entityliving, (entityliving instanceof EntityPlayer) ? EntityTargetEvent.TargetReason.CLOSEST_PLAYER : EntityTargetEvent.TargetReason.CLOSEST_ENTITY);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ entityliving = (event.getTarget() != null) ? ((CraftLivingEntity) event.getTarget()).getHandle() : null;
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ e0.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, entityliving); // CraftBukkit - decompile error
|
||||
e0.getBrain().eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
|
||||
}
|
||||
}
|
||||
public BehaviorAttackTargetSet() {}
|
||||
@@ -35,6 +42,17 @@
|
||||
if (!entityinsentient.canAttack(entityliving)) {
|
||||
return false;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(entityinsentient, entityliving, (entityliving instanceof EntityPlayer) ? EntityTargetEvent.TargetReason.CLOSEST_PLAYER : EntityTargetEvent.TargetReason.CLOSEST_ENTITY);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (event.getTarget() == null) {
|
||||
+ memoryaccessor.erase();
|
||||
+ return true;
|
||||
+ }
|
||||
+ entityliving = ((CraftLivingEntity) event.getTarget()).getHandle();
|
||||
+ // CraftBukkit end
|
||||
memoryaccessor.set(entityliving);
|
||||
memoryaccessor1.erase();
|
||||
return true;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorCareer.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorCareer.java
|
||||
@@ -12,6 +12,12 @@
|
||||
@@ -9,6 +9,12 @@
|
||||
import net.minecraft.world.entity.npc.EntityVillager;
|
||||
import net.minecraft.world.entity.npc.VillagerProfession;
|
||||
|
||||
@@ -10,31 +10,22 @@
|
||||
+import org.bukkit.event.entity.VillagerCareerChangeEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BehaviorCareer extends Behavior<EntityVillager> {
|
||||
public class BehaviorCareer {
|
||||
|
||||
public BehaviorCareer() {
|
||||
@@ -28,7 +34,7 @@
|
||||
GlobalPos globalpos = (GlobalPos) entityvillager.getBrain().getMemory(MemoryModuleType.POTENTIAL_JOB_SITE).get();
|
||||
|
||||
entityvillager.getBrain().eraseMemory(MemoryModuleType.POTENTIAL_JOB_SITE);
|
||||
- entityvillager.getBrain().setMemory(MemoryModuleType.JOB_SITE, (Object) globalpos);
|
||||
+ entityvillager.getBrain().setMemory(MemoryModuleType.JOB_SITE, globalpos); // CraftBukkit - decompile error
|
||||
worldserver.broadcastEntityEvent(entityvillager, (byte) 14);
|
||||
if (entityvillager.getVillagerData().getProfession() == VillagerProfession.NONE) {
|
||||
MinecraftServer minecraftserver = worldserver.getServer();
|
||||
@@ -40,7 +46,14 @@
|
||||
return villagerprofession.heldJobSite().test(holder);
|
||||
}).findFirst();
|
||||
}).ifPresent((villagerprofession) -> {
|
||||
- entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(villagerprofession));
|
||||
+ // CraftBukkit start - Fire VillagerCareerChangeEvent where Villager gets employed
|
||||
+ VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(entityvillager, CraftVillager.nmsToBukkitProfession(villagerprofession), VillagerCareerChangeEvent.ChangeReason.EMPLOYED);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
public BehaviorCareer() {}
|
||||
@@ -37,7 +43,14 @@
|
||||
return villagerprofession.heldJobSite().test(holder);
|
||||
}).findFirst();
|
||||
}).ifPresent((villagerprofession) -> {
|
||||
- entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(villagerprofession));
|
||||
+ // CraftBukkit start - Fire VillagerCareerChangeEvent where Villager gets employed
|
||||
+ VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(entityvillager, CraftVillager.nmsToBukkitProfession(villagerprofession), VillagerCareerChangeEvent.ChangeReason.EMPLOYED);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
|
||||
+ // CraftBukkit end
|
||||
entityvillager.refreshBrain(worldserver);
|
||||
});
|
||||
}
|
||||
+ entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
|
||||
+ // CraftBukkit end
|
||||
entityvillager.refreshBrain(worldserver);
|
||||
});
|
||||
return true;
|
||||
|
||||
@@ -1,28 +1,23 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorFindAdmirableItem.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorFindAdmirableItem.java
|
||||
@@ -35,6 +35,25 @@
|
||||
@@ -28,6 +28,20 @@
|
||||
EntityItem entityitem = (EntityItem) behaviorbuilder_b.get(memoryaccessor2);
|
||||
|
||||
@Override
|
||||
protected void start(WorldServer worldserver, E e0, long i) {
|
||||
+ // CraftBukkit start
|
||||
+ if (e0 instanceof net.minecraft.world.entity.animal.allay.Allay) {
|
||||
+ Entity target = this.getClosestLovedItem(e0);
|
||||
+ org.bukkit.event.entity.EntityTargetEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(e0, target, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_ENTITY);
|
||||
if (behaviorbuilder_b.tryGet(memoryaccessor3).isEmpty() && predicate.test(entityliving) && entityitem.closerThan(entityliving, (double) i) && entityliving.level.getWorldBorder().isWithinBounds(entityitem.blockPosition())) {
|
||||
+ // CraftBukkit start
|
||||
+ if (entityliving instanceof net.minecraft.world.entity.animal.allay.Allay) {
|
||||
+ org.bukkit.event.entity.EntityTargetEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(entityliving, entityitem, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_ENTITY);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (!(event.getTarget() instanceof EntityItem)) {
|
||||
+ memoryaccessor2.erase();
|
||||
+ }
|
||||
+
|
||||
+ target = (event.getTarget() == null) ? null : ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle();
|
||||
+ if (target instanceof EntityItem item) {
|
||||
+ e0.getBrain().setMemory(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, java.util.Optional.of(item));
|
||||
+ BehaviorUtil.setWalkAndLookTargetMemories(e0, target, this.speedModifier, 0);
|
||||
+ } else {
|
||||
+ e0.getBrain().eraseMemory(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
BehaviorUtil.setWalkAndLookTargetMemories(e0, (Entity) this.getClosestLovedItem(e0), this.speedModifier, 0);
|
||||
}
|
||||
+ entityitem = (EntityItem) ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
MemoryTarget memorytarget = new MemoryTarget(new BehaviorPositionEntity(entityitem, false), f, 0);
|
||||
|
||||
memoryaccessor.set(new BehaviorPositionEntity(entityitem, true));
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorFollowAdult.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorFollowAdult.java
|
||||
@@ -10,6 +10,13 @@
|
||||
@@ -8,6 +8,13 @@
|
||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
|
||||
import net.minecraft.world.entity.ai.memory.MemoryStatus;
|
||||
import net.minecraft.world.entity.ai.memory.MemoryTarget;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
@@ -11,25 +11,28 @@
|
||||
+import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BehaviorFollowAdult<E extends EntityAgeable> extends Behavior<E> {
|
||||
public class BehaviorFollowAdult {
|
||||
|
||||
private final UniformInt followRange;
|
||||
@@ -38,7 +45,17 @@
|
||||
}
|
||||
public BehaviorFollowAdult() {}
|
||||
@@ -25,9 +32,20 @@
|
||||
if (!entityageable.isBaby()) {
|
||||
return false;
|
||||
} else {
|
||||
- EntityAgeable entityageable1 = (EntityAgeable) behaviorbuilder_b.get(memoryaccessor);
|
||||
+ EntityLiving entityageable1 = (EntityAgeable) behaviorbuilder_b.get(memoryaccessor); // CraftBukkit - type
|
||||
|
||||
protected void start(WorldServer worldserver, E e0, long i) {
|
||||
- BehaviorUtil.setWalkAndLookTargetMemories(e0, (Entity) this.getNearestAdult(e0), (Float) this.speedModifier.apply(e0), this.followRange.getMinValue() - 1);
|
||||
+ // CraftBukkit start
|
||||
+ EntityTargetLivingEntityEvent event = CraftEventFactory.callEntityTargetLivingEvent(e0, this.getNearestAdult(e0), EntityTargetEvent.TargetReason.FOLLOW_LEADER);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (event.getTarget() != null) {
|
||||
+ BehaviorUtil.setWalkAndLookTargetMemories(e0, ((CraftLivingEntity) event.getTarget()).getHandle(), this.speedModifier.apply(e0), this.followRange.getMinValue() - 1);
|
||||
+ } else {
|
||||
+ e0.getBrain().eraseMemory(MemoryModuleType.NEAREST_VISIBLE_ADULT);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
if (entityageable.closerThan(entityageable1, (double) (uniformint.getMaxValue() + 1)) && !entityageable.closerThan(entityageable1, (double) uniformint.getMinValue())) {
|
||||
+ // CraftBukkit start
|
||||
+ EntityTargetLivingEntityEvent event = CraftEventFactory.callEntityTargetLivingEvent(entityageable, entityageable1, EntityTargetEvent.TargetReason.FOLLOW_LEADER);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (event.getTarget() == null) {
|
||||
+ memoryaccessor.erase();
|
||||
+ return true;
|
||||
+ }
|
||||
+ entityageable1 = ((CraftLivingEntity) event.getTarget()).getHandle();
|
||||
+ // CraftBukkit end
|
||||
MemoryTarget memorytarget = new MemoryTarget(new BehaviorPositionEntity(entityageable1, false), (Float) function.apply(entityageable), uniformint.getMinValue() - 1);
|
||||
|
||||
private EntityAgeable getNearestAdult(E e0) {
|
||||
memoryaccessor1.set(new BehaviorPositionEntity(entityageable1, true));
|
||||
|
||||
@@ -1,48 +1,39 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorInteractDoor.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorInteractDoor.java
|
||||
@@ -69,6 +69,13 @@
|
||||
BlockDoor blockdoor = (BlockDoor) iblockdata.getBlock();
|
||||
@@ -61,6 +61,13 @@
|
||||
BlockDoor blockdoor = (BlockDoor) iblockdata.getBlock();
|
||||
|
||||
if (!blockdoor.isOpen(iblockdata)) {
|
||||
+ // CraftBukkit start - entities opening doors
|
||||
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.level, blockposition));
|
||||
+ entityliving.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
blockdoor.setOpen(entityliving, worldserver, iblockdata, blockposition, true);
|
||||
}
|
||||
if (!blockdoor.isOpen(iblockdata)) {
|
||||
+ // CraftBukkit start - entities opening doors
|
||||
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.level, blockposition));
|
||||
+ entityliving.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
blockdoor.setOpen(entityliving, worldserver, iblockdata, blockposition, true);
|
||||
}
|
||||
|
||||
@@ -84,6 +91,13 @@
|
||||
BlockDoor blockdoor1 = (BlockDoor) iblockdata1.getBlock();
|
||||
@@ -76,6 +83,13 @@
|
||||
BlockDoor blockdoor1 = (BlockDoor) iblockdata1.getBlock();
|
||||
|
||||
if (!blockdoor1.isOpen(iblockdata1)) {
|
||||
+ // CraftBukkit start - entities opening doors
|
||||
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.level, blockposition1));
|
||||
+ entityliving.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
blockdoor1.setOpen(entityliving, worldserver, iblockdata1, blockposition1, true);
|
||||
this.rememberDoorToClose(worldserver, entityliving, blockposition1);
|
||||
}
|
||||
@@ -134,7 +148,7 @@
|
||||
private static boolean areOtherMobsComingThroughDoor(WorldServer worldserver, EntityLiving entityliving, BlockPosition blockposition) {
|
||||
BehaviorController<?> behaviorcontroller = entityliving.getBrain();
|
||||
if (!blockdoor1.isOpen(iblockdata1)) {
|
||||
+ // CraftBukkit start - entities opening doors
|
||||
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.level, blockposition1));
|
||||
+ entityliving.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
blockdoor1.setOpen(entityliving, worldserver, iblockdata1, blockposition1, true);
|
||||
optional = rememberDoorToClose(memoryaccessor1, optional, worldserver, blockposition1);
|
||||
}
|
||||
@@ -129,7 +143,7 @@
|
||||
}
|
||||
|
||||
- return !behaviorcontroller.hasMemoryValue(MemoryModuleType.NEAREST_LIVING_ENTITIES) ? false : ((List) behaviorcontroller.getMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES).get()).stream().filter((entityliving1) -> {
|
||||
+ return !behaviorcontroller.hasMemoryValue(MemoryModuleType.NEAREST_LIVING_ENTITIES) ? false : (behaviorcontroller.getMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES).get()).stream().filter((entityliving1) -> { // CraftBukkit - decompile error
|
||||
private static boolean areOtherMobsComingThroughDoor(EntityLiving entityliving, BlockPosition blockposition, Optional<List<EntityLiving>> optional) {
|
||||
- return optional.isEmpty() ? false : ((List) optional.get()).stream().filter((entityliving1) -> {
|
||||
+ return optional.isEmpty() ? false : (optional.get()).stream().filter((entityliving1) -> { // CraftBukkit - decompile error
|
||||
return entityliving1.getType() == entityliving.getType();
|
||||
}).filter((entityliving1) -> {
|
||||
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 {
|
||||
- behaviorcontroller.setMemory(MemoryModuleType.DOORS_TO_CLOSE, (Object) Sets.newHashSet(new GlobalPos[]{globalpos}));
|
||||
+ behaviorcontroller.setMemory(MemoryModuleType.DOORS_TO_CLOSE, Sets.newHashSet(new GlobalPos[]{globalpos})); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorProfession.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorProfession.java
|
||||
@@ -8,6 +8,12 @@
|
||||
@@ -6,6 +6,12 @@
|
||||
import net.minecraft.world.entity.npc.VillagerData;
|
||||
import net.minecraft.world.entity.npc.VillagerProfession;
|
||||
|
||||
@@ -10,22 +10,22 @@
|
||||
+import org.bukkit.event.entity.VillagerCareerChangeEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BehaviorProfession extends Behavior<EntityVillager> {
|
||||
public class BehaviorProfession {
|
||||
|
||||
public BehaviorProfession() {
|
||||
@@ -21,7 +27,14 @@
|
||||
}
|
||||
public BehaviorProfession() {}
|
||||
@@ -17,7 +23,14 @@
|
||||
VillagerData villagerdata = entityvillager.getVillagerData();
|
||||
|
||||
protected void start(WorldServer worldserver, EntityVillager entityvillager, long i) {
|
||||
- entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(VillagerProfession.NONE));
|
||||
+ // CraftBukkit start
|
||||
+ VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(entityvillager, CraftVillager.nmsToBukkitProfession(VillagerProfession.NONE), VillagerCareerChangeEvent.ChangeReason.LOSING_JOB);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
if (villagerdata.getProfession() != VillagerProfession.NONE && villagerdata.getProfession() != VillagerProfession.NITWIT && entityvillager.getVillagerXp() == 0 && villagerdata.getLevel() <= 1) {
|
||||
- entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(VillagerProfession.NONE));
|
||||
+ // CraftBukkit start
|
||||
+ VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(entityvillager, CraftVillager.nmsToBukkitProfession(VillagerProfession.NONE), VillagerCareerChangeEvent.ChangeReason.LOSING_JOB);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
|
||||
+ // CraftBukkit end
|
||||
entityvillager.refreshBrain(worldserver);
|
||||
}
|
||||
}
|
||||
+ entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
|
||||
+ // CraftBukkit end
|
||||
entityvillager.refreshBrain(worldserver);
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorUtil.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorUtil.java
|
||||
@@ -61,7 +61,7 @@
|
||||
@@ -60,7 +60,7 @@
|
||||
}
|
||||
|
||||
public static void lookAtEntity(EntityLiving entityliving, EntityLiving entityliving1) {
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
private static void setWalkAndLookTargetMemoriesToEachOther(EntityLiving entityliving, EntityLiving entityliving1, float f) {
|
||||
@@ -82,8 +82,8 @@
|
||||
@@ -81,8 +81,8 @@
|
||||
public static void setWalkAndLookTargetMemories(EntityLiving entityliving, BehaviorPosition behaviorposition, float f, int i) {
|
||||
MemoryTarget memorytarget = new MemoryTarget(behaviorposition, f, i);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
}
|
||||
|
||||
public static void throwItem(EntityLiving entityliving, ItemStack itemstack, Vec3D vec3d) {
|
||||
@@ -93,6 +93,7 @@
|
||||
@@ -92,6 +92,7 @@
|
||||
}
|
||||
|
||||
public static void throwItem(EntityLiving entityliving, ItemStack itemstack, Vec3D vec3d, Vec3D vec3d1, float f) {
|
||||
@@ -28,7 +28,7 @@
|
||||
double d0 = entityliving.getEyeY() - (double) f;
|
||||
EntityItem entityitem = new EntityItem(entityliving.level, entityliving.getX(), d0, entityliving.getZ(), itemstack);
|
||||
|
||||
@@ -102,12 +103,19 @@
|
||||
@@ -101,12 +102,19 @@
|
||||
vec3d2 = vec3d2.normalize().multiply(vec3d1.x, vec3d1.y, vec3d1.z);
|
||||
entityitem.setDeltaMovement(vec3d2);
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
@@ -82,8 +96,8 @@
|
||||
|
||||
protected void tick(WorldServer worldserver, E e0, long i) {
|
||||
if (this.ramCandidate.isPresent()) {
|
||||
if (!this.ramCandidate.isEmpty()) {
|
||||
- e0.getBrain().setMemory(MemoryModuleType.WALK_TARGET, (Object) (new MemoryTarget(((PrepareRamNearestTarget.a) this.ramCandidate.get()).getStartPosition(), this.walkSpeed, 0)));
|
||||
- e0.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorPositionEntity(((PrepareRamNearestTarget.a) this.ramCandidate.get()).getTarget(), true)));
|
||||
+ e0.getBrain().setMemory(MemoryModuleType.WALK_TARGET, (new MemoryTarget(((PrepareRamNearestTarget.a) this.ramCandidate.get()).getStartPosition(), this.walkSpeed, 0))); // CraftBukkit - decompile error
|
||||
@@ -54,7 +54,7 @@
|
||||
if (i - (Long) this.reachedRamPositionTimestamp.get() >= (long) this.ramPrepareTime) {
|
||||
- e0.getBrain().setMemory(MemoryModuleType.RAM_TARGET, (Object) this.getEdgeOfBlock(blockposition, ((PrepareRamNearestTarget.a) this.ramCandidate.get()).getTargetPosition()));
|
||||
+ e0.getBrain().setMemory(MemoryModuleType.RAM_TARGET, this.getEdgeOfBlock(blockposition, ((PrepareRamNearestTarget.a) this.ramCandidate.get()).getTargetPosition())); // CraftBukkit - decompile error
|
||||
worldserver.playSound((EntityHuman) null, (Entity) e0, (SoundEffect) this.getPrepareRamSound.apply(e0), SoundCategory.HOSTILE, 1.0F, e0.getVoicePitch());
|
||||
worldserver.playSound((EntityHuman) null, (Entity) e0, (SoundEffect) this.getPrepareRamSound.apply(e0), SoundCategory.NEUTRAL, 1.0F, e0.getVoicePitch());
|
||||
this.ramCandidate = Optional.empty();
|
||||
}
|
||||
@@ -152,7 +166,7 @@
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/ai/sensing/TemptingSensor.java
|
||||
+++ b/net/minecraft/world/entity/ai/sensing/TemptingSensor.java
|
||||
@@ -17,6 +17,14 @@
|
||||
@@ -18,6 +18,14 @@
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.RecipeItemStack;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
public class TemptingSensor extends Sensor<EntityCreature> {
|
||||
|
||||
public static final int TEMPTATION_RANGE = 10;
|
||||
@@ -29,7 +37,7 @@
|
||||
@@ -30,7 +38,7 @@
|
||||
|
||||
protected void doTick(WorldServer worldserver, EntityCreature entitycreature) {
|
||||
BehaviorController<?> behaviorcontroller = entitycreature.getBrain();
|
||||
@@ -24,7 +24,7 @@
|
||||
return TemptingSensor.TEMPT_TARGETING.test(entitycreature, entityplayer);
|
||||
}).filter((entityplayer) -> {
|
||||
return entitycreature.closerThan(entityplayer, 10.0D);
|
||||
@@ -41,7 +49,17 @@
|
||||
@@ -44,7 +52,17 @@
|
||||
if (!list.isEmpty()) {
|
||||
EntityHuman entityhuman = (EntityHuman) list.get(0);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public class EntityBat extends EntityAmbient {
|
||||
|
||||
public static final float FLAP_DEGREES_PER_TICK = 74.48451F;
|
||||
@@ -137,16 +139,24 @@
|
||||
@@ -140,16 +142,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())) {
|
||||
@@ -170,7 +180,11 @@
|
||||
@@ -173,7 +183,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 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +214,11 @@
|
||||
@@ -203,7 +217,11 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.level.isClientSide && this.isResting()) {
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
+ if (playerBucketFishEvent.isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).containerMenu.sendAllDataToRemote(); // We need to update inventory to resync client's bucket
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutSpawnEntity(t0)); // We need to play out these packets as the client assumes the fish is gone
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutEntityMetadata(t0.getId(), t0.getEntityData(), true)); // Need to send data such as the display name to client
|
||||
+ t0.getEntityData().refresh((EntityPlayer) entityhuman); // Need to send data such as the display name to client
|
||||
+ return Optional.of(EnumInteractionResult.FAIL);
|
||||
+ }
|
||||
+ t0.playSound(((Bucketable) t0).getPickupSound(), 1.0F, 1.0F);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -643,11 +643,15 @@
|
||||
@@ -646,11 +646,15 @@
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -27,7 +27,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1223,7 +1227,7 @@
|
||||
@@ -1226,7 +1230,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();
|
||||
@@ -1296,7 +1300,7 @@
|
||||
@@ -1299,7 +1303,7 @@
|
||||
@Override
|
||||
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
if (entityinsentient instanceof EntityBee && this.mob.hasLineOfSight(entityliving)) {
|
||||
@@ -45,7 +45,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1305,7 +1309,7 @@
|
||||
@@ -1308,7 +1312,7 @@
|
||||
private static class c extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
|
||||
|
||||
c(EntityBee entitybee) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityCat.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityCat.java
|
||||
@@ -410,7 +410,7 @@
|
||||
@@ -415,7 +415,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);
|
||||
@@ -467,7 +467,7 @@
|
||||
@@ -472,7 +472,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) {
|
||||
@@ -608,7 +608,15 @@
|
||||
@@ -613,7 +613,15 @@
|
||||
while (iterator.hasNext()) {
|
||||
ItemStack itemstack = (ItemStack) iterator.next();
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -640,10 +648,10 @@
|
||||
@@ -645,10 +653,10 @@
|
||||
private final EntityCat cat;
|
||||
|
||||
public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityChicken.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityChicken.java
|
||||
@@ -95,7 +95,9 @@
|
||||
@@ -96,7 +96,9 @@
|
||||
this.flap += this.flapping * 2.0F;
|
||||
if (!this.level.isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0) {
|
||||
this.playSound(SoundEffects.CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityCow.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityCow.java
|
||||
@@ -30,6 +30,11 @@
|
||||
@@ -31,6 +31,11 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class EntityCow extends EntityAnimal {
|
||||
|
||||
public EntityCow(EntityTypes<? extends EntityCow> entitytypes, World world) {
|
||||
@@ -82,8 +87,16 @@
|
||||
@@ -83,8 +88,16 @@
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityFox.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityFox.java
|
||||
@@ -511,7 +511,8 @@
|
||||
@@ -516,7 +516,8 @@
|
||||
protected void pickUpItem(EntityItem entityitem) {
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
int i = itemstack.getCount();
|
||||
|
||||
if (i > 1) {
|
||||
@@ -866,6 +867,16 @@
|
||||
@@ -871,6 +872,16 @@
|
||||
if (entityplayer1 != null && entityplayer != entityplayer1) {
|
||||
entityfox.addTrustedUUID(entityplayer1.getUUID());
|
||||
}
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
if (entityplayer2 != null) {
|
||||
entityplayer2.awardStat(StatisticList.ANIMALS_BRED);
|
||||
@@ -876,12 +887,14 @@
|
||||
@@ -881,12 +892,14 @@
|
||||
this.partner.setAge(6000);
|
||||
this.animal.resetLove();
|
||||
this.partner.resetLove();
|
||||
@@ -46,7 +46,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1272,13 +1285,18 @@
|
||||
@@ -1277,13 +1290,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);
|
||||
|
||||
@@ -1435,7 +1453,7 @@
|
||||
@@ -1440,7 +1458,7 @@
|
||||
private EntityLiving trustedLastHurt;
|
||||
private int timestamp;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityMushroomCow.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityMushroomCow.java
|
||||
@@ -43,6 +43,13 @@
|
||||
@@ -42,6 +42,13 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
+import org.bukkit.event.entity.EntityTransformEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityMushroomCow extends EntityCow implements IShearable {
|
||||
public class EntityMushroomCow extends EntityCow implements IShearable, VariantHolder<EntityMushroomCow.Type> {
|
||||
|
||||
private static final DataWatcherObject<String> DATA_TYPE = DataWatcher.defineId(EntityMushroomCow.class, DataWatcherRegistry.STRING);
|
||||
@@ -116,6 +123,11 @@
|
||||
@@ -115,6 +122,11 @@
|
||||
this.playSound(soundeffect, 1.0F, 1.0F);
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
} else if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
|
||||
@@ -26,40 +26,40 @@
|
||||
this.shear(SoundCategory.PLAYERS);
|
||||
this.gameEvent(GameEvent.SHEAR, entityhuman);
|
||||
if (!this.level.isClientSide) {
|
||||
@@ -163,7 +175,7 @@
|
||||
this.level.playSound((EntityHuman) null, (Entity) this, SoundEffects.MOOSHROOM_SHEAR, soundcategory, 1.0F, 1.0F);
|
||||
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);
|
||||
- this.discard();
|
||||
+ // this.discard(); // CraftBukkit - moved down
|
||||
EntityCow entitycow = (EntityCow) EntityTypes.COW.create(this.level);
|
||||
@@ -165,7 +177,7 @@
|
||||
|
||||
entitycow.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
|
||||
if (entitycow != null) {
|
||||
((WorldServer) this.level).sendParticles(Particles.EXPLOSION, this.getX(), this.getY(0.5D), this.getZ(), 1, 0.0D, 0.0D, 0.0D, 0.0D);
|
||||
- this.discard();
|
||||
+ // this.discard(); // CraftBukkit - moved down
|
||||
entitycow.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
|
||||
entitycow.setHealth(this.getHealth());
|
||||
entitycow.yBodyRot = this.yBodyRot;
|
||||
@@ -179,10 +191,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
entitycow.setInvulnerable(this.isInvulnerable());
|
||||
- this.level.addFreshEntity(entitycow);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ this.level.addFreshEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
|
||||
+
|
||||
+ this.discard(); // CraftBukkit - from above
|
||||
+ // CraftBukkit end
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
- this.level.addFreshEntity(new EntityItem(this.level, this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getMushroomType().blockState.getBlock())));
|
||||
entitycow.setInvulnerable(this.isInvulnerable());
|
||||
- this.level.addFreshEntity(entitycow);
|
||||
+ // CraftBukkit start
|
||||
+ EntityItem entityitem = new EntityItem(this.level, this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getMushroomType().blockState.getBlock()));
|
||||
+ EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ continue;
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ this.level.addFreshEntity(entityitem);
|
||||
+ this.level.addFreshEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
|
||||
+
|
||||
+ this.discard(); // CraftBukkit - from above
|
||||
+ // CraftBukkit end
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
- this.level.addFreshEntity(new EntityItem(this.level, this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getVariant().blockState.getBlock())));
|
||||
+ // CraftBukkit start
|
||||
+ EntityItem entityitem = new EntityItem(this.level, this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getVariant().blockState.getBlock()));
|
||||
+ EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ this.level.addFreshEntity(entityitem);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
this.setTrusting(true);
|
||||
this.spawnTrustingParticles(true);
|
||||
this.level.broadcastEntityEvent(this, (byte) 41);
|
||||
@@ -312,10 +313,10 @@
|
||||
@@ -313,10 +314,10 @@
|
||||
private final EntityOcelot ocelot;
|
||||
|
||||
public a(EntityOcelot entityocelot, Class<T> oclass, float f, double d0, double d1) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityPanda.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityPanda.java
|
||||
@@ -64,6 +64,8 @@
|
||||
@@ -65,6 +65,8 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public class EntityPanda extends EntityAnimal {
|
||||
|
||||
private static final DataWatcherObject<Integer> UNHAPPY_COUNTER = DataWatcher.defineId(EntityPanda.class, DataWatcherRegistry.INT);
|
||||
@@ -526,7 +528,7 @@
|
||||
@@ -532,7 +534,7 @@
|
||||
|
||||
@Override
|
||||
protected void pickUpItem(EntityItem entityitem) {
|
||||
@@ -18,7 +18,7 @@
|
||||
this.onItemPickup(entityitem);
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
|
||||
@@ -872,10 +874,10 @@
|
||||
@@ -863,10 +865,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;
|
||||
}
|
||||
|
||||
@@ -1114,7 +1116,7 @@
|
||||
@@ -1105,7 +1107,7 @@
|
||||
@Override
|
||||
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
if (entityinsentient instanceof EntityPanda && ((EntityPanda) entityinsentient).isAggressive()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityParrot.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityParrot.java
|
||||
@@ -257,7 +257,7 @@
|
||||
@@ -261,7 +261,7 @@
|
||||
}
|
||||
|
||||
if (!this.level.isClientSide) {
|
||||
@@ -9,7 +9,7 @@
|
||||
this.tame(entityhuman);
|
||||
this.level.broadcastEntityEvent(this, (byte) 7);
|
||||
} else {
|
||||
@@ -271,7 +271,7 @@
|
||||
@@ -275,7 +275,7 @@
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
if (entityhuman.isCreative() || !this.isInvulnerable()) {
|
||||
this.hurt(DamageSource.playerAttack(entityhuman), Float.MAX_VALUE);
|
||||
}
|
||||
@@ -383,7 +383,7 @@
|
||||
@@ -387,7 +387,7 @@
|
||||
|
||||
@Override
|
||||
public boolean isPushable() {
|
||||
@@ -27,7 +27,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -399,7 +399,7 @@
|
||||
@@ -403,7 +403,7 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.level.isClientSide) {
|
||||
|
||||
@@ -11,18 +11,18 @@
|
||||
public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable {
|
||||
|
||||
private static final DataWatcherObject<Boolean> DATA_SADDLE_ID = DataWatcher.defineId(EntityPig.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -249,7 +253,13 @@
|
||||
}
|
||||
@@ -250,7 +254,13 @@
|
||||
}
|
||||
|
||||
entitypigzombie.setPersistenceRequired();
|
||||
- worldserver.addFreshEntity(entitypigzombie);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit - added a reason for spawning this creature
|
||||
+ worldserver.addFreshEntity(entitypigzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
|
||||
+ // CraftBukkit end
|
||||
this.discard();
|
||||
} else {
|
||||
super.thunderHit(worldserver, entitylightning);
|
||||
entitypigzombie.setPersistenceRequired();
|
||||
- worldserver.addFreshEntity(entitypigzombie);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit - added a reason for spawning this creature
|
||||
+ worldserver.addFreshEntity(entitypigzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
|
||||
+ // CraftBukkit end
|
||||
this.discard();
|
||||
} else {
|
||||
super.thunderHit(worldserver, entitylightning);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityRabbit.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityRabbit.java
|
||||
@@ -90,8 +90,14 @@
|
||||
@@ -88,8 +88,14 @@
|
||||
super(entitytypes, world);
|
||||
this.jumpControl = new EntityRabbit.ControllerJumpRabbit(this);
|
||||
this.moveControl = new EntityRabbit.ControllerMoveRabbit(this);
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
@Override
|
||||
public void registerGoals() {
|
||||
@@ -559,9 +565,23 @@
|
||||
@@ -570,9 +576,23 @@
|
||||
int i = (Integer) iblockdata.getValue(BlockCarrots.AGE);
|
||||
|
||||
if (i == 0) {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
public class EntitySheep extends EntityAnimal implements IShearable {
|
||||
|
||||
private static final int EAT_ANIMATION_TICKS = 40;
|
||||
@@ -222,6 +230,11 @@
|
||||
@@ -243,6 +251,11 @@
|
||||
|
||||
if (itemstack.is(Items.SHEARS)) {
|
||||
if (!this.level.isClientSide && this.readyForShearing()) {
|
||||
@@ -27,7 +27,7 @@
|
||||
this.shear(SoundCategory.PLAYERS);
|
||||
this.gameEvent(GameEvent.SHEAR, entityhuman);
|
||||
itemstack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
|
||||
@@ -243,7 +256,9 @@
|
||||
@@ -264,7 +277,9 @@
|
||||
int i = 1 + this.random.nextInt(3);
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
if (entityitem != null) {
|
||||
entityitem.setDeltaMovement(entityitem.getDeltaMovement().add((double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (this.random.nextFloat() * 0.05F), (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F)));
|
||||
@@ -333,6 +348,12 @@
|
||||
@@ -357,6 +372,12 @@
|
||||
|
||||
@Override
|
||||
public void ate() {
|
||||
@@ -50,7 +50,7 @@
|
||||
super.ate();
|
||||
this.setSheared(false);
|
||||
if (this.isBaby()) {
|
||||
@@ -352,7 +373,7 @@
|
||||
@@ -376,7 +397,7 @@
|
||||
EnumColor enumcolor = ((EntitySheep) entityanimal).getColor();
|
||||
EnumColor enumcolor1 = ((EntitySheep) entityanimal1).getColor();
|
||||
InventoryCrafting inventorycrafting = makeContainer(enumcolor, enumcolor1);
|
||||
@@ -59,7 +59,7 @@
|
||||
return recipecrafting.assemble(inventorycrafting);
|
||||
}).map(ItemStack::getItem);
|
||||
|
||||
@@ -375,10 +396,18 @@
|
||||
@@ -399,10 +420,18 @@
|
||||
public boolean stillValid(EntityHuman entityhuman) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
}
|
||||
|
||||
private static class e extends ControllerMove {
|
||||
@@ -480,8 +484,12 @@
|
||||
@@ -482,8 +486,12 @@
|
||||
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
|
||||
World world = this.turtle.level;
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
}
|
||||
|
||||
if (this.isDancing() && this.shouldStopDancing() && this.tickCount % 20 == 0) {
|
||||
@@ -303,7 +310,12 @@
|
||||
@@ -306,7 +313,12 @@
|
||||
ItemStack itemstack1 = this.getItemInHand(EnumHand.MAIN_HAND);
|
||||
|
||||
if (this.isDancing() && this.isDuplicationItem(itemstack) && this.canDuplicate()) {
|
||||
@@ -62,7 +62,7 @@
|
||||
this.level.broadcastEntityEvent(this, (byte) 18);
|
||||
this.level.playSound(entityhuman, (Entity) this, SoundEffects.AMETHYST_BLOCK_CHIME, SoundCategory.NEUTRAL, 2.0F, 1.0F);
|
||||
this.removeInteractionItem(entityhuman, itemstack);
|
||||
@@ -315,7 +327,7 @@
|
||||
@@ -318,7 +330,7 @@
|
||||
this.setItemInHand(EnumHand.MAIN_HAND, itemstack2);
|
||||
this.removeInteractionItem(entityhuman, itemstack);
|
||||
this.level.playSound(entityhuman, (Entity) this, SoundEffects.ALLAY_ITEM_GIVEN, SoundCategory.NEUTRAL, 2.0F, 1.0F);
|
||||
@@ -71,7 +71,7 @@
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else if (!itemstack1.isEmpty() && enumhand == EnumHand.MAIN_HAND && itemstack.isEmpty()) {
|
||||
this.setItemSlot(EnumItemSlot.MAINHAND, ItemStack.EMPTY);
|
||||
@@ -407,6 +419,7 @@
|
||||
@@ -439,6 +451,7 @@
|
||||
}
|
||||
|
||||
private boolean shouldStopDancing() {
|
||||
@@ -79,25 +79,25 @@
|
||||
return this.jukeboxPos == null || !this.jukeboxPos.closerToCenterThan(this.position(), (double) GameEvent.JUKEBOX_PLAY.getNotificationRadius()) || !this.level.getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
|
||||
}
|
||||
|
||||
@@ -446,7 +459,7 @@
|
||||
@@ -483,7 +496,7 @@
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
nbttagcompound.put("Inventory", this.inventory.createTag());
|
||||
this.writeInventoryToTag(nbttagcompound);
|
||||
- DataResult dataresult = VibrationListener.codec(this.vibrationListenerConfig).encodeStart(DynamicOpsNBT.INSTANCE, (VibrationListener) this.dynamicVibrationListener.getListener());
|
||||
+ DataResult<net.minecraft.nbt.NBTBase> dataresult = VibrationListener.codec(this.vibrationListenerConfig).encodeStart(DynamicOpsNBT.INSTANCE, (VibrationListener) this.dynamicVibrationListener.getListener()); // CraftBukkit - decompile error
|
||||
Logger logger = Allay.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -462,7 +475,7 @@
|
||||
@@ -499,7 +512,7 @@
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
this.inventory.fromTag(nbttagcompound.getList("Inventory", 10));
|
||||
this.readInventoryFromTag(nbttagcompound);
|
||||
if (nbttagcompound.contains("listener", 10)) {
|
||||
- DataResult dataresult = VibrationListener.codec(this.vibrationListenerConfig).parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener")));
|
||||
+ DataResult<VibrationListener> dataresult = VibrationListener.codec(this.vibrationListenerConfig).parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener"))); // CraftBukkit - decompile error
|
||||
Logger logger = Allay.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -508,7 +521,7 @@
|
||||
@@ -532,7 +545,7 @@
|
||||
return Allay.DUPLICATION_ITEM.test(itemstack);
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
Allay allay = (Allay) EntityTypes.ALLAY.create(this.level);
|
||||
|
||||
if (allay != null) {
|
||||
@@ -516,17 +529,17 @@
|
||||
@@ -540,17 +553,17 @@
|
||||
allay.setPersistenceRequired();
|
||||
allay.resetDuplicationCooldown();
|
||||
this.resetDuplicationCooldown();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
||||
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
||||
@@ -66,10 +66,17 @@
|
||||
@@ -68,9 +68,16 @@
|
||||
|
||||
public class Axolotl extends EntityAnimal implements LerpingModel, Bucketable {
|
||||
public class Axolotl extends EntityAnimal implements LerpingModel, VariantHolder<Axolotl.Variant>, Bucketable {
|
||||
|
||||
+ // CraftBukkit start - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
|
||||
+ @Override
|
||||
@@ -10,7 +10,6 @@
|
||||
+ 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, MemoryModuleType.IS_PANICKING});
|
||||
@@ -19,7 +18,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);
|
||||
@@ -187,7 +194,7 @@
|
||||
@@ -188,7 +195,7 @@
|
||||
|
||||
@Override
|
||||
public int getMaxAirSupply() {
|
||||
@@ -27,8 +26,8 @@
|
||||
+ return maxAirTicks; // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
|
||||
}
|
||||
|
||||
public Axolotl.Variant getVariant() {
|
||||
@@ -423,7 +430,7 @@
|
||||
@Override
|
||||
@@ -418,7 +425,7 @@
|
||||
|
||||
if (i < 2400) {
|
||||
i = Math.min(2400, 100 + i);
|
||||
@@ -37,7 +36,7 @@
|
||||
}
|
||||
|
||||
entityhuman.removeEffect(MobEffects.DIG_SLOWDOWN);
|
||||
@@ -473,7 +480,7 @@
|
||||
@@ -468,7 +475,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<Axolotl> getBrain() {
|
||||
|
||||
@@ -9,19 +9,19 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -232,8 +232,14 @@
|
||||
@@ -233,8 +233,14 @@
|
||||
}
|
||||
|
||||
frog.setPersistenceRequired();
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTransformEvent(this, frog, org.bukkit.event.entity.EntityTransformEvent.TransformReason.METAMORPHOSIS).isCancelled()) {
|
||||
+ this.setAge(0); // Sets the age to 0 for avoid a loop if the event is canceled
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.playSound(SoundEffects.TADPOLE_GROW_UP, 0.15F, 1.0F);
|
||||
- worldserver.addFreshEntityWithPassengers(frog);
|
||||
+ worldserver.addFreshEntityWithPassengers(frog, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.METAMORPHOSIS); // CraftBukkit - add SpawnReason
|
||||
this.discard();
|
||||
}
|
||||
|
||||
frog.setPersistenceRequired();
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTransformEvent(this, frog, org.bukkit.event.entity.EntityTransformEvent.TransformReason.METAMORPHOSIS).isCancelled()) {
|
||||
+ this.setAge(0); // Sets the age to 0 for avoid a loop if the event is canceled
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.playSound(SoundEffects.TADPOLE_GROW_UP, 0.15F, 1.0F);
|
||||
- worldserver.addFreshEntityWithPassengers(frog);
|
||||
+ worldserver.addFreshEntityWithPassengers(frog, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.METAMORPHOSIS); // CraftBukkit - add SpawnReason
|
||||
this.discard();
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
@@ -156,7 +161,7 @@
|
||||
@@ -181,7 +186,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<Goat> getBrain() {
|
||||
@@ -21,7 +21,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -194,8 +199,15 @@
|
||||
@@ -219,8 +224,15 @@
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
|
||||
@@ -72,6 +72,8 @@
|
||||
@@ -74,6 +74,8 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, HasCustomInventoryScreen, IJumpable, ISaddleable {
|
||||
|
||||
public static final int EQUIPMENT_SLOT_OFFSET = 400;
|
||||
@@ -111,6 +113,7 @@
|
||||
@@ -113,6 +115,7 @@
|
||||
private float mouthAnimO;
|
||||
protected boolean canGallop = true;
|
||||
protected int gallopSoundCounter;
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
protected EntityHorseAbstract(EntityTypes<? extends EntityHorseAbstract> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -296,7 +299,7 @@
|
||||
@@ -312,7 +315,7 @@
|
||||
public void createInventory() {
|
||||
InventorySubcontainer inventorysubcontainer = this.inventory;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
if (inventorysubcontainer != null) {
|
||||
inventorysubcontainer.removeListener(this);
|
||||
int i = Math.min(inventorysubcontainer.getContainerSize(), this.inventory.getContainerSize());
|
||||
@@ -412,7 +415,7 @@
|
||||
@@ -416,7 +419,7 @@
|
||||
}
|
||||
|
||||
public int getMaxTemper() {
|
||||
@@ -35,7 +35,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -483,7 +486,7 @@
|
||||
@@ -487,7 +490,7 @@
|
||||
}
|
||||
|
||||
if (this.getHealth() < this.getMaxHealth() && f > 0.0F) {
|
||||
@@ -44,7 +44,7 @@
|
||||
flag = true;
|
||||
}
|
||||
|
||||
@@ -560,7 +563,7 @@
|
||||
@@ -564,7 +567,7 @@
|
||||
super.aiStep();
|
||||
if (!this.level.isClientSide && this.isAlive()) {
|
||||
if (this.random.nextInt(900) == 0 && this.deathTime == 0) {
|
||||
@@ -53,7 +53,7 @@
|
||||
}
|
||||
|
||||
if (this.canEatGrass()) {
|
||||
@@ -791,6 +794,7 @@
|
||||
@@ -838,6 +841,7 @@
|
||||
if (this.getOwnerUUID() != null) {
|
||||
nbttagcompound.putUUID("Owner", this.getOwnerUUID());
|
||||
}
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
if (!this.inventory.getItem(0).isEmpty()) {
|
||||
nbttagcompound.put("SaddleItem", this.inventory.getItem(0).save(new NBTTagCompound()));
|
||||
@@ -818,6 +822,11 @@
|
||||
@@ -865,6 +869,11 @@
|
||||
if (uuid != null) {
|
||||
this.setOwnerUUID(uuid);
|
||||
}
|
||||
@@ -73,7 +73,7 @@
|
||||
|
||||
if (nbttagcompound.contains("SaddleItem", 10)) {
|
||||
ItemStack itemstack = ItemStack.of(nbttagcompound.getCompound("SaddleItem"));
|
||||
@@ -895,6 +904,18 @@
|
||||
@@ -942,6 +951,18 @@
|
||||
|
||||
@Override
|
||||
public void handleStartJump(int i) {
|
||||
@@ -90,5 +90,5 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.allowStandSliding = true;
|
||||
this.stand();
|
||||
this.standIfPossible();
|
||||
this.playJumpSound();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/horse/EntityLlama.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/EntityLlama.java
|
||||
@@ -77,6 +77,12 @@
|
||||
@@ -82,6 +82,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/horse/EntityLlamaTrader.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/EntityLlamaTrader.java
|
||||
@@ -152,7 +152,7 @@
|
||||
@@ -153,7 +153,7 @@
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
|
||||
@@ -1,28 +1,26 @@
|
||||
--- a/net/minecraft/world/entity/animal/horse/PathfinderGoalHorseTrap.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/PathfinderGoalHorseTrap.java
|
||||
@@ -39,19 +39,20 @@
|
||||
@@ -41,12 +41,12 @@
|
||||
if (entitylightning != null) {
|
||||
entitylightning.moveTo(this.horse.getX(), this.horse.getY(), this.horse.getZ());
|
||||
entitylightning.setVisualOnly(true);
|
||||
- worldserver.addFreshEntity(entitylightning);
|
||||
+ worldserver.strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRAP); // CraftBukkit
|
||||
EntitySkeleton entityskeleton = this.createSkeleton(difficultydamagescaler, this.horse);
|
||||
|
||||
entitylightning.moveTo(this.horse.getX(), this.horse.getY(), this.horse.getZ());
|
||||
entitylightning.setVisualOnly(true);
|
||||
- worldserver.addFreshEntity(entitylightning);
|
||||
+ worldserver.strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRAP); // CraftBukkit
|
||||
EntitySkeleton entityskeleton = this.createSkeleton(difficultydamagescaler, this.horse);
|
||||
if (entityskeleton != null) {
|
||||
entityskeleton.startRiding(this.horse);
|
||||
- worldserver.addFreshEntityWithPassengers(entityskeleton);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.TRAP); // CraftBukkit
|
||||
|
||||
- entityskeleton.startRiding(this.horse);
|
||||
- worldserver.addFreshEntityWithPassengers(entityskeleton);
|
||||
+ if (entityskeleton != null) entityskeleton.startRiding(this.horse); // CraftBukkit
|
||||
+ worldserver.addFreshEntityWithPassengers(entityskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.TRAP); // CraftBukkit
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
EntityHorseAbstract entityhorseabstract = this.createHorse(difficultydamagescaler);
|
||||
+ if (entityhorseabstract == null) continue; // CraftBukkit
|
||||
EntitySkeleton entityskeleton1 = this.createSkeleton(difficultydamagescaler, entityhorseabstract);
|
||||
|
||||
- entityskeleton1.startRiding(entityhorseabstract);
|
||||
+ if (entityskeleton1 != null) entityskeleton1.startRiding(entityhorseabstract); // CraftBukkit
|
||||
entityhorseabstract.push(this.horse.getRandom().triangle(0.0D, 1.1485D), 0.0D, this.horse.getRandom().triangle(0.0D, 1.1485D));
|
||||
- worldserver.addFreshEntityWithPassengers(entityhorseabstract);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityhorseabstract, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.JOCKEY); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
EntityHorseAbstract entityhorseabstract = this.createHorse(difficultydamagescaler);
|
||||
@@ -57,7 +57,7 @@
|
||||
if (entityskeleton1 != null) {
|
||||
entityskeleton1.startRiding(entityhorseabstract);
|
||||
entityhorseabstract.push(this.horse.getRandom().triangle(0.0D, 1.1485D), 0.0D, this.horse.getRandom().triangle(0.0D, 1.1485D));
|
||||
- worldserver.addFreshEntityWithPassengers(entityhorseabstract);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityhorseabstract, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.JOCKEY); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java
|
||||
+++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java
|
||||
@@ -21,6 +21,11 @@
|
||||
@@ -19,6 +19,11 @@
|
||||
import net.minecraft.world.level.block.BlockFireAbstract;
|
||||
import net.minecraft.world.level.dimension.end.EnderDragonBattle;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class EntityEnderCrystal extends Entity {
|
||||
|
||||
private static final DataWatcherObject<Optional<BlockPosition>> DATA_BEAM_TARGET = DataWatcher.defineId(EntityEnderCrystal.class, DataWatcherRegistry.OPTIONAL_BLOCK_POS);
|
||||
@@ -56,7 +61,11 @@
|
||||
@@ -54,7 +59,11 @@
|
||||
BlockPosition blockposition = this.blockPosition();
|
||||
|
||||
if (((WorldServer) this.level).dragonFight() != null && this.level.getBlockState(blockposition).isAir()) {
|
||||
@@ -25,7 +25,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,9 +105,22 @@
|
||||
@@ -94,11 +103,24 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.isRemoved() && !this.level.isClientSide) {
|
||||
@@ -36,7 +36,9 @@
|
||||
+ // CraftBukkit end
|
||||
this.remove(Entity.RemovalReason.KILLED);
|
||||
if (!damagesource.isExplosion()) {
|
||||
- this.level.explode((Entity) null, this.getX(), this.getY(), this.getZ(), 6.0F, Explosion.Effect.DESTROY);
|
||||
DamageSource damagesource1 = damagesource.getEntity() != null ? DamageSource.explosion(this, damagesource.getEntity()) : null;
|
||||
|
||||
- this.level.explode(this, damagesource1, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), 6.0F, false, World.a.BLOCK);
|
||||
+ // CraftBukkit start
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 6.0F, false);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
@@ -44,7 +46,7 @@
|
||||
+ this.unsetRemoved();
|
||||
+ return false;
|
||||
+ }
|
||||
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Explosion.Effect.DESTROY);
|
||||
+ this.level.explode(this, damagesource1, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.BLOCK);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/boss/wither/EntityWither.java
|
||||
+++ b/net/minecraft/world/entity/boss/wither/EntityWither.java
|
||||
@@ -55,6 +55,17 @@
|
||||
@@ -54,6 +54,17 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -18,21 +18,21 @@
|
||||
public class EntityWither extends EntityMonster implements PowerableMob, IRangedEntity {
|
||||
|
||||
private static final DataWatcherObject<Integer> DATA_TARGET_A = DataWatcher.defineId(EntityWither.class, DataWatcherRegistry.INT);
|
||||
@@ -249,16 +260,40 @@
|
||||
@@ -247,15 +258,40 @@
|
||||
i = this.getInvulnerableTicks() - 1;
|
||||
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;
|
||||
- this.level.explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, World.a.MOB);
|
||||
+ // CraftBukkit start
|
||||
+ // this.level.explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, explosion_effect);
|
||||
+ // this.level.explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, World.a.MOB);
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 7.0F, false);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.level.explode(this, this.getX(), this.getEyeY(), this.getZ(), event.getRadius(), event.getFire(), explosion_effect);
|
||||
+ this.level.explode(this, this.getX(), this.getEyeY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
- this.level.explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, explosion_effect);
|
||||
+
|
||||
if (!this.isSilent()) {
|
||||
- this.level.globalLevelEvent(1023, this.blockPosition(), 0);
|
||||
+ // CraftBukkit start - Use relative location for far away sounds
|
||||
@@ -62,7 +62,7 @@
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -303,6 +338,7 @@
|
||||
@@ -300,6 +336,7 @@
|
||||
if (!list.isEmpty()) {
|
||||
EntityLiving entityliving1 = (EntityLiving) list.get(this.random.nextInt(list.size()));
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
this.setAlternativeTarget(i, entityliving1.getId());
|
||||
}
|
||||
}
|
||||
@@ -333,6 +369,11 @@
|
||||
@@ -330,6 +367,11 @@
|
||||
IBlockData iblockdata = this.level.getBlockState(blockposition);
|
||||
|
||||
if (canDestroy(iblockdata)) {
|
||||
@@ -82,7 +82,7 @@
|
||||
flag = this.level.destroyBlock(blockposition, true, this) || flag;
|
||||
}
|
||||
}
|
||||
@@ -346,7 +387,7 @@
|
||||
@@ -343,7 +385,7 @@
|
||||
}
|
||||
|
||||
if (this.tickCount % 20 == 0) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/decoration/EntityItemFrame.java
|
||||
+++ b/net/minecraft/world/entity/decoration/EntityItemFrame.java
|
||||
@@ -93,16 +93,27 @@
|
||||
@@ -94,16 +94,27 @@
|
||||
@Override
|
||||
protected void recalculateBoundingBox() {
|
||||
if (this.direction != null) {
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
switch (enumdirection_enumaxis) {
|
||||
case X:
|
||||
@@ -118,9 +129,10 @@
|
||||
@@ -119,9 +130,10 @@
|
||||
d4 /= 32.0D;
|
||||
d5 /= 32.0D;
|
||||
d6 /= 32.0D;
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
@Override
|
||||
public boolean survives() {
|
||||
@@ -170,6 +182,11 @@
|
||||
@@ -171,6 +183,11 @@
|
||||
return false;
|
||||
} else if (!damagesource.isExplosion() && !this.getItem().isEmpty()) {
|
||||
if (!this.level.isClientSide) {
|
||||
@@ -61,7 +61,7 @@
|
||||
this.dropItem(damagesource.getEntity(), false);
|
||||
this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F);
|
||||
}
|
||||
@@ -297,6 +314,12 @@
|
||||
@@ -298,6 +315,12 @@
|
||||
}
|
||||
|
||||
public void setItem(ItemStack itemstack, boolean flag) {
|
||||
@@ -74,7 +74,7 @@
|
||||
if (!itemstack.isEmpty()) {
|
||||
itemstack = itemstack.copy();
|
||||
itemstack.setCount(1);
|
||||
@@ -304,7 +327,7 @@
|
||||
@@ -305,7 +328,7 @@
|
||||
|
||||
this.onItemChanged(itemstack);
|
||||
this.getEntityData().set(EntityItemFrame.DATA_ITEM, itemstack);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/decoration/EntityLeash.java
|
||||
+++ b/net/minecraft/world/entity/decoration/EntityLeash.java
|
||||
@@ -24,6 +24,12 @@
|
||||
@@ -25,6 +25,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;
|
||||
@@ -95,22 +101,42 @@
|
||||
@@ -96,22 +102,42 @@
|
||||
while (iterator.hasNext()) {
|
||||
entityinsentient = (EntityInsentient) iterator.next();
|
||||
if (entityinsentient.getLeashHolder() == entityhuman) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/item/EntityFallingBlock.java
|
||||
+++ b/net/minecraft/world/entity/item/EntityFallingBlock.java
|
||||
@@ -46,6 +46,8 @@
|
||||
@@ -48,6 +48,8 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public class EntityFallingBlock extends Entity {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -80,10 +82,17 @@
|
||||
@@ -82,10 +84,17 @@
|
||||
}
|
||||
|
||||
public static EntityFallingBlock fall(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
@@ -28,7 +28,7 @@
|
||||
return entityfallingblock;
|
||||
}
|
||||
|
||||
@@ -166,6 +175,12 @@
|
||||
@@ -168,6 +177,12 @@
|
||||
this.blockState = (IBlockData) this.blockState.setValue(BlockProperties.WATERLOGGED, true);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,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();
|
||||
@@ -236,7 +251,7 @@
|
||||
@@ -238,7 +253,7 @@
|
||||
if (i < 0) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -50,7 +50,7 @@
|
||||
DamageSource damagesource1;
|
||||
|
||||
if (this.blockState.getBlock() instanceof Fallable) {
|
||||
@@ -252,7 +267,9 @@
|
||||
@@ -254,7 +269,9 @@
|
||||
float f2 = (float) Math.min(MathHelper.floor((float) i * this.fallDamagePerDistance), this.fallDamageMax);
|
||||
|
||||
this.level.getEntities((Entity) this, this.getBoundingBox(), predicate).forEach((entity) -> {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/item/EntityItem.java
|
||||
+++ b/net/minecraft/world/entity/item/EntityItem.java
|
||||
@@ -32,6 +32,12 @@
|
||||
@@ -30,6 +30,12 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
public class EntityItem extends Entity {
|
||||
|
||||
private static final DataWatcherObject<ItemStack> DATA_ITEM = DataWatcher.defineId(EntityItem.class, DataWatcherRegistry.ITEM_STACK);
|
||||
@@ -46,6 +52,7 @@
|
||||
@@ -44,6 +50,7 @@
|
||||
@Nullable
|
||||
private UUID owner;
|
||||
public final float bobOffs;
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
public EntityItem(EntityTypes<? extends EntityItem> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -103,9 +110,12 @@
|
||||
@@ -101,9 +108,12 @@
|
||||
this.discard();
|
||||
} else {
|
||||
super.tick();
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
this.xo = this.getX();
|
||||
this.yo = this.getY();
|
||||
@@ -155,9 +165,11 @@
|
||||
@@ -153,9 +163,11 @@
|
||||
this.mergeWithNeighbours();
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
this.hasImpulse |= this.updateInWaterStateAndDoFluidPushing();
|
||||
if (!this.level.isClientSide) {
|
||||
@@ -169,6 +181,12 @@
|
||||
@@ -167,6 +179,12 @@
|
||||
}
|
||||
|
||||
if (!this.level.isClientSide && this.age >= 6000) {
|
||||
@@ -62,7 +62,7 @@
|
||||
this.discard();
|
||||
}
|
||||
|
||||
@@ -244,10 +262,11 @@
|
||||
@@ -242,10 +260,11 @@
|
||||
private static void merge(EntityItem entityitem, ItemStack itemstack, ItemStack itemstack1) {
|
||||
ItemStack itemstack2 = merge(itemstack, itemstack1, 64);
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
merge(entityitem, itemstack, itemstack1);
|
||||
entityitem.pickupDelay = Math.max(entityitem.pickupDelay, entityitem1.pickupDelay);
|
||||
entityitem.age = Math.min(entityitem.age, entityitem1.age);
|
||||
@@ -273,6 +292,11 @@
|
||||
@@ -271,6 +290,11 @@
|
||||
} else if (this.level.isClientSide) {
|
||||
return true;
|
||||
} else {
|
||||
@@ -87,7 +87,7 @@
|
||||
this.markHurt();
|
||||
this.health = (int) ((float) this.health - f);
|
||||
this.gameEvent(GameEvent.ENTITY_DAMAGE, damagesource.getEntity());
|
||||
@@ -336,6 +360,46 @@
|
||||
@@ -334,6 +358,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()) {
|
||||
@@ -379,7 +443,9 @@
|
||||
@@ -377,7 +441,9 @@
|
||||
}
|
||||
|
||||
public void setItem(ItemStack itemstack) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
||||
+++ b/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
||||
@@ -17,12 +17,16 @@
|
||||
import net.minecraft.world.level.Explosion;
|
||||
@@ -14,12 +14,16 @@
|
||||
import net.minecraft.world.entity.EnumMoveType;
|
||||
import net.minecraft.world.level.World;
|
||||
|
||||
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
public EntityTNTPrimed(EntityTypes<? extends EntityTNTPrimed> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -73,10 +77,13 @@
|
||||
@@ -70,10 +74,13 @@
|
||||
|
||||
this.setFuse(i);
|
||||
if (i <= 0) {
|
||||
@@ -32,7 +32,7 @@
|
||||
} else {
|
||||
this.updateInWaterStateAndDoFluidPushing();
|
||||
if (this.level.isClientSide) {
|
||||
@@ -87,9 +94,16 @@
|
||||
@@ -84,9 +91,16 @@
|
||||
}
|
||||
|
||||
private void explode() {
|
||||
@@ -40,12 +40,12 @@
|
||||
+ // CraftBukkit start
|
||||
+ // float f = 4.0F;
|
||||
|
||||
- this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 4.0F, Explosion.Effect.BREAK);
|
||||
- this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 4.0F, World.a.TNT);
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity());
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), Explosion.Effect.BREAK);
|
||||
+ this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), World.a.TNT);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityCreeper.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityCreeper.java
|
||||
@@ -44,6 +44,12 @@
|
||||
@@ -43,6 +43,12 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
public class EntityCreeper extends EntityMonster implements PowerableMob {
|
||||
|
||||
private static final DataWatcherObject<Integer> DATA_SWELL_DIR = DataWatcher.defineId(EntityCreeper.class, DataWatcherRegistry.INT);
|
||||
@@ -219,9 +225,19 @@
|
||||
@@ -218,9 +224,19 @@
|
||||
@Override
|
||||
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
super.thunderHit(worldserver, entitylightning);
|
||||
@@ -35,11 +35,11 @@
|
||||
protected EnumInteractionResult mobInteract(EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
@@ -246,10 +262,18 @@
|
||||
Explosion.Effect explosion_effect = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
|
||||
if (!this.level.isClientSide) {
|
||||
float f = this.isPowered() ? 2.0F : 1.0F;
|
||||
|
||||
- this.dead = true;
|
||||
- this.level.explode(this, this.getX(), this.getY(), this.getZ(), (float) this.explosionRadius * f, explosion_effect);
|
||||
- this.level.explode(this, this.getX(), this.getY(), this.getZ(), (float) this.explosionRadius * f, World.a.MOB);
|
||||
- this.discard();
|
||||
- this.spawnLingeringCloud();
|
||||
+ // CraftBukkit start
|
||||
@@ -47,7 +47,7 @@
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.dead = true;
|
||||
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), explosion_effect);
|
||||
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB);
|
||||
+ this.discard();
|
||||
+ this.spawnLingeringCloud();
|
||||
+ } else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityEnderman.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityEnderman.java
|
||||
@@ -109,7 +109,17 @@
|
||||
@@ -114,7 +114,17 @@
|
||||
|
||||
@Override
|
||||
public void setTarget(@Nullable EntityLiving entityliving) {
|
||||
@@ -19,7 +19,7 @@
|
||||
AttributeModifiable attributemodifiable = this.getAttribute(GenericAttributes.MOVEMENT_SPEED);
|
||||
|
||||
if (entityliving == null) {
|
||||
@@ -124,6 +134,7 @@
|
||||
@@ -129,6 +139,7 @@
|
||||
attributemodifiable.addTransientModifier(EntityEnderman.SPEED_MODIFIER_ATTACKING);
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -474,9 +485,13 @@
|
||||
@@ -490,9 +501,13 @@
|
||||
if (iblockdata2 != null) {
|
||||
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level, blockposition);
|
||||
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
|
||||
@@ -41,7 +41,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -515,9 +530,13 @@
|
||||
@@ -531,9 +546,13 @@
|
||||
boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition);
|
||||
|
||||
if (iblockdata.is(TagsBlock.ENDERMAN_HOLDABLE) && flag) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityEvoker.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityEvoker.java
|
||||
@@ -191,7 +191,7 @@
|
||||
entityvex.setOwner(EntityEvoker.this);
|
||||
entityvex.setBoundOrigin(blockposition);
|
||||
entityvex.setLimitedLife(20 * (30 + EntityEvoker.this.random.nextInt(90)));
|
||||
- worldserver.addFreshEntityWithPassengers(entityvex);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityvex, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPELL); // CraftBukkit - Add SpawnReason
|
||||
@@ -192,7 +192,7 @@
|
||||
entityvex.setOwner(EntityEvoker.this);
|
||||
entityvex.setBoundOrigin(blockposition);
|
||||
entityvex.setLimitedLife(20 * (30 + EntityEvoker.this.random.nextInt(90)));
|
||||
- worldserver.addFreshEntityWithPassengers(entityvex);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityvex, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPELL); // CraftBukkit - Add SpawnReason
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityIllagerWizard.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityIllagerWizard.java
|
||||
@@ -161,6 +161,11 @@
|
||||
@@ -155,6 +155,11 @@
|
||||
public void tick() {
|
||||
--this.attackWarmupDelay;
|
||||
if (this.attackWarmupDelay == 0) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityPigZombie.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityPigZombie.java
|
||||
@@ -145,7 +145,7 @@
|
||||
@@ -154,7 +154,7 @@
|
||||
}).filter((entitypigzombie) -> {
|
||||
return !entitypigzombie.isAlliedTo((Entity) this.getTarget());
|
||||
}).forEach((entitypigzombie) -> {
|
||||
@@ -9,7 +9,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
@@ -163,7 +163,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -18,7 +18,7 @@
|
||||
if (this.getTarget() == null && entityliving != null) {
|
||||
this.playFirstAngerSoundIn = EntityPigZombie.FIRST_ANGER_SOUND_DELAY.sample(this.random);
|
||||
this.ticksUntilNextAlert = EntityPigZombie.ALERT_INTERVAL.sample(this.random);
|
||||
@@ -164,12 +164,21 @@
|
||||
@@ -173,12 +173,21 @@
|
||||
this.setLastHurtByPlayer((EntityHuman) entityliving);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityShulker.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityShulker.java
|
||||
@@ -57,6 +57,12 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
@@ -59,6 +59,12 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.server.level.WorldServer;
|
||||
@@ -10,10 +10,10 @@
|
||||
+import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityShulker extends EntityGolem implements IMonster {
|
||||
public class EntityShulker extends EntityGolem implements VariantHolder<Optional<EnumColor>>, IMonster {
|
||||
|
||||
private static final UUID COVERED_ARMOR_MODIFIER_UUID = UUID.fromString("7E0292F2-9434-48D5-A29F-9583AF7DF27F");
|
||||
@@ -405,6 +411,16 @@
|
||||
@@ -407,6 +413,16 @@
|
||||
EnumDirection enumdirection = this.findAttachableSurface(blockposition1);
|
||||
|
||||
if (enumdirection != null) {
|
||||
@@ -30,12 +30,12 @@
|
||||
this.unRide();
|
||||
this.setAttachFace(enumdirection);
|
||||
this.playSound(SoundEffects.SHULKER_TELEPORT, 1.0F, 1.0F);
|
||||
@@ -478,7 +494,7 @@
|
||||
@@ -477,7 +493,7 @@
|
||||
if (entityshulker != null) {
|
||||
entityshulker.setVariant(this.getVariant());
|
||||
entityshulker.moveTo(vec3d);
|
||||
- this.level.addFreshEntity(entityshulker);
|
||||
+ this.level.addFreshEntity(entityshulker, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - the mysteries of life
|
||||
}
|
||||
|
||||
entityshulker.moveTo(vec3d);
|
||||
- this.level.addFreshEntity(entityshulker);
|
||||
+ this.level.addFreshEntity(entityshulker, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - the mysteries of life
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntitySkeleton.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySkeleton.java
|
||||
@@ -86,7 +86,7 @@
|
||||
@@ -90,7 +90,7 @@
|
||||
}
|
||||
|
||||
protected void doFreezeConversion() {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
public class EntitySlime extends EntityInsentient implements IMonster {
|
||||
|
||||
private static final DataWatcherObject<Integer> ID_SIZE = DataWatcher.defineId(EntitySlime.class, DataWatcherRegistry.INT);
|
||||
@@ -184,7 +192,7 @@
|
||||
@@ -185,7 +193,7 @@
|
||||
|
||||
@Override
|
||||
public EntityTypes<? extends EntitySlime> getType() {
|
||||
@@ -24,7 +24,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -198,6 +206,19 @@
|
||||
@@ -199,6 +207,19 @@
|
||||
int j = i / 2;
|
||||
int k = 2 + this.random.nextInt(3);
|
||||
|
||||
@@ -44,14 +44,14 @@
|
||||
for (int l = 0; l < k; ++l) {
|
||||
float f1 = ((float) (l % 2) - 0.5F) * f;
|
||||
float f2 = ((float) (l / 2) - 0.5F) * f;
|
||||
@@ -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);
|
||||
- this.level.addFreshEntity(entityslime);
|
||||
+ slimes.add(entityslime); // CraftBukkit
|
||||
+ }
|
||||
+
|
||||
@@ -214,9 +235,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);
|
||||
- this.level.addFreshEntity(entityslime);
|
||||
+ slimes.add(entityslime); // CraftBukkit
|
||||
}
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, slimes, EntityTransformEvent.TransformReason.SPLIT).isCancelled()) {
|
||||
+ super.remove(entity_removalreason);
|
||||
@@ -59,7 +59,7 @@
|
||||
+ }
|
||||
+ for (EntityLiving living : slimes) {
|
||||
+ this.level.addFreshEntity(living, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntitySpider.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySpider.java
|
||||
@@ -177,7 +177,7 @@
|
||||
@@ -179,7 +179,7 @@
|
||||
MobEffectList mobeffectlist = ((EntitySpider.GroupDataSpider) object).effect;
|
||||
|
||||
if (mobeffectlist != null) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityVex.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityVex.java
|
||||
@@ -373,7 +373,7 @@
|
||||
@@ -386,7 +386,7 @@
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
public class EntityZombie extends EntityMonster {
|
||||
|
||||
private static final UUID SPEED_MODIFIER_BABY_UUID = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");
|
||||
@@ -85,6 +94,7 @@
|
||||
@@ -86,6 +95,7 @@
|
||||
private boolean canBreakDoors;
|
||||
private int inWaterTime;
|
||||
public int conversionTime;
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
public EntityZombie(EntityTypes<? extends EntityZombie> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -201,7 +211,10 @@
|
||||
@@ -202,7 +212,10 @@
|
||||
public void tick() {
|
||||
if (!this.level.isClientSide && this.isAlive() && !this.isNoAi()) {
|
||||
if (this.isUnderWaterConverting()) {
|
||||
@@ -36,7 +36,7 @@
|
||||
if (this.conversionTime < 0) {
|
||||
this.doUnderWaterConversion();
|
||||
}
|
||||
@@ -218,6 +231,7 @@
|
||||
@@ -219,6 +232,7 @@
|
||||
}
|
||||
|
||||
super.tick();
|
||||
@@ -44,7 +44,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -250,6 +264,7 @@
|
||||
@@ -251,6 +265,7 @@
|
||||
}
|
||||
|
||||
public void startUnderWaterConversion(int i) {
|
||||
@@ -52,7 +52,7 @@
|
||||
this.conversionTime = i;
|
||||
this.getEntityData().set(EntityZombie.DATA_DROWNED_CONVERSION_ID, true);
|
||||
}
|
||||
@@ -263,11 +278,15 @@
|
||||
@@ -264,11 +279,15 @@
|
||||
}
|
||||
|
||||
protected void convertToZombieType(EntityTypes<? extends EntityZombie> entitytypes) {
|
||||
@@ -69,7 +69,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -307,9 +326,9 @@
|
||||
@@ -308,9 +327,9 @@
|
||||
if (SpawnerCreature.isSpawnPositionOk(entitypositiontypes_surface, this.level, blockposition, entitytypes) && EntityPositionTypes.checkSpawnRules(entitytypes, worldserver, EnumMobSpawn.REINFORCEMENT, blockposition, this.level.random)) {
|
||||
entityzombie.setPos((double) i1, (double) j1, (double) k1);
|
||||
if (!this.level.hasNearbyAlivePlayer((double) i1, (double) j1, (double) k1, 7.0D) && this.level.isUnobstructed(entityzombie) && this.level.noCollision((Entity) entityzombie) && !this.level.containsAnyLiquid(entityzombie.getBoundingBox())) {
|
||||
@@ -81,7 +81,7 @@
|
||||
this.getAttribute(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE).addPermanentModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, AttributeModifier.Operation.ADDITION));
|
||||
entityzombie.getAttribute(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE).addPermanentModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, AttributeModifier.Operation.ADDITION));
|
||||
break;
|
||||
@@ -330,7 +349,14 @@
|
||||
@@ -331,7 +350,14 @@
|
||||
float f = this.level.getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty();
|
||||
|
||||
if (this.getMainHandItem().isEmpty() && this.isOnFire() && this.random.nextFloat() < f * 0.3F) {
|
||||
@@ -97,49 +97,54 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,21 +438,30 @@
|
||||
@@ -413,8 +439,17 @@
|
||||
if (worldserver.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) {
|
||||
return flag;
|
||||
}
|
||||
|
||||
EntityVillager entityvillager = (EntityVillager) entityliving;
|
||||
- EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.convertTo(EntityTypes.ZOMBIE_VILLAGER, false);
|
||||
+ // CraftBukkit start
|
||||
+ flag = zombifyVillager(worldserver, entityvillager, this.blockPosition(), this.isSilent(), CreatureSpawnEvent.SpawnReason.INFECTION) == null;
|
||||
+ }
|
||||
|
||||
- EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.convertTo(EntityTypes.ZOMBIE_VILLAGER, false);
|
||||
+ return flag;
|
||||
+ }
|
||||
+
|
||||
+ public static EntityZombieVillager zombifyVillager(WorldServer worldserver, EntityVillager entityvillager, net.minecraft.core.BlockPosition blockPosition, boolean silent, CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.convertTo(EntityTypes.ZOMBIE_VILLAGER, false, EntityTransformEvent.TransformReason.INFECTION, spawnReason);
|
||||
+ if (entityzombievillager != null) {
|
||||
+ {
|
||||
+ EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.convertTo(EntityTypes.ZOMBIE_VILLAGER, false, EntityTransformEvent.TransformReason.INFECTION, spawnReason);
|
||||
+ // CraftBukkit end
|
||||
entityzombievillager.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityzombievillager.blockPosition()), EnumMobSpawn.CONVERSION, new EntityZombie.GroupDataZombie(false, true), (NBTTagCompound) null);
|
||||
entityzombievillager.setVillagerData(entityvillager.getVillagerData());
|
||||
entityzombievillager.setGossips((NBTBase) entityvillager.getGossips().store(DynamicOpsNBT.INSTANCE).getValue());
|
||||
entityzombievillager.setTradeOffers(entityvillager.getOffers().createTag());
|
||||
entityzombievillager.setVillagerXp(entityvillager.getVillagerXp());
|
||||
- if (!this.isSilent()) {
|
||||
- worldserver.levelEvent((EntityHuman) null, 1026, this.blockPosition(), 0);
|
||||
+ // CraftBukkit start
|
||||
+ if (!silent) {
|
||||
+ worldserver.levelEvent((EntityHuman) null, 1026, blockPosition, 0);
|
||||
|
||||
if (entityzombievillager != null) {
|
||||
entityzombievillager.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityzombievillager.blockPosition()), EnumMobSpawn.CONVERSION, new EntityZombie.GroupDataZombie(false, true), (NBTTagCompound) null);
|
||||
@@ -422,15 +457,17 @@
|
||||
entityzombievillager.setGossips((NBTBase) entityvillager.getGossips().store(DynamicOpsNBT.INSTANCE));
|
||||
entityzombievillager.setTradeOffers(entityvillager.getOffers().createTag());
|
||||
entityzombievillager.setVillagerXp(entityvillager.getVillagerXp());
|
||||
- if (!this.isSilent()) {
|
||||
- worldserver.levelEvent((EntityHuman) null, 1026, this.blockPosition(), 0);
|
||||
+ // CraftBukkit start
|
||||
+ if (!silent) {
|
||||
+ worldserver.levelEvent((EntityHuman) null, 1026, blockPosition, 0);
|
||||
}
|
||||
|
||||
- flag = false;
|
||||
+ // flag = false;
|
||||
}
|
||||
-
|
||||
- flag = false;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
- }
|
||||
|
||||
- return flag;
|
||||
+ return entityzombievillager; // CraftBukkit
|
||||
+ return entityzombievillager;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -478,7 +513,7 @@
|
||||
entitychicken1.finalizeSpawn(worldaccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
entitychicken1.setChickenJockey(true);
|
||||
this.startRiding(entitychicken1);
|
||||
- worldaccess.addFreshEntity(entitychicken1);
|
||||
+ worldaccess.addFreshEntity(entitychicken1, CreatureSpawnEvent.SpawnReason.MOUNT); // CraftBukkit
|
||||
@@ -483,7 +520,7 @@
|
||||
entitychicken1.finalizeSpawn(worldaccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
entitychicken1.setChickenJockey(true);
|
||||
this.startRiding(entitychicken1);
|
||||
- worldaccess.addFreshEntity(entitychicken1);
|
||||
+ worldaccess.addFreshEntity(entitychicken1, CreatureSpawnEvent.SpawnReason.MOUNT); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/piglin/EntityPiglin.java
|
||||
+++ b/net/minecraft/world/entity/monster/piglin/EntityPiglin.java
|
||||
@@ -54,6 +54,18 @@
|
||||
@@ -56,6 +56,18 @@
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
+import java.util.stream.Collectors;
|
||||
+import java.util.HashSet;
|
||||
+import java.util.Set;
|
||||
+import net.minecraft.core.IRegistry;
|
||||
+import net.minecraft.core.registries.BuiltInRegistries;
|
||||
+import net.minecraft.nbt.NBTTagList;
|
||||
+import net.minecraft.nbt.NBTTagString;
|
||||
+import net.minecraft.nbt.NBTBase;
|
||||
@@ -19,10 +19,10 @@
|
||||
public class EntityPiglin extends EntityPiglinAbstract implements ICrossbow, InventoryCarrier {
|
||||
|
||||
private static final DataWatcherObject<Boolean> DATA_BABY_ID = DataWatcher.defineId(EntityPiglin.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -74,6 +86,10 @@
|
||||
@@ -76,6 +88,10 @@
|
||||
public boolean cannotHunt;
|
||||
protected static final ImmutableList<SensorType<? extends Sensor<? super EntityPiglin>>> SENSOR_TYPES = ImmutableList.of(SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_PLAYERS, SensorType.NEAREST_ITEMS, SensorType.HURT_BY, SensorType.PIGLIN_SPECIFIC_SENSOR);
|
||||
protected static final ImmutableList<MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.LOOK_TARGET, MemoryModuleType.DOORS_TO_CLOSE, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLINS, MemoryModuleType.NEARBY_ADULT_PIGLINS, MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.WALK_TARGET, new MemoryModuleType[]{MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.INTERACTION_TARGET, MemoryModuleType.PATH, MemoryModuleType.ANGRY_AT, MemoryModuleType.UNIVERSAL_ANGER, MemoryModuleType.AVOID_TARGET, MemoryModuleType.ADMIRING_ITEM, MemoryModuleType.TIME_TRYING_TO_REACH_ADMIRE_ITEM, MemoryModuleType.ADMIRING_DISABLED, MemoryModuleType.DISABLE_WALK_TO_ADMIRE_ITEM, MemoryModuleType.CELEBRATE_LOCATION, MemoryModuleType.DANCING, MemoryModuleType.HUNTED_RECENTLY, MemoryModuleType.NEAREST_VISIBLE_BABY_HOGLIN, MemoryModuleType.NEAREST_VISIBLE_NEMESIS, MemoryModuleType.NEAREST_VISIBLE_ZOMBIFIED, MemoryModuleType.RIDE_TARGET, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_VISIBLE_HUNTABLE_HOGLIN, MemoryModuleType.NEAREST_TARGETABLE_PLAYER_NOT_WEARING_GOLD, MemoryModuleType.NEAREST_PLAYER_HOLDING_WANTED_ITEM, MemoryModuleType.ATE_RECENTLY, MemoryModuleType.NEAREST_REPELLENT});
|
||||
protected static final ImmutableList<MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.LOOK_TARGET, MemoryModuleType.DOORS_TO_CLOSE, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLINS, MemoryModuleType.NEARBY_ADULT_PIGLINS, MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, MemoryModuleType.ITEM_PICKUP_COOLDOWN_TICKS, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, new MemoryModuleType[]{MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.INTERACTION_TARGET, MemoryModuleType.PATH, MemoryModuleType.ANGRY_AT, MemoryModuleType.UNIVERSAL_ANGER, MemoryModuleType.AVOID_TARGET, MemoryModuleType.ADMIRING_ITEM, MemoryModuleType.TIME_TRYING_TO_REACH_ADMIRE_ITEM, MemoryModuleType.ADMIRING_DISABLED, MemoryModuleType.DISABLE_WALK_TO_ADMIRE_ITEM, MemoryModuleType.CELEBRATE_LOCATION, MemoryModuleType.DANCING, MemoryModuleType.HUNTED_RECENTLY, MemoryModuleType.NEAREST_VISIBLE_BABY_HOGLIN, MemoryModuleType.NEAREST_VISIBLE_NEMESIS, MemoryModuleType.NEAREST_VISIBLE_ZOMBIFIED, MemoryModuleType.RIDE_TARGET, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_VISIBLE_HUNTABLE_HOGLIN, MemoryModuleType.NEAREST_TARGETABLE_PLAYER_NOT_WEARING_GOLD, MemoryModuleType.NEAREST_PLAYER_HOLDING_WANTED_ITEM, MemoryModuleType.ATE_RECENTLY, MemoryModuleType.NEAREST_REPELLENT});
|
||||
+ // CraftBukkit start - Custom bartering and interest list
|
||||
+ public Set<Item> allowedBarterItems = new HashSet<>();
|
||||
+ public Set<Item> interestItems = new HashSet<>();
|
||||
@@ -30,33 +30,33 @@
|
||||
|
||||
public EntityPiglin(EntityTypes<? extends EntityPiglinAbstract> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -92,6 +108,14 @@
|
||||
@@ -94,6 +110,14 @@
|
||||
}
|
||||
|
||||
nbttagcompound.put("Inventory", this.inventory.createTag());
|
||||
this.writeInventoryToTag(nbttagcompound);
|
||||
+ // CraftBukkit start
|
||||
+ NBTTagList barterList = new NBTTagList();
|
||||
+ allowedBarterItems.stream().map(IRegistry.ITEM::getKey).map(MinecraftKey::toString).map(NBTTagString::valueOf).forEach(barterList::add);
|
||||
+ allowedBarterItems.stream().map(BuiltInRegistries.ITEM::getKey).map(MinecraftKey::toString).map(NBTTagString::valueOf).forEach(barterList::add);
|
||||
+ nbttagcompound.put("Bukkit.BarterList", barterList);
|
||||
+ NBTTagList interestList = new NBTTagList();
|
||||
+ interestItems.stream().map(IRegistry.ITEM::getKey).map(MinecraftKey::toString).map(NBTTagString::valueOf).forEach(interestList::add);
|
||||
+ interestItems.stream().map(BuiltInRegistries.ITEM::getKey).map(MinecraftKey::toString).map(NBTTagString::valueOf).forEach(interestList::add);
|
||||
+ nbttagcompound.put("Bukkit.InterestList", interestList);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,6 +124,10 @@
|
||||
@@ -102,6 +126,10 @@
|
||||
this.setBaby(nbttagcompound.getBoolean("IsBaby"));
|
||||
this.setCannotHunt(nbttagcompound.getBoolean("CannotHunt"));
|
||||
this.inventory.fromTag(nbttagcompound.getList("Inventory", 10));
|
||||
this.readInventoryFromTag(nbttagcompound);
|
||||
+ // CraftBukkit start
|
||||
+ this.allowedBarterItems = nbttagcompound.getList("Bukkit.BarterList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(IRegistry.ITEM::get).collect(Collectors.toCollection(HashSet::new));
|
||||
+ this.interestItems = nbttagcompound.getList("Bukkit.InterestList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(IRegistry.ITEM::get).collect(Collectors.toCollection(HashSet::new));
|
||||
+ this.allowedBarterItems = nbttagcompound.getList("Bukkit.BarterList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(BuiltInRegistries.ITEM::get).collect(Collectors.toCollection(HashSet::new));
|
||||
+ this.interestItems = nbttagcompound.getList("Bukkit.InterestList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(BuiltInRegistries.ITEM::get).collect(Collectors.toCollection(HashSet::new));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@VisibleForDebug
|
||||
@@ -206,7 +234,7 @@
|
||||
@@ -223,7 +251,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<EntityPiglin> getBrain() {
|
||||
@@ -65,7 +65,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -349,7 +377,7 @@
|
||||
@@ -368,7 +396,7 @@
|
||||
}
|
||||
|
||||
protected void holdInOffHand(ItemStack itemstack) {
|
||||
@@ -74,7 +74,7 @@
|
||||
this.setItemSlot(EnumItemSlot.OFFHAND, itemstack);
|
||||
this.setGuaranteedDrop(EnumItemSlot.OFFHAND);
|
||||
} else {
|
||||
@@ -375,8 +403,8 @@
|
||||
@@ -394,8 +422,8 @@
|
||||
if (EnchantmentManager.hasBindingCurse(itemstack1)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -85,7 +85,7 @@
|
||||
|
||||
return flag && !flag1 ? true : (!flag && flag1 ? false : (this.isAdult() && !itemstack.is(Items.CROSSBOW) && itemstack1.is(Items.CROSSBOW) ? false : super.canReplaceCurrentItem(itemstack, itemstack1)));
|
||||
}
|
||||
@@ -405,7 +433,7 @@
|
||||
@@ -424,7 +452,7 @@
|
||||
|
||||
@Override
|
||||
protected SoundEffect getAmbientSound() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/piglin/EntityPiglinAbstract.java
|
||||
+++ b/net/minecraft/world/entity/monster/piglin/EntityPiglinAbstract.java
|
||||
@@ -100,7 +100,7 @@
|
||||
@@ -108,7 +108,7 @@
|
||||
}
|
||||
|
||||
protected void finishConversion(WorldServer worldserver) {
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
if (entitypigzombie != null) {
|
||||
entitypigzombie.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0));
|
||||
@@ -117,7 +117,7 @@
|
||||
@@ -125,7 +125,7 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public EntityLiving getTarget() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/piglin/PiglinAI.java
|
||||
+++ b/net/minecraft/world/entity/monster/piglin/PiglinAI.java
|
||||
@@ -71,6 +71,13 @@
|
||||
@@ -74,6 +74,13 @@
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -14,7 +14,26 @@
|
||||
public class PiglinAI {
|
||||
|
||||
public static final int REPELLENT_DETECTION_RANGE_HORIZONTAL = 8;
|
||||
@@ -186,13 +193,13 @@
|
||||
@@ -164,7 +171,8 @@
|
||||
}
|
||||
|
||||
private static void initRideHoglinActivity(BehaviorController<EntityPiglin> behaviorcontroller) {
|
||||
- behaviorcontroller.addActivityAndRemoveMemoryWhenStopped(Activity.RIDE, 10, ImmutableList.of(BehaviorStartRiding.create(0.8F), BehaviorLookTarget.create(PiglinAI::isPlayerHoldingLovedItem, 8.0F), BehaviorBuilder.sequence(BehaviorBuilder.triggerIf(Entity::isPassenger), TriggerGate.triggerOneShuffled(ImmutableList.builder().addAll(createLookBehaviors()).add(Pair.of(BehaviorBuilder.triggerIf((entitypiglin) -> {
|
||||
+ // CraftBukkit - decompile error
|
||||
+ behaviorcontroller.addActivityAndRemoveMemoryWhenStopped(Activity.RIDE, 10, ImmutableList.of(BehaviorStartRiding.create(0.8F), BehaviorLookTarget.create(PiglinAI::isPlayerHoldingLovedItem, 8.0F), BehaviorBuilder.sequence(BehaviorBuilder.triggerIf(Entity::isPassenger), TriggerGate.triggerOneShuffled(ImmutableList.<Pair<? extends net.minecraft.world.entity.ai.behavior.declarative.Trigger<? super EntityLiving>, Integer>>builder().addAll(createLookBehaviors()).add(Pair.of(BehaviorBuilder.triggerIf((entitypiglin) -> {
|
||||
return true;
|
||||
}), 1)).build())), BehaviorStopRiding.create(8, PiglinAI::wantsToStopRiding)), MemoryModuleType.RIDE_TARGET);
|
||||
}
|
||||
@@ -174,7 +182,7 @@
|
||||
}
|
||||
|
||||
private static BehaviorGateSingle<EntityLiving> createIdleLookBehaviors() {
|
||||
- return new BehaviorGateSingle<>(ImmutableList.builder().addAll(createLookBehaviors()).add(Pair.of(new BehaviorNop(30, 60), 1)).build());
|
||||
+ return new BehaviorGateSingle<>(ImmutableList.<Pair<? extends BehaviorControl<? super EntityLiving>, Integer>>builder().addAll(createLookBehaviors()).add(Pair.of(new BehaviorNop(30, 60), 1)).build()); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
private static BehaviorGateSingle<EntityPiglin> createIdleMovementBehaviors() {
|
||||
@@ -195,13 +203,13 @@
|
||||
|
||||
protected static void updateActivity(EntityPiglin entitypiglin) {
|
||||
BehaviorController<EntityPiglin> behaviorcontroller = entitypiglin.getBrain();
|
||||
@@ -31,7 +50,7 @@
|
||||
|
||||
Objects.requireNonNull(entitypiglin);
|
||||
optional.ifPresent(entitypiglin::playSoundEvent);
|
||||
@@ -224,23 +231,27 @@
|
||||
@@ -233,23 +241,27 @@
|
||||
stopWalking(entitypiglin);
|
||||
ItemStack itemstack;
|
||||
|
||||
@@ -58,12 +77,12 @@
|
||||
} else if (isFood(itemstack) && !hasEatenRecently(entitypiglin)) {
|
||||
eat(entitypiglin);
|
||||
} else {
|
||||
- boolean flag = entitypiglin.equipItemIfPossible(itemstack);
|
||||
+ boolean flag = entitypiglin.equipItemIfPossible(itemstack, entityitem); // CraftBukkit
|
||||
- boolean flag = !entitypiglin.equipItemIfPossible(itemstack).equals(ItemStack.EMPTY);
|
||||
+ boolean flag = !entitypiglin.equipItemIfPossible(itemstack, entityitem).equals(ItemStack.EMPTY); // CraftBukkit
|
||||
|
||||
if (!flag) {
|
||||
putInInventory(entitypiglin, itemstack);
|
||||
@@ -276,9 +287,14 @@
|
||||
@@ -285,9 +297,14 @@
|
||||
boolean flag1;
|
||||
|
||||
if (entitypiglin.isAdult()) {
|
||||
@@ -78,9 +97,9 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (!flag1) {
|
||||
boolean flag2 = entitypiglin.equipItemIfPossible(itemstack);
|
||||
boolean flag2 = !entitypiglin.equipItemIfPossible(itemstack).isEmpty();
|
||||
|
||||
@@ -291,7 +307,7 @@
|
||||
@@ -300,7 +317,7 @@
|
||||
if (!flag1) {
|
||||
ItemStack itemstack1 = entitypiglin.getMainHandItem();
|
||||
|
||||
@@ -89,7 +108,7 @@
|
||||
putInInventory(entitypiglin, itemstack1);
|
||||
} else {
|
||||
throwItems(entitypiglin, Collections.singletonList(itemstack1));
|
||||
@@ -368,7 +384,7 @@
|
||||
@@ -377,7 +394,7 @@
|
||||
return false;
|
||||
} else if (isAdmiringDisabled(entitypiglin) && entitypiglin.getBrain().hasMemoryValue(MemoryModuleType.ATTACK_TARGET)) {
|
||||
return false;
|
||||
@@ -98,7 +117,7 @@
|
||||
return isNotHoldingLovedItemInOffHand(entitypiglin);
|
||||
} else {
|
||||
boolean flag = entitypiglin.canAddToInventory(itemstack);
|
||||
@@ -377,6 +393,12 @@
|
||||
@@ -386,6 +403,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +130,7 @@
|
||||
protected static boolean isLovedItem(ItemStack itemstack) {
|
||||
return itemstack.is(TagsItem.PIGLIN_LOVED);
|
||||
}
|
||||
@@ -472,7 +494,7 @@
|
||||
@@ -481,7 +504,7 @@
|
||||
}
|
||||
|
||||
protected static boolean canAdmire(EntityPiglin entitypiglin, ItemStack itemstack) {
|
||||
@@ -120,7 +139,7 @@
|
||||
}
|
||||
|
||||
protected static void wasHurtBy(EntityPiglin entitypiglin, EntityLiving entityliving) {
|
||||
@@ -739,6 +761,12 @@
|
||||
@@ -738,6 +761,12 @@
|
||||
return entitypiglin.getBrain().hasMemoryValue(MemoryModuleType.ADMIRING_ITEM);
|
||||
}
|
||||
|
||||
@@ -133,7 +152,7 @@
|
||||
private static boolean isBarterCurrency(ItemStack itemstack) {
|
||||
return itemstack.is(PiglinAI.BARTERING_ITEM);
|
||||
}
|
||||
@@ -776,7 +804,7 @@
|
||||
@@ -775,7 +804,7 @@
|
||||
}
|
||||
|
||||
private static boolean isNotHoldingLovedItemInOffHand(EntityPiglin entitypiglin) {
|
||||
|
||||
@@ -61,3 +61,12 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -560,7 +560,7 @@
|
||||
|
||||
public void setAttackTarget(EntityLiving entityliving) {
|
||||
this.getBrain().eraseMemory(MemoryModuleType.ROAR_TARGET);
|
||||
- this.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, (Object) entityliving);
|
||||
+ this.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, entityliving); // CraftBukkit - decompile error
|
||||
this.getBrain().eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
|
||||
SonicBoom.setCooldown(this, 200);
|
||||
}
|
||||
|
||||
@@ -72,21 +72,21 @@
|
||||
Logger logger = EntityVillager.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -818,7 +838,12 @@
|
||||
}
|
||||
@@ -820,7 +840,12 @@
|
||||
}
|
||||
|
||||
entitywitch.setPersistenceRequired();
|
||||
- worldserver.addFreshEntityWithPassengers(entitywitch);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, entitywitch, EntityTransformEvent.TransformReason.LIGHTNING).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ worldserver.addFreshEntityWithPassengers(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
|
||||
+ // CraftBukkit end
|
||||
this.releaseAllPois();
|
||||
this.discard();
|
||||
} else {
|
||||
@@ -904,7 +929,7 @@
|
||||
entitywitch.setPersistenceRequired();
|
||||
- worldserver.addFreshEntityWithPassengers(entitywitch);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, entitywitch, EntityTransformEvent.TransformReason.LIGHTNING).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ worldserver.addFreshEntityWithPassengers(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
|
||||
+ // CraftBukkit end
|
||||
this.releaseAllPois();
|
||||
this.discard();
|
||||
} else {
|
||||
@@ -909,7 +934,7 @@
|
||||
}).limit(5L).collect(Collectors.toList());
|
||||
|
||||
if (list1.size() >= j) {
|
||||
@@ -95,7 +95,7 @@
|
||||
list.forEach(SensorGolemLastSeen::golemDetected);
|
||||
}
|
||||
}
|
||||
@@ -961,7 +986,7 @@
|
||||
@@ -966,7 +991,7 @@
|
||||
@Override
|
||||
public void startSleeping(BlockPosition blockposition) {
|
||||
super.startSleeping(blockposition);
|
||||
@@ -104,7 +104,7 @@
|
||||
this.brain.eraseMemory(MemoryModuleType.WALK_TARGET);
|
||||
this.brain.eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
|
||||
}
|
||||
@@ -969,7 +994,7 @@
|
||||
@@ -974,7 +999,7 @@
|
||||
@Override
|
||||
public void stopSleeping() {
|
||||
super.stopSleeping();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/npc/InventoryCarrier.java
|
||||
+++ b/net/minecraft/world/entity/npc/InventoryCarrier.java
|
||||
@@ -20,6 +20,13 @@
|
||||
@@ -23,6 +23,13 @@
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/world/entity/npc/MobSpawnerTrader.java
|
||||
+++ b/net/minecraft/world/entity/npc/MobSpawnerTrader.java
|
||||
@@ -113,7 +113,7 @@
|
||||
@@ -110,7 +110,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
- EntityVillagerTrader entityvillagertrader = (EntityVillagerTrader) EntityTypes.WANDERING_TRADER.spawn(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition2, EnumMobSpawn.EVENT, false, false);
|
||||
+ EntityVillagerTrader entityvillagertrader = (EntityVillagerTrader) EntityTypes.WANDERING_TRADER.spawn(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition2, EnumMobSpawn.EVENT, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit
|
||||
- EntityVillagerTrader entityvillagertrader = (EntityVillagerTrader) EntityTypes.WANDERING_TRADER.spawn(worldserver, blockposition2, EnumMobSpawn.EVENT);
|
||||
+ EntityVillagerTrader entityvillagertrader = (EntityVillagerTrader) EntityTypes.WANDERING_TRADER.spawn(worldserver, blockposition2, EnumMobSpawn.EVENT, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit
|
||||
|
||||
if (entityvillagertrader != null) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
@@ -121,7 +121,7 @@
|
||||
@@ -118,7 +118,7 @@
|
||||
}
|
||||
|
||||
this.serverLevelData.setWanderingTraderId(entityvillagertrader.getUUID());
|
||||
@@ -18,12 +18,12 @@
|
||||
entityvillagertrader.setWanderTarget(blockposition1);
|
||||
entityvillagertrader.restrictTo(blockposition1, 16);
|
||||
return true;
|
||||
@@ -136,7 +136,7 @@
|
||||
@@ -133,7 +133,7 @@
|
||||
BlockPosition blockposition = this.findSpawnPositionNear(worldserver, entityvillagertrader.blockPosition(), i);
|
||||
|
||||
if (blockposition != null) {
|
||||
- EntityLlamaTrader entityllamatrader = (EntityLlamaTrader) EntityTypes.TRADER_LLAMA.spawn(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition, EnumMobSpawn.EVENT, false, false);
|
||||
+ EntityLlamaTrader entityllamatrader = (EntityLlamaTrader) EntityTypes.TRADER_LLAMA.spawn(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition, EnumMobSpawn.EVENT, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit
|
||||
- EntityLlamaTrader entityllamatrader = (EntityLlamaTrader) EntityTypes.TRADER_LLAMA.spawn(worldserver, blockposition, EnumMobSpawn.EVENT);
|
||||
+ EntityLlamaTrader entityllamatrader = (EntityLlamaTrader) EntityTypes.TRADER_LLAMA.spawn(worldserver, blockposition, EnumMobSpawn.EVENT, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit
|
||||
|
||||
if (entityllamatrader != null) {
|
||||
entityllamatrader.setLeashedTo(entityvillagertrader, true);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/player/EntityHuman.java
|
||||
+++ b/net/minecraft/world/entity/player/EntityHuman.java
|
||||
@@ -117,6 +117,20 @@
|
||||
@@ -115,6 +115,20 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeamBase;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
public abstract class EntityHuman extends EntityLiving {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -130,7 +144,8 @@
|
||||
@@ -128,7 +142,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);
|
||||
@@ -31,7 +31,7 @@
|
||||
private static final int FLY_ACHIEVEMENT_SPEED = 25;
|
||||
private static final DataWatcherObject<Float> DATA_PLAYER_ABSORPTION_ID = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.FLOAT);
|
||||
private static final DataWatcherObject<Integer> DATA_SCORE_ID = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.INT);
|
||||
@@ -140,10 +155,10 @@
|
||||
@@ -138,10 +153,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);
|
||||
@@ -41,10 +41,10 @@
|
||||
public Container containerMenu;
|
||||
- protected FoodMetaData foodData = new FoodMetaData();
|
||||
+ protected FoodMetaData foodData = new FoodMetaData(this); // CraftBukkit - add "this" to constructor
|
||||
protected WardenSpawnTracker wardenSpawnTracker = new WardenSpawnTracker(0, 0, 0);
|
||||
protected int jumpTriggerTime;
|
||||
public float oBob;
|
||||
@@ -174,6 +189,16 @@
|
||||
public float bob;
|
||||
@@ -169,6 +184,16 @@
|
||||
@Nullable
|
||||
public EntityFishingHook fishing;
|
||||
|
||||
@@ -58,10 +58,10 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile, @Nullable ProfilePublicKey profilepublickey) {
|
||||
public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile) {
|
||||
super(EntityTypes.PLAYER, world);
|
||||
this.lastItemInMainHand = ItemStack.EMPTY;
|
||||
@@ -315,7 +340,7 @@
|
||||
@@ -308,7 +333,7 @@
|
||||
ItemStack itemstack = this.getItemBySlot(EnumItemSlot.HEAD);
|
||||
|
||||
if (itemstack.is(Items.TURTLE_HELMET) && !this.isEyeInFluid(TagsFluid.WATER)) {
|
||||
@@ -70,7 +70,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -507,7 +532,8 @@
|
||||
@@ -502,7 +527,8 @@
|
||||
|
||||
if (this.level.getDifficulty() == EnumDifficulty.PEACEFUL && this.level.getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION)) {
|
||||
if (this.getHealth() < this.getMaxHealth() && this.tickCount % 20 == 0) {
|
||||
@@ -80,7 +80,7 @@
|
||||
}
|
||||
|
||||
if (this.foodData.needsFood() && this.tickCount % 10 == 0) {
|
||||
@@ -671,6 +697,13 @@
|
||||
@@ -666,6 +692,13 @@
|
||||
|
||||
@Nullable
|
||||
public EntityItem drop(ItemStack itemstack, boolean flag, boolean flag1) {
|
||||
@@ -94,7 +94,7 @@
|
||||
if (itemstack.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -705,6 +738,33 @@
|
||||
@@ -700,6 +733,33 @@
|
||||
entityitem.setDeltaMovement((double) (-f3 * f2 * 0.3F) + Math.cos((double) f5) * (double) f6, (double) (-f1 * 0.3F + 0.1F + (this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (f4 * f2 * 0.3F) + Math.sin((double) f5) * (double) f6);
|
||||
}
|
||||
|
||||
@@ -128,43 +128,25 @@
|
||||
return entityitem;
|
||||
}
|
||||
}
|
||||
@@ -781,7 +841,7 @@
|
||||
this.setScore(nbttagcompound.getInt("Score"));
|
||||
this.foodData.readAdditionalSaveData(nbttagcompound);
|
||||
if (nbttagcompound.contains("warden_spawn_tracker", 10)) {
|
||||
- DataResult dataresult = WardenSpawnTracker.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("warden_spawn_tracker")));
|
||||
+ DataResult<WardenSpawnTracker> dataresult = WardenSpawnTracker.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("warden_spawn_tracker"))); // CraftBukkit - decompile error
|
||||
Logger logger = EntityHuman.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -805,7 +865,7 @@
|
||||
@@ -790,7 +850,7 @@
|
||||
}
|
||||
|
||||
if (nbttagcompound.contains("LastDeathLocation", 10)) {
|
||||
- DataResult dataresult1 = GlobalPos.CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("LastDeathLocation"));
|
||||
+ DataResult<GlobalPos> dataresult1 = GlobalPos.CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("LastDeathLocation")); // CraftBukkit - decompile error
|
||||
Logger logger1 = EntityHuman.LOGGER;
|
||||
- DataResult dataresult = GlobalPos.CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("LastDeathLocation"));
|
||||
+ DataResult<GlobalPos> dataresult = GlobalPos.CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("LastDeathLocation")); // CraftBukkit - decompile error
|
||||
Logger logger = EntityHuman.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger1);
|
||||
@@ -827,7 +887,7 @@
|
||||
nbttagcompound.putInt("XpSeed", this.enchantmentSeed);
|
||||
nbttagcompound.putInt("Score", this.getScore());
|
||||
this.foodData.addAdditionalSaveData(nbttagcompound);
|
||||
- DataResult dataresult = WardenSpawnTracker.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.wardenSpawnTracker);
|
||||
+ DataResult<NBTBase> dataresult = WardenSpawnTracker.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.wardenSpawnTracker); // CraftBukkit - decompile error
|
||||
Logger logger = EntityHuman.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -845,7 +905,7 @@
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -823,7 +883,7 @@
|
||||
}
|
||||
|
||||
this.getLastDeathLocation().flatMap((globalpos) -> {
|
||||
- DataResult dataresult1 = GlobalPos.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, globalpos);
|
||||
+ DataResult<NBTBase> dataresult1 = GlobalPos.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, globalpos); // CraftBukkit - decompile error
|
||||
Logger logger1 = EntityHuman.LOGGER;
|
||||
- DataResult dataresult = GlobalPos.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, globalpos);
|
||||
+ DataResult<NBTBase> dataresult = GlobalPos.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, globalpos); // CraftBukkit - decompile error
|
||||
Logger logger = EntityHuman.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger1);
|
||||
@@ -872,12 +932,12 @@
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -850,12 +910,12 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.level.isClientSide) {
|
||||
@@ -179,7 +161,7 @@
|
||||
}
|
||||
|
||||
if (this.level.getDifficulty() == EnumDifficulty.EASY) {
|
||||
@@ -889,7 +949,13 @@
|
||||
@@ -867,7 +927,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +176,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -909,10 +975,29 @@
|
||||
@@ -887,10 +953,29 @@
|
||||
}
|
||||
|
||||
public boolean canHarmPlayer(EntityHuman entityhuman) {
|
||||
@@ -227,7 +209,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -954,8 +1039,13 @@
|
||||
@@ -932,8 +1017,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +224,7 @@
|
||||
if (!this.isInvulnerableTo(damagesource)) {
|
||||
f = this.getDamageAfterArmorAbsorb(damagesource, f);
|
||||
f = this.getDamageAfterMagicAbsorb(damagesource, f);
|
||||
@@ -970,7 +1060,7 @@
|
||||
@@ -948,7 +1038,7 @@
|
||||
}
|
||||
|
||||
if (f != 0.0F) {
|
||||
@@ -251,7 +233,7 @@
|
||||
float f3 = this.getHealth();
|
||||
|
||||
this.setHealth(this.getHealth() - f);
|
||||
@@ -981,6 +1071,7 @@
|
||||
@@ -959,6 +1049,7 @@
|
||||
|
||||
}
|
||||
}
|
||||
@@ -259,7 +241,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1140,7 +1231,7 @@
|
||||
@@ -1122,7 +1213,7 @@
|
||||
|
||||
f *= 0.2F + f2 * f2 * 0.8F;
|
||||
f1 *= f2;
|
||||
@@ -268,7 +250,7 @@
|
||||
if (f > 0.0F || f1 > 0.0F) {
|
||||
boolean flag = f2 > 0.9F;
|
||||
boolean flag1 = false;
|
||||
@@ -1179,8 +1270,15 @@
|
||||
@@ -1161,8 +1252,15 @@
|
||||
if (entity instanceof EntityLiving) {
|
||||
f3 = ((EntityLiving) entity).getHealth();
|
||||
if (j > 0 && !entity.isOnFire()) {
|
||||
@@ -286,7 +268,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1208,8 +1306,11 @@
|
||||
@@ -1190,8 +1288,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) {
|
||||
@@ -299,7 +281,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1218,9 +1319,26 @@
|
||||
@@ -1200,9 +1301,26 @@
|
||||
}
|
||||
|
||||
if (entity instanceof EntityPlayer && entity.hurtMarked) {
|
||||
@@ -326,7 +308,7 @@
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
@@ -1265,7 +1383,14 @@
|
||||
@@ -1247,7 +1365,14 @@
|
||||
|
||||
this.awardStat(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F));
|
||||
if (j > 0) {
|
||||
@@ -342,7 +324,7 @@
|
||||
}
|
||||
|
||||
if (this.level instanceof WorldServer && f5 > 2.0F) {
|
||||
@@ -1275,12 +1400,17 @@
|
||||
@@ -1257,12 +1382,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,7 +343,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1362,6 +1492,12 @@
|
||||
@@ -1339,6 +1469,12 @@
|
||||
}
|
||||
|
||||
public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition) {
|
||||
@@ -374,7 +356,7 @@
|
||||
this.startSleeping(blockposition);
|
||||
this.sleepCounter = 0;
|
||||
return Either.right(Unit.INSTANCE);
|
||||
@@ -1446,9 +1582,9 @@
|
||||
@@ -1423,9 +1559,9 @@
|
||||
super.jumpFromGround();
|
||||
this.awardStat(StatisticList.JUMP);
|
||||
if (this.isSprinting()) {
|
||||
@@ -386,7 +368,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1482,7 +1618,11 @@
|
||||
@@ -1459,7 +1595,11 @@
|
||||
this.setDeltaMovement(vec3d2.x, d3 * 0.6D, vec3d2.z);
|
||||
this.flyingSpeed = f;
|
||||
this.resetFallDistance();
|
||||
@@ -399,7 +381,7 @@
|
||||
} else {
|
||||
super.travel(vec3d);
|
||||
}
|
||||
@@ -1517,19 +1657,19 @@
|
||||
@@ -1494,19 +1634,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);
|
||||
@@ -422,7 +404,7 @@
|
||||
}
|
||||
} else if (this.onClimbable()) {
|
||||
if (d1 > 0.0D) {
|
||||
@@ -1540,13 +1680,13 @@
|
||||
@@ -1517,13 +1657,13 @@
|
||||
if (i > 0) {
|
||||
if (this.isSprinting()) {
|
||||
this.awardStat(StatisticList.SPRINT_ONE_CM, i);
|
||||
@@ -439,7 +421,7 @@
|
||||
}
|
||||
}
|
||||
} else if (this.isFallFlying()) {
|
||||
@@ -1617,12 +1757,24 @@
|
||||
@@ -1589,12 +1729,24 @@
|
||||
}
|
||||
|
||||
public void startFallFlying() {
|
||||
@@ -465,7 +447,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1713,10 +1865,21 @@
|
||||
@@ -1685,10 +1837,21 @@
|
||||
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
|
||||
}
|
||||
|
||||
@@ -488,7 +470,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1802,13 +1965,20 @@
|
||||
@@ -1774,13 +1937,20 @@
|
||||
|
||||
@Override
|
||||
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||
@@ -512,7 +494,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1847,26 +2017,31 @@
|
||||
@@ -1819,26 +1989,31 @@
|
||||
|
||||
protected void removeEntitiesOnShoulder() {
|
||||
if (this.timeEntitySatOnShoulder + 20L < this.level.getGameTime()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityArrow.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityArrow.java
|
||||
@@ -45,6 +45,12 @@
|
||||
@@ -46,6 +46,12 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
public abstract class EntityArrow extends IProjectile {
|
||||
|
||||
private static final double ARROW_BASE_DAMAGE = 2.0D;
|
||||
@@ -211,7 +217,7 @@
|
||||
@@ -212,7 +218,7 @@
|
||||
}
|
||||
|
||||
if (object != null && !flag) {
|
||||
@@ -22,7 +22,7 @@
|
||||
this.hasImpulse = true;
|
||||
}
|
||||
|
||||
@@ -358,7 +364,13 @@
|
||||
@@ -359,7 +365,13 @@
|
||||
int k = entity.getRemainingFireTicks();
|
||||
|
||||
if (this.isOnFire() && !flag) {
|
||||
@@ -37,7 +37,7 @@
|
||||
}
|
||||
|
||||
if (entity.hurt(damagesource, (float) i)) {
|
||||
@@ -521,7 +533,22 @@
|
||||
@@ -522,7 +534,22 @@
|
||||
@Override
|
||||
public void playerTouch(EntityHuman entityhuman) {
|
||||
if (!this.level.isClientSide && (this.inGround || this.isNoPhysics()) && this.shakeTime <= 0) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
public class EntityEgg extends EntityProjectileThrowable {
|
||||
|
||||
public EntityEgg(EntityTypes<? extends EntityEgg> entitytypes, World world) {
|
||||
@@ -48,20 +57,40 @@
|
||||
@@ -48,22 +57,42 @@
|
||||
protected void onHit(MovingObjectPosition movingobjectposition) {
|
||||
super.onHit(movingobjectposition);
|
||||
if (!this.level.isClientSide) {
|
||||
@@ -47,17 +47,20 @@
|
||||
+ hatchingType = event.getHatchingType();
|
||||
+ }
|
||||
|
||||
- entitychicken.setAge(-24000);
|
||||
- entitychicken.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F);
|
||||
- this.level.addFreshEntity(entitychicken);
|
||||
- if (entitychicken != null) {
|
||||
- entitychicken.setAge(-24000);
|
||||
- entitychicken.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F);
|
||||
- this.level.addFreshEntity(entitychicken);
|
||||
+ if (hatching) {
|
||||
+ for (int i = 0; i < b0; ++i) {
|
||||
+ Entity entity = level.getWorld().createEntity(new org.bukkit.Location(level.getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F), hatchingType.getEntityClass());
|
||||
+ if (entity.getBukkitEntity() instanceof Ageable) {
|
||||
+ ((Ageable) entity.getBukkitEntity()).setBaby();
|
||||
+ if (entity != null) {
|
||||
+ if (entity.getBukkitEntity() instanceof Ageable) {
|
||||
+ ((Ageable) entity.getBukkitEntity()).setBaby();
|
||||
+ }
|
||||
+ level.getWorld().addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG);
|
||||
+ }
|
||||
+ level.getWorld().addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -14,15 +14,12 @@
|
||||
public class EntityEnderPearl extends EntityProjectileThrowable {
|
||||
|
||||
public EntityEnderPearl(EntityTypes<? extends EntityEnderPearl> entitytypes, World world) {
|
||||
@@ -53,21 +60,34 @@
|
||||
@@ -53,23 +60,36 @@
|
||||
EntityPlayer entityplayer = (EntityPlayer) entity;
|
||||
|
||||
if (entityplayer.connection.getConnection().isConnected() && entityplayer.level == this.level && !entityplayer.isSleeping()) {
|
||||
- if (this.random.nextFloat() < 0.05F && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
|
||||
- EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.create(this.level);
|
||||
-
|
||||
- entityendermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
|
||||
- this.level.addFreshEntity(entityendermite);
|
||||
+ // CraftBukkit start - Fire PlayerTeleportEvent
|
||||
+ org.bukkit.craftbukkit.entity.CraftPlayer player = entityplayer.getBukkitEntity();
|
||||
+ org.bukkit.Location location = getBukkitEntity().getLocation();
|
||||
@@ -36,14 +33,24 @@
|
||||
+ if (this.random.nextFloat() < 0.05F && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
|
||||
+ EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.create(this.level);
|
||||
+
|
||||
+ entityendermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
|
||||
+ this.level.addFreshEntity(entityendermite, CreatureSpawnEvent.SpawnReason.ENDER_PEARL);
|
||||
+ if (entityendermite != null) {
|
||||
+ entityendermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
|
||||
+ this.level.addFreshEntity(entityendermite, CreatureSpawnEvent.SpawnReason.ENDER_PEARL);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
||||
- if (entityendermite != null) {
|
||||
- entityendermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
|
||||
- this.level.addFreshEntity(entityendermite);
|
||||
+ if (entity.isPassenger()) {
|
||||
+ entity.stopRiding();
|
||||
+ }
|
||||
+
|
||||
}
|
||||
- }
|
||||
|
||||
- if (entity.isPassenger()) {
|
||||
- entityplayer.dismountTo(this.getX(), this.getY(), this.getZ());
|
||||
- } else {
|
||||
- entity.teleportTo(this.getX(), this.getY(), this.getZ());
|
||||
+ entityplayer.connection.teleport(teleEvent.getTo());
|
||||
+ entity.resetFallDistance();
|
||||
+ CraftEventFactory.entityDamage = this;
|
||||
@@ -51,19 +58,13 @@
|
||||
+ CraftEventFactory.entityDamage = null;
|
||||
}
|
||||
-
|
||||
- if (entity.isPassenger()) {
|
||||
- entityplayer.dismountTo(this.getX(), this.getY(), this.getZ());
|
||||
- } else {
|
||||
- entity.teleportTo(this.getX(), this.getY(), this.getZ());
|
||||
- }
|
||||
-
|
||||
- entity.resetFallDistance();
|
||||
- entity.hurt(DamageSource.FALL, 5.0F);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else if (entity != null) {
|
||||
entity.teleportTo(this.getX(), this.getY(), this.getZ());
|
||||
@@ -96,7 +116,7 @@
|
||||
@@ -98,7 +118,7 @@
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
Entity entity = this.getOwner();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityEnderSignal.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityEnderSignal.java
|
||||
@@ -38,7 +38,7 @@
|
||||
@@ -36,7 +36,7 @@
|
||||
}
|
||||
|
||||
public void setItem(ItemStack itemstack) {
|
||||
@@ -9,7 +9,7 @@
|
||||
this.getEntityData().set(EntityEnderSignal.DATA_ITEM_STACK, (ItemStack) SystemUtils.make(itemstack.copy(), (itemstack1) -> {
|
||||
itemstack1.setCount(1);
|
||||
}));
|
||||
@@ -182,7 +182,7 @@
|
||||
@@ -180,7 +180,7 @@
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
ItemStack itemstack = ItemStack.of(nbttagcompound.getCompound("Item"));
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
|
||||
@@ -130,7 +130,9 @@
|
||||
@@ -128,7 +128,9 @@
|
||||
|
||||
if (entityliving.isAlive() && !entityliving.isInvulnerable() && entityliving != entityliving1) {
|
||||
if (entityliving1 == null) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityFireball.java
|
||||
@@ -14,11 +14,15 @@
|
||||
@@ -15,11 +15,15 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
protected EntityFireball(EntityTypes<? extends EntityFireball> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -28,6 +32,12 @@
|
||||
@@ -29,6 +33,12 @@
|
||||
this(entitytypes, world);
|
||||
this.moveTo(d0, d1, d2, this.getYRot(), this.getXRot());
|
||||
this.reapplyPosition();
|
||||
@@ -29,7 +29,7 @@
|
||||
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
|
||||
|
||||
if (d6 != 0.0D) {
|
||||
@@ -74,7 +84,13 @@
|
||||
@@ -75,7 +85,13 @@
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);
|
||||
|
||||
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
|
||||
@@ -44,7 +44,7 @@
|
||||
}
|
||||
|
||||
this.checkInsideBlocks();
|
||||
@@ -160,6 +176,11 @@
|
||||
@@ -161,6 +177,11 @@
|
||||
|
||||
if (entity != null) {
|
||||
if (!this.level.isClientSide) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityFireworks.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityFireworks.java
|
||||
@@ -29,15 +29,17 @@
|
||||
@@ -29,6 +29,8 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -9,17 +9,6 @@
|
||||
public class EntityFireworks extends IProjectile implements ItemSupplier {
|
||||
|
||||
public static final DataWatcherObject<ItemStack> DATA_ID_FIREWORKS_ITEM = DataWatcher.defineId(EntityFireworks.class, DataWatcherRegistry.ITEM_STACK);
|
||||
private static final DataWatcherObject<OptionalInt> DATA_ATTACHED_TO_TARGET = DataWatcher.defineId(EntityFireworks.class, DataWatcherRegistry.OPTIONAL_UNSIGNED_INT);
|
||||
public static final DataWatcherObject<Boolean> DATA_SHOT_AT_ANGLE = DataWatcher.defineId(EntityFireworks.class, DataWatcherRegistry.BOOLEAN);
|
||||
- private int life;
|
||||
+ public int life; // PAIL private -> public
|
||||
public int lifetime;
|
||||
@Nullable
|
||||
- private EntityLiving attachedToEntity;
|
||||
+ public EntityLiving attachedToEntity; // PAIL private -> public
|
||||
|
||||
public EntityFireworks(EntityTypes<? extends EntityFireworks> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -144,7 +146,7 @@
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityFishingHook.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityFishingHook.java
|
||||
@@ -45,6 +45,12 @@
|
||||
@@ -46,6 +46,12 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
public class EntityFishingHook extends IProjectile {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -66,6 +72,12 @@
|
||||
@@ -67,6 +73,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 = RandomSource.create();
|
||||
@@ -260,7 +272,7 @@
|
||||
@@ -261,7 +273,7 @@
|
||||
private void checkCollision() {
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -307,6 +319,10 @@
|
||||
@@ -308,6 +320,10 @@
|
||||
this.timeUntilLured = 0;
|
||||
this.timeUntilHooked = 0;
|
||||
this.getEntityData().set(EntityFishingHook.DATA_BITING, false);
|
||||
@@ -46,7 +46,7 @@
|
||||
}
|
||||
} else {
|
||||
float f;
|
||||
@@ -340,6 +356,13 @@
|
||||
@@ -341,6 +357,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;
|
||||
|
||||
@@ -376,8 +399,10 @@
|
||||
@@ -377,8 +400,10 @@
|
||||
this.timeUntilHooked = MathHelper.nextInt(this.random, 20, 80);
|
||||
}
|
||||
} else {
|
||||
@@ -73,7 +73,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,6 +469,14 @@
|
||||
@@ -445,6 +470,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);
|
||||
@@ -459,6 +492,15 @@
|
||||
@@ -460,6 +493,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();
|
||||
@@ -466,7 +508,11 @@
|
||||
@@ -467,7 +509,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);
|
||||
@@ -117,7 +117,7 @@
|
||||
if (itemstack1.is(TagsItem.FISHES)) {
|
||||
entityhuman.awardStat(StatisticList.FISH_CAUGHT, 1);
|
||||
}
|
||||
@@ -476,8 +522,25 @@
|
||||
@@ -477,8 +523,25 @@
|
||||
}
|
||||
|
||||
if (this.onGround) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityLargeFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityLargeFireball.java
|
||||
@@ -11,17 +11,21 @@
|
||||
@@ -10,17 +10,21 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
|
||||
@@ -22,24 +22,24 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -30,7 +34,15 @@
|
||||
@@ -29,7 +33,15 @@
|
||||
if (!this.level.isClientSide) {
|
||||
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
|
||||
- this.level.explode((Entity) null, this.getX(), this.getY(), this.getZ(), (float) this.explosionPower, flag, flag ? Explosion.Effect.DESTROY : Explosion.Effect.NONE);
|
||||
- this.level.explode(this, this.getX(), this.getY(), this.getZ(), (float) this.explosionPower, flag, World.a.MOB);
|
||||
+ // CraftBukkit start - fire ExplosionPrimeEvent
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity());
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ // give 'this' instead of (Entity) null so we know what causes the damage
|
||||
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), flag ? Explosion.Effect.DESTROY : Explosion.Effect.NONE);
|
||||
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.discard();
|
||||
}
|
||||
|
||||
@@ -61,7 +73,8 @@
|
||||
@@ -60,7 +72,8 @@
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
if (nbttagcompound.contains("ExplosionPower", 99)) {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
public class EntityPotion extends EntityProjectileThrowable implements ItemSupplier {
|
||||
|
||||
public static final double SPLASH_RANGE = 4.0D;
|
||||
@@ -98,7 +108,7 @@
|
||||
@@ -100,7 +110,7 @@
|
||||
|
||||
if (flag) {
|
||||
this.applyWater();
|
||||
@@ -26,7 +26,7 @@
|
||||
if (this.isLingering()) {
|
||||
this.makeAreaOfEffectCloud(itemstack, potionregistry);
|
||||
} else {
|
||||
@@ -144,6 +154,7 @@
|
||||
@@ -149,6 +159,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();
|
||||
@@ -162,21 +173,47 @@
|
||||
@@ -167,21 +178,47 @@
|
||||
d1 = 1.0D;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,7 +249,14 @@
|
||||
@@ -217,7 +254,14 @@
|
||||
entityareaeffectcloud.setFixedColor(nbttagcompound.getInt("CustomPotionColor"));
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
}
|
||||
|
||||
public boolean isLingering() {
|
||||
@@ -223,13 +267,25 @@
|
||||
@@ -228,13 +272,25 @@
|
||||
IBlockData iblockdata = this.level.getBlockState(blockposition);
|
||||
|
||||
if (iblockdata.is(TagsBlock.FIRE)) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityThrownTrident.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityThrownTrident.java
|
||||
@@ -156,7 +156,7 @@
|
||||
|
||||
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
|
||||
entitylightning.setCause(entity1 instanceof EntityPlayer ? (EntityPlayer) entity1 : null);
|
||||
- this.level.addFreshEntity(entitylightning);
|
||||
+ ((WorldServer) this.level).strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRIDENT); // CraftBukkit
|
||||
soundeffect = SoundEffects.TRIDENT_THUNDER;
|
||||
f1 = 5.0F;
|
||||
}
|
||||
@@ -157,7 +157,7 @@
|
||||
if (entitylightning != null) {
|
||||
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
|
||||
entitylightning.setCause(entity1 instanceof EntityPlayer ? (EntityPlayer) entity1 : null);
|
||||
- this.level.addFreshEntity(entitylightning);
|
||||
+ ((WorldServer) this.level).strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRIDENT); // CraftBukkit
|
||||
soundeffect = SoundEffects.TRIDENT_THUNDER;
|
||||
f1 = 5.0F;
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
+ }
|
||||
+
|
||||
+ public String getPotionType() {
|
||||
+ return IRegistry.POTION.getKey(this.potion).toString();
|
||||
+ return BuiltInRegistries.POTION.getKey(this.potion).toString();
|
||||
+ }
|
||||
+
|
||||
+ public void setPotionType(String string) {
|
||||
+ this.potion = IRegistry.POTION.get(new net.minecraft.resources.MinecraftKey(string));
|
||||
+ this.potion = BuiltInRegistries.POTION.get(new net.minecraft.resources.MinecraftKey(string));
|
||||
+ this.getEntityData().set(EntityTippedArrow.ID_EFFECT_COLOR, PotionUtil.getColor((Collection) PotionUtil.getAllEffects(this.potion, (Collection) this.effects)));
|
||||
+ }
|
||||
+
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityWitherSkull.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityWitherSkull.java
|
||||
@@ -21,6 +21,8 @@
|
||||
@@ -20,6 +20,8 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public class EntityWitherSkull extends EntityFireball {
|
||||
|
||||
private static final DataWatcherObject<Boolean> DATA_DANGEROUS = DataWatcher.defineId(EntityWitherSkull.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -64,7 +66,7 @@
|
||||
@@ -63,7 +65,7 @@
|
||||
if (entity.isAlive()) {
|
||||
this.doEnchantDamageEffects(entityliving, entity);
|
||||
} else {
|
||||
@@ -18,7 +18,7 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -81,7 +83,7 @@
|
||||
@@ -80,7 +82,7 @@
|
||||
}
|
||||
|
||||
if (b0 > 0) {
|
||||
@@ -27,18 +27,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +96,15 @@
|
||||
@@ -91,7 +93,15 @@
|
||||
protected void onHit(MovingObjectPosition movingobjectposition) {
|
||||
super.onHit(movingobjectposition);
|
||||
if (!this.level.isClientSide) {
|
||||
Explosion.Effect explosion_effect = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
|
||||
|
||||
- this.level.explode(this, this.getX(), this.getY(), this.getZ(), 1.0F, false, explosion_effect);
|
||||
- this.level.explode(this, this.getX(), this.getY(), this.getZ(), 1.0F, false, World.a.MOB);
|
||||
+ // CraftBukkit start
|
||||
+ // this.level.createExplosion(this, this.locX(), this.locY(), this.locZ(), 1.0F, false, explosion_effect);
|
||||
+ // this.level.explode(this, this.getX(), this.getY(), this.getZ(), 1.0F, false, World.a.MOB);
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 1.0F, false);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), explosion_effect);
|
||||
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.discard();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/IProjectile.java
|
||||
+++ b/net/minecraft/world/entity/projectile/IProjectile.java
|
||||
@@ -22,6 +22,10 @@
|
||||
@@ -23,6 +23,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
public abstract class IProjectile extends Entity {
|
||||
|
||||
@Nullable
|
||||
@@ -31,6 +35,10 @@
|
||||
@@ -32,6 +36,10 @@
|
||||
private boolean leftOwner;
|
||||
private boolean hasBeenShot;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
IProjectile(EntityTypes<? extends IProjectile> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
}
|
||||
@@ -40,6 +48,7 @@
|
||||
@@ -41,6 +49,7 @@
|
||||
this.ownerUUID = entity.getUUID();
|
||||
this.cachedOwner = entity;
|
||||
}
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -143,6 +152,16 @@
|
||||
@@ -144,6 +153,16 @@
|
||||
this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, entity.isOnGround() ? 0.0D : vec3d.y, vec3d.z));
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
protected void onHit(MovingObjectPosition movingobjectposition) {
|
||||
MovingObjectPosition.EnumMovingObjectType movingobjectposition_enummovingobjecttype = movingobjectposition.getType();
|
||||
|
||||
@@ -163,6 +182,11 @@
|
||||
@@ -164,6 +183,11 @@
|
||||
protected void onHitEntity(MovingObjectPositionEntity movingobjectpositionentity) {}
|
||||
|
||||
protected void onHitBlock(MovingObjectPositionBlock movingobjectpositionblock) {
|
||||
|
||||
@@ -74,38 +74,38 @@
|
||||
this.stop();
|
||||
return;
|
||||
}
|
||||
@@ -539,6 +554,10 @@
|
||||
Raid.Wave[] araid_wave = Raid.Wave.VALUES;
|
||||
@@ -540,6 +555,10 @@
|
||||
int j = araid_wave.length;
|
||||
int k = 0;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ EntityRaider leader = null;
|
||||
+ List<EntityRaider> raiders = new java.util.ArrayList<>();
|
||||
+ // CraftBukkit end
|
||||
for (int k = 0; k < j; ++k) {
|
||||
while (k < j) {
|
||||
Raid.Wave raid_wave = araid_wave[k];
|
||||
int l = this.getDefaultNumSpawns(raid_wave, i, flag1) + this.getPotentialBonusSpawns(raid_wave, this.random, i, difficultydamagescaler, flag1);
|
||||
@@ -551,9 +570,11 @@
|
||||
entityraider.setPatrolLeader(true);
|
||||
this.setLeader(i, entityraider);
|
||||
flag = true;
|
||||
+ leader = entityraider; // CraftBukkit
|
||||
}
|
||||
@@ -555,9 +574,11 @@
|
||||
entityraider.setPatrolLeader(true);
|
||||
this.setLeader(i, entityraider);
|
||||
flag = true;
|
||||
+ leader = entityraider; // CraftBukkit
|
||||
}
|
||||
|
||||
this.joinRaid(i, entityraider, blockposition, false);
|
||||
+ raiders.add(entityraider); // CraftBukkit
|
||||
if (raid_wave.entityType == EntityTypes.RAVAGER) {
|
||||
EntityRaider entityraider1 = null;
|
||||
|
||||
@@ -572,6 +593,7 @@
|
||||
this.joinRaid(i, entityraider1, blockposition, false);
|
||||
entityraider1.moveTo(blockposition, 0.0F, 0.0F);
|
||||
entityraider1.startRiding(entityraider);
|
||||
this.joinRaid(i, entityraider, blockposition, false);
|
||||
+ raiders.add(entityraider); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -581,6 +603,7 @@
|
||||
if (raid_wave.entityType == EntityTypes.RAVAGER) {
|
||||
EntityRaider entityraider1 = null;
|
||||
|
||||
@@ -576,6 +597,7 @@
|
||||
this.joinRaid(i, entityraider1, blockposition, false);
|
||||
entityraider1.moveTo(blockposition, 0.0F, 0.0F);
|
||||
entityraider1.startRiding(entityraider);
|
||||
+ raiders.add(entityraider); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -593,6 +615,7 @@
|
||||
++this.groupsSpawned;
|
||||
this.updateBossbar();
|
||||
this.setDirty();
|
||||
@@ -113,7 +113,7 @@
|
||||
}
|
||||
|
||||
public void joinRaid(int i, EntityRaider entityraider, @Nullable BlockPosition blockposition, boolean flag) {
|
||||
@@ -596,7 +619,7 @@
|
||||
@@ -608,7 +631,7 @@
|
||||
entityraider.finalizeSpawn(this.level, this.level.getCurrentDifficultyAt(blockposition), EnumMobSpawn.EVENT, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
entityraider.applyRaidBuffs(i, false);
|
||||
entityraider.setOnGround(true);
|
||||
@@ -122,7 +122,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -846,6 +869,12 @@
|
||||
@@ -858,6 +881,12 @@
|
||||
this.heroesOfTheVillage.add(entity.getUUID());
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
public class ChestBoat extends EntityBoat implements HasCustomInventoryScreen, ContainerEntity {
|
||||
|
||||
@@ -215,4 +222,51 @@
|
||||
@@ -218,4 +225,51 @@
|
||||
public void clearItemStacks() {
|
||||
this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/vehicle/EntityBoat.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/EntityBoat.java
|
||||
@@ -51,6 +51,15 @@
|
||||
@@ -53,6 +53,15 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
+import org.bukkit.event.vehicle.VehicleMoveEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityBoat extends Entity {
|
||||
public class EntityBoat extends Entity implements VariantHolder<EntityBoat.EnumBoatType> {
|
||||
|
||||
private static final DataWatcherObject<Integer> DATA_ID_HURT = DataWatcher.defineId(EntityBoat.class, DataWatcherRegistry.INT);
|
||||
@@ -91,6 +100,14 @@
|
||||
@@ -93,6 +102,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];
|
||||
@@ -160,6 +177,19 @@
|
||||
@@ -162,6 +179,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);
|
||||
@@ -168,6 +198,15 @@
|
||||
@@ -170,6 +200,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.destroy(damagesource);
|
||||
}
|
||||
@@ -207,9 +246,29 @@
|
||||
@@ -209,9 +248,29 @@
|
||||
public void push(Entity entity) {
|
||||
if (entity instanceof EntityBoat) {
|
||||
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
|
||||
@@ -97,7 +97,7 @@
|
||||
super.push(entity);
|
||||
}
|
||||
|
||||
@@ -262,6 +321,7 @@
|
||||
@@ -276,6 +335,7 @@
|
||||
return this.getDirection().getClockWise();
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
@Override
|
||||
public void tick() {
|
||||
this.oldStatus = this.status;
|
||||
@@ -302,6 +362,22 @@
|
||||
@@ -316,6 +376,22 @@
|
||||
this.setDeltaMovement(Vec3D.ZERO);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
this.tickBubbleColumn();
|
||||
|
||||
for (int i = 0; i <= 1; ++i) {
|
||||
@@ -809,6 +885,11 @@
|
||||
@@ -823,6 +899,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;
|
||||
@@ -822,6 +903,7 @@
|
||||
@@ -836,6 +917,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
|
||||
@@ -48,6 +48,15 @@
|
||||
@@ -47,6 +47,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);
|
||||
@@ -90,6 +99,17 @@
|
||||
@@ -89,6 +98,17 @@
|
||||
private double lyd;
|
||||
private double lzd;
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
protected EntityMinecartAbstract(EntityTypes<?> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
this.blocksBuilding = true;
|
||||
@@ -216,6 +236,19 @@
|
||||
@@ -215,6 +235,19 @@
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -54,7 +54,7 @@
|
||||
this.setHurtDir(-this.getHurtDir());
|
||||
this.setHurtTime(10);
|
||||
this.markHurt();
|
||||
@@ -224,6 +257,15 @@
|
||||
@@ -223,6 +256,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();
|
||||
@@ -285,6 +327,14 @@
|
||||
@@ -284,6 +326,14 @@
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -85,7 +85,7 @@
|
||||
if (this.getHurtTime() > 0) {
|
||||
this.setHurtTime(this.getHurtTime() - 1);
|
||||
}
|
||||
@@ -294,7 +344,7 @@
|
||||
@@ -293,7 +343,7 @@
|
||||
}
|
||||
|
||||
this.checkOutOfWorld();
|
||||
@@ -94,7 +94,7 @@
|
||||
double d0;
|
||||
|
||||
if (this.level.isClientSide) {
|
||||
@@ -360,6 +410,18 @@
|
||||
@@ -359,6 +409,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));
|
||||
|
||||
@@ -368,8 +430,26 @@
|
||||
@@ -367,8 +429,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);
|
||||
}
|
||||
}
|
||||
@@ -381,6 +461,14 @@
|
||||
@@ -380,6 +460,14 @@
|
||||
Entity entity1 = (Entity) iterator.next();
|
||||
|
||||
if (!this.hasPassenger(entity1) && entity1.isPushable() && entity1 instanceof EntityMinecartAbstract) {
|
||||
@@ -155,7 +155,7 @@
|
||||
entity1.push(this);
|
||||
}
|
||||
}
|
||||
@@ -397,7 +485,7 @@
|
||||
@@ -396,7 +484,7 @@
|
||||
}
|
||||
|
||||
protected double getMaxSpeed() {
|
||||
@@ -164,7 +164,7 @@
|
||||
}
|
||||
|
||||
public void activateMinecart(int i, int j, int k, boolean flag) {}
|
||||
@@ -408,12 +496,16 @@
|
||||
@@ -407,12 +495,16 @@
|
||||
|
||||
this.setDeltaMovement(MathHelper.clamp(vec3d.x, -d0, d0), vec3d.y, MathHelper.clamp(vec3d.z, -d0, d0));
|
||||
if (this.onGround) {
|
||||
@@ -183,7 +183,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -604,7 +696,7 @@
|
||||
@@ -603,7 +695,7 @@
|
||||
}
|
||||
|
||||
protected void applyNaturalSlowdown() {
|
||||
@@ -192,7 +192,7 @@
|
||||
Vec3D vec3d = this.getDeltaMovement();
|
||||
|
||||
vec3d = vec3d.multiply(d0, 0.0D, d0);
|
||||
@@ -743,6 +835,14 @@
|
||||
@@ -742,6 +834,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;
|
||||
@@ -922,4 +1022,26 @@
|
||||
@@ -916,4 +1016,26 @@
|
||||
|
||||
private EnumMinecartType() {}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java
|
||||
@@ -20,6 +20,10 @@
|
||||
@@ -22,6 +22,10 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
public class EntityMinecartTNT extends EntityMinecartAbstract {
|
||||
|
||||
private static final byte EVENT_PRIME = 10;
|
||||
@@ -106,7 +110,15 @@
|
||||
@@ -114,7 +118,15 @@
|
||||
d1 = 5.0D;
|
||||
}
|
||||
|
||||
- this.level.explode(this, this.getX(), this.getY(), this.getZ(), (float) (4.0D + this.random.nextDouble() * 1.5D * d1), Explosion.Effect.BREAK);
|
||||
- this.level.explode(this, damagesource, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), (float) (4.0D + this.random.nextDouble() * 1.5D * d1), false, World.a.TNT);
|
||||
+ // CraftBukkit start
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), (float) (4.0D + this.random.nextDouble() * 1.5D * d1), false);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
@@ -23,7 +23,7 @@
|
||||
+ fuse = -1;
|
||||
+ return;
|
||||
+ }
|
||||
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Explosion.Effect.BREAK);
|
||||
+ this.level.explode(this, damagesource, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.TNT);
|
||||
+ // CraftBukkit end
|
||||
this.discard();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user