mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 00:17:27 +00:00
Updating Texture Sizes
Attempting to implement a selective renderer to allow for 64x64 Skin Url type for mobs.
This commit is contained in:
1 parent
8a4be0bc1e
commit
66270715ac
41 files changed
+487
-18
No files matched your search
@@ -19,14 +19,14 @@ public class DataDisplay {
|
||||
public String name;
|
||||
public String title = "";
|
||||
|
||||
public byte skinType = 0; //0:normal, 1:player, 2:url
|
||||
public byte skinType = 0; //0:normal, 1:player, 2:url, 3:url64
|
||||
public String url = "";
|
||||
public GameProfile playerProfile;
|
||||
public String texture = "customnpcs:textures/entity/humanmale/Steve.png";;
|
||||
public String cloakTexture = "";
|
||||
public String glowTexture = "";
|
||||
|
||||
public int visible = 0;//0:visible 1:Invisible 2:semi-invisible
|
||||
public int visible = 0; //0:visible 1:Invisible 2:semi-invisible
|
||||
|
||||
public int modelSize = 5;
|
||||
|
||||
@@ -89,7 +89,6 @@ public class DataDisplay {
|
||||
|
||||
nbttagcompound.setBoolean("NoLivingAnimation", disableLivingAnimation);
|
||||
nbttagcompound.setByte("BossBar", showBossBar);
|
||||
// nbttagcompound.setByte("SquareTexture", squareTexture);
|
||||
|
||||
return nbttagcompound;
|
||||
}
|
||||
@@ -126,7 +125,6 @@ public class DataDisplay {
|
||||
|
||||
disableLivingAnimation = nbttagcompound.getBoolean("NoLivingAnimation");
|
||||
showBossBar = nbttagcompound.getByte("BossBar");
|
||||
// squareTexture = nbttagcompound.getByte("SquareTexture");
|
||||
|
||||
if(prevSkinType != skinType || !texture.equals(prevTexture))
|
||||
npc.textureLocation = null;
|
||||
|
||||
@@ -24,7 +24,7 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ImageDownloadAlt extends SimpleTexture
|
||||
public class ImageDownloadAlt32 extends SimpleTexture
|
||||
{
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
private static final AtomicInteger threadDownloadCounter = new AtomicInteger(0);
|
||||
@@ -35,7 +35,7 @@ public class ImageDownloadAlt extends SimpleTexture
|
||||
private Thread imageThread;
|
||||
private boolean textureUploaded;
|
||||
|
||||
public ImageDownloadAlt(File file, String url, ResourceLocation resource, IImageBuffer buffer)
|
||||
public ImageDownloadAlt32(File file, String url, ResourceLocation resource, IImageBuffer buffer)
|
||||
{
|
||||
super(resource);
|
||||
this.cacheFile = file;
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
package noppes.npcs.client;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IImageBuffer;
|
||||
import net.minecraft.client.renderer.texture.SimpleTexture;
|
||||
import net.minecraft.client.renderer.texture.TextureUtil;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ImageDownloadAlt extends SimpleTexture
|
||||
{
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
private static final AtomicInteger threadDownloadCounter = new AtomicInteger(0);
|
||||
private final File cacheFile;
|
||||
private final String imageUrl;
|
||||
private final IImageBuffer imageBuffer;
|
||||
private BufferedImage bufferedImage;
|
||||
private Thread imageThread;
|
||||
private boolean textureUploaded;
|
||||
|
||||
public ImageDownloadAlt(File file, String url, ResourceLocation resource, IImageBuffer buffer)
|
||||
{
|
||||
super(resource);
|
||||
this.cacheFile = file;
|
||||
this.imageUrl = url;
|
||||
this.imageBuffer = buffer;
|
||||
}
|
||||
|
||||
private void checkTextureUploaded()
|
||||
{
|
||||
if (!this.textureUploaded)
|
||||
{
|
||||
if (this.bufferedImage != null)
|
||||
{
|
||||
if (this.textureLocation != null)
|
||||
{
|
||||
this.deleteGlTexture();
|
||||
}
|
||||
|
||||
TextureUtil.uploadTextureImage(super.getGlTextureId(), this.bufferedImage);
|
||||
this.textureUploaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getGlTextureId()
|
||||
{
|
||||
this.checkTextureUploaded();
|
||||
return super.getGlTextureId();
|
||||
}
|
||||
|
||||
public void setBufferedImage(BufferedImage p_147641_1_)
|
||||
{
|
||||
this.bufferedImage = p_147641_1_;
|
||||
|
||||
if (this.imageBuffer != null)
|
||||
{
|
||||
this.imageBuffer.func_152634_a();
|
||||
}
|
||||
}
|
||||
|
||||
public void loadTexture(IResourceManager resourceManager) throws IOException
|
||||
{
|
||||
if (this.bufferedImage == null && this.textureLocation != null)
|
||||
{
|
||||
super.loadTexture(resourceManager);
|
||||
}
|
||||
|
||||
if (this.imageThread == null)
|
||||
{
|
||||
if (this.cacheFile != null && this.cacheFile.isFile())
|
||||
{
|
||||
logger.debug("Loading http texture from local cache ({})", new Object[] {this.cacheFile});
|
||||
|
||||
try
|
||||
{
|
||||
this.bufferedImage = ImageIO.read(this.cacheFile);
|
||||
|
||||
if (this.imageBuffer != null)
|
||||
{
|
||||
this.setBufferedImage(this.imageBuffer.parseUserSkin(this.bufferedImage));
|
||||
}
|
||||
}
|
||||
catch (IOException ioexception)
|
||||
{
|
||||
logger.error("Couldn\'t load skin " + this.cacheFile, ioexception);
|
||||
this.loadTextureFromServer();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.loadTextureFromServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadTextureFromServer()
|
||||
{
|
||||
this.imageThread = new Thread("Texture Downloader #" + threadDownloadCounter.incrementAndGet())
|
||||
{
|
||||
private static final String __OBFID = "CL_00001050";
|
||||
public void run()
|
||||
{
|
||||
HttpURLConnection connection = null;
|
||||
ImageDownloadAlt.logger.debug("Downloading http texture from {} to {}", new Object[] {ImageDownloadAlt.this.imageUrl, ImageDownloadAlt.this.cacheFile});
|
||||
|
||||
try
|
||||
{
|
||||
connection = (HttpURLConnection)(new URL(ImageDownloadAlt.this.imageUrl)).openConnection(Minecraft.getMinecraft().getProxy());
|
||||
connection.setDoInput(true);
|
||||
connection.setDoOutput(false);
|
||||
connection.setRequestProperty("Content-Type", "image/png");
|
||||
connection.setRequestProperty("Expect", "100-continue");
|
||||
//connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20100101 Firefox/19.0");
|
||||
connection.setRequestProperty("User-Agent", "Mozilla/5.0");
|
||||
connection.connect();
|
||||
|
||||
if (connection.getResponseCode() / 100 != 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BufferedImage bufferedimage;
|
||||
|
||||
if (ImageDownloadAlt.this.cacheFile != null)
|
||||
{
|
||||
FileUtils.copyInputStreamToFile(connection.getInputStream(), ImageDownloadAlt.this.cacheFile);
|
||||
bufferedimage = ImageIO.read(ImageDownloadAlt.this.cacheFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
bufferedimage = ImageIO.read(connection.getInputStream());
|
||||
}
|
||||
|
||||
if (ImageDownloadAlt.this.imageBuffer != null)
|
||||
{
|
||||
bufferedimage = ImageDownloadAlt.this.imageBuffer.parseUserSkin(bufferedimage);
|
||||
}
|
||||
|
||||
ImageDownloadAlt.this.setBufferedImage(bufferedimage);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ImageDownloadAlt.logger.error("Couldn\'t download http texture", exception);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (connection != null)
|
||||
{
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
this.imageThread.setDaemon(true);
|
||||
this.imageThread.start();
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
|
||||
addLabel(new GuiNpcLabel(4,"display.texture", guiLeft + 5, y + 5));
|
||||
addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 80, y, 200, 20, display.skinType == 0?display.texture:display.url));
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 325, y, 38, 20, "mco.template.button.select"));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 283, y, 40, 20, new String[]{"display.texture","display.player", "display.url"},display.skinType));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 283, y, 40, 20, new String[]{"display.texture","display.player", "display.url", "display.url64"},display.skinType));
|
||||
getButton(3).setEnabled(display.skinType == 0);
|
||||
if(display.skinType == 1 && display.playerProfile != null)
|
||||
getTextField(3).setText(display.playerProfile.getName());
|
||||
@@ -102,7 +102,8 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
|
||||
display.modelSize = textfield.getInteger();
|
||||
}
|
||||
else if(textfield.id == 3){
|
||||
if(display.skinType == 2)
|
||||
// SKIN CHANGE
|
||||
if(display.skinType == 2 || display.skinType == 3)
|
||||
display.url = textfield.getText();
|
||||
else if(display.skinType == 1){
|
||||
if(!textfield.isEmpty()){
|
||||
@@ -137,7 +138,10 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
|
||||
}
|
||||
if(button.id == 2){
|
||||
display.skinType = (byte) button.getValue();
|
||||
display.url = "";
|
||||
// SKIN CHANGE
|
||||
if (display.skinType != 3){
|
||||
display.url = "";
|
||||
}
|
||||
display.playerProfile = null;
|
||||
initGui();
|
||||
}
|
||||
|
||||
@@ -270,6 +270,9 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
|
||||
// New Button for Changing Models
|
||||
if(button.id == 250){
|
||||
if(npc.display.modelType == 0){
|
||||
if (npc.display.skinType == 2){
|
||||
npc.display.skinType = 3;
|
||||
}
|
||||
npc.display.modelType = 1;
|
||||
}
|
||||
else if(npc.display.modelType == 1){
|
||||
@@ -277,6 +280,9 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
|
||||
}
|
||||
else {
|
||||
npc.display.modelType = 0;
|
||||
if (npc.display.skinType == 3){
|
||||
npc.display.skinType = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ public class GuiModelBody extends GuiModelInterface{
|
||||
private final String[] arrWing = new String[]{"gui.no","Player","Type1","Type2","Type3","Type4","Type5","Type6","Type7","Type8","Type9",
|
||||
"Type10","Type11","Type12","Type13"};
|
||||
private final String[] arrBreasts = new String[]{"gui.no","Type1","Type2","Type3"};
|
||||
private final String[] arrParticles = new String[]{"gui.no","Player","Type1","Type2", "Rainbow"};
|
||||
private final String[] arrParticles = new String[]{"gui.no","Player","Type1", "Type2", "Rainbow", "Type3", "Type4", "Type5", "Type6", "Type7"};
|
||||
private final String[] arrfins = new String[]{"gui.no","Player","Type1","Type2","Type3","Type4","Type5","Type6"};
|
||||
private final String[] arrskirt = new String[]{"gui.no","Player","Type1"};
|
||||
|
||||
@@ -109,6 +109,16 @@ public class GuiModelBody extends GuiModelInterface{
|
||||
return 2;
|
||||
if(particles.texture.contains("2"))
|
||||
return 3;
|
||||
if(particles.texture.contains("3"))
|
||||
return 5;
|
||||
if(particles.texture.contains("4"))
|
||||
return 6;
|
||||
if(particles.texture.contains("5"))
|
||||
return 7;
|
||||
if(particles.texture.contains("6"))
|
||||
return 8;
|
||||
if(particles.texture.contains("7"))
|
||||
return 9;
|
||||
}
|
||||
if(particles.type == 1){
|
||||
return 4;
|
||||
@@ -149,6 +159,16 @@ public class GuiModelBody extends GuiModelInterface{
|
||||
particles.setTexture("particle/type2", 0);
|
||||
if(value == 4)
|
||||
particles.setTexture("", 1);
|
||||
if(value == 5)
|
||||
particles.setTexture("particle/type3", 0);
|
||||
if(value == 6)
|
||||
particles.setTexture("particle/type4", 0);
|
||||
if(value == 7)
|
||||
particles.setTexture("particle/type5", 0);
|
||||
if(value == 8)
|
||||
particles.setTexture("particle/type6", 0);
|
||||
if(value == 9)
|
||||
particles.setTexture("particle/type7", 0);
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ public class ModelMPM extends ModelNPCMale{
|
||||
}
|
||||
|
||||
headwear = new ModelHeadwear(this);
|
||||
legs = new ModelLegs(this, (ModelScaleRenderer)bipedRightLeg, (ModelScaleRenderer)bipedLeftLeg);
|
||||
legs = new ModelLegs(this, (ModelScaleRenderer)bipedRightLeg, (ModelScaleRenderer)bipedLeftLeg, 64, 64);
|
||||
// bodywear = new ModelBodywear(this);
|
||||
|
||||
this.bipedBody.addChild(breasts = new ModelBreasts(this));
|
||||
@@ -234,6 +234,101 @@ public class ModelMPM extends ModelNPCMale{
|
||||
}
|
||||
}
|
||||
|
||||
// Steve 64x32
|
||||
public ModelMPM(float par1) {
|
||||
|
||||
super(par1);
|
||||
isArmor = par1 > 0;
|
||||
float par2 = 0;
|
||||
|
||||
this.bipedCloak = new ModelRenderer(this, 0, 0);
|
||||
this.bipedCloak.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, par1);
|
||||
|
||||
this.bipedEars = new ModelRenderer(this, 24, 0);
|
||||
this.bipedEars.addBox(-3.0F, -6.0F, -1.0F, 6, 6, 1, par1);
|
||||
|
||||
this.bipedHead = (new ModelScaleRenderer(this, 0, 0));
|
||||
this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1);
|
||||
this.bipedHead.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
|
||||
|
||||
this.bipedHeadwear = (new ModelScaleRenderer(this, 32, 0));
|
||||
this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1 + 0.5F);
|
||||
this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
|
||||
|
||||
this.bipedBody = (new ModelScaleRenderer(this, 16, 16));
|
||||
this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, par1);
|
||||
this.bipedBody.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
|
||||
|
||||
// New Extension
|
||||
this.bipedBodywear = (new ModelScaleRenderer(this, 16, 32));
|
||||
this.bipedBodywear.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, par1 + 0.5F);
|
||||
this.bipedBody.addChild(this.bipedBodywear);
|
||||
|
||||
this.bipedRightArm = new ModelScaleRenderer(this, 40, 16);
|
||||
this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, par1);
|
||||
this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + par2, 0.0F);
|
||||
|
||||
this.bipedLeftArm = new ModelScaleRenderer(this, 40, 16);
|
||||
this.bipedLeftArm.mirror = true;
|
||||
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1);
|
||||
this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + par2, 0.0F);
|
||||
|
||||
// Arms
|
||||
this.bipedRightArmwear = (new ModelScaleRenderer(this, 40, 16));
|
||||
this.bipedRightArmwear.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
|
||||
this.bipedRightArm.addChild(this.bipedRightArmwear);
|
||||
|
||||
this.bipedLeftArmwear = new ModelScaleRenderer(this, 40, 16);
|
||||
this.bipedLeftArmwear.mirror = true;
|
||||
this.bipedLeftArmwear.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
|
||||
this.bipedLeftArm.addChild(this.bipedLeftArmwear);
|
||||
|
||||
this.bipedRightLeg = new ModelScaleRenderer(this, 0, 16);
|
||||
this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1);
|
||||
this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F + par2, 0.0F);
|
||||
|
||||
// Legs
|
||||
this.bipedLeftLeg = new ModelScaleRenderer(this, 0, 16);
|
||||
this.bipedLeftLeg.mirror = true;
|
||||
this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1);
|
||||
this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F + par2, 0.0F);
|
||||
|
||||
this.bipedRightLegWear = (new ModelScaleRenderer(this, 0, 16));
|
||||
this.bipedRightLegWear.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
|
||||
this.bipedRightLeg.addChild(this.bipedRightLegWear);
|
||||
|
||||
this.bipedLeftLegWear = new ModelScaleRenderer(this, 0, 16);
|
||||
this.bipedLeftArmwear.mirror = true;
|
||||
this.bipedLeftLegWear.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
|
||||
this.bipedLeftLeg.addChild(this.bipedLeftLegWear);
|
||||
|
||||
headwear = new ModelHeadwear(this, true);
|
||||
legs = new ModelLegs(this, (ModelScaleRenderer)bipedRightLeg, (ModelScaleRenderer)bipedLeftLeg, 64, 32);
|
||||
|
||||
this.bipedBody.addChild(breasts = new ModelBreasts(this));
|
||||
if(!isArmor){
|
||||
this.bipedHead.addChild(ears = new ModelEars(this));
|
||||
this.bipedHead.addChild(mohawk = new ModelMohawk(this));
|
||||
this.bipedHead.addChild(hair = new ModelHair(this));
|
||||
this.bipedHead.addChild(beard = new ModelBeard(this));
|
||||
|
||||
// Completed
|
||||
this.bipedHead.addChild(snout = new ModelSnout(this));
|
||||
this.bipedHead.addChild(horns = new ModelHorns(this));
|
||||
|
||||
// Completed
|
||||
tail = new ModelTail(this);
|
||||
|
||||
this.bipedBody.addChild(wings = new ModelWings(this));
|
||||
this.bipedBody.addChild(fin = new ModelFin(this));
|
||||
|
||||
// Fix This
|
||||
this.bipedBody.addChild(skirt = new ModelSkirt(this));
|
||||
this.bipedLeftArm.addChild(clawsL = new ModelClaws(this, false));
|
||||
this.bipedRightArm.addChild(clawsR = new ModelClaws(this, true));
|
||||
}
|
||||
}
|
||||
|
||||
private void setPlayerData(EntityCustomNpc entity){
|
||||
if(!isArmor){
|
||||
mohawk.setData(entity.modelData, entity);
|
||||
|
||||
@@ -52,6 +52,51 @@ public class ModelHeadwear extends ModelScaleRenderer{
|
||||
this.addChild(bottom);
|
||||
}
|
||||
|
||||
public ModelHeadwear(ModelBase base, boolean steve32) {
|
||||
super(base);
|
||||
Model2DRenderer right = new Model2DRenderer(base, 32, 8, 8, 8, 64, 32);
|
||||
right.setRotationPoint(-4.641F, .8f, 4.64f);
|
||||
right.setScale(0.58f);
|
||||
right.setThickness(0.65f);
|
||||
setRotation(right, 0, (float)(Math.PI/2f), 0);
|
||||
this.addChild(right);
|
||||
|
||||
Model2DRenderer left = new Model2DRenderer(base, 48, 8, 8, 8, 64, 32);
|
||||
left.setRotationPoint(4.639F, .8f, -4.64f);
|
||||
left.setScale(0.58f);
|
||||
left.setThickness(0.65f);
|
||||
setRotation(left, 0, (float)(Math.PI/-2f), 0);
|
||||
this.addChild(left);
|
||||
|
||||
Model2DRenderer front = new Model2DRenderer(base, 40, 8, 8, 8, 64, 32);
|
||||
front.setRotationPoint(-4.64F, .801f, -4.641f);
|
||||
front.setScale(0.58f);
|
||||
front.setThickness(0.65f);
|
||||
setRotation(front, 0, 0, 0);
|
||||
this.addChild(front);
|
||||
|
||||
Model2DRenderer back = new Model2DRenderer(base, 56, 8, 8, 8, 64, 32);
|
||||
back.setRotationPoint(4.64F, .801f, 4.639f);
|
||||
back.setScale(0.58f);
|
||||
back.setThickness(0.65f);
|
||||
setRotation(back, 0, (float)(Math.PI), 0);
|
||||
this.addChild(back);
|
||||
|
||||
Model2DRenderer top = new Model2DRenderer(base, 40, 0, 8, 8, 64, 32);
|
||||
top.setRotationPoint(-4.64F, -8.5f, -4.64f);
|
||||
top.setScale(0.5799f);
|
||||
top.setThickness(0.65f);
|
||||
setRotation(top, (float)(Math.PI / -2), 0, 0);
|
||||
this.addChild(top);
|
||||
|
||||
Model2DRenderer bottom = new Model2DRenderer(base, 48, 0, 8, 8, 64, 32);
|
||||
bottom.setRotationPoint(-4.64F, 0f, -4.64f);
|
||||
bottom.setScale(0.5799f);
|
||||
bottom.setThickness(0.65f);
|
||||
setRotation(bottom, (float)(Math.PI / -2), 0, 0);
|
||||
this.addChild(bottom);
|
||||
}
|
||||
|
||||
public void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
|
||||
@@ -59,7 +59,7 @@ public class ModelLegs extends ModelScaleRenderer{
|
||||
|
||||
private ModelMPM base;
|
||||
|
||||
public ModelLegs(ModelMPM base, ModelScaleRenderer leg1, ModelScaleRenderer leg2) {
|
||||
public ModelLegs(ModelMPM base, ModelScaleRenderer leg1, ModelScaleRenderer leg2, int textWidth, int textHeight) {
|
||||
super(base);
|
||||
this.base = base;
|
||||
this.leg1 = leg1;
|
||||
@@ -73,51 +73,61 @@ public class ModelLegs extends ModelScaleRenderer{
|
||||
float var1 = 0.0F;
|
||||
byte var2 = 15;
|
||||
spiderNeck = new ModelRenderer(base, 0, 0);
|
||||
spiderNeck.setTextureSize(64,32);
|
||||
spiderNeck.addBox(-3.0F, -3.0F, -3.0F, 6, 6, 6, var1);
|
||||
spiderNeck.setRotationPoint(0.0F, (float)var2, 2.0F);
|
||||
spider.addChild(spiderNeck);
|
||||
|
||||
spiderBody = new ModelRenderer(base, 0, 12);
|
||||
spiderBody.setTextureSize(64,32);
|
||||
spiderBody.addBox(-5.0F, -4.0F, -6.0F, 10, 8, 12, var1);
|
||||
spiderBody.setRotationPoint(0.0F, (float)var2, 11.0F);
|
||||
spider.addChild(spiderBody);
|
||||
|
||||
this.spiderLeg1 = new ModelRenderer(base, 18, 0);
|
||||
this.spiderLeg1.setTextureSize(64,32);
|
||||
this.spiderLeg1.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, var1);
|
||||
this.spiderLeg1.setRotationPoint(-4.0F, (float)var2, 4.0F);
|
||||
spider.addChild(spiderLeg1);
|
||||
|
||||
this.spiderLeg2 = new ModelRenderer(base, 18, 0);
|
||||
this.spiderLeg2.setTextureSize(64,32);
|
||||
this.spiderLeg2.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, var1);
|
||||
this.spiderLeg2.setRotationPoint(4.0F, (float)var2, 4.0F);
|
||||
spider.addChild(spiderLeg2);
|
||||
|
||||
this.spiderLeg3 = new ModelRenderer(base, 18, 0);
|
||||
this.spiderLeg3.setTextureSize(64,32);
|
||||
this.spiderLeg3.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, var1);
|
||||
this.spiderLeg3.setRotationPoint(-4.0F, (float)var2, 3.0F);
|
||||
spider.addChild(spiderLeg3);
|
||||
|
||||
this.spiderLeg4 = new ModelRenderer(base, 18, 0);
|
||||
this.spiderLeg4.setTextureSize(64,32);
|
||||
this.spiderLeg4.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, var1);
|
||||
this.spiderLeg4.setRotationPoint(4.0F, (float)var2, 3.0F);
|
||||
spider.addChild(spiderLeg4);
|
||||
|
||||
this.spiderLeg5 = new ModelRenderer(base, 18, 0);
|
||||
this.spiderLeg5.setTextureSize(64,32);
|
||||
this.spiderLeg5.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, var1);
|
||||
this.spiderLeg5.setRotationPoint(-4.0F, (float)var2, 2.0F);
|
||||
spider.addChild(spiderLeg5);
|
||||
|
||||
this.spiderLeg6 = new ModelRenderer(base, 18, 0);
|
||||
this.spiderLeg6.setTextureSize(64,32);
|
||||
this.spiderLeg6.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, var1);
|
||||
this.spiderLeg6.setRotationPoint(4.0F, (float)var2, 2.0F);
|
||||
spider.addChild(spiderLeg6);
|
||||
|
||||
this.spiderLeg7 = new ModelRenderer(base, 18, 0);
|
||||
this.spiderLeg7.setTextureSize(64,32);
|
||||
this.spiderLeg7.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, var1);
|
||||
this.spiderLeg7.setRotationPoint(-4.0F, (float)var2, 1.0F);
|
||||
spider.addChild(spiderLeg7);
|
||||
|
||||
this.spiderLeg8 = new ModelRenderer(base, 18, 0);
|
||||
this.spiderLeg8.setTextureSize(64,32);
|
||||
this.spiderLeg8.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, var1);
|
||||
this.spiderLeg8.setRotationPoint(4.0F, (float)var2, 1.0F);
|
||||
spider.addChild(spiderLeg8);
|
||||
|
||||
@@ -29,29 +29,34 @@ public class ModelMermaidLegs extends ModelRenderer {
|
||||
textureHeight = 32;
|
||||
|
||||
top = new ModelRenderer(base, 0, 16);
|
||||
top.setTextureSize(64,32);
|
||||
top.addBox(-2F, -2.5F, -2F, 8, 9, 4);
|
||||
top.setRotationPoint(-2F, 14F, 1F);
|
||||
setRotation(top, 0.26F, 0F, 0F);
|
||||
|
||||
middle = new ModelRenderer(base, 28, 0);
|
||||
middle.setTextureSize(64,32);
|
||||
middle.addBox(0F, 0F, 0F, 7, 6, 4);
|
||||
middle.setRotationPoint(-1.5F, 6.5F, -1F);
|
||||
setRotation(middle, 0.86f, 0F, 0F);
|
||||
top.addChild(middle);
|
||||
|
||||
bottom = new ModelRenderer(base, 24, 16);
|
||||
bottom.setTextureSize(64,32);
|
||||
bottom.addBox(0F, 0F, 0F, 6, 7, 3);
|
||||
bottom.setRotationPoint(0.5F, 6F, 0.5f);
|
||||
setRotation(bottom, 0.15f, 0F, 0F);
|
||||
middle.addChild(bottom);
|
||||
|
||||
fin1 = new ModelRenderer(base, 0, 0);
|
||||
fin1.setTextureSize(64,32);
|
||||
fin1.addBox(0F, 0F, 0F, 5, 9, 1);
|
||||
fin1.setRotationPoint(0F, 4.5F, 1F);
|
||||
setRotation(fin1, 0.05f, 0, 0.5911399F);
|
||||
bottom.addChild(fin1);
|
||||
|
||||
fin2 = new ModelRenderer(base, 0, 0);
|
||||
fin2.setTextureSize(64,32);
|
||||
fin2.mirror = true;
|
||||
fin2.addBox(-5F, 0F, 0F, 5, 9, 1);
|
||||
fin2.setRotationPoint(6F, 4.5F, 1F);
|
||||
|
||||
@@ -29,47 +29,55 @@ public class ModelMermaidLegs2 extends ModelRenderer {
|
||||
textureHeight = 32;
|
||||
|
||||
Tail1 = new ModelRenderer(base, 0, 18);
|
||||
Tail1.setTextureSize(64,32);
|
||||
Tail1.addBox(0F, 0F, 0F, 8, 6, 4);
|
||||
Tail1.setRotationPoint(-4F, 12F, -2F);
|
||||
setRotation(Tail1, 0.075F, 0F, 0F);
|
||||
|
||||
Tail2 = new ModelRenderer(base, 0, 18);
|
||||
Tail2.setTextureSize(64,32);
|
||||
Tail2.addBox(0F, 0F, 0F, 6, 5, 3);
|
||||
Tail2.setRotationPoint(1F, 5.5F, 0.3F);
|
||||
setRotation(Tail2, 0.56F, 0F, 0F);
|
||||
Tail1.addChild(Tail2);
|
||||
|
||||
Tail3 = new ModelRenderer(base, 0, 18);
|
||||
Tail3.setTextureSize(64,32);
|
||||
Tail3.addBox(0F, 0F, 0F, 5, 5, 2);
|
||||
Tail3.setRotationPoint(5.5F, 4F, 2.5F);
|
||||
setRotation(Tail3, -0.37818F, 3.141593F, 0F);
|
||||
Tail2.addChild(Tail3);
|
||||
|
||||
Tail4 = new ModelRenderer(base, 0, 20);
|
||||
Tail4.setTextureSize(64,32);
|
||||
Tail4.addBox(0F, 0F, 0F, 4, 3, 1);
|
||||
Tail4.setRotationPoint(0.5F, 4.5F, 0.5F);
|
||||
setRotation(Tail4, -0.1f, 0, 0F);
|
||||
Tail3.addChild(Tail4);
|
||||
|
||||
Tail5 = new ModelRenderer(base, 0, 20);
|
||||
Tail5.setTextureSize(64,32);
|
||||
Tail5.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||
Tail5.setRotationPoint(-1F, 1.5F, 0F);
|
||||
setRotation(Tail5, 0, 0, 0F);
|
||||
Tail4.addChild(Tail5);
|
||||
|
||||
Tail6 = new ModelRenderer(base, 0, 20);
|
||||
Tail6.setTextureSize(64,32);
|
||||
Tail6.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||
Tail6.setRotationPoint(-2F, 3F, 0F);
|
||||
setRotation(Tail6, 0, 0, 0F);
|
||||
Tail4.addChild(Tail6);
|
||||
|
||||
Tail7 = new ModelRenderer(base, 0, 20);
|
||||
Tail7.setTextureSize(64,32);
|
||||
Tail7.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||
Tail7.setRotationPoint(4F, 1.5F, 0F);
|
||||
setRotation(Tail7, 0, 0, 0F);
|
||||
Tail4.addChild(Tail7);
|
||||
|
||||
Tail8 = new ModelRenderer(base, 0, 20);
|
||||
Tail8.setTextureSize(64,32);
|
||||
Tail8.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||
Tail8.setRotationPoint(5F, 3F, 0F);
|
||||
setRotation(Tail8, 0, 0, 0F);
|
||||
|
||||
@@ -25,8 +25,10 @@ public class ModelNagaLegs extends ModelRenderer{
|
||||
super(base);
|
||||
|
||||
nagaPart1 = new ModelRenderer(base,0,0);
|
||||
nagaPart1.setTextureSize(64,32);
|
||||
|
||||
ModelRenderer legPart = new ModelRenderer(base,0,16);
|
||||
|
||||
legPart.addBox(0, -2, -2, 4, 4, 4);
|
||||
legPart.setRotationPoint(-4, 0, 0);
|
||||
nagaPart1.addChild(legPart);
|
||||
@@ -36,9 +38,11 @@ public class ModelNagaLegs extends ModelRenderer{
|
||||
nagaPart1.addChild(legPart);
|
||||
|
||||
nagaPart2 = new ModelRenderer(base,0,0);
|
||||
nagaPart2.setTextureSize(64,32);
|
||||
nagaPart2.childModels = nagaPart1.childModels;
|
||||
|
||||
nagaPart3 = new ModelRenderer(base,0,0);
|
||||
nagaPart3.setTextureSize(64,32);
|
||||
|
||||
ModelPlaneRenderer plane = new ModelPlaneRenderer(base, 4, 24);
|
||||
plane.addBackPlane(0,-2, 0, 4, 4);
|
||||
@@ -89,9 +93,11 @@ public class ModelNagaLegs extends ModelRenderer{
|
||||
nagaPart3.addChild(plane);
|
||||
|
||||
nagaPart4 = new ModelRenderer(base,0,0);
|
||||
nagaPart4.setTextureSize(64,32);
|
||||
nagaPart4.childModels = nagaPart3.childModels;
|
||||
|
||||
nagaPart5 = new ModelRenderer(base,0,0);
|
||||
nagaPart5.setTextureSize(64,32);
|
||||
|
||||
legPart = new ModelRenderer(base,56,20);
|
||||
legPart.addBox(0, 0, -2, 2, 5, 2);
|
||||
|
||||
@@ -14,6 +14,7 @@ public class ModelDragonTail extends ModelRenderer {
|
||||
int y = 16;
|
||||
|
||||
ModelRenderer dragon = new ModelRenderer(base, x, y);
|
||||
dragon.setTextureSize(64,32);
|
||||
dragon.setRotationPoint(0F, 0F, 3F);
|
||||
this.addChild(dragon);
|
||||
|
||||
|
||||
@@ -16,30 +16,35 @@ public class ModelSquirrelTail extends ModelRenderer {
|
||||
textureHeight = 32;
|
||||
|
||||
ModelRenderer Shape1 = new ModelRenderer(base, 0, 0);
|
||||
Shape1.setTextureSize(64,32);
|
||||
Shape1.addBox(-1F, -1F, -1F, 2, 2, 3);
|
||||
Shape1.setRotationPoint(0F, -1F, 3F);
|
||||
setRotation(Shape1, 0F, 0F, 0F);
|
||||
this.addChild(Shape1);
|
||||
|
||||
ModelRenderer Shape2 = new ModelRenderer(base, 0, 9);
|
||||
Shape2.setTextureSize(64,32);
|
||||
Shape2.addBox(-2F, -5F, -1F, 4, 5, 3);
|
||||
Shape2.setRotationPoint(0F, 0F, 1F);
|
||||
setRotation(Shape2, -0.37F, 0F, 0F);
|
||||
Shape1.addChild(Shape2);
|
||||
|
||||
ModelRenderer Shape3 = new ModelRenderer(base, 0, 18);
|
||||
Shape3.setTextureSize(64,32);
|
||||
Shape3.addBox(-2.466667F, -6F, -1F, 5, 7, 3);
|
||||
Shape3.setRotationPoint(0F, -5F, 0F);
|
||||
setRotation(Shape3, 0.3f, 0F, 0F);
|
||||
Shape2.addChild(Shape3);
|
||||
|
||||
ModelRenderer Shape4 = new ModelRenderer(base, 25, 0);
|
||||
Shape4.setTextureSize(64,32);
|
||||
Shape4.addBox(-3F, -0.6F, -1F, 6, 5, 3);
|
||||
Shape4.setRotationPoint(0F, -5F, 1F);
|
||||
setRotation(Shape4, 2.5F, 0F, 0F);
|
||||
Shape3.addChild(Shape4);
|
||||
|
||||
ModelRenderer Shape5 = new ModelRenderer(base, 25, 10);
|
||||
Shape5.setTextureSize(64,32);
|
||||
Shape5.addBox(-3F, -2F, -1F, 6, 3, 5);
|
||||
Shape5.setRotationPoint(0F, 3.5F, 0F);
|
||||
setRotation(Shape5, -2.5F, 0F, 0F);
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package noppes.npcs.client.renderer;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBufferInt;
|
||||
import java.awt.image.ImageObserver;
|
||||
|
||||
import net.minecraft.client.renderer.ImageBufferDownload;
|
||||
|
||||
public class ImageBufferDownload32 extends ImageBufferDownload {
|
||||
private int imageData[];
|
||||
private int imageWidth;
|
||||
private int imageHeight;
|
||||
|
||||
@Override
|
||||
public BufferedImage parseUserSkin(BufferedImage bufferedimage) {
|
||||
|
||||
imageWidth = bufferedimage.getWidth(null);
|
||||
imageHeight = imageWidth/2;
|
||||
|
||||
BufferedImage bufferedimage1 = new BufferedImage(imageWidth, imageHeight, 2);
|
||||
Graphics g = bufferedimage1.getGraphics();
|
||||
g.drawImage(bufferedimage, 0, 0, null);
|
||||
g.dispose();
|
||||
imageData = ((DataBufferInt) bufferedimage1.getRaster().getDataBuffer()).getData();
|
||||
|
||||
setAreaTransparent(imageWidth / 2, 0, imageWidth, imageHeight / 2);
|
||||
|
||||
return bufferedimage1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the given area of the image transparent if it was previously completely opaque (used to remove the outer
|
||||
* layer of a skin around the head if it was saved all opaque; this would be redundant so it's assumed that the skin
|
||||
* maker is just using an image editor without an alpha channel)
|
||||
*/
|
||||
private void setAreaTransparent(int par1, int par2, int par3, int par4) {
|
||||
if (!this.hasTransparency(par1, par2, par3, par4)) {
|
||||
for (int i1 = par1; i1 < par3; ++i1) {
|
||||
for (int j1 = par2; j1 < par4; ++j1) {
|
||||
this.imageData[i1 + j1 * this.imageWidth] &= 16777215;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given area of the image contains transparent pixels
|
||||
*/
|
||||
private boolean hasTransparency(int par1, int par2, int par3, int par4) {
|
||||
for (int i1 = par1; i1 < par3; ++i1) {
|
||||
for (int j1 = par2; j1 < par4; ++j1) {
|
||||
int k1 = this.imageData[i1 + j1 * this.imageWidth];
|
||||
|
||||
if ((k1 >> 24 & 255) < 128) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ public class RenderCustomNpc extends RenderNPCHumanMale{
|
||||
|
||||
// Default Renderer
|
||||
public RenderCustomNpc() {
|
||||
super(new ModelMPM(0, false, false), new ModelMPM(1,false, false), new ModelMPM(0.5f, false, false));
|
||||
super(new ModelMPM(0), new ModelMPM(1), new ModelMPM(0.5f));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,8 +38,8 @@ public class RenderNPCHumanMale extends RenderNPCInterface
|
||||
protected ModelNPCMale modelArmorChestplate;
|
||||
protected ModelNPCMale modelArmor;
|
||||
|
||||
protected final ModelNPCMale OGmodelArmorChestplate = new ModelMPM(1, false, false);
|
||||
protected final ModelNPCMale OGmodelArmor = new ModelMPM(0.5f, false, false);
|
||||
protected final ModelNPCMale OGmodelArmorChestplate = new ModelMPM(1);
|
||||
protected final ModelNPCMale OGmodelArmor = new ModelMPM(0.5f);
|
||||
|
||||
protected final ModelMPM steve = new ModelMPM(0, true, false);
|
||||
protected final ModelMPM steveArmorChestplate = new ModelMPM(1, true, false);
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.boss.BossStatus;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.ImageDownloadAlt;
|
||||
import noppes.npcs.client.ImageDownloadAlt32;
|
||||
import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.constants.EnumStandingType;
|
||||
@@ -289,7 +290,29 @@ public class RenderNPCInterface extends RenderLiving{
|
||||
sb.append(String.format("%02x", b&0xff));
|
||||
}
|
||||
npc.textureLocation = new ResourceLocation("skins/" + sb.toString());
|
||||
|
||||
loadSkin32(null, npc.textureLocation, npc.display.url);
|
||||
|
||||
LastTextureTick = 0;
|
||||
}
|
||||
catch(Exception ex){
|
||||
|
||||
}
|
||||
}
|
||||
// SKIN CHANGE
|
||||
// For 64 x 64 Textures
|
||||
else if(npc.display.skinType == 3){
|
||||
try{
|
||||
MessageDigest digestion = MessageDigest.getInstance("MD5");
|
||||
byte[] hash = digestion.digest(npc.display.url.getBytes("UTF-8"));
|
||||
StringBuilder sb = new StringBuilder(2*hash.length);
|
||||
for(byte b : hash){
|
||||
sb.append(String.format("%02x", b&0xff));
|
||||
}
|
||||
npc.textureLocation = new ResourceLocation("skins/" + sb.toString());
|
||||
|
||||
loadSkin(null, npc.textureLocation, npc.display.url);
|
||||
|
||||
LastTextureTick = 0;
|
||||
}
|
||||
catch(Exception ex){
|
||||
@@ -302,11 +325,18 @@ public class RenderNPCInterface extends RenderLiving{
|
||||
return npc.textureLocation;
|
||||
}
|
||||
|
||||
// True = 64x64 Skin
|
||||
// 64x64 Skin
|
||||
private void loadSkin(File file, ResourceLocation resource, String par1Str){
|
||||
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
|
||||
ITextureObject object = new ImageDownloadAlt(file, par1Str, SkinManager.field_152793_a, new ImageBufferDownloadAlt());
|
||||
texturemanager.loadTexture(resource, object);
|
||||
}
|
||||
|
||||
// SORT OF WORKS
|
||||
private void loadSkin32(File file, ResourceLocation resource, String par1Str){
|
||||
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
|
||||
ITextureObject object = new ImageDownloadAlt32(file, par1Str, SkinManager.field_152793_a, new ImageBufferDownload32());
|
||||
texturemanager.loadTexture(resource, object);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -167,8 +167,6 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
private int taskCount = 1;
|
||||
public int lastInteract = 0;
|
||||
|
||||
public int animationStart = 0;
|
||||
|
||||
public Faction faction; //should only be used server side
|
||||
|
||||
private EntityAIRangedAttack aiRange;
|
||||
|
||||
Reference in new issue
Block a user