mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 08:45:11 +00:00
Moved model scale parts into a single ModelScale class, similar to ModelRotate.
Added NPC model data interfaces to the API.
This commit is contained in:
1 parent
2ef93dd35f
commit
f0b33cf913
63 files changed
+412
-283
No files matched your search
@@ -0,0 +1,51 @@
|
||||
package noppes.npcs.entity.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.entity.data.IModelScalePart;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
public class ModelScalePart implements IModelScalePart {
|
||||
public float scaleX = 1, scaleY = 1, scaleZ = 1;
|
||||
|
||||
public NBTTagCompound writeToNBT(){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setFloat("ScaleX", scaleX);
|
||||
compound.setFloat("ScaleY", scaleY);
|
||||
compound.setFloat("ScaleZ", scaleZ);
|
||||
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
scaleX = ValueUtil.correctFloat(compound.getFloat("ScaleX"), 0.5f, 1.5f);
|
||||
scaleY = ValueUtil.correctFloat(compound.getFloat("ScaleY"), 0.5f, 1.5f);
|
||||
scaleZ = ValueUtil.correctFloat(compound.getFloat("ScaleZ"), 0.5f, 1.5f);
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return "ScaleX: " + scaleX + " - ScaleY: " + scaleY + " - ScaleZ: " + scaleZ;
|
||||
}
|
||||
|
||||
public void setScale(float x, float y) {
|
||||
scaleZ = scaleX = x;
|
||||
scaleY = y;
|
||||
}
|
||||
|
||||
public void setScale(float x, float y, float z) {
|
||||
scaleX = ValueUtil.correctFloat(x, 0.5f, 1.5f);
|
||||
scaleY = ValueUtil.correctFloat(y, 0.5f, 1.5f);
|
||||
scaleZ = ValueUtil.correctFloat(z, 0.5f, 1.5f);
|
||||
}
|
||||
|
||||
public float getScaleX() {
|
||||
return scaleX;
|
||||
}
|
||||
|
||||
public float getScaleY() {
|
||||
return scaleY;
|
||||
}
|
||||
|
||||
public float getScaleZ() {
|
||||
return scaleZ;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user