Jump to content

How can I change things in the render things from my model in the TileEntity


tattyseal

Recommended Posts

Model Code

 

 

package codedmodding.mods.electricraft.power.wire;

 

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.model.ModelRenderer;

import net.minecraft.entity.Entity;

 

public class ModelWire extends ModelBase

{

  //fields

    ModelRenderer Down;

    ModelRenderer Out1;

    ModelRenderer Up;

    ModelRenderer Centre;

    ModelRenderer Out2;

    ModelRenderer Out3;

    ModelRenderer Out4;

 

  public ModelWire()

  {

    textureWidth = 64;

    textureHeight = 32;

   

      Down = new ModelRenderer(this, 0, 0);

      Down.addBox(0F, 0F, 0F, 2, 7, 2);

      Down.setRotationPoint(-1F, 17F, -1F);

      Down.setTextureSize(64, 32);

      Down.mirror = true;

      setRotation(Down, 0F, 0F, 0F);

      Out1 = new ModelRenderer(this, 0, 0);

      Out1.addBox(0F, 0F, 0F, 9, 2, 2);

      Out1.setRotationPoint(-1F, 17F, -1F);

      Out1.setTextureSize(64, 32);

      Out1.mirror = true;

      setRotation(Out1, 0F, 0F, 0F);

      Up = new ModelRenderer(this, 0, 0);

      Up.addBox(0F, 0F, 0F, 2, 7, 2);

      Up.setRotationPoint(-1F, 10F, -1F);

      Up.setTextureSize(64, 32);

      Up.mirror = true;

      setRotation(Up, 0F, 0F, 0F);

      Centre = new ModelRenderer(this, 0, 0);

      Centre.addBox(0F, 0F, 0F, 2, 2, 2);

      Centre.setRotationPoint(-1F, 17F, -1F);

      Centre.setTextureSize(64, 32);

      Centre.mirror = true;

      setRotation(Centre, 0F, 0F, 0F);

      Out2 = new ModelRenderer(this, 0, 0);

      Out2.addBox(0F, 0F, 0F, 2, 2, 9);

      Out2.setRotationPoint(-1F, 17F, -1F);

      Out2.setTextureSize(64, 32);

      Out2.mirror = true;

      setRotation(Out2, 0F, 0F, 0F);

      Out3 = new ModelRenderer(this, 0, 0);

      Out3.addBox(0F, 0F, 0F, 9, 2, 2);

      Out3.setRotationPoint(-8F, 17F, -1F);

      Out3.setTextureSize(64, 32);

      Out3.mirror = true;

      setRotation(Out3, 0F, 0F, 0F);

      Out4 = new ModelRenderer(this, 0, 0);

      Out4.addBox(0F, 0F, 0F, 2, 2, 9);

      Out4.setRotationPoint(-1F, 17F, -8F);

      Out4.setTextureSize(64, 32);

      Out4.mirror = true;

      setRotation(Out4, 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);

    renderCenter(f5);

  }

 

  public void renderDown(float f)

  {

  Down.render(f);

  }

 

  public void renderUp(float f)

  {

  Up.render(f);

  }

 

  public void renderCenter(float f)

  {

  Centre.render(f);

  }

 

  public void renderOut1(float f)

  {

  Out1.render(f);

  }

  public void renderOut2(float f)

  {

  Out2.render(f);

  }

  public void renderOut3(float f)

  {

  Out3.render(f);

  }

  public void renderOut4(float f)

  {

  Out4.render(f);

  }

 

  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 ent)

  {

    super.setRotationAngles(f, f1, f2, f3, f4, f5, ent);

  }

 

}

 

 

 

 

TileSpecialRender

 

 

package codedmodding.mods.electricraft.power.wire.copper;

 

import net.minecraft.block.Block;

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;

 

import org.lwjgl.opengl.GL11;

 

import codedmodding.mods.electricraft.power.wire.ModelWire;

 

public class RenderCopperWire extends TileEntitySpecialRenderer {

       

        //The model of your block

        private final ModelWire model;

        private String tex;

       

        public RenderCopperWire(String str)

        {

                this.model = new ModelWire();

                tex = str;

        }

       

        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

        bindTexture(new ResourceLocation(tex));

        //the ':' is very important

 

        //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.glRotatef(180F, 0.0F, 0.0F, 1.0F);

        //A reference to your Model file. Again, very important.

                this.model.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.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);

                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);

        }

}

 

 

 

Block

 

 

package codedmodding.mods.electricraft.power.wire.copper;

 

import net.minecraft.block.BlockContainer;

import net.minecraft.block.material.Material;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.world.World;

 

public class CopperWire extends BlockContainer

{

public CopperWire(int id)

{

super(id, Material.cloth);

}

 

@Override

public TileEntity createNewTileEntity(World w)

{

return new TileCopperWire();

}

 

public boolean renderAsNormalBlock()

{

return false;

}

 

public int getRenderType()

{

return -1;

}

 

public boolean isOpaqueCube()

{

return false;

}

 

}

 

 

 

 

TileEntity

 

 

package codedmodding.mods.electricraft.power.wire.copper;

 

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.tileentity.TileEntity;

 

public class TileCopperWire extends TileEntity

{

public TileCopperWire()

{

 

}

 

public void writeToNBT(NBTTagCompound t)

{

 

}

 

public void readFromNBT(NBTTagCompound t)

{

 

}

 

public void updateEntity()

{

 

}

}

 

 

 

 

Anyone know?

Link to comment
Share on other sites

Question is too vague.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • There's a scheme I got into where they promised to trade Bitcoin for me and take a cut as a commission. Seemed like a good idea at the time. But then, things went south real fast. They ended up transferring   $190,000 worth of my Bitcoin. I was devastated and felt completely helpless. That's when I stumbled upon the Wizard Web Recovery Tool. It was like a beacon of hope amid chaos. With this tool, I could finally start digging into what went wrong and hopefully get my Bitcoin back. Using Wizard Web was surprisingly easy. I just had to plug in some details about my Bitcoin account and let it do its thing. It started scanning the internet, looking for any clues about what happened to my Bitcoin. It felt like having a detective on my side, searching for answers. And guess what? Wizard Web found some leads. It uncovered evidence of the scheme's shady dealings and helped me track down the people responsible for losing my Bitcoin. Armed with this information, I took the case to court. After a long and hard-fought legal battle, the court ruled in my favor. The perpetrators were held accountable for their actions and faced criminal charges for their involvement in the scheme. It was a victory not just for me, but for anyone who's been taken advantage of by these kinds of scams. Thanks to Wizard Web Recovery, I was able to get justice and reclaim what was rightfully mine. It showed me that even in the face of adversity, there's always a way to fight back. And with the right tools and determination, anything is possible.   The following is the contact information for Wizard Web Recovery.   Email: wizard web recovery((@))programmer . net
    • Hello, good morning. I know some programming and I'm interested in mod creation. That's why I've decided to follow a tutorial guide on YouTube by TurtyWurty. https://www.youtube.com/watch?v=DhoX9cmAZqA&t=160s&ab_channel=TurtyWurty I've followed the tutorial perfectly. The problem is that when checking the food, the texture doesn't load for me. However, everything seems fine no matter how much I check. I'm sure it's something trivial, the problem is that I can't find it. Could you help me solve it, please? I leave a zip of my file so you can edit it freely. forge-1.20-Civicraft.rar
    • If you have nvidia graphics, it's important that you make sure Minecraft (and anything Minecraft-related) is set to prefer high performance graphics first. If you only update your AMD drivers it might fix the issue but cause severe performance loss vs Vanilla as it'll be running on the integrated graphics instead of dedicated nvidia graphics
    • Update your drivers: https://www.amd.com/en/support/downloads/drivers.html/processors/ryzen/ryzen-5000-series/amd-ryzen-5-5600g.html
  • Topics

×
×
  • Create New...

Important Information

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