2013-09-11 06:22:16 +02:00
|
|
|
package StevenDimDoors.mod_pocketDim.items;
|
2013-09-10 10:32:19 +02:00
|
|
|
|
|
|
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.block.material.Material;
|
|
|
|
import net.minecraft.client.renderer.texture.IconRegister;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.item.ItemDoor;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.MathHelper;
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
|
|
|
public class ItemGoldDoor extends ItemDoor
|
|
|
|
{
|
|
|
|
|
|
|
|
public ItemGoldDoor(int par1, Material par2Material)
|
|
|
|
{
|
|
|
|
super(par1, par2Material);
|
|
|
|
// TODO Auto-generated constructor stub
|
|
|
|
}
|
|
|
|
|
|
|
|
public void registerIcons(IconRegister par1IconRegister)
|
|
|
|
{
|
|
|
|
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
|
|
|
{
|
|
|
|
if (par7 != 1)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
++par5;
|
|
|
|
Block block = mod_pocketDim.goldDoor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack))
|
|
|
|
{
|
|
|
|
if (!block.canPlaceBlockAt(par3World, par4, par5, par6))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int i1 = MathHelper.floor_double((double)((par2EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
|
|
|
|
placeDoorBlock(par3World, par4, par5, par6, i1, block);
|
|
|
|
--par1ItemStack.stackSize;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|