Condensed world generation
Consended blocks and items with inheritance
This commit is contained in:
parent
5c12c3d75a
commit
67609531ce
20 changed files with 207 additions and 525 deletions
39
common/mysticstones/blocks/ItemBlockMulti.java
Normal file
39
common/mysticstones/blocks/ItemBlockMulti.java
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
package mysticstones.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class ItemBlockMulti extends ItemBlock {
|
||||
private String[] types;
|
||||
private Block block;
|
||||
|
||||
public ItemBlockMulti(int par1, Block block, String[] names) {
|
||||
super(par1);
|
||||
this.types = names;
|
||||
this.block = block;
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage(int par1) {
|
||||
return block.getIcon(2, par1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int par1) {
|
||||
return par1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemStack) {
|
||||
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, types.length);
|
||||
return types[meta];
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue