2013-04-17 02:48:49 +02:00
|
|
|
package StevenDimDoors.mod_pocketDim.blocks;
|
2013-02-18 03:46:16 +01:00
|
|
|
|
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
import net.minecraft.block.material.Material;
|
2013-03-29 23:19:27 +01:00
|
|
|
import net.minecraft.client.renderer.texture.IconRegister;
|
2013-02-18 03:46:16 +01:00
|
|
|
import net.minecraft.item.Item;
|
2013-03-29 23:19:27 +01:00
|
|
|
import net.minecraft.util.Icon;
|
|
|
|
import net.minecraft.world.IBlockAccess;
|
2013-02-18 03:46:16 +01:00
|
|
|
import net.minecraft.world.World;
|
2013-08-29 08:14:24 +02:00
|
|
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
|
|
|
import StevenDimDoors.mod_pocketDim.core.IDimLink;
|
|
|
|
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
|
|
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2013-02-18 03:46:16 +01:00
|
|
|
|
2013-08-31 22:43:18 +02:00
|
|
|
public class WarpDoor extends DimensionalDoor
|
2013-02-18 03:46:16 +01:00
|
|
|
{
|
2013-03-29 23:19:27 +01:00
|
|
|
private Icon blockIconBottom;
|
2013-02-18 03:46:16 +01:00
|
|
|
|
2013-08-31 22:43:18 +02:00
|
|
|
public WarpDoor(int blockID, Material material)
|
2013-08-29 08:14:24 +02:00
|
|
|
{
|
|
|
|
super(blockID, material);
|
2013-02-18 03:46:16 +01:00
|
|
|
}
|
2013-03-29 23:19:27 +01:00
|
|
|
|
|
|
|
public void registerIcons(IconRegister par1IconRegister)
|
2013-02-18 03:46:16 +01:00
|
|
|
{
|
2013-08-29 08:14:24 +02:00
|
|
|
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()+"_top");
|
|
|
|
this.blockIconBottom = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()+"_bottom");
|
|
|
|
}
|
2013-02-18 03:46:16 +01:00
|
|
|
|
2013-08-29 08:14:24 +02:00
|
|
|
@Override
|
|
|
|
public void onBlockAdded(World world, int x, int y, int z)
|
|
|
|
{
|
|
|
|
//FIXME: We need to set door generation flags on the tile entities. Ignoring that for now. ~SenseiKiwi
|
2013-02-18 03:46:16 +01:00
|
|
|
|
2013-08-29 08:14:24 +02:00
|
|
|
if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID)
|
|
|
|
{
|
|
|
|
NewDimData dimension = PocketManager.getDimensionData(world);
|
|
|
|
IDimLink link = dimension.getLink(x, y, z);
|
|
|
|
if (link == null)
|
2013-02-18 03:46:16 +01:00
|
|
|
{
|
2013-08-29 08:14:24 +02:00
|
|
|
dimension.createLink(x, y, z).setLinkType(IDimLink.TYPE_SAFE_EXIT);
|
2013-02-18 03:46:16 +01:00
|
|
|
}
|
|
|
|
}
|
2013-08-29 08:14:24 +02:00
|
|
|
world.setBlockTileEntity(x, y, z, this.createNewTileEntity(world));
|
2013-02-18 03:46:16 +01:00
|
|
|
}
|
2013-08-29 08:14:24 +02:00
|
|
|
|
2013-03-29 23:19:27 +01:00
|
|
|
@SideOnly(Side.CLIENT)
|
2013-08-29 08:14:24 +02:00
|
|
|
/**
|
|
|
|
* Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side
|
|
|
|
*/
|
|
|
|
public Icon getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
|
|
|
{
|
|
|
|
if(par1IBlockAccess.getBlockId(par2, par3-1, par4)==this.blockID)
|
|
|
|
{
|
|
|
|
return this.blockIcon;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return this.blockIconBottom;
|
|
|
|
}
|
|
|
|
}
|
2013-03-29 23:19:27 +01:00
|
|
|
|
2013-08-29 08:14:24 +02:00
|
|
|
public int idPicked(World par1World, int par2, int par3, int par4)
|
|
|
|
{
|
|
|
|
return Item.doorWood.itemID;
|
|
|
|
}
|
2013-02-18 03:46:16 +01:00
|
|
|
|
2013-08-29 08:14:24 +02:00
|
|
|
public int idDropped(int par1, Random par2Random, int par3)
|
|
|
|
{
|
|
|
|
return (par1 & 8) != 0 ? 0 : (Item.doorWood.itemID);
|
|
|
|
}
|
2013-02-18 03:46:16 +01:00
|
|
|
}
|