mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Further refactoring and consolidating
This commit is contained in:
parent
a9b870547a
commit
4b842c9e9a
62 changed files with 168 additions and 247 deletions
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.api.pony.network.fabric;
|
||||
package com.minelittlepony.api.events;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
@ -11,25 +11,28 @@ import net.fabricmc.loader.api.FabricLoader;
|
|||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.minelittlepony.api.pony.Pony;
|
||||
import com.minelittlepony.api.pony.PonyData;
|
||||
import com.minelittlepony.api.pony.network.MsgPonyData;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class Channel {
|
||||
private static final Identifier CLIENT_PONY_DATA = new Identifier("minelittlepony", "pony_data");
|
||||
private static final Identifier REQUEST_PONY_DATA = new Identifier("minelittlepony", "request_pony_data");
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger("MineLittlePony");
|
||||
|
||||
private static boolean registered;
|
||||
|
||||
public static void bootstrap() {
|
||||
ClientLoginConnectionEvents.INIT.register((handler, client) -> {
|
||||
registered = false;
|
||||
MineLittlePony.logger.info("Resetting registered flag");
|
||||
LOGGER.info("Resetting registered flag");
|
||||
});
|
||||
ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> {
|
||||
MineLittlePony.logger.info("Sending consent packet to " + handler.getPlayer().getName().getString());
|
||||
LOGGER.info("Sending consent packet to " + handler.getPlayer().getName().getString());
|
||||
|
||||
sender.sendPacket(REQUEST_PONY_DATA, PacketByteBufs.empty());
|
||||
});
|
||||
|
@ -38,7 +41,7 @@ public class Channel {
|
|||
if (client.player != null) {
|
||||
Pony pony = Pony.getManager().getPony(client.player);
|
||||
registered = true;
|
||||
MineLittlePony.logger.info("Server has just consented");
|
||||
LOGGER.info("Server has just consented");
|
||||
|
||||
sender.sendPacket(CLIENT_PONY_DATA, MsgPonyData.write(pony.metadata(), PacketByteBufs.create()));
|
||||
}
|
||||
|
@ -58,9 +61,9 @@ public class Channel {
|
|||
|
||||
if (!registered) {
|
||||
if (MinecraftClient.getInstance().isInSingleplayer() || MinecraftClient.getInstance().isIntegratedServerRunning()) {
|
||||
MineLittlePony.logger.info("Sending pony skin data over as we are either in single-player or lan");
|
||||
LOGGER.info("Sending pony skin data over as we are either in single-player or lan");
|
||||
} else {
|
||||
MineLittlePony.logger.info("Skipping network packet as the server has not consented");
|
||||
LOGGER.info("Skipping network packet as the server has not consented");
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.api.pony.network;
|
||||
package com.minelittlepony.api.events;
|
||||
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.api.pony.network.fabric;
|
||||
package com.minelittlepony.api.events;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.fabric.api.event.Event;
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.api.model.fabric;
|
||||
package com.minelittlepony.api.events;
|
||||
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.EventFactory;
|
|
@ -1,10 +0,0 @@
|
|||
package com.minelittlepony.api.model;
|
||||
|
||||
import com.minelittlepony.api.pony.PonyData;
|
||||
|
||||
public interface IModelWrapper {
|
||||
/**
|
||||
* Updates metadata values to this wrapper's contained models.
|
||||
*/
|
||||
IModelWrapper applyMetadata(PonyData meta);
|
||||
}
|
|
@ -4,12 +4,8 @@ import net.minecraft.client.model.ModelPart;
|
|||
import net.minecraft.util.Arm;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.model.ClientPonyModel;
|
||||
import com.minelittlepony.mson.util.PartUtil;
|
||||
|
||||
/**
|
||||
* Common interface for all undead enemies.
|
||||
*/
|
||||
public final class MobPosingHelper {
|
||||
/**
|
||||
* Rotates the provided arm to the correct orientation for holding an item.
|
||||
|
@ -34,9 +30,9 @@ public final class MobPosingHelper {
|
|||
arm.roll = cos;
|
||||
}
|
||||
|
||||
public static void rotateUndeadArms(ClientPonyModel<?> model, float move, float ticks) {
|
||||
ModelPart leftArm = model.getArm(Arm.LEFT);
|
||||
ModelPart rightArm = model.getArm(Arm.RIGHT);
|
||||
public static void rotateUndeadArms(PonyModel<?> model, float move, float ticks) {
|
||||
ModelPart leftArm = model.getForeLeg(Arm.LEFT);
|
||||
ModelPart rightArm = model.getForeLeg(Arm.RIGHT);
|
||||
|
||||
if (islookAngleRight(move)) {
|
||||
rotateArmHolding(rightArm, 1, model.getSwingAmount(), ticks);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.minelittlepony.api.model;
|
||||
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.pony.*;
|
||||
import com.minelittlepony.client.*;
|
||||
import com.minelittlepony.common.util.animation.Interpolator;
|
||||
|
@ -156,7 +157,7 @@ public class ModelAttributes {
|
|||
interpolatorId = entity.getUuid();
|
||||
}
|
||||
isLeftHanded = entity.getMainArm() == Arm.LEFT;
|
||||
isHorsey = MineLittlePony.getInstance().getConfig().horsieMode.get();
|
||||
isHorsey = PonyConfig.getInstance().horsieMode.get();
|
||||
featureSkins = SkinsProxy.instance.getAvailableSkins(entity);
|
||||
mainArm = entity.getMainArm();
|
||||
activeHand = entity.getActiveHand();
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package com.minelittlepony.api.model;
|
||||
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.client.render.entity.model.ModelWithArms;
|
||||
import net.minecraft.client.render.entity.model.BipedEntityModel.ArmPose;
|
||||
import net.minecraft.util.Arm;
|
||||
|
||||
public interface ModelWithHooves extends ModelWithArms {
|
||||
ModelPart getForeLeg(Arm side);
|
||||
|
||||
ModelPart getHindLeg(Arm side);
|
||||
|
||||
ArmPose getArmPoseForSide(Arm side);
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.client.model;
|
||||
package com.minelittlepony.api.model;
|
||||
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ArmorItem;
|
||||
|
@ -6,12 +6,11 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.minelittlepony.api.model.PonyModel;
|
||||
import com.minelittlepony.api.model.IModelWrapper;
|
||||
import com.minelittlepony.api.model.armour.*;
|
||||
import com.minelittlepony.api.pony.PonyData;
|
||||
import com.minelittlepony.client.model.armour.PonyArmourModel;
|
||||
import com.minelittlepony.mson.api.*;
|
||||
import com.minelittlepony.client.model.PlayerModelKey;
|
||||
import com.minelittlepony.client.model.armour.*;
|
||||
import com.minelittlepony.mson.api.ModelKey;
|
||||
import com.minelittlepony.mson.api.MsonModel;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
|
@ -19,7 +18,7 @@ import java.util.function.Consumer;
|
|||
/**
|
||||
* Container class for the various models and their associated piece of armour.
|
||||
*/
|
||||
public class ModelWrapper<T extends LivingEntity, M extends PonyModel<?>> implements IModelWrapper {
|
||||
public class ModelWrapper<T extends LivingEntity, M extends PonyModel<?>> {
|
||||
@Nullable
|
||||
private final MsonModel.Factory<PonyArmourModel<T>> armorFactory;
|
||||
private final Map<ModelKey<PonyArmourModel<?>>, PonyArmourModel<T>> armor = new HashMap<>();
|
||||
|
@ -50,7 +49,6 @@ public class ModelWrapper<T extends LivingEntity, M extends PonyModel<?>> implem
|
|||
}));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelWrapper<T, M> applyMetadata(PonyData meta) {
|
||||
body.setMetadata(meta);
|
||||
armor.values().forEach(a -> a.setMetadata(meta));
|
|
@ -12,7 +12,7 @@ import com.minelittlepony.api.pony.PonyData;
|
|||
import com.minelittlepony.api.pony.meta.*;
|
||||
import com.minelittlepony.mson.api.MsonModel;
|
||||
|
||||
public interface PonyModel<T extends LivingEntity> extends MsonModel, ModelWithArms, ModelWithHat, ModelWithHead {
|
||||
public interface PonyModel<T extends LivingEntity> extends MsonModel, ModelWithHooves, ModelWithHat, ModelWithHead {
|
||||
|
||||
void copyAttributes(BipedEntityModel<T> other);
|
||||
|
||||
|
|
|
@ -1,21 +1,20 @@
|
|||
package com.minelittlepony.client.model;
|
||||
package com.minelittlepony.api.model;
|
||||
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.client.render.entity.model.BipedEntityModel;
|
||||
import net.minecraft.client.render.entity.model.ModelWithArms;
|
||||
import net.minecraft.client.render.entity.model.BipedEntityModel.ArmPose;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.Arm;
|
||||
|
||||
import com.minelittlepony.api.model.*;
|
||||
import com.minelittlepony.api.pony.Pony;
|
||||
import com.minelittlepony.api.pony.PonyData;
|
||||
import com.minelittlepony.api.pony.meta.Size;
|
||||
import com.minelittlepony.mson.api.ModelView;
|
||||
import com.minelittlepony.mson.api.model.BoxBuilder.RenderLayerSetter;
|
||||
|
||||
public interface IPonyMixinModel<T extends LivingEntity, M extends PonyModel<T>> extends PonyModel<T> {
|
||||
|
||||
public interface PonyModelMixin<T extends LivingEntity, M extends PonyModel<T>> extends PonyModel<T> {
|
||||
M mixin();
|
||||
|
||||
@Override
|
||||
|
@ -71,6 +70,22 @@ public interface IPonyMixinModel<T extends LivingEntity, M extends PonyModel<T>>
|
|||
return mixin().getRiderYOffset();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
default ModelPart getForeLeg(Arm side) {
|
||||
return mixin().getForeLeg(side);
|
||||
}
|
||||
|
||||
@Override
|
||||
default ModelPart getHindLeg(Arm side) {
|
||||
return mixin().getHindLeg(side);
|
||||
}
|
||||
|
||||
@Override
|
||||
default ArmPose getArmPoseForSide(Arm side) {
|
||||
return mixin().getArmPoseForSide(side);
|
||||
}
|
||||
|
||||
@Override
|
||||
default void setArmAngle(Arm arm, MatrixStack stack) {
|
||||
if (mixin() instanceof ModelWithArms) {
|
||||
|
@ -93,7 +108,7 @@ public interface IPonyMixinModel<T extends LivingEntity, M extends PonyModel<T>>
|
|||
mixin().setHatVisible(hatVisible);
|
||||
}
|
||||
|
||||
interface Caster<T extends LivingEntity, M extends PonyModel<T> & HornedPonyModel<T>, ArmModel> extends IPonyMixinModel<T, M>, HornedPonyModel<T> {
|
||||
interface Caster<T extends LivingEntity, M extends PonyModel<T> & HornedPonyModel<T>, ArmModel> extends PonyModelMixin<T, M>, HornedPonyModel<T> {
|
||||
@Override
|
||||
default boolean isCasting() {
|
||||
return mixin().isCasting();
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.client;
|
||||
package com.minelittlepony.api.model;
|
||||
|
||||
public interface PreviewModel {
|
||||
boolean forceSeapony();
|
|
@ -3,7 +3,7 @@ package com.minelittlepony.api.model;
|
|||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
public interface IPart {
|
||||
public interface SubModel {
|
||||
/**
|
||||
* Sets the model's various rotation angles.
|
||||
*/
|
|
@ -2,8 +2,8 @@ package com.minelittlepony.api.model;
|
|||
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.util.MathUtil;
|
||||
|
||||
public interface WingedPonyModel<T extends LivingEntity> extends PonyModel<T> {
|
||||
|
@ -16,7 +16,7 @@ public interface WingedPonyModel<T extends LivingEntity> extends PonyModel<T> {
|
|||
*/
|
||||
default boolean wingsAreOpen() {
|
||||
return (getAttributes().isSwimming || getAttributes().isFlying || getAttributes().isCrouching)
|
||||
&& (MineLittlePony.getInstance().getConfig().flappyElytras.get() || !getAttributes().isGliding);
|
||||
&& (PonyConfig.getInstance().flappyElytras.get() || !getAttributes().isGliding);
|
||||
}
|
||||
|
||||
default boolean isBurdened() {
|
||||
|
@ -28,7 +28,7 @@ public interface WingedPonyModel<T extends LivingEntity> extends PonyModel<T> {
|
|||
/**
|
||||
* Gets the wings of this pegasus/flying creature
|
||||
*/
|
||||
IPart getWings();
|
||||
SubModel getWings();
|
||||
|
||||
/**
|
||||
* Determines angle used to animate wing flaps whilst flying/swimming.
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
package com.minelittlepony.api.model.armour;
|
||||
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import com.minelittlepony.api.model.PonyModel;
|
||||
|
||||
public interface IArmourModel<T extends LivingEntity> {
|
||||
/**
|
||||
* Called to synchronise this armour's angles with that of another.
|
||||
*
|
||||
* @param model The other model to mimic
|
||||
*/
|
||||
boolean poseModel(T entity, float limbAngle, float limbDistance, float age, float headYaw, float headPitch,
|
||||
EquipmentSlot slot, ArmourLayer layer,
|
||||
PonyModel<T> mainModel);
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
package com.minelittlepony.api.model.armour;
|
||||
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.minelittlepony.client.model.armour.DefaultArmourTextureResolver;
|
||||
|
||||
/**
|
||||
* A resolver for looking up the texture for a piece of armour.
|
||||
* <p>
|
||||
* This is for modders who want to override the default implementation found in {@link DefaultArmourTextureResolver}.
|
||||
*/
|
||||
public interface IArmourTextureResolver {
|
||||
/**
|
||||
* Gets the armour texture to be used for the given entity, armour piece, slot, and render layer.
|
||||
*/
|
||||
Identifier getTexture(LivingEntity entity, ItemStack itemstack, EquipmentSlot slot, ArmourLayer layer, @Nullable String type);
|
||||
|
||||
/**
|
||||
* Gets the armour variant for the identified texture.
|
||||
* Either normal for pony-style textures, or legacy for other textures.
|
||||
*/
|
||||
default ArmourVariant getVariant(ArmourLayer layer, Identifier resolvedTexture) {
|
||||
return ArmourVariant.NORMAL;
|
||||
}
|
||||
}
|
|
@ -9,22 +9,23 @@ import net.minecraft.util.Identifier;
|
|||
|
||||
import com.minelittlepony.api.model.*;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
import com.minelittlepony.client.render.entity.feature.GearFeature;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* Interface for an accessory on a pony's body.
|
||||
*/
|
||||
public interface Gear {
|
||||
List<Supplier<Gear>> MOD_GEARS = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Registers a custom gear to be used with the mod.
|
||||
* <p>
|
||||
* This would be awesome for creating socks.
|
||||
*/
|
||||
static Supplier<Gear> register(Supplier<Gear> gear) {
|
||||
GearFeature.addModGear(gear);
|
||||
MOD_GEARS.add(gear);
|
||||
return gear;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.api.pony;
|
||||
|
||||
import com.minelittlepony.api.pony.meta.Race;
|
||||
import com.minelittlepony.client.PreviewModel;
|
||||
import com.minelittlepony.api.model.PreviewModel;
|
||||
import com.minelittlepony.client.SkinsProxy;
|
||||
import com.minelittlepony.client.render.entity.AquaticPlayerPonyRenderer;
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@ public enum Sizes implements Size {
|
|||
FOAL (0xffbe53, 0.25f, 0.6F, 0.5F),
|
||||
UNSET (0x000000, 1, 1, 1);
|
||||
|
||||
public static final Sizes[] REGISTRY = values();
|
||||
|
||||
private int triggerValue;
|
||||
|
||||
private float shadowSize;
|
||||
|
@ -33,6 +31,11 @@ public enum Sizes implements Size {
|
|||
camera = cameraF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int colorCode() {
|
||||
return triggerValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float shadowSize() {
|
||||
return shadowSize * PonyConfig.getInstance().getGlobalScaleFactor();
|
||||
|
@ -53,25 +56,7 @@ public enum Sizes implements Size {
|
|||
|
||||
@Override
|
||||
public float eyeDistanceFactor() {
|
||||
if (!PonyConfig.getInstance().fillycam.get()) {
|
||||
return 1;
|
||||
}
|
||||
return camera * PonyConfig.getInstance().getGlobalScaleFactor();
|
||||
return eyeHeightFactor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int colorCode() {
|
||||
return triggerValue;
|
||||
}
|
||||
|
||||
public static Sizes of(Size size) {
|
||||
if (size instanceof Sizes) {
|
||||
return (Sizes)size;
|
||||
}
|
||||
int i = size.ordinal();
|
||||
if (i < 0 || i >= REGISTRY.length) {
|
||||
return UNSET;
|
||||
}
|
||||
return REGISTRY[i];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.minelittlepony.api.pony.meta;
|
|||
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.client.model.gear.SaddleBags;
|
||||
import com.minelittlepony.common.util.Color;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -15,9 +14,9 @@ public enum Wearable implements TriggerPixelType<Wearable> {
|
|||
MUFFIN (0x32, new Identifier("minelittlepony", "textures/models/muffin.png")),
|
||||
HAT (0x64, new Identifier("textures/entity/witch.png")),
|
||||
ANTLERS (0x96, new Identifier("minelittlepony", "textures/models/antlers.png")),
|
||||
SADDLE_BAGS_LEFT (0xC6, SaddleBags.TEXTURE),
|
||||
SADDLE_BAGS_RIGHT (0xC7, SaddleBags.TEXTURE),
|
||||
SADDLE_BAGS_BOTH (0xC8, SaddleBags.TEXTURE),
|
||||
SADDLE_BAGS_LEFT (0xC6, new Identifier("minelittlepony", "textures/models/saddlebags.png")),
|
||||
SADDLE_BAGS_RIGHT (0xC7, new Identifier("minelittlepony", "textures/models/saddlebags.png")),
|
||||
SADDLE_BAGS_BOTH (0xC8, new Identifier("minelittlepony", "textures/models/saddlebags.png")),
|
||||
STETSON (0xFA, new Identifier("minelittlepony", "textures/models/stetson.png"));
|
||||
|
||||
private int triggerValue;
|
||||
|
|
|
@ -4,15 +4,14 @@ import net.minecraft.client.MinecraftClient;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.client.model.armour.DefaultArmourTextureResolver;
|
||||
import com.minelittlepony.client.model.armour.ArmourTextureResolver;
|
||||
import com.minelittlepony.client.render.MobRenderers;
|
||||
import com.minelittlepony.common.client.gui.VisibilityMode;
|
||||
import com.minelittlepony.common.util.settings.Setting;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class ClientPonyConfig extends PonyConfig {
|
||||
|
||||
class ClientPonyConfig extends PonyConfig {
|
||||
/**
|
||||
* Visibility mode for the horse button.
|
||||
*/
|
||||
|
@ -25,7 +24,7 @@ public class ClientPonyConfig extends PonyConfig {
|
|||
public ClientPonyConfig(Path path) {
|
||||
super(path);
|
||||
MobRenderers.REGISTRY.values().forEach(r -> value("entities", r.name, true));
|
||||
disablePonifiedArmour.onChanged(t -> DefaultArmourTextureResolver.INSTANCE.invalidate());
|
||||
disablePonifiedArmour.onChanged(t -> ArmourTextureResolver.INSTANCE.invalidate());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.util.hit.HitResult;
|
||||
import net.minecraft.util.math.*;
|
||||
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.pony.Pony;
|
||||
import com.minelittlepony.common.util.settings.Setting;
|
||||
|
||||
|
@ -31,7 +32,7 @@ public class HorseCam {
|
|||
*/
|
||||
public static float transformCameraAngle(float pitch) {
|
||||
|
||||
if (!MineLittlePony.getInstance().getConfig().fillycam.get()) {
|
||||
if (!PonyConfig.getInstance().fillycam.get()) {
|
||||
return pitch;
|
||||
}
|
||||
|
||||
|
@ -51,7 +52,7 @@ public class HorseCam {
|
|||
Pony pony = Pony.getManager().getPony(player);
|
||||
|
||||
if (!pony.race().isHuman()) {
|
||||
Setting<Boolean> fillyCam = MineLittlePony.getInstance().getConfig().fillycam;
|
||||
Setting<Boolean> fillyCam = PonyConfig.getInstance().fillycam;
|
||||
|
||||
fillyCam.set(false);
|
||||
final float vanillaHeight = player.getEyeHeight(player.getPose());
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
package com.minelittlepony.client;
|
||||
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.events.Channel;
|
||||
import com.minelittlepony.api.pony.PonyManager;
|
||||
import com.minelittlepony.api.pony.network.fabric.Channel;
|
||||
import com.minelittlepony.client.model.ModelType;
|
||||
import com.minelittlepony.client.render.PonyRenderDispatcher;
|
||||
import com.minelittlepony.common.client.gui.VisibilityMode;
|
||||
|
@ -130,13 +129,6 @@ public class MineLittlePony implements ClientModInitializer {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the global MineLP client configuration.
|
||||
*/
|
||||
public PonyConfig getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public PonyManager getManager() {
|
||||
return ponyManager;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.client.gui.DrawContext;
|
|||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.text.*;
|
||||
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.client.render.MobRenderers;
|
||||
import com.minelittlepony.common.client.gui.GameGui;
|
||||
import com.minelittlepony.common.client.gui.ScrollContainer;
|
||||
|
@ -43,7 +44,7 @@ public class PonySettingsscreen extends GameGui {
|
|||
public PonySettingsscreen(@Nullable Screen parent) {
|
||||
super(Text.literal(OPTIONS_PREFIX + "title"), parent);
|
||||
|
||||
config = (ClientPonyConfig)MineLittlePony.getInstance().getConfig();
|
||||
config = (ClientPonyConfig)PonyConfig.getInstance();
|
||||
|
||||
content.margin.top = 30;
|
||||
content.margin.bottom = 30;
|
||||
|
|
|
@ -43,17 +43,3 @@ public class SkinsProxy {
|
|||
return Set.of();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ package com.minelittlepony.client.compat.hdskins;
|
|||
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
|
||||
import com.minelittlepony.api.model.PreviewModel;
|
||||
import com.minelittlepony.api.pony.*;
|
||||
import com.minelittlepony.client.PreviewModel;
|
||||
import com.minelittlepony.client.render.EquineRenderManager;
|
||||
import com.minelittlepony.hdskins.client.gui.player.*;
|
||||
import com.minelittlepony.hdskins.client.gui.player.skins.PlayerSkins;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.minelittlepony.client.mixin;
|
||||
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.config.PonyLevel;
|
||||
import com.minelittlepony.api.pony.DefaultPonySkinHelper;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
|
||||
import net.minecraft.client.util.DefaultSkinHelper;
|
||||
import net.minecraft.client.util.SkinTextures;
|
||||
|
@ -21,7 +21,7 @@ abstract class MixinDefaultSkinHelper {
|
|||
at = @At("RETURN"),
|
||||
cancellable = true)
|
||||
private static void onGetTexture(CallbackInfoReturnable<Identifier> cir) {
|
||||
if (MineLittlePony.getInstance().getConfig().ponyLevel.get() == PonyLevel.PONIES) {
|
||||
if (PonyConfig.getInstance().ponyLevel.get() == PonyLevel.PONIES) {
|
||||
cir.setReturnValue(DefaultPonySkinHelper.STEVE);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ abstract class MixinDefaultSkinHelper {
|
|||
at = @At("RETURN"),
|
||||
cancellable = true)
|
||||
private static void onGetTexture(UUID uuid, CallbackInfoReturnable<SkinTextures> cir) {
|
||||
if (MineLittlePony.getInstance().getConfig().ponyLevel.get() == PonyLevel.PONIES) {
|
||||
if (PonyConfig.getInstance().ponyLevel.get() == PonyLevel.PONIES) {
|
||||
cir.setReturnValue(DefaultPonySkinHelper.getTextures(cir.getReturnValue()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.model;
|
||||
|
||||
import com.minelittlepony.api.model.*;
|
||||
import com.minelittlepony.api.model.fabric.PonyModelPrepareCallback;
|
||||
import com.minelittlepony.api.events.PonyModelPrepareCallback;
|
||||
import com.minelittlepony.api.pony.meta.Sizes;
|
||||
import com.minelittlepony.client.transform.PonyTransformation;
|
||||
import com.minelittlepony.client.util.render.RenderList;
|
||||
|
@ -50,7 +50,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
|
||||
protected final RenderList mainRenderList;
|
||||
|
||||
private final List<IPart> parts = new ArrayList<>();
|
||||
private final List<SubModel> parts = new ArrayList<>();
|
||||
|
||||
public AbstractPonyModel(ModelPart tree) {
|
||||
super(tree);
|
||||
|
@ -66,18 +66,18 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
.add(withStage(BodyPart.HEAD, helmetRenderList = RenderList.of(hat)));
|
||||
}
|
||||
|
||||
protected <P extends IPart> P addPart(P part) {
|
||||
protected <P extends SubModel> P addPart(P part) {
|
||||
parts.add(part);
|
||||
return part;
|
||||
}
|
||||
|
||||
protected RenderList forPart(Supplier<IPart> part) {
|
||||
protected RenderList forPart(Supplier<SubModel> part) {
|
||||
return (stack, vertices, overlayUv, lightUv, red, green, blue, alpha) -> {
|
||||
part.get().renderPart(stack, vertices, overlayUv, lightUv, red, green, blue, alpha, attributes);
|
||||
};
|
||||
}
|
||||
|
||||
protected RenderList forPart(IPart part) {
|
||||
protected RenderList forPart(SubModel part) {
|
||||
return (stack, vertices, overlayUv, lightUv, red, green, blue, alpha) -> {
|
||||
part.renderPart(stack, vertices, overlayUv, lightUv, red, green, blue, alpha, attributes);
|
||||
};
|
||||
|
|
|
@ -8,8 +8,8 @@ import net.minecraft.util.Hand;
|
|||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.minelittlepony.api.events.PonyModelPrepareCallback;
|
||||
import com.minelittlepony.api.model.*;
|
||||
import com.minelittlepony.api.model.fabric.PonyModelPrepareCallback;
|
||||
import com.minelittlepony.api.pony.Pony;
|
||||
import com.minelittlepony.api.pony.PonyData;
|
||||
import com.minelittlepony.api.pony.meta.Size;
|
||||
|
@ -93,10 +93,16 @@ public abstract class ClientPonyModel<T extends LivingEntity> extends MsonPlayer
|
|||
}
|
||||
|
||||
@Override
|
||||
public ModelPart getArm(Arm side) {
|
||||
return super.getArm(side);
|
||||
public ModelPart getForeLeg(Arm side) {
|
||||
return getArm(side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelPart getHindLeg(Arm side) {
|
||||
return side == Arm.LEFT ? leftLeg : rightLeg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArmPose getArmPoseForSide(Arm side) {
|
||||
return side == Arm.RIGHT ? rightArmPose : leftArmPose;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import net.minecraft.util.Identifier;
|
|||
import net.minecraft.util.Util;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.mson.api.*;
|
||||
import com.minelittlepony.mson.api.MsonModel.Factory;
|
||||
import com.minelittlepony.mson.api.model.traversal.PartSkeleton;
|
||||
|
@ -79,7 +79,7 @@ final class ModelKeyImpl<M extends Model> implements ModelKey<M>, LocalBlock {
|
|||
}
|
||||
|
||||
private ModelContext getModelContext(FileContent<?> content) {
|
||||
if (MineLittlePony.getInstance().getConfig().horsieMode.get()) {
|
||||
if (PonyConfig.getInstance().horsieMode.get()) {
|
||||
return content.createContext(null, null, content.getLocals().extendWith(getId(), Optional.of(this), Optional.empty()).bake());
|
||||
}
|
||||
return content.createContext(null, null, content.getLocals().bake());
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.util.Identifier;
|
|||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.minelittlepony.api.model.ModelWrapper;
|
||||
import com.minelittlepony.api.model.PonyModel;
|
||||
import com.minelittlepony.client.model.armour.PonyArmourModel;
|
||||
import com.minelittlepony.mson.api.*;
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package com.minelittlepony.api.model.armour;
|
||||
package com.minelittlepony.client.model.armour;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.client.model.armour.PonyArmourModel;
|
||||
import com.minelittlepony.mson.api.ModelKey;
|
||||
import com.minelittlepony.mson.api.Mson;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.api.model.armour;
|
||||
package com.minelittlepony.client.model.armour;
|
||||
|
||||
/**
|
||||
* The layer used to render a given armour piece.
|
|
@ -13,9 +13,6 @@ import com.google.common.base.Strings;
|
|||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.model.armour.ArmourLayer;
|
||||
import com.minelittlepony.api.model.armour.ArmourVariant;
|
||||
import com.minelittlepony.api.model.armour.IArmourTextureResolver;
|
||||
import com.minelittlepony.util.ResourceUtil;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
@ -38,8 +35,8 @@ import java.util.concurrent.TimeUnit;
|
|||
* - the "minecraft" namespace is always replaced with "minelittlepony"
|
||||
* <p>
|
||||
*/
|
||||
public class DefaultArmourTextureResolver implements IArmourTextureResolver {
|
||||
public static final DefaultArmourTextureResolver INSTANCE = new DefaultArmourTextureResolver();
|
||||
public class ArmourTextureResolver {
|
||||
public static final ArmourTextureResolver INSTANCE = new ArmourTextureResolver();
|
||||
|
||||
private final Cache<String, Identifier> cache = CacheBuilder.newBuilder()
|
||||
.expireAfterAccess(30, TimeUnit.SECONDS)
|
||||
|
@ -49,7 +46,6 @@ public class DefaultArmourTextureResolver implements IArmourTextureResolver {
|
|||
cache.invalidateAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getTexture(LivingEntity entity, ItemStack stack, EquipmentSlot slot, ArmourLayer layer, @Nullable String type) {
|
||||
Identifier material = stack.getItem() instanceof ArmorItem armor
|
||||
? new Identifier(armor.getMaterial().getName())
|
||||
|
@ -129,7 +125,6 @@ public class DefaultArmourTextureResolver implements IArmourTextureResolver {
|
|||
return MinecraftClient.getInstance().getResourceManager().getResource(texture).isPresent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArmourVariant getVariant(ArmourLayer layer, Identifier resolvedTexture) {
|
||||
if (resolvedTexture.getPath().endsWith("_pony.png")) {
|
||||
return ArmourVariant.NORMAL;
|
|
@ -1,7 +1,6 @@
|
|||
package com.minelittlepony.api.model.armour;
|
||||
package com.minelittlepony.client.model.armour;
|
||||
|
||||
import com.minelittlepony.client.model.ModelType;
|
||||
import com.minelittlepony.client.model.armour.PonyArmourModel;
|
||||
import com.minelittlepony.mson.api.ModelKey;
|
||||
|
||||
import java.util.Optional;
|
|
@ -6,16 +6,14 @@ import net.minecraft.entity.EquipmentSlot;
|
|||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import com.minelittlepony.api.model.PonyModel;
|
||||
import com.minelittlepony.api.model.armour.*;
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
|
||||
public class PonyArmourModel<T extends LivingEntity> extends AbstractPonyModel<T> implements IArmourModel<T> {
|
||||
public class PonyArmourModel<T extends LivingEntity> extends AbstractPonyModel<T> {
|
||||
|
||||
public PonyArmourModel(ModelPart tree) {
|
||||
super(tree);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean poseModel(T entity, float limbAngle, float limbDistance, float age, float headYaw, float headPitch,
|
||||
EquipmentSlot slot, ArmourLayer layer,
|
||||
PonyModel<T> mainModel) {
|
||||
|
|
|
@ -6,10 +6,11 @@ import net.minecraft.client.render.entity.model.EntityModel;
|
|||
import net.minecraft.client.render.entity.model.GuardianEntityModel;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.mob.GuardianEntity;
|
||||
import com.minelittlepony.client.model.IPonyMixinModel;
|
||||
|
||||
import com.minelittlepony.api.model.PonyModelMixin;
|
||||
import com.minelittlepony.client.model.entity.race.SeaponyModel;
|
||||
|
||||
public class GuardianPonyModel extends GuardianEntityModel implements IPonyMixinModel.Caster<GuardianEntity, SeaponyModel<GuardianEntity>, ModelPart> {
|
||||
public class GuardianPonyModel extends GuardianEntityModel implements PonyModelMixin.Caster<GuardianEntity, SeaponyModel<GuardianEntity>, ModelPart> {
|
||||
private final SeaponyModel<GuardianEntity> mixin;
|
||||
|
||||
public GuardianPonyModel(ModelPart tree) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.model.entity.race;
|
||||
|
||||
import com.minelittlepony.api.model.IPart;
|
||||
import com.minelittlepony.api.model.SubModel;
|
||||
import com.minelittlepony.api.model.WingedPonyModel;
|
||||
import com.minelittlepony.client.model.part.PonyWings;
|
||||
import com.minelittlepony.mson.api.ModelView;
|
||||
|
@ -24,7 +24,7 @@ public class AlicornModel<T extends LivingEntity> extends UnicornModel<T> implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public IPart getWings() {
|
||||
public SubModel getWings() {
|
||||
return wings;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.model.entity.race;
|
||||
|
||||
import com.minelittlepony.api.model.IPart;
|
||||
import com.minelittlepony.api.model.SubModel;
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.model.part.*;
|
||||
import com.minelittlepony.mson.api.ModelView;
|
||||
|
@ -12,7 +12,7 @@ public class EarthPonyModel<T extends LivingEntity> extends AbstractPonyModel<T>
|
|||
|
||||
private final boolean smallArms;
|
||||
|
||||
protected IPart tail;
|
||||
protected SubModel tail;
|
||||
protected PonySnout snout;
|
||||
protected PonyEars ears;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.model.entity.race;
|
||||
|
||||
import com.minelittlepony.api.model.IPart;
|
||||
import com.minelittlepony.api.model.SubModel;
|
||||
import com.minelittlepony.api.model.WingedPonyModel;
|
||||
import com.minelittlepony.client.model.part.PonyWings;
|
||||
import com.minelittlepony.mson.api.ModelView;
|
||||
|
@ -24,7 +24,7 @@ public class PegasusModel<T extends LivingEntity> extends EarthPonyModel<T> impl
|
|||
}
|
||||
|
||||
@Override
|
||||
public IPart getWings() {
|
||||
public SubModel getWings() {
|
||||
return wings;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.minelittlepony.client.model.entity.race;
|
||||
|
||||
import com.minelittlepony.client.model.armour.PonyArmourModel;
|
||||
import com.minelittlepony.mson.api.ModelView;
|
||||
import com.minelittlepony.api.model.*;
|
||||
import com.minelittlepony.api.pony.Pony;
|
||||
import com.minelittlepony.client.model.armour.PonyArmourModel;
|
||||
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.minelittlepony.client.model.entity.race;
|
||||
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.model.*;
|
||||
import com.minelittlepony.api.pony.meta.Size;
|
||||
import com.minelittlepony.api.pony.meta.Sizes;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.client.model.part.UnicornHorn;
|
||||
import com.minelittlepony.client.util.render.RenderList;
|
||||
import com.minelittlepony.mson.api.ModelView;
|
||||
|
@ -57,7 +57,7 @@ public class UnicornModel<T extends LivingEntity> extends EarthPonyModel<T> impl
|
|||
|
||||
@Override
|
||||
public boolean isCasting() {
|
||||
return MineLittlePony.getInstance().getConfig().tpsmagic.get()
|
||||
return PonyConfig.getInstance().tpsmagic.get()
|
||||
&& (rightArmPose != ArmPose.EMPTY || leftArmPose != ArmPose.EMPTY);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class UnicornModel<T extends LivingEntity> extends EarthPonyModel<T> impl
|
|||
|
||||
@Override
|
||||
public ModelPart getArm(Arm side) {
|
||||
if (hasMagic() && getArmPoseForSide(side) != ArmPose.EMPTY && MineLittlePony.getInstance().getConfig().tpsmagic.get()) {
|
||||
if (hasMagic() && getArmPoseForSide(side) != ArmPose.EMPTY && PonyConfig.getInstance().tpsmagic.get()) {
|
||||
return side == Arm.LEFT ? unicornArmLeft : unicornArmRight;
|
||||
}
|
||||
return super.getArm(side);
|
||||
|
@ -80,7 +80,7 @@ public class UnicornModel<T extends LivingEntity> extends EarthPonyModel<T> impl
|
|||
protected void positionheldItem(Arm arm, MatrixStack matrices) {
|
||||
super.positionheldItem(arm, matrices);
|
||||
|
||||
if (!MineLittlePony.getInstance().getConfig().tpsmagic.get() || !hasMagic()) {
|
||||
if (!PonyConfig.getInstance().tpsmagic.get() || !hasMagic()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,13 +13,9 @@ import net.minecraft.client.model.ModelPart;
|
|||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class SaddleBags extends WearableGear {
|
||||
|
||||
public static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/models/saddlebags.png");
|
||||
|
||||
private final ModelPart leftBag;
|
||||
private final ModelPart rightBag;
|
||||
|
||||
|
|
|
@ -5,11 +5,11 @@ import net.minecraft.client.render.VertexConsumer;
|
|||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.api.model.IPart;
|
||||
import com.minelittlepony.api.model.SubModel;
|
||||
import com.minelittlepony.api.model.ModelAttributes;
|
||||
import com.minelittlepony.common.util.animation.Interpolator;
|
||||
|
||||
public class LionTail implements IPart {
|
||||
public class LionTail implements SubModel {
|
||||
|
||||
private ModelPart tail;
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@ import net.minecraft.client.render.VertexConsumer;
|
|||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.api.model.IPart;
|
||||
import com.minelittlepony.api.model.SubModel;
|
||||
import com.minelittlepony.api.model.ModelAttributes;
|
||||
import com.minelittlepony.mson.api.*;
|
||||
import com.minelittlepony.mson.api.model.PartBuilder;
|
||||
|
||||
public class PonyEars implements IPart, MsonModel {
|
||||
public class PonyEars implements SubModel, MsonModel {
|
||||
private final ModelPart right;
|
||||
private final ModelPart left;
|
||||
|
||||
|
|
|
@ -4,14 +4,14 @@ import net.minecraft.client.model.ModelPart;
|
|||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
import com.minelittlepony.api.model.IPart;
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.model.SubModel;
|
||||
import com.minelittlepony.api.model.ModelAttributes;
|
||||
import com.minelittlepony.api.pony.meta.Gender;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.mson.api.*;
|
||||
import com.minelittlepony.mson.api.model.PartBuilder;
|
||||
|
||||
public class PonySnout implements IPart, MsonModel {
|
||||
public class PonySnout implements SubModel, MsonModel {
|
||||
|
||||
private final ModelPart mare;
|
||||
private final ModelPart stallion;
|
||||
|
@ -41,7 +41,7 @@ public class PonySnout implements IPart, MsonModel {
|
|||
public void setVisible(boolean visible, ModelAttributes attributes) {
|
||||
visible &= !attributes.isHorsey
|
||||
&& !attributes.metadata.race().isHuman()
|
||||
&& MineLittlePony.getInstance().getConfig().snuzzles.get();
|
||||
&& PonyConfig.getInstance().snuzzles.get();
|
||||
Gender gender = attributes.metadata.gender();
|
||||
|
||||
mare.visible = (visible && gender.isMare());
|
||||
|
|
|
@ -14,7 +14,7 @@ import com.minelittlepony.util.MathUtil;
|
|||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class PonyTail implements IPart, MsonModel {
|
||||
public class PonyTail implements SubModel, MsonModel {
|
||||
private static final float TAIL_Z = 14;
|
||||
private static final float TAIL_RIDING_Y = 3;
|
||||
private static final float TAIL_RIDING_Z = 13;
|
||||
|
|
|
@ -12,7 +12,7 @@ import com.minelittlepony.mson.api.ModelView;
|
|||
import com.minelittlepony.mson.api.MsonModel;
|
||||
import com.minelittlepony.util.MathUtil;
|
||||
|
||||
public class PonyWings<T extends Model & WingedPonyModel<?>> implements IPart, MsonModel {
|
||||
public class PonyWings<T extends Model & WingedPonyModel<?>> implements SubModel, MsonModel {
|
||||
|
||||
protected T pegasus;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.model.part;
|
||||
|
||||
import com.minelittlepony.api.model.IPart;
|
||||
import com.minelittlepony.api.model.SubModel;
|
||||
import com.minelittlepony.api.model.ModelAttributes;
|
||||
import com.minelittlepony.mson.api.MsonModel;
|
||||
|
||||
|
@ -9,7 +9,7 @@ import net.minecraft.client.render.VertexConsumer;
|
|||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class SeaponyTail implements IPart, MsonModel {
|
||||
public class SeaponyTail implements SubModel, MsonModel {
|
||||
private final ModelPart tailBase;
|
||||
|
||||
private final ModelPart tailTip;
|
||||
|
|
|
@ -7,12 +7,12 @@ import net.minecraft.client.render.VertexConsumer;
|
|||
import net.minecraft.client.render.VertexConsumerProvider.Immediate;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
import com.minelittlepony.api.model.IPart;
|
||||
import com.minelittlepony.api.model.SubModel;
|
||||
import com.minelittlepony.api.model.ModelAttributes;
|
||||
import com.minelittlepony.client.render.MagicGlow;
|
||||
import com.minelittlepony.common.util.Color;
|
||||
|
||||
public class UnicornHorn implements IPart {
|
||||
public class UnicornHorn implements SubModel {
|
||||
|
||||
private final ModelPart horn;
|
||||
private final ModelPart glow;
|
||||
|
|
|
@ -17,7 +17,6 @@ import com.minelittlepony.api.pony.Pony;
|
|||
import com.minelittlepony.client.PonyBounds;
|
||||
|
||||
public final class DebugBoundingBoxRenderer {
|
||||
|
||||
public static <T extends LivingEntity> void render(Pony pony, EntityRenderer<T> renderer, T entity, MatrixStack stack, VertexConsumerProvider renderContext, float tickDelta) {
|
||||
|
||||
if (RenderPass.getCurrent() != RenderPass.WORLD) {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package com.minelittlepony.client.render;
|
||||
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.events.Channel;
|
||||
import com.minelittlepony.api.events.PonyDataCallback;
|
||||
import com.minelittlepony.api.model.*;
|
||||
import com.minelittlepony.api.pony.Pony;
|
||||
import com.minelittlepony.api.pony.network.fabric.Channel;
|
||||
import com.minelittlepony.api.pony.network.fabric.PonyDataCallback;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.client.transform.PonyPosture;
|
||||
import com.minelittlepony.mson.api.ModelKey;
|
||||
import com.minelittlepony.util.MathUtil;
|
||||
|
@ -65,7 +65,7 @@ public class EquineRenderManager<T extends LivingEntity, M extends EntityModel<T
|
|||
return FrustrumCheck.ALWAYS_VISIBLE;
|
||||
}
|
||||
|
||||
if (entity.isSleeping() || !MineLittlePony.getInstance().getConfig().frustrum.get()) {
|
||||
if (entity.isSleeping() || !PonyConfig.getInstance().frustrum.get()) {
|
||||
return vanilla;
|
||||
}
|
||||
return frustrum.withCamera(entity, vanilla);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.render;
|
||||
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.pony.Pony;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.client.util.render.RenderLayerUtil;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
@ -43,7 +43,7 @@ public class LevitatingItemRenderer {
|
|||
|
||||
matrix.push();
|
||||
|
||||
boolean doMagic = MineLittlePony.getInstance().getConfig().fpsmagic.get() && pony.hasMagic();
|
||||
boolean doMagic = PonyConfig.getInstance().fpsmagic.get() && pony.hasMagic();
|
||||
|
||||
if (doMagic && mode.isFirstPerson()) {
|
||||
setupPerspective(itemRenderer, entity, stack, left, matrix);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.minelittlepony.client.render;
|
||||
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.client.render.entity.*;
|
||||
import com.minelittlepony.client.render.entity.npc.*;
|
||||
|
@ -40,7 +41,7 @@ public final class MobRenderers {
|
|||
pony.switchRenderer(state, EntityType.PIGLIN, PonyPiglinRenderer::piglin);
|
||||
pony.switchRenderer(state, EntityType.PIGLIN_BRUTE, PonyPiglinRenderer::brute);
|
||||
pony.switchRenderer(state, EntityType.ZOMBIFIED_PIGLIN, PonyPiglinRenderer::zombified);
|
||||
if (!MineLittlePony.getInstance().getConfig().noFun.get()) {
|
||||
if (!PonyConfig.getInstance().noFun.get()) {
|
||||
pony.switchRenderer(state, EntityType.PIG, PonyPigRenderer::new);
|
||||
}
|
||||
});
|
||||
|
@ -78,7 +79,7 @@ public final class MobRenderers {
|
|||
}
|
||||
|
||||
public Setting<Boolean> option() {
|
||||
return MineLittlePony.getInstance().getConfig().getCategory("entities").<Boolean>get(name);
|
||||
return PonyConfig.getInstance().getCategory("entities").<Boolean>get(name);
|
||||
}
|
||||
|
||||
public boolean set(boolean value) {
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.minelittlepony.client.render.blockentity.skull;
|
|||
import com.google.common.collect.Maps;
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.pony.Pony;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.client.model.ModelType;
|
||||
import com.minelittlepony.client.render.MobRenderers;
|
||||
import com.minelittlepony.client.render.entity.SkeleponyRenderer;
|
||||
|
@ -50,7 +49,7 @@ public class PonySkullRenderer {
|
|||
|
||||
ISkull skull = SKULLS.get(skullType);
|
||||
|
||||
if (skull == null || !skull.canRender(MineLittlePony.getInstance().getConfig())) {
|
||||
if (skull == null || !skull.canRender(PonyConfig.getInstance())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -64,7 +63,7 @@ public class PonySkullRenderer {
|
|||
MatrixStack stack, VertexConsumerProvider renderContext, RenderLayer layer,
|
||||
int lightUv) {
|
||||
|
||||
if (selectedSkull == null || !selectedSkull.canRender(MineLittlePony.getInstance().getConfig())) {
|
||||
if (selectedSkull == null || !selectedSkull.canRender(PonyConfig.getInstance())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.minelittlepony.client.render.entity;
|
||||
|
||||
import com.minelittlepony.api.model.PreviewModel;
|
||||
import com.minelittlepony.api.pony.Pony;
|
||||
import com.minelittlepony.api.pony.PonyPosture;
|
||||
import com.minelittlepony.api.pony.meta.Race;
|
||||
import com.minelittlepony.client.PreviewModel;
|
||||
import com.minelittlepony.client.SkinsProxy;
|
||||
import com.minelittlepony.util.MathUtil;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.minelittlepony.client.render.entity;
|
||||
|
||||
import com.minelittlepony.api.model.ModelAttributes;
|
||||
import com.minelittlepony.api.model.ModelWrapper;
|
||||
import com.minelittlepony.api.pony.Pony;
|
||||
import com.minelittlepony.api.pony.meta.Race;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
|
|
|
@ -11,11 +11,11 @@ import net.minecraft.entity.EquipmentSlot;
|
|||
import net.minecraft.entity.decoration.ArmorStandEntity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import com.minelittlepony.api.model.armour.ArmourLayer;
|
||||
import com.minelittlepony.api.model.ModelWrapper;
|
||||
import com.minelittlepony.api.pony.PonyData;
|
||||
import com.minelittlepony.api.pony.meta.Race;
|
||||
import com.minelittlepony.client.model.ModelType;
|
||||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.client.model.armour.ArmourLayer;
|
||||
import com.minelittlepony.client.model.entity.PonyArmourStandModel;
|
||||
import com.minelittlepony.client.model.entity.race.EarthPonyModel;
|
||||
import com.minelittlepony.client.render.entity.feature.ArmourFeature;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.render.entity.feature;
|
||||
|
||||
import com.minelittlepony.api.model.ModelWrapper;
|
||||
import com.minelittlepony.api.model.PonyModel;
|
||||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package com.minelittlepony.client.render.entity.feature;
|
||||
|
||||
import com.minelittlepony.api.model.ModelWrapper;
|
||||
import com.minelittlepony.api.model.PonyModel;
|
||||
import com.minelittlepony.api.model.armour.*;
|
||||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.client.model.armour.DefaultArmourTextureResolver;
|
||||
import com.minelittlepony.client.model.armour.*;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.common.util.Color;
|
||||
|
||||
|
@ -39,7 +38,7 @@ public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & Po
|
|||
}
|
||||
}
|
||||
|
||||
public static <T extends LivingEntity, V extends BipedEntityModel<T> & IArmourModel<T>> void renderArmor(
|
||||
public static <T extends LivingEntity, V extends PonyArmourModel<T>> void renderArmor(
|
||||
ModelWrapper<T, ? extends PonyModel<T>> pony, MatrixStack matrices,
|
||||
VertexConsumerProvider renderContext, int light, T entity,
|
||||
float limbDistance, float limbAngle,
|
||||
|
@ -52,9 +51,8 @@ public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & Po
|
|||
return;
|
||||
}
|
||||
|
||||
IArmourTextureResolver resolver = DefaultArmourTextureResolver.INSTANCE;
|
||||
Identifier texture = resolver.getTexture(entity, stack, armorSlot, layer, null);
|
||||
ArmourVariant variant = resolver.getVariant(layer, texture);
|
||||
Identifier texture = ArmourTextureResolver.INSTANCE.getTexture(entity, stack, armorSlot, layer, null);
|
||||
ArmourVariant variant = ArmourTextureResolver.INSTANCE.getVariant(layer, texture);
|
||||
|
||||
boolean glint = stack.hasGlint();
|
||||
Item item = stack.getItem();
|
||||
|
@ -76,8 +74,8 @@ public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & Po
|
|||
model.render(matrices, getArmorConsumer(renderContext, texture, glint), light, OverlayTexture.DEFAULT_UV, red, green, blue, 1);
|
||||
|
||||
if (item instanceof DyeableArmorItem) {
|
||||
Identifier tex = resolver.getTexture(entity, stack, armorSlot, layer, "overlay");
|
||||
pony.getArmourModel(stack, layer, resolver.getVariant(layer, tex))
|
||||
Identifier tex = ArmourTextureResolver.INSTANCE.getTexture(entity, stack, armorSlot, layer, "overlay");
|
||||
pony.getArmourModel(stack, layer, ArmourTextureResolver.INSTANCE.getVariant(layer, tex))
|
||||
.filter(m -> m.poseModel(entity, limbAngle, limbDistance, age, headYaw, headPitch, armorSlot, layer, pony.body()))
|
||||
.ifPresent(m -> {
|
||||
m.render(matrices, getArmorConsumer(renderContext, tex, false), light, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
||||
|
|
|
@ -19,20 +19,13 @@ import com.minelittlepony.client.render.IPonyRenderContext;
|
|||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class GearFeature<T extends LivingEntity, M extends EntityModel<T> & PonyModel<T>> extends AbstractPonyFeature<T, M> {
|
||||
|
||||
private static final List<Supplier<Gear>> MOD_GEARS = new ArrayList<>();
|
||||
|
||||
public static void addModGear(Supplier<Gear> gear) {
|
||||
MOD_GEARS.add(gear);
|
||||
}
|
||||
|
||||
private final List<Entry> gears = Streams.concat(
|
||||
ModelType.getWearables().map(e -> new Entry(e.getValue().createModel(), e.getKey())),
|
||||
MOD_GEARS.stream().map(e -> new Entry(e.get(), Wearable.NONE))
|
||||
Gear.MOD_GEARS.stream().map(e -> new Entry(e.get(), Wearable.NONE))
|
||||
).collect(Collectors.toList());
|
||||
|
||||
private final LoadingCache<Long, List<Entry>> randomisedGearCache = CacheBuilder.newBuilder()
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.util.Identifier;
|
|||
import net.minecraft.village.VillagerDataContainer;
|
||||
import net.minecraft.village.VillagerProfession;
|
||||
|
||||
import com.minelittlepony.api.model.ModelWrapper;
|
||||
import com.minelittlepony.api.model.gear.Gear;
|
||||
import com.minelittlepony.api.pony.meta.Race;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
|
|
Loading…
Reference in a new issue