From bb2443caec7685bd12141cb0a8042958ab9ca1b7 Mon Sep 17 00:00:00 2001 From: Pyrix25633 Date: Mon, 9 Jan 2023 15:07:03 +0100 Subject: [PATCH] 1.19.2 - 1.0.5: Fixed calls to deprecated GeckoLib methods --- .../entity/client/BlastlingModel.java | 6 +++--- .../entity/client/IndigoSquidModel.java | 4 ++-- .../improved_end/entity/client/MawlingModel.java | 7 +++---- .../entity/client/SnarelingModel.java | 6 +++--- .../entity/client/WatchlingModel.java | 6 +++--- .../entity/custom/BlastlingEntity.java | 12 ++++++++---- .../entity/custom/IndigoSquidEntity.java | 15 +++++++++------ .../improved_end/entity/custom/MawlingEntity.java | 11 +++++++---- .../entity/custom/SnarelingEntity.java | 11 +++++++---- .../entity/custom/WatchlingEntity.java | 11 +++++++---- 10 files changed, 52 insertions(+), 37 deletions(-) diff --git a/src/main/java/net/rupyber_studios/improved_end/entity/client/BlastlingModel.java b/src/main/java/net/rupyber_studios/improved_end/entity/client/BlastlingModel.java index 4db5fb3..97b5246 100644 --- a/src/main/java/net/rupyber_studios/improved_end/entity/client/BlastlingModel.java +++ b/src/main/java/net/rupyber_studios/improved_end/entity/client/BlastlingModel.java @@ -24,10 +24,10 @@ public Identifier getAnimationResource(BlastlingEntity animatable) { return new Identifier(ImprovedEnd.MOD_ID, "animations/blastling.animations.json"); } - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings("unchecked") @Override - public void setLivingAnimations(BlastlingEntity entity, Integer uniqueID, AnimationEvent customPredicate) { - super.setLivingAnimations(entity, uniqueID, customPredicate); + public void setCustomAnimations(BlastlingEntity entity, int uniqueID, AnimationEvent customPredicate) { + super.setCustomAnimations(entity, uniqueID, customPredicate); IBone head = this.getAnimationProcessor().getBone("head"); EntityModelData extraData = (EntityModelData) customPredicate.getExtraDataOfType(EntityModelData.class).get(0); diff --git a/src/main/java/net/rupyber_studios/improved_end/entity/client/IndigoSquidModel.java b/src/main/java/net/rupyber_studios/improved_end/entity/client/IndigoSquidModel.java index 82e898c..fb4c383 100644 --- a/src/main/java/net/rupyber_studios/improved_end/entity/client/IndigoSquidModel.java +++ b/src/main/java/net/rupyber_studios/improved_end/entity/client/IndigoSquidModel.java @@ -24,8 +24,8 @@ public Identifier getAnimationResource(IndigoSquidEntity animatable) { } @Override - public void setLivingAnimations(IndigoSquidEntity entity, Integer uniqueID, AnimationEvent customPredicate) { - super.setLivingAnimations(entity, uniqueID, customPredicate); + public void setCustomAnimations(IndigoSquidEntity entity, int uniqueID, AnimationEvent customPredicate) { + super.setCustomAnimations(entity, uniqueID, customPredicate); IBone head = this.getAnimationProcessor().getBone("body"); if (head != null) { diff --git a/src/main/java/net/rupyber_studios/improved_end/entity/client/MawlingModel.java b/src/main/java/net/rupyber_studios/improved_end/entity/client/MawlingModel.java index 013bdb4..1b6f9ca 100644 --- a/src/main/java/net/rupyber_studios/improved_end/entity/client/MawlingModel.java +++ b/src/main/java/net/rupyber_studios/improved_end/entity/client/MawlingModel.java @@ -2,7 +2,6 @@ import net.minecraft.util.Identifier; import net.rupyber_studios.improved_end.ImprovedEnd; -import net.rupyber_studios.improved_end.entity.custom.BlastlingEntity; import net.rupyber_studios.improved_end.entity.custom.MawlingEntity; import software.bernie.geckolib3.core.event.predicate.AnimationEvent; import software.bernie.geckolib3.core.processor.IBone; @@ -25,10 +24,10 @@ public Identifier getAnimationResource(MawlingEntity animatable) { return new Identifier(ImprovedEnd.MOD_ID, "animations/mawling.animations.json"); } - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings("unchecked") @Override - public void setLivingAnimations(MawlingEntity entity, Integer uniqueID, AnimationEvent customPredicate) { - super.setLivingAnimations(entity, uniqueID, customPredicate); + public void setCustomAnimations(MawlingEntity entity, int uniqueID, AnimationEvent customPredicate) { + super.setCustomAnimations(entity, uniqueID, customPredicate); IBone head = this.getAnimationProcessor().getBone("head"); EntityModelData extraData = (EntityModelData) customPredicate.getExtraDataOfType(EntityModelData.class).get(0); diff --git a/src/main/java/net/rupyber_studios/improved_end/entity/client/SnarelingModel.java b/src/main/java/net/rupyber_studios/improved_end/entity/client/SnarelingModel.java index 3688796..3f17434 100644 --- a/src/main/java/net/rupyber_studios/improved_end/entity/client/SnarelingModel.java +++ b/src/main/java/net/rupyber_studios/improved_end/entity/client/SnarelingModel.java @@ -24,10 +24,10 @@ public Identifier getAnimationResource(SnarelingEntity animatable) { return new Identifier(ImprovedEnd.MOD_ID, "animations/snareling.animations.json"); } - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings("unchecked") @Override - public void setLivingAnimations(SnarelingEntity entity, Integer uniqueID, AnimationEvent customPredicate) { - super.setLivingAnimations(entity, uniqueID, customPredicate); + public void setCustomAnimations(SnarelingEntity entity, int uniqueID, AnimationEvent customPredicate) { + super.setCustomAnimations(entity, uniqueID, customPredicate); IBone head = this.getAnimationProcessor().getBone("head"); EntityModelData extraData = (EntityModelData) customPredicate.getExtraDataOfType(EntityModelData.class).get(0); diff --git a/src/main/java/net/rupyber_studios/improved_end/entity/client/WatchlingModel.java b/src/main/java/net/rupyber_studios/improved_end/entity/client/WatchlingModel.java index 3a00c39..4b6bf28 100644 --- a/src/main/java/net/rupyber_studios/improved_end/entity/client/WatchlingModel.java +++ b/src/main/java/net/rupyber_studios/improved_end/entity/client/WatchlingModel.java @@ -24,10 +24,10 @@ public Identifier getAnimationResource(WatchlingEntity animatable) { return new Identifier(ImprovedEnd.MOD_ID, "animations/watchling.animations.json"); } - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings("unchecked") @Override - public void setLivingAnimations(WatchlingEntity entity, Integer uniqueID, AnimationEvent customPredicate) { - super.setLivingAnimations(entity, uniqueID, customPredicate); + public void setCustomAnimations(WatchlingEntity entity, int uniqueID, AnimationEvent customPredicate) { + super.setCustomAnimations(entity, uniqueID, customPredicate); IBone head = this.getAnimationProcessor().getBone("head"); EntityModelData extraData = (EntityModelData) customPredicate.getExtraDataOfType(EntityModelData.class).get(0); diff --git a/src/main/java/net/rupyber_studios/improved_end/entity/custom/BlastlingEntity.java b/src/main/java/net/rupyber_studios/improved_end/entity/custom/BlastlingEntity.java index 35ca6f0..c32888f 100644 --- a/src/main/java/net/rupyber_studios/improved_end/entity/custom/BlastlingEntity.java +++ b/src/main/java/net/rupyber_studios/improved_end/entity/custom/BlastlingEntity.java @@ -45,6 +45,7 @@ import software.bernie.geckolib3.core.event.predicate.AnimationEvent; import software.bernie.geckolib3.core.manager.AnimationData; import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib3.util.GeckoLibUtil; import java.util.EnumSet; import java.util.List; @@ -52,7 +53,8 @@ import java.util.function.Predicate; public class BlastlingEntity extends HostileEntity implements IAnimatable, Angerable { - private final AnimationFactory factory = new AnimationFactory(this); + private final AnimationFactory factory = GeckoLibUtil.createFactory(this); + private static final UUID ATTACKING_SPEED_BOOST_ID = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0"); private static final EntityAttributeModifier ATTACKING_SPEED_BOOST; private static final TrackedData ANGRY; @@ -93,17 +95,17 @@ protected void initGoals() { private PlayState predicate(AnimationEvent event) { if(event.isMoving()) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.blastling.walk", true)); + event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.blastling.walk")); return PlayState.CONTINUE; } - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.blastling.idle", true)); + event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.blastling.idle")); return PlayState.CONTINUE; } private PlayState attackPredicate(AnimationEvent event) { if(this.isAttacking() && event.getController().getAnimationState().equals(AnimationState.Stopped)) { event.getController().markNeedsReload(); - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.blastling.attack", false)); + event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.blastling.attack")); } return PlayState.CONTINUE; } @@ -127,10 +129,12 @@ public void setTarget(@Nullable LivingEntity target) { this.ageWhenTargetSet = 0; this.dataTracker.set(ANGRY, false); this.dataTracker.set(PROVOKED, false); + assert entityAttributeInstance != null; entityAttributeInstance.removeModifier(ATTACKING_SPEED_BOOST); } else { this.ageWhenTargetSet = this.age; this.dataTracker.set(ANGRY, true); + assert entityAttributeInstance != null; if (!entityAttributeInstance.hasModifier(ATTACKING_SPEED_BOOST)) { entityAttributeInstance.addTemporaryModifier(ATTACKING_SPEED_BOOST); } diff --git a/src/main/java/net/rupyber_studios/improved_end/entity/custom/IndigoSquidEntity.java b/src/main/java/net/rupyber_studios/improved_end/entity/custom/IndigoSquidEntity.java index 6558b76..ec14cf6 100644 --- a/src/main/java/net/rupyber_studios/improved_end/entity/custom/IndigoSquidEntity.java +++ b/src/main/java/net/rupyber_studios/improved_end/entity/custom/IndigoSquidEntity.java @@ -28,9 +28,12 @@ import software.bernie.geckolib3.core.event.predicate.AnimationEvent; import software.bernie.geckolib3.core.manager.AnimationData; import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib3.util.GeckoLibUtil; + +import java.util.Objects; public class IndigoSquidEntity extends WaterCreatureEntity implements IAnimatable { - private final AnimationFactory factory = new AnimationFactory(this); + private final AnimationFactory factory = GeckoLibUtil.createFactory(this); public float tiltAngle; public float prevTiltAngle; public float rollAngle; @@ -48,7 +51,7 @@ public class IndigoSquidEntity extends WaterCreatureEntity implements IAnimatabl public IndigoSquidEntity(EntityType entityType, World world) { super(entityType, world); - this.random.setSeed((long) this.getId()); + this.random.setSeed(this.getId()); this.thrustTimerSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; setAttributes(); initGoals(); @@ -66,7 +69,7 @@ protected void initGoals() { } private PlayState predicate(AnimationEvent event) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.indigo_squid.swim", true)); + event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.indigo_squid.swim")); return PlayState.CONTINUE; } @@ -156,7 +159,7 @@ public void tickMovement() { this.turningSpeed *= 0.99F; } if (!this.world.isClient) { - this.setVelocity((this.swimX * this.swimVelocityScale), (double) (this.swimY * this.swimVelocityScale), (this.swimZ * this.swimVelocityScale)); + this.setVelocity((this.swimX * this.swimVelocityScale), (this.swimY * this.swimVelocityScale), (this.swimZ * this.swimVelocityScale)); } Vec3d vec3d = this.getVelocity(); double d = vec3d.horizontalLength(); @@ -169,7 +172,7 @@ public void tickMovement() { if (!this.world.isClient) { double e = this.getVelocity().y; if (this.hasStatusEffect(StatusEffects.LEVITATION)) { - e = 0.05 * (double) (this.getStatusEffect(StatusEffects.LEVITATION).getAmplifier() + 1); + e = 0.05 * (double) (Objects.requireNonNull(this.getStatusEffect(StatusEffects.LEVITATION)).getAmplifier() + 1); } else if (!this.hasNoGravity()) { e -= 0.08; } @@ -238,7 +241,7 @@ public boolean hasSwimmingVector() { return this.swimX != 0.0F || this.swimY != 0.0F || this.swimZ != 0.0F; } - class SwimGoal extends Goal { + static class SwimGoal extends Goal { private final IndigoSquidEntity squid; public SwimGoal(IndigoSquidEntity squid) { diff --git a/src/main/java/net/rupyber_studios/improved_end/entity/custom/MawlingEntity.java b/src/main/java/net/rupyber_studios/improved_end/entity/custom/MawlingEntity.java index 02029e5..249f1d0 100644 --- a/src/main/java/net/rupyber_studios/improved_end/entity/custom/MawlingEntity.java +++ b/src/main/java/net/rupyber_studios/improved_end/entity/custom/MawlingEntity.java @@ -45,6 +45,7 @@ import software.bernie.geckolib3.core.event.predicate.AnimationEvent; import software.bernie.geckolib3.core.manager.AnimationData; import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib3.util.GeckoLibUtil; import java.util.EnumSet; import java.util.List; @@ -52,7 +53,7 @@ import java.util.function.Predicate; public class MawlingEntity extends HostileEntity implements IAnimatable, Angerable { - private final AnimationFactory factory = new AnimationFactory(this); + private final AnimationFactory factory = GeckoLibUtil.createFactory(this); private static final UUID ATTACKING_SPEED_BOOST_ID = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0"); private static final EntityAttributeModifier ATTACKING_SPEED_BOOST; private static final TrackedData ANGRY; @@ -93,17 +94,17 @@ protected void initGoals() { private PlayState predicate(AnimationEvent event) { if(event.isMoving()) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.mawling.walk", true)); + event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.mawling.walk")); return PlayState.CONTINUE; } - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.mawling.idle", true)); + event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.mawling.idle")); return PlayState.CONTINUE; } private PlayState attackPredicate(AnimationEvent event) { if(this.isAttacking() && event.getController().getAnimationState().equals(AnimationState.Stopped)) { event.getController().markNeedsReload(); - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.mawling.attack", false)); + event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.mawling.attack")); } return PlayState.CONTINUE; } @@ -127,10 +128,12 @@ public void setTarget(@Nullable LivingEntity target) { this.ageWhenTargetSet = 0; this.dataTracker.set(ANGRY, false); this.dataTracker.set(PROVOKED, false); + assert entityAttributeInstance != null; entityAttributeInstance.removeModifier(ATTACKING_SPEED_BOOST); } else { this.ageWhenTargetSet = this.age; this.dataTracker.set(ANGRY, true); + assert entityAttributeInstance != null; if (!entityAttributeInstance.hasModifier(ATTACKING_SPEED_BOOST)) { entityAttributeInstance.addTemporaryModifier(ATTACKING_SPEED_BOOST); } diff --git a/src/main/java/net/rupyber_studios/improved_end/entity/custom/SnarelingEntity.java b/src/main/java/net/rupyber_studios/improved_end/entity/custom/SnarelingEntity.java index b2ca185..74c6088 100644 --- a/src/main/java/net/rupyber_studios/improved_end/entity/custom/SnarelingEntity.java +++ b/src/main/java/net/rupyber_studios/improved_end/entity/custom/SnarelingEntity.java @@ -41,12 +41,13 @@ import software.bernie.geckolib3.core.event.predicate.AnimationEvent; import software.bernie.geckolib3.core.manager.AnimationData; import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib3.util.GeckoLibUtil; import java.util.*; import java.util.function.Predicate; public class SnarelingEntity extends HostileEntity implements IAnimatable, Angerable { - private final AnimationFactory factory = new AnimationFactory(this); + private final AnimationFactory factory = GeckoLibUtil.createFactory(this); private static final UUID ATTACKING_SPEED_BOOST_ID = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0"); private static final EntityAttributeModifier ATTACKING_SPEED_BOOST; private static final TrackedData ANGRY; @@ -87,17 +88,17 @@ protected void initGoals() { private PlayState predicate(AnimationEvent event) { if(event.isMoving()) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.snareling.walk", true)); + event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.snareling.walk")); return PlayState.CONTINUE; } - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.snareling.idle", true)); + event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.snareling.idle")); return PlayState.CONTINUE; } private PlayState attackPredicate(AnimationEvent event) { if(this.isAttacking() && event.getController().getAnimationState().equals(AnimationState.Stopped)) { event.getController().markNeedsReload(); - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.snareling.attack", false)); + event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.snareling.attack")); } return PlayState.CONTINUE; } @@ -121,10 +122,12 @@ public void setTarget(@Nullable LivingEntity target) { this.ageWhenTargetSet = 0; this.dataTracker.set(ANGRY, false); this.dataTracker.set(PROVOKED, false); + assert entityAttributeInstance != null; entityAttributeInstance.removeModifier(ATTACKING_SPEED_BOOST); } else { this.ageWhenTargetSet = this.age; this.dataTracker.set(ANGRY, true); + assert entityAttributeInstance != null; if (!entityAttributeInstance.hasModifier(ATTACKING_SPEED_BOOST)) { entityAttributeInstance.addTemporaryModifier(ATTACKING_SPEED_BOOST); } diff --git a/src/main/java/net/rupyber_studios/improved_end/entity/custom/WatchlingEntity.java b/src/main/java/net/rupyber_studios/improved_end/entity/custom/WatchlingEntity.java index 3a71a2f..00a5972 100644 --- a/src/main/java/net/rupyber_studios/improved_end/entity/custom/WatchlingEntity.java +++ b/src/main/java/net/rupyber_studios/improved_end/entity/custom/WatchlingEntity.java @@ -45,6 +45,7 @@ import software.bernie.geckolib3.core.event.predicate.AnimationEvent; import software.bernie.geckolib3.core.manager.AnimationData; import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib3.util.GeckoLibUtil; import java.util.EnumSet; import java.util.List; @@ -52,7 +53,7 @@ import java.util.function.Predicate; public class WatchlingEntity extends HostileEntity implements IAnimatable, Angerable { - private final AnimationFactory factory = new AnimationFactory(this); + private final AnimationFactory factory = GeckoLibUtil.createFactory(this); private static final UUID ATTACKING_SPEED_BOOST_ID = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0"); private static final EntityAttributeModifier ATTACKING_SPEED_BOOST; private static final TrackedData ANGRY; @@ -93,17 +94,17 @@ protected void initGoals() { private PlayState predicate(AnimationEvent event) { if(event.isMoving()) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.watchling.walk", true)); + event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.watchling.walk")); return PlayState.CONTINUE; } - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.watchling.idle", true)); + event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.watchling.idle")); return PlayState.CONTINUE; } private PlayState attackPredicate(AnimationEvent event) { if(this.isAttacking() && event.getController().getAnimationState().equals(AnimationState.Stopped)) { event.getController().markNeedsReload(); - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.watchling.attack", false)); + event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.watchling.attack")); } return PlayState.CONTINUE; } @@ -127,10 +128,12 @@ public void setTarget(@Nullable LivingEntity target) { this.ageWhenTargetSet = 0; this.dataTracker.set(ANGRY, false); this.dataTracker.set(PROVOKED, false); + assert entityAttributeInstance != null; entityAttributeInstance.removeModifier(ATTACKING_SPEED_BOOST); } else { this.ageWhenTargetSet = this.age; this.dataTracker.set(ANGRY, true); + assert entityAttributeInstance != null; if (!entityAttributeInstance.hasModifier(ATTACKING_SPEED_BOOST)) { entityAttributeInstance.addTemporaryModifier(ATTACKING_SPEED_BOOST); }