Jump to content

Recommended Posts

Posted

ok so ive got a rough idea how to do it but am in on the right track and how do i finish it?

 

Code

 

 

public class blockAsphalt extends Block

{

private Icon[][] iconBuffer;

 

public blockAsphalt(int ID, Material material)

{

super(ID, material); //The ID and material

}

 

public int damageDropped(int i) //Tells it what block it drops and also for creative mode pick block

{

return i;

}

 

@SideOnly(Side.CLIENT)

public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) //Adds the metadata blocks to the creative inventory

{

for (int var4 = 0; var4 < 9; ++var4)

{

par3List.add(new ItemStack(par1, 1, var4));

}

}

 

@Override

public void func_94332_a(IconRegister par1IconRegister)

{

iconBuffer = new Icon[9][6];

 

iconBuffer[0][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[0][1] = par1IconRegister.func_94245_a("Class3:Asphalt"); // top

        iconBuffer[0][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[0][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[0][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[0][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[1][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[1][1] = par1IconRegister.func_94245_a("Class3:YellowLine1"); // top

        iconBuffer[1][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[1][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[1][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[1][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[2][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[2][1] = par1IconRegister.func_94245_a("Class3:YellowLine2"); // top

        iconBuffer[2][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[2][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[2][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[2][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[3][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[3][1] = par1IconRegister.func_94245_a("Class3:WhiteCorner1"); // top

        iconBuffer[3][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[3][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[3][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[3][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[4][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[4][1] = par1IconRegister.func_94245_a("Class3:WhiteCorner2"); // top

        iconBuffer[4][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[4][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[4][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[4][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[5][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[5][1] = par1IconRegister.func_94245_a("Class3:WhiteCorner3"); // top

        iconBuffer[5][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[5][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[5][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[5][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[6][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[6][1] = par1IconRegister.func_94245_a("Class3:WhiteCorner4"); // top

        iconBuffer[6][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[6][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[6][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[6][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[7][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[7][1] = par1IconRegister.func_94245_a("Class3:WhiteLine1"); // top

        iconBuffer[7][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[7][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[7][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[7][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[8][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[8][1] = par1IconRegister.func_94245_a("Class3:WhiteLine2"); // top

        iconBuffer[8][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[8][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[8][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[8][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

}

}

 

Posted

Well that depends what you mean when you say "finish it" dude.

 

Displaying the texture by it's value (damage/meta) is done using "getBlockTextureFromSideAndMetadata" and returning an Icon from the array you created such as

 

return Icons[meta][side];	

Posted

world.setBlockMetadataWithNotify(x, y, z, VALUE, TYPE);

 

I've just answered a question on this, it's on the front page in this forum dude so look into it for what the "TYPE" is and the value is the new meta data value, if it's the same as the old one it won't do anything (notify systems).

Posted

ok so i added in whats hilighted with red but theres 2 erros on the meta and side, help?

 

 

 

public class blockAsphalt extends Block

{

private Icon[][] iconBuffer;

 

public blockAsphalt(int ID, Material material)

{

super(ID, material); //The ID and material

}

 

public int damageDropped(int i) //Tells it what block it drops and also for creative mode pick block

{

return i;

}

 

@SideOnly(Side.CLIENT)

public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) //Adds the metadata blocks to the creative inventory

{

for (int var4 = 0; var4 < 9; ++var4)

{

par3List.add(new ItemStack(par1, 1, var4));

}

}

 

@Override

public void func_94332_a(IconRegister par1IconRegister)

{

iconBuffer = new Icon[9][6];

 

iconBuffer[0][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[0][1] = par1IconRegister.func_94245_a("Class3:Asphalt"); // top

        iconBuffer[0][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[0][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[0][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[0][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[1][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[1][1] = par1IconRegister.func_94245_a("Class3:YellowLine1"); // top

        iconBuffer[1][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[1][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[1][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[1][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[2][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[2][1] = par1IconRegister.func_94245_a("Class3:YellowLine2"); // top

        iconBuffer[2][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[2][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[2][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[2][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[3][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[3][1] = par1IconRegister.func_94245_a("Class3:WhiteCorner1"); // top

        iconBuffer[3][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[3][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[3][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[3][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[4][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[4][1] = par1IconRegister.func_94245_a("Class3:WhiteCorner2"); // top

        iconBuffer[4][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[4][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[4][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[4][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[5][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[5][1] = par1IconRegister.func_94245_a("Class3:WhiteCorner3"); // top

        iconBuffer[5][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[5][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[5][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[5][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[6][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[6][1] = par1IconRegister.func_94245_a("Class3:WhiteCorner4"); // top

        iconBuffer[6][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[6][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[6][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[6][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[7][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[7][1] = par1IconRegister.func_94245_a("Class3:WhiteLine1"); // top

        iconBuffer[7][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[7][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[7][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[7][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[8][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[8][1] = par1IconRegister.func_94245_a("Class3:WhiteLine2"); // top

        iconBuffer[8][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[8][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[8][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[8][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

}

 

public Icon getBlockfromsideandmetadata()

{

return iconBuffer[meta][side];

}

}

 

Posted

ok you dont have to be a dick about it. so now i crash when i click on my block tab:

 

 

2013-03-21 14:12:47 [iNFO] [Minecraft-Server] Player702[/127.0.0.1:0] logged in with entity id 79 at (340.37729664954117, 66.86512829970259, -184.50583606079942)

2013-03-21 14:12:53 [iNFO] [sTDERR] net.minecraft.util.ReportedException: Rendering screen

2013-03-21 14:12:53 [iNFO] [sTDERR] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1030)

2013-03-21 14:12:53 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:866)

2013-03-21 14:12:53 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:755)

2013-03-21 14:12:53 [iNFO] [sTDERR] at java.lang.Thread.run(Unknown Source)

2013-03-21 14:12:53 [iNFO] [sTDERR] Caused by: java.lang.ArrayIndexOutOfBoundsException: 6

2013-03-21 14:12:53 [iNFO] [sTDERR] at herz.class3.block.blockAsphalt.getBlockTextureFromSideAndMetadata(blockAsphalt.java:111)

2013-03-21 14:12:53 [iNFO] [sTDERR] at net.minecraft.client.renderer.RenderBlocks.func_94165_a(RenderBlocks.java:7495)

2013-03-21 14:12:53 [iNFO] [sTDERR] at net.minecraft.client.renderer.RenderBlocks.renderBlockAsItem(RenderBlocks.java:7420)

2013-03-21 14:12:53 [iNFO] [sTDERR] at net.minecraft.client.renderer.entity.RenderItem.renderItemIntoGUI(RenderItem.java:368)

2013-03-21 14:12:53 [iNFO] [sTDERR] at net.minecraft.client.renderer.entity.RenderItem.renderItemAndEffectIntoGUI(RenderItem.java:444)

2013-03-21 14:12:53 [iNFO] [sTDERR] at net.minecraft.client.gui.inventory.GuiContainer.drawSlotInventory(GuiContainer.java:413)

2013-03-21 14:12:53 [iNFO] [sTDERR] at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:126)

2013-03-21 14:12:53 [iNFO] [sTDERR] at net.minecraft.client.renderer.InventoryEffectRenderer.drawScreen(InventoryEffectRenderer.java:43)

2013-03-21 14:12:53 [iNFO] [sTDERR] at net.minecraft.client.gui.inventory.GuiContainerCreative.drawScreen(GuiContainerCreative.java:664)

2013-03-21 14:12:53 [iNFO] [sTDERR] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1021)

2013-03-21 14:12:53 [iNFO] [sTDERR] ... 3 more

 

 

hand here's my code:

 

public class blockAsphalt extends Block

{

  private Icon[][] iconBuffer;

 

  public blockAsphalt(int ID, Material material)

  {

      super(ID, material); //The ID and material

  }

 

  public int damageDropped(int i) //Tells it what block it drops and also for creative mode pick block

  {

      return i;

  }

 

  @SideOnly(Side.CLIENT)

  public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) //Adds the metadata blocks to the creative inventory

  {

      for (int var4 = 0; var4 < 9; ++var4)

      {

        par3List.add(new ItemStack(par1, 1, var4));

      }

  }

 

  @Override

  public void func_94332_a(IconRegister par1IconRegister)

  {

      iconBuffer = new Icon[9][6];

     

      iconBuffer[0][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[0][1] = par1IconRegister.func_94245_a("Class3:Asphalt"); // top

        iconBuffer[0][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[0][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[0][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[0][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[1][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[1][1] = par1IconRegister.func_94245_a("Class3:YellowLine1"); // top

        iconBuffer[1][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[1][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[1][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[1][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[2][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[2][1] = par1IconRegister.func_94245_a("Class3:YellowLine2"); // top

        iconBuffer[2][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[2][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[2][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[2][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[3][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[3][1] = par1IconRegister.func_94245_a("Class3:WhiteCorner1"); // top

        iconBuffer[3][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[3][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[3][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[3][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[4][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[4][1] = par1IconRegister.func_94245_a("Class3:WhiteCorner2"); // top

        iconBuffer[4][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[4][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[4][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[4][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[5][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[5][1] = par1IconRegister.func_94245_a("Class3:WhiteCorner3"); // top

        iconBuffer[5][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[5][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[5][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[5][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[6][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[6][1] = par1IconRegister.func_94245_a("Class3:WhiteCorner4"); // top

        iconBuffer[6][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[6][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[6][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[6][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[7][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[7][1] = par1IconRegister.func_94245_a("Class3:WhiteLine1"); // top

        iconBuffer[7][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[7][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[7][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[7][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

       

        iconBuffer[8][0] = par1IconRegister.func_94245_a("Class3:Asphalt"); // bottom

        iconBuffer[8][1] = par1IconRegister.func_94245_a("Class3:WhiteLine2"); // top

        iconBuffer[8][2] = par1IconRegister.func_94245_a("Class3:Asphalt"); // north

        iconBuffer[8][3] = par1IconRegister.func_94245_a("Class3:Asphalt"); // east

        iconBuffer[8][4] = par1IconRegister.func_94245_a("Class3:Asphalt"); // south

        iconBuffer[8][5] = par1IconRegister.func_94245_a("Class3:Asphalt"); // west

  }

 

  public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)

  {

      return iconBuffer[par1][par2];

  }

}

 

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



×
×
  • Create New...

Important Information

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