Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

My Metadeta block only drops metadata 0.

 

Block

 

 

package tattyseal.e.energyCollector;

 

 

 

import java.util.ArrayList;

import java.util.List;

 

import net.minecraft.block.Block;

import net.minecraft.block.BlockContainer;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IconRegister;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.item.ItemStack;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.util.Icon;

import net.minecraft.world.World;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class EnergyCollector extends BlockContainer

{

@SideOnly(Side.CLIENT)

public static Icon[] texture = new Icon[5];

 

public EnergyCollector(int id)

{

super(id, Material.glass);

}

 

public TileEntity createNewTileEntity(World world)

{

return new TileEnergyCollector();

}

 

@SideOnly(Side.CLIENT)

public void registerIcons(IconRegister i)

{

texture[0] = i.registerIcon("ee:collector");

texture[1] = i.registerIcon("ee:collector_front");

texture[2] = Block.glowStone.getIcon(0, 0);

texture[3] = i.registerIcon("ee:collector_dm");

texture[4] = i.registerIcon("ee:collector_rm");

}

 

@SideOnly(Side.CLIENT)

public Icon getIcon(int side, int meta)

{

if(side == 0 || side == 1)

{

if(meta == 0)

{

return texture[0];

}

else if(meta == 1)

{

return texture[3];

}

else if(meta == 2)

{

return texture[4];

}

else

{

return null;

}

}

else

{

return texture[2];

}

}

 

@SideOnly(Side.CLIENT)

public void getSubBlocks(int id, CreativeTabs c, List l)

{

for(int i = 0; i < 3; i++)

{

l.add(new ItemStack(id, 1, i));

}

}

 

public int getDamageDropped(int meta)

{

return meta;

}

}

 

 

 

 

ItemBlock

 

 

package tattyseal.e.energyCollector;

 

import net.minecraft.item.ItemBlock;

import net.minecraft.item.ItemStack;

 

public class ItemEnergyCollector extends ItemBlock

{

 

public ItemEnergyCollector(int par1)

{

super(par1);

setHasSubtypes(true);

}

 

public String getUnlocalizedName(ItemStack itemstack)

{

String name = "";

 

switch(itemstack.getItemDamage())

{

case 0:

{

name = "ee.energyCollector";

break;

}

case 1:

{

name = "ee.energyCollectorMk1";

break;

}

case 2:

{

name = "ee.energyCollectorMk2";

break;

}

default:

{

name = "broken";

}

}

 

return name;

}

 

public int getMetadata(int par1)

{

return par1;

}

 

}

 

 

 

 

Help!  :(

  • Author

Yes, GameRegistry.registerBlock(energyCollector, ItemEnergyCollector.class, "ee.energyCollector");

 

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.