Cleanup/document/etc

This commit is contained in:
Sollace 2019-02-05 10:47:51 +02:00
parent 55dea27d2f
commit 0ac62558f4
7 changed files with 44 additions and 5 deletions

View file

@ -2,6 +2,7 @@ package com.minelittlepony.ducks;
import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.ModelWrapper;
import com.minelittlepony.model.PonyModelConstants;
import com.minelittlepony.model.capabilities.IModel;
import com.minelittlepony.pony.data.IPony;
import com.minelittlepony.render.RenderPony;
@ -13,7 +14,7 @@ import net.minecraft.util.ResourceLocation;
/**
* I Render Pony now, oky?
*/
public interface IRenderPony<T extends EntityLivingBase> {
public interface IRenderPony<T extends EntityLivingBase> extends PonyModelConstants {
/**
* Gets the wrapped pony model for this renderer.

View file

@ -5,6 +5,8 @@ public interface PonyModelConstants {
float
PI = (float)Math.PI,
BASE_MODEL_SCALE = 15/16F,
BODY_CENTRE_X = 0,
BODY_CENTRE_Y = 8,
BODY_CENTRE_Z = 6,

View file

@ -11,7 +11,8 @@ import com.minelittlepony.render.model.PlaneRenderer;
public class ModelVillagerPony extends ModelMobPony {
public PlaneRenderer apron, trinket;
public PlaneRenderer apron;
public PlaneRenderer trinket;
private int profession;

View file

@ -33,7 +33,7 @@ public abstract class RenderPonyIllager<T extends AbstractIllager> extends Rende
@Override
public void preRenderCallback(T entity, float ticks) {
super.preRenderCallback(entity, ticks);
GlStateManager.scale(0.9375F, 0.9375F, 0.9375F);
GlStateManager.scale(BASE_MODEL_SCALE, BASE_MODEL_SCALE, BASE_MODEL_SCALE);
}
public static class Vindicator extends RenderPonyIllager<EntityVindicator> {

View file

@ -34,7 +34,7 @@ public class RenderPonyWitch extends RenderPonyMob<EntityWitch> {
@Override
public void preRenderCallback(EntityWitch entity, float ticks) {
super.preRenderCallback(entity, ticks);
GlStateManager.scale(0.9375F, 0.9375F, 0.9375F);
GlStateManager.scale(BASE_MODEL_SCALE, BASE_MODEL_SCALE, BASE_MODEL_SCALE);
}
@Override

View file

@ -2,20 +2,52 @@ package com.minelittlepony.util.render;
import net.minecraft.client.renderer.GlStateManager;
/**
* Colouration Utilities
*/
public interface Color {
/**
* Returns the RED channel for the given colour integer.
*/
static float r(int color) {
return (color >> 16 & 255) / 255F;
}
/**
* Returns the GREEN channel for the given colour integer.
*/
static float g(int color) {
return (color >> 8 & 255) / 255F;
}
/**
* Returns the BLUE channel for the given colour integer.
*/
static float b(int color) {
return (color & 255) / 255F;
}
/**
* Converts the given rgb floats on a range of 0-1 into a minecraft colour integer.
*/
static int colorInteger(float r, float g, float b) {
return colorInteger((int) (r * 255), (int) (g * 255), (int) (b * 255));
}
/**
* Converts the given rbg int on a range of 0-255 into a minecraft colour integer.
*/
static int colorInteger(int r, int g, int b) {
return (r << 16) | (g << 8) | (b);
}
/**
* Applies a GLTint based on the given colour integer.
*
* @param color The colour to apply
* @param alpha The opacity to use
*/
static void glColor(int color, float alpha) {
GlStateManager.color(Color.r(color), Color.g(color), Color.b(color), alpha);
GlStateManager.color(r(color), g(color), b(color), alpha);
}
}

View file

@ -7,5 +7,8 @@ import net.minecraft.util.ResourceLocation;
*/
@FunctionalInterface
public interface ITextureSupplier<T> {
/**
* Supplies a new texture. May be generated for returned from a pool indexed by the given key.
*/
ResourceLocation supplyTexture(T key);
}