Jump to content

josh_iz_beast

Members
  • Posts

    9
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

josh_iz_beast's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. i put a break point on that method and debugged it and when i placed the block the game froze
  2. okay i found out the methods that register the tile entity and bind the tile entity to the render were not being called and now i fixed that but the block is still invisable
  3. i registered the entity and the block with GameRegistry
  4. i'm trying to make a custom rendered block but when i place the block it shows up invisible and i have no idea whats wrong with the code so please help the block class package com.electric.craft.block; import com.electric.craft.MainMod; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockBatteryPack extends BlockContainer { public BlockBatteryPack(Material material) { super(material); } public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) { return false; } public boolean isOpaqueCube() { return false; } public int getRenderType() { return -1; } @Override public TileEntity createNewTileEntity(World var1, int var2) { return new EntityBatteryPack(); } } the tile entity class package com.electric.craft.block; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.Packet; import net.minecraft.tileentity.TileEntity; public class EntityBatteryPack extends TileEntity { public EntityBatteryPack() { } } the render class package com.electric.craft.block; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import com.electric.craft.MainMod; public class RenderBatteryPack extends TileEntitySpecialRenderer { private ModelBatteryPack model; public static final ResourceLocation texture = new ResourceLocation(MainMod.modId, "textures/models/batteryPack.png"); public RenderBatteryPack() { this.model = new ModelBatteryPack(); } public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float scale) { GL11.glPushMatrix(); GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F); GL11.glRotatef(180, 0, 0, 1); this.bindTexture(texture); this.model.renderModel(0.0625F); GL11.glPopMatrix(); } } the model class package com.electric.craft.block; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelBatteryPack extends ModelBase { ModelRenderer base; ModelRenderer side1; ModelRenderer side2; ModelRenderer side3; ModelRenderer side4; ModelRenderer contact1; ModelRenderer contact2; ModelRenderer contact3; ModelRenderer contact4; public ModelBatteryPack() { textureWidth = 64; textureHeight = 32; base = new ModelRenderer(this, 0, 0); base.addBox(0F, 0F, 0F, 6, 1, 14); base.setRotationPoint(-3F, 23F, -7F); base.setTextureSize(64, 32); base.mirror = true; setRotation(base, 0F, 0F, 0F); side1 = new ModelRenderer(this, 4, 15); side1.addBox(0F, 0F, 0F, 6, 3, 1); side1.setRotationPoint(-3F, 20F, -7F); side1.setTextureSize(64, 32); side1.mirror = true; setRotation(side1, 0F, 0F, 0F); side2 = new ModelRenderer(this, 4, 15); side2.addBox(0F, 0F, 0F, 6, 3, 1); side2.setRotationPoint(-3F, 20F, 6F); side2.setTextureSize(64, 32); side2.mirror = true; setRotation(side2, 0F, 0F, 0F); side3 = new ModelRenderer(this, 0, 0); side3.addBox(0F, 0F, 0F, 1, 3, 12); side3.setRotationPoint(-3F, 20F, -6F); side3.setTextureSize(64, 32); side3.mirror = true; setRotation(side3, 0F, 0F, 0F); side4 = new ModelRenderer(this, 0, 0); side4.addBox(0F, 0F, 0F, 1, 3, 12); side4.setRotationPoint(2F, 20F, -6F); side4.setTextureSize(64, 32); side4.mirror = true; setRotation(side4, 0F, 0F, 0F); contact1.mirror = true; contact1 = new ModelRenderer(this, 0, 15); contact1.addBox(0F, 0F, 0F, 1, 2, 1); contact1.setRotationPoint(0.48F, 22F, 6.5F); contact1.setTextureSize(64, 32); contact1.mirror = true; setRotation(contact1, 0F, 0F, 0F); contact1.mirror = false; contact2.mirror = true; contact2 = new ModelRenderer(this, 0, 15); contact2.addBox(0F, 0F, 0F, 1, 2, 1); contact2.setRotationPoint(-1.5F, 22F, 6.5F); contact2.setTextureSize(64, 32); contact2.mirror = true; setRotation(contact2, 0F, 0F, 0F); contact2.mirror = false; contact3.mirror = true; contact3 = new ModelRenderer(this, 0, 15); contact3.addBox(0F, 0F, 0F, 1, 2, 1); contact3.setRotationPoint(0.5F, 22F, -7.5F); contact3.setTextureSize(64, 32); contact3.mirror = true; setRotation(contact3, 0F, 0F, 0F); contact3.mirror = false; contact4.mirror = true; contact4 = new ModelRenderer(this, 0, 15); contact4.addBox(0F, 0F, 0F, 1, 2, 1); contact4.setRotationPoint(-1.5F, 22F, -7.5F); contact4.setTextureSize(64, 32); contact4.mirror = true; setRotation(contact4, 0F, 0F, 0F); contact4.mirror = false; } 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); base.render(f5); side1.render(f5); side2.render(f5); side3.render(f5); side4.render(f5); contact1.render(f5); contact2.render(f5); contact3.render(f5); contact4.render(f5); } public void renderModel(float 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 entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } }
×
×
  • Create New...

Important Information

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