Jump to content

Recommended Posts

Posted

Hi, I can't find out why my custom furnace isn't working, this is probably a noob question with a simple answer, but I just can't figure it out!

 

Here's my container class:

 

package k3.moremetals.mod.container;

 

import k3.moremetals.mod.tileentity.TileEntityRefueler;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.entity.player.InventoryPlayer;

import net.minecraft.inventory.Container;

import net.minecraft.inventory.ICrafting;

import net.minecraft.inventory.Slot;

import net.minecraft.inventory.SlotFurnace;

 

public class ContainerRefueler extends Container{

 

private TileEntityRefueler tileentityrefueler;

 

public int lastBurnTime;

public int lastCurrentItemBurnTime;

public int lastCookTime;

 

public ContainerRefueler(InventoryPlayer inventory, TileEntityRefueler tileentity){

this.tileentityrefueler = tileentity;

 

this.addSlotToContainer(new Slot(tileentity, 0, 56, 17));

this.addSlotToContainer(new Slot(tileentity, 1, 56, 53));

this.addSlotToContainer(new SlotFurnace(inventory.player, tileentity, 2, 116, 35));

 

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

for(int j = 0; j < 9; j++){

this.addSlotToContainer(new Slot(inventory, j + i*9 + 9, 8 + j*18, 94 + i*18));

 

 

}

}

 

for(int i = 0; i < 9; i++){

this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 142));

}

}

 

 

public void addCraftingToCrafters (ICrafting icrafting){

super.addCraftingToCrafters(icrafting);

icrafting.sendProgressBarUpdate(this, 0, this.tileentityrefueler.cookTime);

icrafting.sendProgressBarUpdate(this, 1, this.tileentityrefueler.burnTime);

icrafting.sendProgressBarUpdate(this, 2, this.tileentityrefueler.currentItemBurnTime);

}

 

public void detectAndSendChanges() {

super.detectAndSendChanges();

for(int i = 0; i < this.crafters.size(); i++){

ICrafting icrafting = (ICrafting) this.crafters.get(i);

 

if(this.lastCookTime != this.tileentityrefueler.cookTime){

icrafting.sendProgressBarUpdate(this, 0, this.tileentityrefueler.cookTime);

}

 

if(this.lastBurnTime != this.tileentityrefueler.burnTime){

icrafting.sendProgressBarUpdate(this, 1, this.tileentityrefueler.burnTime);

}

 

if(this.lastCurrentItemBurnTime != this.tileentityrefueler.currentItemBurnTime){

icrafting.sendProgressBarUpdate(this, 2, this.tileentityrefueler.currentItemBurnTime);

}

}

this.lastCookTime = this.tileentityrefueler.cookTime;

this.lastBurnTime = this.tileentityrefueler.burnTime;

this.lastCurrentItemBurnTime = this.tileentityrefueler.currentItemBurnTime;

}

 

public void updateProgressBar(int slot, int newValue){

 

}

 

 

@Override

public boolean canInteractWith(EntityPlayer var1) {

// TODO Auto-generated method stub

return false;

}

 

}

 

 

Here's my block class:

 

package k3.moremetals.mod.block;

 

import cpw.mods.fml.common.network.internal.FMLNetworkHandler;

import k3.moremetals.mod.MoreMetalsMod;

import k3.moremetals.mod.tileentity.TileEntityRefueler;

import net.minecraft.block.Block;

import net.minecraft.block.BlockContainer;

import net.minecraft.block.material.Material;

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

import net.minecraft.entity.EntityLivingBase;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.util.IIcon;

import net.minecraft.util.MathHelper;

import net.minecraft.world.World;

 

public class BlockRefueler extends BlockContainer{

private IIcon iconFront;

private IIcon iconLeft;

 

 

private boolean isActive;

private static boolean keepInventory;

 

public BlockRefueler(boolean isActive) {

super(Material.iron);

this.isActive = isActive;

 

}

 

 

@Override

public void registerBlockIcons(IIconRegister iconRegister){

this.blockIcon = iconRegister.registerIcon(MoreMetalsMod.modid + ":blockRefueler_Side");

this.iconFront = iconRegister.registerIcon(MoreMetalsMod.modid + (this.isActive ? ":blockRefueler_Front_Active" : ":blockRefueler_Front_Idle"));

this.iconLeft = iconRegister.registerIcon(MoreMetalsMod.modid + ":blockRefueler_Left");

}

 

 

public IIcon getIcon(int side, int metadata){

return side == 1 ? this.blockIcon : (side == 0 ? this.blockIcon : (side == 6 ? this.iconLeft : (side != metadata ? this.blockIcon : this.iconFront)));

}

 

public Item getItemDropped(World world, int x, int y, int z){

return Item.getItemFromBlock(MoreMetalsMod.blockRefueler_Idle);

}

 

public void onBlockAdded(World world, int x, int y, int z){

super.onBlockAdded(world, x, y, z);

this.setDefaultDirection(world, x, y, z);

}

 

 

private void setDefaultDirection(World world, int x, int y, int z) {

if(!world.isRemote){

Block b1 = world.getBlock(x, y, z -1);

Block b2 = world.getBlock(x, y, z +1);

Block b3 = world.getBlock(x -1, y, z);

Block b4 = world.getBlock(x +1, y, z);

 

byte b0 = 3;

 

if(b1.func_149730_j() &&  !b2.func_149730_j()){

b0 = 3;

}

 

if(b2.func_149730_j() &&  !b1.func_149730_j()){

b0 = 2;

}

 

if(b3.func_149730_j() &&  !b4.func_149730_j()){

b0 = 5;

}

 

if(b4.func_149730_j() &&  !b3.func_149730_j()){

b0 = 4;

}

 

world.setBlockMetadataWithNotify(x, y, x, b0, 2);

}

}

 

 

public boolean onBlockAcitvated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){

if(!world.isRemote){

FMLNetworkHandler.openGui(player, MoreMetalsMod.instance, MoreMetalsMod.guiIDRefueler, world, x, y, z);

}

return true;

}

 

@Override

public TileEntity createNewTileEntity(World world, int i) {

return new TileEntityRefueler();

}

 

//TODO randomDisplayTick

 

public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityplayer, ItemStack itemstack){

int l = MathHelper.floor_double((double)(entityplayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

 

if(l == 0){

world.setBlockMetadataWithNotify(x, y, z, 2, 2);

}

 

if(l == 1){

world.setBlockMetadataWithNotify(x, y, z, 5, 2);

}

 

if(l == 2){

world.setBlockMetadataWithNotify(x, y, z, 3, 2);

}

 

if(l == 3){

world.setBlockMetadataWithNotify(x, y, z, 4, 2);

}

 

if(itemstack.hasDisplayName()){

((TileEntityRefueler)world.getTileEntity(x, y, z)).setGuiDisplayName(itemstack.getDisplayName());

}

}

 

 

public static void updateBlockRefuelerBlockState(boolean active, World worldObj, int xCoord, int yCoord, int zCoord) {

 

int i = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);

 

TileEntity tileentity = worldObj.getTileEntity(xCoord, yCoord, zCoord);

keepInventory = true;

 

if(active){

worldObj.setBlock(xCoord, yCoord, zCoord, MoreMetalsMod.blockRefueler_Active);

 

}

else {

worldObj.setBlock(xCoord, yCoord, zCoord, MoreMetalsMod.blockRefueler_Idle);

}

 

keepInventory = false;

worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, i, 2);

 

if(tileentity != null){

tileentity.validate();

worldObj.setTileEntity(xCoord, yCoord, zCoord, tileentity);

}

}

}

 

 

 

 

 

The GUI

 

 

package k3.moremetals.mod.gui;

 

import k3.moremetals.mod.MoreMetalsMod;

import k3.moremetals.mod.container.ContainerRefueler;

import k3.moremetals.mod.tileentity.TileEntityRefueler;

import net.minecraft.client.gui.inventory.GuiContainer;

import net.minecraft.client.resources.I18n;

import net.minecraft.entity.player.InventoryPlayer;

import net.minecraft.util.ResourceLocation;

 

public class GuiRefueler extends GuiContainer{

 

public static final ResourceLocation texture = new ResourceLocation(MoreMetalsMod.modid + ":textures/gui/refueler.png");

 

public TileEntityRefueler refueler;

 

public GuiRefueler(InventoryPlayer inventoryPlayer, TileEntityRefueler entity) {

super(new ContainerRefueler(inventoryPlayer, entity));

 

this.refueler = entity;

 

this.xSize = 176;

this.ySize = 166;

}

 

public void drawGuiContainerForegroundLayer(int par1, int par2){

String name = this.refueler.hasCustomInventoryName() ? this.refueler.getInventoryName() : I18n.format(this.refueler.getInventoryName(), new Object[0]);

 

this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);

this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 128, this.ySize - 96 + 2, 4210752);

}

 

 

@Override

protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {

// TODO Auto-generated method stub

 

}

 

}

 

 

 

GUI Handler

 

 

package k3.moremetals.mod.handler;

 

import k3.moremetals.mod.MoreMetalsMod;

import k3.moremetals.mod.container.ContainerRefueler;

import k3.moremetals.mod.gui.GuiRefueler;

import k3.moremetals.mod.tileentity.TileEntityRefueler;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.world.World;

import cpw.mods.fml.common.network.IGuiHandler;

 

public class GuiHandler implements IGuiHandler{

 

@Override

public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {

TileEntity entity = world.getTileEntity(x, y, z);

 

if(entity != null){

switch(ID){

case MoreMetalsMod.guiIDRefueler:

if(entity instanceof TileEntityRefueler){

return new ContainerRefueler(player.inventory, (TileEntityRefueler) entity);

 

}

return null;

}

}

 

 

return null;

}

 

@Override

public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {

TileEntity entity = world.getTileEntity(x, y, z);

 

if(entity != null){

switch(ID){

case MoreMetalsMod.guiIDRefueler:

if(entity instanceof TileEntityRefueler){

return new GuiRefueler(player.inventory, (TileEntityRefueler) entity);

 

}

return null;

}

}

 

 

return null;

}

 

}

 

 

 

 

TileEntity

 

 

package k3.moremetals.mod.tileentity;

 

import k3.moremetals.mod.MoreMetalsMod;

import k3.moremetals.mod.block.BlockRefueler;

import k3.moremetals.mod.handler.RefuelerRecipeHandler;

import net.minecraft.block.Block;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.init.Blocks;

import net.minecraft.init.Items;

import net.minecraft.inventory.ISidedInventory;

import net.minecraft.item.Item;

import net.minecraft.item.ItemBlock;

import net.minecraft.item.ItemStack;

import net.minecraft.tileentity.TileEntity;

 

public class TileEntityRefueler extends TileEntity implements ISidedInventory{

 

private String localizedName;

private static final int[] slots_top = new int[]{0};

private static final int[] slots_bottom = new int[]{2, 1};

private static final int[] slots_side = new int[]{1};

private ItemStack[] slots = new ItemStack[3];

public int furnaceSpeed = 300;

public int burnTime;

public int currentItemBurnTime;

public int cookTime;

 

public void setGuiDisplayName(String displayName) {

this.localizedName = displayName;

 

}

 

public String getInventoryName(){

return this.hasCustomInventoryName() ? this.localizedName : "container.refueler";

}

 

public boolean hasCustomInventoryName() {

return this.localizedName != null && this.localizedName.length() > 0;

}

 

public int getSizeInvetory(){

return this.slots.length;

}

 

@Override

public int getSizeInventory() {

// TODO Auto-generated method stub

return 0;

}

 

@Override

public ItemStack getStackInSlot(int var1) {

return this.slots[var1];

}

 

@Override

public ItemStack decrStackSize(int var1, int var2) {

if(this.slots[var1] != null){

 

ItemStack itemstack;

 

if(this.slots[var1].stackSize <= var2){

itemstack = this.slots[var1];

this.slots[var1] = null;

return itemstack;

}

else{

itemstack = this.slots[var1].splitStack(var2);

 

if(this.slots[var1].stackSize == 0){

this.slots[var1] = null;

return itemstack;

}

}

}

return null;

}

 

@Override

public ItemStack getStackInSlotOnClosing(int i) {

if(this.slots != null){

ItemStack itemstack = this.slots;

this.slots = null;

return itemstack;

}

return null;

}

 

@Override

public void setInventorySlotContents(int i, ItemStack itemstack) {

this.slots = itemstack;

 

if(itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()){

itemstack.stackSize = this.getInventoryStackLimit();

}

}

 

@Override

public int getInventoryStackLimit() {

return 64;

}

 

@Override

public boolean isUseableByPlayer(EntityPlayer entityplayer) {

return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : entityplayer.getDistance((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D;

}

 

 

public void openInventory() {

}

 

public void closeInventory() {

}

 

private static int getItemBurnTime(ItemStack itemstack){

if(itemstack == null){

return 0;

}

else{

Item item = itemstack.getItem();

 

if(item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air){

Block block = Block.getBlockFromItem(item);

 

if (item == MoreMetalsMod.bucketOil) return 200;

}

}

return 0;

}

 

public boolean isBurning(){

return this.burnTime > 0;

}

 

public void updateEntity(){

boolean flag = this.burnTime > 0;

boolean flag1 = false;

 

if(this.isBurning()){

this.burnTime--;

}

 

if(!this.worldObj.isRemote){

if(this.burnTime == 0 && this.canSmelt()){

this.currentItemBurnTime = this.burnTime = getItemBurnTime(this.slots[1]);

 

if(this.isBurning()){

flag1 = true;

 

if(this.slots[1] != null){

this.slots[1].stackSize--;

 

if(this.slots[1].stackSize == 0){

this.slots[1] = this.slots[1].getItem().getContainerItem(this.slots[1]);

}

}

}

}

}

 

if(this.isBurning() && this.canSmelt()){

this.cookTime++;

 

if(this.cookTime == this.furnaceSpeed){

this.cookTime = 0;

this.refuelItem();

flag1 = true;

}

 

else{

this.cookTime = 0;

}

 

if(flag != this.isBurning()){

flag1 = true;

BlockRefueler.updateBlockRefuelerBlockState(this.burnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);

}

}

if(flag1){

this.markDirty();

}

 

}

 

public void refuelItem() {

if(this.canSmelt()){

ItemStack itemstack = RefuelerRecipeHandler.smelting().getSmeltingResult(this.slots[0]);

 

if(this.slots[2] == null){

this.slots[2] = itemstack.copy();

}

 

else if(this.slots[2].isItemEqual(itemstack)){

this.slots[2].stackSize += itemstack.stackSize;

}

 

this.slots[0].stackSize--;

 

if(this.slots[0].stackSize <= 0){

this.slots[0] = null;

}

}

}

 

public boolean canSmelt(){

if(this.slots[0] == null){

return false;

}

 

else{

ItemStack itemstack = RefuelerRecipeHandler.smelting().getSmeltingResult(this.slots[0]);

 

 

if(itemstack == null) return false;

if(this.slots[2] == null) return true;

if(!this.slots[2].isItemEqual(itemstack)) return false;

 

int result = this.slots[2].stackSize + itemstack.stackSize;

 

return(result <= getInventoryStackLimit() && result <= itemstack.getMaxStackSize());

 

}

}

 

@Override

public boolean isItemValidForSlot(int i, ItemStack itemstack) {

return i == 2 ? false : (i == 1 ? isItemOil(itemstack) : true);

}

 

 

 

private boolean isItemOil(ItemStack itemstack) {

return getItemBurnTime(itemstack) > 0;

}

 

@Override

public int[] getAccessibleSlotsFromSide(int var1) {

return var1 == 0 ? slots_bottom : (var1 == 1 ? slots_top : slots_side);

}

 

@Override

public boolean canInsertItem(int i, ItemStack itemstack, int j) {

return this.isItemValidForSlot(i, itemstack);

}

 

@Override

public boolean canExtractItem(int i, ItemStack itemstack, int j) {

return j != 0 || i != 1 || itemstack.getItem() == Items.bucket;

}

}

 

 

 

And finally, the main class:

 

 

 

package k3.moremetals.mod;

 

import k3.moremetals.mod.armor.CopperArmor;

import k3.moremetals.mod.block.BlockCoppOre;

import k3.moremetals.mod.block.BlockCopper;

import k3.moremetals.mod.block.BlockOil;

import k3.moremetals.mod.block.BlockPlatOre;

import k3.moremetals.mod.block.BlockRefueler;

import k3.moremetals.mod.block.BlockVimbOre;

import k3.moremetals.mod.generation.MMOreGeneration;

import k3.moremetals.mod.handler.GuiHandler;

import k3.moremetals.mod.item.HatchetCopper;

import k3.moremetals.mod.item.HatchetIronBlackened;

import k3.moremetals.mod.item.HatchetPlatinum;

import k3.moremetals.mod.item.HoeCopper;

import k3.moremetals.mod.item.HoeIronBlackened;

import k3.moremetals.mod.item.HoePlatinum;

import k3.moremetals.mod.item.ItemBlackenedIronIngot;

import k3.moremetals.mod.item.ItemBlackenedIronRod;

import k3.moremetals.mod.item.ItemBucketOil;

import k3.moremetals.mod.item.ItemCopperIngot;

import k3.moremetals.mod.item.ItemIronRod;

import k3.moremetals.mod.item.ItemPlatChunk;

import k3.moremetals.mod.item.ItemVimbeeShard;

import k3.moremetals.mod.item.PickaxeCopper;

import k3.moremetals.mod.item.PickaxeIronBlackened;

import k3.moremetals.mod.item.PickaxePlatinum;

import k3.moremetals.mod.item.ShovelCopper;

import k3.moremetals.mod.item.ShovelIronBlackened;

import k3.moremetals.mod.item.ShovelPlatinum;

import k3.moremetals.mod.item.SwordCopper;

import k3.moremetals.mod.item.SwordIronBlackened;

import k3.moremetals.mod.item.SwordPlatinum;

import k3.moremetals.mod.tileentity.TileEntityRefueler;

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.Item.ToolMaterial;

import net.minecraft.item.ItemArmor.ArmorMaterial;

import net.minecraft.item.ItemStack;

import net.minecraftforge.common.util.EnumHelper;

import net.minecraftforge.fluids.Fluid;

import net.minecraftforge.fluids.FluidContainerRegistry;

import net.minecraftforge.fluids.FluidRegistry;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.EventHandler;

import cpw.mods.fml.common.Mod.Instance;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;

import cpw.mods.fml.common.network.NetworkRegistry;

import cpw.mods.fml.common.registry.GameRegistry;

 

 

@Mod(modid = MoreMetalsMod.modid, name = MoreMetalsMod.name, version = MoreMetalsMod.version)

public class MoreMetalsMod {

 

   

//Mod Info Stuffs

public static final String modid = "moremetals";

public static final String version = "1.0";

public static final String name = "More Metals!";

 

@Instance(modid)

public static MoreMetalsMod instance;

 

 

public static CreativeTabs moreMetalsTab = new CreativeTabs("moreMetalsStuff"){

 

 

public Item getTabIconItem() {

return Item.getItemFromBlock(orePlatinum);

}

};

 

public static CreativeTabs moreMetalsTools = new CreativeTabs("moreMetalsTools"){

 

 

public Item getTabIconItem() {

return swordPlatinum;

}

};

 

public static CreativeTabs moreMetalsArmor = new CreativeTabs("moreMetalsArmor"){

 

 

public Item getTabIconItem() {

return copperHelmet;

}

};

 

//Unique Armor IDs

public static int copperBootsID;

public static int copperLeggingsID;

public static int copperChestplateID;

public static int copperHelmetID;

public static int darkenedIronBootsID;

public static int darkenedIronLeggingsID;

public static int darkenedIronChestplateID;

public static int darkenedIronHelmetID;

public static int platinumBootsID;

public static int platinumLeggingsID;

public static int platinumChestplateID;

public static int platinumHelmetIDID;

 

//Materials

public static ToolMaterial materialPlatinum = EnumHelper.addToolMaterial("materialPlatinum", 5, 2300, 9.0F, 6.0F, 23);

public static ToolMaterial materialCopper = EnumHelper.addToolMaterial("materialCopper", 2, 211, 5.0F, 1.0F, 7);

public static ToolMaterial materialIronBlackened = EnumHelper.addToolMaterial("materialIronBlackened", 3, 800, 7.0F, 3.0F, 19);

    public static ArmorMaterial armorMaterialCopper = EnumHelper.addArmorMaterial("armorMaterialCopper", 12, new int[] {2, 5, 4, 2}, 10);

 

    //Machines

public static Block blockRefueler_Active;

public static Block blockRefueler_Idle;

 

//Ore Generation

public static MMOreGeneration PlatinumOreWorldGen = new MMOreGeneration();

 

//Blocks

public static Block orePlatinum;

public static Block oreCopper;

public static Block oreVimbee;

public static Block blockCopper;

public static Block blockOil;

 

//Gui Stuffs

public static final int guiIDRefueler = 0;

 

//Fluids

public static Fluid fluidOil = new Fluid("fluidOil");

 

//Items

public static Item chunkPlatinum;

public static Item rodIron;

public static Item rodIronBlackened;

public static Item ingotIronBlackened;

public static Item swordPlatinum;

public static Item hatchetPlatinum;

public static Item shovelPlatinum;

public static Item hoePlatinum;

public static Item pickaxePlatinum;

public static Item swordCopper;

public static Item hatchetCopper;

public static Item shovelCopper;

public static Item hoeCopper;

public static Item pickaxeCopper;

public static Item ingotCopper;

public static Item swordIronBlackened;

public static Item hatchetIronBlackened;

public static Item shovelIronBlackened;

public static Item hoeIronBlackened;

public static Item pickaxeIronBlackened;

public static Item jackhammer;

public static Item chainsaw;

public static Item shardVimbee;

 

//Armor

public static Item copperBoots;

public static Item copperLeggings;

public static Item copperChestplate;

public static Item copperHelmet;

 

 

//Bucket

public static Item bucketOil = new ItemBucketOil(blockOil);

 

 

@EventHandler

public void preInit(FMLPreInitializationEvent preevent){

 

 

//Register The Items

chunkPlatinum = new ItemPlatChunk().setUnlocalizedName("chunkPlatinum").setCreativeTab(MoreMetalsMod.moreMetalsTab);

GameRegistry.registerItem(chunkPlatinum, "chunkPlatinum");

 

rodIron = new ItemIronRod().setUnlocalizedName("rodIron").setCreativeTab(MoreMetalsMod.moreMetalsTab);

GameRegistry.registerItem(rodIron, "rodIron");

 

ingotIronBlackened = new ItemBlackenedIronIngot().setUnlocalizedName("ingotIronBlackened").setCreativeTab(MoreMetalsMod.moreMetalsTab);

GameRegistry.registerItem(ingotIronBlackened, "ingotIronBlackened");

 

rodIronBlackened = new ItemBlackenedIronRod().setUnlocalizedName("rodIronBlackened").setCreativeTab(MoreMetalsMod.moreMetalsTab);

GameRegistry.registerItem(rodIronBlackened, "rodIronBlackened");

 

ingotCopper = new ItemCopperIngot().setUnlocalizedName("ingotCopper").setCreativeTab(moreMetalsTab);

GameRegistry.registerItem(ingotCopper, "ingotCopper");

 

shardVimbee = new ItemVimbeeShard(2, 1.5F, true).setUnlocalizedName("shardVimbee").setCreativeTab(moreMetalsTab);

GameRegistry.registerItem(shardVimbee, "shardVimbee");

 

//Register The Armor

copperBoots = new CopperArmor(armorMaterialCopper, copperBootsID, 3).setUnlocalizedName("copperBoots").setCreativeTab(moreMetalsArmor);

GameRegistry.registerItem(copperBoots, "copperBoots");

 

copperLeggings = new CopperArmor(armorMaterialCopper, copperLeggingsID, 2).setUnlocalizedName("copperLeggings").setCreativeTab(moreMetalsArmor);

GameRegistry.registerItem(copperLeggings, "copperLeggings");

 

copperChestplate = new CopperArmor(armorMaterialCopper, copperChestplateID, 1).setUnlocalizedName("copperChestplate").setCreativeTab(moreMetalsArmor);

GameRegistry.registerItem(copperChestplate, "copperChestplate");

 

copperHelmet = new CopperArmor(armorMaterialCopper, copperHelmetID, 0).setUnlocalizedName("copperHelmet").setCreativeTab(moreMetalsArmor);

GameRegistry.registerItem(copperHelmet, "copperHelmet");

 

//Register The Tools

shovelPlatinum = new ShovelPlatinum(materialPlatinum).setUnlocalizedName("shovelPlatinum").setCreativeTab(MoreMetalsMod.moreMetalsTools);

GameRegistry.registerItem(shovelPlatinum, "shovelPlatinum");

 

swordPlatinum = new SwordPlatinum(materialPlatinum).setUnlocalizedName("swordPlatinum").setCreativeTab(MoreMetalsMod.moreMetalsTools);

GameRegistry.registerItem(swordPlatinum, "swordPlatinum");

 

hatchetPlatinum = new HatchetPlatinum(materialPlatinum).setUnlocalizedName("hatchetPlatinum").setCreativeTab(MoreMetalsMod.moreMetalsTools);

GameRegistry.registerItem(hatchetPlatinum, "hatchetPlatinum");

 

hoePlatinum = new HoePlatinum(materialPlatinum).setUnlocalizedName("hoePlatinum").setCreativeTab(MoreMetalsMod.moreMetalsTools);

GameRegistry.registerItem(hoePlatinum, "hoePlatinum");

 

pickaxePlatinum = new PickaxePlatinum(materialPlatinum).setUnlocalizedName("pickaxePlatinum").setCreativeTab(MoreMetalsMod.moreMetalsTools);

GameRegistry.registerItem(pickaxePlatinum, "pickaxePlatinum");

 

shovelCopper = new ShovelCopper(materialCopper).setUnlocalizedName("shovelCopper").setCreativeTab(MoreMetalsMod.moreMetalsTools);

GameRegistry.registerItem(shovelCopper, "shovelCopper");

 

swordCopper = new SwordCopper(materialCopper).setUnlocalizedName("swordCopper").setCreativeTab(MoreMetalsMod.moreMetalsTools);

GameRegistry.registerItem(swordCopper, "swordCopper");

 

hatchetCopper = new HatchetCopper(materialCopper).setUnlocalizedName("hatchetCopper").setCreativeTab(MoreMetalsMod.moreMetalsTools);

GameRegistry.registerItem(hatchetCopper, "hatchetCopper");

 

hoeCopper = new HoeCopper(materialCopper).setUnlocalizedName("hoeCopper").setCreativeTab(MoreMetalsMod.moreMetalsTools);

GameRegistry.registerItem(hoeCopper, "hoeCopper");

 

pickaxeCopper = new PickaxeCopper(materialCopper).setUnlocalizedName("pickaxeCopper").setCreativeTab(MoreMetalsMod.moreMetalsTools);

GameRegistry.registerItem(pickaxeCopper, "pickaxeCopper");

 

shovelIronBlackened = new ShovelIronBlackened(materialIronBlackened).setUnlocalizedName("shovelIronBlackened").setCreativeTab(MoreMetalsMod.moreMetalsTools);

GameRegistry.registerItem(shovelIronBlackened, "shovelIronBlackened");

 

swordIronBlackened = new SwordIronBlackened(materialIronBlackened).setUnlocalizedName("swordIronBlackened").setCreativeTab(MoreMetalsMod.moreMetalsTools);

GameRegistry.registerItem(swordIronBlackened, "swordIronBlackened");

 

hatchetIronBlackened = new HatchetIronBlackened(materialIronBlackened).setUnlocalizedName("hatchetIronBlackened").setCreativeTab(MoreMetalsMod.moreMetalsTools);

GameRegistry.registerItem(hatchetIronBlackened, "hatchetIronBlackened");

 

hoeIronBlackened = new HoeIronBlackened(materialIronBlackened).setUnlocalizedName("hoeIronBlackened").setCreativeTab(MoreMetalsMod.moreMetalsTools);

GameRegistry.registerItem(hoeIronBlackened, "hoeIronBlackened");

 

pickaxeIronBlackened = new PickaxeIronBlackened(materialIronBlackened).setUnlocalizedName("pickaxeIronBlackened").setCreativeTab(MoreMetalsMod.moreMetalsTools);

GameRegistry.registerItem(pickaxeIronBlackened, "pickaxeIronBlackened");

 

//Register World Generation

GameRegistry.registerWorldGenerator(PlatinumOreWorldGen, 1);

 

//Register The Fluids

FluidRegistry.registerFluid(fluidOil);

 

blockOil = new BlockOil(fluidOil, Material.water).setBlockName("fluidOil");

GameRegistry.registerBlock(blockOil, modid + "_" + blockOil.getUnlocalizedName().substring(5));

 

fluidOil.setUnlocalizedName(blockOil.getUnlocalizedName());

 

bucketOil.setUnlocalizedName("bucketOil").setContainerItem(Items.bucket);

GameRegistry.registerItem(bucketOil, "bucketOil");

FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("fluidoil", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(bucketOil), new ItemStack(Items.bucket));

 

//Register The Blocks

orePlatinum = new BlockPlatOre().setBlockName("orePlatinum").setCreativeTab(MoreMetalsMod.moreMetalsTab);

GameRegistry.registerBlock(orePlatinum, "orePlatinum");

 

oreCopper = new BlockCoppOre().setBlockName("oreCopper").setCreativeTab(MoreMetalsMod.moreMetalsTab);

GameRegistry.registerBlock(oreCopper, "oreCopper");

 

oreVimbee = new BlockVimbOre().setBlockName("oreVimbee").setCreativeTab(MoreMetalsMod.moreMetalsTab);

GameRegistry.registerBlock(oreVimbee, "oreVimbee");

 

blockCopper = new BlockCopper().setBlockName("blockCopper").setCreativeTab(MoreMetalsMod.moreMetalsTab);

GameRegistry.registerBlock(blockCopper, "blockCopper");

 

//Register The Machines

blockRefueler_Idle = new BlockRefueler(false).setBlockName("blockRefueler_Idle").setCreativeTab(moreMetalsTab);

blockRefueler_Active = new BlockRefueler(true).setBlockName("blockRefueler_Active").setCreativeTab(moreMetalsTab);

GameRegistry.registerBlock(blockRefueler_Idle, "blockRefueler_Idle");

GameRegistry.registerBlock(blockRefueler_Active, "blockRefueler_Active");

 

 

//Register TileEntities

GameRegistry.registerTileEntity(TileEntityRefueler.class, "TileEntityRefueler");

 

//More Gui Stuffs

NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());

 

//Crafting Recipes

GameRegistry.addRecipe(new ItemStack(blockCopper, 1), new Object[]{"CCC","CCC","CCC",'C', ingotCopper});

 

GameRegistry.addRecipe(new ItemStack(hatchetPlatinum, 1), new Object[]{"PP","PR"," R",'P', chunkPlatinum, 'R', rodIronBlackened});

 

GameRegistry.addRecipe(new ItemStack(swordPlatinum, 1), new Object[]{"P","P","R",'P', chunkPlatinum, 'R', rodIronBlackened});

 

GameRegistry.addRecipe(new ItemStack(hoePlatinum, 1), new Object[]{"PP"," R"," R",'P', chunkPlatinum, 'R', rodIronBlackened});

 

GameRegistry.addRecipe(new ItemStack(shovelPlatinum, 1), new Object[]{"P","R","R",'P', chunkPlatinum, 'R', rodIronBlackened});

 

GameRegistry.addRecipe(new ItemStack(pickaxePlatinum, 1), new Object[]{"PPP"," R "," R ", 'P', chunkPlatinum, 'R', rodIronBlackened});

 

GameRegistry.addRecipe(new ItemStack(hatchetIronBlackened, 1), new Object[]{"II","IR"," R",'I', ingotIronBlackened, 'R', rodIron});

 

GameRegistry.addRecipe(new ItemStack(swordIronBlackened, 1), new Object[]{"I","I","R",'I', ingotIronBlackened, 'R', rodIron});

 

GameRegistry.addRecipe(new ItemStack(hoeIronBlackened, 1), new Object[]{"II"," R"," R",'I', ingotIronBlackened, 'R', rodIron});

 

GameRegistry.addRecipe(new ItemStack(shovelIronBlackened, 1), new Object[]{"I","R","R",'I', ingotIronBlackened, 'R', rodIron});

 

GameRegistry.addRecipe(new ItemStack(pickaxeIronBlackened, 1), new Object[]{"III"," R "," R ", 'I', ingotIronBlackened, 'R', rodIron});

 

GameRegistry.addRecipe(new ItemStack(hatchetCopper, 1), new Object[]{"CC","CS"," S",'C', ingotCopper, 'S', Items.stick});

 

GameRegistry.addRecipe(new ItemStack(swordCopper, 1), new Object[]{"C","C","S",'C', ingotCopper, 'S', Items.stick});

 

GameRegistry.addRecipe(new ItemStack(hoeCopper, 1), new Object[]{"CC"," S"," S",'C', ingotCopper, 'S', Items.stick});

 

GameRegistry.addRecipe(new ItemStack(shovelCopper, 1), new Object[]{" C"," S"," S",'C', ingotCopper, 'S', Items.stick});

 

GameRegistry.addRecipe(new ItemStack(pickaxeCopper, 1), new Object[]{"CCC"," S "," S ", 'C', ingotCopper, 'S', Items.stick});

 

GameRegistry.addRecipe(new ItemStack(rodIronBlackened, 4), new Object[]{"I", "I", 'I', ingotIronBlackened});

 

GameRegistry.addRecipe(new ItemStack(rodIron, 4), new Object[]{"I", "I", 'I', Items.iron_ingot});

 

GameRegistry.addRecipe(new ItemStack(copperBoots, 1), new Object[]{"C C", "C C", 'C', ingotCopper});

 

GameRegistry.addRecipe(new ItemStack(copperLeggings, 1), new Object[]{"CCC", "C C", "C C", 'C', ingotCopper});

 

GameRegistry.addRecipe(new ItemStack(copperChestplate, 1), new Object[]{"C C", "CCC", "CCC", 'C', ingotCopper});

 

GameRegistry.addRecipe(new ItemStack(copperHelmet, 1), new Object[]{"CCC", "C C", 'C', ingotCopper});

 

GameRegistry.addShapelessRecipe(new ItemStack(ingotIronBlackened, 1), new Object[] {new ItemStack(Items.iron_ingot, 1), new ItemStack(Items.coal, 1)});

 

 

//Smelting Recipes

GameRegistry.addSmelting(oreCopper, new ItemStack(ingotCopper), 2.50F);

 

}

}

 

 

 

I know that I'm not completely done, as I am following a tutorial and have not finished yet, but it should at least open without the texture, according to the tutorial.

 

Sorry about all the posts, I'm new to modding.

 

EDIT: Wow, I didn't set canInteractWith to true, I just did, but it still won't work :/

Currently developing the More Metals Mod.

Posted

public boolean onBlockAcitvated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){
      if(!world.isRemote){
         FMLNetworkHandler.openGui(player, MoreMetalsMod.instance, MoreMetalsMod.guiIDRefueler, world, x, y, z);
      }   
      return true;
   }

It says onBlockAcitvated, not onBlockActivated. And, once changing it, you may or may not need to add @Override.

 

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

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.