Add changeling wings

This commit is contained in:
Sollace 2023-08-29 02:06:13 +01:00
parent 559b8d2e6e
commit 82ec2b4f14
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
3 changed files with 23 additions and 2 deletions

View file

@ -9,6 +9,7 @@ import com.minelittlepony.api.model.gear.IGear;
import com.minelittlepony.client.model.ClientPonyModel; import com.minelittlepony.client.model.ClientPonyModel;
import com.minelittlepony.client.model.ModelType; import com.minelittlepony.client.model.ModelType;
import com.minelittlepony.client.model.PlayerModelKey; import com.minelittlepony.client.model.PlayerModelKey;
import com.minelittlepony.client.model.entity.race.ChangelingModel;
import com.minelittlepony.client.model.entity.race.PegasusModel; import com.minelittlepony.client.model.entity.race.PegasusModel;
import com.minelittlepony.client.model.entity.race.UnicornModel; import com.minelittlepony.client.model.entity.race.UnicornModel;
import com.minelittlepony.client.model.part.UnicornHorn; import com.minelittlepony.client.model.part.UnicornHorn;
@ -33,6 +34,9 @@ class BodyPartGear<M extends ClientPonyModel<LivingEntity> & MsonModel & IModel>
private static final Identifier ICARUS_WINGS = Unicopia.id("textures/models/wings/icarus_pony.png"); private static final Identifier ICARUS_WINGS = Unicopia.id("textures/models/wings/icarus_pony.png");
private static final Identifier ICARUS_WINGS_CORRUPTED = Unicopia.id("textures/models/wings/icarus_corrupted_pony.png"); private static final Identifier ICARUS_WINGS_CORRUPTED = Unicopia.id("textures/models/wings/icarus_corrupted_pony.png");
public static final Predicate<LivingEntity> BUG_WINGS_PREDICATE = MINE_LP_HAS_NO_WINGS.and(AmuletSelectors.PEGASUS_AMULET.negate()).and(EquinePredicates.PLAYER_CHANGELING);
public static final Identifier BUG_WINGS = Unicopia.id("textures/models/wings/bug_pony.png");
public static final Predicate<LivingEntity> BAT_WINGS_PREDICATE = MINE_LP_HAS_NO_WINGS.and(AmuletSelectors.PEGASUS_AMULET.negate()).and(EquinePredicates.PLAYER_BAT); public static final Predicate<LivingEntity> BAT_WINGS_PREDICATE = MINE_LP_HAS_NO_WINGS.and(AmuletSelectors.PEGASUS_AMULET.negate()).and(EquinePredicates.PLAYER_BAT);
public static final Identifier BAT_WINGS = Unicopia.id("textures/models/wings/bat_pony.png"); public static final Identifier BAT_WINGS = Unicopia.id("textures/models/wings/bat_pony.png");
@ -52,7 +56,11 @@ class BodyPartGear<M extends ClientPonyModel<LivingEntity> & MsonModel & IModel>
} }
public static BodyPartGear<WingsGearModel> batWings() { public static BodyPartGear<WingsGearModel> batWings() {
return new BodyPartGear<>(BodyPart.BODY, ModelType.BAT_PONY, BAT_WINGS_PREDICATE, WingsGearModel::new, WingsGearModel::getWings, e -> BAT_WINGS); return new BodyPartGear<>(BodyPart.BODY, ModelType.BAT_PONY, BAT_WINGS_PREDICATE, WingsGearModel::new, IPegasus::getWings, e -> BAT_WINGS);
}
public static BodyPartGear<BugWingsGearModel> bugWings() {
return new BodyPartGear<>(BodyPart.BODY, ModelType.CHANGELING, BUG_WINGS_PREDICATE, BugWingsGearModel::new, IPegasus::getWings, e -> BUG_WINGS);
} }
public static BodyPartGear<HornGearModel> unicornHorn() { public static BodyPartGear<HornGearModel> unicornHorn() {
@ -70,7 +78,7 @@ class BodyPartGear<M extends ClientPonyModel<LivingEntity> & MsonModel & IModel>
PlayerModelKey<LivingEntity, ? super M> modelKey, PlayerModelKey<LivingEntity, ? super M> modelKey,
Predicate<LivingEntity> renderTargetPredicate, Predicate<LivingEntity> renderTargetPredicate,
MsonModel.Factory<M> modelFactory, MsonModel.Factory<M> modelFactory,
Function<M, IPart> partExtractor, Function<? super M, IPart> partExtractor,
Function<Entity, Identifier> textureSupplier) { Function<Entity, Identifier> textureSupplier) {
this.gearLocation = gearLocation; this.gearLocation = gearLocation;
this.model = modelKey.steveKey().createModel(modelFactory); this.model = modelKey.steveKey().createModel(modelFactory);
@ -119,6 +127,17 @@ class BodyPartGear<M extends ClientPonyModel<LivingEntity> & MsonModel & IModel>
} }
} }
static final class BugWingsGearModel extends ChangelingModel<LivingEntity> {
public BugWingsGearModel(ModelPart tree) {
super(tree, false);
}
@Override
public boolean canFly() {
return true;
}
}
static final class HornGearModel extends UnicornModel<LivingEntity> { static final class HornGearModel extends UnicornModel<LivingEntity> {
public HornGearModel(ModelPart tree) { public HornGearModel(ModelPart tree) {
super(tree, false); super(tree, false);

View file

@ -29,6 +29,7 @@ public class Main extends MineLPDelegate implements ClientModInitializer {
IGear.register(HeldEntityGear::new); IGear.register(HeldEntityGear::new);
IGear.register(BodyPartGear::pegasusWings); IGear.register(BodyPartGear::pegasusWings);
IGear.register(BodyPartGear::batWings); IGear.register(BodyPartGear::batWings);
IGear.register(BodyPartGear::bugWings);
IGear.register(BodyPartGear::unicornHorn); IGear.register(BodyPartGear::unicornHorn);
IGear.register(AmuletGear::new); IGear.register(AmuletGear::new);
IGear.register(GlassesGear::new); IGear.register(GlassesGear::new);
@ -51,6 +52,7 @@ public class Main extends MineLPDelegate implements ClientModInitializer {
model.getAttributes().isGoingFast |= zMotion > 0.4F; model.getAttributes().isGoingFast |= zMotion > 0.4F;
model.getAttributes().isGoingFast |= pony.getMotion().isDiving(); model.getAttributes().isGoingFast |= pony.getMotion().isDiving();
} }
model.getAttributes().isGoingFast |= pony.getMotion().isRainbooming(); model.getAttributes().isGoingFast |= pony.getMotion().isRainbooming();
model.getAttributes().isGoingFast &= !pony.getEntityInArms().isPresent(); model.getAttributes().isGoingFast &= !pony.getEntityInArms().isPresent();

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB