mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 12:37:59 +01:00
Minor reorganisation
This commit is contained in:
parent
965d701da4
commit
1e9a663aa2
13 changed files with 36 additions and 65 deletions
|
@ -18,8 +18,6 @@ import com.minelittlepony.pony.IPonyData;
|
|||
import com.minelittlepony.pony.meta.Size;
|
||||
import com.minelittlepony.util.math.MathUtil;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.model.ModelPlayer;
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
|
@ -50,7 +48,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
/**
|
||||
* Associated pony data.
|
||||
*/
|
||||
public IPonyData metadata = new PonyData();
|
||||
private IPonyData metadata = new PonyData();
|
||||
|
||||
/**
|
||||
* Vertical pitch whilst flying.
|
||||
|
@ -274,12 +272,6 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
return bipedHead;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ModelRenderer getBody() {
|
||||
return bipedBody;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPitch(float pitch) {
|
||||
motionPitch = pitch;
|
||||
|
@ -469,6 +461,18 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
alignArmForAction(bipedRightArm, rightArmPose, leftArmPose, both, swing, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelRenderer getBodyPart(BodyPart part) {
|
||||
switch (part) {
|
||||
default:
|
||||
case HEAD: return bipedHead;
|
||||
case NECK: return neck;
|
||||
case TAIL:
|
||||
case LEGS:
|
||||
case BODY: return bipedBody;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Aligns an arm for the appropriate arm pose
|
||||
*
|
||||
|
@ -764,6 +768,11 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IClientMo
|
|||
return metadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(IPonyData meta) {
|
||||
metadata = meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCrouching() {
|
||||
return isCrouching;
|
||||
|
|
|
@ -2,9 +2,11 @@ package com.minelittlepony.client.model;
|
|||
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.ICapitated;
|
||||
import com.minelittlepony.model.IModel;
|
||||
|
||||
public interface IClientModel extends IModel, ICapitated<ModelRenderer> {
|
||||
|
||||
ModelRenderer getBodyPart(BodyPart part);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ModelWrapper implements IModelWrapper {
|
|||
init();
|
||||
}
|
||||
|
||||
body.metadata = meta;
|
||||
body.apply(meta);
|
||||
armor.apply(meta);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ public class PonyArmor implements IEquestrianArmour<ModelPonyArmor> {
|
|||
|
||||
@Override
|
||||
public void apply(IPonyData meta) {
|
||||
outerLayer.metadata = meta;
|
||||
innerLayer.metadata = meta;
|
||||
outerLayer.apply(meta);
|
||||
innerLayer.apply(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,8 +5,6 @@ import com.minelittlepony.client.util.render.PonyRenderer;
|
|||
import com.minelittlepony.model.ICapitated;
|
||||
import com.minelittlepony.pony.IPonyData;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.entity.model.ModelHumanoidHead;
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -41,12 +39,6 @@ public class ModelPonyHead extends ModelHumanoidHead implements ICapitated<Model
|
|||
return skeletonHead;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ModelRenderer getBody() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasHeadGear() {
|
||||
return false;
|
||||
|
|
|
@ -2,13 +2,11 @@ package com.minelittlepony.client.model.gear;
|
|||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.model.PonyModelConstants;
|
||||
|
||||
public abstract class AbstractGear extends ModelBase implements IGear, PonyModelConstants {
|
||||
|
@ -20,18 +18,6 @@ public abstract class AbstractGear extends ModelBase implements IGear, PonyModel
|
|||
init(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelRenderer getOriginBodyPart(AbstractPonyModel model) {
|
||||
switch (getGearLocation()) {
|
||||
default:
|
||||
case HEAD: return model.getHead();
|
||||
case NECK: return model.neck;
|
||||
case TAIL:
|
||||
case LEGS:
|
||||
case BODY: return model.getBody();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderSeparately(Entity entity, float scale) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
package com.minelittlepony.client.model.gear;
|
||||
|
||||
import net.minecraft.client.renderer.entity.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.model.IClientModel;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IPart;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public interface IGear extends IPart {
|
||||
|
@ -36,12 +33,6 @@ public interface IGear extends IPart {
|
|||
@Nullable
|
||||
ResourceLocation getTexture(Entity entity);
|
||||
|
||||
/**
|
||||
* Gets the actual body part this wearable will latch onto.
|
||||
*/
|
||||
@Nonnull
|
||||
ModelRenderer getOriginBodyPart(AbstractPonyModel model);
|
||||
|
||||
/**
|
||||
* Orients this wearable.
|
||||
*/
|
||||
|
|
|
@ -110,21 +110,11 @@ public class ModelUnicorn extends ModelEarthPony implements IUnicorn<PonyRendere
|
|||
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 ponyCrouch() {
|
||||
super.ponyCrouch();
|
||||
|
|
|
@ -53,7 +53,7 @@ public class LayerGear<T extends EntityLivingBase> extends AbstractPonyLayer<T>
|
|||
if (gear.canRender(model, entity)) {
|
||||
GlStateManager.pushMatrix();
|
||||
model.transform(gear.getGearLocation());
|
||||
gear.getOriginBodyPart(model).postRender(scale);
|
||||
model.getBodyPart(gear.getGearLocation()).postRender(scale);
|
||||
|
||||
if (gear instanceof IStackable) {
|
||||
BodyPart part = gear.getGearLocation();
|
||||
|
|
|
@ -33,7 +33,7 @@ public class LayerPonyCape extends AbstractPonyLayer<AbstractClientPlayer> {
|
|||
|
||||
model.transform(BodyPart.BODY);
|
||||
translatef(0, 0.24F, 0);
|
||||
model.getBody().postRender(scale);
|
||||
model.getBodyPart(BodyPart.BODY).postRender(scale);
|
||||
|
||||
double capeX = player.prevChasingPosX + (player.chasingPosX - player.prevChasingPosX) * scale - (player.prevPosX + (player.posX - player.prevPosX) * scale);
|
||||
double capeY = player.prevChasingPosY + (player.chasingPosY - player.prevChasingPosY) * scale - (player.prevPosY + (player.posY - player.prevPosY) * scale);
|
||||
|
|
|
@ -1,19 +1,11 @@
|
|||
package com.minelittlepony.model;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public interface ICapitated<ModelRenderer> {
|
||||
/**
|
||||
* Gets the head of this capitated object.
|
||||
*/
|
||||
ModelRenderer getHead();
|
||||
|
||||
/**
|
||||
* Gets the main body
|
||||
*/
|
||||
@Nullable
|
||||
ModelRenderer getBody();
|
||||
|
||||
/**
|
||||
* Returns true if we're wearing any unconventional headgear (ie. a Pumpkin)
|
||||
*/
|
||||
|
|
|
@ -39,6 +39,11 @@ public interface IModel {
|
|||
*/
|
||||
IPonyData getMetadata();
|
||||
|
||||
/**
|
||||
* Sets the pony metadata object associated with this model.
|
||||
*/
|
||||
void apply(IPonyData meta);
|
||||
|
||||
/**
|
||||
* Returns true if this model is on the ground and crouching.
|
||||
*/
|
||||
|
|
|
@ -11,7 +11,9 @@ public interface IUnicorn<Arm> extends IModel {
|
|||
/**
|
||||
* Returns true if this model is being applied to a race that can use magic.
|
||||
*/
|
||||
boolean canCast();
|
||||
default boolean canCast() {
|
||||
return getMetadata().hasMagic();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this model is currently using magic (horn is lit).
|
||||
|
@ -22,5 +24,7 @@ public interface IUnicorn<Arm> extends IModel {
|
|||
/**
|
||||
* Gets the preferred magic color for this mode.
|
||||
*/
|
||||
int getMagicColor();
|
||||
default int getMagicColor() {
|
||||
return getMetadata().getGlowColor();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue