A few changes, read below:

- Add storage blocks for alloys and other metals
 - Register quite clear glass as "blockGlass" as well for compatability
 - Add registration for all nuggets
This commit is contained in:
tterrag1098 committed 2014-08-26 22:07:59 -04:00
1 parent a3ac86e3f8
commit 4b161d20f9
16 files changed
+159 -23

No files matched your search

@@ -98,6 +98,7 @@ import crazypants.enderio.machine.wireless.BlockWirelessCharger;
import crazypants.enderio.material.Alloy;
import crazypants.enderio.material.BlockDarkIronBars;
import crazypants.enderio.material.BlockFusedQuartz;
import crazypants.enderio.material.BlockIngotStorage;
import crazypants.enderio.material.ItemAlloy;
import crazypants.enderio.material.ItemCapacitor;
import crazypants.enderio.material.ItemFusedQuartzFrame;
@@ -136,6 +137,7 @@ public class EnderIO {
public static ItemMachinePart itemMachinePart;
public static ItemPowderIngot itemPowderIngot;
public static ItemMaterial itemMaterial;
public static BlockIngotStorage blockIngotStorage;
public static BlockDarkIronBars blockDarkIronBars;
// Enderface
@@ -359,6 +361,8 @@ public class EnderIO {
itemConduitProbe = ItemConduitProbe.create();
itemMagnet = ItemMagnet.create();
blockIngotStorage = BlockIngotStorage.create();
blockDarkIronBars = BlockDarkIronBars.create();
@@ -64,6 +64,7 @@ public enum ModObject {
//Blocks
blockDarkSteelPressurePlate,
blockReinforcedObsidian,
blockIngotStorage,
// Painter
blockPainter,
@@ -1,21 +1,30 @@
package crazypants.enderio.material;
import org.apache.commons.lang3.StringUtils;
public enum Alloy {
ELECTRICAL_STEEL("electricalSteel"),
ENERGETIC_ALLOY("energeticAlloy"),
PHASED_GOLD("phasedGold"),
REDSTONE_ALLOY("redstoneAlloy"),
CONDUCTIVE_IRON("conductiveIron"),
PHASED_IRON("phasedIron"),
DARK_STEEL("darkSteel");
ELECTRICAL_STEEL("electricalSteel", 6.0f),
ENERGETIC_ALLOY("energeticAlloy", 7.0f),
PHASED_GOLD("phasedGold", 4.0f),
REDSTONE_ALLOY("redstoneAlloy", 1.0f),
CONDUCTIVE_IRON("conductiveIron", 5.2f),
PHASED_IRON("phasedIron", 7.0f),
DARK_STEEL("darkSteel", 10.0f);
public final String unlocalisedName;
public final String iconKey;
public final String oredictName;
private final float hardness;
private Alloy(String iconKey) {
this.unlocalisedName = "enderio." + iconKey;
this.iconKey = "enderio:" + iconKey;
private Alloy(String baseName, float hardness) {
this.unlocalisedName = "enderio." + baseName;
this.iconKey = "enderio:" + baseName;
this.oredictName = "ingot" + StringUtils.capitalize(baseName);
this.hardness = hardness;
}
public float getHardness() {
return hardness;
}
}
@@ -0,0 +1,70 @@
package crazypants.enderio.material;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderio.BlockEio;
import crazypants.enderio.ModObject;
public class BlockIngotStorage extends BlockEio {
@SideOnly(Side.CLIENT)
private IIcon[] icons = new IIcon[Alloy.values().length];
public static BlockIngotStorage create() {
BlockIngotStorage res = new BlockIngotStorage();
res.init();
return res;
}
private BlockIngotStorage() {
super(ModObject.blockIngotStorage.unlocalisedName, null, Material.iron);
setStepSound(soundTypeMetal);
}
@Override
protected void init() {
GameRegistry.registerBlock(this, BlockItemIngotStorage.class, ModObject.blockIngotStorage.unlocalisedName);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register) {
for (Alloy alloy : Alloy.values()) {
icons[alloy.ordinal()] = register.registerIcon(alloy.iconKey + "Block");
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
meta = MathHelper.clamp_int(meta, 0, Alloy.values().length - 1);
return icons[meta];
}
@Override
public int getDamageValue(World world, int x, int y, int z) {
return world.getBlockMetadata(x, y, z);
}
@Override
public int damageDropped(int meta) {
return meta;
}
@Override
public float getBlockHardness(World world, int x, int y, int z) {
return Alloy.values()[world.getBlockMetadata(x, y, z)].getHardness();
}
@Override
public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) {
return getBlockHardness(world, x, y, z) * 2.0f; // vanilla default is / 5.0f, this means hardness*2 = resistance
}
}
@@ -16,10 +16,10 @@ public class BlockItemDarkIronBars extends ItemBlock {
super(block);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(Lang.localize("blastResistant"));
}
}
@@ -0,0 +1,39 @@
package crazypants.enderio.material;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockItemIngotStorage extends ItemBlock {
public BlockItemIngotStorage(Block block) {
super(block);
setHasSubtypes(true);
setMaxDamage(0);
}
@Override
public String getUnlocalizedName(ItemStack stack) {
return "tile." + Alloy.values()[stack.getItemDamage()].unlocalisedName;
}
@Override
public int getMetadata(int damage) {
return damage;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list) {
for (Alloy alloy : Alloy.values()) {
list.add(new ItemStack(this, 1, alloy.ordinal()));
}
}
}
@@ -78,5 +78,4 @@ public class ItemAlloy extends Item {
par3List.add(new ItemStack(par1, 1, j));
}
}
}
@@ -2,6 +2,8 @@ package crazypants.enderio.material;
import java.util.ArrayList;
import org.apache.commons.lang3.StringUtils;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
@@ -28,14 +30,12 @@ public class MaterialRecipes {
OreDictionary.registerOre("itemSilicon", new ItemStack(EnderIO.itemMaterial, 1, Material.SILICON.ordinal()));
OreDictionary.registerOre("ingotConductiveIron", new ItemStack(EnderIO.itemAlloy, 1, Alloy.CONDUCTIVE_IRON.ordinal()));
OreDictionary.registerOre("ingotElectricalSteel", new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()));
OreDictionary.registerOre("ingotEnergeticAlloy", new ItemStack(EnderIO.itemAlloy, 1, Alloy.ENERGETIC_ALLOY.ordinal()));
OreDictionary.registerOre("ingotRedstoneAlloy", new ItemStack(EnderIO.itemAlloy, 1, Alloy.REDSTONE_ALLOY.ordinal()));
OreDictionary.registerOre("ingotRedAlloy", new ItemStack(EnderIO.itemAlloy, 1, Alloy.REDSTONE_ALLOY.ordinal()));
OreDictionary.registerOre("ingotVibrantAlloy", new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal()));
OreDictionary.registerOre("ingotPulsatingIron", new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_IRON.ordinal()));
OreDictionary.registerOre("ingotDarkSteel", new ItemStack(EnderIO.itemAlloy, 1, Alloy.DARK_STEEL.ordinal()));
for (Alloy alloy : Alloy.values()) {
OreDictionary.registerOre(alloy.oredictName, new ItemStack(EnderIO.itemAlloy, 1, alloy.ordinal()));
}
OreDictionary.registerOre("nuggetPulsatingIron", new ItemStack(EnderIO.itemMaterial, 1, Material.PHASED_IRON_NUGGET.ordinal()));
OreDictionary.registerOre("nuggetVibrantAlloy", new ItemStack(EnderIO.itemMaterial, 1, Material.VIBRANT_NUGGET.ordinal()));
OreDictionary.registerOre("glass", Blocks.glass);
OreDictionary.registerOre("stickWood", Items.stick);
@@ -46,6 +46,7 @@ public class MaterialRecipes {
ItemStack pureGlass = new ItemStack(EnderIO.blockFusedQuartz, 1, BlockFusedQuartz.Type.GLASS.ordinal());
OreDictionary.registerOre("glass", pureGlass);
OreDictionary.registerOre("blockGlass", pureGlass);
OreDictionary.registerOre("glassHardened", new ItemStack(EnderIO.blockFusedQuartz, 1, BlockFusedQuartz.Type.FUSED_QUARTZ.ordinal()));
//Skulls
@@ -152,7 +153,10 @@ public class MaterialRecipes {
ItemStack reinfObs = new ItemStack(EnderIO.blockReinforcedObsidian);
GameRegistry.addShapedRecipe(reinfObs , "dbd", "bob", "dbd", 'd', darkSteel, 'b', EnderIO.blockDarkIronBars, 'o', Blocks.obsidian);
}
for (Alloy alloy : Alloy.values()) {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(EnderIO.blockIngotStorage, 1, alloy.ordinal()), "iii", "iii", "iii", 'i', alloy.oredictName));
}
}
public static void addOreDictionaryRecipes() {