Jump to content

Recommended Posts

Posted

OK so, I am having a few errors with the "setDefaultDirection" in my furnace class... I looked at a bunch of tutorials and found nothing. If its something very basic that i didn't spot, then I'm sorry...

 

package electro.blocks;

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.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electro.lib.Referance;
import electro.mod.Electrocuted;

public class CompressionFurnace extends BlockContainer {

private final boolean isActive;

@SideOnly(Side.CLIENT)
private IIcon iconFront;


public CompressionFurnace(boolean isActive) {
	super(Material.rock);
	this.setCreativeTab(Electrocuted.ElectrocutedTab);

	this.isActive = isActive;
}

@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister) {
	this.blockIcon = iconRegister.registerIcon(Referance.MODID + ":" + "CompressionFurnace_side");
	this.iconFront = iconRegister.registerIcon(Referance.MODID + ":" + (this.isActive ? "CompressionFurnace_Active_front" : "CompressionFurnace_Idle_front"));
}

@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
	return side == metadata ? this.iconFront : this.blockIcon;

}
public int idDropped(int par1, int par3) {
	return getIdFromBlock(Electrocuted.CompressionFurnaceIdle);
}

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) {
		 int l1;
		 int l2;
		 int l3;
		 int l4;
		 byte b1 = 3;

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

	}

}

}

The problem is that there is no world.getBlockID or Block.opaqueCubeLookup[] method. I don't know is it the new forge or am i doing something wrong. Any help would be great! :D

If I helped then you help, hit that Thank You button or Applaud.

Posted

setDefaultDirection:

 

if u do something like a furnace. there is already a furnace in the game. just look  at the code and copy it. mess with it around until u know how it works.

 

taken from the BlockFurnace.class:

    private void func_149930_e(World p_149930_1_, int p_149930_2_, int p_149930_3_, int p_149930_4_)
    {
        if (!p_149930_1_.isRemote)
        {
            Block block = p_149930_1_.getBlock(p_149930_2_, p_149930_3_, p_149930_4_ - 1);
            Block block1 = p_149930_1_.getBlock(p_149930_2_, p_149930_3_, p_149930_4_ + 1);
            Block block2 = p_149930_1_.getBlock(p_149930_2_ - 1, p_149930_3_, p_149930_4_);
            Block block3 = p_149930_1_.getBlock(p_149930_2_ + 1, p_149930_3_, p_149930_4_);
            byte b0 = 3;

            if (block.func_149730_j() && !block1.func_149730_j())
            {
                b0 = 3;
            }

            if (block1.func_149730_j() && !block.func_149730_j())
            {
                b0 = 2;
            }

            if (block2.func_149730_j() && !block3.func_149730_j())
            {
                b0 = 5;
            }

            if (block3.func_149730_j() && !block2.func_149730_j())
            {
                b0 = 4;
            }

            p_149930_1_.setBlockMetadataWithNotify(p_149930_2_, p_149930_3_, p_149930_4_, b0, 2);
        }
    }

*********************************

**  Always remember you are unique,  **

**  just like everyone else                   **     

**********************************

Was my post helpful? Say thanks and

press the thank you button, on my post!!

God, damn it!

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.