Merge pull request #47 from Sollace/master

Pretty much a total rewrite
This commit is contained in:
Matthew Messinger 2018-05-09 13:30:06 -04:00 committed by GitHub
commit 5b3836c2df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
161 changed files with 5694 additions and 4965 deletions

View file

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Tue Jan 02 00:10:52 EST 2018
build.number=495
#Tue Apr 10 14:03:42 CAT 2018
build.number=497

View file

@ -15,6 +15,7 @@ import java.util.UUID;
* required because it has no useful constructor. This uses reflection
* via Gson to create a new instance and populate the fields.
*/
@SuppressWarnings("unused")
public class TexturesPayloadBuilder {
private static Gson gson = new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).create();

View file

@ -14,6 +14,7 @@ import javax.annotation.Nullable;
public class ValhallaSkinServer implements SkinServer {
@SuppressWarnings("unused")
private final String baseURL;
public ValhallaSkinServer(String baseURL) {

View file

@ -2,40 +2,51 @@ package com.minelittlepony;
import com.mumfrey.liteloader.util.ModUtilities;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.ForgeHooksClient;
import javax.annotation.Nullable;
import java.util.Optional;
import java.util.function.Function;
/**
* Proxy class for accessing forge fields and methods.
*/
public class ForgeProxy {
/**
* True if forge is present.
*/
private static boolean forgeLoaded = ModUtilities.fmlIsPresent();
public static String getArmorTexture(Entity entity, ItemStack armor, String def, EntityEquipmentSlot slot, @Nullable String type) {
/**
* Gets the mod armour texture for an associated item and slot.
*
* @param entity The entity to get armour for.
* @param item The armour item
* @param def Default return value if no mods present
* @param slot The slot this armour piece is place in.
* @param type unknown
* @return
*/
public static String getArmorTexture(Entity entity, ItemStack item, String def, EntityEquipmentSlot slot, @Nullable String type) {
if (forgeLoaded)
return ForgeHooksClient.getArmorTexture(entity, armor, def, slot, type);
return ForgeHooksClient.getArmorTexture(entity, item, def, slot, type);
return def;
}
/**
* Gets the mod armour model for an associated item and slot.
*
* @param entity The entity to get armour for.
* @param item The armour item
* @param slot The slot this armour piece is place in.
* @param def Default return value if no mods present
*/
public static ModelBiped getArmorModel(EntityLivingBase entity, ItemStack item, EntityEquipmentSlot slot, ModelBiped def) {
if (forgeLoaded)
return ForgeHooksClient.getArmorModel(entity, item, slot, def);
return def;
}
public static Optional<Function<RenderManager,LayerRenderer<EntityPlayer>>> createShoulderLayer() {
if (forgeLoaded) {
// TODO
}
return Optional.empty();
}
}

View file

@ -1,10 +0,0 @@
package com.minelittlepony;
import net.minecraft.client.resources.data.IMetadataSection;
/**
* Dummy interface so gson won't go crazy
*/
public interface IPonyData extends IMetadataSection {
}

View file

@ -27,19 +27,16 @@ public class LiteModMineLittlePony implements Tickable, InitCompleteListener {
@Override
public void init(File configPath) {
this.mlp = new MineLittlePony();
this.mlp.init();
mlp = new MineLittlePony();
}
@Override
public void onInitCompleted(Minecraft minecraft, LiteLoader loader) {
this.mlp.postInit(minecraft);
mlp.postInit(minecraft);
}
@Override
public void onTick(Minecraft minecraft, float partialTicks, boolean inGame, boolean clock) {
this.mlp.onTick(minecraft, inGame);
mlp.onTick(minecraft, inGame);
}
}

View file

@ -1,90 +1,67 @@
package com.minelittlepony;
import com.google.common.collect.Maps;
import com.minelittlepony.gui.PonySettingPanel;
import com.minelittlepony.hdskins.gui.EntityPonyModel;
import com.minelittlepony.hdskins.gui.GuiSkinsMineLP;
import com.minelittlepony.hdskins.gui.RenderPonyModel;
import com.minelittlepony.renderer.RenderPonyEvoker;
import com.minelittlepony.renderer.RenderPonyIllusionIllager;
import com.minelittlepony.renderer.RenderPonyPigman;
import com.minelittlepony.renderer.RenderPonySkeleton;
import com.minelittlepony.renderer.RenderPonyVex;
import com.minelittlepony.renderer.RenderPonyVillager;
import com.minelittlepony.renderer.RenderPonyVindicator;
import com.minelittlepony.renderer.RenderPonyZombie;
import com.minelittlepony.renderer.RenderPonyZombieVillager;
import com.minelittlepony.pony.data.IPonyData;
import com.minelittlepony.pony.data.PonyDataSerialzier;
import com.mumfrey.liteloader.core.LiteLoader;
import com.mumfrey.liteloader.util.ModUtilities;
import com.voxelmodpack.hdskins.HDSkinManager;
import com.voxelmodpack.hdskins.gui.GuiSkins;
import com.voxelmodpack.hdskins.skins.SkinServer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.resources.IReloadableResourceManager;
import net.minecraft.client.resources.data.MetadataSerializer;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.EntityEvoker;
import net.minecraft.entity.monster.EntityHusk;
import net.minecraft.entity.monster.EntityIllusionIllager;
import net.minecraft.entity.monster.EntityPigZombie;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntityStray;
import net.minecraft.entity.monster.EntityVex;
import net.minecraft.entity.monster.EntityVindicator;
import net.minecraft.entity.monster.EntityWitherSkeleton;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.monster.EntityZombieVillager;
import net.minecraft.entity.passive.EntityVillager;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.input.Keyboard;
import java.util.Map;
/**
* Static MineLittlePony singleton class. Everything's controlled from up here.
*/
public class MineLittlePony {
public static final Logger logger = LogManager.getLogger("MineLittlePony");
public static final String MOD_NAME = "Mine Little Pony";
public static final String MOD_VERSION = "@VERSION@";
private static final String SKIN_SERVER_URL = "minelpskins.voxelmodpack.com";
private static final String GATEWAY_URL = "minelpskinmanager.voxelmodpack.com";
private static final KeyBinding SETTINGS_GUI = new KeyBinding("Settings", Keyboard.KEY_F9, "Mine Little Pony");
private static MineLittlePony instance;
private PonyConfig config;
private PonyManager ponyManager;
private final PonyConfig config;
private final PonyManager ponyManager;
private Map<Class<? extends Entity>, Render<?>> renderMap = Maps.newHashMap();
private final PonyRenderManager renderManager;
MineLittlePony() {
instance = this;
}
void init() {
LiteLoader.getInput().registerKeyBinding(SETTINGS_GUI);
this.config = new PonyConfig();
this.ponyManager = new PonyManager(config);
config = new PonyConfig();
ponyManager = new PonyManager(config);
renderManager = new PonyRenderManager();
LiteLoader.getInstance().registerExposable(config, null);
IReloadableResourceManager irrm = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
irrm.registerReloadListener(this.ponyManager);
irrm.registerReloadListener(ponyManager);
MetadataSerializer ms = Minecraft.getMinecraft().getResourcePackRepository().rprMetadataSerializer;
ms.registerMetadataSectionType(new PonyDataSerialzier(), IPonyData.class);
// This also makes it the default gateway server.
SkinServer.defaultServers.add("legacy:http://minelpskins.voxelmodpack.com;http://minelpskinmanager.voxelmodpack.com");
SkinServer.defaultServers.add("legacy:" + SKIN_SERVER_URL + ";" + GATEWAY_URL);
}
/**
* Called when the game is ready.
*/
void postInit(Minecraft minecraft) {
HDSkinManager manager = HDSkinManager.INSTANCE;
@ -94,95 +71,13 @@ public class MineLittlePony {
// logger.info("Set MineLP skin server URL.");
RenderManager rm = minecraft.getRenderManager();
this.saveCurrentRenderers(rm);
ModUtilities.addRenderer(EntityPonyModel.class, new RenderPonyModel(rm));
this.initializeMobRenderers(rm);
}
private void saveCurrentRenderers(RenderManager rm) {
// villagers
saveRenderer(rm, EntityVillager.class);
saveRenderer(rm, EntityZombieVillager.class);
// zombies
saveRenderer(rm, EntityZombie.class);
saveRenderer(rm, EntityHusk.class);
// pig zombie
saveRenderer(rm, EntityPigZombie.class);
// skeletons
saveRenderer(rm, EntitySkeleton.class);
saveRenderer(rm, EntityStray.class);
saveRenderer(rm, EntityWitherSkeleton.class);
// illagers
saveRenderer(rm, EntityVex.class);
saveRenderer(rm, EntityEvoker.class);
saveRenderer(rm, EntityVindicator.class);
saveRenderer(rm, EntityIllusionIllager.class);
}
private void saveRenderer(RenderManager rm, Class<? extends Entity> cl) {
this.renderMap.put(cl, rm.getEntityClassRenderObject(cl));
}
@SuppressWarnings("unchecked")
private <T extends Entity> Render<T> getRenderer(Class<T> cl) {
Render<T> render = (Render<T>) this.renderMap.get(cl);
if (render == null)
throw new MissingRendererException(cl);
return render;
}
public void initializeMobRenderers(RenderManager rm) {
if (this.config.villagers) {
ModUtilities.addRenderer(EntityVillager.class, new RenderPonyVillager(rm));
ModUtilities.addRenderer(EntityZombieVillager.class, new RenderPonyZombieVillager(rm));
logger.info("Villagers are now ponies.");
} else {
ModUtilities.addRenderer(EntityVillager.class, getRenderer(EntityVillager.class));
ModUtilities.addRenderer(EntityZombieVillager.class, getRenderer(EntityZombieVillager.class));
}
if (this.config.zombies) {
ModUtilities.addRenderer(EntityZombie.class, new RenderPonyZombie<>(rm));
ModUtilities.addRenderer(EntityHusk.class, new RenderPonyZombie.Husk(rm));
logger.info("Zombies are now ponies.");
} else {
ModUtilities.addRenderer(EntityZombie.class, getRenderer(EntityZombie.class));
ModUtilities.addRenderer(EntityHusk.class, getRenderer(EntityHusk.class));
}
if (this.config.pigzombies) {
ModUtilities.addRenderer(EntityPigZombie.class, new RenderPonyPigman(rm));
logger.info("Zombie pigmen are now ponies.");
} else {
ModUtilities.addRenderer(EntityPigZombie.class, getRenderer(EntityPigZombie.class));
}
if (this.config.skeletons) {
ModUtilities.addRenderer(EntitySkeleton.class, new RenderPonySkeleton<>(rm));
ModUtilities.addRenderer(EntityStray.class, new RenderPonySkeleton.Stray(rm));
ModUtilities.addRenderer(EntityWitherSkeleton.class, new RenderPonySkeleton.Wither(rm));
logger.info("Skeletons are now ponies.");
} else {
ModUtilities.addRenderer(EntitySkeleton.class, getRenderer(EntitySkeleton.class));
ModUtilities.addRenderer(EntityStray.class, getRenderer(EntityStray.class));
ModUtilities.addRenderer(EntityWitherSkeleton.class, getRenderer(EntityWitherSkeleton.class));
}
if (this.config.illagers) {
ModUtilities.addRenderer(EntityVex.class, new RenderPonyVex(rm));
ModUtilities.addRenderer(EntityEvoker.class, new RenderPonyEvoker(rm));
ModUtilities.addRenderer(EntityVindicator.class, new RenderPonyVindicator(rm));
ModUtilities.addRenderer(EntityIllusionIllager.class, new RenderPonyIllusionIllager(rm));
logger.info("Illagers are now ponies.");
} else {
ModUtilities.addRenderer(EntityVex.class, getRenderer(EntityVex.class));
ModUtilities.addRenderer(EntityEvoker.class, getRenderer(EntityEvoker.class));
ModUtilities.addRenderer(EntityVindicator.class, getRenderer(EntityVindicator.class));
ModUtilities.addRenderer(EntityIllusionIllager.class, getRenderer(EntityIllusionIllager.class));
}
renderManager.initialisePlayerRenderers(rm);
renderManager.initializeMobRenderers(rm, config);
}
/**
* Called on every update tick
*/
void onTick(Minecraft minecraft, boolean inGame) {
if (inGame && minecraft.currentScreen == null && SETTINGS_GUI.isPressed()) {
@ -198,14 +93,30 @@ public class MineLittlePony {
}
/**
* Gets the global MineLP instance.
*/
public static MineLittlePony getInstance() {
return instance;
}
/**
* Gets the static pony manager instance.
*/
public PonyManager getManager() {
return this.ponyManager;
return ponyManager;
}
/**
* Gets the static pony render manager responsible for all entity renderers.
*/
public PonyRenderManager getRenderManager() {
return renderManager;
}
/**
* Gets the global MineLP client configuration.
*/
public static PonyConfig getConfig() {
return getInstance().config;
}

View file

@ -1,6 +1,7 @@
package com.minelittlepony;
public class MissingRendererException extends RuntimeException {
private static final long serialVersionUID = -6059469512902628663L;
public MissingRendererException(Class<?> cl) {
super("Could not find a renderer for " + cl.getName() + ". This is a bug.");

View file

@ -1,167 +0,0 @@
package com.minelittlepony;
import com.google.common.base.MoreObjects;
import com.minelittlepony.model.PMAPI;
import com.minelittlepony.model.PlayerModel;
import com.minelittlepony.util.PonyFields;
import com.voxelmodpack.hdskins.DynamicTextureImage;
import com.voxelmodpack.hdskins.ThreadDownloadImageETag;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.renderer.ThreadDownloadImageData;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.client.resources.IResource;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import java.awt.image.BufferedImage;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
@Immutable
public class Pony {
private static final AtomicInteger ponyCount = new AtomicInteger();
private final int ponyId = ponyCount.getAndIncrement();
private final ResourceLocation texture;
private final PonyData metadata;
public Pony(AbstractClientPlayer player) {
this.texture = player.getLocationSkin();
this.metadata = this.checkSkin(this.texture);
MineLittlePony.logger.debug("+ Initialising new pony #{} for player {} ({}) with resource location {}.",
this.ponyId, player.getName(), player.getUniqueID(), this.texture);
}
public Pony(ResourceLocation resourceLocation) {
this(resourceLocation, null);
}
public Pony(ResourceLocation aTextureResourceLocation, @Nullable PonyData meta) {
this.texture = aTextureResourceLocation;
this.metadata = meta != null ? meta : this.checkSkin(this.texture);
MineLittlePony.logger.debug("+ Initialising new pony #{} with resource location {}.", this.ponyId, this.texture);
}
private PonyData checkSkin(ResourceLocation textureResourceLocation) {
PonyData data = checkPonyMeta(textureResourceLocation);
if (data == null) {
BufferedImage skinImage = this.getBufferedImage(textureResourceLocation);
if (skinImage != null) {
data = this.checkSkin(skinImage);
} else {
data = new PonyData();
}
}
return data;
}
@Nullable
private PonyData checkPonyMeta(ResourceLocation location) {
try {
IResource res = Minecraft.getMinecraft().getResourceManager().getResource(location);
if (res.hasMetadata()) {
PonyData data = res.getMetadata(PonyDataSerialzier.NAME);
if (data != null) {
return data;
}
}
} catch (FileNotFoundException e) {
// Ignore uploaded texture
} catch (IOException e) {
MineLittlePony.logger.warn("Unable to read {} metadata", location, e);
}
return null;
}
@Nullable
private BufferedImage getBufferedImage(@Nonnull ResourceLocation textureResourceLocation) {
BufferedImage skinImage = null;
try {
IResource skin = Minecraft.getMinecraft().getResourceManager().getResource(textureResourceLocation);
skinImage = TextureUtil.readBufferedImage(skin.getInputStream());
MineLittlePony.logger.debug("Obtained skin from resource location {}", textureResourceLocation);
// this.checkSkin(skinImage);
} catch (IOException e) {
try {
ITextureObject e2 = Minecraft.getMinecraft().getTextureManager().getTexture(textureResourceLocation);
if (e2 instanceof ThreadDownloadImageData) {
skinImage = PonyFields.downloadedImage.get((ThreadDownloadImageData) e2);
if (skinImage != null) {
MineLittlePony.logger.debug("Successfully reflected downloadedImage from texture object", e);
// this.checkSkin(skinImage);
}
} else if (e2 instanceof ThreadDownloadImageETag) {
skinImage = ((ThreadDownloadImageETag) e2).getBufferedImage();
} else if (e2 instanceof DynamicTextureImage) {
skinImage = ((DynamicTextureImage) e2).getImage();
}
} catch (Exception ignored) {
}
}
return skinImage;
}
private PonyData checkSkin(BufferedImage bufferedimage) {
MineLittlePony.logger.debug("\tStart skin check for pony #{} with image {}.", this.ponyId, bufferedimage);
return PonyData.parse(bufferedimage);
}
public boolean isPegasusFlying(EntityPlayer player) {
//noinspection SimplifiableIfStatement
if (!this.metadata.getRace().hasWings()) {
return false;
}
return player.capabilities.isFlying || !(player.onGround || player.isRiding() || player.isOnLadder() || player.isInWater() || player.isElytraFlying());
}
public PlayerModel getModel(boolean ignorePony, boolean smallArms) {
boolean is_a_pony = false;
switch (ignorePony ? PonyLevel.BOTH : MineLittlePony.getConfig().getPonyLevel()) {
case HUMANS:
is_a_pony = false;
break;
case BOTH:
is_a_pony = metadata.getRace() != PonyRace.HUMAN;
break;
case PONIES:
is_a_pony = true;
}
PlayerModel model;
if (is_a_pony) {
model = smallArms ? PMAPI.ponySmall : PMAPI.pony;
} else {
model = smallArms ? PMAPI.humanSmall : PMAPI.human;
}
return model;
}
public ResourceLocation getTexture() {
return this.texture;
}
public PonyData getMetadata() {
return metadata;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("texture", texture)
.add("metadata", metadata)
.toString();
}
}

View file

@ -1,40 +1,51 @@
package com.minelittlepony;
import com.google.gson.annotations.Expose;
import com.minelittlepony.pony.data.PonyLevel;
import com.mumfrey.liteloader.modconfig.ConfigStrategy;
import com.mumfrey.liteloader.modconfig.Exposable;
import com.mumfrey.liteloader.modconfig.ExposableOptions;
/**
* Storage contained for MineLP client settings.
*
*/
@ExposableOptions(filename = "minelittlepony", strategy = ConfigStrategy.Unversioned)
public class PonyConfig implements Exposable {
@Expose
private PonyLevel ponylevel = PonyLevel.PONIES;
@Expose
public boolean sizes = true;
@Expose
public boolean snuzzles = true;
@Expose
public boolean hd = true;
@Expose
public boolean showscale = true;
@Expose
public boolean villagers = true;
@Expose
public boolean zombies = true;
@Expose
public boolean pigzombies = true;
@Expose
public boolean skeletons = true;
@Expose
public boolean illagers = true;
@Expose private PonyLevel ponylevel = PonyLevel.PONIES;
@Expose public boolean sizes = true;
@Expose public boolean snuzzles = true;
@Expose public boolean hd = true;
@Expose public boolean showscale = true;
@Expose public boolean villagers = true;
@Expose public boolean zombies = true;
@Expose public boolean pigzombies = true;
@Expose public boolean skeletons = true;
@Expose public boolean illagers = true;
/**
* Gets the current PonyLevel. That is the level of ponies you would like to see.
* @param ignorePony true to ignore whatever value the setting has.
*/
public PonyLevel getEffectivePonyLevel(boolean ignorePony) {
return ignorePony ? PonyLevel.BOTH : getPonyLevel();
}
/**
* Actually gets the pony level value. No option to ignore reality here.
*/
public PonyLevel getPonyLevel() {
if (ponylevel == null)
if (ponylevel == null) {
ponylevel = PonyLevel.PONIES;
}
return ponylevel;
}
/**
* Sets the pony level. Want MOAR PONEHS? Well here you go.
* @param ponylevel
*/
public void setPonyLevel(PonyLevel ponylevel) {
this.ponylevel = ponylevel;
}

View file

@ -1,128 +0,0 @@
package com.minelittlepony;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableBiMap;
import java.awt.image.BufferedImage;
import java.util.Map;
import javax.annotation.concurrent.Immutable;
@Immutable
public class PonyData implements IPonyData {
private static final Map<Integer, PonyRace> RACE_COLORS = ImmutableBiMap.<Integer, PonyRace>builder()
.put(0xf9b131, PonyRace.EARTH)
.put(0xd19fe4, PonyRace.UNICORN)
.put(0x88caf0, PonyRace.PEGASUS)
.put(0xfef9fc, PonyRace.ALICORN)
.put(0xd0cccf, PonyRace.ZEBRA)
.put(0x282b29, PonyRace.CHANGELING)
.put(0xcaed5a, PonyRace.REFORMED_CHANGELING)
.put(0xae9145, PonyRace.GRIFFIN)
.put(0xd6ddac, PonyRace.HIPPOGRIFF)
.build();
private static final Map<Integer, TailLengths> TAIL_COLORS = ImmutableBiMap.<Integer, TailLengths>builder()
.put(0x425844, TailLengths.STUB)
.put(0xd19fe4, TailLengths.QUARTER)
.put(0x534b76, TailLengths.HALF)
.put(0x8a6b7f, TailLengths.THREE_QUARTERS).build();
private static final Map<Integer, PonySize> SIZE_COLORS = ImmutableBiMap.<Integer, PonySize>builder()
.put(0xffbe53, PonySize.FOAL)
.put(0xce3254, PonySize.LARGE)
.put(0x534b76, PonySize.TALL)
.build();
private final PonyRace race;
private final TailLengths tailSize;
private final PonyGender gender;
private final PonySize size;
private final int glowColor;
public PonyData() {
this(PonyRace.HUMAN, TailLengths.FULL, PonyGender.MARE, PonySize.NORMAL, 0x4444aa);
}
private PonyData(PonyRace race, TailLengths tailSize, PonyGender gender, PonySize size, int glowColor) {
this.race = race;
this.tailSize = tailSize;
this.gender = gender;
this.size = size;
this.glowColor = glowColor;
}
public PonyRace getRace() {
return race;
}
public TailLengths getTail() {
return tailSize;
}
public PonyGender getGender() {
return gender;
}
public PonySize getSize() {
return MineLittlePony.getConfig().sizes ? size : PonySize.NORMAL;
}
public int getGlowColor() {
return glowColor;
}
public boolean hasMagic() {
return this.race != null && this.race.hasHorn() && this.glowColor != 0;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("race", race)
.add("tailSize", tailSize)
.add("gender", gender)
.add("size", size)
.add("glowColor", "#" + Integer.toHexString(glowColor))
.toString();
}
static PonyData parse(BufferedImage image) {
int racePx = TriggerPixels.RACE.readColor(image);
PonyRace race = RACE_COLORS.getOrDefault(racePx, PonyRace.HUMAN);
int tailPx = TriggerPixels.TAIL.readColor(image);
TailLengths tail = TAIL_COLORS.getOrDefault(tailPx, TailLengths.FULL);
int sizePx = TriggerPixels.SIZE.readColor(image);
PonySize size = SIZE_COLORS.getOrDefault(sizePx, PonySize.NORMAL);
int genderPx = TriggerPixels.GENDER.readColor(image);
PonyGender gender = genderPx == 0xffffff ? PonyGender.STALLION : PonyGender.MARE;
int glowColor = TriggerPixels.GLOW.readColor(image, -1);
return new PonyData(race, tail, gender, size, glowColor);
}
private enum TriggerPixels {
RACE(0, 0),
TAIL(1, 0),
GENDER(2, 0),
SIZE(3, 0),
GLOW(0, 1);
private int x, y;
TriggerPixels(int x, int y) {
this.x = x;
this.y = y;
}
private int readColor(BufferedImage image) {
return readColor(image, 0xffffff);
}
private int readColor(BufferedImage image, int mask) {
return image.getRGB(x, y) & mask;
}
}
}

View file

@ -1,6 +0,0 @@
package com.minelittlepony;
public enum PonyGender {
MARE,
STALLION
}

View file

@ -5,7 +5,13 @@ import com.google.common.collect.Maps;
import com.google.gson.Gson;
import com.google.gson.JsonParseException;
import com.minelittlepony.model.PMAPI;
import com.minelittlepony.pony.data.Pony;
import com.minelittlepony.pony.data.PonyLevel;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.network.NetworkPlayerInfo;
import net.minecraft.client.resources.DefaultPlayerSkin;
import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener;
@ -19,15 +25,21 @@ import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* The PonyManager is responsible for reading and recoding all the pony data associated with an entity of skin.
*
*/
public class PonyManager implements IResourceManagerReloadListener {
public static final ResourceLocation STEVE = new ResourceLocation("minelittlepony", "textures/entity/steve_pony.png");
public static final ResourceLocation ALEX = new ResourceLocation("minelittlepony", "textures/entity/alex_pony.png");
private static final ResourceLocation BGPONIES_JSON = new ResourceLocation("minelittlepony", "textures/entity/pony/bgponies.json");
public static final ResourceLocation BGPONIES_JSON = new ResourceLocation("minelittlepony", "textures/entity/pony/bgponies.json");
private static final Gson GSON = new Gson();
/**
* All currently loaded background ponies.
*/
private List<ResourceLocation> backgroundPonyList = Lists.newArrayList();
private PonyConfig config;
@ -40,87 +52,132 @@ public class PonyManager implements IResourceManagerReloadListener {
initmodels();
}
public void initmodels() {
private void initmodels() {
MineLittlePony.logger.info("Initializing models...");
PMAPI.init();
MineLittlePony.logger.info("Done initializing models.");
}
public Pony getPony(ResourceLocation skinResourceLocation) {
return this.poniesCache.computeIfAbsent(skinResourceLocation, Pony::new);
/**
* Gets or creates a pony for the given skin resource and vanilla model type.
*
* @param resource A texture resource
*/
public Pony getPony(ResourceLocation resource, boolean slim) {
return poniesCache.computeIfAbsent(resource, res -> new Pony(res, slim));
}
/**
* Gets or creates a pony for the given player.
* Delegates to the background-ponies registry if no pony skins were available and client settings allows it.
*
* @param player the player
*/
public Pony getPony(AbstractClientPlayer player) {
ResourceLocation skin = player.getLocationSkin();
UUID uuid = player.getGameProfile().getId();
Pony myLittlePony = this.poniesCache.computeIfAbsent(player.getLocationSkin(), res -> new Pony(player));
if (skin == null) return getDefaultPony(uuid);
if (config.getPonyLevel() == PonyLevel.PONIES && myLittlePony.getMetadata().getRace() == PonyRace.HUMAN) {
myLittlePony = this.getPonyFromBackgroundResourceRegistry(player);
}
return myLittlePony;
return getPony(skin, uuid);
}
public Pony removePony(ResourceLocation location) {
return this.poniesCache.remove(location);
public Pony getPony(NetworkPlayerInfo playerInfo) {
ResourceLocation skin = playerInfo.getLocationSkin();
UUID uuid = playerInfo.getGameProfile().getId();
if (skin == null) return getDefaultPony(uuid);
return getPony(skin, uuid);
}
private ResourceLocation getBackgroundPonyResource(UUID id) {
if (getNumberOfPonies() > 0) {
int backgroundIndex = id.hashCode() % this.getNumberOfPonies();
if (backgroundIndex < 0) {
backgroundIndex += this.getNumberOfPonies();
}
/**
* Gets or creates a pony for the given skin resource and entity id.
*
* Whether is has slim arms is determined by the id.
*
* Delegates to the background-ponies registry if no pony skins were available and client settings allows it.
*
* @param resource A texture resource
* @param uuid id of a player or entity
*/
public Pony getPony(ResourceLocation resource, UUID uuid) {
Pony pony = getPony(resource, isSlimSkin(uuid));
return backgroundPonyList.get(backgroundIndex);
if (config.getPonyLevel() == PonyLevel.PONIES && pony.getMetadata().getRace().isHuman()) {
return getBackgroundPony(uuid);
}
return STEVE;
return pony;
}
private Pony getPonyFromBackgroundResourceRegistry(AbstractClientPlayer player) {
ResourceLocation textureResourceLocation;
if (player.isUser()) {
textureResourceLocation = getDefaultSkin(player.getUniqueID());
} else {
textureResourceLocation = this.getBackgroundPonyResource(player.getUniqueID());
/**
* Gets the default pony. Either STEVE/ALEX, or a background pony based on client settings.
*
* @param uuid id of a player or entity
*/
public Pony getDefaultPony(UUID uuid) {
if (config.getPonyLevel() != PonyLevel.PONIES) {
return getPony(DefaultPlayerSkin.getDefaultSkin(uuid), isSlimSkin(uuid));
}
Pony myLittlePony;
if (!this.backgroudPoniesCache.containsKey(textureResourceLocation)) {
myLittlePony = new Pony(textureResourceLocation);
this.backgroudPoniesCache.put(textureResourceLocation, myLittlePony);
} else {
myLittlePony = this.backgroudPoniesCache.get(textureResourceLocation);
return getBackgroundPony(uuid);
}
private Pony getBackgroundPony(UUID uuid) {
if (getNumberOfPonies() == 0 || isUser(uuid)) {
return getPony(getDefaultSkin(uuid), isSlimSkin(uuid));
}
return myLittlePony;
int bgi = uuid.hashCode() % getNumberOfPonies();
while (bgi < 0) bgi += getNumberOfPonies();
return getPony(backgroundPonyList.get(bgi), false);
}
private boolean isUser(UUID uuid) {
return Minecraft.getMinecraft().player != null && Minecraft.getMinecraft().player.getUniqueID().equals(uuid);
}
/**
* De-registers a pony from the cache.
*/
public Pony removePony(ResourceLocation resource) {
return poniesCache.remove(resource);
}
@Override
public void onResourceManagerReload(IResourceManager resourceManager) {
this.poniesCache.clear();
this.backgroudPoniesCache.clear();
this.backgroundPonyList.clear();
poniesCache.clear();
backgroudPoniesCache.clear();
backgroundPonyList.clear();
try {
for (IResource res : resourceManager.getAllResources(BGPONIES_JSON)) {
try (Reader reader = new InputStreamReader((res.getInputStream()))) {
BackgroundPonies ponies = GSON.fromJson(reader, BackgroundPonies.class);
if (ponies.override) {
this.backgroundPonyList.clear();
backgroundPonyList.clear();
}
this.backgroundPonyList.addAll(ponies.getPonies());
backgroundPonyList.addAll(ponies.getPonies());
} catch (JsonParseException e) {
MineLittlePony.logger.error("Invalid bgponies.json in " + res.getResourcePackName(), e);
}
}
} catch (IOException e) {
} catch (IOException ignored) {
// this isn't the exception you're looking for.
}
MineLittlePony.logger.info("Detected {} background ponies installed.", getNumberOfPonies());
}
private ResourceLocation getDefaultSkin(UUID uuid) {
return (uuid.hashCode() & 1) == 0 ? STEVE : ALEX;
return isSlimSkin(uuid) ? ALEX : STEVE;
}
/**
* Returns true if the given uuid is of a player would would use the ALEX skin type.
*/
public static boolean isSlimSkin(UUID uuid) {
return (uuid.hashCode() & 1) == 1;
}
private int getNumberOfPonies() {
@ -142,7 +199,7 @@ public class PonyManager implements IResourceManagerReloadListener {
}
public List<ResourceLocation> getPonies() {
return this.ponies.stream().map(this::apply).collect(Collectors.toList());
return ponies.stream().map(this::apply).collect(Collectors.toList());
}
}
}

View file

@ -1,32 +0,0 @@
package com.minelittlepony;
public enum PonyRace {
HUMAN(false, false),
EARTH(false, false),
PEGASUS(true, false),
UNICORN(false, true),
ALICORN(true, true),
CHANGELING(true, true),
ZEBRA(false, false),
REFORMED_CHANGELING(true, true),
GRIFFIN(true, false),
HIPPOGRIFF(true, false),
;
private boolean wings;
private boolean horn;
PonyRace(boolean wings, boolean horn) {
this.wings = wings;
this.horn = horn;
}
public boolean hasHorn() {
return horn;
}
public boolean hasWings() {
return wings;
}
}

View file

@ -0,0 +1,152 @@
package com.minelittlepony;
import java.util.Map;
import com.google.common.collect.Maps;
import com.minelittlepony.mixin.MixinRenderManager;
import com.minelittlepony.hdskins.gui.EntityPonyModel;
import com.minelittlepony.hdskins.gui.RenderPonyModel;
import com.minelittlepony.model.player.PlayerModels;
import com.minelittlepony.render.player.RenderPonyPlayer;
import com.minelittlepony.render.ponies.RenderPonyIllager;
import com.minelittlepony.render.ponies.RenderPonyPigman;
import com.minelittlepony.render.ponies.RenderPonySkeleton;
import com.minelittlepony.render.ponies.RenderPonyVex;
import com.minelittlepony.render.ponies.RenderPonyVillager;
import com.minelittlepony.render.ponies.RenderPonyWitch;
import com.minelittlepony.render.ponies.RenderPonyZombie;
import com.minelittlepony.render.ponies.RenderPonyZombieVillager;
import com.mumfrey.liteloader.util.ModUtilities;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.EntityEvoker;
import net.minecraft.entity.monster.EntityGiantZombie;
import net.minecraft.entity.monster.EntityHusk;
import net.minecraft.entity.monster.EntityIllusionIllager;
import net.minecraft.entity.monster.EntityPigZombie;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntityStray;
import net.minecraft.entity.monster.EntityVex;
import net.minecraft.entity.monster.EntityVindicator;
import net.minecraft.entity.monster.EntityWitch;
import net.minecraft.entity.monster.EntityWitherSkeleton;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.monster.EntityZombieVillager;
import net.minecraft.entity.passive.EntityVillager;
/**
* Render manager responsible for replacing and restoring entity renderers when the client settings change.
* Old values of persisted internally.
*/
public class PonyRenderManager {
private final Map<Class<? extends Entity>, Render<?>> renderMap = Maps.newHashMap();
/**
* Registers all new player skin types. (currently only pony and slimpony).
*/
public void initialisePlayerRenderers(RenderManager manager) {
// Preview on the select skin gui
ModUtilities.addRenderer(EntityPonyModel.class, new RenderPonyModel(manager));
registerPlayerSkin(manager, PlayerModels.EARTH);
registerPlayerSkin(manager, PlayerModels.PEGASUS);
registerPlayerSkin(manager, PlayerModels.ALICORN);
}
private void registerPlayerSkin(RenderManager manager, PlayerModels playerModel) {
addPlayerSkin(manager, false, playerModel);
addPlayerSkin(manager, true, playerModel);
}
private void addPlayerSkin(RenderManager manager, boolean slimArms, PlayerModels playerModel) {
RenderPonyPlayer renderer = new RenderPonyPlayer(manager, slimArms, playerModel.getModel(slimArms));
((MixinRenderManager)manager).getSkinMap().put(playerModel.getId(slimArms), renderer);
}
/**
* Registers all entity model replacements. (except for players).
*/
public void initializeMobRenderers(RenderManager manager, PonyConfig config) {
if (config.villagers) {
pushNewRenderer(manager, EntityVillager.class, new RenderPonyVillager(manager));
pushNewRenderer(manager, EntityWitch.class, new RenderPonyWitch(manager));
pushNewRenderer(manager, EntityZombieVillager.class, new RenderPonyZombieVillager(manager));
MineLittlePony.logger.info("Villagers are now ponies.");
} else {
restoreRenderer(EntityVillager.class);
restoreRenderer(EntityWitch.class);
restoreRenderer(EntityZombieVillager.class);
}
if (config.zombies) {
pushNewRenderer(manager, EntityZombie.class, new RenderPonyZombie<>(manager));
pushNewRenderer(manager, EntityHusk.class, new RenderPonyZombie.Husk(manager));
pushNewRenderer(manager, EntityGiantZombie.class, new RenderPonyZombie.Giant(manager));
MineLittlePony.logger.info("Zombies are now ponies.");
} else {
restoreRenderer(EntityZombie.class);
restoreRenderer(EntityHusk.class);
restoreRenderer(EntityGiantZombie.class);
}
if (config.pigzombies) {
pushNewRenderer(manager, EntityPigZombie.class, new RenderPonyPigman(manager));
MineLittlePony.logger.info("Zombie pigmen are now ponies.");
} else {
restoreRenderer(EntityPigZombie.class);
}
if (config.skeletons) {
pushNewRenderer(manager, EntitySkeleton.class, new RenderPonySkeleton<>(manager));
pushNewRenderer(manager, EntityStray.class, new RenderPonySkeleton.Stray(manager));
pushNewRenderer(manager, EntityWitherSkeleton.class, new RenderPonySkeleton.Wither(manager));
MineLittlePony.logger.info("Skeletons are now ponies.");
} else {
restoreRenderer(EntitySkeleton.class);
restoreRenderer(EntityStray.class);
restoreRenderer(EntityWitherSkeleton.class);
}
if (config.illagers) {
pushNewRenderer(manager, EntityVex.class, new RenderPonyVex(manager));
pushNewRenderer(manager, EntityEvoker.class, new RenderPonyIllager.Evoker(manager));
pushNewRenderer(manager, EntityVindicator.class, new RenderPonyIllager.Vindicator(manager));
pushNewRenderer(manager, EntityIllusionIllager.class, new RenderPonyIllager.Illusionist(manager));
MineLittlePony.logger.info("Illagers are now ponies.");
} else {
restoreRenderer(EntityVex.class);
restoreRenderer(EntityEvoker.class);
restoreRenderer(EntityVindicator.class);
restoreRenderer(EntityIllusionIllager.class);
}
}
/**
* Pushes a new renderer replacement storing the original internally. This change can be undone with {@link #restoreRenderer(Class)}
* @param manager The render manager
* @param type The type to replace
* @param renderer The replacement value
* @param <T> The entity type
*/
public <T extends Entity> void pushNewRenderer(RenderManager manager, Class<T> type, Render<T> renderer) {
if (!renderMap.containsKey(type)) {
renderMap.put(type, manager.getEntityClassRenderObject(type));
}
ModUtilities.addRenderer(type, renderer);
}
/**
* Restores a renderer to its previous value.
*/
@SuppressWarnings("unchecked")
public <T extends Entity> void restoreRenderer(Class<T> type) {
if (renderMap.containsKey(type)) {
ModUtilities.addRenderer(type, (Render<T>)renderMap.get(type));
}
}
}

View file

@ -1,8 +1,6 @@
package com.minelittlepony.gui;
package com.minelittlepony;
import com.minelittlepony.MineLittlePony;
import com.minelittlepony.PonyConfig;
import com.minelittlepony.PonyLevel;
import com.minelittlepony.pony.data.PonyLevel;
import com.mumfrey.liteloader.client.gui.GuiCheckbox;
import com.mumfrey.liteloader.core.LiteLoader;
import net.minecraft.client.gui.GuiButton;
@ -11,6 +9,9 @@ import net.minecraft.client.resources.I18n;
import java.io.IOException;
/**
* In-Game options menu.
*/
public class PonySettingPanel extends GuiScreen {
private static final String _PREFIX = "minelp.options.";
@ -64,22 +65,22 @@ public class PonySettingPanel extends GuiScreen {
final int LEFT = width / 10 + 16;
GuiCheckbox pony, human, both, hd, sizes, snuzzles, showscale, villager, zombie, pigmen, skeleton, illager;
int row = 32;
this.buttonList.add(pony = ponies = new GuiCheckbox(PONY_ID, LEFT, row += 15, I18n.format(PONY)));
this.buttonList.add(human = humans = new GuiCheckbox(HUMAN_ID, LEFT, row += 15, I18n.format(HUMAN)));
this.buttonList.add(both = this.both = new GuiCheckbox(BOTH_ID, LEFT, row += 15, I18n.format(BOTH)));
buttonList.add(pony = ponies = new GuiCheckbox(PONY_ID, LEFT, row += 15, I18n.format(PONY)));
buttonList.add(human = humans = new GuiCheckbox(HUMAN_ID, LEFT, row += 15, I18n.format(HUMAN)));
buttonList.add(both = this.both = new GuiCheckbox(BOTH_ID, LEFT, row += 15, I18n.format(BOTH)));
row += 15;
this.buttonList.add(hd = new GuiCheckbox(HD_ID, LEFT, row += 15, I18n.format(HD)));
this.buttonList.add(sizes = new GuiCheckbox(SIZES_ID, LEFT, row += 15, I18n.format(SIZES)));
this.buttonList.add(snuzzles = new GuiCheckbox(SNUZZLES_ID, LEFT, row += 15, I18n.format(SNUZZLES)));
this.buttonList.add(showscale = new GuiCheckbox(SHOW_SCALE_ID, LEFT, row += 15, I18n.format(SHOW_SCALE)));
buttonList.add(hd = new GuiCheckbox(HD_ID, LEFT, row += 15, I18n.format(HD)));
buttonList.add(sizes = new GuiCheckbox(SIZES_ID, LEFT, row += 15, I18n.format(SIZES)));
buttonList.add(snuzzles = new GuiCheckbox(SNUZZLES_ID, LEFT, row += 15, I18n.format(SNUZZLES)));
buttonList.add(showscale = new GuiCheckbox(SHOW_SCALE_ID, LEFT, row += 15, I18n.format(SHOW_SCALE)));
final int RIGHT = width - width / 3;
row = 32;
this.buttonList.add(villager = new GuiCheckbox(VILLAGERS_ID, RIGHT, row += 15, I18n.format(VILLAGERS)));
this.buttonList.add(zombie = new GuiCheckbox(ZOMBIES_ID, RIGHT, row += 15, I18n.format(ZOMBIES)));
this.buttonList.add(pigmen = new GuiCheckbox(ZOMBIE_PIGMEN_ID, RIGHT, row += 15, I18n.format(ZOMBIE_PIGMEN)));
this.buttonList.add(skeleton = new GuiCheckbox(SKELETONS_ID, RIGHT, row += 15, I18n.format(SKELETONS)));
this.buttonList.add(illager = new GuiCheckbox(ILLAGER_ID, RIGHT, row += 15, I18n.format(ILLAGERS)));
buttonList.add(villager = new GuiCheckbox(VILLAGERS_ID, RIGHT, row += 15, I18n.format(VILLAGERS)));
buttonList.add(zombie = new GuiCheckbox(ZOMBIES_ID, RIGHT, row += 15, I18n.format(ZOMBIES)));
buttonList.add(pigmen = new GuiCheckbox(ZOMBIE_PIGMEN_ID, RIGHT, row += 15, I18n.format(ZOMBIE_PIGMEN)));
buttonList.add(skeleton = new GuiCheckbox(SKELETONS_ID, RIGHT, row += 15, I18n.format(SKELETONS)));
buttonList.add(illager = new GuiCheckbox(ILLAGER_ID, RIGHT, row += 15, I18n.format(ILLAGERS)));
switch (config.getPonyLevel()) {
default:
@ -106,13 +107,13 @@ public class PonySettingPanel extends GuiScreen {
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
this.drawDefaultBackground();
drawDefaultBackground();
this.drawCenteredString(mc.fontRenderer, I18n.format(TITLE), width / 2, 12, -1);
drawCenteredString(mc.fontRenderer, I18n.format(TITLE), width / 2, 12, -1);
this.drawString(mc.fontRenderer, I18n.format(MOB_TITLE), width - width / 3 - 16, 32, -1);
this.drawString(mc.fontRenderer, I18n.format(PONY_LEVEL), width / 10, 32, -1);
this.drawString(mc.fontRenderer, I18n.format(OPTIONS), width / 10, 94, -1);
drawString(mc.fontRenderer, I18n.format(MOB_TITLE), width - width / 3 - 16, 32, -1);
drawString(mc.fontRenderer, I18n.format(PONY_LEVEL), width / 10, 32, -1);
drawString(mc.fontRenderer, I18n.format(OPTIONS), width / 10, 94, -1);
super.drawScreen(mouseX, mouseY, partialTicks);
}
@ -177,6 +178,6 @@ public class PonySettingPanel extends GuiScreen {
@Override
public void onGuiClosed() {
LiteLoader.getInstance().writeConfig(config);
MineLittlePony.getInstance().initializeMobRenderers(mc.getRenderManager());
MineLittlePony.getInstance().getRenderManager().initializeMobRenderers(mc.getRenderManager(), config);
}
}

View file

@ -1,8 +0,0 @@
package com.minelittlepony;
public enum PonySize {
NORMAL,
LARGE,
FOAL,
TALL
}

View file

@ -1,20 +0,0 @@
package com.minelittlepony;
public enum TailLengths {
STUB(4),
QUARTER(3),
HALF(2),
THREE_QUARTERS(1),
FULL(0);
private int size;
TailLengths(int size) {
this.size = size;
}
public int getSize() {
return size;
}
}

View file

@ -0,0 +1,17 @@
package com.minelittlepony.ducks;
import net.minecraft.client.network.NetworkPlayerInfo;
public interface IPlayerInfo {
/**
* Returns true if the vanilla skin (the one returned by NetworkPlayerInfo.getSkinLocation) uses the ALEX model type.
*/
boolean usesSlimArms();
/**
* Quick cast back to the original type.
*/
default NetworkPlayerInfo unwrap() {
return (NetworkPlayerInfo)this;
}
}

View file

@ -2,5 +2,8 @@ package com.minelittlepony.ducks;
public interface IRenderItem {
/**
* Sets whether items should be rendered with transparency support.
*/
void useTransparency(boolean use);
}

View file

@ -1,8 +1,19 @@
package com.minelittlepony.ducks;
import com.minelittlepony.model.PlayerModel;
import com.minelittlepony.model.ModelWrapper;
/**
* I Render Pony now, oky?
*/
public interface IRenderPony {
PlayerModel getPony();
/**
* Gets the wrapped pony model for this renderer.
*/
ModelWrapper getPlayerModel();
/**
* Gets the current shadow size for rendering.
*/
float getShadowScale();
}

View file

@ -1,11 +1,44 @@
package com.minelittlepony.hdskins.gui;
import java.io.File;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import com.voxelmodpack.hdskins.gui.EntityPlayerModel;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
/**
* Dummy model used for the skin uploading screen.
*/
public class EntityPonyModel extends EntityPlayerModel {
public static final ResourceLocation NO_SKIN_PONY = new ResourceLocation("minelittlepony", "textures/mob/noskin.png");
public EntityPonyModel(GameProfile profile) {
super(profile);
}
public void setLocalTexture(File skinTextureFile, Type type) {
super.setLocalTexture(skinTextureFile, type);
}
public ResourceLocation getSkinTexture() {
ResourceLocation skin = super.getSkinTexture();
if (skin == NO_SKIN) {
// We're a pony, might as well look like one.
return NO_SKIN_PONY;
}
return skin;
}
public void swingArm() {
super.swingArm();
// Fixes the preview model swinging the wrong arm.
// Who's maintaining HDSkins anyway?
swingingHand = EnumHand.MAIN_HAND;
}
}

View file

@ -4,16 +4,20 @@ import com.minelittlepony.MineLittlePony;
import com.minelittlepony.PonyManager;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import com.voxelmodpack.hdskins.gui.EntityPlayerModel;
import com.voxelmodpack.hdskins.gui.GuiSkins;
import net.minecraft.util.ResourceLocation;
/**
* Skin uploading GUI. Usually displayed over the main menu.
*/
public class GuiSkinsMineLP extends GuiSkins {
private PonyManager ponyManager;
public GuiSkinsMineLP(PonyManager manager) {
this.ponyManager = manager;
ponyManager = manager;
}
@Override
@ -22,26 +26,26 @@ public class GuiSkinsMineLP extends GuiSkins {
}
@Override
protected void onSetLocalSkin(MinecraftProfileTexture.Type type) {
protected void onSetLocalSkin(Type type) {
MineLittlePony.logger.debug("Invalidating old local skin, checking updated local skin");
if (type == MinecraftProfileTexture.Type.SKIN) {
ponyManager.removePony(this.localPlayer.getSkinTexture());
if (type == Type.SKIN) {
ponyManager.removePony(localPlayer.getSkinTexture());
}
}
@Override
protected void onSetRemoteSkin(MinecraftProfileTexture.Type type, ResourceLocation location, MinecraftProfileTexture profileTexture) {
protected void onSetRemoteSkin(Type type, ResourceLocation resource, MinecraftProfileTexture profileTexture) {
MineLittlePony.logger.debug("Invalidating old remote skin, checking updated remote skin");
if (type == MinecraftProfileTexture.Type.SKIN) {
ponyManager.removePony(location);
if (type == Type.SKIN) {
ponyManager.removePony(resource);
}
}
@Override
public void onGuiClosed() {
super.onGuiClosed();
ponyManager.removePony(this.localPlayer.getSkinTexture());
ponyManager.removePony(this.remotePlayer.getSkinTexture());
ponyManager.removePony(localPlayer.getSkinTexture());
ponyManager.removePony(remotePlayer.getSkinTexture());
}
}

View file

@ -1,13 +1,15 @@
package com.minelittlepony.hdskins.gui;
import com.minelittlepony.MineLittlePony;
import com.minelittlepony.Pony;
import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.ModelPonyElytra;
import com.minelittlepony.model.PlayerModel;
import com.minelittlepony.renderer.layer.AbstractPonyLayer;
import com.minelittlepony.PonyManager;
import com.minelittlepony.model.ModelWrapper;
import com.minelittlepony.model.components.PonyElytra;
import com.minelittlepony.pony.data.Pony;
import com.minelittlepony.render.layer.AbstractPonyLayer;
import com.voxelmodpack.hdskins.gui.RenderPlayerModel;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelElytra;
import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderManager;
@ -18,53 +20,67 @@ import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
/**
* Renderer used for the dummy pony model when selecting a skin.
*/
public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> {
public RenderPonyModel(RenderManager renderer) {
super(renderer);
boolean renderingAsHuman = false;
public RenderPonyModel(RenderManager manager) {
super(manager);
}
@Override
public ModelPlayer getEntityModel(EntityPonyModel playermodel) {
ResourceLocation loc = this.getEntityTexture(playermodel);
renderingAsHuman = true;
ResourceLocation loc = getEntityTexture(playermodel);
if (loc == null) {
return super.getEntityModel(playermodel);
}
Pony thePony = MineLittlePony.getInstance().getManager().getPony(loc);
// TODO small arms
PlayerModel pm = thePony.getModel(true, false);
// TODO: We can't find out whether to use thin arms just by the texture.
// Maybe a trigger pixel for thin arms? #FutureThoughts
Pony thePony = MineLittlePony.getInstance().getManager().getPony(loc, PonyManager.isSlimSkin(playermodel.profile.getId()));
if (thePony.getRace(false).isHuman()) {
return super.getEntityModel(playermodel);
}
ModelWrapper pm = thePony.getModel(true);
pm.apply(thePony.getMetadata());
renderingAsHuman = false;
return pm.getModel();
}
@Override
protected LayerRenderer<EntityLivingBase> getElytraLayer() {
final LayerRenderer<EntityLivingBase> elytra = super.getElytraLayer();
final ModelPonyElytra modelElytra = new ModelPonyElytra();
return new AbstractPonyLayer<EntityLivingBase>(this, elytra) {
return new AbstractPonyLayer<EntityPonyModel>(this) {
final PonyElytra ponyElytra = new PonyElytra();
final ModelElytra modelElytra = new ModelElytra();
@Override
public void doPonyRender(EntityLivingBase entityBase, float swing, float swingAmount, float ticks, float age, float yaw, float head,
float scale) {
EntityPonyModel entity = (EntityPonyModel) entityBase;
public void doPonyRender(EntityPonyModel entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
if (itemstack.getItem() == Items.ELYTRA) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.color(1, 1, 1, 1);
bindTexture(entity.getElytraTexture());
GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, 0.25F, 0.125F);
((AbstractPonyModel) mainModel).transform(BodyPart.BODY);
modelElytra.setRotationAngles(swing, swingAmount, age, yaw, head, scale, entity);
modelElytra.render(entity, swing, swingAmount, age, yaw, head, scale);
ModelBase model = renderingAsHuman ? modelElytra : ponyElytra;
if (!renderingAsHuman) {
GlStateManager.translate(0, 0.25F, 0.125F);
}
model.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
model.render(entity, move, swing, ticks, headYaw, headPitch, scale);
GlStateManager.popMatrix();
}

View file

@ -0,0 +1,31 @@
package com.minelittlepony.mixin;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.minelittlepony.MineLittlePony;
import com.minelittlepony.PonyManager;
import com.minelittlepony.ducks.IPlayerInfo;
import net.minecraft.client.network.NetworkPlayerInfo;
@Mixin(NetworkPlayerInfo.class)
public abstract class MixinNetworkPlayerInfo implements IPlayerInfo {
@Shadow
private String skinType;
@Inject(method = "getSkinType()Ljava/lang/String;", at = @At("RETURN"), cancellable = true)
private void getSkinType(CallbackInfoReturnable<String> info) {
info.setReturnValue(MineLittlePony.getInstance().getManager().getPony(unwrap()).getRace(false).getModel().getId(usesSlimArms()));
}
@Override
public boolean usesSlimArms() {
if (skinType == null) return PonyManager.isSlimSkin(unwrap().getGameProfile().getId());
return "slim".equals(skinType);
}
}

View file

@ -2,42 +2,32 @@ package com.minelittlepony.mixin;
import com.minelittlepony.ducks.IRenderItem;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.GlStateManager.DestFactor;
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.resources.IResourceManagerReloadListener;
import org.spongepowered.asm.mixin.Implements;
import org.spongepowered.asm.mixin.Interface;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value = RenderItem.class)
@Implements( value = @Interface(iface = IRenderItem.class, prefix = "mlp$") )
@Mixin(RenderItem.class)
public abstract class MixinRenderItem implements IResourceManagerReloadListener, IRenderItem {
private static final String ItemStack = "Lnet/minecraft/item/ItemStack;";
private static final String IBakedModel = "Lnet/minecraft/client/renderer/block/model/IBakedModel;";
private static final String ItemCameraTransform$TransformType = "Lnet/minecraft/client/renderer/block/model/ItemCameraTransforms$TransformType;";
private static final String GlStateManager$SourceFactor = "Lnet/minecraft/client/renderer/GlStateManager$SourceFactor;";
private static final String GlStateManager$DestFactor = "Lnet/minecraft/client/renderer/GlStateManager$DestFactor;";
private boolean transparency;
public void mlp$useTransparency(boolean transparency) {
@Override
public void useTransparency(boolean transparency) {
this.transparency = transparency;
}
@Redirect(method = "renderItemModel(" + ItemStack + IBakedModel + ItemCameraTransform$TransformType + "Z)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/GlStateManager;tryBlendFuncSeparate("
+ GlStateManager$SourceFactor + GlStateManager$DestFactor
+ GlStateManager$SourceFactor + GlStateManager$DestFactor + ")V"))
private void redirectBlendFunc(GlStateManager.SourceFactor srcFactor, GlStateManager.DestFactor dstFactor,
GlStateManager.SourceFactor srcFactorAlpha, GlStateManager.DestFactor dstFactorAlpha) {
@Inject(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/renderer/block/model/IBakedModel;)V", at = @At("HEAD"))
private void onRenderItem(ItemStack stack, IBakedModel model, CallbackInfo info) {
if (transparency) {
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.CONSTANT_COLOR, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
} else {
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.tryBlendFuncSeparate(SourceFactor.CONSTANT_COLOR, DestFactor.ONE, SourceFactor.ONE, DestFactor.ZERO);
}
}
}

View file

@ -0,0 +1,15 @@
package com.minelittlepony.mixin;
import java.util.Map;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
@Mixin(RenderManager.class)
public interface MixinRenderManager {
@Accessor
Map<String, RenderPlayer> getSkinMap();
}

View file

@ -1,261 +0,0 @@
package com.minelittlepony.mixin;
import com.minelittlepony.MineLittlePony;
import com.minelittlepony.Pony;
import com.minelittlepony.PonyRace;
import com.minelittlepony.PonySize;
import com.minelittlepony.ducks.IRenderPony;
import com.minelittlepony.model.PMAPI;
import com.minelittlepony.model.PlayerModel;
import com.minelittlepony.model.pony.ModelHumanPlayer;
import com.minelittlepony.model.pony.ModelPlayerPony;
import com.minelittlepony.renderer.layer.LayerEntityOnPonyShoulder;
import com.minelittlepony.renderer.layer.LayerHeldPonyItem;
import com.minelittlepony.renderer.layer.LayerPonyArmor;
import com.minelittlepony.renderer.layer.LayerPonyCape;
import com.minelittlepony.renderer.layer.LayerPonyCustomHead;
import com.minelittlepony.renderer.layer.LayerPonyElytra;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderLivingBase;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.layers.LayerArrow;
import net.minecraft.util.ResourceLocation;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.At.Shift;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(RenderPlayer.class)
public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientPlayer> implements IRenderPony {
@Shadow
@Final
private boolean smallArms;
private PlayerModel playerModel;
private Pony thePony;
@SuppressWarnings("ConstantConditions")
private MixinRenderPlayer(RenderManager renderManager) {
super(renderManager, null, 0.5F);
}
@Inject(
method = "<init>(Lnet/minecraft/client/renderer/entity/RenderManager;Z)V",
at = @At("RETURN"))
private void init(RenderManager renderManager, boolean useSmallArms, CallbackInfo ci) {
this.playerModel = smallArms ? PMAPI.ponySmall : PMAPI.pony;
this.mainModel = this.playerModel.getModel();
this.layerRenderers.clear();
this.addLayer(new LayerPonyArmor(this));
this.addLayer(new LayerHeldPonyItem(this));
this.addLayer(new LayerArrow(this));
this.addLayer(new LayerPonyCape(this));
this.addLayer(new LayerPonyCustomHead(this));
this.addLayer(new LayerPonyElytra(this));
this.addLayer(new LayerEntityOnPonyShoulder(renderManager, this));
}
@Inject(
method = "doRender(Lnet/minecraft/client/entity/AbstractClientPlayer;DDDFF)V",
at = @At("HEAD"))
private void onDoRender(AbstractClientPlayer player, double x, double y, double z, float yaw, float partialTicks, CallbackInfo ci) {
updateModel(player);
this.playerModel.getModel().isSneak = player.isSneaking();
this.playerModel.getModel().isFlying = thePony.isPegasusFlying(player);
this.playerModel.getModel().isSleeping = player.isPlayerSleeping();
if (MineLittlePony.getConfig().showscale && this.playerModel.getModel().metadata.getRace() != PonyRace.HUMAN) {
PonySize size = thePony.getMetadata().getSize();
if (size == PonySize.FOAL) {
this.shadowSize = 0.25F;
} else if (size == PonySize.NORMAL) {
this.shadowSize = 0.4F;
} else if (size == PonySize.TALL) {
this.shadowSize = 0.45F;
} else {
this.shadowSize = 0.5F;
}
} else {
this.shadowSize = 0.5F;
}
}
@Inject(
method = "renderLivingAt(Lnet/minecraft/client/entity/AbstractClientPlayer;DDD)V",
at = @At("RETURN"))
private void setupPlayerScale(AbstractClientPlayer player, double xPosition, double yPosition, double zPosition, CallbackInfo ci) {
if (MineLittlePony.getConfig().showscale && !(playerModel.getModel() instanceof ModelHumanPlayer)) {
PonySize size = thePony.getMetadata().getSize();
if (size == PonySize.LARGE) {
GlStateManager.scale(0.9F, 0.9F, 0.9F);
} else if (size == PonySize.NORMAL || size == PonySize.FOAL) {
GlStateManager.scale(0.8F, 0.8F, 0.8F);
}
}
}
@Inject(
method = "renderRightArm(Lnet/minecraft/client/entity/AbstractClientPlayer;)V",
at = @At("HEAD"))
private void onRenderRightArm(AbstractClientPlayer player, CallbackInfo ci) {
updateModel(player);
bindEntityTexture(player);
}
@Inject(
method = "renderLeftArm(Lnet/minecraft/client/entity/AbstractClientPlayer;)V",
at = @At("HEAD"))
private void onRenderLeftArm(AbstractClientPlayer player, CallbackInfo ci) {
updateModel(player);
bindEntityTexture(player);
}
@Redirect(
method = "renderLeftArm(Lnet/minecraft/client/entity/AbstractClientPlayer;)V",
at = @At(
value = "FIELD",
target = "Lnet/minecraft/client/model/ModelPlayer;bipedLeftArm:Lnet/minecraft/client/model/ModelRenderer;",
opcode = Opcodes.GETFIELD),
require = 2)
private ModelRenderer redirectLeftArm(ModelPlayer mr) {
return this.playerModel.getModel().steveLeftArm;
}
@Redirect(
method = "renderLeftArm(Lnet/minecraft/client/entity/AbstractClientPlayer;)V",
at = @At(
value = "FIELD",
target = "Lnet/minecraft/client/model/ModelPlayer;bipedLeftArmwear:Lnet/minecraft/client/model/ModelRenderer;",
opcode = Opcodes.GETFIELD),
require = 2)
private ModelRenderer redirectLeftArmwear(ModelPlayer mr) {
return this.playerModel.getModel().steveLeftArmwear;
}
@Redirect(
method = "renderRightArm(Lnet/minecraft/client/entity/AbstractClientPlayer;)V",
at = @At(
value = "FIELD",
target = "Lnet/minecraft/client/model/ModelPlayer;bipedRightArm:Lnet/minecraft/client/model/ModelRenderer;",
opcode = Opcodes.GETFIELD),
require = 2)
private ModelRenderer redirectRightArm(ModelPlayer mr) {
return this.playerModel.getModel().steveRightArm;
}
@Redirect(
method = "renderRightArm(Lnet/minecraft/client/entity/AbstractClientPlayer;)V",
at = @At(
value = "FIELD",
target = "Lnet/minecraft/client/model/ModelPlayer;bipedRightArmwear:Lnet/minecraft/client/model/ModelRenderer;",
opcode = Opcodes.GETFIELD),
require = 2)
private ModelRenderer redirectRightArmwear(ModelPlayer mr) {
return this.playerModel.getModel().steveRightArmwear;
}
@Inject(
method = "applyRotations(Lnet/minecraft/client/entity/AbstractClientPlayer;FFF)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/entity/RenderLivingBase;"
+ "applyRotations(Lnet/minecraft/entity/EntityLivingBase;FFF)V",
ordinal = 1,
shift = Shift.AFTER))
private void onRotateCorpse(AbstractClientPlayer player, float yaw, float pitch, float ticks, CallbackInfo ci) {
if (this.mainModel instanceof ModelPlayerPony) {
// require arms to be stretched out (sorry mud ponies, no flight
// skills for you)
if (!((ModelPlayerPony) this.mainModel).rainboom) {
this.playerModel.getModel().motionPitch = 0;
return;
}
double motionX = player.posX - player.prevPosX;
double motionY = player.posY - player.prevPosY;
double motionZ = player.posZ - player.prevPosZ;
if (player.onGround) {
motionY = 0;
}
double dist = Math.sqrt(motionX * motionX + motionZ * motionZ);
double angle = Math.atan2(motionY, dist);
if (!player.capabilities.isFlying) {
if (angle > 0) {
angle = 0;
} else {
angle /= 2;
}
}
if (angle > Math.PI / 3) {
angle = Math.PI / 3;
}
if (angle < -Math.PI / 3) {
angle = -Math.PI / 3;
}
this.playerModel.getModel().motionPitch = (float) Math.toDegrees(angle);
GlStateManager.rotate((float) Math.toDegrees(angle), 1F, 0F, 0F);
}
}
@Redirect(
method = "applyRotations(Lnet/minecraft/client/entity/AbstractClientPlayer;FFF)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/GlStateManager;rotate(FFFF)V",
ordinal = 3))
private void rotateRedirect(float f1, float f2, float f3, float f4) {
boolean isPony = this.playerModel.getModel() instanceof ModelPlayerPony;
if (isPony) {
f1 += 90;
}
GlStateManager.rotate(f1, f2, f3, f4);
if (isPony) {
GlStateManager.translate(0, -1, 0);
}
}
private void updateModel(AbstractClientPlayer player) {
this.thePony = MineLittlePony.getInstance().getManager().getPony(player);
this.playerModel = this.getModel(player);
this.mainModel = this.playerModel.getModel();
this.playerModel.apply(thePony.getMetadata());
}
@Redirect(
method = "getEntityTexture(Lnet/minecraft/client/entity/AbstractClientPlayer;)Lnet/minecraft/util/ResourceLocation;",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/AbstractClientPlayer;getLocationSkin()Lnet/minecraft/util/ResourceLocation;"))
private ResourceLocation redirectEntityTexture(AbstractClientPlayer player) {
Pony thePony = MineLittlePony.getInstance().getManager().getPony(player);
return thePony.getTexture();
}
private PlayerModel getModel(AbstractClientPlayer player) {
ResourceLocation skin = getEntityTexture(player);
Pony thePony = MineLittlePony.getInstance().getManager().getPony(skin);
return thePony.getModel(false, this.smallArms);
}
@Override
public PlayerModel getPony() {
return this.playerModel;
}
}

View file

@ -0,0 +1,14 @@
package com.minelittlepony.mixin;
import java.awt.image.BufferedImage;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import net.minecraft.client.renderer.ThreadDownloadImageData;
@Mixin(ThreadDownloadImageData.class)
public interface MixinThreadDownloadImageData {
@Accessor("bufferedImage")
BufferedImage getBufferedImage();
}

View file

@ -1,15 +0,0 @@
package com.minelittlepony.model;
import com.minelittlepony.PonyData;
public abstract class AbstractArmor {
public AbstractPonyModel modelArmorChestplate;
public AbstractPonyModel modelArmor;
public void apply(PonyData meta) {
modelArmorChestplate.metadata = meta;
modelArmor.metadata = meta;
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,82 +0,0 @@
package com.minelittlepony.model;
import com.minelittlepony.renderer.HornGlowRenderer;
import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.PositionTextureVertex;
import net.minecraft.client.model.TexturedQuad;
import net.minecraft.client.renderer.BufferBuilder;
import javax.annotation.Nonnull;
public class ModelHornGlow extends ModelBox {
private TexturedQuad[] quadList;
public ModelHornGlow(HornGlowRenderer par1ModelRenderer, int par2, int par3, float par4, float par5, float par6, int par7, int par8, int par9, float par10) {
super(par1ModelRenderer, par2, par3, par4, par5, par6, par7, par8, par9, par10);
this.quadList = new TexturedQuad[6];
float var11 = par4 + par7;
float var12 = par5 + par8;
float var13 = par6 + par9;
float halfpar4 = par4 + par7 * 0.05F;
float halfpar6 = par6 + par9 * 0.05F;
float halfvar11 = par4 + par7 * 0.95F;
float halfvar13 = par6 + par9 * 0.95F;
par4 -= par10;
par5 -= par10;
par6 -= par10;
var11 += par10;
var12 += par10;
var13 += par10;
if (par1ModelRenderer.mirror) {
float var26 = var11;
var11 = par4;
par4 = var26;
}
PositionTextureVertex var32 = new PositionTextureVertex(halfpar4, par5, halfpar6, 0.0F, 0.0F);
PositionTextureVertex var15 = new PositionTextureVertex(halfvar11, par5, halfpar6, 0.0F, 8.0F);
PositionTextureVertex var16 = new PositionTextureVertex(var11, var12, par6, 8.0F, 8.0F);
PositionTextureVertex var17 = new PositionTextureVertex(par4, var12, par6, 8.0F, 0.0F);
PositionTextureVertex var18 = new PositionTextureVertex(halfpar4, par5, halfvar13, 0.0F, 0.0F);
PositionTextureVertex var19 = new PositionTextureVertex(halfvar11, par5, halfvar13, 0.0F, 8.0F);
PositionTextureVertex var20 = new PositionTextureVertex(var11, var12, var13, 8.0F, 8.0F);
PositionTextureVertex var21 = new PositionTextureVertex(par4, var12, var13, 8.0F, 0.0F);
this.quadList[0] = new TexturedQuad(new PositionTextureVertex[]{var19, var15, var16, var20},
par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par9, par3 + par9 + par8,
par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
this.quadList[1] = new TexturedQuad(new PositionTextureVertex[]{var32, var18, var21, var17}, par2,
par3 + par9, par2 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth,
par1ModelRenderer.textureHeight);
this.quadList[2] = new TexturedQuad(new PositionTextureVertex[]{var19, var18, var32, var15}, par2 + par9,
par3, par2 + par9 + par7, par3 + par9, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
this.quadList[3] = new TexturedQuad(new PositionTextureVertex[]{var16, var17, var21, var20},
par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par7, par3, par1ModelRenderer.textureWidth,
par1ModelRenderer.textureHeight);
this.quadList[4] = new TexturedQuad(new PositionTextureVertex[]{var15, var32, var17, var16}, par2 + par9,
par3 + par9, par2 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth,
par1ModelRenderer.textureHeight);
this.quadList[5] = new TexturedQuad(new PositionTextureVertex[]{var18, var19, var20, var21},
par2 + par9 + par7 + par9, par3 + par9, par2 + par9 + par7 + par9 + par7, par3 + par9 + par8,
par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
if (par1ModelRenderer.mirror) {
TexturedQuad[] var22 = this.quadList;
for (TexturedQuad var25 : var22) {
var25.flipFace();
}
}
}
@Override
public void render(@Nonnull BufferBuilder buffer, float par2) {
TexturedQuad[] var3 = this.quadList;
for (TexturedQuad var6 : var3) {
var6.draw(buffer, par2);
}
}
}

View file

@ -0,0 +1,45 @@
package com.minelittlepony.model;
import com.minelittlepony.model.player.ModelAlicorn;
import net.minecraft.util.math.MathHelper;
/**
* Common class for all humanoid (ponioid?) non-player enemies.
*
*/
public class ModelMobPony extends ModelAlicorn {
public ModelMobPony() {
super(false);
}
/**
* Returns true if the angle is to the right?
*/
public boolean islookAngleRight(float move) {
return MathHelper.sin(move / 20) < 0;
}
@Override
protected void adjustLegs(float move, float swing, float ticks) {
super.adjustLegs(move, swing, ticks);
if (rightArmPose != ArmPose.EMPTY) {
if (canCast()) {
unicornArmRight.setRotationPoint(-7, 12, -2);
rotateArmHolding(unicornArmRight, -1, swingProgress, ticks);
} else {
rotateArmHolding(bipedRightArm, -1, swingProgress, ticks);
}
}
if (leftArmPose != ArmPose.EMPTY) {
if (!canCast()) {
unicornArmRight.setRotationPoint(-7, 12, -2);
rotateArmHolding(unicornArmLeft, -1, swingProgress, ticks);
} else {
rotateArmHolding(bipedLeftArm, -1, swingProgress, ticks);
}
}
}
}

View file

@ -1,119 +0,0 @@
package com.minelittlepony.model;
import com.minelittlepony.renderer.PlaneRenderer;
import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.PositionTextureVertex;
import net.minecraft.client.model.TexturedQuad;
import net.minecraft.client.renderer.BufferBuilder;
import javax.annotation.Nonnull;
public class ModelPlane extends ModelBox {
private TexturedQuad[] quadList;
private final Face face;
public ModelPlane(PlaneRenderer renderer, int textureX, int textureY,
float x, float y, float z, int w, int h, int d,
float scale, Face face) {
super(renderer, textureX, textureY, x, y, z, w, h, d, scale, false);
this.face = face;
this.quadList = new TexturedQuad[6];
float x2 = x + w;
float y2 = y + h;
float z2 = z + d;
x -= scale;
y -= scale;
z -= scale;
x2 += scale;
y2 += scale;
z2 += scale;
if (renderer.mirror) {
float v = x2;
x2 = x;
x = v;
}
if (renderer.mirrory) {
float v = y2;
y2 = y;
y = v;
}
if (renderer.mirrorz) {
float v = z2;
z2 = z;
z = v;
}
// w:west e:east d:down u:up s:south n:north
PositionTextureVertex wds = new PositionTextureVertex(x, y, z, 0.0F, 0.0F);
PositionTextureVertex eds = new PositionTextureVertex(x2, y, z, 0.0F, 8.0F);
PositionTextureVertex eus = new PositionTextureVertex(x2, y2, z, 8.0F, 8.0F);
PositionTextureVertex wus = new PositionTextureVertex(x, y2, z, 8.0F, 0.0F);
PositionTextureVertex wdn = new PositionTextureVertex(x, y, z2, 0.0F, 0.0F);
PositionTextureVertex edn = new PositionTextureVertex(x2, y, z2, 0.0F, 8.0F);
PositionTextureVertex eun = new PositionTextureVertex(x2, y2, z2, 8.0F, 8.0F);
PositionTextureVertex wun = new PositionTextureVertex(x, y2, z2, 8.0F, 0.0F);
// east
this.quadList[0] = new TexturedQuad(
new PositionTextureVertex[]{edn, eds, eus, eun},
textureX, textureY,
textureX + d, textureY + h,
renderer.textureWidth, renderer.textureHeight);
// west
this.quadList[1] = new TexturedQuad(
new PositionTextureVertex[]{wds, wdn, wun, wus},
textureX, textureY,
textureX + d, textureY + h,
renderer.textureWidth, renderer.textureHeight);
// down
this.quadList[3] = new TexturedQuad(
new PositionTextureVertex[]{edn, wdn, wds, eds},
textureX, textureY,
textureX + w, textureY + d,
renderer.textureWidth, renderer.textureHeight);
// up
this.quadList[2] = new TexturedQuad(
new PositionTextureVertex[]{eus, wus, wun, eun},
textureX, textureY,
textureX + w, textureY + d,
renderer.textureWidth, renderer.textureHeight);
// south
this.quadList[4] = new TexturedQuad(
new PositionTextureVertex[]{eds, wds, wus, eus},
textureX, textureY,
textureX + w, textureY + h,
renderer.textureWidth, renderer.textureHeight);
// north
this.quadList[5] = new TexturedQuad(
new PositionTextureVertex[]{wdn, edn, eun, wun},
textureX, textureY,
textureX + w, textureY + h,
renderer.textureWidth, renderer.textureHeight);
if (renderer.mirror || renderer.mirrory || renderer.mirrorz) {
for (TexturedQuad texturedquad : this.quadList) {
texturedquad.flipFace();
}
}
}
@Override
public void render(@Nonnull BufferBuilder renderer, float scale) {
this.quadList[this.face.ordinal()].draw(renderer, scale);
}
public enum Face {
EAST,
WEST,
DOWN,
UP,
SOUTH,
NORTH
}
}

View file

@ -1,80 +0,0 @@
package com.minelittlepony.model;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.math.Vec3d;
public class ModelPonyElytra extends ModelBase {
private ModelRenderer rightWing;
private ModelRenderer leftWing = new ModelRenderer(this, 22, 0);
public ModelPonyElytra() {
this.leftWing.addBox(-10.0F, 0.0F, 0.0F, 10, 20, 2, 1.0F);
this.rightWing = new ModelRenderer(this, 22, 0);
this.rightWing.mirror = true;
this.rightWing.addBox(0.0F, 0.0F, 0.0F, 10, 20, 2, 1.0F);
}
@Override
public void render(Entity entityIn, float p_78088_2_, float limbSwing, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
GlStateManager.disableRescaleNormal();
GlStateManager.disableCull();
this.leftWing.render(scale);
this.rightWing.render(scale);
}
@Override
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {
super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
final float PI = (float) Math.PI;
float rotateX = PI / 2F;
float rotateZ = PI / 12;
float rpY = PonyModelConstants.BODY_RP_Y_NOTSNEAK;
float rotateY = PI / 8F;
if (entityIn instanceof EntityLivingBase && ((EntityLivingBase) entityIn).isElytraFlying()) {
float f4 = 1.0F;
if (entityIn.motionY < 0.0D) {
Vec3d vec3d = (new Vec3d(entityIn.motionX, entityIn.motionY, entityIn.motionZ)).normalize();
f4 = 1.0F - (float) Math.pow(-vec3d.y, 1.5D);
}
rotateX = f4 * PI * (2 / 3F) + (1.0F - f4) * rotateX;
rotateY = f4 * ((float) Math.PI / 2F) + (1.0F - f4) * rotateY;
} else if (entityIn.isSneaking()) {
rotateX = ((float) Math.PI * 1.175F);
rotateY = PI / 2;
rpY = PonyModelConstants.BODY_RP_Y_SNEAK;
rotateZ = PI / 4F;
}
this.leftWing.rotationPointX = 5.0F;
this.leftWing.rotationPointY = rpY;
if (entityIn instanceof AbstractClientPlayer) {
AbstractClientPlayer abstractclientplayer = (AbstractClientPlayer) entityIn;
abstractclientplayer.rotateElytraX = (float) (abstractclientplayer.rotateElytraX + (rotateX - abstractclientplayer.rotateElytraX) * 0.1D);
abstractclientplayer.rotateElytraY = (float) (abstractclientplayer.rotateElytraY + (rotateY - abstractclientplayer.rotateElytraY) * 0.1D);
abstractclientplayer.rotateElytraZ = (float) (abstractclientplayer.rotateElytraZ + (rotateZ - abstractclientplayer.rotateElytraZ) * 0.1D);
this.leftWing.rotateAngleX = abstractclientplayer.rotateElytraX;
this.leftWing.rotateAngleY = abstractclientplayer.rotateElytraY;
this.leftWing.rotateAngleZ = abstractclientplayer.rotateElytraZ;
} else {
this.leftWing.rotateAngleX = rotateX;
this.leftWing.rotateAngleZ = rotateZ;
this.leftWing.rotateAngleY = rotateY;
}
this.rightWing.rotationPointX = -this.leftWing.rotationPointX;
this.rightWing.rotateAngleY = -this.leftWing.rotateAngleY;
this.rightWing.rotationPointY = this.leftWing.rotationPointY;
this.rightWing.rotateAngleX = this.leftWing.rotateAngleX;
this.rightWing.rotateAngleZ = -this.leftWing.rotateAngleZ;
}
}

View file

@ -0,0 +1,45 @@
package com.minelittlepony.model;
import com.minelittlepony.model.armour.PonyArmor;
import com.minelittlepony.model.capabilities.IModelWrapper;
import com.minelittlepony.pony.data.IPonyData;
/**
* Container class for the various models and their associated piece of armour.
*/
public class ModelWrapper implements IModelWrapper {
private final AbstractPonyModel model;
private final PonyArmor armor;
/**
* Created a new model wrapper to contain the given pony.
*/
public ModelWrapper(AbstractPonyModel model) {
this.model = model;
armor = model.createArmour();
armor.apply(model.metadata);
}
public AbstractPonyModel getModel() {
return model;
}
/**
* Returns the contained armour model.
* @return
*/
public PonyArmor getArmor() {
return armor;
}
public void apply(IPonyData meta) {
model.metadata = meta;
armor.apply(meta);
}
public void init() {
model.init(0, 0);
armor.init();
}
}

View file

@ -1,33 +1,45 @@
package com.minelittlepony.model;
import com.minelittlepony.model.pony.ModelHumanPlayer;
import com.minelittlepony.model.pony.ModelIllagerPony;
import com.minelittlepony.model.pony.ModelPlayerPony;
import com.minelittlepony.model.pony.ModelSkeletonPony;
import com.minelittlepony.model.pony.ModelVillagerPony;
import com.minelittlepony.model.pony.ModelZombiePony;
import com.minelittlepony.model.pony.armor.HumanArmors;
import com.minelittlepony.model.pony.armor.PonyArmors;
import com.minelittlepony.model.pony.armor.SkeletonPonyArmors;
import com.minelittlepony.model.pony.armor.ZombiePonyArmors;
import com.minelittlepony.model.player.ModelAlicorn;
import com.minelittlepony.model.player.ModelEarthPony;
import com.minelittlepony.model.player.ModelPegasus;
import com.minelittlepony.model.ponies.ModelIllagerPony;
import com.minelittlepony.model.ponies.ModelSkeletonPony;
import com.minelittlepony.model.ponies.ModelVillagerPony;
import com.minelittlepony.model.ponies.ModelWitchPony;
import com.minelittlepony.model.ponies.ModelZombiePony;
import java.lang.reflect.Field;
/**
* PMAPI - Pony Models API?
*
* TODO: Remove this, move the models to where they're being used.
*/
public final class PMAPI {
public static final PlayerModel pony = new PlayerModel(new ModelPlayerPony(false)).setArmor(new PonyArmors());
public static final PlayerModel ponySmall = new PlayerModel(new ModelPlayerPony(true)).setArmor(new PonyArmors());
public static final PlayerModel zombie = new PlayerModel(new ModelZombiePony()).setArmor(new ZombiePonyArmors());
public static final PlayerModel skeleton = new PlayerModel(new ModelSkeletonPony()).setArmor(new SkeletonPonyArmors());
public static final PlayerModel villager = new PlayerModel(new ModelVillagerPony()).setArmor(new PonyArmors());
public static final PlayerModel illager = new PlayerModel(new ModelIllagerPony()).setArmor(new PonyArmors());
public static final PlayerModel human = new PlayerModel(new ModelHumanPlayer(false)).setArmor(new HumanArmors());
public static final PlayerModel humanSmall = new PlayerModel(new ModelHumanPlayer(true)).setArmor(new HumanArmors());
public static final ModelWrapper pony = new ModelWrapper(new ModelAlicorn(false));
public static final ModelWrapper ponySmall = new ModelWrapper(new ModelAlicorn(true));
public static final ModelWrapper earthpony = new ModelWrapper(new ModelEarthPony(false));
public static final ModelWrapper earthponySmall = new ModelWrapper(new ModelEarthPony(true));
public static final ModelWrapper pegasus = new ModelWrapper(new ModelPegasus(false));
public static final ModelWrapper pegasusSmall = new ModelWrapper(new ModelPegasus(true));
public static final ModelWrapper alicorn = new ModelWrapper(new ModelAlicorn(false));
public static final ModelWrapper alicornSmall = new ModelWrapper(new ModelAlicorn(true));
public static final ModelWrapper zombie = new ModelWrapper(new ModelZombiePony());
public static final ModelWrapper skeleton = new ModelWrapper(new ModelSkeletonPony());
public static final ModelWrapper villager = new ModelWrapper(new ModelVillagerPony());
public static final ModelWrapper illager = new ModelWrapper(new ModelIllagerPony());
public static final ModelWrapper witch = new ModelWrapper(new ModelWitchPony());
public static void init() {
for (Field field : PMAPI.class.getFields()) {
try {
PlayerModel model = (PlayerModel) field.get(null);
ModelWrapper model = (ModelWrapper) field.get(null);
model.init();
} catch (Exception e) {
e.printStackTrace();

View file

@ -1,183 +0,0 @@
package com.minelittlepony.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;
public class PegasusWings extends ModelBase implements PonyModelConstants {
private final AbstractPonyModel pony;
public ModelRenderer[] leftWing;
public ModelRenderer[] rightWing;
public ModelRenderer[] leftWingExt;
public ModelRenderer[] rightWingExt;
public PegasusWings(AbstractPonyModel pony, float yOffset, float stretch) {
this.pony = pony;
this.leftWing = new ModelRenderer[3];
this.rightWing = new ModelRenderer[3];
this.leftWingExt = new ModelRenderer[6];
this.rightWingExt = new ModelRenderer[6];
for (int i = 0; i < leftWing.length; i++) {
this.leftWing[i] = new ModelRenderer(pony, 56, 32);
this.pony.boxList.remove(this.leftWing[i]);
}
for (int i = 0; i < rightWing.length; i++) {
this.rightWing[i] = new ModelRenderer(pony, 56, 16);
this.pony.boxList.remove(this.rightWing[i]);
}
for (int i = 0; i < leftWingExt.length; i++) {
this.leftWingExt[i] = new ModelRenderer(pony, 56, 35);
this.pony.boxList.remove(this.leftWingExt[i]);
}
for (int i = 0; i < rightWingExt.length; i++) {
this.rightWingExt[i] = new ModelRenderer(pony, 56, 19);
// this seems to hide the wings being a different size when folded
this.rightWingExt[i].mirror = true;
this.pony.boxList.remove(this.rightWingExt[i]);
}
this.leftWing[0].addBox(4.0F, 5.0F, 2.0F, 2, 6, 2, stretch);
this.leftWing[0].setRotationPoint(HEAD_RP_X, WING_FOLDED_RP_Y + yOffset, WING_FOLDED_RP_Z);
this.leftWing[0].rotateAngleX = ROTATE_90;
this.leftWing[1].addBox(4.0F, 5.0F, 4.0F, 2, 8, 2, stretch);
this.leftWing[1].setRotationPoint(HEAD_RP_X, WING_FOLDED_RP_Y + yOffset, WING_FOLDED_RP_Z);
this.leftWing[1].rotateAngleX = ROTATE_90;
this.leftWing[2].addBox(4.0F, 5.0F, 6.0F, 2, 6, 2, stretch);
this.leftWing[2].setRotationPoint(HEAD_RP_X, WING_FOLDED_RP_Y + yOffset, WING_FOLDED_RP_Z);
this.leftWing[2].rotateAngleX = ROTATE_90;
this.rightWing[0].addBox(-6.0F, 5.0F, 2.0F, 2, 6, 2, stretch);
this.rightWing[0].setRotationPoint(HEAD_RP_X, WING_FOLDED_RP_Y + yOffset, WING_FOLDED_RP_Z);
this.rightWing[0].rotateAngleX = ROTATE_90;
this.rightWing[1].addBox(-6.0F, 5.0F, 4.0F, 2, 8, 2, stretch);
this.rightWing[1].setRotationPoint(HEAD_RP_X, WING_FOLDED_RP_Y + yOffset, WING_FOLDED_RP_Z);
this.rightWing[1].rotateAngleX = ROTATE_90;
this.rightWing[2].addBox(-6.0F, 5.0F, 6.0F, 2, 6, 2, stretch);
this.rightWing[2].setRotationPoint(HEAD_RP_X, WING_FOLDED_RP_Y + yOffset, WING_FOLDED_RP_Z);
this.rightWing[2].rotateAngleX = ROTATE_90;
this.leftWingExt[0].addBox(-0.5F, 6.0F, 0.0F, 1, 8, 2, stretch + 0.1F);
this.leftWingExt[0].setRotationPoint(LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + yOffset, LEFT_WING_EXT_RP_Z);
this.leftWingExt[1].addBox(-0.5F, -1.2F, -0.2F, 1, 8, 2, stretch - 0.2F);
this.leftWingExt[1].setRotationPoint(LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + yOffset, LEFT_WING_EXT_RP_Z);
this.leftWingExt[2].addBox(-0.5F, 1.8F, 1.3F, 1, 8, 2, stretch - 0.1F);
this.leftWingExt[2].setRotationPoint(LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + yOffset, LEFT_WING_EXT_RP_Z);
this.leftWingExt[3].addBox(-0.5F, 5.0F, 2.0F, 1, 8, 2, stretch);
this.leftWingExt[3].setRotationPoint(LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + yOffset, LEFT_WING_EXT_RP_Z);
this.leftWingExt[4].addBox(-0.5F, 0.0F, -0.2F, 1, 6, 2, stretch + 0.3F);
this.leftWingExt[4].setRotationPoint(LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + yOffset, LEFT_WING_EXT_RP_Z);
this.leftWingExt[5].addBox(-0.5F, 0.0F, 0.2F, 1, 3, 2, stretch + 0.19F);
this.leftWingExt[5].setRotationPoint(LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + yOffset, LEFT_WING_EXT_RP_Z);
this.rightWingExt[0].addBox(-0.5F, 6.0F, 0.0F, 1, 8, 2, stretch + 0.1F);
this.rightWingExt[0].setRotationPoint(RIGHT_WING_EXT_RP_X, RIGHT_WING_EXT_RP_Y + yOffset, RIGHT_WING_EXT_RP_Z);
this.rightWingExt[1].addBox(-0.5F, -1.2F, -0.2F, 1, 8, 2, stretch - 0.2F);
this.rightWingExt[1].setRotationPoint(RIGHT_WING_EXT_RP_X, RIGHT_WING_EXT_RP_Y + yOffset, RIGHT_WING_EXT_RP_Z);
this.rightWingExt[2].addBox(-0.5F, 1.8F, 1.3F, 1, 8, 2, stretch - 0.1F);
this.rightWingExt[2].setRotationPoint(RIGHT_WING_EXT_RP_X, RIGHT_WING_EXT_RP_Y + yOffset, RIGHT_WING_EXT_RP_Z);
this.rightWingExt[3].addBox(-0.5F, 5.0F, 2.0F, 1, 8, 2, stretch);
this.rightWingExt[3].setRotationPoint(RIGHT_WING_EXT_RP_X, RIGHT_WING_EXT_RP_Y + yOffset, RIGHT_WING_EXT_RP_Z);
this.rightWingExt[4].addBox(-0.5F, 0.0F, -0.2F, 1, 6, 2, stretch + 0.3F);
this.rightWingExt[4].setRotationPoint(RIGHT_WING_EXT_RP_X, RIGHT_WING_EXT_RP_Y + yOffset, RIGHT_WING_EXT_RP_Z);
this.rightWingExt[5].addBox(-0.5F, 0.0F, 0.2F, 1, 3, 2, stretch + 0.19F);
this.rightWingExt[5].setRotationPoint(RIGHT_WING_EXT_RP_X, RIGHT_WING_EXT_RP_Y + yOffset, RIGHT_WING_EXT_RP_Z);
}
@Override
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {
float bodySwingRotation = 0.0F;
if (pony.swingProgress > -9990.0F && !pony.metadata.hasMagic()) {
bodySwingRotation = MathHelper.sin(MathHelper.sqrt(pony.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
}
for (ModelRenderer aLeftWing : this.leftWing) {
aLeftWing.rotateAngleY = bodySwingRotation * 0.2F;
}
for (ModelRenderer aRightWing : this.rightWing) {
aRightWing.rotateAngleY = bodySwingRotation * 0.2F;
}
if (pony.isSneak && !pony.isFlying) {
this.sneak();
} else {
this.unsneak(ageInTicks);
}
float angle = ROTATE_90;
for (ModelRenderer aLeftWing : this.leftWing) {
aLeftWing.rotateAngleX = angle;
}
for (ModelRenderer aRightWing : this.rightWing) {
aRightWing.rotateAngleX = angle;
}
// Special
this.leftWingExt[1].rotateAngleX -= 0.85F;
this.leftWingExt[2].rotateAngleX -= 0.75F;
this.leftWingExt[3].rotateAngleX -= 0.5F;
this.leftWingExt[5].rotateAngleX -= 0.85F;
this.rightWingExt[1].rotateAngleX -= 0.85F;
this.rightWingExt[2].rotateAngleX -= 0.75F;
this.rightWingExt[3].rotateAngleX -= 0.5F;
this.rightWingExt[5].rotateAngleX -= 0.85F;
}
@Override
public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
if (pony.metadata.getRace().hasWings()) {
if (!pony.isFlying && !pony.isSneak) {
for (ModelRenderer aLeftWing : this.leftWing) {
aLeftWing.render(scale);
}
for (ModelRenderer aRightWing : this.rightWing) {
aRightWing.render(scale);
}
} else {
for (ModelRenderer aLeftWingExt : this.leftWingExt) {
aLeftWingExt.render(scale);
}
for (ModelRenderer aRightWingExt : this.rightWingExt) {
aRightWingExt.render(scale);
}
}
}
}
private void sneak() {
for (ModelRenderer aLeftWingExt : this.leftWingExt) {
aLeftWingExt.rotateAngleX = EXT_WING_ROTATE_ANGLE_X;
aLeftWingExt.rotateAngleZ = LEFT_WING_ROTATE_ANGLE_Z_SNEAK;
}
for (int i = 0; i < this.leftWingExt.length; ++i) {
this.rightWingExt[i].rotateAngleX = EXT_WING_ROTATE_ANGLE_X;
this.rightWingExt[i].rotateAngleZ = RIGHT_WING_ROTATE_ANGLE_Z_SNEAK;
}
}
private void unsneak(float tick) {
if (pony.isFlying) {
float WingRotateAngleZ = MathHelper.sin(tick * 0.536F) * 1.0F;
for (ModelRenderer aLeftWingExt : this.leftWingExt) {
aLeftWingExt.rotateAngleX = EXT_WING_ROTATE_ANGLE_X;
aLeftWingExt.rotateAngleZ = -WingRotateAngleZ - ROTATE_270 - 0.4F;
}
for (ModelRenderer aRightWingExt : this.rightWingExt) {
aRightWingExt.rotateAngleX = EXT_WING_ROTATE_ANGLE_X;
aRightWingExt.rotateAngleZ = WingRotateAngleZ + ROTATE_270 + 0.4F;
}
}
}
}

View file

@ -1,38 +0,0 @@
package com.minelittlepony.model;
import com.minelittlepony.PonyData;
public class PlayerModel {
private final AbstractPonyModel model;
private AbstractArmor armor;
public PlayerModel(AbstractPonyModel model) {
this.model = model;
}
public AbstractPonyModel getModel() {
return model;
}
public PlayerModel setArmor(AbstractArmor armor) {
this.armor = armor;
this.armor.apply(model.metadata);
return this;
}
public void init() {
getModel().init(0, 0);
getArmor().modelArmorChestplate.init(0.0F, 1.0F);
getArmor().modelArmor.init(0.0F, 0.5F);
}
public AbstractArmor getArmor() {
return armor;
}
public void apply(PonyData meta) {
model.metadata = meta;
armor.apply(meta);
}
}

View file

@ -1,52 +1,75 @@
package com.minelittlepony.model;
public interface PonyModelConstants {
public final class PonyModelConstants {
float BODY_CENTRE_X = 0.0F;
float BODY_CENTRE_Y = 8.0F;
float BODY_CENTRE_Z = 6.0F;
float BODY_ROTATE_ANGLE_X_NOTSNEAK = 0.0F;
float BODY_ROTATE_ANGLE_X_SNEAK = 0.4F;
float BODY_ROTATE_ANGLE_X_RIDING = (float) (Math.PI * 3.8);
float BODY_RP_Y_NOTSNEAK = 0.0F;
float BODY_RP_Y_SNEAK = 7.0F;
float BODY_RP_Y_RIDING = 1;
float BODY_RP_Z_NOTSNEAK = 0.0F;
float BODY_RP_Z_SNEAK = -4.0F;
float BODY_RP_Z_RIDING = 4F;
float EXT_WING_ROTATE_ANGLE_X = 2.5F;
float FIRSTP_ARM_CENTRE_X = -1.0F;
float FIRSTP_ARM_CENTRE_Y = 4.0F;
float FIRSTP_ARM_CENTRE_Z = 0.0F;
float FRONT_LEG_RP_Y_NOTSNEAK = 8.0F;
float FRONT_LEG_RP_Y_SNEAK = 8.0F;
float HEAD_CENTRE_X = 0.0F;
float HEAD_CENTRE_Y = -1.0F;
float HEAD_CENTRE_Z = -2.0F;
float HEAD_RP_X = 0.0F;
float HEAD_RP_Y = 0.0F;
float HEAD_RP_Z = 0.0F;
float LEFT_WING_EXT_RP_X = 4.5F;
float LEFT_WING_EXT_RP_Y = 5.0F;
float LEFT_WING_EXT_RP_Z = 6.0F;
float LEFT_WING_ROTATE_ANGLE_Z_SNEAK = -6.0F;
float RIGHT_WING_EXT_RP_X = -4.5F;
float RIGHT_WING_EXT_RP_Y = 5.0F;
float RIGHT_WING_EXT_RP_Z = 6.0F;
float RIGHT_WING_ROTATE_ANGLE_Z_SNEAK = 6.0F;
float ROTATE_270 = 4.712F;
float ROTATE_90 = 1.571F;
float SNEAK_LEG_X_ROTATION_ADJUSTMENT = 0.4F;
float TAIL_RP_X = 0.0F;
float TAIL_RP_Y = 0.0F;
float TAIL_RP_Z = 0.0F;
float TAIL_RP_Z_NOTSNEAK = 14.0F;
float TAIL_RP_Z_SNEAK = 15.0F;
float THIRDP_ARM_CENTRE_X = 0.0F;
float THIRDP_ARM_CENTRE_Y = 10.0F;
float THIRDP_ARM_CENTRE_Z = 0.0F;
float WING_FOLDED_RP_Y = 13.0F;
float WING_FOLDED_RP_Z = -3.0F;
float NECK_ROT_X = 0.166F;
public static final float
PI = (float)Math.PI,
BODY_CENTRE_X = 0,
BODY_CENTRE_Y = 8,
BODY_CENTRE_Z = 6,
NECK_CENTRE_X = BODY_CENTRE_X - 2,
NECK_CENTRE_Y = BODY_CENTRE_Y - 6.8F,
NECK_CENTRE_Z = BODY_CENTRE_Z - 8.8F,
BODY_ROTATE_ANGLE_X_NOTSNEAK = 0,
BODY_ROTATE_ANGLE_X_SNEAK = 0.4F,
BODY_ROTATE_ANGLE_X_RIDING = PI * 3.8F,
BODY_RP_Y_NOTSNEAK = 0,
BODY_RP_Y_SNEAK = 7,
BODY_RP_Y_RIDING = 1,
BODY_RP_Z_NOTSNEAK = 0,
BODY_RP_Z_SNEAK = -4,
BODY_RP_Z_RIDING = 4,
EXT_WING_ROTATE_ANGLE_X = 2.5F,
FIRSTP_ARM_CENTRE_X = -1,
FIRSTP_ARM_CENTRE_Y = 4,
FIRSTP_ARM_CENTRE_Z = 0,
FRONT_LEG_RP_Y_NOTSNEAK = 8,
FRONT_LEG_RP_Y_SNEAK = 8,
HEAD_CENTRE_X = 0,
HEAD_CENTRE_Y = -1,
HEAD_CENTRE_Z = -2,
HEAD_RP_X = 0,
HEAD_RP_Y = 0,
HEAD_RP_Z = 0,
HORN_X = HEAD_CENTRE_X - 0.5F,
HORN_Y = HEAD_CENTRE_Y - 10,
HORN_Z = HEAD_CENTRE_Z - 1.5F,
LEFT_WING_EXT_RP_X = 4.5F,
LEFT_WING_EXT_RP_Y = 6,
LEFT_WING_EXT_RP_Z = 6,
LEFT_WING_ROTATE_ANGLE_Z_SNEAK = 4,
ROTATE_270 = 4.712F,
ROTATE_90 = 1.571F,
SNEAK_LEG_X_ROTATION_ADJUSTMENT = 0.4F,
TAIL_RP_X = 0,
TAIL_RP_Y = 0,
TAIL_RP_Z = 0,
TAIL_RP_Z_NOTSNEAK = 14,
TAIL_RP_Z_SNEAK = 15,
THIRDP_ARM_CENTRE_X = 0,
THIRDP_ARM_CENTRE_Y = 10,
THIRDP_ARM_CENTRE_Z = 0,
WING_FOLDED_RP_Y = 13,
WING_FOLDED_RP_Z = -3,
NECK_ROT_X = 0.166F;
}

View file

@ -1,53 +0,0 @@
package com.minelittlepony.model;
import com.minelittlepony.PonyGender;
import com.minelittlepony.renderer.PlaneRenderer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.entity.Entity;
public class PonySnout extends ModelBase implements PonyModelConstants {
private PonyGender gender;
private PlaneRenderer mare;
private PlaneRenderer stallion;
public PonySnout(AbstractPonyModel pony, float yOffset, float stretch) {
mare = new PlaneRenderer(pony);
mare.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
mare.setTextureOffset(10, 14).addBackPlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 2, stretch);
mare.setTextureOffset(11, 13).addBackPlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 2, 1, stretch);
mare.setTextureOffset(9, 14).addTopPlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 1, 1, stretch);
mare.setTextureOffset(14, 14).addTopPlane(1.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 1, 1, stretch);
mare.setTextureOffset(11, 12).addTopPlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 2, 1, stretch);
mare.setTextureOffset(18, 7).addBottomPlane(-2.0F + HEAD_CENTRE_X, 4.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 1, stretch);
mare.setTextureOffset(9, 14).addWestPlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 2, 1, stretch);
mare.setTextureOffset(14, 14).addEastPlane(2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 2, 1, stretch);
mare.setTextureOffset(11, 12).addWestPlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 1, 1, stretch);
mare.setTextureOffset(12, 12).addEastPlane(1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 1, 1, stretch);
pony.bipedHead.addChild(mare);
stallion = new PlaneRenderer(pony);
stallion.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
stallion.setTextureOffset(10, 13).addBackPlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 3, stretch);
stallion.setTextureOffset(10, 13).addTopPlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 1, stretch);
stallion.setTextureOffset(18, 7).addBottomPlane(-2.0F + HEAD_CENTRE_X, 4.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 1, stretch);
stallion.setTextureOffset(10, 13).addWestPlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 3, 1, stretch);
stallion.setTextureOffset(13, 13).addEastPlane(2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 3, 1, stretch);
pony.bipedHead.addChild(stallion);
}
@Override
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {
mare.isHidden = gender != PonyGender.MARE;
stallion.isHidden = gender != PonyGender.STALLION;
}
public void setGender(PonyGender gender) {
this.gender = gender;
}
}

View file

@ -1,73 +0,0 @@
package com.minelittlepony.model;
import com.minelittlepony.PonyData;
import com.minelittlepony.renderer.HornGlowRenderer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import org.lwjgl.opengl.GL11;
import static net.minecraft.client.renderer.GlStateManager.*;
public class UnicornHorn extends ModelBase implements PonyModelConstants {
protected final AbstractPonyModel pony;
private ModelRenderer horn;
private HornGlowRenderer[] hornglow;
private boolean usingMagic;
public UnicornHorn(AbstractPonyModel pony, float yOffset, float stretch) {
this.pony = pony;
this.horn = new ModelRenderer(pony, 0, 3);
this.hornglow = new HornGlowRenderer[2];
for (int i = 0; i < hornglow.length; i++) {
this.hornglow[i] = new HornGlowRenderer(pony, 0, 3);
}
this.horn.addBox(-0.5F + HEAD_CENTRE_X, -10.0F + HEAD_CENTRE_Y, -1.5F + HEAD_CENTRE_Z, 1, 4, 1, stretch);
this.horn.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.horn.rotateAngleX = 0.5F;
this.hornglow[0].addBox(-0.5F + HEAD_CENTRE_X, -10.0F + HEAD_CENTRE_Y, -1.5F + HEAD_CENTRE_Z, 1, 4, 1, stretch + 0.5F);
this.hornglow[1].addBox(-0.5F + HEAD_CENTRE_X, -10.0F + HEAD_CENTRE_Y, -1.5F + HEAD_CENTRE_Z, 1, 3, 1, stretch + 0.8F);
}
@Override
public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
PonyData data = pony.metadata;
if (data.getRace().hasHorn()) {
this.horn.render(scale);
if (usingMagic && data.hasMagic()) {
GL11.glPushAttrib(24577);
disableTexture2D();
disableLighting();
enableBlend();
float red = (data.getGlowColor() >> 16 & 255) / 255.0F;
float green = (data.getGlowColor() >> 8 & 255) / 255.0F;
float blue = (data.getGlowColor() & 255) / 255.0F;
blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
this.horn.postRender(scale);
color(red, green, blue, 0.4F);
this.hornglow[0].render(scale);
color(red, green, blue, 0.2F);
this.hornglow[1].render(scale);
enableTexture2D();
enableLighting();
disableBlend();
popAttrib();
}
}
}
public void setUsingMagic(boolean usingMagic) {
this.usingMagic = usingMagic;
}
}

View file

@ -0,0 +1,207 @@
package com.minelittlepony.model.armour;
import net.minecraft.entity.Entity;
import static com.minelittlepony.model.PonyModelConstants.*;
import com.minelittlepony.model.ModelMobPony;
import com.minelittlepony.render.PonyRenderer;
public class ModelPonyArmor extends ModelMobPony {
public PonyRenderer flankGuard;
public PonyRenderer saddle;
public PonyRenderer helmet;
public PonyRenderer leftLegging;
public PonyRenderer rightLegging;
public ModelPonyArmor() {
super();
textureHeight = 32;
}
@Override
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
syncLegs();
}
@Override
protected void rotateLook(float move, float swing, float bodySwing, float ticks) {
bipedBody.rotateAngleY = bodySwing / 5;
}
@Override
protected void adjustBodyRiding() {
adjustBody(BODY_ROTATE_ANGLE_X_RIDING, BODY_RP_Y_RIDING, BODY_RP_Z_RIDING);
}
@Override
protected void setHead(float posX, float posY, float posZ) {
super.setHead(posX, posY, posZ);
helmet.setRotationPoint(posX, posY, posZ);
}
@Override
protected void updateHeadRotation(float x, float y) {
super.updateHeadRotation(x, y);
helmet.rotateAngleX = x;
helmet.rotateAngleY = y;
}
@Override
protected void adjustBody(float rotateAngleX, float rotationPointY, float rotationPointZ) {
bipedBody.rotateAngleX = rotateAngleX;
bipedBody.rotationPointY = rotationPointY;
bipedBody.rotationPointZ = rotationPointZ;
flankGuard.rotateAngleX = rotateAngleX;
flankGuard.rotationPointY = rotationPointY;
flankGuard.rotationPointZ = rotationPointZ;
saddle.rotateAngleX = rotateAngleX;
saddle.rotationPointY = rotationPointY;
saddle.rotationPointZ = rotationPointZ;
}
@Override
protected void renderHead(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
bipedHead.render(this.scale);
helmet.render(this.scale);
bipedHeadwear.render(this.scale);
}
@Override
protected void renderNeck() {
// TODO: Disabling the neck like this forces more complexity lower down
}
@Override
protected void adjustNeck(float rotateAngleX, float rotationPointY, float rotationPointZ) {
}
@Override
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
bipedBody.render(this.scale);
flankGuard.render(this.scale);
saddle.render(this.scale);
}
@Override
protected void renderLegs() {
if (!isSneak) {
boolean isLegs = saddle.showModel;
saddle.showModel = true;
saddle.postRender(scale);
saddle.showModel = isLegs;
}
bipedLeftArm.render(scale);
bipedRightArm.render(scale);
bipedLeftLeg.render(scale);
bipedRightLeg.render(scale);
rightLegging.render(scale);
leftLegging.render(scale);
}
@Override
protected void initTextures() {
initHeadTextures();
initBodyTextures();
initLegTextures();
}
@Override
protected void initHeadTextures() {
bipedHead = new PonyRenderer(this, 0, 0);
bipedHeadwear = new PonyRenderer(this, 32, 0);
helmet = new PonyRenderer(this, 0, 0);
}
@Override
protected void initBodyTextures() {
bipedBody = new PonyRenderer(this, 16, 16);
flankGuard = new PonyRenderer(this, 0, 0);
saddle = new PonyRenderer(this, 16, 8);
}
@Override
protected void initLegTextures() {
bipedRightArm = new PonyRenderer(this, 0, 16);
bipedRightLeg = new PonyRenderer(this, 0, 16);
bipedLeftArm = new PonyRenderer(this, 0, 16).flipX();
bipedLeftLeg = new PonyRenderer(this, 0, 16).flipX();
unicornArmRight = new PonyRenderer(this, 0, 16);
unicornArmLeft = new PonyRenderer(this, 0, 16);
leftLegging = new PonyRenderer(this, 48, 8);
rightLegging = new PonyRenderer(this, 48, 8);
}
@Override
protected void initTailPositions(float yOffset, float stretch) {
}
@Override
protected void initHeadPositions(float yOffset, float stretch) {
bipedHead .addBox(HEAD_CENTRE_X - 4, HEAD_CENTRE_Y - 4, HEAD_CENTRE_Z - 4, 8, 8, 8, stretch * 1.1F);
bipedHeadwear.addBox(HEAD_CENTRE_X - 4, HEAD_CENTRE_Y - 4, HEAD_CENTRE_Z - 4, 8, 8, 8, stretch * 1.1F + 0.5F);
helmet.offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.box(-4, -6, 1, 2, 2, 2, stretch * 0.5F)
.tex(0, 4).box( 2, -6, 1, 2, 2, 2, stretch * 0.5F);
bipedHead .setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
bipedHeadwear.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
}
@Override
protected void initBodyPositions(float yOffset, float stretch) {
bipedBody.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
bipedBody.addBox(-4.0F, 4.0F, -2.0F, 8, 8, 4, stretch);
flankGuard.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.box(-4.0F, 4.0F, 6.0F, 8, 8, 8, stretch);
saddle.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.box(-4.0F, 4.0F, -2.0F, 8, 8, 16, stretch);
}
@Override
protected void initLegPositions(float yOffset, float stretch) {
super.initLegPositions(yOffset, stretch);
float rarmX = getLegRotationX();
float armX = THIRDP_ARM_CENTRE_X;
float armY = THIRDP_ARM_CENTRE_Y;
float armZ = THIRDP_ARM_CENTRE_Z;
leftLegging.offset(armX + 2, armY, armZ)
.around(rarmX, yOffset, 0)
.box(-2, -6, -2, 4, 12, 4, stretch);
rightLegging.offset(armX - 2, armY, armZ)
.around(-rarmX, yOffset, 0)
.flipX().box(-2, -6, -2, 4, 12, 4, stretch);
}
protected void syncLegs() {
rightLegging.rotateAt(bipedRightLeg).rotateTo(bipedRightLeg);
leftLegging.rotateAt(bipedLeftLeg).rotateTo(bipedLeftLeg);
}
@Override
public void setVisible(boolean invisible) {
super.setVisible(invisible);
flankGuard.showModel = invisible;
saddle.showModel = invisible;
helmet.showModel = invisible;
leftLegging.showModel = invisible;
rightLegging.showModel = invisible;
}
}

View file

@ -0,0 +1,15 @@
package com.minelittlepony.model.armour;
/**
* Armour for skeleton ponies.
*
*/
public class ModelSkeletonPonyArmor extends ModelPonyArmor {
@Override
protected void fixSpecialRotationPoints(float move) {
if (rightArmPose != ArmPose.EMPTY && !canCast()) {
bipedRightArm.setRotationPoint(-1.5F, 9.5F, 4);
}
}
}

View file

@ -0,0 +1,29 @@
package com.minelittlepony.model.armour;
import com.minelittlepony.render.AbstractPonyRenderer;
public class ModelZombiePonyArmor extends ModelPonyArmor {
// Copied from ModelZombiePony
@Override
protected void adjustLegs(float move, float swing, float ticks) {
super.adjustLegs(move, swing, ticks);
if (rightArmPose != ArmPose.EMPTY) return;
if (islookAngleRight(move)) {
rotateArmHolding(bipedRightArm, 1, swingProgress, ticks);
} else {
rotateArmHolding(bipedLeftArm, -1, swingProgress, ticks);
}
}
@Override
protected void fixSpecialRotationPoints(float move) {
if (rightArmPose != ArmPose.EMPTY) return;
if (islookAngleRight(move)) {
AbstractPonyRenderer.shiftRotationPoint(bipedRightArm, 0.5F, 1.5F, 3);
} else {
AbstractPonyRenderer.shiftRotationPoint(bipedLeftArm, -0.5F, 1.5F, 3);
}
}
}

View file

@ -0,0 +1,36 @@
package com.minelittlepony.model.armour;
import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.model.capabilities.IModelWrapper;
import com.minelittlepony.pony.data.IPonyData;
import net.minecraft.inventory.EntityEquipmentSlot;
public class PonyArmor implements IModelWrapper {
public final AbstractPonyModel chestplate;
public final AbstractPonyModel leggings;
public PonyArmor(AbstractPonyModel chest, AbstractPonyModel body) {
chestplate = chest;
leggings = body;
}
public void apply(IPonyData meta) {
chestplate.metadata = meta;
leggings.metadata = meta;
}
public void init() {
chestplate.init(0, 1);
leggings.init(0, 0.5f);
}
public AbstractPonyModel getArmorForSlot(EntityEquipmentSlot slot) {
if (slot == EntityEquipmentSlot.LEGS) {
return leggings;
}
return chestplate;
}
}

View file

@ -1,6 +1,6 @@
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
package com.minelittlepony.model.pony;
package com.minelittlepony.model.armour;
import mcp.MethodsReturnNonnullByDefault;

View file

@ -0,0 +1,49 @@
package com.minelittlepony.model.capabilities;
import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.armour.PonyArmor;
import net.minecraft.entity.Entity;
public interface IModel {
/**
* Sets up this model's initial values, like a constructor...
* @param yOffset YPosition for this model. Always 0.
* @param stretch Scaling factor for this model. Ranges above or below 0 (no change).
*/
void init(float yOffset, float stretch);
/**
* Applies a transform particular to a certain body part.
*/
void transform(BodyPart part);
/**
* Returns a new pony armour to go with this model. Called on startup by a model wrapper.
*/
PonyArmor createArmour();
/**
* Returns true if this model is on the ground and crouching.
*/
boolean isCrouching();
/**
* Returns true if the given entity can and is flying, or has an elytra.
*/
boolean isFlying(Entity entity);
/**
* Returns true if the model is flying.
*/
boolean isFlying();
/**
* Returns true if the current model is a child or a child-like foal.
*/
boolean isChild();
float getSwingAmount();
}

View file

@ -0,0 +1,13 @@
package com.minelittlepony.model.capabilities;
public interface IModelPegasus extends IModel {
/**
* Returns true if the wings are spread.
*/
boolean wingsAreOpen();
/**
* Returns true if this model is being applied to a race that has wings.
*/
boolean canFly();
}

View file

@ -0,0 +1,25 @@
package com.minelittlepony.model.capabilities;
import com.minelittlepony.render.PonyRenderer;
import net.minecraft.util.EnumHandSide;
public interface IModelUnicorn extends IModel {
PonyRenderer getUnicornArmForSide(EnumHandSide side);
/**
* Returns true if this model is being applied to a race that can use magic.
*/
boolean canCast();
/**
* Returns true if this model is currently using magic (horn is lit).
* @return
*/
boolean isCasting();
/**
* Gets the preferred magic color for this mode.
*/
int getMagicColor();
}

View file

@ -0,0 +1,15 @@
package com.minelittlepony.model.capabilities;
import com.minelittlepony.pony.data.IPonyData;
public interface IModelWrapper {
/**
* Initialises this wrapper's contained models.
*/
void init();
/**
* Updates metadata values to this wrapper's contained models.
*/
void apply(IPonyData meta);
}

View file

@ -0,0 +1,7 @@
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
package com.minelittlepony.model.capabilities;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -0,0 +1,70 @@
package com.minelittlepony.model.components;
import static com.minelittlepony.model.PonyModelConstants.*;
import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.render.PonyRenderer;
public class ModelWing {
public PonyRenderer extended;
public PonyRenderer folded;
private boolean mirror;
public ModelWing(AbstractPonyModel pony, boolean mirror, float x, float y, float scale, int texY) {
this.mirror = mirror;
folded = new PonyRenderer(pony, 56, texY)
.around(HEAD_RP_X, WING_FOLDED_RP_Y, WING_FOLDED_RP_Z);
extended = new PonyRenderer(pony, 56, texY + 3)
.around(HEAD_RP_X, WING_FOLDED_RP_Y, WING_FOLDED_RP_Z).mirror(mirror);
addClosedWing(x, y, scale);
addFeathers(mirror, y, scale);
}
private void addClosedWing(float x, float y, float scale) {
folded.box(x, 5f, 2, 2, 6, 2, scale)
.box(x, 5f, 4, 2, 8, 2, scale)
.box(x, 5f, 6, 2, 6, 2, scale)
.rotateAngleX = ROTATE_90;
}
private void addFeathers(boolean mirror, float y, float scale) {
float r = mirror ? -1 : 1;
extended.cubeList.clear();
extended.around(r * LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + y, LEFT_WING_EXT_RP_Z);
addFeather(0, r, y, 6, 0, 8, scale + 0.1F);
addFeather(1, r, y, -1.2F, -0.2F, 8, scale + 0.2F) .rotateAngleX = -0.85F;
addFeather(2, r, y, 1.8F, 1.3F, 8, scale - 0.1F) .rotateAngleX = -0.75F;
addFeather(3, r, y, 5, 2, 8, scale) .rotateAngleX = -0.5F;
addFeather(4, r, y, 0, -0.2F, 6, scale + 0.3F);
addFeather(5, r, y, 0, 0.2F, 3, scale + 0.19F).rotateAngleX = -0.85F;
}
private PonyRenderer addFeather(int i, float r, float Y, float y, float z, int h, float scale) {
return extended.child(i).around(0, 0, 0).box(-0.5f, y, z, 1, h, 2, scale);
}
public void rotateWalking(float swing) {
folded.rotateAngleY = swing * 0.2F;
}
public void render(boolean extend, float scale) {
extended.rotationPointX = (mirror ? -1 : 1) * LEFT_WING_EXT_RP_X;
extended.rotationPointY = LEFT_WING_EXT_RP_Y;
extended.rotateAngleY = 3;
if (extend) {
extended.render(scale);
} else {
folded.render(scale);
}
}
public void rotateFlying(float angle) {
extended.rotateAngleZ = angle;
}
}

View file

@ -0,0 +1,62 @@
package com.minelittlepony.model.components;
import net.minecraft.util.math.MathHelper;
import static com.minelittlepony.model.PonyModelConstants.*;
import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.model.capabilities.IModelPegasus;
public class PegasusWings {
private final IModelPegasus pegasus;
public final ModelWing leftWing;
public final ModelWing rightWing;
public <T extends AbstractPonyModel & IModelPegasus> PegasusWings(T model, float yOffset, float stretch) {
pegasus = model;
leftWing = new ModelWing(model, false, 4f, yOffset, stretch, 32);
rightWing = new ModelWing(model, true, -6f, yOffset, stretch, 16);
}
public void setRotationAngles(float move, float swing, float ticks) {
float flap = 0;
float progress = pegasus.getSwingAmount();
if (progress > 0) {
flap = MathHelper.sin(MathHelper.sqrt(progress) * PI * 2);
} else {
float pi = PI * (float) Math.pow(swing, 16);
float mve = move * 0.6662f; // magic number ahoy
float srt = swing / 4;
flap = MathHelper.cos(mve + pi) * srt;
}
leftWing.rotateWalking(flap);
rightWing.rotateWalking(-flap);
if (pegasus.wingsAreOpen()) {
float flapAngle = getWingRotationFactor(ticks);
leftWing.rotateFlying(flapAngle);
rightWing.rotateFlying(-flapAngle);
}
}
public float getWingRotationFactor(float ticks) {
if (pegasus.isFlying()) {
return (MathHelper.sin(ticks * 0.536f) * 1) + ROTATE_270 + 0.4f;
}
return LEFT_WING_ROTATE_ANGLE_Z_SNEAK;
}
public void render(float scale) {
boolean standing = pegasus.wingsAreOpen();
leftWing.render(standing, scale);
rightWing.render(standing, scale);
}
}

View file

@ -0,0 +1,97 @@
package com.minelittlepony.model.components;
import com.minelittlepony.render.PonyRenderer;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.math.Vec3d;
import static com.minelittlepony.model.PonyModelConstants.*;
/**
* Modified from ModelElytra.
*/
public class PonyElytra extends ModelBase {
private PonyRenderer rightWing = new PonyRenderer(this, 22, 0);
private PonyRenderer leftWing = new PonyRenderer(this, 22, 0);
public PonyElytra() {
leftWing .box(-10, 0, 0, 10, 20, 2, 1);
rightWing.flipX().box( 0, 0, 0, 10, 20, 2, 1);
}
/**
* Sets the model's various rotation angles.
*
* See {@link AbstractPonyModel.render} for an explanation of the various parameters.
*/
@Override
public void render(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
GlStateManager.disableRescaleNormal();
GlStateManager.disableCull();
leftWing.render(scale);
rightWing.render(scale);
}
/**
* Sets the model's various rotation angles.
*
* See {@link AbstractPonyModel.setRotationAngles} for an explanation of the various parameters.
*/
@Override
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
float rotateX = PI / 2;
float rotateY = PI / 8;
float rotateZ = PI / 12;
float rpY = BODY_RP_Y_NOTSNEAK;
if (entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying()) {
float velY = 1;
if (entity.motionY < 0) {
Vec3d motion = (new Vec3d(entity.motionX, entity.motionY, entity.motionZ)).normalize();
velY = 1 - (float) Math.pow(-motion.y, 1.5);
}
rotateX = velY * PI * (2 / 3F) + (1 - velY) * rotateX;
rotateY = velY * (PI / 2) + (1 - velY) * rotateY;
} else if (entity.isSneaking()) {
rotateX = PI * 1.175F;
rotateY = PI / 2;
rotateZ = PI / 4;
rpY = BODY_RP_Y_SNEAK;
}
leftWing.rotationPointX = 5;
leftWing.rotationPointY = rpY;
if (entity instanceof AbstractClientPlayer) {
AbstractClientPlayer player = (AbstractClientPlayer) entity;
player.rotateElytraX += (rotateX - player.rotateElytraX) / 10;
player.rotateElytraY += (rotateY - player.rotateElytraY) / 10;
player.rotateElytraZ += (rotateZ - player.rotateElytraZ) / 10;
leftWing.rotateAngleX = player.rotateElytraX;
leftWing.rotateAngleY = player.rotateElytraY;
leftWing.rotateAngleZ = player.rotateElytraZ;
} else {
leftWing.rotateAngleX = rotateX;
leftWing.rotateAngleZ = rotateZ;
leftWing.rotateAngleY = rotateY;
}
rightWing.rotationPointX = -leftWing.rotationPointX;
rightWing.rotationPointY = leftWing.rotationPointY;
rightWing.rotateAngleX = leftWing.rotateAngleX;
rightWing.rotateAngleY = -leftWing.rotateAngleY;
rightWing.rotateAngleZ = -leftWing.rotateAngleZ;
}
}

View file

@ -0,0 +1,49 @@
package com.minelittlepony.model.components;
import com.minelittlepony.pony.data.PonyGender;
import com.minelittlepony.render.plane.PlaneRenderer;
import static com.minelittlepony.model.PonyModelConstants.*;
import com.minelittlepony.model.AbstractPonyModel;
public class PonySnout {
private PlaneRenderer mare;
private PlaneRenderer stallion;
public PonySnout(AbstractPonyModel pony) {
mare = new PlaneRenderer(pony);
stallion = new PlaneRenderer(pony);
pony.bipedHead.addChild(stallion);
pony.bipedHead.addChild(mare);
}
public void init(float yOffset, float stretch) {
mare.offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.tex(10, 14) .addBackPlane(-2, 2, -5, 4, 2, stretch)
.tex(11, 13) .addBackPlane(-1, 1, -5, 2, 1, stretch)
.tex(9, 14) .addTopPlane(-2, 2, -5, 1, 1, stretch)
.tex(14, 14) .addTopPlane( 1, 2, -5, 1, 1, stretch)
.tex(11, 12) .addTopPlane(-1, 1, -5, 2, 1, stretch)
.tex(18, 7).addBottomPlane(-2, 4, -5, 4, 1, stretch)
.tex(9, 14) .addWestPlane(-2, 2, -5, 2, 1, stretch)
.tex(14, 14) .addEastPlane( 2, 2, -5, 2, 1, stretch)
.tex(11, 12) .addWestPlane(-1, 1, -5, 1, 1, stretch)
.tex(12, 12) .addEastPlane( 1, 1, -5, 1, 1, stretch);
stallion.offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.tex(10, 13) .addBackPlane(-2, 1, -5, 4, 3, stretch)
.tex(10, 13) .addTopPlane(-2, 1, -5, 4, 1, stretch)
.tex(18, 7).addBottomPlane(-2, 4, -5, 4, 1, stretch)
.tex(10, 13) .addWestPlane(-2, 1, -5, 3, 1, stretch)
.tex(13, 13) .addEastPlane( 2, 1, -5, 3, 1, stretch);
}
public void setGender(PonyGender gender) {
mare.isHidden = gender == PonyGender.STALLION;
stallion.isHidden = !mare.isHidden;
}
}

View file

@ -0,0 +1,113 @@
package com.minelittlepony.model.components;
import net.minecraft.client.model.ModelBase;
import net.minecraft.util.math.MathHelper;
import static com.minelittlepony.model.PonyModelConstants.*;
import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.render.plane.PlaneRenderer;
public class PonyTail extends PlaneRenderer {
private static final int SEGMENTS = 4;
private final AbstractPonyModel theModel;
private int tailStop = 0;
public PonyTail(AbstractPonyModel model) {
super(model);
theModel = model;
}
public void init(float yOffset, float stretch) {
for (int i = 0; i < SEGMENTS; i++) {
addChild(new TailSegment(theModel, i, yOffset, stretch));
}
}
/**
* Sets the model's various rotation angles.
*
* See {@link AbstractPonyMode.setRotationAndAngle} for an explanation of the various parameters.
*/
public void setRotationAndAngles(boolean rainboom, float move, float swing, float bodySwing, float ticks) {
rotateAngleZ = rainboom ? 0 : MathHelper.cos(move * 0.8F) * 0.2f * swing;
rotateAngleY = bodySwing;
if (theModel.isCrouching() && !rainboom) {
rotateSneak();
} else if (theModel.isRiding) {
rotationPointZ = 13;
rotationPointY = 3;
rotateAngleX = PI / 5;
} else {
setRotationPoint(TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_NOTSNEAK);
if (rainboom) {
rotateAngleX = ROTATE_90 + MathHelper.sin(move) / 10;
} else {
rotateAngleX = swing / 2;
}
if (!rainboom) {
swingX(ticks);
}
}
if (rainboom) {
rotationPointY += 6;
rotationPointZ++;
}
tailStop = theModel.metadata.getTail().ordinal();
}
public void swingX(float ticks) {
float sinTickFactor = MathHelper.sin(ticks * 0.067f) * 0.05f;
rotateAngleX += sinTickFactor;
rotateAngleY += sinTickFactor;
}
public void rotateSneak() {
setRotationPoint(TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_SNEAK);
rotateAngleX = -BODY_ROTATE_ANGLE_X_SNEAK + 0.1F;
}
private class TailSegment extends PlaneRenderer {
private final int index;
public TailSegment(ModelBase model, int index, float yOffset, float stretch) {
super(model);
this.index = index;
offsetY = ((float)index)/4 + 0.063f;
init(yOffset, stretch);
}
public void init(float yOffset, float stretch) {
int texX = (index % 2) * 4;
around(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
if (index == 0) {
tex(32, 0).addTopPlane(-2, 0, 2, 4, 4, stretch);
}
tex(36, texX).addEastPlane( 2, 0, 2, 4, 4, stretch)
.addWestPlane(-2, 0, 2, 4, 4, stretch);
tex(32, texX).addBackPlane(-2, 0, 2, 4, 4, stretch)
.addFrontPlane(-2, 0, 6, 4, 4, stretch);
tex(32, 0).addBottomPlane(-2, 4, 2, 4, 4, stretch);
}
@Override
public void render(float scale) {
if (index < tailStop) {
super.render(scale);
}
}
}
}

View file

@ -0,0 +1,51 @@
package com.minelittlepony.model.components;
import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.render.HornGlowRenderer;
import com.minelittlepony.render.PonyRenderer;
import static org.lwjgl.opengl.GL11.*;
import static net.minecraft.client.renderer.GlStateManager.*;
import static com.minelittlepony.model.PonyModelConstants.*;
public class UnicornHorn {
private PonyRenderer horn;
private HornGlowRenderer glow;
public UnicornHorn(AbstractPonyModel pony, float yOffset, float stretch) {
horn = new PonyRenderer(pony, 0, 3);
glow = new HornGlowRenderer(pony, 0, 3);
horn.offset(HORN_X, HORN_Y, HORN_Z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.box(0, 0, 0, 1, 4, 1, stretch)
.rotateAngleX = 0.5F;
glow.offset(HORN_X, HORN_Y, HORN_Z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.setAlpha(0.4f).box(0, 0, 0, 1, 4, 1, stretch + 0.5F)
.setAlpha(0.2f).box(0, 0, 0, 1, 3, 1, stretch + 0.8F);
}
public void render(float scale) {
horn.render(scale);
}
public void renderMagic(int tint, float scale) {
glPushAttrib(24577);
disableTexture2D();
disableLighting();
enableBlend();
blendFunc(GL_SRC_ALPHA, GL_ONE);
horn.postRender(scale);
glow.setTint(tint).render(scale);
enableTexture2D();
enableLighting();
disableBlend();
popAttrib();
}
}

View file

@ -1,6 +1,6 @@
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
package com.minelittlepony.renderer.layer;
package com.minelittlepony.model.components;
import mcp.MethodsReturnNonnullByDefault;

View file

@ -0,0 +1,164 @@
package com.minelittlepony.model.player;
import com.minelittlepony.model.components.UnicornHorn;
import com.minelittlepony.render.PonyRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.math.MathHelper;
import com.minelittlepony.model.capabilities.IModelUnicorn;
import static com.minelittlepony.model.PonyModelConstants.*;
/**
* Used for both unicorns and alicorns since there's no logical way to keep them distinct and not duplicate stuff.
*/
public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
public PonyRenderer unicornArmRight;
public PonyRenderer unicornArmLeft;
public UnicornHorn horn;
public ModelAlicorn(boolean smallArms) {
super(smallArms);
}
@Override
public void init(float yOffset, float stretch) {
super.init(yOffset, stretch);
horn = new UnicornHorn(this, yOffset, stretch);
}
@Override
protected void rotateLegsOnGround(float move, float swing, float ticks, Entity entity) {
super.rotateLegsOnGround(move, swing, ticks, entity);
unicornArmRight.rotateAngleY = 0;
unicornArmLeft.rotateAngleY = 0;
}
@Override
protected void adjustLegs(float move, float swing, float ticks) {
super.adjustLegs(move, swing, ticks);
unicornArmLeft.rotateAngleZ = 0;
unicornArmRight.rotateAngleZ = 0;
unicornArmLeft.rotateAngleX = 0;
unicornArmRight.rotateAngleX = 0;
}
@Override
protected void holdItem(float swing) {
if (canCast()) {
boolean both = leftArmPose == ArmPose.ITEM && rightArmPose == ArmPose.ITEM;
alignArmForAction(unicornArmLeft, leftArmPose, both, swing);
alignArmForAction(unicornArmRight, rightArmPose, both, swing);
} else {
super.holdItem(swing);
}
}
@Override
protected void swingItem(Entity entity) {
EnumHandSide mainSide = getMainHand(entity);
if (canCast() && getArmPoseForSide(mainSide) != ArmPose.EMPTY) {
if (swingProgress > -9990.0F && !isSleeping) {
swingArm(getUnicornArmForSide(mainSide));
}
} else {
super.swingItem(entity);
}
}
@Override
protected void swingArms(float ticks) {
if (isSleeping) return;
if (canCast()) {
float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
float sin = MathHelper.sin(ticks * 0.067F) * 0.05F;
if (rightArmPose != ArmPose.EMPTY) {
unicornArmRight.rotateAngleZ += cos;
unicornArmRight.rotateAngleX += sin;
}
if (leftArmPose != ArmPose.EMPTY) {
unicornArmLeft.rotateAngleZ += cos;
unicornArmLeft.rotateAngleX += sin;
}
} else {
super.swingArms(ticks);
}
}
@Override
public PonyRenderer getUnicornArmForSide(EnumHandSide side) {
return side == EnumHandSide.LEFT ? unicornArmLeft : unicornArmRight;
}
@Override
public boolean canCast() {
return metadata.hasMagic();
}
@Override
public boolean isCasting() {
return rightArmPose != ArmPose.EMPTY || leftArmPose != ArmPose.EMPTY;
}
@Override
public int getMagicColor() {
return metadata.getGlowColor();
}
@Override
protected void sneakLegs() {
super.sneakLegs();
unicornArmRight.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
unicornArmLeft.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
}
@Override
protected void aimBow(ArmPose leftArm, ArmPose rightArm, float ticks) {
if (canCast()) {
if (rightArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmRight, ticks);
if (leftArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmLeft, ticks);
} else {
super.aimBow(leftArm, rightArm, ticks);
}
}
@Override
protected void renderHead(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
super.renderHead(entity, move, swing, ticks, headYaw, headPitch, scale);
if (canCast()) {
horn.render(scale);
if (isCasting()) {
horn.renderMagic(getMagicColor(), scale);
}
}
}
@Override
protected void initLegTextures() {
super.initLegTextures();
unicornArmLeft = new PonyRenderer(this, 40, 32).size(64, 64);
unicornArmRight = new PonyRenderer(this, 40, 32).size(64, 64);
}
@Override
protected void initLegPositions(float yOffset, float stretch) {
super.initLegPositions(yOffset, stretch);
float armY = THIRDP_ARM_CENTRE_Y - 6;
float armZ = THIRDP_ARM_CENTRE_Z - 2;
unicornArmLeft .box(FIRSTP_ARM_CENTRE_X - 2, armY, armZ, 4, 12, 4, stretch + .25F).around(5, yOffset + 2, 0);
unicornArmRight.box(FIRSTP_ARM_CENTRE_X - 2, armY, armZ, 4, 12, 4, stretch + .25F).around(-5, yOffset + 2, 0);
}
}

View file

@ -0,0 +1,63 @@
package com.minelittlepony.model.player;
import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.render.PonyRenderer;
import net.minecraft.entity.Entity;
public class ModelEarthPony extends AbstractPonyModel {
private final boolean smallArms;
public PonyRenderer bipedCape;
public ModelEarthPony(boolean smallArms) {
super(smallArms);
this.smallArms = smallArms;
}
@Override
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
if (bipedCape != null) {
bipedCape.rotationPointY = isSneak ? 2 : isRiding ? -4 : 0;
}
}
protected float getLegOutset() {
if (smallArms) {
if (isSleeping) return 2.6f;
if (isCrouching()) return 1;
return 4;
}
return super.getLegOutset();
}
protected int getArmWidth() {
return smallArms ? 3 : super.getArmWidth();
}
protected float getLegRotationX() {
return smallArms ? 2 : super.getLegRotationX();
}
protected float getArmRotationY() {
return smallArms ? 8.5f : super.getArmRotationY();
}
protected void initHeadTextures() {
super.initHeadTextures();
bipedCape = new PonyRenderer(this, 0, 0).size(64, 32);
}
protected void initHeadPositions(float yOffset, float stretch) {
super.initHeadPositions(yOffset, stretch);
bipedCape.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, stretch);
}
@Override
public void renderCape(float scale) {
bipedCape.render(scale);
}
}

View file

@ -0,0 +1,82 @@
package com.minelittlepony.model.player;
import com.minelittlepony.model.components.PegasusWings;
import net.minecraft.entity.Entity;
import static com.minelittlepony.model.PonyModelConstants.*;
import com.minelittlepony.model.capabilities.IModelPegasus;
public class ModelPegasus extends ModelEarthPony implements IModelPegasus {
public PegasusWings wings;
public ModelPegasus(boolean smallArms) {
super(smallArms);
}
@Override
public void init(float yOffset, float stretch) {
super.init(yOffset, stretch);
wings = new PegasusWings(this, yOffset, stretch);
}
@Override
public boolean isCrouching() {
return super.isCrouching() && !rainboom;
}
@Override
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
checkRainboom(entity, swing);
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
if (bipedCape != null) {
wings.setRotationAngles(move, swing, ticks);
}
}
@Override
protected void rotateLegsInFlight(float move, float swing, float ticks, Entity entity) {
if (rainboom) {
bipedLeftArm.rotateAngleX = ROTATE_270;
bipedRightArm.rotateAngleX = ROTATE_270;
bipedLeftLeg.rotateAngleX = ROTATE_90;
bipedRightLeg.rotateAngleX = ROTATE_90;
bipedLeftArm.rotateAngleY = -0.2F;
bipedLeftLeg.rotateAngleY = 0.2F;
bipedRightArm.rotateAngleY = 0.2F;
bipedRightLeg.rotateAngleY = -0.2F;
} else {
super.rotateLegsInFlight(move, swing, ticks, entity);
}
}
protected void holdItem(float swing) {
if (!rainboom) {
super.holdItem(swing);
}
}
@Override
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
if (canFly()) {
wings.render(scale);
}
}
@Override
public boolean wingsAreOpen() {
return isFlying || isCrouching();
}
@Override
public boolean canFly() {
return metadata.getRace().hasWings();
}
}

View file

@ -0,0 +1,41 @@
package com.minelittlepony.model.player;
import com.minelittlepony.model.PMAPI;
import com.minelittlepony.model.ModelWrapper;
public enum PlayerModels {
/**
* @deprecated Will be removed in a later revision
*/
@Deprecated HUMAN("default", "slim", () -> PMAPI.pony, () -> PMAPI.ponySmall),
EARTH("earthpony", "slimearthpony", () -> PMAPI.earthpony, () -> PMAPI.earthponySmall),
PEGASUS("pegasus", "slimpegasus", () -> PMAPI.pegasus, () -> PMAPI.pegasusSmall),
ALICORN("alicorn", "slimalicorn", () -> PMAPI.alicorn, () -> PMAPI.alicornSmall);
private final ModelResolver normal, slim;
private final String normalKey, slimKey;
PlayerModels(String normalKey, String slimKey, ModelResolver normal, ModelResolver slim) {
this.normalKey = normalKey;
this.slimKey = slimKey;
this.normal = normal;
this.slim = slim;
}
public ModelWrapper getModel(boolean slim) {
return slim ? this.slim.resolve() : normal.resolve();
}
public String getId(boolean useSlimArms) {
return useSlimArms ? slimKey : normalKey;
}
/**
* FIXME: PMAPI fields are null when the game starts.
*/
static interface ModelResolver {
ModelWrapper resolve();
}
}

View file

@ -0,0 +1,7 @@
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
package com.minelittlepony.model.player;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -0,0 +1,180 @@
package com.minelittlepony.model.ponies;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.math.MathHelper;
import static com.minelittlepony.model.PonyModelConstants.PI;
import com.minelittlepony.render.PonyRenderer;
public class ModelBreezie extends ModelBiped {
PonyRenderer neck;
PonyRenderer tail;
PonyRenderer tailStub;
PonyRenderer leftWing;
PonyRenderer rightWing;
public ModelBreezie() {
textureWidth = 64;
textureHeight = 64;
bipedHeadwear.showModel = false;
bipedHead = new PonyRenderer(this)
.child(new PonyRenderer(this)
.addBox(-3, -6, -3, 6, 6, 6).around(0, 0, -4)
.tex(28, 0).addBox( 2, -7, 1, 1, 1, 1)
.tex(24, 0).addBox(-3, -7, 1, 1, 1, 1)
.tex(24, 9).addBox(-1, -2, -4, 2, 2, 1))
.child(new PonyRenderer(this)
.tex(28, 2).addBox( 1, -11, -2, 1, 6, 1)
.tex(24, 2).addBox(-2, -11, -2, 1, 6, 1)
.rotate(-0.2617994F, 0, 0));
bipedBody = new PonyRenderer(this, 2, 12)
.addBox(0, 0, 0, 6, 7, 14).rotate(-0.5235988F, 0, 0).around(-3, 1, -3);
bipedLeftArm = new PonyRenderer(this, 28, 12).addBox(0, 0, 0, 2, 12, 2).around( 1, 8, -5);
bipedRightArm = new PonyRenderer(this, 36, 12).addBox(0, 0, 0, 2, 12, 2).around(-3, 8, -5);
bipedLeftLeg = new PonyRenderer(this, 8, 12) .addBox(0, 0, 0, 2, 12, 2).around( 1, 12, 3);
bipedRightLeg = new PonyRenderer(this, 0, 12) .addBox(0, 0, 0, 2, 12, 2).around(-3, 12, 3);
neck = new PonyRenderer(this, 40, 0)
.addBox(0, 0, 0, 2, 5, 2)
.rotate(0.0872665F, 0, 0).around(-1, -2, -4);
tailStub = new PonyRenderer(this, 40, 7)
.addBox(0, 0, 0, 1, 1, 3).around(-0.5F, 8, 8);
tail = new PonyRenderer(this, 32, 0)
.addBox(0, 0, 1, 2, 9, 2).around(-1, 7, 10);
leftWing = new PonyRenderer(this, 0, 40)
.addBox(0, -12, 0, 24, 24, 0)
.rotate(0, -0.6981317F, 0).around(2, 3, 1);
leftWing.setTextureSize(64, 32);
rightWing = new PonyRenderer(this, 0, 40)
.addBox(-24, -12, 0, 24, 24, 0, true)
.rotate(0, 0.6981317F, 0).around(-2, 3, 1);
rightWing.setTextureSize(64, 32);
}
@Override
public void render(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
super.render(entity, move, swing, ticks, headYaw, headPitch, scale);
neck.render(scale);
tailStub.render(scale);
tail.render(scale);
leftWing.render(scale);
rightWing.render(scale);
}
@SuppressWarnings("incomplete-switch")
@Override
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
bipedHead.rotateAngleY = headYaw * 0.017453292F;
bipedHead.rotateAngleX = headPitch * 0.017453292F;
bipedLeftArm.rotateAngleX = MathHelper.cos(move * 0.6662F) * swing;
bipedLeftArm.rotateAngleZ = 0;
((PonyRenderer)bipedRightArm).rotate(swing * MathHelper.cos(move * 0.6662F + PI), 0, 0);
((PonyRenderer)bipedLeftLeg) .rotate(swing * MathHelper.cos(move * 0.6662F + PI) * 1.4F, 0, 0);
((PonyRenderer)bipedRightLeg).rotate(swing * MathHelper.cos(move * 0.6662F) * 1.4F, 0, 0);
if (isRiding) {
bipedLeftArm.rotateAngleX += -PI / 5;
bipedRightArm.rotateAngleX += -PI / 5;
rotateLegRiding(((PonyRenderer)bipedLeftLeg), -1);
rotateLegRiding(((PonyRenderer)bipedRightLeg), 1);
}
rotateArm(bipedLeftArm, leftArmPose, 1);
rotateArm(bipedRightArm, rightArmPose, 1);
if (swingProgress > 0) {
swingArms(getMainHand(entity));
}
float rotX = MathHelper.sin(ticks * 0.067F) * 0.05F;
float rotZ = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
bipedLeftArm.rotateAngleX -= rotX;
bipedLeftArm.rotateAngleZ -= rotZ;
bipedRightArm.rotateAngleX += rotX;
bipedRightArm.rotateAngleZ += rotZ;
if (rightArmPose == ModelBiped.ArmPose.BOW_AND_ARROW) {
raiseArm(bipedRightArm, bipedLeftArm, -1);
} else if (leftArmPose == ModelBiped.ArmPose.BOW_AND_ARROW) {
raiseArm(bipedLeftArm, bipedRightArm, 1);
}
}
protected void rotateLegRiding(PonyRenderer leg, float factor) {
leg.rotate(-1.4137167F, factor * PI / 10, factor * 0.07853982F);
}
protected void swingArms(EnumHandSide mainHand) {
bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt(swingProgress) * PI * 2) / 5;
if (mainHand == EnumHandSide.LEFT) {
bipedBody.rotateAngleY *= -1;
}
float sin = MathHelper.sin(bipedBody.rotateAngleY) * 5;
float cos = MathHelper.cos(bipedBody.rotateAngleY) * 5;
bipedLeftArm.rotateAngleX += bipedBody.rotateAngleY;
bipedLeftArm.rotateAngleY += bipedBody.rotateAngleY;
bipedLeftArm.rotationPointX = cos;
bipedLeftArm.rotationPointZ = -sin;
bipedRightArm.rotateAngleY += bipedBody.rotateAngleY;
bipedRightArm.rotationPointX = -cos;
bipedRightArm.rotationPointZ = sin;
float swingAmount = 1 - (float)Math.pow(1 - swingProgress, 4);
float swingFactorX = MathHelper.sin(swingAmount * PI);
float swingX = MathHelper.sin(swingProgress * PI) * (0.7F - bipedHead.rotateAngleX) * 0.75F;
ModelRenderer mainArm = getArmForSide(mainHand);
mainArm.rotateAngleX -= swingFactorX * 1.2F + swingX;
mainArm.rotateAngleY += bipedBody.rotateAngleY * 2;
mainArm.rotateAngleZ -= MathHelper.sin(swingProgress * PI) * 0.4F;
}
protected void rotateArm(ModelRenderer arm, ArmPose pose, float factor) {
switch (pose) {
case EMPTY:
arm.rotateAngleY = 0;
break;
case ITEM:
arm.rotateAngleX = arm.rotateAngleX / 2 - (PI / 10);
arm.rotateAngleY = 0;
case BLOCK:
arm.rotateAngleX = arm.rotateAngleX / 2 - 0.9424779F;
arm.rotateAngleY = factor * 0.5235988F;
break;
default:
}
}
protected void raiseArm(ModelRenderer up, ModelRenderer down, float factor) {
up.rotateAngleY = bipedHead.rotateAngleY + (factor / 10);
up.rotateAngleX = bipedHead.rotateAngleX - (PI / 2);
down.rotateAngleY = bipedHead.rotateAngleY - (factor / 2);
down.rotateAngleX = bipedHead.rotateAngleX - (PI / 2);
}
}

View file

@ -0,0 +1,76 @@
package com.minelittlepony.model.ponies;
import com.minelittlepony.model.player.ModelAlicorn;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.AbstractIllager;
import net.minecraft.entity.monster.AbstractIllager.IllagerArmPose;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.math.MathHelper;
public class ModelIllagerPony extends ModelAlicorn {
public ModelIllagerPony() {
super(false);
}
@Override
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
AbstractIllager illager = (AbstractIllager) entity;
IllagerArmPose pose = illager.getArmPose();
boolean rightHanded = illager.getPrimaryHand() == EnumHandSide.RIGHT;
if (pose == IllagerArmPose.ATTACKING) {
// vindicator attacking
float f = MathHelper.sin(swingProgress * (float) Math.PI);
float f1 = MathHelper.sin((1.0F - (1.0F - swingProgress) * (1.0F - swingProgress)) * (float) Math.PI);
bipedRightArm.rotateAngleZ = 0.0F;
bipedLeftArm.rotateAngleZ = 0.0F;
bipedRightArm.rotateAngleY = 0.15707964F;
bipedLeftArm.rotateAngleY = -0.15707964F;
if (rightHanded) {
bipedRightArm.rotateAngleX = -1.8849558F + MathHelper.cos(ticks * 0.09F) * 0.15F;
bipedRightArm.rotateAngleX += f * 2.2F - f1 * 0.4F;
} else {
bipedLeftArm.rotateAngleX = -1.8849558F + MathHelper.cos(ticks * 0.09F) * 0.15F;
bipedLeftArm.rotateAngleX += f * 2.2F - f1 * 0.4F;
}
bipedRightArm.rotateAngleZ += MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
bipedLeftArm.rotateAngleZ -= MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
bipedRightArm.rotateAngleX += MathHelper.sin(ticks * 0.067F) * 0.05F;
bipedLeftArm.rotateAngleX -= MathHelper.sin(ticks * 0.067F) * 0.05F;
} else if (pose == IllagerArmPose.SPELLCASTING) {
// waving arms!
if (rightHanded) {
// this.bipedRightArm.rotationPointZ = 0.0F;
// this.bipedRightArm.rotationPointX = -5.0F;
bipedRightArm.rotateAngleX = (float) (-.75F * Math.PI);
bipedRightArm.rotateAngleZ = MathHelper.cos(ticks * 0.6662F) / 4;
bipedRightArm.rotateAngleY = 1.1F;
} else {
// this.bipedLeftArm.rotationPointZ = 0.0F;
// this.bipedLeftArm.rotationPointX = 5.0F;
bipedLeftArm.rotateAngleX = (float) (-.75F * Math.PI);
bipedLeftArm.rotateAngleZ = -MathHelper.cos(ticks * 0.6662F) / 4;
bipedLeftArm.rotateAngleY = -1.1F;
}
} else if (pose == IllagerArmPose.BOW_AND_ARROW) {
if (rightHanded) {
aimBow(ArmPose.EMPTY, ArmPose.BOW_AND_ARROW, ticks);
} else {
aimBow(ArmPose.BOW_AND_ARROW, ArmPose.EMPTY, ticks);
}
}
}
public ModelRenderer getArm(EnumHandSide side) {
return canCast() ? getUnicornArmForSide(side) : getArmForSide(side);
}
}

View file

@ -0,0 +1,72 @@
package com.minelittlepony.model.ponies;
import com.minelittlepony.model.ModelMobPony;
import com.minelittlepony.model.armour.ModelSkeletonPonyArmor;
import com.minelittlepony.model.armour.PonyArmor;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.AbstractSkeleton;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumHandSide;
public class ModelSkeletonPony extends ModelMobPony {
@Override
public PonyArmor createArmour() {
return new PonyArmor(new ModelSkeletonPonyArmor(), new ModelSkeletonPonyArmor());
}
@Override
public boolean isCasting() {
return true;
}
@Override
public void setLivingAnimations(EntityLivingBase entity, float move, float swing, float ticks) {
rightArmPose = ArmPose.EMPTY;
leftArmPose = ArmPose.EMPTY;
ItemStack itemstack = entity.getHeldItem(EnumHand.MAIN_HAND);
if (itemstack.getItem() == Items.BOW && ((AbstractSkeleton)entity).isSwingingArms())
{
if (entity.getPrimaryHand() == EnumHandSide.RIGHT) {
rightArmPose = ArmPose.BOW_AND_ARROW;
} else {
leftArmPose = ArmPose.BOW_AND_ARROW;
}
}
super.setLivingAnimations(entity, move, swing, ticks);
}
@Override
protected void fixSpecialRotationPoints(float move) {
if (rightArmPose != ArmPose.EMPTY && !canCast()) {
bipedRightArm.setRotationPoint(-1.5F, 9.5F, 4);
}
}
protected float getLegOutset() {
if (isSleeping) return 2.6f;
if (isCrouching()) return 0;
return 4;
}
protected int getArmWidth() {
return 2;
}
protected int getArmDepth() {
return 2;
}
protected float getLegRotationX() {
return 3;
}
protected float getArmRotationY() {
return 8;
}
}

View file

@ -0,0 +1,99 @@
package com.minelittlepony.model.ponies;
import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.EntityZombieVillager;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.util.math.MathHelper;
import static com.minelittlepony.model.PonyModelConstants.*;
import com.minelittlepony.model.player.ModelAlicorn;
import com.minelittlepony.render.plane.PlaneRenderer;
public class ModelVillagerPony extends ModelAlicorn {
public PlaneRenderer bag, apron, trinket;
public ModelVillagerPony() {
super(false);
}
@Override
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
float angleY = 0;
if (swingProgress > -9990.0F && !canCast()) {
angleY = MathHelper.sin(MathHelper.sqrt(swingProgress) * PI * 2) * 0.04F;
}
bag.rotateAngleY = angleY;
apron.rotateAngleY = angleY;
trinket.rotateAngleY = angleY;
}
@Override
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
int profession = getProfession(entity);
if (profession > -1) {
bipedBody.postRender(this.scale);
if (profession < 2) {
bag.render(scale);
} else if (profession == 2) {
trinket.render(scale);
} else if (profession > 2) {
apron.render(scale);
}
}
}
protected int getProfession(Entity entity) {
if (entity instanceof EntityVillager) {
return ((EntityVillager) entity).getProfession();
}
if (entity instanceof EntityZombieVillager) {
return ((EntityZombieVillager) entity).getProfession();
}
return -1;
}
@Override
protected void initTextures() {
super.initTextures();
bag = new PlaneRenderer(this, 56, 19);
apron = new PlaneRenderer(this, 56, 16);
trinket = new PlaneRenderer(this, 0, 3);
}
@Override
protected void initPositions(float yOffset, float stretch) {
super.initPositions(yOffset, stretch);
bag.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.tex(56, 25).addBackPlane(-7, -5, -4, 3, 6, stretch) //right bag front
.addBackPlane( 4, -5, -4, 3, 6, stretch) //left bag front
.tex(59, 25).addBackPlane(-7, -5, 4, 3, 6, stretch) //right bag back
.addBackPlane( 4, -5, 4, 3, 6, stretch) //left bag back
.tex(56, 29).addWestPlane(-7, -5, -4, 6, 8, stretch) //right bag outside
.addWestPlane( 7, -5, -4, 6, 8, stretch) //left bag outside
.addWestPlane(-4.01f, -5, -4, 6, 8, stretch) //right bag inside
.addWestPlane( 4.01f, -5, -4, 6, 8, stretch) //left bag inside
.tex(56, 31) .addTopPlane(-4, -4.5F, -1, 8, 1, stretch) //strap front
.addTopPlane(-4, -4.5F, 0, 8, 1, stretch) //strap back
.addBackPlane(-4, -4.5F, 0, 8, 1, stretch)
.addFrontPlane(-4, -4.5F, 0, 8, 1, stretch)
.child(0).tex(56, 16).flipZ().addTopPlane(2, -5, -13, 8, 3, stretch) //left bag top
.flipZ().addTopPlane(2, -5, -2, 8, 3, stretch) //right bag top
.tex(56, 22).flipZ().addBottomPlane(2, 1, -13, 8, 3, stretch) //left bag bottom
.flipZ().addBottomPlane(2, 1, -2, 8, 3, stretch) //right bag bottom
.rotateAngleY = 4.712389F;
apron.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.addBackPlane(-4, -4, -9, 8, 10, stretch);
trinket.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.addBackPlane(-2, -4, -9, 4, 5, stretch);
}
}

View file

@ -0,0 +1,72 @@
package com.minelittlepony.model.ponies;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.EntityWitch;
import net.minecraft.util.ResourceLocation;
import static com.minelittlepony.model.PonyModelConstants.HEAD_RP_X;
import static com.minelittlepony.model.PonyModelConstants.HEAD_RP_Y;
import static com.minelittlepony.model.PonyModelConstants.HEAD_RP_Z;
import com.minelittlepony.render.PonyRenderer;
public class ModelWitchPony extends ModelVillagerPony {
private static final ResourceLocation WITCH_TEXTURES = new ResourceLocation("textures/entity/witch.png");
private PonyRenderer witchHat;
public ModelWitchPony() {
super();
}
@Override
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
rightArmPose = ArmPose.EMPTY;
leftArmPose = ((EntityWitch) entity).getHeldItemMainhand().isEmpty() ? ArmPose.EMPTY : ArmPose.ITEM;
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
if (leftArmPose != ArmPose.EMPTY) {
if (!canCast()) {
bipedRightArm.rotateAngleX = -2 * (float)Math.PI/3;
bipedRightArm.offsetZ = 0.1f;
}
unicornArmRight.offsetZ = -0.1f;
}
}
@Override
public void render(Entity entityIn, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
super.render(entityIn, move, swing, ticks, headYaw, headPitch, scale);
copyModelAngles(bipedHead, witchHat);
TextureManager tex = Minecraft.getMinecraft().getRenderManager().renderEngine;
tex.bindTexture(WITCH_TEXTURES);
witchHat.render(scale * 1.3f);
}
@Override
protected void initTextures() {
super.initTextures();
witchHat = new PonyRenderer(this).size(64, 128);
}
@Override
protected void initPositions(float yOffset, float stretch) {
super.initPositions(yOffset, stretch);
witchHat.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2)
.tex(0, 64).box(-5, -6, -7, 10, 2, 10, stretch)
.child(0).around(1.75F, -4, 2)
.tex(0, 76).box(-5, -5, -7, 7, 4, 7, stretch)
.rotate(-0.05235988F, 0, 0.02617994F)
.child(0).around(1.75F, -4, 2)
.tex(0, 87).box(-5, -4, -7, 4, 4, 4, stretch)
.rotate(-0.10471976F, 0, 0.05235988F)
.child(0).around(1.75F, -2, 2)
.tex(0, 95).box(-5, -2, -7, 1, 2, 1, stretch)
.rotate(-0.20943952F, 0, 0.10471976F);
}
}

View file

@ -0,0 +1,37 @@
package com.minelittlepony.model.ponies;
import com.minelittlepony.model.ModelMobPony;
import com.minelittlepony.model.armour.ModelZombiePonyArmor;
import com.minelittlepony.model.armour.PonyArmor;
import com.minelittlepony.render.AbstractPonyRenderer;
public class ModelZombiePony extends ModelMobPony {
@Override
public PonyArmor createArmour() {
return new PonyArmor(new ModelZombiePonyArmor(), new ModelZombiePonyArmor());
}
@Override
protected void adjustLegs(float move, float swing, float ticks) {
super.adjustLegs(move, swing, ticks);
if (rightArmPose != ArmPose.EMPTY) return;
if (islookAngleRight(move)) {
rotateArmHolding(bipedRightArm, 1, swingProgress, ticks);
} else {
rotateArmHolding(bipedLeftArm, -1, swingProgress, ticks);
}
}
@Override
protected void fixSpecialRotationPoints(float move) {
if (rightArmPose != ArmPose.EMPTY) return;
if (islookAngleRight(move)) {
AbstractPonyRenderer.shiftRotationPoint(bipedRightArm, 0.5F, 1.5F, 3);
} else {
AbstractPonyRenderer.shiftRotationPoint(bipedLeftArm, -0.5F, 1.5F, 3);
}
}
}

View file

@ -0,0 +1,7 @@
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
package com.minelittlepony.model.ponies;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -1,199 +0,0 @@
package com.minelittlepony.model.pony;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.math.MathHelper;
public class ModelBreezie extends ModelBiped {
ModelRenderer neck;
ModelRenderer tail;
ModelRenderer tailStub;
ModelRenderer leftWing;
ModelRenderer rightWing;
public ModelBreezie() {
textureWidth = 64;
textureHeight = 64;
this.bipedHeadwear.showModel = false;
bipedHead = new ModelRenderer(this, 0, 0);
bipedHead.setRotationPoint(0, 0, -4);
bipedHead.addBox(-3, -6, -3F, 6, 6, 6);
bipedHead.setTextureOffset(28, 0).addBox(2F, -7F, 1F, 1, 1, 1);
bipedHead.setTextureOffset(24, 0).addBox(-3F, -7F, 1F, 1, 1, 1);
bipedHead.setTextureOffset(24, 9).addBox(-1F, -2F, -4F, 2, 2, 1);
ModelRenderer antenna = new ModelRenderer(this);
antenna.setTextureOffset(28, 2).addBox(1F, -11F, -2F, 1, 6, 1);
antenna.setTextureOffset(24, 2).addBox(-2F, -11F, -2F, 1, 6, 1);
setRotation(antenna, -0.2617994F, 0F, 0F);
this.bipedHead.addChild(antenna);
bipedBody = new ModelRenderer(this, 2, 12);
bipedBody.addBox(0F, 0F, 0F, 6, 7, 14).setRotationPoint(-3F, 1F, -3F);
setRotation(bipedBody, -0.5235988F, 0F, 0F);
bipedRightArm = new ModelRenderer(this, 36, 12);
bipedRightArm.addBox(0F, 0F, 0F, 2, 12, 2).setRotationPoint(-3F, 8F, -5F);
bipedLeftArm = new ModelRenderer(this, 28, 12);
bipedLeftArm.addBox(0F, 0F, 0F, 2, 12, 2).setRotationPoint(1F, 8F, -5F);
bipedLeftLeg = new ModelRenderer(this, 8, 12);
bipedLeftLeg.addBox(0F, 0F, 0F, 2, 12, 2).setRotationPoint(1F, 12F, 3F);
bipedRightLeg = new ModelRenderer(this, 0, 12);
bipedRightLeg.addBox(0F, 0F, 0F, 2, 12, 2).setRotationPoint(-3F, 12F, 3F);
neck = new ModelRenderer(this, 40, 0);
neck.addBox(0F, 0F, 0F, 2, 5, 2).setRotationPoint(-1F, -2F, -4F);
setRotation(neck, 0.0872665F, 0F, 0F);
tailStub = new ModelRenderer(this, 40, 7);
tailStub.addBox(0F, 0F, 0F, 1, 1, 3).setRotationPoint(-0.5F, 8F, 8F);
tail = new ModelRenderer(this, 32, 0);
tail.addBox(0F, 0F, 1F, 2, 9, 2).setRotationPoint(-1F, 7F, 10F);
leftWing = new ModelRenderer(this, 0, 40);
leftWing.addBox(0F, -12F, 0F, 24, 24, 0);
leftWing.setRotationPoint(2F, 3F, 1F);
leftWing.setTextureSize(64, 32);
setRotation(leftWing, 0F, -0.6981317F, 0F);
rightWing = new ModelRenderer(this, 0, 40);
rightWing.addBox(-24F, -12F, 0F, 24, 24, 0, true);
rightWing.setRotationPoint(-2F, 3F, 1F);
rightWing.setTextureSize(64, 32);
setRotation(rightWing, 0F, 0.6981317F, 0F);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
super.render(entity, f, f1, f2, f3, f4, f5);
neck.render(f5);
tailStub.render(f5);
tail.render(f5);
leftWing.render(f5);
rightWing.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z) {
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
@SuppressWarnings("incomplete-switch")
@Override
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {
this.bipedHead.rotateAngleY = netHeadYaw * 0.017453292F;
this.bipedHead.rotateAngleX = headPitch * 0.017453292F;
this.bipedRightArm.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float) Math.PI) * 2.0F * limbSwingAmount * 0.5F;
this.bipedLeftArm.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 2.0F * limbSwingAmount * 0.5F;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
this.bipedRightLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount;
this.bipedLeftLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount;
this.bipedRightLeg.rotateAngleY = 0.0F;
this.bipedLeftLeg.rotateAngleY = 0.0F;
this.bipedRightLeg.rotateAngleZ = 0.0F;
this.bipedLeftLeg.rotateAngleZ = 0.0F;
if (this.isRiding) {
this.bipedRightArm.rotateAngleX += -((float) Math.PI / 5F);
this.bipedLeftArm.rotateAngleX += -((float) Math.PI / 5F);
this.bipedRightLeg.rotateAngleX = -1.4137167F;
this.bipedRightLeg.rotateAngleY = ((float) Math.PI / 10F);
this.bipedRightLeg.rotateAngleZ = 0.07853982F;
this.bipedLeftLeg.rotateAngleX = -1.4137167F;
this.bipedLeftLeg.rotateAngleY = -((float) Math.PI / 10F);
this.bipedLeftLeg.rotateAngleZ = -0.07853982F;
}
this.bipedRightArm.rotateAngleY = 0;
this.bipedRightArm.rotateAngleZ = 0F;
switch (this.leftArmPose) {
case EMPTY:
this.bipedLeftArm.rotateAngleY = 0.0F;
break;
case BLOCK:
this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - 0.9424779F;
this.bipedLeftArm.rotateAngleY = 0.5235988F;
break;
case ITEM:
this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - ((float) Math.PI / 10F);
this.bipedLeftArm.rotateAngleY = 0.0F;
}
switch (this.rightArmPose) {
case EMPTY:
this.bipedRightArm.rotateAngleY = 0.0F;
break;
case BLOCK:
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - 0.9424779F;
this.bipedRightArm.rotateAngleY = -0.5235988F;
break;
case ITEM:
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - ((float) Math.PI / 10F);
this.bipedRightArm.rotateAngleY = 0.0F;
}
if (this.swingProgress > 0.0F) {
EnumHandSide enumhandside = this.getMainHand(entityIn);
ModelRenderer modelrenderer = this.getArmForSide(enumhandside);
float f1 = this.swingProgress;
this.bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt(f1) * ((float) Math.PI * 2F)) * 0.2F;
if (enumhandside == EnumHandSide.LEFT) {
this.bipedBody.rotateAngleY *= -1.0F;
}
this.bipedRightArm.rotationPointZ = MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F;
this.bipedRightArm.rotationPointX = -MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F;
this.bipedLeftArm.rotationPointZ = -MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F;
this.bipedLeftArm.rotationPointX = MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F;
this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY;
this.bipedLeftArm.rotateAngleY += this.bipedBody.rotateAngleY;
//noinspection SuspiciousNameCombination
this.bipedLeftArm.rotateAngleX += this.bipedBody.rotateAngleY;
f1 = 1.0F - this.swingProgress;
f1 = f1 * f1;
f1 = f1 * f1;
f1 = 1.0F - f1;
float f2 = MathHelper.sin(f1 * (float) Math.PI);
float f3 = MathHelper.sin(this.swingProgress * (float) Math.PI) * -(this.bipedHead.rotateAngleX - 0.7F) * 0.75F;
modelrenderer.rotateAngleX = (float) (modelrenderer.rotateAngleX - (f2 * 1.2D + f3));
modelrenderer.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
modelrenderer.rotateAngleZ += MathHelper.sin(this.swingProgress * (float) Math.PI) * -0.4F;
}
this.bipedRightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
this.bipedLeftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
if (this.rightArmPose == ModelBiped.ArmPose.BOW_AND_ARROW) {
this.bipedRightArm.rotateAngleY = -0.1F + this.bipedHead.rotateAngleY;
this.bipedLeftArm.rotateAngleY = 0.1F + this.bipedHead.rotateAngleY + 0.4F;
this.bipedRightArm.rotateAngleX = -((float) Math.PI / 2F) + this.bipedHead.rotateAngleX;
this.bipedLeftArm.rotateAngleX = -((float) Math.PI / 2F) + this.bipedHead.rotateAngleX;
} else if (this.leftArmPose == ModelBiped.ArmPose.BOW_AND_ARROW) {
this.bipedRightArm.rotateAngleY = -0.1F + this.bipedHead.rotateAngleY - 0.4F;
this.bipedLeftArm.rotateAngleY = 0.1F + this.bipedHead.rotateAngleY;
this.bipedRightArm.rotateAngleX = -((float) Math.PI / 2F) + this.bipedHead.rotateAngleX;
this.bipedLeftArm.rotateAngleX = -((float) Math.PI / 2F) + this.bipedHead.rotateAngleX;
}
}
}

View file

@ -1,20 +0,0 @@
package com.minelittlepony.model.pony;
import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.model.BodyPart;
public class ModelHumanPlayer extends AbstractPonyModel {
public ModelHumanPlayer(boolean smallArms) {
super(smallArms);
}
@Override
protected boolean doCancelRender() {
return true;
}
@Override
public void transform(BodyPart part) {
}
}

View file

@ -1,76 +0,0 @@
package com.minelittlepony.model.pony;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.AbstractIllager;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.math.MathHelper;
public class ModelIllagerPony extends ModelPlayerPony {
public ModelIllagerPony() {
super(false);
}
@Override
public void setRotationAngles(float swing, float move, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {
super.setRotationAngles(swing, move, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
AbstractIllager illager = (AbstractIllager) entityIn;
AbstractIllager.IllagerArmPose pose = illager.getArmPose();
boolean rightHanded = illager.getPrimaryHand() == EnumHandSide.RIGHT;
if (pose == AbstractIllager.IllagerArmPose.ATTACKING) {
// vindicator attacking
float f = MathHelper.sin(this.swingProgress * (float) Math.PI);
float f1 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float) Math.PI);
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
this.bipedRightArm.rotateAngleY = 0.15707964F;
this.bipedLeftArm.rotateAngleY = -0.15707964F;
if (rightHanded) {
this.bipedRightArm.rotateAngleX = -1.8849558F + MathHelper.cos(ageInTicks * 0.09F) * 0.15F;
this.bipedRightArm.rotateAngleX += f * 2.2F - f1 * 0.4F;
} else {
this.bipedLeftArm.rotateAngleX = -1.8849558F + MathHelper.cos(ageInTicks * 0.09F) * 0.15F;
this.bipedLeftArm.rotateAngleX += f * 2.2F - f1 * 0.4F;
}
this.bipedRightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
this.bipedLeftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
} else if (pose == AbstractIllager.IllagerArmPose.SPELLCASTING) {
if (this.metadata.hasMagic()) {
this.horn.setUsingMagic(true);
}
// waving arms!
if (rightHanded) {
// this.bipedRightArm.rotationPointZ = 0.0F;
// this.bipedRightArm.rotationPointX = -5.0F;
this.bipedRightArm.rotateAngleX = (float) (-.75F * Math.PI);
this.bipedRightArm.rotateAngleZ = MathHelper.cos(ageInTicks * 0.6662F) * 0.25F;
this.bipedRightArm.rotateAngleY = 1.1F;
} else {
// this.bipedLeftArm.rotationPointZ = 0.0F;
// this.bipedLeftArm.rotationPointX = 5.0F;
this.bipedLeftArm.rotateAngleX = (float) (-.75F * Math.PI);
this.bipedLeftArm.rotateAngleZ = -MathHelper.cos(ageInTicks * 0.6662F) * 0.25F;
this.bipedLeftArm.rotateAngleY = -1.1F;
}
} else if (pose == AbstractIllager.IllagerArmPose.BOW_AND_ARROW) {
if (rightHanded) {
aimBow(ArmPose.EMPTY, ArmPose.BOW_AND_ARROW, ageInTicks);
} else {
aimBow(ArmPose.BOW_AND_ARROW, ArmPose.EMPTY, ageInTicks);
}
}
}
public ModelRenderer getArm(EnumHandSide side) {
return metadata.hasMagic() ? side == EnumHandSide.LEFT ? this.unicornArmLeft : this.unicornArmRight : this.getArmForSide(side);
}
}

View file

@ -1,940 +0,0 @@
package com.minelittlepony.model.pony;
import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.PegasusWings;
import com.minelittlepony.model.PonyModelConstants;
import com.minelittlepony.model.PonySnout;
import com.minelittlepony.model.UnicornHorn;
import com.minelittlepony.renderer.PlaneRenderer;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.math.MathHelper;
import static net.minecraft.client.renderer.GlStateManager.popMatrix;
import static net.minecraft.client.renderer.GlStateManager.pushMatrix;
public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConstants {
private final boolean smallArms;
public boolean rainboom;
public ModelRenderer bipedCape;
public PlaneRenderer[] Bodypiece;
public PlaneRenderer[] BodypieceNeck;
public ModelRenderer unicornArmRight;
public ModelRenderer unicornArmLeft;
public PlaneRenderer[] Tail;
public PonySnout snout;
public UnicornHorn horn;
public PegasusWings wings;
public ModelPlayerPony(boolean smallArms) {
super(smallArms);
this.smallArms = smallArms;
}
public void init(float yOffset, float stretch) {
super.init(yOffset, stretch);
snout = new PonySnout(this, yOffset, stretch);
horn = new UnicornHorn(this, yOffset, stretch);
wings = new PegasusWings(this, yOffset, stretch);
}
@Override
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor,
Entity entityIn) {
super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
this.checkRainboom(entityIn, limbSwingAmount);
this.rotateHead(netHeadYaw, headPitch);
this.swingTailZ(limbSwing, limbSwingAmount);
float bodySwingRotation = 0.0F;
if (this.swingProgress > -9990.0F && !this.metadata.hasMagic()) {
bodySwingRotation = MathHelper.sin(MathHelper.sqrt(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
}
this.bipedBody.rotateAngleY = bodySwingRotation * 0.2F;
int k1;
for (k1 = 0; k1 < this.Bodypiece.length; ++k1) {
this.Bodypiece[k1].rotateAngleY = bodySwingRotation * 0.2F;
}
for (k1 = 0; k1 < this.BodypieceNeck.length; ++k1) {
this.BodypieceNeck[k1].rotateAngleY = bodySwingRotation * 0.2F;
}
int tailstop = this.Tail.length - this.metadata.getTail().getSize() * 5;
if (tailstop <= 1) {
tailstop = 0;
}
for (k1 = 0; k1 < tailstop; ++k1) {
this.Tail[k1].rotateAngleY = bodySwingRotation;
}
this.bipedHead.offsetY = 0f;
this.bipedHead.offsetZ = 0f;
this.bipedHeadwear.offsetY = 0f;
this.bipedHeadwear.offsetZ = 0f;
this.setLegs(limbSwing, limbSwingAmount, ageInTicks, entityIn);
this.holdItem(limbSwingAmount);
this.swingItem(entityIn, this.swingProgress);
if (this.isSneak && !this.isFlying && !this.rainboom) {
this.adjustBody(BODY_ROTATE_ANGLE_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK);
this.sneakLegs();
this.setHead(0.0F, 6.0F, -2.0F);
this.sneakTail();
} else if (this.isRiding) {
this.adjustBodyComponents(BODY_ROTATE_ANGLE_X_RIDING, BODY_RP_Y_RIDING, BODY_RP_Z_RIDING);
this.adjustNeck(BODY_ROTATE_ANGLE_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK);
this.setHead(0.0F, 0.0F, 0.0F);
this.bipedLeftLeg.rotationPointZ = 15;
this.bipedLeftLeg.rotationPointY = 10;
this.bipedLeftLeg.rotateAngleX = (float) (Math.PI * -0.25);
this.bipedLeftLeg.rotateAngleY = (float) (Math.PI * -0.2);
this.bipedRightLeg.rotationPointZ = 15;
this.bipedRightLeg.rotationPointY = 10;
this.bipedRightLeg.rotateAngleX = (float) (Math.PI * -0.25);
this.bipedRightLeg.rotateAngleY = (float) (Math.PI * 0.2);
this.bipedLeftArm.rotateAngleZ = (float) (Math.PI * -0.06);
this.bipedRightArm.rotateAngleZ = (float) (Math.PI * 0.06);
for (PlaneRenderer aTail : Tail) {
aTail.rotationPointZ = 13;
aTail.rotationPointY = 3;
aTail.rotateAngleX = (float) (Math.PI * 0.2);
}
} else {
this.adjustBody(BODY_ROTATE_ANGLE_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK);
this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
this.bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
this.swingArms(ageInTicks);
this.setHead(0.0F, 0.0F, 0.0F);
for (k1 = 0; k1 < tailstop; ++k1) {
setRotationPoint(this.Tail[k1], TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_NOTSNEAK);
if (this.rainboom) {
this.Tail[k1].rotateAngleX = ROTATE_90 + 0.1F * MathHelper.sin(limbSwing);
} else {
this.Tail[k1].rotateAngleX = 0.5F * limbSwingAmount;
}
}
if (!this.rainboom) {
this.swingTailX(ageInTicks);
}
}
if (this.rainboom) {
for (k1 = 0; k1 < tailstop; ++k1) {
this.Tail[k1].rotationPointY += 6.0F;
++this.Tail[k1].rotationPointZ;
}
}
if (this.isSleeping) {
this.ponySleep();
}
this.aimBow(leftArmPose, rightArmPose, ageInTicks);
this.fixSpecialRotations();
this.fixSpecialRotationPoints(limbSwing);
animateWears();
this.bipedCape.rotationPointY = isSneak ? 2 : isRiding ? -4 : 0;
this.snout.setGender(this.metadata.getGender());
this.snout.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
this.wings.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
}
private void animateWears() {
copyModelAngles(bipedLeftArm, bipedLeftArmwear);
copyModelAngles(bipedRightArm, bipedRightArmwear);
copyModelAngles(bipedLeftLeg, bipedLeftLegwear);
copyModelAngles(bipedRightLeg, bipedRightLegwear);
copyModelAngles(bipedBody, bipedBodyWear);
}
protected void checkRainboom(Entity entity, float swing) {
boolean flying = this.metadata.getRace().hasWings() && this.isFlying
|| entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying();
this.rainboom = flying && swing >= 0.9999F;
}
protected void setHead(float posX, float posY, float posZ) {
setRotationPoint(this.bipedHead, posX, posY, posZ);
setRotationPoint(this.bipedHeadwear, posX, posY, posZ);
}
protected void rotateHead(float horz, float vert) {
float headRotateAngleY;
float headRotateAngleX;
if (this.isSleeping) {
headRotateAngleY = 1.4F;
headRotateAngleX = 0.1F;
} else {
headRotateAngleY = horz / 57.29578F;
headRotateAngleX = vert / 57.29578F;
}
final float max = (float) (0.5f - Math.toRadians(this.motionPitch));
final float min = (float) (-1.25f - Math.toRadians(this.motionPitch));
headRotateAngleX = Math.min(headRotateAngleX, max);
headRotateAngleX = Math.max(headRotateAngleX, min);
this.bipedHead.rotateAngleY = headRotateAngleY;
this.bipedHead.rotateAngleX = headRotateAngleX;
this.bipedHeadwear.rotateAngleY = headRotateAngleY;
this.bipedHeadwear.rotateAngleX = headRotateAngleX;
}
protected void setLegs(float move, float swing, float tick, Entity entity) {
this.rotateLegs(move, swing, tick, entity);
this.adjustLegs();
}
protected void rotateLegs(float move, float swing, float tick, Entity entity) {
float rightArmRotateAngleX;
float leftArmRotateAngleX;
float rightLegRotateAngleX;
float leftLegRotateAngleX;
if (this.isFlying && this.metadata.getRace().hasWings() || entity instanceof EntityLivingBase && ((EntityLivingBase) entity)
.isElytraFlying()) {
if (this.rainboom) {
rightArmRotateAngleX = ROTATE_270;
leftArmRotateAngleX = ROTATE_270;
rightLegRotateAngleX = ROTATE_90;
leftLegRotateAngleX = ROTATE_90;
} else {
rightArmRotateAngleX = MathHelper.sin(0.0F - swing * 0.5F);
leftArmRotateAngleX = MathHelper.sin(0.0F - swing * 0.5F);
rightLegRotateAngleX = MathHelper.sin(swing * 0.5F);
leftLegRotateAngleX = MathHelper.sin(swing * 0.5F);
}
this.steveRightArm.rotateAngleY = 0.2F;
this.bipedRightArm.rotateAngleY = 0.2F;
this.bipedLeftArm.rotateAngleY = -0.2F;
this.bipedRightLeg.rotateAngleY = -0.2F;
this.bipedLeftLeg.rotateAngleY = 0.2F;
} else {
float swag = (float) Math.pow(swing, 16.0D);
float raQuad = 3.1415927F * swag * 0.5F;
float laQuad = 3.1415927F * swag;
float rlQuad = 3.1415927F * swag * 0.2F;
float llQuad = 3.1415927F * swag * -0.4F;
rightArmRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + raQuad) * 0.45F * swing;
leftArmRotateAngleX = MathHelper.cos(move * 0.6662F + laQuad) * 0.45F * swing;
rightLegRotateAngleX = MathHelper.cos(move * 0.6662F + rlQuad) * 0.45F * swing;
leftLegRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + llQuad) * 0.45F * swing;
this.steveRightArm.rotateAngleY = 0.0F;
this.unicornArmRight.rotateAngleY = 0.0F;
this.unicornArmLeft.rotateAngleY = 0.0F;
this.bipedRightArm.rotateAngleY = 0.0F;
this.bipedLeftArm.rotateAngleY = 0.0F;
this.bipedRightLeg.rotateAngleY = 0.0F;
this.bipedLeftLeg.rotateAngleY = 0.0F;
}
this.bipedRightArm.rotateAngleX = rightArmRotateAngleX;
this.steveRightArm.rotateAngleX = rightArmRotateAngleX;
this.unicornArmRight.rotateAngleX = 0.0F;
this.unicornArmLeft.rotateAngleX = 0.0F;
this.bipedLeftArm.rotateAngleX = leftArmRotateAngleX;
this.bipedRightLeg.rotateAngleX = rightLegRotateAngleX;
this.bipedLeftLeg.rotateAngleX = leftLegRotateAngleX;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.steveRightArm.rotateAngleZ = 0.0F;
this.unicornArmRight.rotateAngleZ = 0.0F;
this.unicornArmLeft.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
}
protected void adjustLegs() {
float sinBodyRotateAngleYFactor = MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F;
float cosBodyRotateAngleYFactor = MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F;
float legOutset = 4.0F;
if (this.isSneak && !this.isFlying) {
legOutset = smallArms ? 1.0F : 0F;
}
if (this.isSleeping) {
legOutset = 2.6F;
}
if (this.rainboom) {
this.bipedRightArm.rotationPointZ = sinBodyRotateAngleYFactor + 2.0F;
this.steveRightArm.rotationPointZ = sinBodyRotateAngleYFactor + 2.0F;
this.bipedLeftArm.rotationPointZ = 0.0F - sinBodyRotateAngleYFactor + 2.0F;
} else {
this.bipedRightArm.rotationPointZ = sinBodyRotateAngleYFactor + 1.0F;
this.steveRightArm.rotationPointZ = sinBodyRotateAngleYFactor + 1.0F;
this.bipedLeftArm.rotationPointZ = 0.0F - sinBodyRotateAngleYFactor + 1.0F;
}
this.steveRightArm.rotationPointX = 0.0F - cosBodyRotateAngleYFactor;
this.bipedRightArm.rotationPointX = 0.0F - cosBodyRotateAngleYFactor - 1.0F + legOutset;
this.bipedLeftArm.rotationPointX = cosBodyRotateAngleYFactor + 2.0F - legOutset;
this.bipedRightLeg.rotationPointX = 0.0F - cosBodyRotateAngleYFactor - 1.0F + legOutset;
this.bipedLeftLeg.rotationPointX = cosBodyRotateAngleYFactor + 1.0F - legOutset;
this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY;
this.bipedLeftArm.rotateAngleY += this.bipedBody.rotateAngleY;
//noinspection SuspiciousNameCombination
this.bipedLeftArm.rotateAngleX += this.bipedBody.rotateAngleY;
this.bipedRightArm.rotationPointY = 8.0F;
this.bipedLeftArm.rotationPointY = 8.0F;
this.bipedRightLeg.rotationPointZ = 10.0F;
this.bipedLeftLeg.rotationPointZ = 10.0F;
}
protected void swingTailZ(float move, float swing) {
int tailstop = this.Tail.length - this.metadata.getTail().getSize() * 5;
if (tailstop <= 1) {
tailstop = 0;
}
for (int j = 0; j < tailstop; ++j) {
if (this.rainboom) {
this.Tail[j].rotateAngleZ = 0.0F;
} else {
this.Tail[j].rotateAngleZ = MathHelper.cos(move * 0.8F) * 0.2F * swing;
}
}
}
protected void swingTailX(float tick) {
float sinTickFactor = MathHelper.sin(tick * 0.067F) * 0.05F;
int tailstop = this.Tail.length - this.metadata.getTail().getSize() * 5;
if (tailstop <= 1) {
tailstop = 0;
}
for (int l6 = 0; l6 < tailstop; ++l6) {
this.Tail[l6].rotateAngleX += sinTickFactor;
}
}
@SuppressWarnings("incomplete-switch")
protected void holdItem(float swing) {
if (!this.rainboom && !this.metadata.hasMagic()) {
boolean bothHoovesAreOccupied = this.leftArmPose == ArmPose.ITEM && this.rightArmPose == ArmPose.ITEM;
switch (this.leftArmPose) {
case EMPTY:
this.bipedLeftArm.rotateAngleY = 0.0F;
break;
case BLOCK:
this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - 0.9424779F;
this.bipedLeftArm.rotateAngleY = (float) (Math.PI / 6);
break;
case ITEM:
float swag = 1f;
if (!isFlying && bothHoovesAreOccupied) {
swag = (float) (1d - Math.pow(swing, 2d));
}
float rotationMultiplier = 0.5f + 0.5f * (1f - swag);
this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * rotationMultiplier - ((float) Math.PI / 10F) * swag;
this.bipedLeftArm.rotateAngleY = 0.0F;
}
switch (this.rightArmPose) {
case EMPTY:
this.bipedRightArm.rotateAngleY = 0.0F;
break;
case BLOCK:
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - 0.9424779F;
this.bipedRightArm.rotateAngleY = (float) (-Math.PI / 6);
break;
case ITEM:
float swag = 1f;
if (!isFlying && bothHoovesAreOccupied) {
swag = (float) (1d - Math.pow(swing, 2d));
}
float rotationMultiplier = 0.5f + 0.5f * (1f - swag);
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * rotationMultiplier - ((float) Math.PI / 10F) * swag;
this.bipedRightArm.rotateAngleY = 0.0F;
}
} else if (this.metadata.hasMagic()) {
if (this.leftArmPose == ArmPose.BLOCK) {
this.unicornArmLeft.rotateAngleX = this.unicornArmLeft.rotateAngleX * 0.5F - 0.9424779F;
this.unicornArmLeft.rotateAngleY = (float) (Math.PI / 6);
}
if (this.rightArmPose == ArmPose.BLOCK) {
this.unicornArmRight.rotateAngleY = (float) (-Math.PI / 6);
this.unicornArmRight.rotateAngleX = this.unicornArmRight.rotateAngleX * 0.5F - 0.9424779F;
}
}
this.horn.setUsingMagic(this.leftArmPose != ArmPose.EMPTY || this.rightArmPose != ArmPose.EMPTY);
}
protected void swingItem(Entity entity, float swingProgress) {
if (swingProgress > -9990.0F && !this.isSleeping) {
float f16 = 1.0F - swingProgress;
f16 *= f16 * f16;
f16 = 1.0F - f16;
float f22 = MathHelper.sin(f16 * 3.1415927F);
float f28 = MathHelper.sin(swingProgress * 3.1415927F);
float f33 = f28 * -(this.bipedHead.rotateAngleX - 0.7F) * 0.75F;
EnumHandSide mainSide = this.getMainHand(entity);
boolean mainRight = mainSide == EnumHandSide.RIGHT;
ArmPose mainPose = mainRight ? this.rightArmPose : this.leftArmPose;
if (this.metadata.hasMagic() && mainPose != ArmPose.EMPTY) {
ModelRenderer unicornarm = mainSide == EnumHandSide.LEFT ? this.unicornArmLeft : this.unicornArmRight;
unicornarm.rotateAngleX = (float) (this.unicornArmRight.rotateAngleX - (f22 * 1.2D + f33));
unicornarm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
unicornarm.rotateAngleZ = f28 * -0.4F;
} else {
ModelRenderer bipedArm = this.getArmForSide(mainSide);
ModelRenderer steveArm = mainRight ? this.steveRightArm : this.steveLeftArm;
bipedArm.rotateAngleX = (float) (bipedArm.rotateAngleX - (f22 * 1.2D + f33));
bipedArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
bipedArm.rotateAngleZ = f28 * -0.4F;
steveArm.rotateAngleX = (float) (steveArm.rotateAngleX - (f22 * 1.2D + f33));
steveArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
steveArm.rotateAngleZ = f28 * -0.4F;
}
}
}
protected void swingArms(float tick) {
if (this.rightArmPose != ArmPose.EMPTY && !this.isSleeping) {
float cosTickFactor = MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
float sinTickFactor = MathHelper.sin(tick * 0.067F) * 0.05F;
if (this.metadata.hasMagic()) {
this.unicornArmRight.rotateAngleZ += cosTickFactor;
this.unicornArmRight.rotateAngleX += sinTickFactor;
} else {
this.bipedRightArm.rotateAngleZ += cosTickFactor;
this.bipedRightArm.rotateAngleX += sinTickFactor;
this.steveRightArm.rotateAngleZ += cosTickFactor;
this.steveRightArm.rotateAngleX += sinTickFactor;
}
}
if (this.leftArmPose != ArmPose.EMPTY && !this.isSleeping) {
float cosTickFactor = MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
float sinTickFactor = MathHelper.sin(tick * 0.067F) * 0.05F;
if (this.metadata.hasMagic()) {
this.unicornArmLeft.rotateAngleZ += cosTickFactor;
this.unicornArmLeft.rotateAngleX += sinTickFactor;
} else {
this.bipedLeftArm.rotateAngleZ += cosTickFactor;
this.bipedLeftArm.rotateAngleX += sinTickFactor;
this.steveLeftArm.rotateAngleZ += cosTickFactor;
this.steveLeftArm.rotateAngleX += sinTickFactor;
}
}
}
protected void adjustBody(float rotateAngleX, float rotationPointY, float rotationPointZ) {
this.adjustBodyComponents(rotateAngleX, rotationPointY, rotationPointZ);
this.adjustNeck(rotateAngleX, rotationPointY, rotationPointZ);
}
protected void adjustBodyComponents(float rotateAngleX, float rotationPointY, float rotationPointZ) {
this.bipedBody.rotateAngleX = rotateAngleX;
this.bipedBody.rotationPointY = rotationPointY;
this.bipedBody.rotationPointZ = rotationPointZ;
int k3;
for (k3 = 0; k3 < this.Bodypiece.length; ++k3) {
this.Bodypiece[k3].rotateAngleX = rotateAngleX;
this.Bodypiece[k3].rotationPointY = rotationPointY;
this.Bodypiece[k3].rotationPointZ = rotationPointZ;
}
}
protected void adjustNeck(float rotateAngleX, float rotationPointY, float rotationPointZ) {
for (PlaneRenderer aBodypieceNeck : this.BodypieceNeck) {
aBodypieceNeck.rotateAngleX = NECK_ROT_X + rotateAngleX;
aBodypieceNeck.rotationPointY = rotationPointY;
aBodypieceNeck.rotationPointZ = rotationPointZ;
}
}
protected void sneakLegs() {
this.steveRightArm.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
this.unicornArmRight.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
this.unicornArmLeft.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
this.bipedRightArm.rotateAngleX -= SNEAK_LEG_X_ROTATION_ADJUSTMENT;
this.bipedLeftArm.rotateAngleX -= SNEAK_LEG_X_ROTATION_ADJUSTMENT;
this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_SNEAK;
this.bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_SNEAK;
}
protected void sneakTail() {
int tailstop = this.Tail.length - this.metadata.getTail().getSize() * 5;
if (tailstop <= 1) {
tailstop = 0;
}
for (int i7 = 0; i7 < tailstop; ++i7) {
setRotationPoint(this.Tail[i7], TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_SNEAK);
this.Tail[i7].rotateAngleX = -BODY_ROTATE_ANGLE_X_SNEAK + 0.1F;
}
}
protected void ponySleep() {
this.bipedRightArm.rotateAngleX = ROTATE_270;
this.bipedLeftArm.rotateAngleX = ROTATE_270;
this.bipedRightLeg.rotateAngleX = ROTATE_90;
this.bipedLeftLeg.rotateAngleX = ROTATE_90;
float headPosX;
float headPosY;
float headPosZ;
if (this.isSneak) {
headPosY = 2.0F;
headPosZ = -1.0F;
headPosX = 1.0F;
} else {
headPosY = 2.0F;
headPosZ = 1.0F;
headPosX = 1.0F;
}
this.setHead(headPosX, headPosY, headPosZ);
shiftRotationPoint(this.bipedRightArm, 0.0F, 2.0F, 6.0F);
shiftRotationPoint(this.bipedLeftArm, 0.0F, 2.0F, 6.0F);
shiftRotationPoint(this.bipedRightLeg, 0.0F, 2.0F, -8.0F);
shiftRotationPoint(this.bipedLeftLeg, 0.0F, 2.0F, -8.0F);
}
protected void aimBow(ArmPose leftArm, ArmPose rightArm, float tick) {
if (leftArm == ArmPose.BOW_AND_ARROW || rightArm == ArmPose.BOW_AND_ARROW) {
if (this.metadata.hasMagic()) {
this.aimBowUnicorn(tick);
} else {
this.aimBowPony(leftArm, rightArm, tick);
}
}
}
protected void aimBowPony(ArmPose leftArm, ArmPose rightArm, float tick) {
if (rightArm == ArmPose.BOW_AND_ARROW) {
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedRightArm.rotateAngleY = -0.06F + this.bipedHead.rotateAngleY;
this.bipedRightArm.rotateAngleX = ROTATE_270 + this.bipedHead.rotateAngleX;
this.bipedRightArm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.05F;
shiftRotationPoint(this.bipedRightArm, 0.0F, 0.0F, 1.0F);
} else if (leftArm == ArmPose.BOW_AND_ARROW) {
this.bipedLeftArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleY = -0.06F + this.bipedHead.rotateAngleY;
this.bipedLeftArm.rotateAngleX = ROTATE_270 + this.bipedHead.rotateAngleX;
this.bipedLeftArm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.bipedLeftArm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.05F;
shiftRotationPoint(this.bipedLeftArm, 0.0F, 0.0F, 1.0F);
}
}
protected void aimBowUnicorn(float tick) {
this.unicornArmRight.rotateAngleZ = 0.0F;
this.unicornArmRight.rotateAngleY = -0.06F + this.bipedHead.rotateAngleY;
this.unicornArmRight.rotateAngleX = ROTATE_270 + this.bipedHead.rotateAngleX;
this.unicornArmRight.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.unicornArmRight.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.05F;
}
protected void fixSpecialRotations() {
this.Bodypiece[9].rotateAngleX += 0.5F;
this.Bodypiece[10].rotateAngleX += 0.5F;
this.Bodypiece[11].rotateAngleX += 0.5F;
this.Bodypiece[12].rotateAngleX += 0.5F;
this.Bodypiece[13].rotateAngleX += 0.5F;
}
protected void fixSpecialRotationPoints(float move) {
}
@Override
public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
pushMatrix();
this.transform(BodyPart.HEAD);
this.renderHead(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
popMatrix();
pushMatrix();
this.transform(BodyPart.NECK);
this.renderNeck();
popMatrix();
pushMatrix();
this.transform(BodyPart.BODY);
this.renderBody(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
this.renderTail();
popMatrix();
pushMatrix();
this.transform(BodyPart.LEGS);
this.renderLegs();
popMatrix();
}
protected void renderHead(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch,
float scale) {
this.bipedHead.render(this.scale);
this.bipedHeadwear.render(this.scale);
this.bipedHead.postRender(scale);
this.horn.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
}
protected void renderNeck() {
GlStateManager.scale(0.9, 0.9, 0.9);
for (PlaneRenderer element : this.BodypieceNeck) {
element.render(this.scale);
}
}
protected void renderBody(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch,
float scale) {
this.bipedBody.render(this.scale);
if (this.textureHeight == 64) {
this.bipedBodyWear.render(this.scale);
}
for (PlaneRenderer aBodypiece : this.Bodypiece) {
aBodypiece.render(this.scale);
}
this.bipedBody.postRender(scale);
this.wings.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, this.scale);
}
protected void renderTail() {
int var3 = this.Tail.length - this.metadata.getTail().getSize() * 5;
if (var3 <= 1) {
var3 = 0;
}
// this.bipedBody.postRender(this.scale);
for (int k = 0; k < var3; ++k) {
this.Tail[k].render(this.scale);
}
}
protected void renderLegs() {
if (!this.isSneak) {
this.bipedBody.postRender(this.scale);
}
this.bipedLeftArm.render(this.scale);
this.bipedRightArm.render(this.scale);
this.bipedLeftLeg.render(this.scale);
this.bipedRightLeg.render(this.scale);
if (this.textureHeight == 64) {
this.bipedLeftArmwear.render(this.scale);
this.bipedRightArmwear.render(this.scale);
this.bipedLeftLegwear.render(this.scale);
this.bipedRightLegwear.render(this.scale);
}
}
@Override
protected void initTextures() {
this.boxList.clear();
this.Tail = new PlaneRenderer[21];
this.Bodypiece = new PlaneRenderer[14];
this.BodypieceNeck = new PlaneRenderer[4];
this.initHeadTextures();
this.initBodyTextures();
this.initLegTextures();
this.initTailTextures();
}
protected void initHeadTextures() {
this.bipedCape = new ModelRenderer(this, 0, 0).setTextureSize(64, 32);
this.bipedHead = new ModelRenderer(this, 0, 0);
this.bipedHeadwear = new ModelRenderer(this, 32, 0);
}
protected void initBodyTextures() {
this.bipedBody = new ModelRenderer(this, 16, 16);
if (this.textureHeight == 64) {
this.bipedBodyWear = new ModelRenderer(this, 16, 32);
}
this.Bodypiece[0] = new PlaneRenderer(this, 24, 0);
this.Bodypiece[0].mirrorz = true;
this.Bodypiece[1] = new PlaneRenderer(this, 24, 0);
this.Bodypiece[2] = new PlaneRenderer(this, 32, 20);
this.Bodypiece[2].mirrorz = true;
this.Bodypiece[3] = new PlaneRenderer(this, 56, 0);
this.Bodypiece[4] = new PlaneRenderer(this, 4, 0);
this.Bodypiece[4].mirrorz = true;
this.Bodypiece[5] = new PlaneRenderer(this, 4, 0);
this.Bodypiece[6] = new PlaneRenderer(this, 36, 16);
this.Bodypiece[7] = new PlaneRenderer(this, 36, 16);
this.Bodypiece[8] = new PlaneRenderer(this, 36, 16);
this.Bodypiece[9] = new PlaneRenderer(this, 32, 0);
this.Bodypiece[10] = new PlaneRenderer(this, 32, 0);
this.Bodypiece[11] = new PlaneRenderer(this, 32, 0);
this.Bodypiece[11].mirror = true;
this.Bodypiece[12] = new PlaneRenderer(this, 32, 0);
this.Bodypiece[13] = new PlaneRenderer(this, 32, 0);
// neck
this.BodypieceNeck[0] = new PlaneRenderer(this, 0, 16);
this.BodypieceNeck[1] = new PlaneRenderer(this, 0, 16);
this.BodypieceNeck[2] = new PlaneRenderer(this, 0, 16);
this.BodypieceNeck[3] = new PlaneRenderer(this, 0, 16);
}
protected void initLegTextures() {
this.bipedRightArm = new ModelRenderer(this, 40, 16);
this.bipedRightLeg = new ModelRenderer(this, 0, 16);
this.bipedLeftArm = new ModelRenderer(this, 32, 48);
this.bipedLeftLeg = new ModelRenderer(this, 16, 48);
this.bipedRightArmwear = new ModelRenderer(this, 40, 32);
this.bipedRightLegwear = new ModelRenderer(this, 0, 32);
this.bipedLeftArmwear = new ModelRenderer(this, 48, 48);
this.bipedLeftLegwear = new ModelRenderer(this, 0, 48);
this.unicornArmRight = new ModelRenderer(this, 40, 32).setTextureSize(64, 64);
this.unicornArmLeft = new ModelRenderer(this, 40, 32).setTextureSize(64, 64);
this.boxList.remove(this.steveRightArm);
this.boxList.remove(this.unicornArmRight);
}
protected void initTailTextures() {
// upper
this.Tail[0] = new PlaneRenderer(this, 32, 0);
this.Tail[1] = new PlaneRenderer(this, 36, 0);
this.Tail[2] = new PlaneRenderer(this, 32, 0);
this.Tail[3] = new PlaneRenderer(this, 36, 0);
this.Tail[4] = new PlaneRenderer(this, 32, 0);
this.Tail[5] = new PlaneRenderer(this, 32, 0);
this.Tail[6] = new PlaneRenderer(this, 36, 4);
this.Tail[7] = new PlaneRenderer(this, 32, 4);
this.Tail[8] = new PlaneRenderer(this, 36, 4);
this.Tail[9] = new PlaneRenderer(this, 32, 4);
this.Tail[10] = new PlaneRenderer(this, 32, 0);
this.Tail[11] = new PlaneRenderer(this, 36, 0);
this.Tail[12] = new PlaneRenderer(this, 32, 0);
this.Tail[13] = new PlaneRenderer(this, 36, 0);
this.Tail[14] = new PlaneRenderer(this, 32, 0);
this.Tail[15] = new PlaneRenderer(this, 32, 0);
this.Tail[16] = new PlaneRenderer(this, 36, 4);
this.Tail[17] = new PlaneRenderer(this, 32, 4);
this.Tail[18] = new PlaneRenderer(this, 36, 4);
this.Tail[19] = new PlaneRenderer(this, 32, 4);
this.Tail[20] = new PlaneRenderer(this, 32, 0);
}
@Override
protected void initPositions(float yOffset, float stretch) {
this.initHeadPositions(yOffset, stretch);
this.initBodyPositions(yOffset, stretch);
this.initLegPositions(yOffset, stretch);
this.initTailPositions(yOffset, stretch);
}
protected void initHeadPositions(float yOffset, float stretch) {
this.bipedCape.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, stretch);
this.bipedHead.addBox(-4.0F + HEAD_CENTRE_X, -4 + HEAD_CENTRE_Y, -4.0F + HEAD_CENTRE_Z, 8, 8, 8, stretch);
this.bipedHead.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2);
// set ears
this.bipedHead.setTextureOffset(12, 16);
this.bipedHead.addBox(-4.0F + HEAD_CENTRE_X, -6.0F + HEAD_CENTRE_Y, 1.0F + HEAD_CENTRE_Z, 2, 2, 2, stretch);
this.bipedHead.mirror = true;
this.bipedHead.addBox(2.0F + HEAD_CENTRE_X, -6.0F + HEAD_CENTRE_Y, 1.0F + HEAD_CENTRE_Z, 2, 2, 2, stretch);
this.bipedHeadwear.addBox(-4.0F + HEAD_CENTRE_X, -4.0F + HEAD_CENTRE_Y, -4.0F + HEAD_CENTRE_Z, 8, 8, 8, stretch + 0.5F);
this.bipedHeadwear.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2);
}
protected void initBodyPositions(float yOffset, float stretch) {
this.bipedBody.addBox(-4.0F, 4.0F, -2.0F, 8, 8, 4, stretch);
this.bipedBody.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.bipedBodyWear.addBox(-4.0F, 4.0F, -2.0F, 8, 8, 4, stretch + 0.25F);
this.bipedBodyWear.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[0].addWestPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 8, stretch);
this.Bodypiece[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[1].addEastPlane(4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 8, stretch);
this.Bodypiece[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[2].addTopPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 12, stretch);
this.Bodypiece[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[3].addBottomPlane(-4.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 8, stretch);
this.Bodypiece[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[4].addWestPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 8, 4, stretch);
this.Bodypiece[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[5].addEastPlane(4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 8, 4, stretch);
this.Bodypiece[5].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[6].addBackPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 8.0F + BODY_CENTRE_Z, 8, 4, stretch);
this.Bodypiece[6].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[7].addBackPlane(-4.0F + BODY_CENTRE_X, 0.0F + BODY_CENTRE_Y, 8.0F + BODY_CENTRE_Z, 8, 4, stretch);
this.Bodypiece[7].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[8].addBottomPlane(-4.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 8, 4, stretch);
this.Bodypiece[8].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[9].addTopPlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 2, 6, stretch);
this.Bodypiece[9].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[10].addBottomPlane(-1.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 2, 6, stretch);
this.Bodypiece[10].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[11].addWestPlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 2, 6, stretch);
this.Bodypiece[11].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[12].addEastPlane(1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 2, 6, stretch);
this.Bodypiece[12].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[13].addBackPlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 8.0F + BODY_CENTRE_Z, 2, 2, stretch);
this.Bodypiece[13].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.BodypieceNeck[0].addBackPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 4, 4, stretch);
this.BodypieceNeck[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.BodypieceNeck[1].addBackPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -4.8F + BODY_CENTRE_Z, 4, 4, stretch);
this.BodypieceNeck[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.BodypieceNeck[2].addWestPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 4, 4, stretch);
this.BodypieceNeck[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.BodypieceNeck[3].addEastPlane(2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 4, 4, stretch);
this.BodypieceNeck[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.BodypieceNeck[0].rotateAngleX = NECK_ROT_X;
this.BodypieceNeck[1].rotateAngleX = NECK_ROT_X;
this.BodypieceNeck[2].rotateAngleX = NECK_ROT_X;
this.BodypieceNeck[3].rotateAngleX = NECK_ROT_X;
}
protected void initLegPositions(float yOffset, float stretch) {
if (this.smallArms) {
this.bipedRightArm.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 3, 12, 4, stretch);
this.bipedRightArm.setRotationPoint(-2.0F, 8.5F + yOffset, 0.0F);
if (bipedRightArmwear != null) {
this.bipedRightArmwear
.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 3, 12, 4, stretch + 0.25f);
this.bipedRightArmwear.setRotationPoint(-3.0F, 8.5F + yOffset, 0.0F);
}
this.bipedLeftArm.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 3, 12, 4, stretch);
this.bipedLeftArm.setRotationPoint(3.0F, 8.5F + yOffset, 0.0F);
if (this.bipedLeftArmwear != null) {
this.bipedLeftArmwear
.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 3, 12, 4, stretch + 0.25f);
this.bipedLeftArmwear.setRotationPoint(3.0F, 8.5F + yOffset, 0.0F);
}
} else {
this.bipedRightArm.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch);
this.bipedRightArm.setRotationPoint(-3.0F, 8.0F + yOffset, 0.0F);
if (bipedRightArmwear != null) {
this.bipedRightArmwear
.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch + 0.25f);
this.bipedRightArmwear.setRotationPoint(-3.0F, 8.0F + yOffset, 0.0F);
}
this.bipedLeftArm.addBox(-3.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch);
this.bipedLeftArm.setRotationPoint(3.0F, 8.0F + yOffset, 0.0F);
if (this.bipedLeftArmwear != null) {
this.bipedLeftArmwear
.addBox(-3.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch + 0.25f);
this.bipedLeftArmwear.setRotationPoint(3.0F, 8.0F + yOffset, 0.0F);
}
}
this.bipedRightLeg.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch);
this.bipedRightLeg.setRotationPoint(-3.0F, 0.0F + yOffset, 0.0F);
if (bipedRightLegwear != null) {
this.bipedRightLegwear
.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch + 0.25f);
this.bipedRightLegwear.setRotationPoint(-3.0F, 0.0F + yOffset, 0.0F);
}
this.bipedLeftLeg.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch);
if (this.bipedLeftLegwear != null) {
this.bipedLeftLegwear
.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch + 0.25f);
}
this.unicornArmRight.addBox(-2.0F + FIRSTP_ARM_CENTRE_X, -6.0F + FIRSTP_ARM_CENTRE_Y, -2.0F + FIRSTP_ARM_CENTRE_Z, 4, 12, 4, stretch + .25f);
this.unicornArmRight.setRotationPoint(-5.0F, 2.0F + yOffset, 0.0F);
this.unicornArmLeft.addBox(-2.0F + FIRSTP_ARM_CENTRE_X, -6.0F + FIRSTP_ARM_CENTRE_Y, -2.0F + FIRSTP_ARM_CENTRE_Z, 4, 12, 4, stretch + .25f);
this.unicornArmLeft.setRotationPoint(-5.0F, 2.0F + yOffset, 0.0F);
}
protected void initTailPositions(float yOffset, float stretch) {
this.Tail[0].addTopPlane(-2.0F, 1.0F, 2.0F, 4, 4, stretch);
this.Tail[0].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[1].addWestPlane(-2.0F, 1.0F, 2.0F, 4, 4, stretch);
this.Tail[1].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[2].addBackPlane(-2.0F, 1.0F, 2.0F, 4, 4, stretch);
this.Tail[2].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[3].addEastPlane(2.0F, 1.0F, 2.0F, 4, 4, stretch);
this.Tail[3].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[4].addBackPlane(-2.0F, 1.0F, 6.0F, 4, 4, stretch);
this.Tail[4].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[5].addTopPlane(-2.0F, 5.0F, 2.0F, 4, 4, stretch);
this.Tail[5].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[6].addWestPlane(-2.0F, 5.0F, 2.0F, 4, 4, stretch);
this.Tail[6].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[7].addBackPlane(-2.0F, 5.0F, 2.0F, 4, 4, stretch);
this.Tail[7].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[8].addEastPlane(2.0F, 5.0F, 2.0F, 4, 4, stretch);
this.Tail[8].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[9].addBackPlane(-2.0F, 5.0F, 6.0F, 4, 4, stretch);
this.Tail[9].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[10].addTopPlane(-2.0F, 9.0F, 2.0F, 4, 4, stretch);
this.Tail[10].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[11].addWestPlane(-2.0F, 9.0F, 2.0F, 4, 4, stretch);
this.Tail[11].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[12].addBackPlane(-2.0F, 9.0F, 2.0F, 4, 4, stretch);
this.Tail[12].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[13].addEastPlane(2.0F, 9.0F, 2.0F, 4, 4, stretch);
this.Tail[13].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[14].addBackPlane(-2.0F, 9.0F, 6.0F, 4, 4, stretch);
this.Tail[14].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[15].addTopPlane(-2.0F, 13.0F, 2.0F, 4, 4, stretch);
this.Tail[15].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[16].addWestPlane(-2.0F, 13.0F, 2.0F, 4, 4, stretch);
this.Tail[16].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[17].addBackPlane(-2.0F, 13.0F, 2.0F, 4, 4, stretch);
this.Tail[17].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[18].addEastPlane(2.0F, 13.0F, 2.0F, 4, 4, stretch);
this.Tail[18].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[19].addBackPlane(-2.0F, 13.0F, 6.0F, 4, 4, stretch);
this.Tail[19].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[20].addTopPlane(-2.0F, 17.0F, 2.0F, 4, 4, stretch);
this.Tail[20].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
}
@Override
public void renderCape(float scale) {
this.bipedCape.render(scale);
}
}

View file

@ -1,150 +0,0 @@
package com.minelittlepony.model.pony;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.math.MathHelper;
import static net.minecraft.client.renderer.GlStateManager.*;
public class ModelSkeletonPony extends ModelPlayerPony {
public ModelSkeletonPony() {
super(false);
}
@Override
protected void rotateLegs(float move, float swing, float tick, Entity entity) {
float rightArmRotateAngleX;
float leftArmRotateAngleX;
float rightLegRotateAngleX;
float leftLegRotateAngleX;
float var8;
float var9;
if (this.isFlying && this.metadata.getRace().hasWings() || entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying()) {
if (this.rainboom) {
rightArmRotateAngleX = ROTATE_270;
leftArmRotateAngleX = ROTATE_270;
rightLegRotateAngleX = ROTATE_90;
leftLegRotateAngleX = ROTATE_90;
} else {
rightArmRotateAngleX = MathHelper.sin(0.0F - swing * 0.5F);
leftArmRotateAngleX = MathHelper.sin(0.0F - swing * 0.5F);
rightLegRotateAngleX = MathHelper.sin(swing * 0.5F);
leftLegRotateAngleX = MathHelper.sin(swing * 0.5F);
}
this.bipedRightArm.rotateAngleY = 0.2F;
this.steveRightArm.rotateAngleY = 0.2F;
this.bipedLeftArm.rotateAngleY = -0.2F;
this.bipedRightLeg.rotateAngleY = -0.2F;
this.bipedLeftLeg.rotateAngleY = 0.2F;
} else {
var8 = (float) Math.pow(swing, 16.0D);
var9 = 3.1415927F * var8 * 0.5F;
float laQuad = 3.1415927F * var8;
float rlQuad = 3.1415927F * var8 * 0.2F;
float llQuad = 3.1415927F * var8 * -0.4F;
rightArmRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + var9) * 0.6F * swing;
leftArmRotateAngleX = MathHelper.cos(move * 0.6662F + laQuad) * 0.6F * swing;
rightLegRotateAngleX = MathHelper.cos(move * 0.6662F + rlQuad) * 0.6F * swing;
leftLegRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + llQuad) * 0.6F * swing;
this.bipedRightArm.rotateAngleY = 0.0F;
this.steveRightArm.rotateAngleY = 0.0F;
this.unicornArmRight.rotateAngleY = 0.0F;
this.bipedLeftArm.rotateAngleY = 0.0F;
this.bipedRightLeg.rotateAngleY = 0.0F;
this.bipedLeftLeg.rotateAngleY = 0.0F;
}
this.bipedRightArm.rotateAngleX = rightArmRotateAngleX;
this.steveRightArm.rotateAngleX = rightArmRotateAngleX;
this.unicornArmRight.rotateAngleX = rightArmRotateAngleX;
this.bipedLeftArm.rotateAngleX = leftArmRotateAngleX;
this.bipedRightLeg.rotateAngleX = rightLegRotateAngleX;
this.bipedLeftLeg.rotateAngleX = leftLegRotateAngleX;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.steveRightArm.rotateAngleZ = 0.0F;
this.unicornArmRight.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
if (this.rightArmPose != ArmPose.EMPTY) {
var8 = MathHelper.sin(this.swingProgress * 3.1415927F);
var9 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * 3.1415927F);
if (!this.metadata.hasMagic()) {
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedRightArm.rotateAngleY = 0.1F - var8 * 0.6F;
this.bipedRightArm.rotateAngleX = -1.5707964F;
this.bipedRightArm.rotateAngleX -= var8 * 1.2F - var9 * 0.4F;
this.bipedRightArm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.1F;
} else {
this.unicornArmRight.rotationPointX = -7.0F;
this.unicornArmRight.rotationPointY = 12.0F;
this.unicornArmRight.rotationPointZ = -2.0F;
this.unicornArmRight.rotateAngleZ = 0.0F;
this.unicornArmRight.rotateAngleY = 0.1F - var8 * 0.6F;
this.unicornArmRight.rotateAngleX = -1.5707964F;
this.unicornArmRight.rotateAngleX -= var8 * 1.2F - var9 * 0.4F;
this.unicornArmRight.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.unicornArmRight.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.1F;
}
}
if (this.leftArmPose != ArmPose.EMPTY) {
var8 = MathHelper.sin(this.swingProgress * 3.1415927F);
var9 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * 3.1415927F);
if (!this.metadata.hasMagic()) {
this.bipedLeftArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleY = 0.1F - var8 * 0.6F;
this.bipedLeftArm.rotateAngleX = -1.5707964F;
this.bipedLeftArm.rotateAngleX -= var8 * 1.2F - var9 * 0.4F;
this.bipedLeftArm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.bipedLeftArm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.1F;
} else {
this.unicornArmLeft.rotationPointX = -7.0F;
this.unicornArmLeft.rotationPointY = 12.0F;
this.unicornArmLeft.rotationPointZ = -2.0F;
this.unicornArmLeft.rotateAngleZ = 0.0F;
this.unicornArmLeft.rotateAngleY = 0.1F - var8 * 0.6F;
this.unicornArmLeft.rotateAngleX = -1.5707964F;
this.unicornArmLeft.rotateAngleX -= var8 * 1.2F - var9 * 0.4F;
this.unicornArmLeft.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.unicornArmLeft.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.1F;
}
}
this.aimBow(this.leftArmPose, this.rightArmPose, tick);
}
@Override
protected void fixSpecialRotationPoints(float move) {
if (this.rightArmPose != ArmPose.EMPTY && !this.metadata.hasMagic()) {
setRotationPoint(this.bipedRightArm, -1.5F, 9.5F, 4.0F);
}
}
@Override
protected void renderLegs() {
pushMatrix();
translate(0.05F, -0.21F, -0.0F);
scale(0.5F, 1.15F, 0.5F);
this.bipedLeftArm.render(this.scale);
popMatrix();
pushMatrix();
translate(-0.05F, -0.21F, -0.0F);
scale(0.5F, 1.2F, 0.5F);
this.bipedRightArm.render(this.scale);
popMatrix();
pushMatrix();
translate(0.05F, -0.21F, 0.35F);
scale(0.5F, 1.2F, 0.5F);
this.bipedLeftLeg.render(this.scale);
popMatrix();
pushMatrix();
translate(-0.05F, -0.21F, 0.35F);
scale(0.5F, 1.15F, 0.5F);
this.bipedRightLeg.render(this.scale);
popMatrix();
}
}

View file

@ -1,115 +0,0 @@
package com.minelittlepony.model.pony;
import com.minelittlepony.renderer.PlaneRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.util.math.MathHelper;
public class ModelVillagerPony extends ModelPlayerPony {
public PlaneRenderer[] VillagerBagPiece;
public PlaneRenderer VillagerApron;
public PlaneRenderer VillagerTrinket;
public ModelVillagerPony() {
super(false);
}
@Override
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {
super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
float bodySwingRotation = 0.0F;
if (this.swingProgress > -9990.0F && !this.metadata.hasMagic()) {
bodySwingRotation = MathHelper.sin(MathHelper.sqrt(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
}
for (PlaneRenderer aVillagerBagPiece : this.VillagerBagPiece) {
aVillagerBagPiece.rotateAngleY = bodySwingRotation * 0.2F;
}
this.VillagerBagPiece[4].rotateAngleY += 4.712389F;
this.VillagerBagPiece[5].rotateAngleY += 4.712389F;
this.VillagerBagPiece[6].rotateAngleY += 4.712389F;
this.VillagerBagPiece[7].rotateAngleY += 4.712389F;
this.VillagerApron.rotateAngleY = bodySwingRotation * 0.2F;
this.VillagerTrinket.rotateAngleY = bodySwingRotation * 0.2F;
}
@Override
protected void renderBody(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
super.renderBody(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
if (entityIn instanceof EntityVillager) {
this.bipedBody.postRender(this.scale);
int profession = ((EntityVillager) entityIn).getProfession();
if (profession < 2) {
for (PlaneRenderer aVillagerBagPiece : this.VillagerBagPiece) {
aVillagerBagPiece.render(this.scale);
}
} else if (profession == 2) {
this.VillagerTrinket.render(this.scale);
} else if (profession > 2) {
this.VillagerApron.render(this.scale);
}
}
}
@Override
protected void initTextures() {
super.initTextures();
this.VillagerBagPiece = new PlaneRenderer[14];
this.VillagerBagPiece[0] = new PlaneRenderer(this, 56, 19);
this.VillagerBagPiece[1] = new PlaneRenderer(this, 56, 19);
this.VillagerBagPiece[2] = new PlaneRenderer(this, 56, 19);
this.VillagerBagPiece[3] = new PlaneRenderer(this, 56, 19);
this.VillagerBagPiece[4] = new PlaneRenderer(this, 56, 16);
this.VillagerBagPiece[5] = new PlaneRenderer(this, 56, 16);
this.VillagerBagPiece[6] = new PlaneRenderer(this, 56, 22);
this.VillagerBagPiece[7] = new PlaneRenderer(this, 56, 22);
this.VillagerBagPiece[8] = new PlaneRenderer(this, 56, 25);
this.VillagerBagPiece[9] = new PlaneRenderer(this, 56, 25);
this.VillagerBagPiece[10] = new PlaneRenderer(this, 59, 25);
this.VillagerBagPiece[11] = new PlaneRenderer(this, 59, 25);
this.VillagerBagPiece[12] = new PlaneRenderer(this, 56, 31);
this.VillagerBagPiece[13] = new PlaneRenderer(this, 56, 31);
this.VillagerApron = new PlaneRenderer(this, 56, 16);
this.VillagerTrinket = new PlaneRenderer(this, 0, 3);
}
@Override
protected void initPositions(float yOffset, float stretch) {
super.initPositions(yOffset, stretch);
this.VillagerBagPiece[0].addWestPlane(-7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 6, 8, stretch);
this.VillagerBagPiece[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[1].addWestPlane(-4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 6, 8, stretch);
this.VillagerBagPiece[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[2].addWestPlane(4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 6, 8, stretch);
this.VillagerBagPiece[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[3].addWestPlane(7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 6, 8, stretch);
this.VillagerBagPiece[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[4].addTopPlane(2.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -2.0F + BODY_CENTRE_Z, 8, 3, stretch);
this.VillagerBagPiece[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[5].addTopPlane(2.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -13.0F + BODY_CENTRE_Z, 8, 3, stretch);
this.VillagerBagPiece[5].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[6].addBottomPlane(2.0F + BODY_CENTRE_X, 1.0F + BODY_CENTRE_Y, -2.0F + BODY_CENTRE_Z, 8, 3, stretch);
this.VillagerBagPiece[6].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[7].addBottomPlane(2.0F + BODY_CENTRE_X, 1.0F + BODY_CENTRE_Y, -13.0F + BODY_CENTRE_Z, 8, 3, stretch);
this.VillagerBagPiece[7].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[8].addBackPlane(-7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 3, 6, stretch);
this.VillagerBagPiece[8].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[9].addBackPlane(4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 3, 6, stretch);
this.VillagerBagPiece[9].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[10].addBackPlane(-7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 3, 6, stretch);
this.VillagerBagPiece[10].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[11].addBackPlane(4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 3, 6, stretch);
this.VillagerBagPiece[11].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[12].addTopPlane(-4.0F + BODY_CENTRE_X, -4.5F + BODY_CENTRE_Y, -1.0F + BODY_CENTRE_Z, 8, 1, stretch);
this.VillagerBagPiece[13].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[13].addTopPlane(-4.0F + BODY_CENTRE_X, -4.5F + BODY_CENTRE_Y, 0.0F + BODY_CENTRE_Z, 8, 1, stretch);
this.VillagerBagPiece[13].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerApron.addBackPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -9.0F + BODY_CENTRE_Z, 8, 10, stretch);
this.VillagerApron.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerTrinket.addBackPlane(-2.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -9.0F + BODY_CENTRE_Z, 4, 5, stretch);
this.VillagerTrinket.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
}
}

View file

@ -1,101 +0,0 @@
package com.minelittlepony.model.pony;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.math.MathHelper;
public class ModelZombiePony extends ModelPlayerPony {
public ModelZombiePony() {
super(false);
}
@Override
protected void rotateLegs(float move, float swing, float tick, Entity entity) {
float rightArmRotateAngleX;
float leftArmRotateAngleX;
float rightLegRotateAngleX;
float leftLegRotateAngleX;
float var8;
float var9;
// why are zombies flying?
if (this.isFlying && this.metadata.getRace().hasWings() || entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying()) {
if (this.rainboom) {
rightArmRotateAngleX = ROTATE_270;
leftArmRotateAngleX = ROTATE_270;
rightLegRotateAngleX = ROTATE_90;
leftLegRotateAngleX = ROTATE_90;
} else {
rightArmRotateAngleX = MathHelper.sin(0.0F - swing * 0.5F);
leftArmRotateAngleX = MathHelper.sin(0.0F - swing * 0.5F);
rightLegRotateAngleX = MathHelper.sin(swing * 0.5F);
leftLegRotateAngleX = MathHelper.sin(swing * 0.5F);
}
this.bipedRightArm.rotateAngleY = 0.2F;
this.steveRightArm.rotateAngleY = 0.2F;
this.bipedLeftArm.rotateAngleY = -0.2F;
this.bipedRightLeg.rotateAngleY = -0.2F;
this.bipedLeftLeg.rotateAngleY = 0.2F;
} else {
var8 = (float) Math.pow(swing, 16.0D);
var9 = 3.1415927F * var8 * 0.5F;
float laQuad = 3.1415927F * var8;
float rlQuad = 3.1415927F * var8 * 0.2F;
float llQuad = 3.1415927F * var8 * -0.4F;
rightArmRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + var9) * 0.45F * swing;
leftArmRotateAngleX = MathHelper.cos(move * 0.6662F + laQuad) * 0.45F * swing;
rightLegRotateAngleX = MathHelper.cos(move * 0.6662F + rlQuad) * 0.45F * swing;
leftLegRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + llQuad) * 0.45F * swing;
this.bipedRightArm.rotateAngleY = 0.0F;
this.steveRightArm.rotateAngleY = 0.0F;
this.unicornArmRight.rotateAngleY = 0.0F;
this.bipedLeftArm.rotateAngleY = 0.0F;
this.bipedRightLeg.rotateAngleY = 0.0F;
this.bipedLeftLeg.rotateAngleY = 0.0F;
}
this.bipedRightArm.rotateAngleX = rightArmRotateAngleX;
this.steveRightArm.rotateAngleX = rightArmRotateAngleX;
this.unicornArmRight.rotateAngleX = 0.0F;
this.bipedLeftArm.rotateAngleX = leftArmRotateAngleX;
this.bipedRightLeg.rotateAngleX = rightLegRotateAngleX;
this.bipedLeftLeg.rotateAngleX = leftLegRotateAngleX;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.steveRightArm.rotateAngleZ = 0.0F;
this.unicornArmRight.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
if (this.rightArmPose == ArmPose.EMPTY) {
var8 = MathHelper.sin(this.swingProgress * (float) Math.PI);
var9 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float) Math.PI);
if (MathHelper.sin(move / 20.0F) < 0.0F) {
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedRightArm.rotateAngleY = 0.1F - var8 * 0.6F;
this.bipedRightArm.rotateAngleX = -1.5707964F;
this.bipedRightArm.rotateAngleX -= var8 * 1.2F - var9 * 0.4F;
this.bipedRightArm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.1F;
} else {
this.bipedLeftArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleY = -(0.1F - var8 * 0.6F);
this.bipedLeftArm.rotateAngleX = -1.5707964F;
this.bipedLeftArm.rotateAngleX -= var8 * 1.2F - var9 * 0.4F;
this.bipedLeftArm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.bipedLeftArm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.1F;
}
}
}
@Override
protected void fixSpecialRotationPoints(float move) {
if (this.rightArmPose == ArmPose.EMPTY) {
if (MathHelper.sin(move / 20.0F) < 0.0F) {
shiftRotationPoint(this.bipedRightArm, 0.5F, 1.5F, 3.0F);
} else {
shiftRotationPoint(this.bipedLeftArm, -0.5F, 1.5F, 3.0F);
}
}
}
}

View file

@ -1,13 +0,0 @@
package com.minelittlepony.model.pony.armor;
import com.minelittlepony.model.AbstractArmor;
import com.minelittlepony.model.pony.ModelHumanPlayer;
public class HumanArmors extends AbstractArmor {
public HumanArmors() {
this.modelArmorChestplate = new ModelHumanPlayer(false);
this.modelArmor = new ModelHumanPlayer(false);
}
}

View file

@ -1,278 +0,0 @@
package com.minelittlepony.model.pony.armor;
import com.minelittlepony.model.pony.ModelPlayerPony;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;
public class ModelPonyArmor extends ModelPlayerPony {
public ModelRenderer Bodypiece;
public ModelRenderer extBody;
public ModelRenderer[] extHead;
public ModelRenderer[] extLegs;
public ModelPonyArmor() {
super(false);
this.textureHeight = 32;
}
@Override
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {
this.checkRainboom(entityIn, limbSwingAmount);
this.rotateHead(netHeadYaw, headPitch);
float bodySwingRotation = 0.0F;
if (this.swingProgress > -9990.0F && !this.metadata.hasMagic()) {
bodySwingRotation = MathHelper.sin(MathHelper.sqrt(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
}
this.bipedBody.rotateAngleY = bodySwingRotation * 0.2F;
this.setLegs(limbSwing, limbSwingAmount, ageInTicks, entityIn);
this.holdItem(limbSwingAmount);
this.swingItem(entityIn, this.swingProgress);
if (this.isSneak && !this.isFlying) {
this.adjustBody(BODY_ROTATE_ANGLE_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK);
this.sneakLegs();
this.setHead(0.0F, 6.0F, -2.0F);
} else if (this.isRiding) {
this.adjustBody(BODY_ROTATE_ANGLE_X_RIDING, BODY_RP_Y_RIDING, BODY_RP_Z_RIDING);
this.bipedLeftLeg.rotationPointZ = 15;
this.bipedLeftLeg.rotationPointY = 10;
this.bipedLeftLeg.rotateAngleX = (float) (Math.PI * -0.25);
this.bipedLeftLeg.rotateAngleY = (float) (Math.PI * -0.2);
this.bipedRightLeg.rotationPointZ = 15;
this.bipedRightLeg.rotationPointY = 10;
this.bipedRightLeg.rotateAngleX = (float) (Math.PI * -0.25);
this.bipedRightLeg.rotateAngleY = (float) (Math.PI * 0.2);
this.bipedLeftArm.rotateAngleZ = (float) (Math.PI * -0.06);
this.bipedRightArm.rotateAngleZ = (float) (Math.PI * 0.06);
} else {
this.adjustBody(BODY_ROTATE_ANGLE_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK);
this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
this.bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
this.swingArms(ageInTicks);
this.setHead(0.0F, 0.0F, 0.0F);
}
if (this.isSleeping) {
this.ponySleep();
}
this.aimBow(leftArmPose, rightArmPose, ageInTicks);
}
@Override
protected void setHead(float posX, float posY, float posZ) {
setRotationPoint(this.bipedHead, posX, posY, posZ);
setRotationPoint(this.bipedHeadwear, posX, posY, posZ);
setRotationPoint(this.extHead[0], posX, posY, posZ);
setRotationPoint(this.extHead[1], posX, posY, posZ);
}
@Override
protected void rotateHead(float horz, float vert) {
super.rotateHead(horz, vert);
float headRotateAngleX = this.bipedHead.rotateAngleX;
float headRotateAngleY = this.bipedHead.rotateAngleY;
this.extHead[0].rotateAngleY = headRotateAngleY;
this.extHead[0].rotateAngleX = headRotateAngleX;
this.extHead[1].rotateAngleY = headRotateAngleY;
this.extHead[1].rotateAngleX = headRotateAngleX;
}
@Override
protected void adjustBody(float rotateAngleX, float rotationPointY, float rotationPointZ) {
this.bipedBody.rotateAngleX = rotateAngleX;
this.bipedBody.rotationPointY = rotationPointY;
this.bipedBody.rotationPointZ = rotationPointZ;
this.Bodypiece.rotateAngleX = rotateAngleX;
this.Bodypiece.rotationPointY = rotationPointY;
this.Bodypiece.rotationPointZ = rotationPointZ;
this.extBody.rotateAngleX = rotateAngleX;
this.extBody.rotationPointY = rotationPointY;
this.extBody.rotationPointZ = rotationPointZ;
}
@Override
protected void renderHead(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
this.bipedHead.render(this.scale);
this.extHead[0].render(this.scale);
this.extHead[1].render(this.scale);
this.bipedHeadwear.render(this.scale);
}
@Override
protected void renderNeck() {
}
@Override
protected void renderBody(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
this.bipedBody.render(this.scale);
this.Bodypiece.render(this.scale);
this.extBody.render(this.scale);
}
@Override
protected void renderTail() {
}
@Override
protected void renderLegs() {
if (!isSneak) {
boolean isLegs = this.extBody.showModel;
this.extBody.showModel = true;
this.extBody.postRender(this.scale);
this.extBody.showModel = isLegs;
}
this.bipedLeftArm.render(this.scale);
this.bipedRightArm.render(this.scale);
this.bipedLeftLeg.render(this.scale);
this.bipedRightLeg.render(this.scale);
this.extLegs[0].render(this.scale);
this.extLegs[1].render(this.scale);
}
@Override
protected void initTextures() {
this.extHead = new ModelRenderer[2];
this.extLegs = new ModelRenderer[2];
this.initHeadTextures();
this.initBodyTextures();
this.initLegTextures();
}
@Override
protected void initHeadTextures() {
this.bipedHead = new ModelRenderer(this, 0, 0);
this.bipedHeadwear = new ModelRenderer(this, 32, 0);
this.extHead[0] = new ModelRenderer(this, 0, 0);
this.extHead[1] = new ModelRenderer(this, 0, 4);
}
@Override
protected void initBodyTextures() {
this.bipedBody = new ModelRenderer(this, 16, 16);
this.Bodypiece = new ModelRenderer(this, 0, 0);
this.extBody = new ModelRenderer(this, 16, 8);
}
@Override
protected void initLegTextures() {
this.bipedRightArm = new ModelRenderer(this, 0, 16);
this.bipedLeftArm = new ModelRenderer(this, 0, 16);
this.bipedLeftArm.mirror = true;
this.bipedRightLeg = new ModelRenderer(this, 0, 16);
this.bipedLeftLeg = new ModelRenderer(this, 0, 16);
this.bipedLeftLeg.mirror = true;
this.steveRightArm = new ModelRenderer(this, 0, 16);
this.unicornArmRight = new ModelRenderer(this, 0, 16);
this.unicornArmLeft = new ModelRenderer(this, 0, 16);
this.extLegs[0] = new ModelRenderer(this, 48, 8);
this.extLegs[1] = new ModelRenderer(this, 48, 8);
this.extLegs[1].mirror = true;
}
@Override
protected void initPositions(float yOffset, float stretch) {
this.initHeadPositions(yOffset, stretch);
this.initBodyPositions(yOffset, stretch);
this.initLegPositions(yOffset, stretch);
}
@Override
protected void initHeadPositions(float yOffset, float stretch) {
this.bipedHead.addBox(-4.0F + HEAD_CENTRE_X, -4.0F + HEAD_CENTRE_Y, -4.0F + HEAD_CENTRE_Z, 8, 8, 8, stretch * 1.1F);
this.bipedHead.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.extHead[0].addBox(-4.0F + HEAD_CENTRE_X, -6.0F + HEAD_CENTRE_Y, 1.0F + HEAD_CENTRE_Z, 2, 2, 2, stretch * 0.5F);
this.extHead[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.extHead[1].addBox(2.0F + HEAD_CENTRE_X, -6.0F + HEAD_CENTRE_Y, 1.0F + HEAD_CENTRE_Z, 2, 2, 2, stretch * 0.5F);
this.extHead[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.bipedHeadwear.addBox(-4.0F + HEAD_CENTRE_X, -4.0F + HEAD_CENTRE_Y, -4.0F + HEAD_CENTRE_Z, 8, 8, 8, stretch * 1.1F + 0.5F);
this.bipedHeadwear.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
}
@Override
protected void initBodyPositions(float yOffset, float stretch) {
this.bipedBody.addBox(-4.0F, 4.0F, -2.0F, 8, 8, 4, stretch);
this.bipedBody.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece.addBox(-4.0F, 4.0F, 6.0F, 8, 8, 8, stretch);
this.Bodypiece.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.extBody.addBox(-4.0F, 4.0F, -2.0F, 8, 8, 16, stretch);
this.extBody.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
}
@Override
protected void initLegPositions(float yOffset, float stretch) {
super.initLegPositions(yOffset, stretch);
this.extLegs[0].addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch);
this.extLegs[0].setRotationPoint(-3.0F, 0.0F + yOffset, 0.0F);
this.extLegs[1].addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch);
this.extLegs[1].setRotationPoint(3.0F, 0.0F + yOffset, 0.0F);
}
protected void syncLegs() {
this.extLegs[0].rotateAngleX = this.bipedRightLeg.rotateAngleX;
this.extLegs[0].rotateAngleY = this.bipedRightLeg.rotateAngleY;
this.extLegs[0].rotateAngleZ = this.bipedRightLeg.rotateAngleZ;
this.extLegs[0].rotationPointX = this.bipedRightLeg.rotationPointX;
this.extLegs[0].rotationPointY = this.bipedRightLeg.rotationPointY;
this.extLegs[0].rotationPointZ = this.bipedRightLeg.rotationPointZ;
this.extLegs[1].rotateAngleX = this.bipedLeftLeg.rotateAngleX;
this.extLegs[1].rotateAngleY = this.bipedLeftLeg.rotateAngleY;
this.extLegs[1].rotateAngleZ = this.bipedLeftLeg.rotateAngleZ;
this.extLegs[1].rotationPointX = this.bipedLeftLeg.rotationPointX;
this.extLegs[1].rotationPointY = this.bipedLeftLeg.rotationPointY;
this.extLegs[1].rotationPointZ = this.bipedLeftLeg.rotationPointZ;
}
@Override
protected void rotateLegs(float move, float swing, float tick, Entity entity) {
super.rotateLegs(move, swing, tick, entity);
this.syncLegs();
}
@Override
protected void adjustLegs() {
super.adjustLegs();
this.syncLegs();
}
@Override
protected void sneakLegs() {
super.sneakLegs();
this.syncLegs();
}
@Override
protected void ponySleep() {
super.ponySleep();
this.syncLegs();
}
public void setVisible(boolean invisible) {
super.setVisible(invisible);
this.Bodypiece.showModel = invisible;
extBody.showModel = invisible;
for (ModelRenderer m : extHead) {
m.showModel = invisible;
}
for (ModelRenderer m : extLegs) {
m.showModel = invisible;
}
}
}

View file

@ -1,93 +0,0 @@
package com.minelittlepony.model.pony.armor;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.math.MathHelper;
public class ModelSkeletonPonyArmor extends ModelPonyArmor {
@Override
protected void rotateLegs(float move, float swing, float tick, Entity entity) {
float rightArmRotateAngleX;
float leftArmRotateAngleX;
float rightLegRotateAngleX;
float leftLegRotateAngleX;
float var8;
float var9;
if (this.isFlying && this.metadata.getRace().hasWings() || entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying()) {
if (this.rainboom) {
rightArmRotateAngleX = ROTATE_270;
leftArmRotateAngleX = ROTATE_270;
rightLegRotateAngleX = ROTATE_90;
leftLegRotateAngleX = ROTATE_90;
} else {
rightArmRotateAngleX = MathHelper.sin(0.0F - swing * 0.5F);
leftArmRotateAngleX = MathHelper.sin(0.0F - swing * 0.5F);
rightLegRotateAngleX = MathHelper.sin(swing * 0.5F);
leftLegRotateAngleX = MathHelper.sin(swing * 0.5F);
}
this.bipedRightArm.rotateAngleY = 0.2F;
this.steveRightArm.rotateAngleY = 0.2F;
this.bipedLeftArm.rotateAngleY = -0.2F;
this.bipedRightLeg.rotateAngleY = -0.2F;
this.bipedLeftLeg.rotateAngleY = 0.2F;
} else {
var8 = (float) Math.pow(swing, 16.0D);
var9 = 3.1415927F * var8 * 0.5F;
float laQuad = 3.1415927F * var8;
float rlQuad = 3.1415927F * var8 * 0.2F;
float llQuad = 3.1415927F * var8 * -0.4F;
rightArmRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + var9) * 0.6F * swing;
leftArmRotateAngleX = MathHelper.cos(move * 0.6662F + laQuad) * 0.6F * swing;
rightLegRotateAngleX = MathHelper.cos(move * 0.6662F + rlQuad) * 0.6F * swing;
leftLegRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + llQuad) * 0.6F * swing;
this.bipedRightArm.rotateAngleY = 0.0F;
this.steveRightArm.rotateAngleY = 0.0F;
this.unicornArmRight.rotateAngleY = 0.0F;
this.bipedLeftArm.rotateAngleY = 0.0F;
this.bipedRightLeg.rotateAngleY = 0.0F;
this.bipedLeftLeg.rotateAngleY = 0.0F;
}
this.bipedRightArm.rotateAngleX = rightArmRotateAngleX;
this.steveRightArm.rotateAngleX = rightArmRotateAngleX;
this.unicornArmRight.rotateAngleX = 0.0F;
this.bipedLeftArm.rotateAngleX = leftArmRotateAngleX;
this.bipedRightLeg.rotateAngleX = rightLegRotateAngleX;
this.bipedLeftLeg.rotateAngleX = leftLegRotateAngleX;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.steveRightArm.rotateAngleZ = 0.0F;
this.unicornArmRight.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
if (this.rightArmPose != ArmPose.EMPTY) {
var8 = MathHelper.sin(this.swingProgress * 3.1415927F);
var9 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * 3.1415927F);
if (!this.metadata.hasMagic()) {
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedRightArm.rotateAngleY = 0.1F - var8 * 0.6F;
this.bipedRightArm.rotateAngleX = -1.5707964F;
this.bipedRightArm.rotateAngleX -= var8 * 1.2F - var9 * 0.4F;
this.bipedRightArm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.1F;
} else {
this.unicornArmRight.rotateAngleZ = 0.0F;
this.unicornArmRight.rotateAngleY = 0.1F - var8 * 0.6F;
this.unicornArmRight.rotateAngleX = -1.5707964F;
this.unicornArmRight.rotateAngleX -= var8 * 1.2F - var9 * 0.4F;
this.unicornArmRight.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.unicornArmRight.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.1F;
}
}
this.syncLegs();
}
@Override
protected void fixSpecialRotationPoints(float move) {
if (this.rightArmPose != ArmPose.EMPTY && !this.metadata.hasMagic()) {
setRotationPoint(this.bipedRightArm, -1.5F, 9.5F, 4.0F);
}
}
}

View file

@ -1,97 +0,0 @@
package com.minelittlepony.model.pony.armor;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.math.MathHelper;
public class ModelZombiePonyArmor extends ModelPonyArmor {
@Override
protected void rotateLegs(float move, float swing, float tick, Entity entity) {
float rightArmRotateAngleX;
float leftArmRotateAngleX;
float rightLegRotateAngleX;
float leftLegRotateAngleX;
float var8;
float var9;
if (this.isFlying && this.metadata.getRace().hasWings() || entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying()) {
if (this.rainboom) {
rightArmRotateAngleX = ROTATE_270;
leftArmRotateAngleX = ROTATE_270;
rightLegRotateAngleX = ROTATE_90;
leftLegRotateAngleX = ROTATE_90;
} else {
rightArmRotateAngleX = MathHelper.sin(0.0F - swing * 0.5F);
leftArmRotateAngleX = MathHelper.sin(0.0F - swing * 0.5F);
rightLegRotateAngleX = MathHelper.sin(swing * 0.5F);
leftLegRotateAngleX = MathHelper.sin(swing * 0.5F);
}
this.bipedRightArm.rotateAngleY = 0.2F;
this.steveRightArm.rotateAngleY = 0.2F;
this.bipedLeftArm.rotateAngleY = -0.2F;
this.bipedRightLeg.rotateAngleY = -0.2F;
this.bipedLeftLeg.rotateAngleY = 0.2F;
} else {
var8 = (float) Math.pow(swing, 16.0D);
var9 = 3.1415927F * var8 * 0.5F;
float laQuad = 3.1415927F * var8;
float rlQuad = 3.1415927F * var8 * 0.2F;
float llQuad = 3.1415927F * var8 * -0.4F;
rightArmRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + var9) * 0.45F * swing;
leftArmRotateAngleX = MathHelper.cos(move * 0.6662F + laQuad) * 0.45F * swing;
rightLegRotateAngleX = MathHelper.cos(move * 0.6662F + rlQuad) * 0.45F * swing;
leftLegRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + llQuad) * 0.45F * swing;
this.bipedRightArm.rotateAngleY = 0.0F;
this.steveRightArm.rotateAngleY = 0.0F;
this.unicornArmRight.rotateAngleY = 0.0F;
this.bipedLeftArm.rotateAngleY = 0.0F;
this.bipedRightLeg.rotateAngleY = 0.0F;
this.bipedLeftLeg.rotateAngleY = 0.0F;
}
this.bipedRightArm.rotateAngleX = rightArmRotateAngleX;
this.steveRightArm.rotateAngleX = rightArmRotateAngleX;
this.unicornArmRight.rotateAngleX = 0.0F;
this.bipedLeftArm.rotateAngleX = leftArmRotateAngleX;
this.bipedRightLeg.rotateAngleX = rightLegRotateAngleX;
this.bipedLeftLeg.rotateAngleX = leftLegRotateAngleX;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.steveRightArm.rotateAngleZ = 0.0F;
this.unicornArmRight.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
if (this.rightArmPose == ArmPose.EMPTY) {
var8 = MathHelper.sin(this.swingProgress * 3.1415927F);
var9 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * 3.1415927F);
if (MathHelper.sin(move / 20.0F) < 0.0F) {
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedRightArm.rotateAngleY = 0.1F - var8 * 0.6F;
this.bipedRightArm.rotateAngleX = -1.5707964F;
this.bipedRightArm.rotateAngleX -= var8 * 1.2F - var9 * 0.4F;
this.bipedRightArm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.1F;
} else {
this.bipedLeftArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleY = -(0.1F - var8 * 0.6F);
this.bipedLeftArm.rotateAngleX = -1.5707964F;
this.bipedLeftArm.rotateAngleX -= var8 * 1.2F - var9 * 0.4F;
this.bipedLeftArm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.bipedLeftArm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.1F;
}
}
this.syncLegs();
}
@Override
protected void fixSpecialRotationPoints(float move) {
if (this.rightArmPose == ArmPose.EMPTY) {
if (MathHelper.sin(move / 20.0F) < 0.0F) {
shiftRotationPoint(this.bipedRightArm, 0.5F, 1.5F, 3.0F);
} else {
shiftRotationPoint(this.bipedLeftArm, -0.5F, 1.5F, 3.0F);
}
}
}
}

View file

@ -1,11 +0,0 @@
package com.minelittlepony.model.pony.armor;
import com.minelittlepony.model.AbstractArmor;
public class PonyArmors extends AbstractArmor {
public PonyArmors() {
this.modelArmorChestplate = new ModelPonyArmor();
this.modelArmor = new ModelPonyArmor();
}
}

View file

@ -1,11 +0,0 @@
package com.minelittlepony.model.pony.armor;
import com.minelittlepony.model.AbstractArmor;
public class SkeletonPonyArmors extends AbstractArmor {
public SkeletonPonyArmors() {
this.modelArmorChestplate = new ModelSkeletonPonyArmor();
this.modelArmor = new ModelSkeletonPonyArmor();
}
}

View file

@ -1,11 +0,0 @@
package com.minelittlepony.model.pony.armor;
import com.minelittlepony.model.AbstractArmor;
public class ZombiePonyArmors extends AbstractArmor {
public ZombiePonyArmors() {
this.modelArmorChestplate = new ModelZombiePonyArmor();
this.modelArmor = new ModelZombiePonyArmor();
}
}

View file

@ -0,0 +1,38 @@
package com.minelittlepony.pony.data;
import net.minecraft.client.resources.data.IMetadataSection;
/**
* Metadata for a pony.
*/
public interface IPonyData extends IMetadataSection {
/**
* Gets this pony's race.
*/
PonyRace getRace();
/**
* Gets the length of the pony's tail.
*/
TailLengths getTail();
/**
* Get the pony's gender (usually female).
*/
PonyGender getGender();
/**
* Gets the current pony size.
*/
PonySize getSize();
/**
* Gets the magical glow colour for magic-casting races. Returns 0 otherwise.
*/
int getGlowColor();
/**
* Returns true if and only if this metadata represents a pony that can cast magic.
*/
boolean hasMagic();
}

View file

@ -0,0 +1,29 @@
package com.minelittlepony.pony.data;
/**
* Interface for enums that can be parsed from an image trigger pixel value.
* @author Chris Albers
*
* @param <T>
*/
public interface ITriggerPixelMapped<T extends Enum<T> & ITriggerPixelMapped<T>> {
/**
* Gets the pixel colour matching this enum value.
*/
int getTriggerPixel();
/**
* Gets the enum value corresponding to the given enum type and pixel value.
* If none are found, the first parameter is returned as the default.
*
* @param type Return type and default value.
* @param pixelValue The pixel colour to search for.
*/
@SuppressWarnings("unchecked")
public static <T extends Enum<T> & ITriggerPixelMapped<T>> T getByTriggerPixel(T type, int pixelValue) {
for (T i : (T[])type.getClass().getEnumConstants()) {
if (i.getTriggerPixel() == pixelValue) return i;
}
return type;
}
}

View file

@ -0,0 +1,129 @@
package com.minelittlepony.pony.data;
import com.google.common.base.MoreObjects;
import com.minelittlepony.MineLittlePony;
import com.minelittlepony.mixin.MixinThreadDownloadImageData;
import com.minelittlepony.model.ModelWrapper;
import com.voxelmodpack.hdskins.DynamicTextureImage;
import com.voxelmodpack.hdskins.ThreadDownloadImageETag;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.client.resources.IResource;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import java.awt.image.BufferedImage;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
@Immutable
public class Pony {
private static final AtomicInteger ponyCount = new AtomicInteger();
private final int ponyId = ponyCount.getAndIncrement();
private final ResourceLocation texture;
private final IPonyData metadata;
private final boolean smallArms;
public Pony(ResourceLocation resource, boolean slim) {
texture = resource;
metadata = checkSkin(texture);
smallArms = slim;
}
private IPonyData checkSkin(ResourceLocation resource) {
IPonyData data = checkPonyMeta(resource);
if (data != null) return data;
BufferedImage skinImage = getBufferedImage(resource);
return this.checkSkin(skinImage);
}
@Nullable
private IPonyData checkPonyMeta(ResourceLocation resource) {
try {
IResource res = Minecraft.getMinecraft().getResourceManager().getResource(resource);
if (res.hasMetadata()) {
PonyData data = res.getMetadata(PonyDataSerialzier.NAME);
if (data != null) {
return data;
}
}
} catch (FileNotFoundException e) {
// Ignore uploaded texture
} catch (IOException e) {
MineLittlePony.logger.warn("Unable to read {} metadata", resource, e);
}
return null;
}
@Nullable
private BufferedImage getBufferedImage(@Nonnull ResourceLocation resource) {
try {
IResource skin = Minecraft.getMinecraft().getResourceManager().getResource(resource);
BufferedImage skinImage = TextureUtil.readBufferedImage(skin.getInputStream());
MineLittlePony.logger.debug("Obtained skin from resource location {}", resource);
return skinImage;
} catch (IOException ignored) { }
try {
ITextureObject texture = Minecraft.getMinecraft().getTextureManager().getTexture(resource);
if (texture instanceof MixinThreadDownloadImageData) {
return ((MixinThreadDownloadImageData) texture).getBufferedImage();
} else if (texture instanceof ThreadDownloadImageETag) {
return ((ThreadDownloadImageETag) texture).getBufferedImage();
} else if (texture instanceof DynamicTextureImage) {
return ((DynamicTextureImage) texture).getImage();
}
} catch (Exception ignored) { }
return null;
}
private IPonyData checkSkin(BufferedImage bufferedimage) {
if (bufferedimage == null) return new PonyData();
MineLittlePony.logger.debug("\tStart skin check for pony #{} with image {}.", ponyId, bufferedimage);
return PonyData.parse(bufferedimage);
}
public boolean isPegasusFlying(EntityPlayer player) {
//noinspection SimplifiableIfStatement
if (!getRace(false).hasWings()) return false;
return player.capabilities.isFlying || !(player.onGround || player.isRiding() || player.isOnLadder() || player.isInWater() || player.isElytraFlying());
}
public ModelWrapper getModel(boolean ignorePony) {
return getRace(ignorePony).getModel().getModel(smallArms);
}
public PonyRace getRace(boolean ignorePony) {
return metadata.getRace().getEffectiveRace(MineLittlePony.getConfig().getEffectivePonyLevel(ignorePony));
}
public ResourceLocation getTexture() {
return texture;
}
public IPonyData getMetadata() {
return metadata;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("texture", texture)
.add("metadata", metadata)
.toString();
}
}

View file

@ -0,0 +1,85 @@
package com.minelittlepony.pony.data;
import com.google.common.base.MoreObjects;
import com.minelittlepony.MineLittlePony;
import java.awt.image.BufferedImage;
import javax.annotation.concurrent.Immutable;
/**
* Implementation for IPonyData.
*
*/
@Immutable
public class PonyData implements IPonyData {
private final PonyRace race;
private final TailLengths tailSize;
private final PonyGender gender;
private final PonySize size;
private final int glowColor;
public PonyData() {
race = PonyRace.HUMAN;
tailSize = TailLengths.FULL;
gender = PonyGender.MARE;
size = PonySize.NORMAL;
glowColor = 0x4444aa;
}
private PonyData(BufferedImage image) {
race = TriggerPixels.RACE.readValue(image);
tailSize = TriggerPixels.TAIL.readValue(image);
size = TriggerPixels.SIZE.readValue(image);
gender = TriggerPixels.GENDER.readValue(image);
glowColor = TriggerPixels.GLOW.readColor(image, -1);
}
@Override
public PonyRace getRace() {
return race;
}
@Override
public TailLengths getTail() {
return tailSize;
}
@Override
public PonyGender getGender() {
return gender;
}
@Override
public PonySize getSize() {
return MineLittlePony.getConfig().sizes ? size : PonySize.NORMAL;
}
@Override
public int getGlowColor() {
return glowColor;
}
@Override
public boolean hasMagic() {
return race != null && race.hasHorn() && glowColor != 0;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("race", race)
.add("tailSize", tailSize)
.add("gender", gender)
.add("size", size)
.add("glowColor", "#" + Integer.toHexString(glowColor))
.toString();
}
/**
* Parses an image buffer into a new IPonyData representing the values stored in it's individual trigger pixels.
*/
static IPonyData parse(BufferedImage image) {
return new PonyData(image);
}
}

View file

@ -1,4 +1,4 @@
package com.minelittlepony;
package com.minelittlepony.pony.data;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonElement;

View file

@ -0,0 +1,17 @@
package com.minelittlepony.pony.data;
public enum PonyGender implements ITriggerPixelMapped<PonyGender> {
MARE(0),
STALLION(0xffffff);
private int triggerValue;
PonyGender(int pixel) {
triggerValue = pixel;
}
@Override
public int getTriggerPixel() {
return triggerValue;
}
}

View file

@ -1,7 +1,6 @@
package com.minelittlepony;
package com.minelittlepony.pony.data;
public enum PonyLevel {
PONIES,
HUMANS,
BOTH

View file

@ -0,0 +1,77 @@
package com.minelittlepony.pony.data;
import com.minelittlepony.model.player.PlayerModels;
public enum PonyRace implements ITriggerPixelMapped<PonyRace> {
HUMAN(0, PlayerModels.HUMAN, false, false),
EARTH(0xf9b131, PlayerModels.EARTH,false, false),
PEGASUS(0x88caf0, PlayerModels.PEGASUS, true, false),
UNICORN(0xd19fe4, PlayerModels.ALICORN, false, true),
ALICORN(0xfef9fc, PlayerModels.ALICORN, true, true),
CHANGELING(0x282b29, PlayerModels.ALICORN, true, true),
ZEBRA(0xd0cccf, PlayerModels.EARTH, false, false),
REFORMED_CHANGELING(0xcaed5a, PlayerModels.ALICORN, true, true),
GRIFFIN(0xae9145, PlayerModels.PEGASUS, true, false),
HIPPOGRIFF(0xd6ddac, PlayerModels.PEGASUS, true, false);
private boolean wings;
private boolean horn;
private int triggerPixel;
private PlayerModels model;
PonyRace(int triggerPixel, PlayerModels model, boolean wings, boolean horn) {
this.triggerPixel = triggerPixel;
this.wings = wings;
this.horn = horn;
this.model = model;
}
/**
* Returns true if this pony has a horn (and by extension can cast magic).
* @return
*/
public boolean hasHorn() {
return horn;
}
/**
* Returns true if this pony has wings. If it has wings, it can fly, of course.
*/
public boolean hasWings() {
return wings;
}
/**
* Returns true if this is a human.
*/
public boolean isHuman() {
return this == HUMAN;
}
/**
* Gets the model type associated with this species.
*/
public PlayerModels getModel() {
return model;
}
/**
* Gets the actual race determined by the given pony level.
* PonyLevel.HUMANS would force all races to be humans.
* PonyLevel.BOTH is no change.
* PonyLevel.PONIES (should) return a pony if this is a human. Don't be fooled, though. It doesn't.
*/
public PonyRace getEffectiveRace(PonyLevel level) {
if (level == PonyLevel.HUMANS) return HUMAN;
return this;
}
@Override
public int getTriggerPixel() {
return triggerPixel;
}
}

View file

@ -0,0 +1,32 @@
package com.minelittlepony.pony.data;
public enum PonySize implements ITriggerPixelMapped<PonySize> {
NORMAL(0, 0.4f, 1f),
LARGE(0xce3254, 0.5f, 0.8f),
FOAL(0xffbe53, 0.25f, 0.8f),
TALL(0x534b76, 0.45f, 1f);
private int triggerValue;
private float shadowSize;
private float scale;
PonySize(int pixel, float shadowSz, float scaleF) {
triggerValue = pixel;
shadowSize = shadowSz;
scale = scaleF;
}
public float getShadowSize() {
return shadowSize;
}
public float getScaleFactor() {
return scale;
}
@Override
public int getTriggerPixel() {
return triggerValue;
}
}

View file

@ -0,0 +1,21 @@
package com.minelittlepony.pony.data;
public enum TailLengths implements ITriggerPixelMapped<TailLengths> {
STUB(0x425844),
QUARTER(0xd19fe4),
HALF(0x534b76),
THREE_QUARTERS(0x8a6b7f),
FULL(0);
private int triggerValue;
TailLengths(int pixel) {
triggerValue = pixel;
}
@Override
public int getTriggerPixel() {
return triggerValue;
}
}

View file

@ -0,0 +1,46 @@
package com.minelittlepony.pony.data;
import java.awt.image.BufferedImage;
/**
* Individual trigger pixels for a pony skin.
*
*/
@SuppressWarnings("unchecked")
public enum TriggerPixels {
RACE(PonyRace.HUMAN, 0, 0),
TAIL(TailLengths.FULL, 1, 0),
GENDER(PonyGender.MARE, 2, 0),
SIZE(PonySize.NORMAL, 3, 0),
GLOW(null, 0, 1);
private int x;
private int y;
ITriggerPixelMapped<?> def;
TriggerPixels(ITriggerPixelMapped<?> def, int x, int y) {
this.def = def;
this.x = x;
this.y = y;
}
/**
* Reads this trigger pixel's value and returns the raw colour.
*
* @param image Image to read
* @param mask Colour mask (0xffffff for rgb, -1 for rgba)
*/
public int readColor(BufferedImage image, int mask) {
return image.getRGB(x, y) & mask;
}
/**
* Reads this trigger pixel's value and parses it to an Enum instance.
*
* @param image Image to read
*/
public <T extends Enum<T> & ITriggerPixelMapped<T>> T readValue(BufferedImage image) {
return ITriggerPixelMapped.getByTriggerPixel((T)def, readColor(image, 0xffffff));
}
}

View file

@ -1,6 +1,6 @@
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
package com.minelittlepony.gui;
package com.minelittlepony.pony.data;
import mcp.MethodsReturnNonnullByDefault;

View file

@ -0,0 +1,201 @@
package com.minelittlepony.render;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.model.TextureOffset;
@SuppressWarnings("unchecked")
public abstract class AbstractPonyRenderer<T extends AbstractPonyRenderer<T>> extends ModelRenderer {
protected final ModelBase baseModel;
protected int textureOffsetX;
protected int textureOffsetY;
protected float modelOffsetX;
protected float modelOffsetY;
protected float modelOffsetZ;
public AbstractPonyRenderer(ModelBase model) {
super(model);
baseModel = model;
}
public AbstractPonyRenderer(ModelBase model, int texX, int texY) {
super(model, texX, texY);
baseModel = model;
}
/**
* Called to create a new instance of this renderer (used for child renderers)
*/
protected abstract T copySelf();
@Override
public T setTextureOffset(int x, int y) {
this.textureOffsetX = x;
this.textureOffsetY = y;
super.setTextureOffset(x, y);
return (T) this;
}
/**
* Flips the mirror flag. All faces are mirrored until this is called again.
*/
public T flipX() {
return mirror(!mirror);
}
public T mirror(boolean m) {
mirror = m;
return (T) this;
}
/**
* Sets the texture offset
*/
public T tex(int x, int y) {
return setTextureOffset(x, y);
}
public T size(int x, int y) {
return (T) setTextureSize(x, y);
}
/**
* Positions this model in space.
*/
public T at(float x, float y, float z) {
return (T)at(this, x, y, z);
}
/**
* Sets an offset to be used on all shapes and children created through this renderer.
*/
public T offset(float x, float y, float z) {
modelOffsetX = x;
modelOffsetY = y;
modelOffsetZ = z;
return (T) this;
}
/**
* Adjusts the rotation center of the given renderer by the given amounts in each direction.
*/
public static void shiftRotationPoint(ModelRenderer renderer, float x, float y, float z) {
renderer.rotationPointX += x;
renderer.rotationPointY += y;
renderer.rotationPointZ += z;
}
/**
* Sets this renderer's rotation angles.
*/
public T rotate(float x, float y, float z) {
rotateAngleX = x;
rotateAngleY = y;
rotateAngleZ = z;
return (T) this;
}
/**
* Positions a given model in space by setting its offset values divided
* by 16 to account for scaling applied inside the model.
*/
public static <T extends ModelRenderer> T at(T renderer, float x, float y, float z) {
renderer.offsetX = x / 16;
renderer.offsetY = y / 16;
renderer.offsetZ = z / 16;
return renderer;
}
/**
* Rotates this model to align itself with the angles of another.
*/
public void rotateTo(ModelRenderer other) {
rotate(other.rotateAngleX, other.rotateAngleY, other.rotateAngleZ);
}
/**
* Shifts this model to align its center with the center of another.
*/
public T rotateAt(ModelRenderer other) {
return around(other.rotationPointX, other.rotationPointY, other.rotationPointZ);
}
/**
* Sets the rotation point.
*/
public T around(float x, float y, float z) {
setRotationPoint(x, y, z);
return (T) this;
}
/**
* Gets or creates a new child model based on its unique index.
* New children will be of the same type and inherit the same textures and offsets of the original.
*/
public T child(int index) {
if (childModels == null || index >= childModels.size()) {
T copy = copySelf();
child(copy.offset(modelOffsetX, modelOffsetY, modelOffsetZ));
copy.textureHeight = textureHeight;
copy.textureWidth = textureWidth;
}
return (T)childModels.get(index);
}
/**
* Adds a new child renderer and returns itself for chaining.
*/
public <K extends ModelRenderer> T child(K child) {
addChild(child);
return (T)this;
}
@Override
public T addBox(String partName, float offX, float offY, float offZ, int width, int height, int depth) {
partName = boxName + "." + partName;
TextureOffset tex = baseModel.getTextureOffset(partName);
setTextureOffset(tex.textureOffsetX, tex.textureOffsetY).addBox(offX, offY, offZ, width, height, depth);
cubeList.get(cubeList.size() - 1).setBoxName(partName);
return (T) this;
}
@Override
public T addBox(float offX, float offY, float offZ, int width, int height, int depth) {
addBox(offX, offY, offZ, width, height, depth, 0);
return (T) this;
}
@Override
public T addBox(float offX, float offY, float offZ, int width, int height, int depth, boolean mirrored) {
addBox(offX, offY, offZ, width, height, depth, 0, mirrored);
return (T)this;
}
@Override
public void addBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) {
addBox(offX, offY, offZ, width, height, depth, scaleFactor, mirror);
}
/**
* Creates a textured box.
*/
public T box(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) {
return addBox(offX, offY, offZ, width, height, depth, scaleFactor, mirror);
}
private T addBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) {
createBox(modelOffsetX + offX, modelOffsetY + offY, modelOffsetZ + offZ, width, height, depth, scaleFactor, mirrored);
return (T)this;
}
protected void createBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) {
cubeList.add(new ModelBox(this, textureOffsetX, textureOffsetY, offX, offY, offZ, width, height, depth, scaleFactor, mirrored));
}
}

View file

@ -0,0 +1,76 @@
package com.minelittlepony.render;
import net.minecraft.client.renderer.BufferBuilder;
import com.minelittlepony.util.coordinates.*;
/**
* Like a normal box, but with the top narrowed a bit.
*/
public class HornGlow extends Box<HornGlowRenderer> {
private final float alpha;
private Quad[] quadList;
public HornGlow(HornGlowRenderer renderer, int texX, int texY, float xMin, float yMin, float zMin, int w, int h, int d, float scale, float alpha) {
super(renderer, texX, texY, xMin, yMin, zMin, w, h, d, scale);
this.alpha = alpha;
float xMax = xMin + w + scale;
float yMax = yMin + h + scale;
float zMax = zMin + d + scale;
xMin -= scale;
yMin -= scale;
zMin -= scale;
if (renderer.mirror) {
float v = xMax;
xMax = xMin;
xMin = v;
}
float tipInset = 0.4f;
float tipXmin = xMin + w * tipInset;
float tipZmin = zMin + d * tipInset;
float tipXMax = xMax - w * tipInset;
float tipZMax = zMax - d * tipInset;
// w:west e:east d:down u:up s:south n:north
Vertex wds = vert(tipXmin, yMin, tipZmin, 0, 0);
Vertex eds = vert(tipXMax, yMin, tipZmin, 0, 8);
Vertex eus = vert(xMax, yMax, zMin, 8, 8);
Vertex wus = vert(xMin, yMax, zMin, 8, 0);
Vertex wdn = vert(tipXmin, yMin, tipZMax, 0, 0);
Vertex edn = vert(tipXMax, yMin, tipZMax, 0, 8);
Vertex eun = vert(xMax, yMax, zMax, 8, 8);
Vertex wun = vert(xMin, yMax, zMax, 8, 0);
quadList = new Quad[] {
quad(texX + d + w, d, texY + d, h, edn, eds, eus, eun),
quad(texX, d, texY + d, h, wds, wdn, wun, wus),
quad(texX + d, w, texY, d, edn, wdn, wds, eds),
quad(texX + d + w, w, texY + d, -d, eus, wus, wun, eun),
quad(texX + d, w, texY + d, h, eds, wds, wus, eus),
quad(texX + d + w + d, w, texY + d, h, wdn, edn, eun, wun)
};
if (renderer.mirror) {
for (Quad i : quadList) {
i.flipFace();
}
}
}
@Override
public void render(BufferBuilder buffer, float scale) {
parent.applyTint(alpha);
for (Quad i : quadList) {
i.draw(buffer, scale);
}
}
}

View file

@ -0,0 +1,49 @@
package com.minelittlepony.render;
import static net.minecraft.client.renderer.GlStateManager.color;
import com.minelittlepony.util.coordinates.Color;
import net.minecraft.client.model.ModelBase;
public class HornGlowRenderer extends AbstractPonyRenderer<HornGlowRenderer> {
int tint;
float alpha = 1;
public HornGlowRenderer(ModelBase model, int x, int y) {
super(model, x, y);
}
public HornGlowRenderer setAlpha(float alpha) {
this.alpha = alpha;
return this;
}
public HornGlowRenderer setTint(int tint) {
this.tint = tint;
return this;
}
public void applyTint(float alpha) {
Color.glColor(tint, alpha);
}
@Override
public void createBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) {
cubeList.add(new HornGlow(this, textureOffsetX, textureOffsetY, offX, offY, offZ, width, height, depth, scaleFactor, alpha));
}
@Override
public void render(float scale) {
super.render(scale);
color(1, 1, 1, 1);
}
@Override
protected HornGlowRenderer copySelf() {
return new HornGlowRenderer(baseModel, textureOffsetX, textureOffsetY);
}
}

Some files were not shown because too many files have changed in this diff Show more