Jump to content

nike4613

Members
  • Posts

    18
  • Joined

  • Last visited

Posts posted by nike4613

  1. I am attempting to change the texture based on whether the graphics mode is. I am reading it with

                @SideOnly(Side.CLIENT)
        public void setGraphicsLevel(boolean fof)
        {
            this.isFancy = fof;
            TPDWSP.logger.log(Level.INFO, "Changed graphics level");
        }

    (the logger works)

    and it is not being triggered. How do I get it to trigger? and how do I change the texture when it does?

     

  2. Hi! :) I am trying to make a leaf block whose color changes with the biome (like vanilla) and cannot quite figure out how.

     

    The block class:

     

    package net.mc42.mods.TPDWSP.blocks;
    
    import net.mc42.mods.LeVCore.LeVBlock;
    import net.mc42.mods.TPDWSP.TPDWSP;
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.creativetab.CreativeTabs;
    
    public class PearwoodLeaves extends LeVBlock {
    
    public PearwoodLeaves(Material p_i45394_1_) {
    	super(p_i45394_1_);
    	// TODO Auto-generated constructor stub
    	setBlockTextureName(TPDWSP.MODID + ":pearwood_leaves");
    	setStepSound(Block.soundTypeGrass);
    	setBlockName("pearwood_leaves"); // changed in 1.7
    	setCreativeTab(CreativeTabs.tabBlock);
    	setSideCount(1);
    	setOpaque(false);
    }
    
    }
    

     

    (LeVBlock has the texture and opaque rendering in it.)

     

    LeVBlock:

     

    package net.mc42.mods.LeVCore;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.util.IIcon;
    
    public class LeVBlock extends Block {
    
    public IIcon[] icons = new IIcon[6];
    private int scount = 1;
    private boolean opq = true;
    
    public LeVBlock(Material p_i45394_1_) {
    	super(p_i45394_1_);
    	// TODO Auto-generated constructor stub
    }
    
    public void setSideCount(int c){
    	scount = c;
    }
    
    public void setOpaque(boolean tf){
    	opq = tf;
    }
    
    public boolean isOpaqueCube(){
    	return opq;
    }
    
    @Override
    public void registerBlockIcons(IIconRegister reg) {
    	if(scount <= 1){
    		for (int i = 0; i < 6; i ++) {
    	    	this.icons[i] = reg.registerIcon(textureName);
    	    }
    	} else if(scount==2){ 
    		for (int i = 0; i < 6; i ++) {
        		if(i<2){
        			this.icons[i] = reg.registerIcon(textureName + "_top");
        		} else {
        			this.icons[i] = reg.registerIcon(textureName + "_side");
        		}
        	}
    	} else if(scount==3){ 
    		for (int i = 0; i < 6; i ++) {
        		if(i==0){
        			this.icons[i] = reg.registerIcon(textureName + "_down");
        		} else if(i==1){
        			this.icons[i] = reg.registerIcon(textureName + "_top");
        		} else {
        			this.icons[i] = reg.registerIcon(textureName + "_side");
        		}
        	}
    	} else {
    		int i = 0;
    		this.icons[i++] = reg.registerIcon(textureName + "_down");
    		this.icons[i++] = reg.registerIcon(textureName + "_top");
    		this.icons[i++] = reg.registerIcon(textureName + "_n");
    		this.icons[i++] = reg.registerIcon(textureName + "_s");
    		this.icons[i++] = reg.registerIcon(textureName + "_w");
    		this.icons[i++] = reg.registerIcon(textureName + "_e");
    	}
    }
    
    @Override
    public IIcon getIcon(int side, int meta) {
        return this.icons[side];
    }
    
    }
    

     

  3. Code:

    public ItemStack onItemRightClick(ItemStack is, World w, EntityPlayer p)

    {

    Minecraft mc = Minecraft.getMinecraft();

     

    MovingObjectPosition target = mc.objectMouseOver;

    double i = mc.renderViewEntity.posX;

    double j = mc.renderViewEntity.posY;

    double k = mc.renderViewEntity.posZ;

    float r = 3;

    if(target != null)

    {

    if(target.entityHit != null)

    {

      target.entityHit.setPosition(i, j, k);

      p.addChatMessage(new ChatComponentText("[Telekinesis->Wand] Found and Teleported Entity").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN)));

      }else p.addChatMessage(new ChatComponentText("[Telekinesis->Wand] Did not find entity").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));

    }

     

    p.addChatMessage(new ChatComponentText("[Telekinesis->Wand] Item Right-Click Successful").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN)));

     

    return is;

    }

     

     

    When I use the item and all text is green, the entity moves, and then "unmoves", moves back to its original location. How do I fix it? And is it a server sync issue?

  4. I'm trying to rotate a tile entity model and it is causing inconsistant results. Any suggestions? Any help is appreciated!

     

    Renderer:

     

    package net.mc42.mods.eclipses.tileentities.EssenceInfuser;
    
    import org.lwjgl.opengl.GL11;
    
    import net.mc42.mods.eclipses.mod_Eclipses;
    import net.minecraft.block.Block;
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.renderer.OpenGlHelper;
    import net.minecraft.client.renderer.Tessellator;
    import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
    import net.minecraft.entity.Entity;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.world.World;
    
    public class TileEntityEssenceInfuserRenderer extends TileEntitySpecialRenderer {
            
            //The model of your block
            private final EssenceInfuserModelBase model;
            
            public TileEntityEssenceInfuserRenderer() {
                    this.model = new EssenceInfuserModelBase();
                   // this.modelContent = new TileEntityJarContentsModel(0);
            }
            
            private void adjustRotatePivotViaMeta(World world, int x, int y, int z) {
                    int meta = world.getBlockMetadata(x, y, z);
                    GL11.glPushMatrix();
                    GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F);
                    GL11.glPopMatrix();
            }
            
            @Override
            public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
            	
            	TileEntityEssenceInfuser tej = (TileEntityEssenceInfuser) te;
            //The PushMatrix tells the renderer to "start" doing something.
                 //The PushMatrix tells the renderer to "start" doing something.
                    GL11.glPushMatrix();
            //This is setting the initial location.
                    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
            //This is the texture of your block. It's pathed to be the same place as your other blocks here.
                    //Outdated bindTextureByName("/mods/roads/textures/blocks/TrafficLightPoleRed.png");
           //Use in 1.6.2  this
                    ResourceLocation textures1 = (new ResourceLocation("modeclipses:textures/blocks/EssenceInfuser/Base.png")); 
                    //textures1 = (new ResourceLocation("modeclipses:textures/blocks/EssenceInfuser/Tank.png")); 
                    //textures1 = (new ResourceLocation("modeclipses:textures/blocks/EssenceInfuser/Backboard.png"));
                    //textures1 = (new ResourceLocation("modeclipses:textures/blocks/EssenceInfuser/Top.png"));
            //the ':' is very important
            //binding the textures
                    Minecraft.getMinecraft().renderEngine.bindTexture(textures1);
    
            //This rotation part is very important! Without it, your model will render upside-down! And for some reason you DO need PushMatrix again!                       
                    GL11.glPushMatrix();
                    
                    //GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                    
                    GL11.glRotatef(180F, tej.orient*1F, 0.0F, 1.0F);
            //A reference to your Model file. Again, very important.
                    //this.modelCap.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
                    this.model.renderBase((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
            //Tell it to stop rendering for both the PushMatrix's
                    GL11.glPopMatrix();
                    textures1 = (new ResourceLocation("modeclipses:textures/blocks/EssenceInfuser/Tank.png")); 
                    //textures1 = (new ResourceLocation("modeclipses:textures/blocks/EssenceInfuser/Tank.png")); 
                    //textures1 = (new ResourceLocation("modeclipses:textures/blocks/EssenceInfuser/Backboard.png"));
                    //textures1 = (new ResourceLocation("modeclipses:textures/blocks/EssenceInfuser/Top.png"));
            //the ':' is very important
            //binding the textures
                    Minecraft.getMinecraft().renderEngine.bindTexture(textures1);
    
            //This rotation part is very important! Without it, your model will render upside-down! And for some reason you DO need PushMatrix again!                       
                    GL11.glPushMatrix();
                    GL11.glDisable(GL11.GL_CULL_FACE);
                    
                    //GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                    
                    GL11.glRotatef(180F, tej.orient*1F, 0.0F, 1.0F);
            //A reference to your Model file. Again, very important.
                    //this.modelCap.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
                    this.model.renderTank((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
            //Tell it to stop rendering for both the PushMatrix's
                    GL11.glEnable(GL11.GL_CULL_FACE);
                    GL11.glPopMatrix();
                    textures1 = (new ResourceLocation("modeclipses:textures/blocks/EssenceInfuser/Backboard.png")); 
                    //textures1 = (new ResourceLocation("modeclipses:textures/blocks/EssenceInfuser/Tank.png")); 
                    //textures1 = (new ResourceLocation("modeclipses:textures/blocks/EssenceInfuser/Backboard.png"));
                    //textures1 = (new ResourceLocation("modeclipses:textures/blocks/EssenceInfuser/Top.png"));
            //the ':' is very important
            //binding the textures
                    Minecraft.getMinecraft().renderEngine.bindTexture(textures1);
    
            //This rotation part is very important! Without it, your model will render upside-down! And for some reason you DO need PushMatrix again!                       
                    GL11.glPushMatrix();
                    
                    //GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                    
                    GL11.glRotatef(180F, tej.orient*1F, 0.0F, 1.0F);        //A reference to your Model file. Again, very important.
                    //this.modelCap.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
                    this.model.renderBackboard((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
            //Tell it to stop rendering for both the PushMatrix's
                    GL11.glPopMatrix();
                    textures1 = (new ResourceLocation("modeclipses:textures/blocks/EssenceInfuser/Top.png")); 
                    //textures1 = (new ResourceLocation("modeclipses:textures/blocks/EssenceInfuser/Tank.png")); 
                    //textures1 = (new ResourceLocation("modeclipses:textures/blocks/EssenceInfuser/Backboard.png"));
                    //textures1 = (new ResourceLocation("modeclipses:textures/blocks/EssenceInfuser/Top.png"));
            //the ':' is very important
            //binding the textures
                    Minecraft.getMinecraft().renderEngine.bindTexture(textures1);
    
            //This rotation part is very important! Without it, your model will render upside-down! And for some reason you DO need PushMatrix again!                       
                    GL11.glPushMatrix();
                    
                    //GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                    
                    GL11.glRotatef(180F, tej.orient*1F, 0.0F, 1.0F);
            //A reference to your Model file. Again, very important.
                    //this.modelCap.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
                    this.model.renderTop((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
            //Tell it to stop rendering for both the PushMatrix's
                    GL11.glPopMatrix();
                    GL11.glPopMatrix();
            }
    
            //Set the lighting stuff, so it changes it's brightness properly.       
            private void adjustLightFixture(World world, int i, int j, int k, Block block) {
                    Tessellator tess = Tessellator.instance;
                    //float brightness = block.getBlockBrightness(world, i, j, k);
                    //As of MC 1.7+ block.getBlockBrightness() has become block.getLightValue():
                    float brightness = block.getLightValue(world, i, j, k);
                    int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
                    int modulousModifier = skyLight % 65536;
                    int divModifier = skyLight / 65536;
                    tess.setColorOpaque_F(brightness, brightness, brightness);
                    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit,  (float) modulousModifier,  divModifier);
            }
    }

     

     

    Model:

     

    // Date: 9/7/2014 8:03:14 PM
    // Template version 1.1
    // Java generated by Techne
    // Keep in mind that you still need to fill in some blanks
    // - ZeuX
    
    
    
    
    
    
    package net.mc42.mods.eclipses.tileentities.EssenceInfuser;
    
    import net.minecraft.client.model.ModelBase;
    import net.minecraft.client.model.ModelRenderer;
    import net.minecraft.entity.Entity;
    
    public class EssenceInfuserModelBase extends ModelBase
    {
      //fields
        ModelRenderer Base;
        ModelRenderer Tank;
        ModelRenderer Backboard;
        ModelRenderer Top;
      
      public EssenceInfuserModelBase()
      {
        textureWidth = 64;
        textureHeight = 32;
        
          Base = new ModelRenderer(this, 0, 0);
          Base.addBox(0F, 0F, 0F, 14, 14, 14);
          Base.setRotationPoint(-6F, 10F, -7F);
          Base.setTextureSize(64, 32);
          Base.mirror = true;
          setRotation(Base, 0.0174533F, 0F, 0F);
          Tank = new ModelRenderer(this, 0, 0);
          Tank.addBox(0F, 0F, 0F, 8, 14, ;
          Tank.setRotationPoint(-1F, -4F, -4.25F);
          Tank.setTextureSize(64, 32);
          Tank.mirror = true;
          setRotation(Tank, 0.0174533F, 0F, 0F);
          Backboard = new ModelRenderer(this, 0, 0);
          Backboard.addBox(0F, 0F, 0F, 2, 14, 10);
          Backboard.setRotationPoint(6F, -4F, -5.25F);
          Backboard.setTextureSize(64, 32);
          Backboard.mirror = true;
          setRotation(Backboard, 0.0174533F, 0F, 0F);
          Top = new ModelRenderer(this, 0, 0);
          Top.addBox(0F, 0F, 0F, 10, 2, 10);
          Top.setRotationPoint(-2F, -5F, -5.25F);
          Top.setTextureSize(64, 32);
          Top.mirror = true;
          setRotation(Top, 0F, 0F, 0F);
      }
      
      public void renderBase(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
      {
        super.render(entity, f, f1, f2, f3, f4, f5);
        setRotationAngles(f, f1, f2, f3, f4, f5, entity);
        Base.render(f5);
        //Tank.render(f5);
        //Backboard.render(f5);
        //Top.render(f5);
      }
      public void renderTank(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
      {
        super.render(entity, f, f1, f2, f3, f4, f5);
        setRotationAngles(f, f1, f2, f3, f4, f5, entity);
        //Base.render(f5);
        Tank.render(f5);
        //Backboard.render(f5);
        //Top.render(f5);
      }
      public void renderBackboard(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
      {
        super.render(entity, f, f1, f2, f3, f4, f5);
        setRotationAngles(f, f1, f2, f3, f4, f5, entity);
        //Base.render(f5);
        //Tank.render(f5);
        Backboard.render(f5);
        //Top.render(f5);
      }
      public void renderTop(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
      {
        super.render(entity, f, f1, f2, f3, f4, f5);
        setRotationAngles(f, f1, f2, f3, f4, f5, entity);
        //Base.render(f5);
        //Tank.render(f5);
        //Backboard.render(f5);
        Top.render(f5);
      }
      
      private void setRotation(ModelRenderer model, float x, float y, float z)
      {
        model.rotateAngleX = x;
        model.rotateAngleY = y;
        model.rotateAngleZ = z;
      }
      
      public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity e)
      {
        super.setRotationAngles(f, f1, f2, f3, f4, f5, e);
      }
    
    }
    

     

     

    post3.png

  5. I need a tile entity to update every tick or so. I found a page that talks about the updateTick function, but it isnt working for me. I have a System.out.println function that isnt happening. Any help is appreciated! ;D

     

    Code:

    private long tickCounter;
    public void updateTick(World world, int x, int y, int z, Random par5Random) {
    	if(tickCounter%mod_Eclipses.JarTickSpeed == 0){
    		long wt = world.getWorldTime();
    
    		System.out.println(wt);
    
    		if(wt > 0 && wt < 12000){
    			setFluid(liquid1);
    		}else if(wt > 12000 && wt < 24000){
    			setFluid(liquid2);
    		}
    	}
    	tickCounter++;
    }
    

  6. I have a tile entity that updates on right-click with certain items. Whenever I relog, the contents of the jar I'm making is deleted. Any help is appreciated! ;D

     

    Code:

     

     

    TileEntityJar.java:

    package net.mc42.mods.eclipses.tileentities;
    
    import net.mc42.mods.eclipses.mod_Eclipses;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.world.World;
    import net.minecraftforge.fluids.Fluid;
    import net.minecraftforge.fluids.FluidRegistry;
    import net.minecraftforge.fluids.FluidStack;
    
    public class TileEntityJar extends TileEntity {
    
    private FluidStack contents;
    private int amRst;
    //private int capacity;
    
    public TileEntityJar(){
    	contents = new FluidStack(0, 0);
    	amRst = 0;
    	//setFluid(mod_Eclipses.lunarEssence);
    	//setAmount(2100);
    }
    
    public void setFluid(Fluid f){
    	contents = new FluidStack(f, amRst);
    }
    
    public void setAmount(int i){
    	contents.amount = i;
    	this.amRst = i;
    }
    
    public boolean remove(int mb){
    	if(contents.amount >= mb){
    		contents.amount -= mb;
    		amRst = contents.amount;
    		if(contents.amount == 0)
    			contents = new FluidStack(0, 0);
    		return true;
    	}
    	return false;
    }
    
    public boolean add(int mb){
    	if(!(contents.amount + mb > mod_Eclipses.JarCapacity)){
    		contents.amount += mb;
    		if(contents.amount == 0)
    			contents = new FluidStack(0, 0);
    		amRst = contents.amount;
    		return true;
    	}
    	return false;
    }
    
    public int getPercentFull(){
    
    	//System.out.println((contents.amount/(float)mod_Eclipses.JarCapacity)*(float)100);
    	return Math.round((contents.amount/(float)mod_Eclipses.JarCapacity)*(float)100);
    }
    
    public boolean hasFluid(Fluid f) {
    	// TODO Auto-generated method stub
    	return contents.isFluidEqual(new FluidStack(f, 0));
    }
    
    @Override
    public void writeToNBT(NBTTagCompound par1)
    {
       super.writeToNBT(par1);
       NBTTagCompound par2 = new NBTTagCompound();
       par2.setInteger("Amount", contents.amount);
       par2.setInteger("FluID", contents.fluidID);
       System.out.println("Saving... " + contents.amount + " " + contents.fluidID);
       //par2 = contents.writeToNBT(par2);
       par1.setTag("Content", par2);
    }
    
    @Override
    public void readFromNBT(NBTTagCompound par1)
    {
       super.readFromNBT(par1);
       //this.contents.loadFluidStackFromNBT((NBTTagCompound) par1.getTag("Content"));
       NBTTagCompound par2 = new NBTTagCompound();
       par2 = (NBTTagCompound) par1.getTag("Content");
       int amo = par2.getInteger("Amount");
       int id = par2.getInteger("FluID");
       System.out.println("Loaded " + amo + " " + id);
       contents = new FluidStack(id, amo);
       amRst = contents.amount;
    }
    }
    

     

     

  7. I am making a jar, and I have a good 3d model for it, but some of the faces aren't rendering throuch other faces.

     

    Srceenshots:

     

     

     

    Code:

     

    Renderer:

    package net.mc42.mods.eclipses.tileentities;
    
    import org.lwjgl.opengl.GL11;
    
    import net.minecraft.block.Block;
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.renderer.OpenGlHelper;
    import net.minecraft.client.renderer.Tessellator;
    import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
    import net.minecraft.entity.Entity;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.world.World;
    
    public class TileEntityJarRenderer extends TileEntitySpecialRenderer {
            
            //The model of your block
            private final TileEntityJarCapModel modelCap;
            private final TileEntityJarBodyModel modelBody;
            private final TileEntityJarContentsModel modelContent;
            
            public TileEntityJarRenderer() {
                    this.modelCap = new TileEntityJarCapModel();
                    this.modelBody = new TileEntityJarBodyModel();
                    this.modelContent = new TileEntityJarContentsModel();
            }
            
            private void adjustRotatePivotViaMeta(World world, int x, int y, int z) {
                    int meta = world.getBlockMetadata(x, y, z);
                    GL11.glPushMatrix();
                    GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F);
                    GL11.glPopMatrix();
            }
            
            @Override
            public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
            //The PushMatrix tells the renderer to "start" doing something.
                    GL11.glPushMatrix();
            //This is setting the initial location.
                    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
            //This is the texture of your block. It's pathed to be the same place as your other blocks here.
                    //Outdated bindTextureByName("/mods/roads/textures/blocks/TrafficLightPoleRed.png");
           //Use in 1.6.2  this
                    ResourceLocation textures = (new ResourceLocation("modeclipses:textures/blocks/TileEntityCapJar.png")); 
            //the ':' is very important
            //binding the textures
                    Minecraft.getMinecraft().renderEngine.bindTexture(textures);
    
            //This rotation part is very important! Without it, your model will render upside-down! And for some reason you DO need PushMatrix again!                       
                    GL11.glPushMatrix();
                    
                    GL11.glEnable(GL11.GL_BLEND);
                    
                    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
            //A reference to your Model file. Again, very important.
                    this.modelCap.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
                    //this.modelBody.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
            //Tell it to stop rendering for both the PushMatrix's
                    GL11.glDisable(GL11.GL_BLEND);
                    
                    GL11.glPopMatrix();
                    GL11.glPopMatrix();
                    
                    GL11.glPushMatrix();
                    //This is setting the initial location.
                    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
                    //This is the texture of your block. It's pathed to be the same place as your other blocks here.
                            //Outdated bindTextureByName("/mods/roads/textures/blocks/TrafficLightPoleRed.png");
                   //Use in 1.6.2  this
                    ResourceLocation textures2 = (new ResourceLocation("modeclipses:textures/blocks/solar_essence_still.png")); 
                    //the ':' is very important
                    //binding the textures
                    Minecraft.getMinecraft().renderEngine.bindTexture(textures2);
    
                    //This rotation part is very important! Without it, your model will render upside-down! And for some reason you DO need PushMatrix again!                       
                    GL11.glPushMatrix();
                            
                            //GL11.glEnable(GL11.GL_BLEND);
                            //GL11.glDisable(GL11.GL_CULL_FACE);
                            
                    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
                    //A reference to your Model file. Again, very important.
                            //this.modelCap.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
                            this.modelContent.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
                    //Tell it to stop rendering for both the PushMatrix's
                            //GL11.glEnable(GL11.GL_CULL_FACE);
                            //GL11.glDisable(GL11.GL_BLEND);
                            
                    GL11.glPopMatrix();
                    GL11.glPopMatrix();
                    
                 //The PushMatrix tells the renderer to "start" doing something.
                    GL11.glPushMatrix();
            //This is setting the initial location.
                    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
            //This is the texture of your block. It's pathed to be the same place as your other blocks here.
                    //Outdated bindTextureByName("/mods/roads/textures/blocks/TrafficLightPoleRed.png");
           //Use in 1.6.2  this
                    ResourceLocation textures1 = (new ResourceLocation("modeclipses:textures/blocks/TileEntityBodyJar.png")); 
            //the ':' is very important
            //binding the textures
                    Minecraft.getMinecraft().renderEngine.bindTexture(textures1);
    
            //This rotation part is very important! Without it, your model will render upside-down! And for some reason you DO need PushMatrix again!                       
                    GL11.glPushMatrix();
                    
                    GL11.glEnable(GL11.GL_BLEND);
                    GL11.glDisable(GL11.GL_CULL_FACE);
                    
                    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
            //A reference to your Model file. Again, very important.
                    //this.modelCap.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
                    this.modelBody.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
            //Tell it to stop rendering for both the PushMatrix's
                    GL11.glEnable(GL11.GL_CULL_FACE);
                    GL11.glDisable(GL11.GL_BLEND);
                    
                    GL11.glPopMatrix();
                    GL11.glPopMatrix();
            }
    
            //Set the lighting stuff, so it changes it's brightness properly.       
            private void adjustLightFixture(World world, int i, int j, int k, Block block) {
                    Tessellator tess = Tessellator.instance;
                    //float brightness = block.getBlockBrightness(world, i, j, k);
                    //As of MC 1.7+ block.getBlockBrightness() has become block.getLightValue():
                    float brightness = block.getLightValue(world, i, j, k);
                    int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
                    int modulousModifier = skyLight % 65536;
                    int divModifier = skyLight / 65536;
                    tess.setColorOpaque_F(brightness, brightness, brightness);
                    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit,  (float) modulousModifier,  divModifier);
            }
    }

    Model Cap:

    // Date: 9/5/2014 8:20:37 PM
    // Template version 1.1
    // Java generated by Techne
    // Keep in mind that you still need to fill in some blanks
    // - ZeuX
    
    
    
    
    
    
    package net.mc42.mods.eclipses.tileentities;
    
    import net.minecraft.client.model.ModelBase;
    import net.minecraft.client.model.ModelRenderer;
    import net.minecraft.entity.Entity;
    
    public class TileEntityJarCapModel extends ModelBase
    {
      //fields
        ModelRenderer Shape1;
        ModelRenderer Shape2;
      
      public TileEntityJarCapModel()
      {
      textureWidth = 64;
      textureHeight = 32;
      
        
          /*Shape1 = new ModelRenderer(this, 0, 0);
          Shape1.addBox(0F, 0F, 0F, 12, 14, 12);
          Shape1.setRotationPoint(-6F, 10F, -6F);
          Shape1.setTextureSize(64, 32);
          Shape1.mirror = true;
          setRotation(Shape1, 0F, 0F, 0F);*/
          Shape2 = new ModelRenderer(this, 0, 0);
          Shape2.addBox(0F, 0F, 0F, 10, 2, 10);
          Shape2.setRotationPoint(-5F, 8F, -5F);
          Shape2.setTextureSize(64, 32);
          Shape2.mirror = true;
          setRotation(Shape2, 0F, 0F, 0F);
      }
      
      public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
      {
        super.render(entity, f, f1, f2, f3, f4, f5);
        setRotationAngles(f, f1, f2, f3, f4, f5, entity);
        //Shape1.render(f5);
        Shape2.render(f5);
      }
      
      private void setRotation(ModelRenderer model, float x, float y, float z)
      {
        model.rotateAngleX = x;
        model.rotateAngleY = y;
        model.rotateAngleZ = z;
      }
      
      public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
      {
        super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
      }
    
    }
    

    Model Body:

    // Date: 9/5/2014 8:20:37 PM
    // Template version 1.1
    // Java generated by Techne
    // Keep in mind that you still need to fill in some blanks
    // - ZeuX
    
    
    
    
    
    
    package net.mc42.mods.eclipses.tileentities;
    
    import net.minecraft.client.model.ModelBase;
    import net.minecraft.client.model.ModelRenderer;
    import net.minecraft.entity.Entity;
    
    public class TileEntityJarBodyModel extends ModelBase
    {
      //fields
        ModelRenderer Shape1;
        ModelRenderer Shape2;
      
      public TileEntityJarBodyModel()
      {
      textureWidth = 64;
      textureHeight = 32;
      
        
          Shape1 = new ModelRenderer(this, 0, 0);
          Shape1.addBox(0F, 0F, 0F, 12, 14, 12);
          Shape1.setRotationPoint(-6F, 10F, -6F);
          Shape1.setTextureSize(64, 32);
          Shape1.mirror = true;
          setRotation(Shape1, 0F, 0F, 0F);
          /*Shape2 = new ModelRenderer(this, 0, 0);
          Shape2.addBox(0F, 0F, 0F, 10, 2, 10);
          Shape2.setRotationPoint(-5F, 8F, -5F);
          Shape2.setTextureSize(64, 32);
          Shape2.mirror = true;
          setRotation(Shape2, 0F, 0F, 0F);*/
      }
      
      public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
      {
        super.render(entity, f, f1, f2, f3, f4, f5);
        setRotationAngles(f, f1, f2, f3, f4, f5, entity);
        Shape1.render(f5);
        //Shape2.render(f5);
      }
      
      private void setRotation(ModelRenderer model, float x, float y, float z)
      {
        model.rotateAngleX = x;
        model.rotateAngleY = y;
        model.rotateAngleZ = z;
      }
      
      public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
      {
        super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
      }
    
    }
    

     

    Model Contents:

    // Date: 9/5/2014 8:20:37 PM
    // Template version 1.1
    // Java generated by Techne
    // Keep in mind that you still need to fill in some blanks
    // - ZeuX
    
    
    
    
    
    
    package net.mc42.mods.eclipses.tileentities;
    
    import net.minecraft.client.model.ModelBase;
    import net.minecraft.client.model.ModelRenderer;
    import net.minecraft.entity.Entity;
    
    public class TileEntityJarContentsModel extends ModelBase
    {
      //fields
        ModelRenderer Shape1;
        ModelRenderer Shape2;
      
      public TileEntityJarContentsModel()
      {
      textureWidth = 16;
      textureHeight = 16;
      
        
          Shape1 = new ModelRenderer(this, 0, 0);
          Shape1.addBox(0F, 0F, 0F, 10, /*12*/0, 10);
          Shape1.setRotationPoint(-5F, /*11F*/23F, -5F);
          Shape1.setTextureSize(16, 16);
          Shape1.mirror = false;
          setRotation(Shape1, 0F, 0F, 0F);
          /*Shape2 = new ModelRenderer(this, 0, 0);
          Shape2.addBox(0F, 0F, 0F, 10, 2, 10);
          Shape2.setRotationPoint(-5F, 8F, -5F);
          Shape2.setTextureSize(16, 16);
          Shape2.mirror = false;
          setRotation(Shape2, 0F, 0F, 0F);*/
      }
      
      public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
      {
        super.render(entity, f, f1, f2, f3, f4, f5);
        setRotationAngles(f, f1, f2, f3, f4, f5, entity);
        Shape1.render(f5);
        //Shape2.render(f5);
      }
      
      private void setRotation(ModelRenderer model, float x, float y, float z)
      {
        model.rotateAngleX = x;
        model.rotateAngleY = y;
        model.rotateAngleZ = z;
      }
      
      public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
      {
        super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
      }
    
    }
    

     

    Image Files:

     

    TileEntityBodyJar.png

    TileEntityCapJar.png

     

     

     

    Any help is very appreciated!  ;D

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.