diff options
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Spider.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Spider.java.patch | 278 |
1 files changed, 278 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Spider.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Spider.java.patch new file mode 100644 index 0000000000..8019035f12 --- /dev/null +++ b/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Spider.java.patch @@ -0,0 +1,278 @@ +--- a/net/minecraft/world/entity/monster/Spider.java ++++ b/net/minecraft/world/entity/monster/Spider.java +@@ -17,12 +17,12 @@ + import net.minecraft.world.effect.MobEffects; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.EntityDimensions; ++import net.minecraft.world.entity.EntityPose; + import net.minecraft.world.entity.EntityType; ++import net.minecraft.world.entity.EnumMobSpawn; ++import net.minecraft.world.entity.EnumMonsterType; ++import net.minecraft.world.entity.GroupDataEntity; + import net.minecraft.world.entity.LivingEntity; +-import net.minecraft.world.entity.MobSpawnType; +-import net.minecraft.world.entity.MobType; +-import net.minecraft.world.entity.Pose; +-import net.minecraft.world.entity.SpawnGroupData; + import net.minecraft.world.entity.ai.attributes.AttributeSupplier; + import net.minecraft.world.entity.ai.attributes.Attributes; + import net.minecraft.world.entity.ai.goal.FloatGoal; +@@ -40,11 +40,12 @@ + 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.phys.Vec3; + import org.joml.Vector3f; + + public class Spider extends Monster { ++ + private static final EntityDataAccessor<Byte> DATA_FLAGS_ID = SynchedEntityData.defineId(Spider.class, EntityDataSerializers.BYTE); + private static final float SPIDER_SPECIAL_EFFECT_CHANCE = 0.1F; + +@@ -57,17 +58,17 @@ + this.goalSelector.addGoal(1, new FloatGoal(this)); + this.goalSelector.addGoal(3, new LeapAtTargetGoal(this, 0.4F)); + this.goalSelector.addGoal(4, new Spider.SpiderAttackGoal(this)); +- this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 0.8)); ++ this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 0.8D)); + this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 8.0F)); + this.goalSelector.addGoal(6, new RandomLookAroundGoal(this)); +- this.targetSelector.addGoal(1, new HurtByTargetGoal(this)); ++ this.targetSelector.addGoal(1, new HurtByTargetGoal(this, new Class[0])); + this.targetSelector.addGoal(2, new Spider.SpiderTargetGoal<>(this, Player.class)); + this.targetSelector.addGoal(3, new Spider.SpiderTargetGoal<>(this, IronGolem.class)); + } + + @Override +- protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entityDimensions, float f) { +- return new Vector3f(0.0F, entityDimensions.height * 0.85F, 0.0F); ++ protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entitysize, float f) { ++ return new Vector3f(0.0F, entitysize.height * 0.85F, 0.0F); + } + + @Override +@@ -78,7 +79,7 @@ + @Override + protected void defineSynchedData() { + super.defineSynchedData(); +- this.entityData.define(DATA_FLAGS_ID, (byte)0); ++ this.entityData.define(Spider.DATA_FLAGS_ID, (byte) 0); + } + + @Override +@@ -87,10 +88,11 @@ + if (!this.level().isClientSide) { + this.setClimbing(this.horizontalCollision); + } ++ + } + + public static AttributeSupplier.Builder createAttributes() { +- return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 16.0).add(Attributes.MOVEMENT_SPEED, 0.3F); ++ return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 16.0D).add(Attributes.MOVEMENT_SPEED, 0.30000001192092896D); + } + + @Override +@@ -109,7 +111,7 @@ + } + + @Override +- protected void playStepSound(BlockPos pos, BlockState block) { ++ protected void playStepSound(BlockPos pos, IBlockData block) { + this.playSound(SoundEvents.SPIDER_STEP, 0.15F, 1.0F); + } + +@@ -119,72 +121,76 @@ + } + + @Override +- public void makeStuckInBlock(BlockState state, Vec3 motionMultiplier) { ++ public void makeStuckInBlock(IBlockData state, Vec3 motionMultiplier) { + if (!state.is(Blocks.COBWEB)) { + super.makeStuckInBlock(state, motionMultiplier); + } ++ + } + + @Override +- public MobType getMobType() { +- return MobType.ARTHROPOD; ++ public EnumMonsterType getMobType() { ++ return EnumMonsterType.ARTHROPOD; + } + + @Override + public boolean canBeAffected(MobEffectInstance potioneffect) { +- return potioneffect.getEffect() != MobEffects.POISON && super.canBeAffected(potioneffect); ++ return potioneffect.getEffect() == MobEffects.POISON ? false : super.canBeAffected(potioneffect); + } + + public boolean isClimbing() { +- return (this.entityData.get(DATA_FLAGS_ID) & 1) != 0; ++ return ((Byte) this.entityData.get(Spider.DATA_FLAGS_ID) & 1) != 0; + } + + public void setClimbing(boolean climbing) { +- byte b = this.entityData.get(DATA_FLAGS_ID); ++ byte b0 = (Byte) this.entityData.get(Spider.DATA_FLAGS_ID); ++ + if (climbing) { +- b = (byte)(b | 1); ++ b0 = (byte) (b0 | 1); + } else { +- b = (byte)(b & -2); ++ b0 &= -2; + } + +- this.entityData.set(DATA_FLAGS_ID, b); ++ this.entityData.set(Spider.DATA_FLAGS_ID, b0); + } + + @Nullable + @Override +- public SpawnGroupData finalizeSpawn( +- ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType reason, @Nullable SpawnGroupData spawnData, @Nullable CompoundTag dataTag +- ) { +- SpawnGroupData var9 = super.finalizeSpawn(level, difficulty, reason, spawnData, dataTag); +- RandomSource random = level.getRandom(); +- if (random.nextInt(100) == 0) { +- Skeleton skeleton = EntityType.SKELETON.create(this.level()); +- if (skeleton != null) { +- skeleton.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F); +- skeleton.finalizeSpawn(level, difficulty, reason, null, null); +- skeleton.startRiding(this); ++ public GroupDataEntity finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, EnumMobSpawn reason, @Nullable GroupDataEntity spawnData, @Nullable CompoundTag dataTag) { ++ Object object = super.finalizeSpawn(level, difficulty, reason, spawnData, dataTag); ++ RandomSource randomsource = level.getRandom(); ++ ++ if (randomsource.nextInt(100) == 0) { ++ Skeleton entityskeleton = (Skeleton) EntityType.SKELETON.create(this.level()); ++ ++ if (entityskeleton != null) { ++ entityskeleton.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F); ++ entityskeleton.finalizeSpawn(level, difficulty, reason, (GroupDataEntity) null, (CompoundTag) null); ++ entityskeleton.startRiding(this); + } + } + +- if (var9 == null) { +- var9 = new Spider.SpiderEffectsGroupData(); +- if (level.getDifficulty() == Difficulty.HARD && random.nextFloat() < 0.1F * difficulty.getSpecialMultiplier()) { +- ((Spider.SpiderEffectsGroupData)var9).setRandomEffect(random); ++ if (object == null) { ++ object = new Spider.SpiderEffectsGroupData(); ++ if (level.getDifficulty() == Difficulty.HARD && randomsource.nextFloat() < 0.1F * difficulty.getSpecialMultiplier()) { ++ ((Spider.SpiderEffectsGroupData) object).setRandomEffect(randomsource); + } + } + +- if (var9 instanceof Spider.SpiderEffectsGroupData spiderEffectsGroupData) { +- MobEffect mobEffect = spiderEffectsGroupData.effect; +- if (mobEffect != null) { +- this.addEffect(new MobEffectInstance(mobEffect, -1)); ++ if (object instanceof Spider.SpiderEffectsGroupData) { ++ Spider.SpiderEffectsGroupData entityspider_groupdataspider = (Spider.SpiderEffectsGroupData) object; ++ MobEffect mobeffectlist = entityspider_groupdataspider.effect; ++ ++ if (mobeffectlist != null) { ++ this.addEffect(new MobEffectInstance(mobeffectlist, -1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN); // CraftBukkit + } + } + +- return (SpawnGroupData)var9; ++ return (GroupDataEntity) object; + } + + @Override +- protected float getStandingEyeHeight(Pose pose, EntityDimensions size) { ++ protected float getStandingEyeHeight(EntityPose pose, EntityDimensions size) { + return 0.65F; + } + +@@ -193,9 +199,10 @@ + return entity.getBbWidth() <= this.getBbWidth() ? -0.3125F : 0.0F; + } + +- static class SpiderAttackGoal extends MeleeAttackGoal { ++ private static class SpiderAttackGoal extends MeleeAttackGoal { ++ + public SpiderAttackGoal(Spider spider) { +- super(spider, 1.0, true); ++ super(spider, 1.0D, true); + } + + @Override +@@ -205,9 +212,10 @@ + + @Override + public boolean canContinueToUse() { +- float lightLevelDependentMagicValue = this.mob.getLightLevelDependentMagicValue(); +- if (lightLevelDependentMagicValue >= 0.5F && this.mob.getRandom().nextInt(100) == 0) { +- this.mob.setTarget(null); ++ float f = this.mob.getLightLevelDependentMagicValue(); ++ ++ if (f >= 0.5F && this.mob.getRandom().nextInt(100) == 0) { ++ this.mob.setTarget((LivingEntity) null); + return false; + } else { + return super.canContinueToUse(); +@@ -215,33 +223,40 @@ + } + } + +- public static class SpiderEffectsGroupData implements SpawnGroupData { ++ private static class SpiderTargetGoal<T extends LivingEntity> extends NearestAttackableTargetGoal<T> { ++ ++ public SpiderTargetGoal(Spider spider, Class<T> entityTypeToTarget) { ++ super(spider, entityTypeToTarget, true); ++ } ++ ++ @Override ++ public boolean canUse() { ++ float f = this.mob.getLightLevelDependentMagicValue(); ++ ++ return f >= 0.5F ? false : super.canUse(); ++ } ++ } ++ ++ public static class SpiderEffectsGroupData implements GroupDataEntity { ++ + @Nullable + public MobEffect effect; + ++ public SpiderEffectsGroupData() {} ++ + public void setRandomEffect(RandomSource random) { +- int randomInt = random.nextInt(5); +- if (randomInt <= 1) { ++ int i = random.nextInt(5); ++ ++ if (i <= 1) { + this.effect = MobEffects.MOVEMENT_SPEED; +- } else if (randomInt <= 2) { ++ } else if (i <= 2) { + this.effect = MobEffects.DAMAGE_BOOST; +- } else if (randomInt <= 3) { ++ } else if (i <= 3) { + this.effect = MobEffects.REGENERATION; +- } else if (randomInt <= 4) { ++ } else if (i <= 4) { + this.effect = MobEffects.INVISIBILITY; + } +- } +- } + +- static class SpiderTargetGoal<T extends LivingEntity> extends NearestAttackableTargetGoal<T> { +- public SpiderTargetGoal(Spider spider, Class<T> entityTypeToTarget) { +- super(spider, entityTypeToTarget, true); + } +- +- @Override +- public boolean canUse() { +- float lightLevelDependentMagicValue = this.mob.getLightLevelDependentMagicValue(); +- return !(lightLevelDependentMagicValue >= 0.5F) && super.canUse(); +- } + } + } |