mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Added a very festive surprise
This commit is contained in:
parent
dd46e8266a
commit
5f01814441
5 changed files with 107 additions and 3 deletions
102
src/main/java/com/minelittlepony/model/gear/ChristmasHat.java
Normal file
102
src/main/java/com/minelittlepony/model/gear/ChristmasHat.java
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
package com.minelittlepony.model.gear;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
import com.minelittlepony.model.BodyPart;
|
||||||
|
import com.minelittlepony.model.capabilities.IModel;
|
||||||
|
import com.minelittlepony.pony.data.PonyWearable;
|
||||||
|
import com.minelittlepony.render.model.PonyRenderer;
|
||||||
|
import com.minelittlepony.util.render.Color;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
public class ChristmasHat extends AbstractGear {
|
||||||
|
|
||||||
|
private static final ResourceLocation TEXTURE = new ResourceLocation("minelittlepony", "textures/models/antlers.png");
|
||||||
|
|
||||||
|
private PonyRenderer left;
|
||||||
|
private PonyRenderer right;
|
||||||
|
|
||||||
|
private int tint;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(float yOffset, float stretch) {
|
||||||
|
this.boxList.clear();
|
||||||
|
|
||||||
|
left = new PonyRenderer(this, 0, 0).size(16, 8)
|
||||||
|
.around(-7, 0.5F, 0.5F)
|
||||||
|
.offset(-7, 0, 0)
|
||||||
|
.at(3, -4, 0)
|
||||||
|
.box(0, 0, 0, 7, 1, 1, stretch)
|
||||||
|
.tex(0, 2).box(0, -1, 0, 1, 1, 1, stretch)
|
||||||
|
.tex(4, 2).box(2, -1, 0, 1, 1, 1, stretch)
|
||||||
|
.tex(8, 2).box(4, -1, 0, 1, 1, 1, stretch);
|
||||||
|
|
||||||
|
right = new PonyRenderer(this, 0, 4).size(16, 8)
|
||||||
|
.around(7, 0.5F, 0.5F)
|
||||||
|
.offset(0, 0, 0)
|
||||||
|
.at(-3, -4, 0)
|
||||||
|
.box(0, 0, 0, 7, 1, 1, stretch)
|
||||||
|
.tex(0, 6).box(6, -1, 0, 1, 1, 1, stretch)
|
||||||
|
.tex(4, 6).box(4, -1, 0, 1, 1, 1, stretch)
|
||||||
|
.tex(8, 6).box(2, -1, 0, 1, 1, 1, stretch);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canRender(IModel model, Entity entity) {
|
||||||
|
return isChristmasDay() || model.isWearing(PonyWearable.ANTLERS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLivingAnimations(IModel model, Entity entity) {
|
||||||
|
tint = model.getMetadata().getGlowColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRotationAndAngles(boolean rainboom, float move, float swing, float bodySwing, float ticks) {
|
||||||
|
float pi = PI * (float) Math.pow(swing, 16);
|
||||||
|
|
||||||
|
float mve = move * 0.6662f;
|
||||||
|
float srt = swing / 10;
|
||||||
|
|
||||||
|
bodySwing = MathHelper.cos(mve + pi) * srt;
|
||||||
|
|
||||||
|
bodySwing += 0.1F;
|
||||||
|
|
||||||
|
left.rotateAngleZ = bodySwing;
|
||||||
|
right.rotateAngleZ = -bodySwing;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isChristmasDay() {
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
|
||||||
|
return cal.get(Calendar.MONTH) == Calendar.DECEMBER && cal.get(Calendar.DAY_OF_MONTH) == 25;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BodyPart getGearLocation() {
|
||||||
|
return BodyPart.HEAD;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getTexture(Entity entity) {
|
||||||
|
return TEXTURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderPart(float scale) {
|
||||||
|
GlStateManager.pushAttrib();
|
||||||
|
if (tint != 0) {
|
||||||
|
Color.glColor(tint, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
left.render(scale);
|
||||||
|
right.render(scale);
|
||||||
|
|
||||||
|
GlStateManager.popAttrib();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -104,7 +104,6 @@ public class SaddleBags extends AbstractGear {
|
||||||
dropAmount = hangLow ? 0.15F : 0;
|
dropAmount = hangLow ? 0.15F : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void sethangingLow(boolean veryLow) {
|
public void sethangingLow(boolean veryLow) {
|
||||||
hangLow = veryLow;
|
hangLow = veryLow;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,10 @@ import java.util.List;
|
||||||
|
|
||||||
public enum PonyWearable implements ITriggerPixelMapped<PonyWearable> {
|
public enum PonyWearable implements ITriggerPixelMapped<PonyWearable> {
|
||||||
NONE(0),
|
NONE(0),
|
||||||
SADDLE_BAGS(200),
|
|
||||||
MUFFIN(50),
|
MUFFIN(50),
|
||||||
HAT(100),
|
HAT(100),
|
||||||
|
ANTLERS(150),
|
||||||
|
SADDLE_BAGS(200),
|
||||||
STETSON(250);
|
STETSON(250);
|
||||||
|
|
||||||
private int triggerValue;
|
private int triggerValue;
|
||||||
|
|
|
@ -11,6 +11,7 @@ import com.google.common.collect.Lists;
|
||||||
import com.minelittlepony.ducks.IRenderPony;
|
import com.minelittlepony.ducks.IRenderPony;
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
|
import com.minelittlepony.model.gear.ChristmasHat;
|
||||||
import com.minelittlepony.model.gear.IGear;
|
import com.minelittlepony.model.gear.IGear;
|
||||||
import com.minelittlepony.model.gear.IStackable;
|
import com.minelittlepony.model.gear.IStackable;
|
||||||
import com.minelittlepony.model.gear.Muffin;
|
import com.minelittlepony.model.gear.Muffin;
|
||||||
|
@ -28,7 +29,8 @@ public class LayerGear<T extends EntityLivingBase> extends AbstractPonyLayer<T>
|
||||||
new SaddleBags(),
|
new SaddleBags(),
|
||||||
new WitchHat(),
|
new WitchHat(),
|
||||||
new Muffin(),
|
new Muffin(),
|
||||||
new Stetson()
|
new Stetson(),
|
||||||
|
new ChristmasHat()
|
||||||
);
|
);
|
||||||
|
|
||||||
public <R extends RenderLivingBase<T> & IRenderPony<T>> LayerGear(R renderer) {
|
public <R extends RenderLivingBase<T> & IRenderPony<T>> LayerGear(R renderer) {
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 462 B |
Loading…
Reference in a new issue