diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Shulker.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Shulker.java.patch | 821 |
1 files changed, 821 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Shulker.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Shulker.java.patch new file mode 100644 index 0000000000..281a1fe86b --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Shulker.java.patch @@ -0,0 +1,821 @@ +--- a/net/minecraft/world/entity/monster/Shulker.java ++++ b/net/minecraft/world/entity/monster/Shulker.java +@@ -25,14 +25,14 @@ + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.EntityDimensions; ++import net.minecraft.world.entity.EntityPose; + import net.minecraft.world.entity.EntitySelector; + import net.minecraft.world.entity.EntityType; ++import net.minecraft.world.entity.EnumMobSpawn; ++import net.minecraft.world.entity.EnumMoveType; ++import net.minecraft.world.entity.GroupDataEntity; + import net.minecraft.world.entity.LivingEntity; + import net.minecraft.world.entity.Mob; +-import net.minecraft.world.entity.MobSpawnType; +-import net.minecraft.world.entity.MoverType; +-import net.minecraft.world.entity.Pose; +-import net.minecraft.world.entity.SpawnGroupData; + import net.minecraft.world.entity.VariantHolder; + import net.minecraft.world.entity.ai.attributes.AttributeModifier; + import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +@@ -52,20 +52,26 @@ + import net.minecraft.world.level.Level; + import net.minecraft.world.level.ServerLevelAccessor; + import net.minecraft.world.level.block.Blocks; +-import net.minecraft.world.level.block.state.BlockState; ++import net.minecraft.world.level.block.state.IBlockData; + import net.minecraft.world.level.entity.EntityTypeTest; + import net.minecraft.world.level.gameevent.GameEvent; + import net.minecraft.world.phys.AABB; + import net.minecraft.world.phys.Vec3; + import org.joml.Vector3f; + +-public class Shulker extends AbstractGolem implements VariantHolder<Optional<DyeColor>>, Enemy { ++// CraftBukkit start ++import org.bukkit.craftbukkit.util.CraftLocation; ++import org.bukkit.event.entity.EntityTeleportEvent; ++import org.bukkit.craftbukkit.event.CraftEventFactory; ++// CraftBukkit end + ++public class Shulker extends AbstractGolem implements VariantHolder<Optional<DyeColor>>, IMonster { ++ + private static final UUID COVERED_ARMOR_MODIFIER_UUID = UUID.fromString("7E0292F2-9434-48D5-A29F-9583AF7DF27F"); + private static final AttributeModifier COVERED_ARMOR_MODIFIER = new AttributeModifier(Shulker.COVERED_ARMOR_MODIFIER_UUID, "Covered armor bonus", 20.0D, AttributeModifier.Operation.ADDITION); + protected static final EntityDataAccessor<Direction> DATA_ATTACH_FACE_ID = SynchedEntityData.defineId(Shulker.class, EntityDataSerializers.DIRECTION); + protected static final EntityDataAccessor<Byte> DATA_PEEK_ID = SynchedEntityData.defineId(Shulker.class, EntityDataSerializers.BYTE); +- protected static final EntityDataAccessor<Byte> DATA_COLOR_ID = SynchedEntityData.defineId(Shulker.class, EntityDataSerializers.BYTE); ++ public static final EntityDataAccessor<Byte> DATA_COLOR_ID = SynchedEntityData.defineId(Shulker.class, EntityDataSerializers.BYTE); + private static final int TELEPORT_STEPS = 6; + private static final byte NO_COLOR = 16; + private static final byte DEFAULT_COLOR = 16; +@@ -74,9 +80,9 @@ + private static final int OTHER_SHULKER_LIMIT = 5; + private static final float PEEK_PER_TICK = 0.05F; + static final Vector3f FORWARD = (Vector3f) Util.make(() -> { +- Vec3i vec3i = Direction.SOUTH.getNormal(); ++ Vec3i baseblockposition = Direction.SOUTH.getNormal(); + +- return new Vector3f((float) vec3i.getX(), (float) vec3i.getY(), (float) vec3i.getZ()); ++ return new Vector3f((float) baseblockposition.getX(), (float) baseblockposition.getY(), (float) baseblockposition.getZ()); + }); + private float currentPeekAmountO; + private float currentPeekAmount; +@@ -85,14 +91,13 @@ + private int clientSideTeleportInterpolation; + private static final float MAX_LID_OPEN = 1.0F; + +- public Shulker(EntityType<? extends Shulker> entitytype, Level level) { +- super(entitytype, level); ++ public Shulker(EntityType<? extends Shulker> entityType, Level level) { ++ super(entityType, level); + this.xpReward = 5; + this.lookControl = new Shulker.ShulkerLookControl(this); + } + + @Override +- @Override + protected void registerGoals() { + this.goalSelector.addGoal(1, new LookAtPlayerGoal(this, Player.class, 8.0F, 0.02F, true)); + this.goalSelector.addGoal(4, new Shulker.ShulkerAttackGoal()); +@@ -104,25 +109,21 @@ + } + + @Override +- @Override + protected Entity.MovementEmission getMovementEmission() { + return Entity.MovementEmission.NONE; + } + + @Override +- @Override + public SoundSource getSoundSource() { + return SoundSource.HOSTILE; + } + + @Override +- @Override + protected SoundEvent getAmbientSound() { + return SoundEvents.SHULKER_AMBIENT; + } + + @Override +- @Override + public void playAmbientSound() { + if (!this.isClosed()) { + super.playAmbientSound(); +@@ -131,19 +132,16 @@ + } + + @Override +- @Override + protected SoundEvent getDeathSound() { + return SoundEvents.SHULKER_DEATH; + } + + @Override +- @Override +- protected SoundEvent getHurtSound(DamageSource damagesource) { ++ protected SoundEvent getHurtSound(DamageSource damageSource) { + return this.isClosed() ? SoundEvents.SHULKER_HURT_CLOSED : SoundEvents.SHULKER_HURT; + } + + @Override +- @Override + protected void defineSynchedData() { + super.defineSynchedData(); + this.entityData.define(Shulker.DATA_ATTACH_FACE_ID, Direction.DOWN); +@@ -156,34 +154,30 @@ + } + + @Override +- @Override + protected BodyRotationControl createBodyControl() { + return new Shulker.ShulkerBodyRotationControl(this); + } + + @Override +- @Override +- public void readAdditionalSaveData(CompoundTag compoundtag) { +- super.readAdditionalSaveData(compoundtag); +- this.setAttachFace(Direction.from3DDataValue(compoundtag.getByte("AttachFace"))); +- this.entityData.set(Shulker.DATA_PEEK_ID, compoundtag.getByte("Peek")); +- if (compoundtag.contains("Color", 99)) { +- this.entityData.set(Shulker.DATA_COLOR_ID, compoundtag.getByte("Color")); ++ public void readAdditionalSaveData(CompoundTag compound) { ++ super.readAdditionalSaveData(compound); ++ this.setAttachFace(Direction.from3DDataValue(compound.getByte("AttachFace"))); ++ this.entityData.set(Shulker.DATA_PEEK_ID, compound.getByte("Peek")); ++ if (compound.contains("Color", 99)) { ++ this.entityData.set(Shulker.DATA_COLOR_ID, compound.getByte("Color")); + } + + } + + @Override +- @Override +- public void addAdditionalSaveData(CompoundTag compoundtag) { +- super.addAdditionalSaveData(compoundtag); +- compoundtag.putByte("AttachFace", (byte) this.getAttachFace().get3DDataValue()); +- compoundtag.putByte("Peek", (Byte) this.entityData.get(Shulker.DATA_PEEK_ID)); +- compoundtag.putByte("Color", (Byte) this.entityData.get(Shulker.DATA_COLOR_ID)); ++ public void addAdditionalSaveData(CompoundTag compound) { ++ super.addAdditionalSaveData(compound); ++ compound.putByte("AttachFace", (byte) this.getAttachFace().get3DDataValue()); ++ compound.putByte("Peek", (Byte) this.entityData.get(Shulker.DATA_PEEK_ID)); ++ compound.putByte("Color", (Byte) this.entityData.get(Shulker.DATA_COLOR_ID)); + } + + @Override +- @Override + public void tick() { + super.tick(); + if (!this.level().isClientSide && !this.isPassenger() && !this.canStayAt(this.blockPosition(), this.getAttachFace())) { +@@ -205,10 +199,10 @@ + } + + private void findNewAttachment() { +- Direction direction = this.findAttachableSurface(this.blockPosition()); ++ Direction enumdirection = this.findAttachableSurface(this.blockPosition()); + +- if (direction != null) { +- this.setAttachFace(direction); ++ if (enumdirection != null) { ++ this.setAttachFace(enumdirection); + } else { + this.teleportSomewhere(); + } +@@ -216,17 +210,16 @@ + } + + @Override +- @Override + protected AABB makeBoundingBox() { + float f = getPhysicalPeek(this.currentPeekAmount); +- Direction direction = this.getAttachFace().getOpposite(); ++ Direction enumdirection = this.getAttachFace().getOpposite(); + float f1 = this.getType().getWidth() / 2.0F; + +- return getProgressAabb(direction, f).move(this.getX() - (double) f1, this.getY(), this.getZ() - (double) f1); ++ return getProgressAabb(enumdirection, f).move(this.getX() - (double) f1, this.getY(), this.getZ() - (double) f1); + } + +- private static float getPhysicalPeek(float f) { +- return 0.5F - Mth.sin((0.5F + f) * 3.1415927F) * 0.5F; ++ private static float getPhysicalPeek(float peek) { ++ return 0.5F - Mth.sin((0.5F + peek) * 3.1415927F) * 0.5F; + } + + private boolean updatePeekAmount() { +@@ -250,11 +243,11 @@ + this.reapplyPosition(); + float f = getPhysicalPeek(this.currentPeekAmount); + float f1 = getPhysicalPeek(this.currentPeekAmountO); +- Direction direction = this.getAttachFace().getOpposite(); ++ Direction enumdirection = this.getAttachFace().getOpposite(); + float f2 = f - f1; + + if (f2 > 0.0F) { +- List<Entity> list = this.level().getEntities((Entity) this, getProgressDeltaAabb(direction, f1, f).move(this.getX() - 0.5D, this.getY(), this.getZ() - 0.5D), EntitySelector.NO_SPECTATORS.and((entity) -> { ++ List<Entity> list = this.level().getEntities((Entity) this, getProgressDeltaAabb(enumdirection, f1, f).move(this.getX() - 0.5D, this.getY(), this.getZ() - 0.5D), EntitySelector.NO_SPECTATORS.and((entity) -> { + return !entity.isPassengerOfSameVehicle(this); + })); + Iterator iterator = list.iterator(); +@@ -263,38 +256,36 @@ + Entity entity = (Entity) iterator.next(); + + if (!(entity instanceof Shulker) && !entity.noPhysics) { +- entity.move(MoverType.SHULKER, new Vec3((double) (f2 * (float) direction.getStepX()), (double) (f2 * (float) direction.getStepY()), (double) (f2 * (float) direction.getStepZ()))); ++ entity.move(EnumMoveType.SHULKER, new Vec3((double) (f2 * (float) enumdirection.getStepX()), (double) (f2 * (float) enumdirection.getStepY()), (double) (f2 * (float) enumdirection.getStepZ()))); + } + } + + } + } + +- public static AABB getProgressAabb(Direction direction, float f) { +- return getProgressDeltaAabb(direction, -1.0F, f); ++ public static AABB getProgressAabb(Direction direction, float delta) { ++ return getProgressDeltaAabb(direction, -1.0F, delta); + } + +- public static AABB getProgressDeltaAabb(Direction direction, float f, float f1) { +- double d0 = (double) Math.max(f, f1); +- double d1 = (double) Math.min(f, f1); ++ public static AABB getProgressDeltaAabb(Direction direction, float delta, float deltaO) { ++ double d0 = (double) Math.max(delta, deltaO); ++ double d1 = (double) Math.min(delta, deltaO); + + return (new AABB(BlockPos.ZERO)).expandTowards((double) direction.getStepX() * d0, (double) direction.getStepY() * d0, (double) direction.getStepZ() * d0).contract((double) (-direction.getStepX()) * (1.0D + d1), (double) (-direction.getStepY()) * (1.0D + d1), (double) (-direction.getStepZ()) * (1.0D + d1)); + } + + @Override +- @Override +- public boolean startRiding(Entity entity, boolean flag) { ++ public boolean startRiding(Entity entity, boolean force) { + if (this.level().isClientSide()) { + this.clientOldAttachPosition = null; + this.clientSideTeleportInterpolation = 0; + } + + this.setAttachFace(Direction.DOWN); +- return super.startRiding(entity, flag); ++ return super.startRiding(entity, force); + } + + @Override +- @Override + public void stopRiding() { + super.stopRiding(); + if (this.level().isClientSide) { +@@ -307,54 +298,49 @@ + + @Nullable + @Override +- @Override +- public SpawnGroupData finalizeSpawn(ServerLevelAccessor serverlevelaccessor, DifficultyInstance difficultyinstance, MobSpawnType mobspawntype, @Nullable SpawnGroupData spawngroupdata, @Nullable CompoundTag compoundtag) { ++ public GroupDataEntity finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, EnumMobSpawn reason, @Nullable GroupDataEntity spawnData, @Nullable CompoundTag dataTag) { + this.setYRot(0.0F); + this.yHeadRot = this.getYRot(); + this.setOldPosAndRot(); +- return super.finalizeSpawn(serverlevelaccessor, difficultyinstance, mobspawntype, spawngroupdata, compoundtag); ++ return super.finalizeSpawn(level, difficulty, reason, spawnData, dataTag); + } + + @Override +- @Override +- public void move(MoverType movertype, Vec3 vec3) { +- if (movertype == MoverType.SHULKER_BOX) { ++ public void move(EnumMoveType type, Vec3 pos) { ++ if (type == EnumMoveType.SHULKER_BOX) { + this.teleportSomewhere(); + } else { +- super.move(movertype, vec3); ++ super.move(type, pos); + } + + } + + @Override +- @Override + public Vec3 getDeltaMovement() { + return Vec3.ZERO; + } + + @Override +- @Override +- public void setDeltaMovement(Vec3 vec3) {} ++ public void setDeltaMovement(Vec3 deltaMovement) {} + + @Override +- @Override +- public void setPos(double d0, double d1, double d2) { +- BlockPos blockpos = this.blockPosition(); ++ public void setPos(double x, double d1, double y) { ++ BlockPos blockposition = this.blockPosition(); + + if (this.isPassenger()) { +- super.setPos(d0, d1, d2); ++ super.setPos(x, d1, y); + } else { +- super.setPos((double) Mth.floor(d0) + 0.5D, (double) Mth.floor(d1 + 0.5D), (double) Mth.floor(d2) + 0.5D); ++ super.setPos((double) Mth.floor(x) + 0.5D, (double) Mth.floor(d1 + 0.5D), (double) Mth.floor(y) + 0.5D); + } + + if (this.tickCount != 0) { +- BlockPos blockpos1 = this.blockPosition(); ++ BlockPos blockposition1 = this.blockPosition(); + +- if (!blockpos1.equals(blockpos)) { ++ if (!blockposition1.equals(blockposition)) { + this.entityData.set(Shulker.DATA_PEEK_ID, (byte) 0); + this.hasImpulse = true; +- if (this.level().isClientSide && !this.isPassenger() && !blockpos1.equals(this.clientOldAttachPosition)) { +- this.clientOldAttachPosition = blockpos; ++ if (this.level().isClientSide && !this.isPassenger() && !blockposition1.equals(this.clientOldAttachPosition)) { ++ this.clientOldAttachPosition = blockposition; + this.clientSideTeleportInterpolation = 6; + this.xOld = this.getX(); + this.yOld = this.getY(); +@@ -366,44 +352,44 @@ + } + + @Nullable +- protected Direction findAttachableSurface(BlockPos blockpos) { +- Direction[] adirection = Direction.values(); +- int i = adirection.length; ++ protected Direction findAttachableSurface(BlockPos pos) { ++ Direction[] aenumdirection = Direction.values(); ++ int i = aenumdirection.length; + + for (int j = 0; j < i; ++j) { +- Direction direction = adirection[j]; ++ Direction enumdirection = aenumdirection[j]; + +- if (this.canStayAt(blockpos, direction)) { +- return direction; ++ if (this.canStayAt(pos, enumdirection)) { ++ return enumdirection; + } + } + + return null; + } + +- boolean canStayAt(BlockPos blockpos, Direction direction) { +- if (this.isPositionBlocked(blockpos)) { ++ boolean canStayAt(BlockPos pos, Direction facing) { ++ if (this.isPositionBlocked(pos)) { + return false; + } else { +- Direction direction1 = direction.getOpposite(); ++ Direction enumdirection1 = facing.getOpposite(); + +- if (!this.level().loadedAndEntityCanStandOnFace(blockpos.relative(direction), this, direction1)) { ++ if (!this.level().loadedAndEntityCanStandOnFace(pos.relative(facing), this, enumdirection1)) { + return false; + } else { +- AABB aabb = getProgressAabb(direction1, 1.0F).move(blockpos).deflate(1.0E-6D); ++ AABB axisalignedbb = getProgressAabb(enumdirection1, 1.0F).move(pos).deflate(1.0E-6D); + +- return this.level().noCollision(this, aabb); ++ return this.level().noCollision(this, axisalignedbb); + } + } + } + +- private boolean isPositionBlocked(BlockPos blockpos) { +- BlockState blockstate = this.level().getBlockState(blockpos); ++ private boolean isPositionBlocked(BlockPos pos) { ++ IBlockData iblockdata = this.level().getBlockState(pos); + +- if (blockstate.isAir()) { ++ if (iblockdata.isAir()) { + return false; + } else { +- boolean flag = blockstate.is(Blocks.MOVING_PISTON) && blockpos.equals(this.blockPosition()); ++ boolean flag = iblockdata.is(Blocks.MOVING_PISTON) && pos.equals(this.blockPosition()); + + return !flag; + } +@@ -411,20 +397,28 @@ + + protected boolean teleportSomewhere() { + if (!this.isNoAi() && this.isAlive()) { +- BlockPos blockpos = this.blockPosition(); ++ BlockPos blockposition = this.blockPosition(); + + for (int i = 0; i < 5; ++i) { +- BlockPos blockpos1 = blockpos.offset(Mth.randomBetweenInclusive(this.random, -8, 8), Mth.randomBetweenInclusive(this.random, -8, 8), Mth.randomBetweenInclusive(this.random, -8, 8)); ++ BlockPos blockposition1 = blockposition.offset(Mth.randomBetweenInclusive(this.random, -8, 8), Mth.randomBetweenInclusive(this.random, -8, 8), Mth.randomBetweenInclusive(this.random, -8, 8)); + +- if (blockpos1.getY() > this.level().getMinBuildHeight() && this.level().isEmptyBlock(blockpos1) && this.level().getWorldBorder().isWithinBounds(blockpos1) && this.level().noCollision(this, (new AABB(blockpos1)).deflate(1.0E-6D))) { +- Direction direction = this.findAttachableSurface(blockpos1); ++ if (blockposition1.getY() > this.level().getMinBuildHeight() && this.level().isEmptyBlock(blockposition1) && this.level().getWorldBorder().isWithinBounds(blockposition1) && this.level().noCollision(this, (new AABB(blockposition1)).deflate(1.0E-6D))) { ++ Direction enumdirection = this.findAttachableSurface(blockposition1); + +- if (direction != null) { ++ if (enumdirection != null) { ++ // CraftBukkit start ++ EntityTeleportEvent teleportEvent = CraftEventFactory.callEntityTeleportEvent(this, blockposition1.getX(), blockposition1.getY(), blockposition1.getZ()); ++ if (teleportEvent.isCancelled()) { ++ return false; ++ } else { ++ blockposition1 = CraftLocation.toBlockPosition(teleportEvent.getTo()); ++ } ++ // CraftBukkit end + this.unRide(); +- this.setAttachFace(direction); ++ this.setAttachFace(enumdirection); + this.playSound(SoundEvents.SHULKER_TELEPORT, 1.0F, 1.0F); +- this.setPos((double) blockpos1.getX() + 0.5D, (double) blockpos1.getY(), (double) blockpos1.getZ() + 0.5D); +- this.level().gameEvent(GameEvent.TELEPORT, blockpos, GameEvent.Context.of((Entity) this)); ++ this.setPos((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D); ++ this.level().gameEvent(GameEvent.TELEPORT, blockposition, GameEvent.Context.of((Entity) this)); + this.entityData.set(Shulker.DATA_PEEK_ID, (byte) 0); + this.setTarget((LivingEntity) null); + return true; +@@ -439,7 +433,6 @@ + } + + @Override +- @Override + public void lerpTo(double d0, double d1, double d2, float f, float f1, int i) { + this.lerpSteps = 0; + this.setPos(d0, d1, d2); +@@ -447,24 +440,23 @@ + } + + @Override +- @Override +- public boolean hurt(DamageSource damagesource, float f) { ++ public boolean hurt(DamageSource source, float amount) { + Entity entity; + + if (this.isClosed()) { +- entity = damagesource.getDirectEntity(); ++ entity = source.getDirectEntity(); + if (entity instanceof AbstractArrow) { + return false; + } + } + +- if (!super.hurt(damagesource, f)) { ++ if (!super.hurt(source, amount)) { + return false; + } else { + if ((double) this.getHealth() < (double) this.getMaxHealth() * 0.5D && this.random.nextInt(4) == 0) { + this.teleportSomewhere(); +- } else if (damagesource.is(DamageTypeTags.IS_PROJECTILE)) { +- entity = damagesource.getDirectEntity(); ++ } else if (source.is(DamageTypeTags.IS_PROJECTILE)) { ++ entity = source.getDirectEntity(); + if (entity != null && entity.getType() == EntityType.SHULKER_BULLET) { + this.hitByShulkerBullet(); + } +@@ -479,20 +471,20 @@ + } + + private void hitByShulkerBullet() { +- Vec3 vec3 = this.position(); +- AABB aabb = this.getBoundingBox(); ++ Vec3 vec3d = this.position(); ++ AABB axisalignedbb = this.getBoundingBox(); + + if (!this.isClosed() && this.teleportSomewhere()) { +- int i = this.level().getEntities((EntityTypeTest) EntityType.SHULKER, aabb.inflate(8.0D), Entity::isAlive).size(); ++ int i = this.level().getEntities((EntityTypeTest) EntityType.SHULKER, axisalignedbb.inflate(8.0D), Entity::isAlive).size(); + float f = (float) (i - 1) / 5.0F; + + if (this.level().random.nextFloat() >= f) { +- Shulker shulker = (Shulker) EntityType.SHULKER.create(this.level()); ++ Shulker entityshulker = (Shulker) EntityType.SHULKER.create(this.level()); + +- if (shulker != null) { +- shulker.setVariant(this.getVariant()); +- shulker.moveTo(vec3); +- this.level().addFreshEntity(shulker); ++ if (entityshulker != null) { ++ entityshulker.setVariant(this.getVariant()); ++ entityshulker.moveTo(vec3d); ++ this.level().addFreshEntity(entityshulker, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - the mysteries of life + } + + } +@@ -500,7 +492,6 @@ + } + + @Override +- @Override + public boolean canBeCollidedWith() { + return this.isAlive(); + } +@@ -509,28 +500,27 @@ + return (Direction) this.entityData.get(Shulker.DATA_ATTACH_FACE_ID); + } + +- private void setAttachFace(Direction direction) { +- this.entityData.set(Shulker.DATA_ATTACH_FACE_ID, direction); ++ public void setAttachFace(Direction attachFace) { ++ this.entityData.set(Shulker.DATA_ATTACH_FACE_ID, attachFace); + } + + @Override +- @Override +- public void onSyncedDataUpdated(EntityDataAccessor<?> entitydataaccessor) { +- if (Shulker.DATA_ATTACH_FACE_ID.equals(entitydataaccessor)) { ++ public void onSyncedDataUpdated(EntityDataAccessor<?> key) { ++ if (Shulker.DATA_ATTACH_FACE_ID.equals(key)) { + this.setBoundingBox(this.makeBoundingBox()); + } + +- super.onSyncedDataUpdated(entitydataaccessor); ++ super.onSyncedDataUpdated(key); + } + +- private int getRawPeekAmount() { ++ public int getRawPeekAmount() { + return (Byte) this.entityData.get(Shulker.DATA_PEEK_ID); + } + +- void setRawPeekAmount(int i) { ++ public void setRawPeekAmount(int peekAmount) { + if (!this.level().isClientSide) { + this.getAttribute(Attributes.ARMOR).removeModifier(Shulker.COVERED_ARMOR_MODIFIER.getId()); +- if (i == 0) { ++ if (peekAmount == 0) { + this.getAttribute(Attributes.ARMOR).addPermanentModifier(Shulker.COVERED_ARMOR_MODIFIER); + this.playSound(SoundEvents.SHULKER_CLOSE, 1.0F, 1.0F); + this.gameEvent(GameEvent.CONTAINER_CLOSE); +@@ -540,52 +530,47 @@ + } + } + +- this.entityData.set(Shulker.DATA_PEEK_ID, (byte) i); ++ this.entityData.set(Shulker.DATA_PEEK_ID, (byte) peekAmount); + } + +- public float getClientPeekAmount(float f) { +- return Mth.lerp(f, this.currentPeekAmountO, this.currentPeekAmount); ++ public float getClientPeekAmount(float partialTick) { ++ return Mth.lerp(partialTick, this.currentPeekAmountO, this.currentPeekAmount); + } + + @Override +- @Override +- protected float getStandingEyeHeight(Pose pose, EntityDimensions entitydimensions) { ++ protected float getStandingEyeHeight(EntityPose pose, EntityDimensions size) { + return 0.5F; + } + + @Override +- @Override +- public void recreateFromPacket(ClientboundAddEntityPacket clientboundaddentitypacket) { +- super.recreateFromPacket(clientboundaddentitypacket); ++ public void recreateFromPacket(ClientboundAddEntityPacket packet) { ++ super.recreateFromPacket(packet); + this.yBodyRot = 0.0F; + this.yBodyRotO = 0.0F; + } + + @Override +- @Override + public int getMaxHeadXRot() { + return 180; + } + + @Override +- @Override + public int getMaxHeadYRot() { + return 180; + } + + @Override +- @Override + public void push(Entity entity) {} + +- public Optional<Vec3> getRenderPosition(float f) { ++ public Optional<Vec3> getRenderPosition(float partial) { + if (this.clientOldAttachPosition != null && this.clientSideTeleportInterpolation > 0) { +- double d0 = (double) ((float) this.clientSideTeleportInterpolation - f) / 6.0D; ++ double d0 = (double) ((float) this.clientSideTeleportInterpolation - partial) / 6.0D; + + d0 *= d0; +- BlockPos blockpos = this.blockPosition(); +- double d1 = (double) (blockpos.getX() - this.clientOldAttachPosition.getX()) * d0; +- double d2 = (double) (blockpos.getY() - this.clientOldAttachPosition.getY()) * d0; +- double d3 = (double) (blockpos.getZ() - this.clientOldAttachPosition.getZ()) * d0; ++ BlockPos blockposition = this.blockPosition(); ++ double d1 = (double) (blockposition.getX() - this.clientOldAttachPosition.getX()) * d0; ++ double d2 = (double) (blockposition.getY() - this.clientOldAttachPosition.getY()) * d0; ++ double d3 = (double) (blockposition.getZ() - this.clientOldAttachPosition.getZ()) * d0; + + return Optional.of(new Vec3(-d1, -d2, -d3)); + } else { +@@ -593,15 +578,13 @@ + } + } + +- @Override +- public void setVariant(Optional<DyeColor> optional) { +- this.entityData.set(Shulker.DATA_COLOR_ID, (Byte) optional.map((dyecolor) -> { +- return (byte) dyecolor.getId(); ++ public void setVariant(Optional<DyeColor> variant) { ++ this.entityData.set(Shulker.DATA_COLOR_ID, (Byte) variant.map((enumcolor) -> { ++ return (byte) enumcolor.getId(); + }).orElse((byte) 16)); + } + + @Override +- @Override + public Optional<DyeColor> getVariant() { + return Optional.ofNullable(this.getColor()); + } +@@ -620,16 +603,14 @@ + } + + @Override +- @Override + protected void clampHeadRotationToBody() {} + + @Override +- @Override + protected Optional<Float> getYRotD() { +- Direction direction = Shulker.this.getAttachFace().getOpposite(); +- Vector3f vector3f = direction.getRotation().transform(new Vector3f(Shulker.FORWARD)); +- Vec3i vec3i = direction.getNormal(); +- Vector3f vector3f1 = new Vector3f((float) vec3i.getX(), (float) vec3i.getY(), (float) vec3i.getZ()); ++ Direction enumdirection = Shulker.this.getAttachFace().getOpposite(); ++ Vector3f vector3f = enumdirection.getRotation().transform(new Vector3f(Shulker.FORWARD)); ++ Vec3i baseblockposition = enumdirection.getNormal(); ++ Vector3f vector3f1 = new Vector3f((float) baseblockposition.getX(), (float) baseblockposition.getY(), (float) baseblockposition.getZ()); + + vector3f1.cross(vector3f); + double d0 = this.wantedX - this.mob.getX(); +@@ -643,7 +624,6 @@ + } + + @Override +- @Override + protected Optional<Float> getXRotD() { + return Optional.of(0.0F); + } +@@ -654,51 +634,46 @@ + private int attackTime; + + public ShulkerAttackGoal() { +- this.setFlags(EnumSet.of(Goal.Flag.MOVE, Goal.Flag.LOOK)); ++ this.setFlags(EnumSet.of(Goal.Type.MOVE, Goal.Type.LOOK)); + } + + @Override +- @Override + public boolean canUse() { +- LivingEntity livingentity = Shulker.this.getTarget(); ++ LivingEntity entityliving = Shulker.this.getTarget(); + +- return livingentity != null && livingentity.isAlive() ? Shulker.this.level().getDifficulty() != Difficulty.PEACEFUL : false; ++ return entityliving != null && entityliving.isAlive() ? Shulker.this.level().getDifficulty() != Difficulty.PEACEFUL : false; + } + + @Override +- @Override + public void start() { + this.attackTime = 20; + Shulker.this.setRawPeekAmount(100); + } + + @Override +- @Override + public void stop() { + Shulker.this.setRawPeekAmount(0); + } + + @Override +- @Override + public boolean requiresUpdateEveryTick() { + return true; + } + + @Override +- @Override + public void tick() { + if (Shulker.this.level().getDifficulty() != Difficulty.PEACEFUL) { + --this.attackTime; +- LivingEntity livingentity = Shulker.this.getTarget(); ++ LivingEntity entityliving = Shulker.this.getTarget(); + +- if (livingentity != null) { +- Shulker.this.getLookControl().setLookAt(livingentity, 180.0F, 180.0F); +- double d0 = Shulker.this.distanceToSqr((Entity) livingentity); ++ if (entityliving != null) { ++ Shulker.this.getLookControl().setLookAt(entityliving, 180.0F, 180.0F); ++ double d0 = Shulker.this.distanceToSqr((Entity) entityliving); + + if (d0 < 400.0D) { + if (this.attackTime <= 0) { + this.attackTime = 20 + Shulker.this.random.nextInt(10) * 20 / 2; +- Shulker.this.level().addFreshEntity(new ShulkerBullet(Shulker.this.level(), Shulker.this, livingentity, Shulker.this.getAttachFace().getAxis())); ++ Shulker.this.level().addFreshEntity(new ShulkerBullet(Shulker.this.level(), Shulker.this, entityliving, Shulker.this.getAttachFace().getAxis())); + Shulker.this.playSound(SoundEvents.SHULKER_SHOOT, 2.0F, (Shulker.this.random.nextFloat() - Shulker.this.random.nextFloat()) * 0.2F + 1.0F); + } + } else { +@@ -718,26 +693,22 @@ + ShulkerPeekGoal() {} + + @Override +- @Override + public boolean canUse() { + return Shulker.this.getTarget() == null && Shulker.this.random.nextInt(reducedTickDelay(40)) == 0 && Shulker.this.canStayAt(Shulker.this.blockPosition(), Shulker.this.getAttachFace()); + } + + @Override +- @Override + public boolean canContinueToUse() { + return Shulker.this.getTarget() == null && this.peekTime > 0; + } + + @Override +- @Override + public void start() { + this.peekTime = this.adjustedTickDelay(20 * (1 + Shulker.this.random.nextInt(3))); + Shulker.this.setRawPeekAmount(30); + } + + @Override +- @Override + public void stop() { + if (Shulker.this.getTarget() == null) { + Shulker.this.setRawPeekAmount(0); +@@ -746,7 +717,6 @@ + } + + @Override +- @Override + public void tick() { + --this.peekTime; + } +@@ -754,45 +724,41 @@ + + private class ShulkerNearestAttackGoal extends NearestAttackableTargetGoal<Player> { + +- public ShulkerNearestAttackGoal(Shulker shulker) { +- super(shulker, Player.class, true); ++ public ShulkerNearestAttackGoal(Shulker entityshulker) { ++ super(entityshulker, Player.class, true); + } + + @Override +- @Override + public boolean canUse() { + return Shulker.this.level().getDifficulty() == Difficulty.PEACEFUL ? false : super.canUse(); + } + + @Override +- @Override +- protected AABB getTargetSearchArea(double d0) { +- Direction direction = ((Shulker) this.mob).getAttachFace(); ++ protected AABB getTargetSearchArea(double targetDistance) { ++ Direction enumdirection = ((Shulker) this.mob).getAttachFace(); + +- return direction.getAxis() == Direction.Axis.X ? this.mob.getBoundingBox().inflate(4.0D, d0, d0) : (direction.getAxis() == Direction.Axis.Z ? this.mob.getBoundingBox().inflate(d0, d0, 4.0D) : this.mob.getBoundingBox().inflate(d0, 4.0D, d0)); ++ return enumdirection.getAxis() == Direction.Axis.X ? this.mob.getBoundingBox().inflate(4.0D, targetDistance, targetDistance) : (enumdirection.getAxis() == Direction.Axis.Z ? this.mob.getBoundingBox().inflate(targetDistance, targetDistance, 4.0D) : this.mob.getBoundingBox().inflate(targetDistance, 4.0D, targetDistance)); + } + } + + private static class ShulkerDefenseAttackGoal extends NearestAttackableTargetGoal<LivingEntity> { + + public ShulkerDefenseAttackGoal(Shulker shulker) { +- super(shulker, LivingEntity.class, 10, true, false, (livingentity) -> { +- return livingentity instanceof Enemy; ++ super(shulker, LivingEntity.class, 10, true, false, (entityliving) -> { ++ return entityliving instanceof IMonster; + }); + } + + @Override +- @Override + public boolean canUse() { + return this.mob.getTeam() == null ? false : super.canUse(); + } + + @Override +- @Override +- protected AABB getTargetSearchArea(double d0) { +- Direction direction = ((Shulker) this.mob).getAttachFace(); ++ protected AABB getTargetSearchArea(double targetDistance) { ++ Direction enumdirection = ((Shulker) this.mob).getAttachFace(); + +- return direction.getAxis() == Direction.Axis.X ? this.mob.getBoundingBox().inflate(4.0D, d0, d0) : (direction.getAxis() == Direction.Axis.Z ? this.mob.getBoundingBox().inflate(d0, d0, 4.0D) : this.mob.getBoundingBox().inflate(d0, 4.0D, d0)); ++ return enumdirection.getAxis() == Direction.Axis.X ? this.mob.getBoundingBox().inflate(4.0D, targetDistance, targetDistance) : (enumdirection.getAxis() == Direction.Axis.Z ? this.mob.getBoundingBox().inflate(targetDistance, targetDistance, 4.0D) : this.mob.getBoundingBox().inflate(targetDistance, 4.0D, targetDistance)); + } + } + +@@ -803,7 +769,6 @@ + } + + @Override +- @Override + public void clientTick() {} + } + } |