先辈不再是蜘蛛了

This commit is contained in:
17146 2024-08-15 14:44:31 +08:00
parent 729264462a
commit 75ed202791
2 changed files with 6 additions and 11 deletions

View file

@ -9,7 +9,6 @@ import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.Difficulty;
import net.minecraft.world.damagesource.DamageSource;
@ -23,7 +22,6 @@ import net.minecraft.world.entity.ai.goal.RandomStrollGoal;
import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal;
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.entity.monster.Spider;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
@ -33,7 +31,6 @@ import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraftforge.common.DungeonHooks;
import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.network.PlayMessages;
import net.minecraftforge.registries.ForgeRegistries;
import software.bernie.geckolib.animatable.GeoEntity;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.core.animation.AnimatableManager;
@ -43,8 +40,7 @@ import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.util.GeckoLibUtil;
// TODO 重置生物
public class SenpaiEntity extends Spider implements GeoEntity, AnimatedEntity {
public class SenpaiEntity extends Monster implements GeoEntity, AnimatedEntity {
public static final EntityDataAccessor<Boolean> SHOOT = SynchedEntityData.defineId(SenpaiEntity.class, EntityDataSerializers.BOOLEAN);
public static final EntityDataAccessor<String> ANIMATION = SynchedEntityData.defineId(SenpaiEntity.class, EntityDataSerializers.STRING);
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
@ -112,7 +108,7 @@ public class SenpaiEntity extends Spider implements GeoEntity, AnimatedEntity {
@Override
public SoundEvent getAmbientSound() {
return ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("superbwarfare:idle"));
return ModSounds.IDLE.get();
}
@Override
@ -122,12 +118,12 @@ public class SenpaiEntity extends Spider implements GeoEntity, AnimatedEntity {
@Override
public SoundEvent getHurtSound(DamageSource ds) {
return ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("superbwarfare:ouch"));
return ModSounds.OUCH.get();
}
@Override
public SoundEvent getDeathSound() {
return ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("superbwarfare:growl"));
return ModSounds.GROWL.get();
}
@Override
@ -173,7 +169,7 @@ public class SenpaiEntity extends Spider implements GeoEntity, AnimatedEntity {
.add(Attributes.KNOCKBACK_RESISTANCE, 0.5);
}
private PlayState movementPredicate(AnimationState event) {
private PlayState movementPredicate(AnimationState<SenpaiEntity> event) {
if (this.animationProcedure.equals("empty")) {
if ((event.isMoving() || !(event.getLimbSwingAmount() > -0.15F && event.getLimbSwingAmount() < 0.15F))
@ -191,7 +187,7 @@ public class SenpaiEntity extends Spider implements GeoEntity, AnimatedEntity {
return PlayState.STOP;
}
private PlayState procedurePredicate(AnimationState event) {
private PlayState procedurePredicate(AnimationState<SenpaiEntity> event) {
if (!animationProcedure.equals("empty") && event.getController().getAnimationState() == AnimationController.State.STOPPED) {
event.getController().setAnimation(RawAnimation.begin().thenPlay(this.animationProcedure));
if (event.getController().getAnimationState() == AnimationController.State.STOPPED) {

View file

@ -21,5 +21,4 @@ public class SenpaiModel extends GeoModel<SenpaiEntity> {
return new ResourceLocation(ModUtils.MODID, "textures/entity/senpai.png");
}
}