Update to Minecraft 1.20.2

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2023-09-22 02:40:00 +10:00
parent 193398c0ff
commit 8a3c8cfcd4
238 changed files with 2448 additions and 2344 deletions

View File

@@ -1,90 +0,0 @@
--- a/net/minecraft/world/entity/Display.java
+++ b/net/minecraft/world/entity/Display.java
@@ -183,11 +183,11 @@
@Override
protected void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
- DataResult dataresult;
+ // DataResult dataresult; // CraftBukkit - decompile error
Logger logger;
if (nbttagcompound.contains("transformation")) {
- dataresult = Transformation.EXTENDED_CODEC.decode(DynamicOpsNBT.INSTANCE, nbttagcompound.get("transformation"));
+ DataResult<Pair<Transformation, net.minecraft.nbt.NBTBase>> dataresult = Transformation.EXTENDED_CODEC.decode(DynamicOpsNBT.INSTANCE, nbttagcompound.get("transformation")); // CraftBukkit - decompile error
logger = Display.LOGGER;
Objects.requireNonNull(logger);
dataresult.resultOrPartial(SystemUtils.prefix("Display entity", logger::error)).ifPresent((pair) -> {
@@ -208,7 +208,7 @@
}
if (nbttagcompound.contains("billboard", 8)) {
- dataresult = Display.BillboardConstraints.CODEC.decode(DynamicOpsNBT.INSTANCE, nbttagcompound.get("billboard"));
+ DataResult<Pair<Display.BillboardConstraints, net.minecraft.nbt.NBTBase>> dataresult = Display.BillboardConstraints.CODEC.decode(DynamicOpsNBT.INSTANCE, nbttagcompound.get("billboard")); // CraftBukkit - decompile error
logger = Display.LOGGER;
Objects.requireNonNull(logger);
dataresult.resultOrPartial(SystemUtils.prefix("Display entity", logger::error)).ifPresent((pair) -> {
@@ -241,7 +241,7 @@
}
if (nbttagcompound.contains("brightness", 10)) {
- dataresult = Brightness.CODEC.decode(DynamicOpsNBT.INSTANCE, nbttagcompound.get("brightness"));
+ DataResult<Pair<Brightness, net.minecraft.nbt.NBTBase>> dataresult = Brightness.CODEC.decode(DynamicOpsNBT.INSTANCE, nbttagcompound.get("brightness")); // CraftBukkit - decompile error
logger = Display.LOGGER;
Objects.requireNonNull(logger);
dataresult.resultOrPartial(SystemUtils.prefix("Display entity", logger::error)).ifPresent((pair) -> {
@@ -594,8 +594,8 @@
private static final byte INITIAL_TEXT_OPACITY = -1;
public static final int INITIAL_BACKGROUND = 1073741824;
private static final DataWatcherObject<IChatBaseComponent> DATA_TEXT_ID = DataWatcher.defineId(Display.TextDisplay.class, DataWatcherRegistry.COMPONENT);
- private static final DataWatcherObject<Integer> DATA_LINE_WIDTH_ID = DataWatcher.defineId(Display.TextDisplay.class, DataWatcherRegistry.INT);
- private static final DataWatcherObject<Integer> DATA_BACKGROUND_COLOR_ID = DataWatcher.defineId(Display.TextDisplay.class, DataWatcherRegistry.INT);
+ public static final DataWatcherObject<Integer> DATA_LINE_WIDTH_ID = DataWatcher.defineId(Display.TextDisplay.class, DataWatcherRegistry.INT);
+ public static final DataWatcherObject<Integer> DATA_BACKGROUND_COLOR_ID = DataWatcher.defineId(Display.TextDisplay.class, DataWatcherRegistry.INT);
private static final DataWatcherObject<Byte> DATA_TEXT_OPACITY_ID = DataWatcher.defineId(Display.TextDisplay.class, DataWatcherRegistry.BYTE);
private static final DataWatcherObject<Byte> DATA_STYLE_FLAGS_ID = DataWatcher.defineId(Display.TextDisplay.class, DataWatcherRegistry.BYTE);
private static final IntSet TEXT_RENDER_STATE_IDS = IntSet.of(new int[]{Display.TextDisplay.DATA_TEXT_ID.getId(), Display.TextDisplay.DATA_LINE_WIDTH_ID.getId(), Display.TextDisplay.DATA_BACKGROUND_COLOR_ID.getId(), Display.TextDisplay.DATA_TEXT_OPACITY_ID.getId(), Display.TextDisplay.DATA_STYLE_FLAGS_ID.getId()});
@@ -614,7 +614,7 @@
this.entityData.define(Display.TextDisplay.DATA_TEXT_ID, IChatBaseComponent.empty());
this.entityData.define(Display.TextDisplay.DATA_LINE_WIDTH_ID, 200);
this.entityData.define(Display.TextDisplay.DATA_BACKGROUND_COLOR_ID, 1073741824);
- this.entityData.define(Display.TextDisplay.DATA_TEXT_OPACITY_ID, -1);
+ this.entityData.define(Display.TextDisplay.DATA_TEXT_OPACITY_ID, (byte) -1); // CraftBukkit - decompile error
this.entityData.define(Display.TextDisplay.DATA_STYLE_FLAGS_ID, (byte) 0);
}
@@ -639,7 +639,7 @@
return (Integer) this.entityData.get(Display.TextDisplay.DATA_LINE_WIDTH_ID);
}
- public void setLineWidth(int i) {
+ private void setLineWidth(int i) {
this.entityData.set(Display.TextDisplay.DATA_LINE_WIDTH_ID, i);
}
@@ -655,7 +655,7 @@
return (Integer) this.entityData.get(Display.TextDisplay.DATA_BACKGROUND_COLOR_ID);
}
- public void setBackgroundColor(int i) {
+ private void setBackgroundColor(int i) {
this.entityData.set(Display.TextDisplay.DATA_BACKGROUND_COLOR_ID, i);
}
@@ -690,7 +690,7 @@
b0 = loadFlag(b0, nbttagcompound, "see_through", (byte) 2);
b0 = loadFlag(b0, nbttagcompound, "default_background", (byte) 4);
- DataResult dataresult = Display.TextDisplay.Align.CODEC.decode(DynamicOpsNBT.INSTANCE, nbttagcompound.get("alignment"));
+ DataResult<Pair<Display.TextDisplay.Align, net.minecraft.nbt.NBTBase>> dataresult = Display.TextDisplay.Align.CODEC.decode(DynamicOpsNBT.INSTANCE, nbttagcompound.get("alignment")); // CraftBukkit - decompile error
Logger logger = Display.LOGGER;
Objects.requireNonNull(logger);
@@ -961,7 +961,7 @@
super.readAdditionalSaveData(nbttagcompound);
this.setItemStack(ItemStack.of(nbttagcompound.getCompound("item")));
if (nbttagcompound.contains("item_display", 8)) {
- DataResult dataresult = ItemDisplayContext.CODEC.decode(DynamicOpsNBT.INSTANCE, nbttagcompound.get("item_display"));
+ DataResult<Pair<ItemDisplayContext, net.minecraft.nbt.NBTBase>> dataresult = ItemDisplayContext.CODEC.decode(DynamicOpsNBT.INSTANCE, nbttagcompound.get("item_display")); // CraftBukkit - decompile error
Logger logger = Display.LOGGER;
Objects.requireNonNull(logger);

View File

@@ -1,11 +1,10 @@
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -124,8 +124,66 @@
import net.minecraft.world.scores.ScoreboardTeamBase;
@@ -125,8 +125,65 @@
import org.joml.Vector3f;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.core.Position;
+import net.minecraft.world.level.dimension.WorldDimension;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
@@ -67,7 +66,7 @@
private static final Logger LOGGER = LogUtils.getLogger();
public static final String ID_TAG = "id";
public static final String PASSENGERS_TAG = "Passengers";
@@ -240,6 +298,25 @@
@@ -241,6 +298,25 @@
public boolean hasVisualFire;
@Nullable
private IBlockData feetBlockState;
@@ -93,7 +92,7 @@
public Entity(EntityTypes<?> entitytypes, World world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
@@ -373,6 +450,12 @@
@@ -374,6 +450,12 @@
public void onClientRemoval() {}
public void setPose(EntityPose entitypose) {
@@ -106,7 +105,7 @@
this.entityData.set(Entity.DATA_POSE, entitypose);
}
@@ -397,6 +480,33 @@
@@ -398,6 +480,33 @@
}
protected void setRot(float f, float f1) {
@@ -140,7 +139,7 @@
this.setYRot(f % 360.0F);
this.setXRot(f1 % 360.0F);
}
@@ -438,6 +548,15 @@
@@ -439,6 +548,15 @@
this.baseTick();
}
@@ -156,7 +155,7 @@
public void baseTick() {
this.level().getProfiler().push("entityBaseTick");
this.feetBlockState = null;
@@ -452,7 +571,7 @@
@@ -453,7 +571,7 @@
this.walkDistO = this.walkDist;
this.xRotO = this.getXRot();
this.yRotO = this.getYRot();
@@ -165,7 +164,7 @@
if (this.canSpawnSprintParticle()) {
this.spawnSprintParticle();
}
@@ -487,6 +606,10 @@
@@ -488,6 +606,10 @@
if (this.isInLava()) {
this.lavaHurt();
this.fallDistance *= 0.5F;
@@ -176,7 +175,7 @@
}
this.checkBelowWorld();
@@ -538,15 +661,48 @@
@@ -539,15 +661,48 @@
public void lavaHurt() {
if (!this.fireImmune()) {
@@ -226,7 +225,7 @@
int j = i * 20;
if (this instanceof EntityLiving) {
@@ -697,6 +853,28 @@
@@ -698,6 +853,28 @@
block.updateEntityAfterFallOn(this.level(), this);
}
@@ -255,7 +254,7 @@
if (this.onGround()) {
block.stepOn(this.level(), blockposition, iblockdata, this);
}
@@ -1024,6 +1202,20 @@
@@ -1025,6 +1202,20 @@
return SoundEffects.GENERIC_SPLASH;
}
@@ -276,7 +275,7 @@
protected void checkInsideBlocks() {
AxisAlignedBB axisalignedbb = this.getBoundingBox();
BlockPosition blockposition = BlockPosition.containing(axisalignedbb.minX + 1.0E-7D, axisalignedbb.minY + 1.0E-7D, axisalignedbb.minZ + 1.0E-7D);
@@ -1430,6 +1622,7 @@
@@ -1439,6 +1630,7 @@
this.yo = d1;
this.zo = d4;
this.setPos(d3, d1, d4);
@@ -284,7 +283,7 @@
}
public void moveTo(Vec3D vec3d) {
@@ -1624,6 +1817,12 @@
@@ -1633,6 +1825,12 @@
return false;
}
@@ -297,7 +296,7 @@
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
if (entity instanceof EntityPlayer) {
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
@@ -1657,7 +1856,7 @@
@@ -1666,7 +1864,7 @@
} else {
String s = this.getEncodeId();
@@ -306,7 +305,7 @@
return false;
} else {
nbttagcompound.putString("id", s);
@@ -1682,6 +1881,18 @@
@@ -1691,6 +1889,18 @@
Vec3D vec3d = this.getDeltaMovement();
nbttagcompound.put("Motion", this.newDoubleList(vec3d.x, vec3d.y, vec3d.z));
@@ -325,7 +324,7 @@
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
nbttagcompound.putFloat("FallDistance", this.fallDistance);
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
@@ -1690,6 +1901,25 @@
@@ -1699,6 +1909,25 @@
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
nbttagcompound.putUUID("UUID", this.getUUID());
@@ -351,7 +350,7 @@
IChatBaseComponent ichatbasecomponent = this.getCustomName();
if (ichatbasecomponent != null) {
@@ -1757,6 +1987,11 @@
@@ -1766,6 +1995,11 @@
}
}
@@ -363,7 +362,7 @@
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -1840,6 +2075,45 @@
@@ -1849,6 +2083,45 @@
} else {
throw new IllegalStateException("Entity has invalid position");
}
@@ -409,7 +408,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
@@ -1915,9 +2189,22 @@
@@ -1924,9 +2197,22 @@
} else if (this.level().isClientSide) {
return null;
} else {
@@ -432,7 +431,7 @@
this.level().addFreshEntity(entityitem);
return entityitem;
}
@@ -2007,6 +2294,18 @@
@@ -2024,6 +2310,18 @@
if (!flag && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
return false;
} else {
@@ -451,7 +450,7 @@
if (this.isPassenger()) {
this.stopRiding();
}
@@ -2044,7 +2343,7 @@
@@ -2057,7 +2355,7 @@
Entity entity = this.vehicle;
this.vehicle = null;
@@ -460,7 +459,7 @@
}
}
@@ -2075,10 +2374,29 @@
@@ -2088,10 +2386,29 @@
}
}
@@ -491,7 +490,7 @@
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
this.passengers = ImmutableList.of();
} else {
@@ -2090,6 +2408,7 @@
@@ -2103,6 +2420,7 @@
entity.boardingCooldown = 60;
this.gameEvent(GameEvent.ENTITY_DISMOUNT, entity);
}
@@ -499,7 +498,7 @@
}
protected boolean canAddPassenger(Entity entity) {
@@ -2156,14 +2475,20 @@
@@ -2189,14 +2507,20 @@
if (this.isInsidePortal) {
MinecraftServer minecraftserver = worldserver.getServer();
@@ -523,7 +522,7 @@
this.level().getProfiler().pop();
}
@@ -2283,6 +2608,13 @@
@@ -2320,6 +2644,13 @@
}
public void setSwimming(boolean flag) {
@@ -537,7 +536,7 @@
this.setSharedFlag(4, flag);
}
@@ -2332,8 +2664,12 @@
@@ -2369,8 +2700,12 @@
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
}
@@ -551,7 +550,7 @@
}
public boolean getSharedFlag(int i) {
@@ -2352,7 +2688,7 @@
@@ -2389,7 +2724,7 @@
}
public int getMaxAirSupply() {
@@ -560,7 +559,7 @@
}
public int getAirSupply() {
@@ -2360,7 +2696,18 @@
@@ -2397,7 +2732,18 @@
}
public void setAirSupply(int i) {
@@ -580,7 +579,7 @@
}
public int getTicksFrozen() {
@@ -2387,11 +2734,41 @@
@@ -2424,11 +2770,41 @@
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
this.setRemainingFireTicks(this.remainingFireTicks + 1);
@@ -624,7 +623,7 @@
}
public void onAboveBubbleCol(boolean flag) {
@@ -2556,15 +2933,38 @@
@@ -2593,15 +2969,38 @@
@Nullable
public Entity changeDimension(WorldServer worldserver) {
@@ -633,7 +632,7 @@
+ }
+
+ @Nullable
+ public Entity teleportTo(WorldServer worldserver, Position location) {
+ public Entity teleportTo(WorldServer worldserver, Vec3D location) {
+ // CraftBukkit end
if (this.level() instanceof WorldServer && !this.isRemoved()) {
this.level().getProfiler().push("changeDimension");
@@ -665,7 +664,7 @@
this.level().getProfiler().popPush("reloading");
Entity entity = this.getType().create(worldserver);
@@ -2573,9 +2973,17 @@
@@ -2610,9 +3009,17 @@
entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
entity.setDeltaMovement(shapedetectorshape.speed);
worldserver.addDuringTeleport(entity);
@@ -685,7 +684,7 @@
}
this.removeAfterChangingDimensions();
@@ -2596,20 +3004,34 @@
@@ -2633,20 +3040,34 @@
@Nullable
protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) {
@@ -711,7 +710,7 @@
double d0 = DimensionManager.getTeleportationScale(this.level().dimensionType(), worldserver.dimensionType());
BlockPosition blockposition = worldborder.clampToBounds(this.getX() * d0, this.getY(), this.getZ() * d0);
+ // CraftBukkit start
+ CraftPortalEvent event = callPortalEvent(this, worldserver, new Position(blockposition.getX(), blockposition.getY(), blockposition.getZ()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16);
+ CraftPortalEvent event = callPortalEvent(this, worldserver, new Vec3D(blockposition.getX(), blockposition.getY(), blockposition.getZ()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16);
+ if (event == null) {
+ return null;
+ }
@@ -725,7 +724,7 @@
IBlockData iblockdata = this.level().getBlockState(this.portalEntrancePos);
EnumDirection.EnumAxis enumdirection_enumaxis;
Vec3D vec3d;
@@ -2626,8 +3048,8 @@
@@ -2663,8 +3084,8 @@
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
}
@@ -736,12 +735,12 @@
}
} else {
BlockPosition blockposition1;
@@ -2637,8 +3059,14 @@
@@ -2674,8 +3095,14 @@
} else {
blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos());
}
+ // CraftBukkit start
+ CraftPortalEvent event = callPortalEvent(this, worldserver, new Position(blockposition1.getX() + 0.5D, blockposition1.getY(), blockposition1.getZ() + 0.5D), PlayerTeleportEvent.TeleportCause.END_PORTAL, 0, 0);
+ CraftPortalEvent event = callPortalEvent(this, worldserver, new Vec3D(blockposition1.getX() + 0.5D, blockposition1.getY(), blockposition1.getZ() + 0.5D), PlayerTeleportEvent.TeleportCause.END_PORTAL, 0, 0);
+ if (event == null) {
+ return null;
+ }
@@ -752,14 +751,14 @@
}
}
@@ -2646,8 +3074,23 @@
@@ -2683,8 +3110,23 @@
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
}
- protected Optional<BlockUtil.Rectangle> getExitPortal(WorldServer worldserver, BlockPosition blockposition, boolean flag, WorldBorder worldborder) {
- return worldserver.getPortalForcer().findPortalAround(blockposition, flag, worldborder);
+ // CraftBukkit start
+ protected CraftPortalEvent callPortalEvent(Entity entity, WorldServer exitWorldServer, Position exitPosition, PlayerTeleportEvent.TeleportCause cause, int searchRadius, int creationRadius) {
+ protected CraftPortalEvent callPortalEvent(Entity entity, WorldServer exitWorldServer, Vec3D exitPosition, PlayerTeleportEvent.TeleportCause cause, int searchRadius, int creationRadius) {
+ org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
+ Location enter = bukkitEntity.getLocation();
+ Location exit = CraftLocation.toBukkit(exitPosition, exitWorldServer.getWorld());
@@ -778,7 +777,7 @@
}
public boolean canChangeDimensions() {
@@ -2767,6 +3210,12 @@
@@ -2804,6 +3246,12 @@
}
}
@@ -791,7 +790,7 @@
public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<RelativeMovement> set, float f, float f1) {
float f2 = MathHelper.clamp(f1, -90.0F, 90.0F);
@@ -2901,7 +3350,26 @@
@@ -2929,7 +3377,26 @@
}
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
@@ -819,7 +818,7 @@
}
protected float getEyeHeight(EntityPose entitypose, EntitySize entitysize) {
@@ -3212,6 +3680,11 @@
@@ -3240,6 +3707,11 @@
vec3d = vec3d.add(vec3d1);
++k1;
}

View File

@@ -13,25 +13,7 @@
public class EntityAreaEffectCloud extends Entity implements TraceableEntity {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -44,7 +50,7 @@
private static final float DEFAULT_RADIUS = 3.0F;
public static final float DEFAULT_WIDTH = 6.0F;
public static final float HEIGHT = 0.5F;
- private PotionRegistry potion;
+ public PotionRegistry potion; // CraftBukkit - private -> public
public List<MobEffect> effects;
private final Map<Entity, Integer> victims;
private int duration;
@@ -112,7 +118,7 @@
}
- private void updateColor() {
+ public void updateColor() { // Craftbukkit - private -> public
if (this.potion == Potions.EMPTY && this.effects.isEmpty()) {
this.getEntityData().set(EntityAreaEffectCloud.DATA_COLOR, 0);
} else {
@@ -263,6 +269,7 @@
@@ -264,6 +270,7 @@
if (!list1.isEmpty()) {
Iterator iterator1 = list1.iterator();
@@ -39,7 +21,7 @@
while (iterator1.hasNext()) {
EntityLiving entityliving = (EntityLiving) iterator1.next();
@@ -272,6 +279,17 @@
@@ -273,6 +280,17 @@
double d8 = d6 * d6 + d7 * d7;
if (d8 <= (double) (f * f)) {
@@ -57,7 +39,7 @@
this.victims.put(entityliving, this.tickCount + this.reapplicationDelay);
Iterator iterator2 = list.iterator();
@@ -281,7 +299,7 @@
@@ -282,7 +300,7 @@
if (mobeffect1.getEffect().isInstantenous()) {
mobeffect1.getEffect().applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect1.getAmplifier(), 0.5D);
} else {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityCreature.java
+++ b/net/minecraft/world/entity/EntityCreature.java
@@ -7,6 +7,10 @@
@@ -9,6 +9,10 @@
import net.minecraft.world.level.World;
import net.minecraft.world.phys.Vec3D;
@@ -11,7 +11,7 @@
public abstract class EntityCreature extends EntityInsentient {
protected static final float DEFAULT_WALK_TARGET_VALUE = 0.0F;
@@ -43,6 +47,7 @@
@@ -51,6 +55,7 @@
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isInSittingPose()) {
if (f > 10.0F) {
@@ -19,7 +19,7 @@
this.dropLeash(true, true);
}
@@ -51,6 +56,7 @@
@@ -59,6 +64,7 @@
this.onLeashDistance(f);
if (f > 10.0F) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/EntityInsentient.java
+++ b/net/minecraft/world/entity/EntityInsentient.java
@@ -74,6 +74,19 @@
import net.minecraft.world.level.material.FluidType;
@@ -75,6 +75,19 @@
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.phys.AxisAlignedBB;
+// CraftBukkit start
+import net.minecraft.server.level.EntityPlayer;
@@ -20,7 +20,7 @@
public abstract class EntityInsentient extends EntityLiving implements Targeting {
private static final DataWatcherObject<Byte> DATA_MOB_FLAGS_ID = DataWatcher.defineId(EntityInsentient.class, DataWatcherRegistry.BYTE);
@@ -120,6 +133,8 @@
@@ -122,6 +135,8 @@
private BlockPosition restrictCenter;
private float restrictRadius;
@@ -29,7 +29,7 @@
protected EntityInsentient(EntityTypes<? extends EntityInsentient> entitytypes, World world) {
super(entitytypes, world);
this.handItems = NonNullList.withSize(2, ItemStack.EMPTY);
@@ -145,6 +160,12 @@
@@ -147,6 +162,12 @@
}
@@ -42,7 +42,7 @@
protected void registerGoals() {}
public static AttributeProvider.Builder createMobAttributes() {
@@ -257,7 +278,38 @@
@@ -258,7 +279,38 @@
}
public void setTarget(@Nullable EntityLiving entityliving) {
@@ -81,7 +81,7 @@
}
@Override
@@ -397,6 +449,12 @@
@@ -398,6 +450,12 @@
return null;
}
@@ -94,7 +94,7 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@@ -486,16 +544,26 @@
@@ -487,16 +545,26 @@
nbttagcompound.putBoolean("NoAI", this.isNoAi());
}
@@ -123,7 +123,7 @@
NBTTagList nbttaglist;
int i;
@@ -542,6 +610,11 @@
@@ -543,6 +611,11 @@
}
this.setNoAi(nbttagcompound.getBoolean("NoAI"));
@@ -135,7 +135,7 @@
}
@Override
@@ -609,7 +682,7 @@
@@ -610,7 +683,7 @@
protected void pickUpItem(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItem();
@@ -144,7 +144,7 @@
if (!itemstack1.isEmpty()) {
this.onItemPickup(entityitem);
@@ -623,6 +696,12 @@
@@ -624,6 +697,12 @@
}
public ItemStack equipItemIfPossible(ItemStack itemstack) {
@@ -157,7 +157,7 @@
EnumItemSlot enumitemslot = getEquipmentSlotForItem(itemstack);
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
boolean flag = this.canReplaceCurrentItem(itemstack, itemstack1);
@@ -633,11 +712,19 @@
@@ -634,11 +713,19 @@
flag = itemstack1.isEmpty();
}
@@ -178,7 +178,7 @@
}
if (enumitemslot.isArmor() && itemstack.getCount() > 1) {
@@ -782,6 +869,7 @@
@@ -790,6 +877,7 @@
@Override
protected final void serverAiStep() {
++this.noActionTime;
@@ -186,7 +186,7 @@
this.level().getProfiler().push("sensing");
this.sensing.tick();
this.level().getProfiler().pop();
@@ -1175,6 +1263,12 @@
@@ -1183,6 +1271,12 @@
if (!this.isAlive()) {
return EnumInteractionResult.PASS;
} else if (this.getLeashHolder() == entityhuman) {
@@ -199,7 +199,7 @@
this.dropLeash(true, !entityhuman.getAbilities().instabuild);
this.gameEvent(GameEvent.ENTITY_INTERACT, entityhuman);
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
@@ -1200,6 +1294,12 @@
@@ -1208,6 +1302,12 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.LEAD) && this.canBeLeashed(entityhuman)) {
@@ -212,7 +212,7 @@
this.setLeashedTo(entityhuman, true);
itemstack.shrink(1);
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
@@ -1215,7 +1315,7 @@
@@ -1223,7 +1323,7 @@
if (itemstack.getItem() instanceof ItemMonsterEgg) {
if (this.level() instanceof WorldServer) {
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
@@ -221,7 +221,7 @@
optional.ifPresent((entityinsentient) -> {
this.onOffspringSpawnedFromEgg(entityhuman, entityinsentient);
@@ -1265,12 +1365,19 @@
@@ -1273,12 +1373,19 @@
return this.restrictRadius != -1.0F;
}
@@ -242,7 +242,7 @@
if (t0 == null) {
return null;
@@ -1304,7 +1411,12 @@
@@ -1312,7 +1419,12 @@
}
}
@@ -256,7 +256,7 @@
if (this.isPassenger()) {
Entity entity = this.getVehicle();
@@ -1325,6 +1437,7 @@
@@ -1333,6 +1445,7 @@
if (this.leashHolder != null) {
if (!this.isAlive() || !this.leashHolder.isAlive()) {
@@ -264,7 +264,7 @@
this.dropLeash(true, true);
}
@@ -1336,7 +1449,9 @@
@@ -1344,7 +1457,9 @@
this.leashHolder = null;
this.leashInfoTag = null;
if (!this.level().isClientSide && flag1) {
@@ -274,7 +274,7 @@
}
if (!this.level().isClientSide && flag && this.level() instanceof WorldServer) {
@@ -1386,6 +1501,7 @@
@@ -1394,6 +1509,7 @@
boolean flag1 = super.startRiding(entity, flag);
if (flag1 && this.isLeashed()) {
@@ -282,7 +282,7 @@
this.dropLeash(true, true);
}
@@ -1410,7 +1526,9 @@
@@ -1418,7 +1534,9 @@
}
if (this.tickCount > 100) {
@@ -292,7 +292,7 @@
this.leashInfoTag = null;
}
}
@@ -1486,7 +1604,14 @@
@@ -1500,7 +1618,14 @@
int i = EnchantmentManager.getFireAspect(this);
if (i > 0) {
@@ -308,7 +308,7 @@
}
boolean flag = entity.hurt(this.damageSources().mobAttack(this), f);
@@ -1560,6 +1685,7 @@
@@ -1574,6 +1699,7 @@
@Override
protected void removeAfterChangingDimensions() {
super.removeAfterChangingDimensions();

View File

@@ -93,9 +93,9 @@
if (!flag && !ItemStack.isSameItemSameTags(itemstack, itemstack1) && !this.firstTick) {
Equipable equipable = Equipable.get(itemstack1);
if (equipable != null && !this.isSpectator() && equipable.getEquipmentSlot() == enumitemslot) {
- if (!this.level().isClientSide() && !this.isSilent()) {
+ if (!this.level().isClientSide() && !this.isSilent() && !silent) { // CraftBukkit
if (!this.level().isClientSide() && !this.isSpectator()) {
- if (!this.isSilent() && equipable != null && equipable.getEquipmentSlot() == enumitemslot) {
+ if (!this.isSilent() && equipable != null && equipable.getEquipmentSlot() == enumitemslot && !silent) { // CraftBukkit
this.level().playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), equipable.getEquipSound(), this.getSoundSource(), 1.0F, 1.0F);
}
@@ -211,7 +211,7 @@
iterator.remove();
}
@@ -976,18 +1092,48 @@
@@ -976,19 +1092,49 @@
return this.addEffect(mobeffect, (Entity) null);
}
@@ -235,6 +235,7 @@
return false;
} else {
MobEffect mobeffect1 = (MobEffect) this.activeEffects.get(mobeffect.getEffect());
boolean flag = false;
+ // CraftBukkit start
+ boolean override = false;
@@ -251,17 +252,17 @@
if (mobeffect1 == null) {
this.activeEffects.put(mobeffect.getEffect(), mobeffect);
this.onEffectAdded(mobeffect, entity);
return true;
flag = true;
- } else if (mobeffect1.update(mobeffect)) {
+ // CraftBukkit start
+ } else if (event.isOverride()) {
+ mobeffect1.update(mobeffect);
this.onEffectUpdated(mobeffect1, true, entity);
+ // CraftBukkit end
return true;
} else {
return false;
@@ -1024,13 +1170,39 @@
flag = true;
}
@@ -1026,13 +1172,39 @@
return this.getMobType() == EnumMonsterType.UNDEAD;
}
@@ -302,7 +303,7 @@
if (mobeffect != null) {
this.onEffectRemoved(mobeffect);
@@ -1098,20 +1270,55 @@
@@ -1130,20 +1302,55 @@
}
@@ -359,7 +360,7 @@
this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.clamp(f, 0.0F, this.getMaxHealth()));
}
@@ -1125,7 +1332,7 @@
@@ -1157,7 +1364,7 @@
return false;
} else if (this.level().isClientSide) {
return false;
@@ -368,7 +369,7 @@
return false;
} else if (damagesource.is(DamageTypeTags.IS_FIRE) && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
return false;
@@ -1136,10 +1343,11 @@
@@ -1168,10 +1375,11 @@
this.noActionTime = 0;
float f1 = f;
@@ -382,7 +383,7 @@
this.hurtCurrentlyUsedShield(f);
f2 = f;
f = 0.0F;
@@ -1163,23 +1371,33 @@
@@ -1195,23 +1403,33 @@
this.walkAnimation.setSpeed(1.5F);
boolean flag1 = true;
@@ -421,7 +422,7 @@
this.hurtHelmet(damagesource, f);
f *= 0.75F;
}
@@ -1297,19 +1515,32 @@
@@ -1329,19 +1547,32 @@
EnumHand[] aenumhand = EnumHand.values();
int i = aenumhand.length;
@@ -458,7 +459,7 @@
EntityPlayer entityplayer = (EntityPlayer) this;
entityplayer.awardStat(StatisticList.ITEM_USED.get(Items.TOTEM_OF_UNDYING));
@@ -1317,14 +1548,16 @@
@@ -1350,14 +1581,16 @@
}
this.setHealth(1.0F);
@@ -480,7 +481,7 @@
}
}
@@ -1433,14 +1666,22 @@
@@ -1466,14 +1699,22 @@
IBlockData iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
@@ -505,7 +506,7 @@
this.level().addFreshEntity(entityitem);
}
}
@@ -1460,21 +1701,40 @@
@@ -1493,21 +1734,40 @@
boolean flag = this.lastHurtByPlayerTime > 0;
@@ -549,7 +550,7 @@
}
@@ -1565,6 +1825,28 @@
@@ -1599,6 +1859,28 @@
return itemstack.getEatingSound();
}
@@ -578,7 +579,7 @@
public Optional<BlockPosition> getLastClimbablePos() {
return this.lastClimbablePos;
}
@@ -1611,9 +1893,14 @@
@@ -1645,9 +1927,14 @@
int i = this.calculateFallDamage(f, f1);
if (i > 0) {
@@ -594,7 +595,7 @@
return true;
} else {
return flag;
@@ -1665,7 +1952,7 @@
@@ -1699,7 +1986,7 @@
protected float getDamageAfterArmorAbsorb(DamageSource damagesource, float f) {
if (!damagesource.is(DamageTypeTags.BYPASSES_ARMOR)) {
@@ -603,7 +604,7 @@
f = CombatMath.getDamageAfterAbsorb(f, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
}
@@ -1678,7 +1965,8 @@
@@ -1712,7 +1999,8 @@
} else {
int i;
@@ -613,7 +614,7 @@
i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
@@ -1711,16 +1999,125 @@
@@ -1745,16 +2033,125 @@
}
}
@@ -747,7 +748,7 @@
if (f2 > 0.0F && f2 < 3.4028235E37F) {
Entity entity = damagesource.getEntity();
@@ -1731,13 +2128,47 @@
@@ -1765,13 +2162,47 @@
}
}
@@ -797,7 +798,7 @@
}
public CombatTracker getCombatTracker() {
@@ -1758,8 +2189,18 @@
@@ -1796,8 +2227,18 @@
}
public final void setArrowCount(int i) {
@@ -817,7 +818,7 @@
public final int getStingerCount() {
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
@@ -2001,6 +2442,12 @@
@@ -2039,6 +2480,12 @@
public abstract ItemStack getItemBySlot(EnumItemSlot enumitemslot);
@@ -830,7 +831,7 @@
@Override
public abstract void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
@@ -2238,6 +2685,7 @@
@@ -2273,6 +2720,7 @@
}
if (this.onGround() && !this.level().isClientSide) {
@@ -838,7 +839,7 @@
this.setSharedFlag(7, false);
}
} else {
@@ -2809,6 +3257,7 @@
@@ -2837,6 +3285,7 @@
}
if (!this.level().isClientSide) {
@@ -846,7 +847,7 @@
this.setSharedFlag(7, flag);
}
@@ -2968,14 +3417,21 @@
@@ -3027,14 +3476,21 @@
@Override
public boolean isPickable() {
@@ -870,7 +871,7 @@
@Override
public float getYHeadRot() {
return this.yHeadRot;
@@ -3170,7 +3626,26 @@
@@ -3229,7 +3685,26 @@
} else {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
this.triggerItemUseEffects(this.useItem, 16);
@@ -898,7 +899,7 @@
if (itemstack != this.useItem) {
this.setItemInHand(enumhand, itemstack);
@@ -3248,6 +3723,12 @@
@@ -3307,6 +3782,12 @@
}
public boolean randomTeleport(double d0, double d1, double d2, boolean flag) {
@@ -911,7 +912,7 @@
double d3 = this.getX();
double d4 = this.getY();
double d5 = this.getZ();
@@ -3272,16 +3753,41 @@
@@ -3331,16 +3812,41 @@
}
if (flag2) {
@@ -956,7 +957,7 @@
} else {
if (flag) {
world.broadcastEntityEvent(this, (byte) 46);
@@ -3291,7 +3797,7 @@
@@ -3350,7 +3856,7 @@
((EntityCreature) this).getNavigation().stop();
}
@@ -965,7 +966,7 @@
}
}
@@ -3374,7 +3880,7 @@
@@ -3439,7 +3945,7 @@
}
public void stopSleeping() {
@@ -974,7 +975,7 @@
World world = this.level();
java.util.Objects.requireNonNull(world);
@@ -3408,7 +3914,7 @@
@@ -3473,7 +3979,7 @@
@Nullable
public EnumDirection getBedOrientation() {
@@ -983,7 +984,7 @@
return blockposition != null ? BlockBed.getBedOrientation(this.level(), blockposition) : null;
}
@@ -3456,7 +3962,7 @@
@@ -3521,7 +4027,7 @@
Pair<MobEffect, Float> pair = (Pair) iterator.next();
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityTypes.java
+++ b/net/minecraft/world/entity/EntityTypes.java
@@ -157,6 +157,7 @@
@@ -158,6 +158,7 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -8,7 +8,7 @@
import org.slf4j.Logger;
public class EntityTypes<T extends Entity> implements FeatureElement, EntityTypeTest<Entity, T> {
@@ -167,7 +168,7 @@
@@ -168,7 +169,7 @@
private static final float MAGIC_HORSE_WIDTH = 1.3964844F;
private static final int DISPLAY_TRACKING_RANGE = 10;
public static final EntityTypes<Allay> ALLAY = register("allay", EntityTypes.Builder.of(Allay::new, EnumCreatureType.CREATURE).sized(0.35F, 0.6F).clientTrackingRange(8).updateInterval(2));
@@ -17,7 +17,7 @@
public static final EntityTypes<EntityArmorStand> ARMOR_STAND = register("armor_stand", EntityTypes.Builder.of(EntityArmorStand::new, EnumCreatureType.MISC).sized(0.5F, 1.975F).clientTrackingRange(10));
public static final EntityTypes<EntityTippedArrow> ARROW = register("arrow", EntityTypes.Builder.of(EntityTippedArrow::new, EnumCreatureType.MISC).sized(0.5F, 0.5F).clientTrackingRange(4).updateInterval(20));
public static final EntityTypes<Axolotl> AXOLOTL = register("axolotl", EntityTypes.Builder.of(Axolotl::new, EnumCreatureType.AXOLOTLS).sized(0.75F, 0.42F).clientTrackingRange(10));
@@ -308,8 +309,8 @@
@@ -309,8 +310,8 @@
private final EntitySize dimensions;
private final FeatureFlagSet requiredFeatures;
@@ -28,7 +28,7 @@
}
public static MinecraftKey getKey(EntityTypes<?> entitytypes) {
@@ -337,8 +338,15 @@
@@ -338,8 +339,15 @@
@Nullable
public T spawn(WorldServer worldserver, @Nullable ItemStack itemstack, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
@@ -45,7 +45,7 @@
if (itemstack != null) {
nbttagcompound = itemstack.getTag();
@@ -349,7 +357,7 @@
@@ -350,7 +358,7 @@
nbttagcompound = null;
}
@@ -54,7 +54,7 @@
}
public static <T extends Entity> Consumer<T> createDefaultStackConfig(WorldServer worldserver, ItemStack itemstack, @Nullable EntityHuman entityhuman) {
@@ -371,21 +379,37 @@
@@ -372,21 +380,37 @@
NBTTagCompound nbttagcompound = itemstack.getTag();
return nbttagcompound != null ? consumer.andThen((entity) -> {
@@ -95,7 +95,7 @@
}
return t0;
@@ -572,7 +596,7 @@
@@ -573,7 +597,7 @@
}
return entity;
@@ -104,7 +104,7 @@
}
public static Stream<Entity> loadEntitiesRecursive(final List<? extends NBTBase> list, final World world) {
@@ -629,7 +653,7 @@
@@ -634,7 +658,7 @@
@Nullable
public T tryCast(Entity entity) {
@@ -113,7 +113,7 @@
}
@Override
@@ -664,7 +688,7 @@
@@ -669,7 +693,7 @@
this.canSpawnFarFromPlayer = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC;
}

View File

@@ -12,12 +12,12 @@
public class PathfinderGoalTame extends PathfinderGoal {
private final EntityHorseAbstract horse;
@@ -62,7 +67,7 @@
@@ -63,7 +68,7 @@
int i = this.horse.getTemper();
int j = this.horse.getMaxTemper();
- if (j > 0 && this.horse.getRandom().nextInt(j) < i) {
+ if (j > 0 && this.horse.getRandom().nextInt(j) < i && !CraftEventFactory.callEntityTameEvent(this.horse, ((CraftHumanEntity) this.horse.getBukkitEntity().getPassenger()).getHandle()).isCancelled()) { // CraftBukkit - fire EntityTameEvent
this.horse.tameWithName((EntityHuman) entity);
this.horse.tameWithName(entityhuman);
return;
}

View File

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

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityCat.java
+++ b/net/minecraft/world/entity/animal/EntityCat.java
@@ -412,7 +412,7 @@
@@ -413,7 +413,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);
@@ -469,7 +469,7 @@
@@ -475,7 +475,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) {
@@ -610,7 +610,15 @@
@@ -616,7 +616,15 @@
while (iterator.hasNext()) {
ItemStack itemstack = (ItemStack) iterator.next();
@@ -35,7 +35,7 @@
}
}
@@ -642,10 +650,10 @@
@@ -648,10 +656,10 @@
private final EntityCat cat;
public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityChicken.java
+++ b/net/minecraft/world/entity/animal/EntityChicken.java
@@ -96,7 +96,9 @@
@@ -97,7 +97,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);

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/animal/EntityCow.java
+++ b/net/minecraft/world/entity/animal/EntityCow.java
@@ -31,6 +31,12 @@
import net.minecraft.world.level.World;
@@ -33,6 +33,12 @@
import net.minecraft.world.level.block.state.IBlockData;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -13,7 +13,7 @@
public class EntityCow extends EntityAnimal {
public EntityCow(EntityTypes<? extends EntityCow> entitytypes, World world) {
@@ -83,8 +89,16 @@
@@ -85,8 +91,16 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityFox.java
+++ b/net/minecraft/world/entity/animal/EntityFox.java
@@ -517,7 +517,8 @@
@@ -523,7 +523,8 @@
protected void pickUpItem(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItem();
@@ -10,7 +10,7 @@
int i = itemstack.getCount();
if (i > 1) {
@@ -872,6 +873,16 @@
@@ -883,6 +884,16 @@
if (entityplayer1 != null && entityplayer != entityplayer1) {
entityfox.addTrustedUUID(entityplayer1.getUUID());
}
@@ -27,7 +27,7 @@
if (entityplayer2 != null) {
entityplayer2.awardStat(StatisticList.ANIMALS_BRED);
@@ -882,12 +893,14 @@
@@ -893,12 +904,14 @@
this.partner.setAge(6000);
this.animal.resetLove();
this.partner.resetLove();
@@ -46,7 +46,7 @@
}
}
@@ -1285,6 +1298,11 @@
@@ -1294,6 +1307,11 @@
int i = (Integer) iblockdata.getValue(BlockSweetBerryBush.AGE);
iblockdata.setValue(BlockSweetBerryBush.AGE, 1);
@@ -58,7 +58,7 @@
int j = 1 + EntityFox.this.level().random.nextInt(2) + (i == 3 ? 1 : 0);
ItemStack itemstack = EntityFox.this.getItemBySlot(EnumItemSlot.MAINHAND);
@@ -1441,7 +1459,7 @@
@@ -1451,7 +1469,7 @@
private EntityLiving trustedLastHurt;
private int timestamp;

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/animal/EntityMushroomCow.java
+++ b/net/minecraft/world/entity/animal/EntityMushroomCow.java
@@ -42,6 +42,13 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.gameevent.GameEvent;
import org.apache.commons.lang3.tuple.Pair;
+// CraftBukkit start
+import org.bukkit.Bukkit;
@@ -14,7 +14,7 @@
public class EntityMushroomCow extends EntityCow implements IShearable, VariantHolder<EntityMushroomCow.Type> {
private static final DataWatcherObject<String> DATA_TYPE = DataWatcher.defineId(EntityMushroomCow.class, DataWatcherRegistry.STRING);
@@ -115,6 +122,11 @@
@@ -114,6 +121,11 @@
this.playSound(soundeffect, 1.0F, 1.0F);
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
} else if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
@@ -26,7 +26,7 @@
this.shear(SoundCategory.PLAYERS);
this.gameEvent(GameEvent.SHEAR, entityhuman);
if (!this.level().isClientSide) {
@@ -165,7 +177,7 @@
@@ -161,7 +173,7 @@
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);
@@ -35,7 +35,7 @@
entitycow.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
entitycow.setHealth(this.getHealth());
entitycow.yBodyRot = this.yBodyRot;
@@ -179,10 +191,25 @@
@@ -175,10 +187,25 @@
}
entitycow.setInvulnerable(this.isInvulnerable());

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityOcelot.java
+++ b/net/minecraft/world/entity/animal/EntityOcelot.java
@@ -177,7 +177,7 @@
@@ -179,7 +179,7 @@
if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemstack) && entityhuman.distanceToSqr((Entity) this) < 9.0D) {
this.usePlayerItem(entityhuman, enumhand, itemstack);
if (!this.level().isClientSide) {
@@ -9,7 +9,7 @@
this.setTrusting(true);
this.spawnTrustingParticles(true);
this.level().broadcastEntityEvent(this, (byte) 41);
@@ -308,10 +308,10 @@
@@ -315,10 +315,10 @@
private final EntityOcelot ocelot;
public a(EntityOcelot entityocelot, Class<T> oclass, float f, double d0, double d1) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/animal/EntityPanda.java
+++ b/net/minecraft/world/entity/animal/EntityPanda.java
@@ -65,6 +65,11 @@
import net.minecraft.world.level.gameevent.GameEvent;
@@ -67,6 +67,11 @@
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -12,7 +12,7 @@
public class EntityPanda extends EntityAnimal {
private static final DataWatcherObject<Integer> UNHAPPY_COUNTER = DataWatcher.defineId(EntityPanda.class, DataWatcherRegistry.INT);
@@ -532,7 +537,7 @@
@@ -534,7 +539,7 @@
@Override
protected void pickUpItem(EntityItem entityitem) {
@@ -21,7 +21,7 @@
this.onItemPickup(entityitem);
ItemStack itemstack = entityitem.getItem();
@@ -863,10 +868,10 @@
@@ -870,10 +875,10 @@
private final EntityPanda panda;
public c(EntityPanda entitypanda, Class<T> oclass, float f, double d0, double d1) {
@@ -35,7 +35,7 @@
this.panda = entitypanda;
}
@@ -1105,7 +1110,7 @@
@@ -1112,7 +1117,7 @@
@Override
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
if (entityinsentient instanceof EntityPanda && entityinsentient.isAggressive()) {

View File

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

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/animal/EntityPig.java
+++ b/net/minecraft/world/entity/animal/EntityPig.java
@@ -49,6 +49,10 @@
import net.minecraft.world.phys.AxisAlignedBB;
@@ -51,6 +51,10 @@
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -11,7 +11,7 @@
public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable {
private static final DataWatcherObject<Boolean> DATA_SADDLE_ID = DataWatcher.defineId(EntityPig.class, DataWatcherRegistry.BOOLEAN);
@@ -250,7 +254,13 @@
@@ -252,7 +256,13 @@
}
entitypigzombie.setPersistenceRequired();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityRabbit.java
+++ b/net/minecraft/world/entity/animal/EntityRabbit.java
@@ -66,6 +66,10 @@
@@ -67,6 +67,10 @@
import net.minecraft.world.level.pathfinder.PathEntity;
import net.minecraft.world.phys.Vec3D;
@@ -11,7 +11,7 @@
public class EntityRabbit extends EntityAnimal implements VariantHolder<EntityRabbit.Variant> {
public static final double STROLL_SPEED_MOD = 0.6D;
@@ -88,7 +92,6 @@
@@ -89,7 +93,6 @@
super(entitytypes, world);
this.jumpControl = new EntityRabbit.ControllerJumpRabbit(this);
this.moveControl = new EntityRabbit.ControllerMoveRabbit(this);
@@ -19,7 +19,7 @@
}
@Override
@@ -576,9 +579,19 @@
@@ -577,9 +580,19 @@
int i = (Integer) iblockdata.getValue(BlockCarrots.AGE);
if (i == 0) {
@@ -37,5 +37,5 @@
+ }
+ // CraftBukkit end
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockCarrots.AGE, i - 1), 2);
world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of((Entity) this.rabbit));
world.levelEvent(2001, blockposition, Block.getId(iblockdata));
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/animal/EntitySheep.java
+++ b/net/minecraft/world/entity/animal/EntitySheep.java
@@ -64,6 +64,14 @@
import net.minecraft.world.level.gameevent.GameEvent;
@@ -66,6 +66,14 @@
import net.minecraft.world.level.storage.loot.LootTables;
import org.joml.Vector3f;
+// CraftBukkit start
+import net.minecraft.world.inventory.InventoryCraftResult;
@@ -15,7 +15,7 @@
public class EntitySheep extends EntityAnimal implements IShearable {
private static final int EAT_ANIMATION_TICKS = 40;
@@ -244,6 +252,11 @@
@@ -246,6 +254,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) -> {
@@ -265,7 +278,9 @@
@@ -267,7 +280,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)));
@@ -358,6 +373,12 @@
@@ -360,6 +375,12 @@
@Override
public void ate() {
@@ -50,16 +50,16 @@
super.ate();
this.setSheared(false);
if (this.isBaby()) {
@@ -377,7 +398,7 @@
@@ -379,7 +400,7 @@
EnumColor enumcolor = ((EntitySheep) entityanimal).getColor();
EnumColor enumcolor1 = ((EntitySheep) entityanimal1).getColor();
InventoryCrafting inventorycrafting = makeContainer(enumcolor, enumcolor1);
- Optional optional = this.level().getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level()).map((recipecrafting) -> {
+ Optional<Item> optional = this.level().getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level()).map((recipecrafting) -> { // CraftBukkit - decompile error
return recipecrafting.assemble(inventorycrafting, this.level().registryAccess());
- Optional optional = this.level().getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level()).map((recipeholder) -> {
+ Optional<Item> optional = this.level().getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level()).map((recipeholder) -> { // CraftBukkit - decompile error
return ((RecipeCrafting) recipeholder.value()).assemble(inventorycrafting, this.level().registryAccess());
}).map(ItemStack::getItem);
@@ -400,10 +421,18 @@
@@ -402,10 +423,18 @@
public boolean stillValid(EntityHuman entityhuman) {
return false;
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityTurtle.java
+++ b/net/minecraft/world/entity/animal/EntityTurtle.java
@@ -308,7 +308,9 @@
@@ -312,7 +312,9 @@
protected void ageBoundaryReached() {
super.ageBoundaryReached();
if (!this.isBaby() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
@@ -10,7 +10,7 @@
}
}
@@ -335,7 +337,9 @@
@@ -339,7 +341,9 @@
@Override
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
@@ -19,8 +19,8 @@
+ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = null; // CraftBukkit
}
private static class e extends ControllerMove {
@@ -487,12 +491,14 @@
@Override
@@ -496,12 +500,14 @@
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
World world = this.turtle.level();

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/animal/EntityWolf.java
+++ b/net/minecraft/world/entity/animal/EntityWolf.java
@@ -69,6 +69,12 @@
import net.minecraft.world.level.pathfinder.PathType;
@@ -70,6 +70,12 @@
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.event.entity.EntityRegainHealthEvent;
@@ -13,7 +13,7 @@
public class EntityWolf extends EntityTameableAnimal implements IEntityAngerable {
private static final DataWatcherObject<Boolean> DATA_INTERESTED_ID = DataWatcher.defineId(EntityWolf.class, DataWatcherRegistry.BOOLEAN);
@@ -297,15 +303,19 @@
@@ -298,15 +304,19 @@
} else {
Entity entity = damagesource.getEntity();
@@ -37,7 +37,7 @@
}
}
@@ -325,7 +335,7 @@
@@ -326,7 +336,7 @@
super.setTame(flag);
if (flag) {
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(20.0D);
@@ -46,7 +46,7 @@
} else {
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(8.0D);
}
@@ -348,7 +358,7 @@
@@ -349,7 +359,7 @@
itemstack.shrink(1);
}
@@ -55,7 +55,7 @@
return EnumInteractionResult.SUCCESS;
} else {
if (item instanceof ItemDye) {
@@ -376,7 +386,7 @@
@@ -377,7 +387,7 @@
this.setOrderedToSit(!this.isOrderedToSit());
this.jumping = false;
this.navigation.stop();
@@ -64,7 +64,7 @@
return EnumInteractionResult.SUCCESS;
} else {
return enuminteractionresult;
@@ -387,7 +397,8 @@
@@ -388,7 +398,8 @@
itemstack.shrink(1);
}

View File

@@ -1,15 +1,6 @@
--- a/net/minecraft/world/entity/animal/allay/Allay.java
+++ b/net/minecraft/world/entity/animal/allay/Allay.java
@@ -93,13 +93,14 @@
private final DynamicGameEventListener<Allay.a> dynamicJukeboxListener;
private final InventorySubcontainer inventory = new InventorySubcontainer(1);
@Nullable
- private BlockPosition jukeboxPos;
- private long duplicationCooldown;
+ public BlockPosition jukeboxPos; // PAIL private -> public
+ public long duplicationCooldown; // PAIL private -> public
private float holdingItemAnimationTicks;
private float holdingItemAnimationTicks0;
@@ -99,6 +99,7 @@
private float dancingAnimationTicks;
private float spinningAnimationTicks;
private float spinningAnimationTicks0;
@@ -17,7 +8,7 @@
public Allay(EntityTypes<? extends Allay> entitytypes, World world) {
super(entitytypes, world);
@@ -111,6 +112,12 @@
@@ -110,6 +111,12 @@
this.dynamicJukeboxListener = new DynamicGameEventListener<>(new Allay.a(this.vibrationUser.getPositionSource(), GameEvent.JUKEBOX_PLAY.getNotificationRadius()));
}
@@ -30,7 +21,7 @@
@Override
protected BehaviorController.b<Allay> brainProvider() {
return BehaviorController.provider(Allay.MEMORY_TYPES, Allay.SENSOR_TYPES);
@@ -123,7 +130,7 @@
@@ -122,7 +129,7 @@
@Override
public BehaviorController<Allay> getBrain() {
@@ -39,7 +30,7 @@
}
public static AttributeProvider.Builder createAttributes() {
@@ -230,7 +237,7 @@
@@ -229,7 +236,7 @@
public void aiStep() {
super.aiStep();
if (!this.level().isClientSide && this.isAlive() && this.tickCount % 10 == 0) {
@@ -48,7 +39,7 @@
}
if (this.isDancing() && this.shouldStopDancing() && this.tickCount % 20 == 0) {
@@ -300,7 +307,12 @@
@@ -299,7 +306,12 @@
ItemStack itemstack1 = this.getItemInHand(EnumHand.MAIN_HAND);
if (this.isDancing() && this.isDuplicationItem(itemstack) && this.canDuplicate()) {
@@ -62,7 +53,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);
@@ -311,7 +323,7 @@
@@ -310,7 +322,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 +62,7 @@
return EnumInteractionResult.SUCCESS;
} else if (!itemstack1.isEmpty() && enumhand == EnumHand.MAIN_HAND && itemstack.isEmpty()) {
this.setItemSlot(EnumItemSlot.MAINHAND, ItemStack.EMPTY);
@@ -432,6 +444,7 @@
@@ -427,6 +439,7 @@
}
private boolean shouldStopDancing() {
@@ -79,7 +70,7 @@
return this.jukeboxPos == null || !this.jukeboxPos.closerToCenterThan(this.position(), (double) GameEvent.JUKEBOX_PLAY.getNotificationRadius()) || !this.level().getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
}
@@ -476,7 +489,7 @@
@@ -471,7 +484,7 @@
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
this.writeInventoryToTag(nbttagcompound);
@@ -88,7 +79,7 @@
Logger logger = Allay.LOGGER;
Objects.requireNonNull(logger);
@@ -492,7 +505,7 @@
@@ -487,7 +500,7 @@
super.readAdditionalSaveData(nbttagcompound);
this.readInventoryFromTag(nbttagcompound);
if (nbttagcompound.contains("listener", 10)) {
@@ -97,16 +88,16 @@
Logger logger = Allay.LOGGER;
Objects.requireNonNull(logger);
@@ -525,7 +538,7 @@
@@ -520,7 +533,7 @@
return Allay.DUPLICATION_ITEM.test(itemstack);
}
- private void duplicateAllay() {
+ public Allay duplicateAllay() { // CraftBukkit - return allay and private -> public
- public void duplicateAllay() {
+ public Allay duplicateAllay() { // CraftBukkit - return allay
Allay allay = (Allay) EntityTypes.ALLAY.create(this.level());
if (allay != null) {
@@ -533,17 +546,17 @@
@@ -528,9 +541,9 @@
allay.setPersistenceRequired();
allay.resetDuplicationCooldown();
this.resetDuplicationCooldown();
@@ -117,14 +108,4 @@
+ return allay; // CraftBukkit
}
- private void resetDuplicationCooldown() {
+ public void resetDuplicationCooldown() { // PAIL private -> public
this.duplicationCooldown = 6000L;
this.entityData.set(Allay.DATA_CAN_DUPLICATE, false);
}
- private boolean canDuplicate() {
+ public boolean canDuplicate() { // PAIL private -> public
return (Boolean) this.entityData.get(Allay.DATA_CAN_DUPLICATE);
}
public void resetDuplicationCooldown() {

View File

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

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
@@ -54,6 +54,12 @@
import net.minecraft.world.level.pathfinder.PathType;
@@ -55,6 +55,12 @@
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -13,7 +13,7 @@
public class Goat extends EntityAnimal {
public static final EntitySize LONG_JUMPING_DIMENSIONS = EntitySize.scalable(0.9F, 1.3F).scale(0.7F);
@@ -181,7 +187,7 @@
@@ -182,7 +188,7 @@
@Override
public BehaviorController<Goat> getBrain() {
@@ -22,7 +22,7 @@
}
@Override
@@ -219,8 +225,15 @@
@@ -220,8 +226,15 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
+++ b/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
@@ -78,6 +78,12 @@
import net.minecraft.world.phys.Vec2F;
@@ -79,6 +79,12 @@
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -13,7 +13,7 @@
public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, HasCustomInventoryScreen, OwnableEntity, IJumpable, ISaddleable {
public static final int EQUIPMENT_SLOT_OFFSET = 400;
@@ -139,6 +145,7 @@
@@ -140,6 +146,7 @@
protected int gallopSoundCounter;
@Nullable
private UUID owner;
@@ -21,7 +21,7 @@
protected EntityHorseAbstract(EntityTypes<? extends EntityHorseAbstract> entitytypes, World world) {
super(entitytypes, world);
@@ -334,7 +341,7 @@
@@ -335,7 +342,7 @@
public void createInventory() {
InventorySubcontainer inventorysubcontainer = this.inventory;
@@ -30,7 +30,7 @@
if (inventorysubcontainer != null) {
inventorysubcontainer.removeListener(this);
int i = Math.min(inventorysubcontainer.getContainerSize(), this.inventory.getContainerSize());
@@ -442,7 +449,7 @@
@@ -443,7 +450,7 @@
}
public int getMaxTemper() {
@@ -39,7 +39,7 @@
}
@Override
@@ -513,7 +520,7 @@
@@ -514,7 +521,7 @@
}
if (this.getHealth() < this.getMaxHealth() && f > 0.0F) {
@@ -48,7 +48,7 @@
flag = true;
}
@@ -590,7 +597,7 @@
@@ -591,7 +598,7 @@
super.aiStep();
if (!this.level().isClientSide && this.isAlive()) {
if (this.random.nextInt(900) == 0 && this.deathTime == 0) {
@@ -57,7 +57,7 @@
}
if (this.canEatGrass()) {
@@ -857,6 +864,7 @@
@@ -858,6 +865,7 @@
if (this.getOwnerUUID() != null) {
nbttagcompound.putUUID("Owner", this.getOwnerUUID());
}
@@ -65,7 +65,7 @@
if (!this.inventory.getItem(0).isEmpty()) {
nbttagcompound.put("SaddleItem", this.inventory.getItem(0).save(new NBTTagCompound()));
@@ -884,6 +892,11 @@
@@ -885,6 +893,11 @@
if (uuid != null) {
this.setOwnerUUID(uuid);
}
@@ -77,7 +77,7 @@
if (nbttagcompound.contains("SaddleItem", 10)) {
ItemStack itemstack = ItemStack.of(nbttagcompound.getCompound("SaddleItem"));
@@ -986,6 +999,17 @@
@@ -987,6 +1000,17 @@
@Override
public void handleStartJump(int i) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/horse/EntityLlama.java
+++ b/net/minecraft/world/entity/animal/horse/EntityLlama.java
@@ -82,6 +82,11 @@
@@ -84,6 +84,11 @@
return false;
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java
+++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java
@@ -82,14 +82,23 @@
@@ -83,14 +83,23 @@
public Sniffer(EntityTypes<? extends EntityAnimal> entitytypes, World world) {
super(entitytypes, world);
@@ -26,7 +26,7 @@
@Override
protected float getStandingEyeHeight(EntityPose entitypose, EntitySize entitysize) {
return this.getDimensions(entitypose).height * 0.6F;
@@ -270,6 +279,13 @@
@@ -267,6 +276,13 @@
ItemStack itemstack = (ItemStack) iterator.next();
EntityItem entityitem = new EntityItem(worldserver, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack);
@@ -40,7 +40,7 @@
entityitem.setDefaultPickUpDelay();
worldserver.addFreshEntity(entityitem);
}
@@ -309,7 +325,7 @@
@@ -306,7 +322,7 @@
List<GlobalPos> list = (List) this.getExploredPositions().limit(20L).collect(Collectors.toList());
list.add(0, GlobalPos.of(this.level().dimension(), blockposition));
@@ -49,7 +49,7 @@
return this;
}
@@ -461,7 +477,7 @@
@@ -458,7 +474,7 @@
@Override
public BehaviorController<Sniffer> getBrain() {

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
@@ -51,6 +51,19 @@
import net.minecraft.world.phys.Vec3D;
@@ -53,6 +53,19 @@
import org.joml.Vector3f;
import org.slf4j.Logger;
+// CraftBukkit start
@@ -20,7 +20,7 @@
public class EntityEnderDragon extends EntityInsentient implements IMonster {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -88,6 +101,7 @@
@@ -90,6 +103,7 @@
private final PathPoint[] nodes;
private final int[] nodeAdjacency;
private final Path openSet;
@@ -28,7 +28,7 @@
public EntityEnderDragon(EntityTypes<? extends EntityEnderDragon> entitytypes, World world) {
super(EntityTypes.ENDER_DRAGON, world);
@@ -109,6 +123,7 @@
@@ -111,6 +125,7 @@
this.noPhysics = true;
this.noCulling = true;
this.phaseManager = new DragonControllerManager(this);
@@ -36,16 +36,16 @@
}
public void setDragonFight(EnderDragonBattle enderdragonbattle) {
@@ -267,7 +282,7 @@
@@ -258,7 +273,7 @@
Vec3D vec3d1 = idragoncontroller.getFlyTargetLocation();
- if (vec3d1 != null) {
+ if (vec3d1 != null && idragoncontroller.getPhase() != DragonControllerPhase.HOVERING) { // CraftBukkit - Don't move when hovering
d0 = vec3d1.x - this.getX();
d1 = vec3d1.y - this.getY();
d2 = vec3d1.z - this.getZ();
@@ -408,7 +423,14 @@
double d0 = vec3d1.x - this.getX();
double d1 = vec3d1.y - this.getY();
double d2 = vec3d1.z - this.getZ();
@@ -399,7 +414,14 @@
if (this.nearestCrystal.isRemoved()) {
this.nearestCrystal = null;
} else if (this.tickCount % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
@@ -61,7 +61,7 @@
}
}
@@ -483,6 +505,9 @@
@@ -474,6 +496,9 @@
int j1 = MathHelper.floor(axisalignedbb.maxZ);
boolean flag = false;
boolean flag1 = false;
@@ -71,7 +71,7 @@
for (int k1 = i; k1 <= l; ++k1) {
for (int l1 = j; l1 <= i1; ++l1) {
@@ -492,7 +517,11 @@
@@ -483,7 +508,11 @@
if (!iblockdata.isAir() && !iblockdata.is(TagsBlock.DRAGON_TRANSPARENT)) {
if (this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.is(TagsBlock.DRAGON_IMMUNE)) {
@@ -84,7 +84,7 @@
} else {
flag = true;
}
@@ -501,6 +530,51 @@
@@ -492,6 +521,51 @@
}
}
@@ -136,7 +136,7 @@
if (flag1) {
BlockPosition blockposition1 = new BlockPosition(i + this.random.nextInt(l - i + 1), j + this.random.nextInt(i1 - j + 1), k + this.random.nextInt(j1 - k + 1));
@@ -565,6 +639,21 @@
@@ -556,6 +630,21 @@
}
@@ -158,7 +158,7 @@
@Override
protected void tickDeath() {
if (this.dragonFight != null) {
@@ -580,15 +669,20 @@
@@ -571,15 +660,20 @@
this.level().addParticle(Particles.EXPLOSION_EMITTER, this.getX() + (double) f, this.getY() + 2.0D + (double) f1, this.getZ() + (double) f2, 0.0D, 0.0D, 0.0D);
}
@@ -180,7 +180,7 @@
EntityExperienceOrb.award((WorldServer) this.level(), this.position(), MathHelper.floor((float) short0 * 0.08F));
}
@@ -599,7 +693,7 @@
@@ -590,7 +684,7 @@
this.move(EnumMoveType.SELF, new Vec3D(0.0D, 0.10000000149011612D, 0.0D));
if (this.dragonDeathTime == 200 && this.level() instanceof WorldServer) {
@@ -189,7 +189,7 @@
EntityExperienceOrb.award((WorldServer) this.level(), this.position(), MathHelper.floor((float) short0 * 0.2F));
}
@@ -820,6 +914,7 @@
@@ -811,6 +905,7 @@
super.addAdditionalSaveData(nbttagcompound);
nbttagcompound.putInt("DragonPhase", this.phaseManager.getCurrentPhase().getPhase().getId());
nbttagcompound.putInt("DragonDeathTime", this.dragonDeathTime);
@@ -197,7 +197,7 @@
}
@Override
@@ -833,6 +928,11 @@
@@ -824,6 +919,11 @@
this.dragonDeathTime = nbttagcompound.getInt("DragonDeathTime");
}

View File

@@ -53,7 +53,7 @@
}
}
@@ -401,7 +424,25 @@
@@ -402,7 +425,25 @@
return false;
} else if (itemstack1.isEmpty() && (this.disabledSlots & 1 << enumitemslot.getFilterFlag() + 16) != 0) {
return false;
@@ -80,7 +80,7 @@
this.setItemSlot(enumitemslot, itemstack.copyWithCount(1));
return true;
} else if (!itemstack.isEmpty() && itemstack.getCount() > 1) {
@@ -416,15 +457,26 @@
@@ -417,15 +458,26 @@
entityhuman.setItemInHand(enumhand, itemstack1);
return true;
}
@@ -108,7 +108,7 @@
if (damagesource.is(DamageTypeTags.IS_EXPLOSION)) {
this.brokenByAnything(damagesource);
this.kill();
@@ -473,7 +525,7 @@
@@ -486,7 +538,7 @@
} else {
this.brokenByPlayer(damagesource);
this.showBreakingParticles();
@@ -117,7 +117,7 @@
}
return true;
@@ -541,13 +593,13 @@
@@ -554,13 +606,13 @@
itemstack.setHoverName(this.getCustomName());
}
@@ -133,7 +133,7 @@
ItemStack itemstack;
int i;
@@ -555,7 +607,7 @@
@@ -568,7 +620,7 @@
for (i = 0; i < this.handItems.size(); ++i) {
itemstack = (ItemStack) this.handItems.get(i);
if (!itemstack.isEmpty()) {
@@ -142,7 +142,7 @@
this.handItems.set(i, ItemStack.EMPTY);
}
}
@@ -563,10 +615,11 @@
@@ -576,10 +628,11 @@
for (i = 0; i < this.armorItems.size(); ++i) {
itemstack = (ItemStack) this.armorItems.get(i);
if (!itemstack.isEmpty()) {
@@ -155,7 +155,7 @@
}
@@ -667,8 +720,16 @@
@@ -675,8 +728,16 @@
return this.isSmall();
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/item/EntityFallingBlock.java
+++ b/net/minecraft/world/entity/item/EntityFallingBlock.java
@@ -49,13 +49,17 @@
@@ -49,6 +49,10 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
@@ -11,14 +11,6 @@
public class EntityFallingBlock extends Entity {
private static final Logger LOGGER = LogUtils.getLogger();
private IBlockData blockState;
public int time;
public boolean dropItem;
- private boolean cancelDrop;
+ public boolean cancelDrop; // PAIL private -> public
public boolean hurtEntities;
public int fallDamageMax;
public float fallDamagePerDistance;
@@ -83,10 +87,17 @@
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityCaveSpider.java
+++ b/net/minecraft/world/entity/monster/EntityCaveSpider.java
@@ -41,7 +41,7 @@
@@ -42,7 +42,7 @@
}
if (b0 > 0) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntityEnderman.java
+++ b/net/minecraft/world/entity/monster/EntityEnderman.java
@@ -70,6 +70,11 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
@@ -71,6 +71,11 @@
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -12,7 +12,7 @@
public class EntityEnderman extends EntityMonster implements IEntityAngerable {
private static final UUID SPEED_MODIFIER_ATTACKING_UUID = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0");
@@ -114,7 +119,17 @@
@@ -115,7 +120,17 @@
@Override
public void setTarget(@Nullable EntityLiving entityliving) {
@@ -31,7 +31,7 @@
AttributeModifiable attributemodifiable = this.getAttribute(GenericAttributes.MOVEMENT_SPEED);
if (entityliving == null) {
@@ -129,6 +144,7 @@
@@ -130,6 +145,7 @@
attributemodifiable.addTransientModifier(EntityEnderman.SPEED_MODIFIER_ATTACKING);
}
}
@@ -39,7 +39,7 @@
}
@@ -487,9 +503,11 @@
@@ -493,9 +509,11 @@
if (iblockdata2 != null) {
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level(), blockposition);
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
@@ -51,7 +51,7 @@
}
}
@@ -528,9 +546,11 @@
@@ -534,9 +552,11 @@
boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition);
if (iblockdata.is(TagsBlock.ENDERMAN_HOLDABLE) && flag) {

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/entity/monster/EntityEvoker.java
+++ b/net/minecraft/world/entity/monster/EntityEvoker.java
@@ -192,7 +192,7 @@
@@ -194,7 +194,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
worldserver.gameEvent(GameEvent.ENTITY_PLACE, blockposition, GameEvent.a.of((Entity) EntityEvoker.this));
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityGhast.java
+++ b/net/minecraft/world/entity/monster/EntityGhast.java
@@ -337,6 +337,8 @@
@@ -348,6 +348,8 @@
EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.ghast, d2, d3, d4, this.ghast.getExplosionPower());

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityGuardian.java
+++ b/net/minecraft/world/entity/monster/EntityGuardian.java
@@ -62,6 +62,7 @@
@@ -63,6 +63,7 @@
private boolean clientSideTouchedGround;
@Nullable
public PathfinderGoalRandomStroll randomStrollGoal;
@@ -8,7 +8,7 @@
public EntityGuardian(EntityTypes<? extends EntityGuardian> entitytypes, World world) {
super(entitytypes, world);
@@ -77,7 +78,7 @@
@@ -78,7 +79,7 @@
PathfinderGoalMoveTowardsRestriction pathfindergoalmovetowardsrestriction = new PathfinderGoalMoveTowardsRestriction(this, 1.0D);
this.randomStrollGoal = new PathfinderGoalRandomStroll(this, 1.0D, 80);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityGuardianElder.java
+++ b/net/minecraft/world/entity/monster/EntityGuardianElder.java
@@ -67,7 +67,7 @@
@@ -70,7 +70,7 @@
super.customServerAiStep();
if ((this.tickCount + this.getId()) % 1200 == 0) {
MobEffect mobeffect = new MobEffect(MobEffects.DIG_SLOWDOWN, 6000, 2);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityPhantom.java
+++ b/net/minecraft/world/entity/monster/EntityPhantom.java
@@ -538,14 +538,14 @@
@@ -543,14 +543,14 @@
List<EntityHuman> list = EntityPhantom.this.level().getNearbyPlayers(this.attackTargeting, EntityPhantom.this, EntityPhantom.this.getBoundingBox().inflate(16.0D, 64.0D, 16.0D));
if (!list.isEmpty()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityPigZombie.java
+++ b/net/minecraft/world/entity/monster/EntityPigZombie.java
@@ -154,7 +154,7 @@
@@ -150,7 +150,7 @@
}).filter((entitypigzombie) -> {
return !entitypigzombie.isAlliedTo((Entity) this.getTarget());
}).forEach((entitypigzombie) -> {
@@ -9,7 +9,7 @@
});
}
@@ -163,7 +163,7 @@
@@ -159,7 +159,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);
@@ -173,12 +173,21 @@
@@ -169,12 +169,21 @@
this.setLastHurtByPlayer((EntityHuman) entityliving);
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntityRavager.java
+++ b/net/minecraft/world/entity/monster/EntityRavager.java
@@ -41,6 +41,10 @@
import net.minecraft.world.phys.AxisAlignedBB;
@@ -43,6 +43,10 @@
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -11,7 +11,7 @@
public class EntityRavager extends EntityRaider {
private static final Predicate<Entity> NO_RAVAGER_AND_ALIVE = (entity) -> {
@@ -171,6 +175,11 @@
@@ -153,6 +157,11 @@
Block block = iblockdata.getBlock();
if (block instanceof BlockLeaves) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityShulker.java
+++ b/net/minecraft/world/entity/monster/EntityShulker.java
@@ -60,6 +60,12 @@
@@ -59,6 +59,12 @@
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
@@ -13,7 +13,7 @@
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");
@@ -408,6 +414,14 @@
@@ -400,6 +406,14 @@
EnumDirection enumdirection = this.findAttachableSurface(blockposition1);
if (enumdirection != null) {
@@ -28,7 +28,7 @@
this.unRide();
this.setAttachFace(enumdirection);
this.playSound(SoundEffects.SHULKER_TELEPORT, 1.0F, 1.0F);
@@ -478,7 +492,7 @@
@@ -470,7 +484,7 @@
if (entityshulker != null) {
entityshulker.setVariant(this.getVariant());
entityshulker.moveTo(vec3d);

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntitySilverfish.java
+++ b/net/minecraft/world/entity/monster/EntitySilverfish.java
@@ -33,6 +33,10 @@
import net.minecraft.world.level.block.BlockMonsterEggs;
@@ -34,6 +34,10 @@
import net.minecraft.world.level.block.state.IBlockData;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -11,7 +11,7 @@
public class EntitySilverfish extends EntityMonster {
@Nullable
@@ -175,6 +179,11 @@
@@ -176,6 +180,11 @@
Block block = iblockdata.getBlock();
if (block instanceof BlockMonsterEggs) {
@@ -23,7 +23,7 @@
if (world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
world.destroyBlock(blockposition1, true, this.silverfish);
} else {
@@ -244,6 +253,11 @@
@@ -245,6 +254,11 @@
IBlockData iblockdata = world.getBlockState(blockposition);
if (BlockMonsterEggs.isCompatibleHostBlock(iblockdata)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntitySkeletonWither.java
+++ b/net/minecraft/world/entity/monster/EntitySkeletonWither.java
@@ -106,7 +106,7 @@
@@ -111,7 +111,7 @@
return false;
} else {
if (entity instanceof EntityLiving) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntitySlime.java
+++ b/net/minecraft/world/entity/monster/EntitySlime.java
@@ -42,6 +42,14 @@
import net.minecraft.world.level.levelgen.SeededRandom;
@@ -44,6 +44,14 @@
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start
+import java.util.ArrayList;
@@ -15,7 +15,7 @@
public class EntitySlime extends EntityInsentient implements IMonster {
private static final DataWatcherObject<Integer> ID_SIZE = DataWatcher.defineId(EntitySlime.class, DataWatcherRegistry.INT);
@@ -185,7 +193,7 @@
@@ -192,7 +200,7 @@
@Override
public EntityTypes<? extends EntitySlime> getType() {
@@ -24,7 +24,7 @@
}
@Override
@@ -199,6 +207,19 @@
@@ -206,6 +214,19 @@
int j = i / 2;
int k = 2 + this.random.nextInt(3);
@@ -44,7 +44,7 @@
for (int l = 0; l < k; ++l) {
float f1 = ((float) (l % 2) - 0.5F) * f;
float f2 = ((float) (l / 2) - 0.5F) * f;
@@ -214,9 +235,18 @@
@@ -221,9 +242,18 @@
entityslime.setInvulnerable(this.isInvulnerable());
entityslime.setSize(j, true);
entityslime.moveTo(this.getX() + (double) f1, this.getY() + 0.5D, this.getZ() + (double) f2, this.random.nextFloat() * 360.0F, 0.0F);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntitySpider.java
+++ b/net/minecraft/world/entity/monster/EntitySpider.java
@@ -180,7 +180,7 @@
@@ -182,7 +182,7 @@
MobEffectList mobeffectlist = entityspider_groupdataspider.effect;
if (mobeffectlist != null) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityStrider.java
+++ b/net/minecraft/world/entity/monster/EntityStrider.java
@@ -349,7 +349,14 @@
@@ -351,7 +351,14 @@
boolean flag2 = flag1;

View File

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

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityWitch.java
+++ b/net/minecraft/world/entity/monster/EntityWitch.java
@@ -132,7 +132,7 @@
@@ -134,7 +134,7 @@
while (iterator.hasNext()) {
MobEffect mobeffect = (MobEffect) iterator.next();

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntityZombie.java
+++ b/net/minecraft/world/entity/monster/EntityZombie.java
@@ -66,6 +66,15 @@
import net.minecraft.world.level.block.Blocks;
@@ -67,6 +67,15 @@
import net.minecraft.world.level.block.state.IBlockData;
import org.joml.Vector3f;
+// CraftBukkit start
+import net.minecraft.server.MinecraftServer;
@@ -16,7 +16,7 @@
public class EntityZombie extends EntityMonster {
private static final UUID SPEED_MODIFIER_BABY_UUID = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");
@@ -86,6 +95,7 @@
@@ -87,6 +96,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);
@@ -202,7 +212,10 @@
@@ -203,7 +213,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();
}
@@ -219,6 +232,7 @@
@@ -220,6 +233,7 @@
}
super.tick();
@@ -44,7 +44,7 @@
}
@Override
@@ -251,6 +265,7 @@
@@ -252,6 +266,7 @@
}
public void startUnderWaterConversion(int i) {
@@ -52,7 +52,7 @@
this.conversionTime = i;
this.getEntityData().set(EntityZombie.DATA_DROWNED_CONVERSION_ID, true);
}
@@ -264,11 +279,15 @@
@@ -265,11 +280,15 @@
}
protected void convertToZombieType(EntityTypes<? extends EntityZombie> entitytypes) {
@@ -69,7 +69,7 @@
}
}
@@ -308,9 +327,9 @@
@@ -309,9 +328,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;
@@ -331,7 +350,14 @@
@@ -332,7 +351,14 @@
float f = this.level().getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty();
if (this.getMainHandItem().isEmpty() && this.isOnFire() && this.random.nextFloat() < f * 0.3F) {
@@ -97,7 +97,7 @@
}
}
@@ -413,8 +439,17 @@
@@ -414,8 +440,17 @@
if (worldserver.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) {
return flag;
}
@@ -116,7 +116,7 @@
if (entityzombievillager != null) {
entityzombievillager.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityzombievillager.blockPosition()), EnumMobSpawn.CONVERSION, new EntityZombie.GroupDataZombie(false, true), (NBTTagCompound) null);
@@ -422,15 +457,17 @@
@@ -423,15 +458,17 @@
entityzombievillager.setGossips((NBTBase) entityvillager.getGossips().store(DynamicOpsNBT.INSTANCE));
entityzombievillager.setTradeOffers(entityvillager.getOffers().createTag());
entityzombievillager.setVillagerXp(entityvillager.getVillagerXp());
@@ -139,7 +139,7 @@
}
@Override
@@ -483,7 +520,7 @@
@@ -484,7 +521,7 @@
entitychicken1.finalizeSpawn(worldaccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null, (NBTTagCompound) null);
entitychicken1.setChickenJockey(true);
this.startRiding(entitychicken1);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityZombieHusk.java
+++ b/net/minecraft/world/entity/monster/EntityZombieHusk.java
@@ -58,7 +58,7 @@
@@ -60,7 +60,7 @@
if (flag && this.getMainHandItem().isEmpty() && entity instanceof EntityLiving) {
float f = this.level().getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty();

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/monster/EntityZombieVillager.java
+++ b/net/minecraft/world/entity/monster/EntityZombieVillager.java
@@ -47,6 +47,13 @@
import net.minecraft.world.level.block.state.IBlockData;
@@ -50,6 +50,13 @@
import org.joml.Vector3f;
import org.slf4j.Logger;
+// CraftBukkit start
@@ -14,7 +14,7 @@
public class EntityZombieVillager extends EntityZombie implements VillagerDataHolder {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -64,6 +71,7 @@
@@ -67,6 +74,7 @@
@Nullable
private NBTTagCompound tradeOffers;
private int villagerXp;
@@ -22,7 +22,7 @@
public EntityZombieVillager(EntityTypes<? extends EntityZombieVillager> entitytypes, World world) {
super(entitytypes, world);
@@ -82,7 +90,7 @@
@@ -85,7 +93,7 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@@ -31,7 +31,7 @@
Logger logger = EntityZombieVillager.LOGGER;
Objects.requireNonNull(logger);
@@ -138,6 +146,10 @@
@@ -141,6 +149,10 @@
public void tick() {
if (!this.level().isClientSide && this.isAlive() && this.isConverting()) {
int i = this.getConversionProgress();
@@ -42,7 +42,7 @@
this.villagerConversionTime -= i;
if (this.villagerConversionTime <= 0) {
@@ -146,6 +158,7 @@
@@ -149,6 +161,7 @@
}
super.tick();
@@ -50,7 +50,7 @@
}
@Override
@@ -189,8 +202,10 @@
@@ -192,8 +205,10 @@
this.conversionStarter = uuid;
this.villagerConversionTime = i;
this.getEntityData().set(EntityZombieVillager.DATA_CONVERTING_ID, true);
@@ -63,7 +63,7 @@
this.level().broadcastEntityEvent(this, (byte) 16);
}
@@ -207,7 +222,13 @@
@@ -210,7 +225,13 @@
}
private void finishConversion(WorldServer worldserver) {
@@ -78,7 +78,7 @@
EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
int i = aenumitemslot.length;
@@ -222,7 +243,9 @@
@@ -225,7 +246,9 @@
double d0 = (double) this.getEquipmentDropChance(enumitemslot);
if (d0 > 1.0D) {
@@ -88,7 +88,7 @@
}
}
}
@@ -249,7 +272,7 @@
@@ -252,7 +275,7 @@
}
}

View File

@@ -65,7 +65,7 @@
}
@Override
@@ -365,7 +393,7 @@
@@ -360,7 +388,7 @@
}
protected void holdInOffHand(ItemStack itemstack) {
@@ -74,7 +74,7 @@
this.setItemSlot(EnumItemSlot.OFFHAND, itemstack);
this.setGuaranteedDrop(EnumItemSlot.OFFHAND);
} else {
@@ -391,8 +419,8 @@
@@ -386,8 +414,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)));
}
@@ -421,7 +449,7 @@
@@ -416,7 +444,7 @@
@Override
protected SoundEffect getAmbientSound() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/piglin/EntityPiglinAbstract.java
+++ b/net/minecraft/world/entity/monster/piglin/EntityPiglinAbstract.java
@@ -108,7 +108,7 @@
@@ -115,7 +115,7 @@
}
protected void finishConversion(WorldServer worldserver) {
@@ -9,7 +9,7 @@
if (entitypigzombie != null) {
entitypigzombie.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0));
@@ -125,7 +125,7 @@
@@ -132,7 +132,7 @@
@Nullable
@Override
public EntityLiving getTarget() {

View File

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

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/npc/EntityVillager.java
+++ b/net/minecraft/world/entity/npc/EntityVillager.java
@@ -91,6 +91,14 @@
@@ -92,6 +92,14 @@
import net.minecraft.world.phys.AxisAlignedBB;
import org.slf4j.Logger;
@@ -15,7 +15,7 @@
public class EntityVillager extends EntityVillagerAbstract implements ReputationHandler, VillagerDataHolder {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -149,7 +157,7 @@
@@ -150,7 +158,7 @@
@Override
public BehaviorController<EntityVillager> getBrain() {
@@ -24,7 +24,7 @@
}
@Override
@@ -232,7 +240,7 @@
@@ -233,7 +241,7 @@
this.increaseProfessionLevelOnUpdate = false;
}
@@ -33,7 +33,7 @@
}
}
@@ -360,7 +368,13 @@
@@ -361,7 +369,13 @@
while (iterator.hasNext()) {
MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
@@ -48,7 +48,7 @@
}
this.resendOffersToTradingPlayer();
@@ -429,7 +443,13 @@
@@ -430,7 +444,13 @@
while (iterator.hasNext()) {
MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
@@ -63,7 +63,7 @@
}
}
@@ -489,7 +509,7 @@
@@ -490,7 +510,7 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@@ -72,7 +72,7 @@
Logger logger = EntityVillager.LOGGER;
Objects.requireNonNull(logger);
@@ -833,7 +853,12 @@
@@ -834,7 +854,12 @@
}
entitywitch.setPersistenceRequired();
@@ -86,16 +86,16 @@
this.releaseAllPois();
this.discard();
} else {
@@ -924,7 +949,7 @@
@@ -933,7 +958,7 @@
}).limit(5L).collect(Collectors.toList());
if (list1.size() >= j) {
- if (SpawnUtil.trySpawnMob(EntityTypes.IRON_GOLEM, EnumMobSpawn.MOB_SUMMONED, worldserver, this.blockPosition(), 10, 8, 6, SpawnUtil.a.LEGACY_IRON_GOLEM).isPresent()) {
+ if (SpawnUtil.trySpawnMob(EntityTypes.IRON_GOLEM, EnumMobSpawn.MOB_SUMMONED, worldserver, this.blockPosition(), 10, 8, 6, SpawnUtil.a.LEGACY_IRON_GOLEM, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE).isPresent()) { // CraftBukkit
- if (!SpawnUtil.trySpawnMob(EntityTypes.IRON_GOLEM, EnumMobSpawn.MOB_SUMMONED, worldserver, this.blockPosition(), 10, 8, 6, SpawnUtil.a.LEGACY_IRON_GOLEM).isEmpty()) {
+ if (!SpawnUtil.trySpawnMob(EntityTypes.IRON_GOLEM, EnumMobSpawn.MOB_SUMMONED, worldserver, this.blockPosition(), 10, 8, 6, SpawnUtil.a.LEGACY_IRON_GOLEM, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE).isEmpty()) { // CraftBukkit
list.forEach(SensorGolemLastSeen::golemDetected);
}
}
@@ -981,7 +1006,7 @@
@@ -990,7 +1015,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);
}
@@ -989,7 +1014,7 @@
@@ -998,7 +1023,7 @@
@Override
public void stopSleeping() {
super.stopSleeping();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/npc/EntityVillagerAbstract.java
+++ b/net/minecraft/world/entity/npc/EntityVillagerAbstract.java
@@ -36,8 +36,24 @@
@@ -35,8 +35,24 @@
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.phys.Vec3D;
@@ -25,7 +25,7 @@
private static final DataWatcherObject<Integer> DATA_UNHAPPY_COUNTER = DataWatcher.defineId(EntityVillagerAbstract.class, DataWatcherRegistry.INT);
public static final int VILLAGER_SLOT_OFFSET = 300;
private static final int VILLAGER_INVENTORY_SIZE = 8;
@@ -45,7 +61,7 @@
@@ -44,7 +60,7 @@
private EntityHuman tradingPlayer;
@Nullable
protected MerchantRecipeList offers;
@@ -34,8 +34,8 @@
public EntityVillagerAbstract(EntityTypes<? extends EntityVillagerAbstract> entitytypes, World world) {
super(entitytypes, world);
@@ -247,7 +263,16 @@
MerchantRecipe merchantrecipe = villagertrades_imerchantrecipeoption.getOffer(this, this.random);
@@ -233,7 +249,16 @@
MerchantRecipe merchantrecipe = ((VillagerTrades.IMerchantRecipeOption) arraylist.remove(this.random.nextInt(arraylist.size()))).getOffer(this, this.random);
if (merchantrecipe != null) {
- merchantrecipelist.add(merchantrecipe);
@@ -49,6 +49,6 @@
+ merchantrecipelist.add(CraftMerchantRecipe.fromBukkit(event.getRecipe()).toMinecraft());
+ }
+ // CraftBukkit end
++j;
}
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/npc/EntityVillagerTrader.java
+++ b/net/minecraft/world/entity/npc/EntityVillagerTrader.java
@@ -44,6 +44,13 @@
import net.minecraft.world.level.World;
@@ -47,6 +47,13 @@
import net.minecraft.world.phys.Vec3D;
import org.apache.commons.lang3.tuple.Pair;
+// CraftBukkit start
+import org.bukkit.Bukkit;
@@ -14,7 +14,7 @@
public class EntityVillagerTrader extends EntityVillagerAbstract {
private static final int NUMBER_OF_TRADE_OFFERS = 5;
@@ -53,6 +60,7 @@
@@ -56,6 +63,7 @@
public EntityVillagerTrader(EntityTypes<? extends EntityVillagerTrader> entitytypes, World world) {
super(entitytypes, world);
@@ -22,21 +22,21 @@
}
@Override
@@ -130,7 +138,16 @@
MerchantRecipe merchantrecipe = villagertrades_imerchantrecipeoption.getOffer(this, this.random);
@@ -136,7 +144,16 @@
MerchantRecipe merchantrecipe = villagertrades_imerchantrecipeoption.getOffer(this, this.random);
if (merchantrecipe != null) {
- merchantrecipelist.add(merchantrecipe);
+ // CraftBukkit start
+ VillagerAcquireTradeEvent event = new VillagerAcquireTradeEvent((AbstractVillager) getBukkitEntity(), merchantrecipe.asBukkit());
+ // Suppress during worldgen
+ if (this.valid) {
+ Bukkit.getPluginManager().callEvent(event);
+ }
+ if (!event.isCancelled()) {
+ merchantrecipelist.add(CraftMerchantRecipe.fromBukkit(event.getRecipe()).toMinecraft());
+ }
+ // CraftBukkit end
}
if (merchantrecipe != null) {
- merchantrecipelist.add(merchantrecipe);
+ // CraftBukkit start
+ VillagerAcquireTradeEvent event = new VillagerAcquireTradeEvent((AbstractVillager) getBukkitEntity(), merchantrecipe.asBukkit());
+ // Suppress during worldgen
+ if (this.valid) {
+ Bukkit.getPluginManager().callEvent(event);
+ }
+ if (!event.isCancelled()) {
+ merchantrecipelist.add(CraftMerchantRecipe.fromBukkit(event.getRecipe()).toMinecraft());
+ }
+ // CraftBukkit end
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/player/EntityHuman.java
+++ b/net/minecraft/world/entity/player/EntityHuman.java
@@ -118,6 +118,20 @@
@@ -117,6 +117,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();
@@ -131,7 +145,8 @@
@@ -132,7 +146,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);
@@ -141,10 +156,10 @@
@@ -142,10 +157,10 @@
protected static final DataWatcherObject<NBTTagCompound> DATA_SHOULDER_RIGHT = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.COMPOUND_TAG);
private long timeEntitySatOnShoulder;
private final PlayerInventory inventory = new PlayerInventory(this);
@@ -44,7 +44,7 @@
protected int jumpTriggerTime;
public float oBob;
public float bob;
@@ -173,6 +188,16 @@
@@ -174,6 +189,16 @@
public EntityFishingHook fishing;
protected float hurtDir;
@@ -61,7 +61,7 @@
public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile) {
super(EntityTypes.PLAYER, world);
this.lastItemInMainHand = ItemStack.EMPTY;
@@ -312,7 +337,7 @@
@@ -313,7 +338,7 @@
ItemStack itemstack = this.getItemBySlot(EnumItemSlot.HEAD);
if (itemstack.is(Items.TURTLE_HELMET) && !this.isEyeInFluid(TagsFluid.WATER)) {
@@ -70,7 +70,7 @@
}
}
@@ -478,8 +503,14 @@
@@ -483,8 +508,14 @@
public void rideTick() {
if (!this.level().isClientSide && this.wantsToStopRiding() && this.isPassenger()) {
this.stopRiding();
@@ -87,7 +87,7 @@
double d0 = this.getX();
double d1 = this.getY();
double d2 = this.getZ();
@@ -506,7 +537,8 @@
@@ -511,7 +542,8 @@
if (this.level().getDifficulty() == EnumDifficulty.PEACEFUL && this.level().getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION)) {
if (this.getHealth() < this.getMaxHealth() && this.tickCount % 20 == 0) {
@@ -97,7 +97,7 @@
}
if (this.foodData.needsFood() && this.tickCount % 10 == 0) {
@@ -665,6 +697,13 @@
@@ -671,6 +703,13 @@
@Nullable
public EntityItem drop(ItemStack itemstack, boolean flag, boolean flag1) {
@@ -111,7 +111,7 @@
if (itemstack.isEmpty()) {
return null;
} else {
@@ -699,6 +738,33 @@
@@ -705,6 +744,33 @@
entityitem.setDeltaMovement((double) (-f3 * f2 * 0.3F) + Math.cos((double) f5) * (double) f6, (double) (-f1 * 0.3F + 0.1F + (this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (f4 * f2 * 0.3F) + Math.sin((double) f5) * (double) f6);
}
@@ -145,7 +145,7 @@
return entityitem;
}
}
@@ -789,7 +855,7 @@
@@ -795,7 +861,7 @@
}
if (nbttagcompound.contains("LastDeathLocation", 10)) {
@@ -154,7 +154,7 @@
Logger logger = EntityHuman.LOGGER;
Objects.requireNonNull(logger);
@@ -822,7 +888,7 @@
@@ -828,7 +894,7 @@
}
this.getLastDeathLocation().flatMap((globalpos) -> {
@@ -163,7 +163,7 @@
Logger logger = EntityHuman.LOGGER;
Objects.requireNonNull(logger);
@@ -849,12 +915,12 @@
@@ -855,12 +921,12 @@
return false;
} else {
if (!this.level().isClientSide) {
@@ -178,7 +178,7 @@
}
if (this.level().getDifficulty() == EnumDifficulty.EASY) {
@@ -866,7 +932,13 @@
@@ -872,7 +938,13 @@
}
}
@@ -193,7 +193,7 @@
}
}
}
@@ -886,10 +958,29 @@
@@ -892,10 +964,29 @@
}
public boolean canHarmPlayer(EntityHuman entityhuman) {
@@ -226,7 +226,7 @@
}
@Override
@@ -931,8 +1022,13 @@
@@ -937,8 +1028,13 @@
}
}
@@ -241,7 +241,7 @@
if (!this.isInvulnerableTo(damagesource)) {
f = this.getDamageAfterArmorAbsorb(damagesource, f);
f = this.getDamageAfterMagicAbsorb(damagesource, f);
@@ -947,7 +1043,7 @@
@@ -953,7 +1049,7 @@
}
if (f != 0.0F) {
@@ -250,7 +250,7 @@
this.getCombatTracker().recordDamage(damagesource, f);
this.setHealth(this.getHealth() - f);
if (f < 3.4028235E37F) {
@@ -957,6 +1053,7 @@
@@ -963,6 +1059,7 @@
this.gameEvent(GameEvent.ENTITY_DAMAGE);
}
}
@@ -258,7 +258,7 @@
}
@Override
@@ -1121,7 +1218,7 @@
@@ -1127,7 +1224,7 @@
f *= 0.2F + f2 * f2 * 0.8F;
f1 *= f2;
@@ -267,7 +267,7 @@
if (f > 0.0F || f1 > 0.0F) {
boolean flag = f2 > 0.9F;
boolean flag1 = false;
@@ -1160,8 +1257,15 @@
@@ -1166,8 +1263,15 @@
if (entity instanceof EntityLiving) {
f3 = ((EntityLiving) entity).getHealth();
if (j > 0 && !entity.isOnFire()) {
@@ -285,7 +285,7 @@
}
}
@@ -1189,8 +1293,11 @@
@@ -1195,8 +1299,11 @@
EntityLiving entityliving = (EntityLiving) iterator.next();
if (entityliving != this && entityliving != entity && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
@@ -298,7 +298,7 @@
}
}
@@ -1199,9 +1306,26 @@
@@ -1205,9 +1312,26 @@
}
if (entity instanceof EntityPlayer && entity.hurtMarked) {
@@ -325,7 +325,7 @@
}
if (flag2) {
@@ -1246,7 +1370,14 @@
@@ -1252,7 +1376,14 @@
this.awardStat(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F));
if (j > 0) {
@@ -341,7 +341,7 @@
}
if (this.level() instanceof WorldServer && f5 > 2.0F) {
@@ -1256,12 +1387,17 @@
@@ -1262,12 +1393,17 @@
}
}
@@ -360,7 +360,7 @@
}
}
@@ -1338,6 +1474,12 @@
@@ -1344,6 +1480,12 @@
}
public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition) {
@@ -373,7 +373,7 @@
this.startSleeping(blockposition);
this.sleepCounter = 0;
return Either.right(Unit.INSTANCE);
@@ -1425,9 +1567,9 @@
@@ -1431,9 +1573,9 @@
super.jumpFromGround();
this.awardStat(StatisticList.JUMP);
if (this.isSprinting()) {
@@ -385,7 +385,7 @@
}
}
@@ -1457,7 +1599,11 @@
@@ -1463,7 +1605,11 @@
this.setDeltaMovement(vec3d2.x, d3 * 0.6D, vec3d2.z);
this.resetFallDistance();
@@ -398,7 +398,7 @@
} else {
super.travel(vec3d);
}
@@ -1492,19 +1638,19 @@
@@ -1498,19 +1644,19 @@
i = Math.round((float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
this.awardStat(StatisticList.SWIM_ONE_CM, i);
@@ -421,7 +421,7 @@
}
} else if (this.onClimbable()) {
if (d1 > 0.0D) {
@@ -1515,13 +1661,13 @@
@@ -1521,13 +1667,13 @@
if (i > 0) {
if (this.isSprinting()) {
this.awardStat(StatisticList.SPRINT_ONE_CM, i);
@@ -438,7 +438,7 @@
}
}
} else if (this.isFallFlying()) {
@@ -1587,12 +1733,24 @@
@@ -1593,12 +1739,24 @@
}
public void startFallFlying() {
@@ -464,7 +464,7 @@
}
@Override
@@ -1706,10 +1864,21 @@
@@ -1712,10 +1870,21 @@
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
}
@@ -487,7 +487,7 @@
}
}
@@ -1795,13 +1964,20 @@
@@ -1801,13 +1970,20 @@
@Override
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
@@ -511,7 +511,7 @@
}
}
@@ -1840,26 +2016,31 @@
@@ -1846,26 +2022,31 @@
protected void removeEntitiesOnShoulder() {
if (this.timeEntitySatOnShoulder + 20L < this.level().getGameTime()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityEnderPearl.java
+++ b/net/minecraft/world/entity/projectile/EntityEnderPearl.java
@@ -16,6 +16,13 @@
@@ -15,6 +15,13 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.MovingObjectPositionEntity;
@@ -14,7 +14,7 @@
public class EntityEnderPearl extends EntityProjectileThrowable {
public EntityEnderPearl(EntityTypes<? extends EntityEnderPearl> entitytypes, World world) {
@@ -52,23 +59,36 @@
@@ -51,23 +58,36 @@
EntityPlayer entityplayer = (EntityPlayer) entity;
if (entityplayer.connection.isAcceptingMessages() && entityplayer.level() == this.level() && !entityplayer.isSleeping()) {
@@ -64,7 +64,7 @@
}
} else if (entity != null) {
entity.teleportTo(this.getX(), this.getY(), this.getZ());
@@ -97,7 +117,7 @@
@@ -96,7 +116,7 @@
public Entity changeDimension(WorldServer worldserver) {
Entity entity = this.getOwner();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityPotion.java
+++ b/net/minecraft/world/entity/projectile/EntityPotion.java
@@ -31,6 +31,16 @@
@@ -31,6 +31,17 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import net.minecraft.world.phys.MovingObjectPositionEntity;
@@ -8,6 +8,7 @@
+import java.util.HashMap;
+import java.util.Map;
+import net.minecraft.server.level.EntityPlayer;
+import net.minecraft.world.effect.MobEffects;
+import net.minecraft.world.level.block.Blocks;
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -17,7 +18,7 @@
public class EntityPotion extends EntityProjectileThrowable implements ItemSupplier {
public static final double SPLASH_RANGE = 4.0D;
@@ -99,7 +109,7 @@
@@ -99,7 +110,7 @@
if (flag) {
this.applyWater();
@@ -26,7 +27,7 @@
if (this.isLingering()) {
this.makeAreaOfEffectCloud(itemstack, potionregistry);
} else {
@@ -148,6 +158,7 @@
@@ -148,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 +35,7 @@
if (!list1.isEmpty()) {
Entity entity1 = this.getEffectSource();
@@ -168,24 +179,50 @@
@@ -168,24 +180,49 @@
d1 = 1.0D - Math.sqrt(d0) / 4.0D;
}
@@ -65,9 +66,8 @@
+ MobEffectList mobeffectlist = mobeffect.getEffect();
+ // CraftBukkit start - Abide by PVP settings - for players only!
+ if (!this.level().pvpMode && this.getOwner() instanceof EntityPlayer && entityliving instanceof EntityPlayer && entityliving != this.getOwner()) {
+ int i = MobEffectList.getId(mobeffectlist);
+ // Block SLOWER_MOVEMENT, SLOWER_DIG, HARM, BLINDNESS, HUNGER, WEAKNESS and POISON potions
+ if (i == 2 || i == 4 || i == 7 || i == 15 || i == 17 || i == 18 || i == 19) {
+ if (mobeffectlist == MobEffects.MOVEMENT_SLOWDOWN || mobeffectlist == MobEffects.DIG_SLOWDOWN || mobeffectlist == MobEffects.HARM || mobeffectlist == MobEffects.BLINDNESS
+ || mobeffectlist == MobEffects.HUNGER || mobeffectlist == MobEffects.WEAKNESS || mobeffectlist == MobEffects.POISON) {
+ continue;
+ }
+ }
@@ -122,10 +122,10 @@
IBlockData iblockdata = this.level().getBlockState(blockposition);
if (iblockdata.is(TagsBlock.FIRE)) {
- this.level().removeBlock(blockposition, false);
- this.level().destroyBlock(blockposition, false, this);
+ // CraftBukkit start
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState())) {
+ this.level().removeBlock(blockposition, false);
+ this.level().destroyBlock(blockposition, false, this);
+ }
+ // CraftBukkit end
} else if (AbstractCandleBlock.isLit(iblockdata)) {

View File

@@ -1,23 +1,5 @@
--- a/net/minecraft/world/entity/projectile/EntityTippedArrow.java
+++ b/net/minecraft/world/entity/projectile/EntityTippedArrow.java
@@ -28,7 +28,7 @@
private static final int NO_EFFECT_COLOR = -1;
private static final DataWatcherObject<Integer> ID_EFFECT_COLOR = DataWatcher.defineId(EntityTippedArrow.class, DataWatcherRegistry.INT);
private static final byte EVENT_POTION_PUFF = 0;
- private PotionRegistry potion;
+ public PotionRegistry potion; // CraftBukkit private -> public
public final Set<MobEffect> effects;
private boolean fixedColor;
@@ -86,7 +86,7 @@
return nbttagcompound != null && nbttagcompound.contains("CustomPotionColor", 99) ? nbttagcompound.getInt("CustomPotionColor") : -1;
}
- private void updateColor() {
+ public void updateColor() { // CraftBukkit private -> public
this.fixedColor = false;
if (this.potion == Potions.EMPTY && this.effects.isEmpty()) {
this.entityData.set(EntityTippedArrow.ID_EFFECT_COLOR, -1);
@@ -212,7 +212,7 @@
mobeffect = (MobEffect) iterator.next();
entityliving.addEffect(new MobEffect(mobeffect.getEffect(), Math.max(mobeffect.mapDuration((i) -> {

View File

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

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/raid/Raid.java
+++ b/net/minecraft/world/entity/raid/Raid.java
@@ -174,6 +174,12 @@
@@ -176,6 +176,12 @@
return this.status == Raid.Status.LOSS;
}
@@ -13,7 +13,7 @@
public float getTotalHealth() {
return this.totalHealth;
}
@@ -270,6 +276,7 @@
@@ -272,6 +278,7 @@
this.active = this.level.hasChunkAt(this.center);
if (this.level.getDifficulty() == EnumDifficulty.PEACEFUL) {
@@ -21,7 +21,7 @@
this.stop();
return;
}
@@ -289,13 +296,16 @@
@@ -291,13 +298,16 @@
if (!this.level.isVillage(this.center)) {
if (this.groupsSpawned > 0) {
this.status = Raid.Status.LOSS;
@@ -38,7 +38,7 @@
this.stop();
return;
}
@@ -369,6 +379,7 @@
@@ -371,6 +381,7 @@
}
if (j > 3) {
@@ -46,7 +46,7 @@
this.stop();
break;
}
@@ -381,6 +392,7 @@
@@ -383,6 +394,7 @@
this.status = Raid.Status.VICTORY;
Iterator iterator = this.heroesOfTheVillage.iterator();
@@ -54,11 +54,12 @@
while (iterator.hasNext()) {
UUID uuid = (UUID) iterator.next();
Entity entity = this.level.getEntity(uuid);
@@ -394,9 +406,11 @@
@@ -397,10 +409,12 @@
entityplayer.awardStat(StatisticList.RAID_WIN);
CriterionTriggers.RAID_WIN.trigger(entityplayer);
+ winners.add(entityplayer.getBukkitEntity()); // CraftBukkit
entityplayer.awardStat(StatisticList.RAID_WIN);
CriterionTriggers.RAID_WIN.trigger(entityplayer);
+ winners.add(entityplayer.getBukkitEntity()); // CraftBukkit
}
}
}
}
@@ -66,7 +67,7 @@
}
}
@@ -404,6 +418,7 @@
@@ -408,6 +422,7 @@
} else if (this.isOver()) {
++this.celebrationTicks;
if (this.celebrationTicks >= 600) {
@@ -74,7 +75,7 @@
this.stop();
return;
}
@@ -540,6 +555,10 @@
@@ -544,6 +559,10 @@
int j = araid_wave.length;
int k = 0;
@@ -85,7 +86,7 @@
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);
@@ -555,9 +574,11 @@
@@ -559,9 +578,11 @@
entityraider.setPatrolLeader(true);
this.setLeader(i, entityraider);
flag = true;
@@ -97,7 +98,7 @@
if (raid_wave.entityType == EntityTypes.RAVAGER) {
EntityRaider entityraider1 = null;
@@ -576,6 +597,7 @@
@@ -580,6 +601,7 @@
this.joinRaid(i, entityraider1, blockposition, false);
entityraider1.moveTo(blockposition, 0.0F, 0.0F);
entityraider1.startRiding(entityraider);
@@ -105,7 +106,7 @@
}
}
@@ -593,6 +615,7 @@
@@ -597,6 +619,7 @@
++this.groupsSpawned;
this.updateBossbar();
this.setDirty();
@@ -113,7 +114,7 @@
}
public void joinRaid(int i, EntityRaider entityraider, @Nullable BlockPosition blockposition, boolean flag) {
@@ -608,7 +631,7 @@
@@ -612,7 +635,7 @@
entityraider.finalizeSpawn(this.level, this.level.getCurrentDifficultyAt(blockposition), EnumMobSpawn.EVENT, (GroupDataEntity) null, (NBTTagCompound) null);
entityraider.applyRaidBuffs(i, false);
entityraider.setOnGround(true);
@@ -122,7 +123,7 @@
}
}
@@ -858,6 +881,12 @@
@@ -862,6 +885,12 @@
this.heroesOfTheVillage.add(entity.getUUID());
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/vehicle/EntityBoat.java
+++ b/net/minecraft/world/entity/vehicle/EntityBoat.java
@@ -53,6 +53,16 @@
import net.minecraft.world.phys.shapes.VoxelShape;
@@ -55,6 +55,16 @@
import net.minecraft.world.phys.shapes.VoxelShapes;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.Location;
@@ -17,7 +17,7 @@
public class EntityBoat extends Entity implements VariantHolder<EntityBoat.EnumBoatType> {
private static final DataWatcherObject<Integer> DATA_ID_HURT = DataWatcher.defineId(EntityBoat.class, DataWatcherRegistry.INT);
@@ -93,6 +103,14 @@
@@ -95,6 +105,14 @@
private float bubbleAngle;
private float bubbleAngleO;
@@ -32,7 +32,7 @@
public EntityBoat(EntityTypes<? extends EntityBoat> entitytypes, World world) {
super(entitytypes, world);
this.paddlePositions = new float[2];
@@ -162,6 +180,19 @@
@@ -180,6 +198,19 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else if (!this.level().isClientSide && !this.isRemoved()) {
@@ -52,7 +52,7 @@
this.setHurtDir(-this.getHurtDir());
this.setHurtTime(10);
this.setDamage(this.getDamage() + f * 10.0F);
@@ -170,6 +201,15 @@
@@ -188,6 +219,15 @@
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).getAbilities().instabuild;
if (flag || this.getDamage() > 40.0F) {
@@ -68,7 +68,7 @@
if (!flag && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
this.destroy(damagesource);
}
@@ -209,9 +249,29 @@
@@ -227,9 +267,29 @@
public void push(Entity entity) {
if (entity instanceof EntityBoat) {
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
@@ -98,7 +98,7 @@
super.push(entity);
}
@@ -279,6 +339,7 @@
@@ -322,6 +382,7 @@
return this.getDirection().getClockWise();
}
@@ -106,7 +106,7 @@
@Override
public void tick() {
this.oldStatus = this.status;
@@ -319,6 +380,22 @@
@@ -362,6 +423,22 @@
this.setDeltaMovement(Vec3D.ZERO);
}
@@ -129,7 +129,7 @@
this.tickBubbleColumn();
for (int i = 0; i <= 1; ++i) {
@@ -830,6 +907,11 @@
@@ -845,6 +922,11 @@
this.causeFallDamage(this.fallDistance, 1.0F, this.damageSources().fall());
if (!this.level().isClientSide && !this.isRemoved()) {
@@ -141,7 +141,7 @@
this.kill();
if (this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
int i;
@@ -843,6 +925,7 @@
@@ -858,6 +940,7 @@
}
}
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
+++ b/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
@@ -47,6 +47,16 @@
import net.minecraft.world.phys.AxisAlignedBB;
@@ -50,6 +50,16 @@
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.Location;
@@ -16,10 +16,10 @@
+
public abstract class EntityMinecartAbstract extends Entity {
private static final DataWatcherObject<Integer> DATA_ID_HURT = DataWatcher.defineId(EntityMinecartAbstract.class, DataWatcherRegistry.INT);
@@ -90,6 +100,17 @@
private double lyd;
private double lzd;
private static final float LOWERED_PASSENGER_ATTACHMENT_Y = 0.0F;
@@ -93,6 +103,17 @@
enummap.put(BlockPropertyTrackPosition.NORTH_EAST, Pair.of(baseblockposition2, baseblockposition1));
});
+ // CraftBukkit start
+ public boolean slowWhenEmpty = true;
@@ -34,8 +34,8 @@
+
protected EntityMinecartAbstract(EntityTypes<?> entitytypes, World world) {
super(entitytypes, world);
this.blocksBuilding = true;
@@ -216,6 +237,19 @@
this.targetDeltaMovement = Vec3D.ZERO;
@@ -222,6 +243,19 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {
@@ -55,7 +55,7 @@
this.setHurtDir(-this.getHurtDir());
this.setHurtTime(10);
this.markHurt();
@@ -224,6 +258,15 @@
@@ -230,6 +264,15 @@
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).getAbilities().instabuild;
if (flag || this.getDamage() > 40.0F) {
@@ -71,7 +71,7 @@
this.ejectPassengers();
if (flag && !this.hasCustomName()) {
this.discard();
@@ -285,6 +328,14 @@
@@ -291,6 +334,14 @@
@Override
public void tick() {
@@ -86,16 +86,16 @@
if (this.getHurtTime() > 0) {
this.setHurtTime(this.getHurtTime() - 1);
}
@@ -294,7 +345,7 @@
@@ -300,7 +351,7 @@
}
this.checkBelowWorld();
- this.handleNetherPortal();
+ // this.handleNetherPortal(); // CraftBukkit - handled in postTick
double d0;
if (this.level().isClientSide) {
@@ -361,6 +412,18 @@
if (this.lerpSteps > 0) {
this.lerpPositionAndRotationStep(this.lerpSteps, this.lerpX, this.lerpY, this.lerpZ, this.lerpYRot, this.lerpXRot);
@@ -358,6 +409,18 @@
}
this.setRot(this.getYRot(), this.getXRot());
@@ -114,8 +114,8 @@
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));
@@ -369,8 +432,26 @@
Entity entity = (Entity) list.get(l);
@@ -368,8 +431,26 @@
Entity entity = (Entity) iterator.next();
if (!(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && !(entity instanceof EntityMinecartAbstract) && !this.isVehicle() && !entity.isPassenger()) {
+ // CraftBukkit start
@@ -141,8 +141,8 @@
entity.push(this);
}
}
@@ -382,6 +463,14 @@
Entity entity1 = (Entity) iterator.next();
@@ -381,6 +462,14 @@
Entity entity1 = (Entity) iterator1.next();
if (!this.hasPassenger(entity1) && entity1.isPushable() && entity1 instanceof EntityMinecartAbstract) {
+ // CraftBukkit start
@@ -156,7 +156,7 @@
entity1.push(this);
}
}
@@ -398,7 +487,7 @@
@@ -397,7 +486,7 @@
}
protected double getMaxSpeed() {
@@ -165,7 +165,7 @@
}
public void activateMinecart(int i, int j, int k, boolean flag) {}
@@ -409,12 +498,16 @@
@@ -408,12 +497,16 @@
this.setDeltaMovement(MathHelper.clamp(vec3d.x, -d0, d0), vec3d.y, MathHelper.clamp(vec3d.z, -d0, d0));
if (this.onGround()) {
@@ -184,7 +184,7 @@
}
}
@@ -610,7 +703,7 @@
@@ -609,7 +702,7 @@
}
protected void applyNaturalSlowdown() {
@@ -193,7 +193,7 @@
Vec3D vec3d = this.getDeltaMovement();
vec3d = vec3d.multiply(d0, 0.0D, d0);
@@ -749,6 +842,14 @@
@@ -748,6 +841,14 @@
if (!this.level().isClientSide) {
if (!entity.noPhysics && !this.noPhysics) {
if (!this.hasPassenger(entity)) {
@@ -208,7 +208,7 @@
double d0 = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ();
double d2 = d0 * d0 + d1 * d1;
@@ -923,4 +1024,26 @@
@@ -945,4 +1046,26 @@
private EnumMinecartType() {}
}