mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 13:57:59 +01:00
Initial update to 1.11. Features next.
This commit is contained in:
parent
bf5b141687
commit
2245e42ad0
20 changed files with 171 additions and 222 deletions
|
@ -26,12 +26,12 @@ apply plugin: 'org.spongepowered.mixin'
|
|||
apply plugin: 'mnm.gradle.ap-ide'
|
||||
|
||||
group = 'com.brohoof.minelp'
|
||||
version = '1.10.2.6'
|
||||
version = '1.11.0.0-beta'
|
||||
description = 'Mine Little Pony'
|
||||
|
||||
minecraft {
|
||||
version = "1.10.2"
|
||||
mappings = 'snapshot_20160704' // 'murica! F*** yeah!
|
||||
version = "1.11"
|
||||
mappings = 'snapshot_20161116'
|
||||
runDir = 'run'
|
||||
replace '@VERSION@',project.version
|
||||
}
|
||||
|
@ -52,8 +52,6 @@ sourceSets {
|
|||
}
|
||||
}
|
||||
|
||||
dependencies.testCompile 'junit:junit:4.12'
|
||||
|
||||
litemod.json {
|
||||
author = 'Verdana, Rene_Z, Mumfrey, JoyJoy'
|
||||
description = 'Mine Little Pony turns players and mobs into ponies'
|
||||
|
|
|
@ -29,7 +29,7 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
|
|||
|
||||
@Override
|
||||
protected boolean canRenderName(M targetEntity) {
|
||||
if (Minecraft.getMinecraft().thePlayer != null) {
|
||||
if (Minecraft.getMinecraft().player != null) {
|
||||
return super.canRenderName(targetEntity);
|
||||
}
|
||||
return false;
|
||||
|
@ -37,7 +37,7 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
|
|||
|
||||
@Override
|
||||
protected boolean setBrightness(M entitylivingbaseIn, float partialTicks, boolean p_177092_3_) {
|
||||
if (Minecraft.getMinecraft().theWorld != null) {
|
||||
if (Minecraft.getMinecraft().world != null) {
|
||||
return super.setBrightness(entitylivingbaseIn, partialTicks, p_177092_3_);
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.brohoof.minelittlepony.renderer.RenderPonyPigman;
|
|||
import com.brohoof.minelittlepony.renderer.RenderPonySkeleton;
|
||||
import com.brohoof.minelittlepony.renderer.RenderPonyVillager;
|
||||
import com.brohoof.minelittlepony.renderer.RenderPonyZombie;
|
||||
import com.brohoof.minelittlepony.renderer.RenderPonyZombieVillager;
|
||||
import com.brohoof.minelittlepony.util.MineLPLogger;
|
||||
import com.mumfrey.liteloader.core.LiteLoader;
|
||||
import com.mumfrey.liteloader.util.ModUtilities;
|
||||
|
@ -20,9 +21,13 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.resources.IReloadableResourceManager;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.entity.monster.EntityHusk;
|
||||
import net.minecraft.entity.monster.EntityPigZombie;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.entity.monster.EntityStray;
|
||||
import net.minecraft.entity.monster.EntityWitherSkeleton;
|
||||
import net.minecraft.entity.monster.EntityZombie;
|
||||
import net.minecraft.entity.monster.EntityZombieVillager;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
|
||||
public class MineLittlePony {
|
||||
|
@ -76,11 +81,13 @@ public class MineLittlePony {
|
|||
ModUtilities.addRenderer(EntityPonyModel.class, new RenderPonyModel(rm));
|
||||
if (this.config.villagers) {
|
||||
ModUtilities.addRenderer(EntityVillager.class, new RenderPonyVillager(rm));
|
||||
ModUtilities.addRenderer(EntityZombieVillager.class, new RenderPonyZombieVillager(rm));
|
||||
MineLPLogger.info("Villagers are now ponies.");
|
||||
}
|
||||
|
||||
if (this.config.zombies) {
|
||||
ModUtilities.addRenderer(EntityZombie.class, new RenderPonyZombie(rm));
|
||||
ModUtilities.addRenderer(EntityZombie.class, new RenderPonyZombie<EntityZombie>(rm));
|
||||
ModUtilities.addRenderer(EntityHusk.class, new RenderPonyZombie.Husk(rm));
|
||||
MineLPLogger.info("Zombies are now ponies.");
|
||||
}
|
||||
|
||||
|
@ -90,7 +97,9 @@ public class MineLittlePony {
|
|||
}
|
||||
|
||||
if (this.config.skeletons) {
|
||||
ModUtilities.addRenderer(EntitySkeleton.class, new RenderPonySkeleton(rm));
|
||||
ModUtilities.addRenderer(EntitySkeleton.class, new RenderPonySkeleton<EntitySkeleton>(rm));
|
||||
ModUtilities.addRenderer(EntityStray.class, new RenderPonySkeleton.Stray(rm));
|
||||
ModUtilities.addRenderer(EntityWitherSkeleton.class, new RenderPonySkeleton.Wither(rm));
|
||||
MineLPLogger.info("Skeletons are now ponies.");
|
||||
}
|
||||
|
||||
|
@ -126,8 +135,4 @@ public class MineLittlePony {
|
|||
return getInstance().config;
|
||||
}
|
||||
|
||||
public static String getSPUsername() {
|
||||
return Minecraft.getMinecraft().getSession().getUsername();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ import java.awt.image.BufferedImage;
|
|||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.brohoof.minelittlepony.model.PMAPI;
|
||||
import com.brohoof.minelittlepony.model.PlayerModel;
|
||||
import com.brohoof.minelittlepony.util.MineLPLogger;
|
||||
|
@ -41,7 +43,7 @@ public class Pony {
|
|||
private int skinCheckCount;
|
||||
private boolean skinChecked;
|
||||
|
||||
public Pony(AbstractClientPlayer player) {
|
||||
public Pony(@Nonnull AbstractClientPlayer player) {
|
||||
this.profile = player.getGameProfile();
|
||||
this.textureResourceLocation = player.getLocationSkin();
|
||||
MineLPLogger.debug("+ Initialising new pony #%d for player %s (%s) with resource location %s.", this.ponyId,
|
||||
|
@ -50,7 +52,7 @@ public class Pony {
|
|||
this.checkMeta(profile);
|
||||
}
|
||||
|
||||
public Pony(ResourceLocation aTextureResourceLocation) {
|
||||
public Pony(@Nonnull ResourceLocation aTextureResourceLocation) {
|
||||
this.textureResourceLocation = aTextureResourceLocation;
|
||||
MineLPLogger.debug("+ Initialising new pony #%d with resource location %s.", this.ponyId, this.textureResourceLocation);
|
||||
this.checkSkin(this.textureResourceLocation);
|
||||
|
@ -118,7 +120,7 @@ public class Pony {
|
|||
metadata.setGlowColor(Integer.parseInt(prefs.apply(MineLittlePony.MLP_MAGIC)));
|
||||
}
|
||||
|
||||
public BufferedImage getBufferedImage(ResourceLocation textureResourceLocation) {
|
||||
public BufferedImage getBufferedImage(@Nonnull ResourceLocation textureResourceLocation) {
|
||||
BufferedImage skinImage = null;
|
||||
try {
|
||||
IResource skin = Minecraft.getMinecraft().getResourceManager().getResource(textureResourceLocation);
|
||||
|
|
|
@ -12,8 +12,6 @@ import org.apache.commons.compress.utils.IOUtils;
|
|||
import com.brohoof.minelittlepony.model.PMAPI;
|
||||
import com.brohoof.minelittlepony.util.MineLPLogger;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.Gson;
|
||||
|
@ -23,48 +21,14 @@ import net.minecraft.client.entity.AbstractClientPlayer;
|
|||
import net.minecraft.client.resources.IResource;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
||||
import net.minecraft.entity.monster.SkeletonType;
|
||||
import net.minecraft.entity.monster.ZombieType;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class PonyManager implements IResourceManagerReloadListener {
|
||||
|
||||
public static final String NAMESPACE = "minelittlepony";
|
||||
public static final ResourceLocation ZOMBIE = new ResourceLocation(NAMESPACE, "textures/entity/zombie/zombie_pony.png");
|
||||
public static final ResourceLocation ZOMBIE_VILLAGER = new ResourceLocation(NAMESPACE, "textures/entity/zombie_villager/zombie_villager_pony.png");
|
||||
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");
|
||||
|
||||
public static final Map<ZombieType, ResourceLocation> ZOMBIES = Maps.immutableEnumMap(ImmutableMap.<ZombieType, ResourceLocation> builder()
|
||||
.put(ZombieType.NORMAL, ZOMBIE)
|
||||
.put(ZombieType.HUSK, new ResourceLocation(NAMESPACE, "textures/entity/zombie/zombie_husk_pony.png"))
|
||||
.put(ZombieType.VILLAGER_FARMER, new ResourceLocation(NAMESPACE, "textures/entity/zombie_villager/zombie_farmer_pony.png"))
|
||||
.put(ZombieType.VILLAGER_LIBRARIAN, new ResourceLocation(NAMESPACE, "textures/entity/zombie_villager/zombie_librarian_pony.png"))
|
||||
.put(ZombieType.VILLAGER_PRIEST, new ResourceLocation(NAMESPACE, "textures/entity/zombie_villager/zombie_priest_pony.png"))
|
||||
.put(ZombieType.VILLAGER_SMITH, new ResourceLocation(NAMESPACE, "textures/entity/zombie_villager/zombie_smith_pony.png"))
|
||||
.put(ZombieType.VILLAGER_BUTCHER, new ResourceLocation(NAMESPACE, "textures/entity/zombie_villager/zombie_butcher_pony.png"))
|
||||
.build());
|
||||
|
||||
public static final List<ResourceLocation> VILLAGER_LIST = ImmutableList.<ResourceLocation> builder()
|
||||
.add(new ResourceLocation(NAMESPACE, "textures/entity/villager/farmer_pony.png"))
|
||||
.add(new ResourceLocation(NAMESPACE, "textures/entity/villager/librarian_pony.png"))
|
||||
.add(new ResourceLocation(NAMESPACE, "textures/entity/villager/priest_pony.png"))
|
||||
.add(new ResourceLocation(NAMESPACE, "textures/entity/villager/smith_pony.png"))
|
||||
.add(new ResourceLocation(NAMESPACE, "textures/entity/villager/butcher_pony.png"))
|
||||
.add(new ResourceLocation(NAMESPACE, "textures/entity/villager/villager_pony.png"))
|
||||
.build();
|
||||
|
||||
public static final ResourceLocation PIGMAN = new ResourceLocation(NAMESPACE, "textures/entity/zombie/zombie_pigman_pony.png");
|
||||
public static final ResourceLocation SKELETON = new ResourceLocation(NAMESPACE, "textures/entity/skeleton/skeleton_pony.png");
|
||||
|
||||
public static final Map<SkeletonType, ResourceLocation> SKELETONS = Maps.immutableEnumMap(ImmutableMap.<SkeletonType, ResourceLocation> builder()
|
||||
.put(SkeletonType.NORMAL, SKELETON)
|
||||
.put(SkeletonType.WITHER, new ResourceLocation(NAMESPACE, "textures/entity/skeleton/skeleton_wither_pony.png"))
|
||||
.put(SkeletonType.STRAY, new ResourceLocation(NAMESPACE, "textures/entity/skeleton/stray_pony.png"))
|
||||
.build());
|
||||
public static final ResourceLocation STEVE = new ResourceLocation(NAMESPACE, "textures/entity/steve_pony.png");
|
||||
public static final ResourceLocation ALEX = new ResourceLocation(NAMESPACE, "textures/entity/alex_pony.png");
|
||||
|
||||
private static final ResourceLocation BGPONIES_JSON = new ResourceLocation(NAMESPACE, "textures/entity/pony/bgponies.json");
|
||||
private static final ResourceLocation BGPONIES_JSON = new ResourceLocation("minelittlepony", "textures/entity/pony/bgponies.json");
|
||||
private List<ResourceLocation> backgroundPonyList = Lists.newArrayList();
|
||||
|
||||
private PonyConfig config;
|
||||
|
@ -113,21 +77,6 @@ public class PonyManager implements IResourceManagerReloadListener {
|
|||
return myLittlePony;
|
||||
}
|
||||
|
||||
public Pony getPonyFromResourceRegistry(EntityVillager entity) {
|
||||
int profession = entity.getProfession();
|
||||
|
||||
ResourceLocation villagerResourceLocation;
|
||||
try {
|
||||
villagerResourceLocation = VILLAGER_LIST.get(profession);
|
||||
} catch (IndexOutOfBoundsException var5) {
|
||||
villagerResourceLocation = VILLAGER_LIST.get(5);
|
||||
}
|
||||
|
||||
Pony myLittlePony = this.getPonyFromResourceRegistry(villagerResourceLocation);
|
||||
// myLittlePony.setVillager(profession);
|
||||
return myLittlePony;
|
||||
}
|
||||
|
||||
public ResourceLocation getBackgroundPonyResource(UUID id) {
|
||||
if (getNumberOfPonies() > 0) {
|
||||
int backgroundIndex = id.hashCode() % this.getNumberOfPonies();
|
||||
|
@ -190,11 +139,11 @@ public class PonyManager implements IResourceManagerReloadListener {
|
|||
}
|
||||
}
|
||||
|
||||
public static ResourceLocation getDefaultSkin(UUID uuid) {
|
||||
private ResourceLocation getDefaultSkin(UUID uuid) {
|
||||
return (uuid.hashCode() & 1) == 0 ? STEVE : ALEX;
|
||||
}
|
||||
|
||||
public int getNumberOfPonies() {
|
||||
private int getNumberOfPonies() {
|
||||
return backgroundPonyList.size();
|
||||
}
|
||||
|
||||
|
@ -205,7 +154,7 @@ public class PonyManager implements IResourceManagerReloadListener {
|
|||
|
||||
@Override
|
||||
public ResourceLocation apply(String input) {
|
||||
return new ResourceLocation(NAMESPACE, String.format("textures/entity/pony/%s.png", input));
|
||||
return new ResourceLocation("minelittlepony", String.format("textures/entity/pony/%s.png", input));
|
||||
}
|
||||
|
||||
public List<ResourceLocation> getPonies() {
|
||||
|
|
|
@ -101,7 +101,7 @@ public class PegasusWings implements IPonyPart, PonyModelConstants {
|
|||
|
||||
float bodySwingRotation = 0.0F;
|
||||
if (pony.swingProgress > -9990.0F && !metadata.hasMagic()) {
|
||||
bodySwingRotation = MathHelper.sin(MathHelper.sqrt_float(pony.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
|
||||
bodySwingRotation = MathHelper.sin(MathHelper.sqrt(pony.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
|
||||
}
|
||||
for (int i = 0; i < this.leftWing.length; ++i) {
|
||||
this.leftWing[i].rotateAngleY = bodySwingRotation * 0.2F;
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
|
|||
this.swingTailZ(move, swing);
|
||||
float bodySwingRotation = 0.0F;
|
||||
if (this.swingProgress > -9990.0F && !this.metadata.hasMagic()) {
|
||||
bodySwingRotation = MathHelper.sin(MathHelper.sqrt_float(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
|
||||
bodySwingRotation = MathHelper.sin(MathHelper.sqrt(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
|
||||
}
|
||||
|
||||
this.bipedBody.rotateAngleY = bodySwingRotation * 0.2F;
|
||||
|
|
|
@ -22,7 +22,7 @@ public class ModelVillagerPony extends ModelPlayerPony {
|
|||
super.animate(move, swing, tick, horz, vert, entity);
|
||||
float bodySwingRotation = 0.0F;
|
||||
if (this.swingProgress > -9990.0F && !this.metadata.hasMagic()) {
|
||||
bodySwingRotation = MathHelper.sin(MathHelper.sqrt_float(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
|
||||
bodySwingRotation = MathHelper.sin(MathHelper.sqrt(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
|
||||
}
|
||||
for (int i = 0; i < this.VillagerBagPiece.length; ++i) {
|
||||
this.VillagerBagPiece[i].rotateAngleY = bodySwingRotation * 0.2F;
|
||||
|
|
|
@ -30,7 +30,7 @@ public class ModelPonyArmor extends ModelPlayerPony {
|
|||
this.rotateHead(horz, vert);
|
||||
float bodySwingRotation = 0.0F;
|
||||
if (this.swingProgress > -9990.0F && !this.metadata.hasMagic()) {
|
||||
bodySwingRotation = MathHelper.sin(MathHelper.sqrt_float(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
|
||||
bodySwingRotation = MathHelper.sin(MathHelper.sqrt(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
|
||||
}
|
||||
|
||||
this.bipedBody.rotateAngleY = bodySwingRotation * 0.2F;
|
||||
|
|
|
@ -12,13 +12,9 @@ import com.brohoof.minelittlepony.renderer.layer.LayerPonyArmor;
|
|||
import com.brohoof.minelittlepony.renderer.layer.LayerPonySkull;
|
||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped.ArmPose;
|
||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving<T> implements IRenderPony {
|
||||
|
@ -49,47 +45,6 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
|
|||
|
||||
@Override
|
||||
protected void preRenderCallback(T entity, float partialTickTime) {
|
||||
ItemStack main = entity.getHeldItemMainhand();
|
||||
ItemStack off = entity.getHeldItemOffhand();
|
||||
ArmPose mainPose = ArmPose.EMPTY;
|
||||
ArmPose offPose = ArmPose.EMPTY;
|
||||
|
||||
if (main != null) {
|
||||
mainPose = ArmPose.ITEM;
|
||||
|
||||
if (entity.getItemInUseCount() > 0) {
|
||||
EnumAction action = main.getItemUseAction();
|
||||
|
||||
if (action == EnumAction.BLOCK) {
|
||||
mainPose = ArmPose.BLOCK;
|
||||
} else if (action == EnumAction.BOW) {
|
||||
mainPose = ArmPose.BOW_AND_ARROW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (off != null) {
|
||||
offPose = ArmPose.ITEM;
|
||||
|
||||
if (entity.getItemInUseCount() > 0) {
|
||||
EnumAction action = off.getItemUseAction();
|
||||
|
||||
if (action == EnumAction.BLOCK) {
|
||||
offPose = ArmPose.BLOCK;
|
||||
} else if (action == EnumAction.BOW) {
|
||||
offPose = ArmPose.BOW_AND_ARROW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entity.getPrimaryHand() == EnumHandSide.RIGHT) {
|
||||
this.playerModel.getModel().rightArmPose = mainPose;
|
||||
this.playerModel.getModel().leftArmPose = offPose;
|
||||
} else {
|
||||
this.playerModel.getModel().rightArmPose = offPose;
|
||||
this.playerModel.getModel().leftArmPose = mainPose;
|
||||
}
|
||||
|
||||
this.playerModel.getModel().isSneak = false;
|
||||
this.playerModel.getModel().isFlying = false;
|
||||
this.playerModel.getModel().isSleeping = false;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.brohoof.minelittlepony.renderer;
|
||||
|
||||
import com.brohoof.minelittlepony.PonyManager;
|
||||
import com.brohoof.minelittlepony.model.PMAPI;
|
||||
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
|
@ -9,13 +8,15 @@ import net.minecraft.util.ResourceLocation;
|
|||
|
||||
public class RenderPonyPigman extends RenderPonyMob<EntityPigZombie> {
|
||||
|
||||
private static final ResourceLocation PIGMAN = new ResourceLocation("minelittlepony", "textures/entity/zombie/zombie_pigman_pony.png");
|
||||
|
||||
public RenderPonyPigman(RenderManager renderManager) {
|
||||
super(renderManager, PMAPI.pony);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityPigZombie entity) {
|
||||
return getTexture(PonyManager.PIGMAN);
|
||||
return getTexture(PIGMAN);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,21 +3,26 @@ package com.brohoof.minelittlepony.renderer;
|
|||
import java.util.Random;
|
||||
|
||||
import com.brohoof.minelittlepony.PonyGender;
|
||||
import com.brohoof.minelittlepony.PonyManager;
|
||||
import com.brohoof.minelittlepony.PonyRace;
|
||||
import com.brohoof.minelittlepony.PonySize;
|
||||
import com.brohoof.minelittlepony.TailLengths;
|
||||
import com.brohoof.minelittlepony.model.PMAPI;
|
||||
import com.brohoof.minelittlepony.renderer.layer.LayerPonySkeletonOverlay;
|
||||
import com.brohoof.minelittlepony.renderer.layer.LayerPonyStrayOverlay;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerBipedArmor;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.entity.monster.SkeletonType;
|
||||
import net.minecraft.entity.monster.AbstractSkeleton;
|
||||
import net.minecraft.entity.monster.EntityStray;
|
||||
import net.minecraft.entity.monster.EntityWitherSkeleton;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderPonySkeleton extends RenderPonyMob<EntitySkeleton> {
|
||||
public class RenderPonySkeleton<Skeleton extends AbstractSkeleton> extends RenderPonyMob<Skeleton> {
|
||||
|
||||
private static final ResourceLocation SKELETON = new ResourceLocation("minelittlepony", "textures/entity/skeleton/skeleton_pony.png");
|
||||
private static final ResourceLocation WITHER = new ResourceLocation("minelittlepony", "textures/entity/skeleton/skeleton_wither_pony.png");
|
||||
private static final ResourceLocation STRAY = new ResourceLocation("minelittlepony", "textures/entity/skeleton/stray_pony.png");
|
||||
|
||||
public RenderPonySkeleton(RenderManager rm) {
|
||||
super(rm, PMAPI.skeleton);
|
||||
this.addLayer(new LayerBipedArmor(this) {
|
||||
|
@ -27,15 +32,11 @@ public class RenderPonySkeleton extends RenderPonyMob<EntitySkeleton> {
|
|||
this.modelArmor = PMAPI.skeleton.getArmor().modelArmorChestplate;
|
||||
}
|
||||
});
|
||||
this.addLayer(new LayerPonySkeletonOverlay(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preRenderCallback(EntitySkeleton skeleton, float partialTicks) {
|
||||
protected void preRenderCallback(Skeleton skeleton, float partialTicks) {
|
||||
super.preRenderCallback(skeleton, partialTicks);
|
||||
if (skeleton.getSkeletonType() == SkeletonType.WITHER) {
|
||||
GlStateManager.scale(1.2F, 1.2F, 1.2F);
|
||||
}
|
||||
|
||||
Random rand = new Random(skeleton.getUniqueID().hashCode());
|
||||
this.playerModel.getModel().metadata.setGender(rand.nextBoolean() ? PonyGender.MARE : PonyGender.STALLION);
|
||||
|
@ -58,11 +59,40 @@ public class RenderPonySkeleton extends RenderPonyMob<EntitySkeleton> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntitySkeleton skeleton) {
|
||||
SkeletonType type = skeleton.getSkeletonType();
|
||||
ResourceLocation loc = PonyManager.SKELETONS.get(type);
|
||||
if (loc == null)
|
||||
loc = PonyManager.SKELETON;
|
||||
return getTexture(loc);
|
||||
protected ResourceLocation getEntityTexture(Skeleton entity) {
|
||||
return getTexture(SKELETON);
|
||||
}
|
||||
|
||||
public static class Stray extends RenderPonySkeleton<EntityStray> {
|
||||
|
||||
public Stray(RenderManager rm) {
|
||||
super(rm);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityStray entity) {
|
||||
return getTexture(STRAY);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Wither extends RenderPonySkeleton<EntityWitherSkeleton> {
|
||||
|
||||
public Wither(RenderManager rm) {
|
||||
super(rm);
|
||||
this.addLayer(new LayerPonyStrayOverlay(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityWitherSkeleton entity) {
|
||||
return getTexture(WITHER);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preRenderCallback(EntityWitherSkeleton skeleton, float partialTicks) {
|
||||
super.preRenderCallback(skeleton, partialTicks);
|
||||
GlStateManager.scale(1.2F, 1.2F, 1.2F);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.brohoof.minelittlepony.renderer;
|
||||
|
||||
import com.brohoof.minelittlepony.MineLittlePony;
|
||||
import com.brohoof.minelittlepony.Pony;
|
||||
import com.brohoof.minelittlepony.model.PMAPI;
|
||||
import com.brohoof.minelittlepony.model.pony.ModelVillagerPony;
|
||||
|
||||
|
@ -12,6 +11,13 @@ import net.minecraft.util.ResourceLocation;
|
|||
|
||||
public class RenderPonyVillager extends RenderPonyMob<EntityVillager> {
|
||||
|
||||
private static final ResourceLocation GENERIC = new ResourceLocation("minelittlepony", "textures/entity/villager/villager_pony.png");
|
||||
private static final ResourceLocation FARMER = new ResourceLocation("minelittlepony", "textures/entity/villager/farmer_pony.png");
|
||||
private static final ResourceLocation LIBRARIAN = new ResourceLocation("minelittlepony", "textures/entity/villager/librarian_pony.png");
|
||||
private static final ResourceLocation PRIEST = new ResourceLocation("minelittlepony", "textures/entity/villager/priest_pony.png");
|
||||
private static final ResourceLocation SMITH = new ResourceLocation("minelittlepony", "textures/entity/villager/smith_pony.png");
|
||||
private static final ResourceLocation BUTCHER = new ResourceLocation("minelittlepony", "textures/entity/villager/butcher_pony.png");
|
||||
|
||||
public RenderPonyVillager(RenderManager rm) {
|
||||
super(rm, PMAPI.villager);
|
||||
}
|
||||
|
@ -34,7 +40,24 @@ public class RenderPonyVillager extends RenderPonyMob<EntityVillager> {
|
|||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityVillager villager) {
|
||||
Pony aVillagerPony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(villager);
|
||||
return getTexture(aVillagerPony.getTextureResourceLocation());
|
||||
return getTexture(getTextureForVillager(villager));
|
||||
}
|
||||
|
||||
private ResourceLocation getTextureForVillager(EntityVillager villager) {
|
||||
switch (villager.getProfession()) {
|
||||
case 0:
|
||||
return FARMER;
|
||||
case 1:
|
||||
return LIBRARIAN;
|
||||
case 2:
|
||||
return PRIEST;
|
||||
case 3:
|
||||
return SMITH;
|
||||
case 4:
|
||||
return BUTCHER;
|
||||
case 5:
|
||||
default:
|
||||
return GENERIC;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,24 +3,28 @@ package com.brohoof.minelittlepony.renderer;
|
|||
import java.util.Random;
|
||||
|
||||
import com.brohoof.minelittlepony.PonyGender;
|
||||
import com.brohoof.minelittlepony.PonyManager;
|
||||
import com.brohoof.minelittlepony.PonyRace;
|
||||
import com.brohoof.minelittlepony.PonySize;
|
||||
import com.brohoof.minelittlepony.TailLengths;
|
||||
import com.brohoof.minelittlepony.model.PMAPI;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.monster.EntityHusk;
|
||||
import net.minecraft.entity.monster.EntityZombie;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderPonyZombie extends RenderPonyMob<EntityZombie> {
|
||||
public class RenderPonyZombie<Zombie extends EntityZombie> extends RenderPonyMob<Zombie> {
|
||||
|
||||
private static final ResourceLocation ZOMBIE = new ResourceLocation("minelittlepony", "textures/entity/zombie/zombie_pony.png");
|
||||
private static final ResourceLocation HUSK = new ResourceLocation("minelittlepony", "textures/entity/zombie/zombie_husk_pony.png");
|
||||
|
||||
public RenderPonyZombie(RenderManager rendermanager) {
|
||||
super(rendermanager, PMAPI.zombie);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preRenderCallback(EntityZombie entity, float partick) {
|
||||
protected void preRenderCallback(Zombie entity, float partick) {
|
||||
super.preRenderCallback(entity, partick);
|
||||
Random rand = new Random(entity.getUniqueID().hashCode());
|
||||
|
||||
|
@ -58,26 +62,33 @@ public class RenderPonyZombie extends RenderPonyMob<EntityZombie> {
|
|||
|
||||
}
|
||||
|
||||
private <T extends Enum<T>> T randEnum(Random rand, Class<T> en) {
|
||||
private static <T extends Enum<T>> T randEnum(Random rand, Class<T> en) {
|
||||
T[] values = en.getEnumConstants();
|
||||
return values[rand.nextInt(values.length)];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void rotateCorpse(EntityZombie zombie, float xPosition, float yPosition, float zPosition) {
|
||||
super.rotateCorpse(zombie, xPosition, yPosition, zPosition);
|
||||
if (zombie.isConverting()) {
|
||||
yPosition += (float) (Math.cos(zombie.ticksExisted * 3.25D) * Math.PI * 0.25D);
|
||||
protected ResourceLocation getEntityTexture(Zombie zombie) {
|
||||
return getTexture(ZOMBIE);
|
||||
}
|
||||
|
||||
public static class Husk extends RenderPonyZombie<EntityHusk> {
|
||||
|
||||
public Husk(RenderManager rendermanager) {
|
||||
super(rendermanager);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityZombie zombie) {
|
||||
ResourceLocation loc = PonyManager.ZOMBIES.get(zombie.getZombieType());
|
||||
if (loc == null) {
|
||||
loc = zombie.isVillager() ? PonyManager.ZOMBIE_VILLAGER : PonyManager.ZOMBIE;
|
||||
protected void preRenderCallback(EntityHusk entitylivingbaseIn, float partialTickTime) {
|
||||
GlStateManager.scale(1.0625F, 1.0625F, 1.0625F);
|
||||
super.preRenderCallback(entitylivingbaseIn, partialTickTime);
|
||||
}
|
||||
return getTexture(loc);
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityHusk zombie) {
|
||||
return getTexture(HUSK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ public class LayerHeldPonyItem implements LayerRenderer<EntityLivingBase> {
|
|||
GL14.glBlendColor(red, green, blue, alpha);
|
||||
|
||||
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
|
||||
IBakedModel model = renderItem.getItemModelWithOverrides(drop, entity.worldObj, entity);
|
||||
IBakedModel model = renderItem.getItemModelWithOverrides(drop, entity.world, entity);
|
||||
|
||||
ItemCameraTransforms itemcameratransforms = model.getItemCameraTransforms();
|
||||
ItemCameraTransforms.applyTransformSide(itemcameratransforms.getTransform(transform), hand == EnumHandSide.LEFT);
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
package com.brohoof.minelittlepony.renderer.layer;
|
||||
|
||||
import com.brohoof.minelittlepony.PonyManager;
|
||||
import com.brohoof.minelittlepony.model.pony.ModelSkeletonPony;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.entity.monster.SkeletonType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class LayerPonySkeletonOverlay extends LayerOverlayBase<EntitySkeleton> {
|
||||
|
||||
public static final ResourceLocation STRAY_SKELETON_OVERLAY = new ResourceLocation(PonyManager.NAMESPACE, "textures/entity/skeleton/stray_pony_overlay.png");
|
||||
|
||||
private final ModelSkeletonPony overlayModel;
|
||||
|
||||
public LayerPonySkeletonOverlay(RenderLivingBase<?> render) {
|
||||
super(render);
|
||||
this.overlayModel = new ModelSkeletonPony();
|
||||
this.overlayModel.init(0F, 0.25F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(EntitySkeleton skele, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
if (skele.getSkeletonType() == SkeletonType.STRAY) {
|
||||
this.renderOverlay(skele, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ModelBase getOverlayModel() {
|
||||
return this.overlayModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getOverlayTexture() {
|
||||
return STRAY_SKELETON_OVERLAY;
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@ import net.minecraft.client.renderer.entity.RenderLivingBase;
|
|||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.EntityZombie;
|
||||
import net.minecraft.entity.monster.EntityZombieVillager;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
|
@ -44,8 +44,7 @@ public class LayerPonySkull implements LayerRenderer<EntityLivingBase> {
|
|||
Item item = itemstack.getItem();
|
||||
|
||||
pushMatrix();
|
||||
boolean isVillager = entity instanceof EntityVillager
|
||||
|| entity instanceof EntityZombie && ((EntityZombie) entity).isVillager();
|
||||
boolean isVillager = entity instanceof EntityVillager || entity instanceof EntityZombieVillager;
|
||||
|
||||
model.transform(BodyPart.HEAD);
|
||||
model.bipedHead.postRender(0.0625f);
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package com.brohoof.minelittlepony.renderer.layer;
|
||||
|
||||
import com.brohoof.minelittlepony.model.pony.ModelSkeletonPony;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||
import net.minecraft.entity.monster.EntityStray;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class LayerPonyStrayOverlay extends LayerOverlayBase<EntityStray> {
|
||||
|
||||
public static final ResourceLocation STRAY_SKELETON_OVERLAY = new ResourceLocation("minelittlepony", "textures/entity/skeleton/stray_pony_overlay.png");
|
||||
|
||||
private final ModelSkeletonPony overlayModel;
|
||||
|
||||
public LayerPonyStrayOverlay(RenderLivingBase<?> render) {
|
||||
super(render);
|
||||
this.overlayModel = new ModelSkeletonPony();
|
||||
this.overlayModel.init(0F, 0.25F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(EntityStray skele, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
this.renderOverlay(skele, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ModelBase getOverlayModel() {
|
||||
return this.overlayModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getOverlayTexture() {
|
||||
return STRAY_SKELETON_OVERLAY;
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 442 B |
|
@ -1,20 +0,0 @@
|
|||
package com.brohoof.minelittlepony.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.brohoof.minelittlepony.PonyManager;
|
||||
|
||||
import net.minecraft.entity.monster.ZombieType;
|
||||
|
||||
public class TestEnumMap {
|
||||
|
||||
@Test
|
||||
public void testMapCompletion() {
|
||||
int size = PonyManager.ZOMBIES.size();
|
||||
|
||||
assertEquals(size, ZombieType.values().length);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue