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;
|
|
|
|
|
2013-04-17 02:48:49 +02:00
|
|
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
|
|
|
|
2013-02-18 03:46:16 +01:00
|
|
|
import net.minecraft.block.Block;
|
2013-04-06 22:57:51 +02:00
|
|
|
import net.minecraft.block.BlockContainer;
|
2013-02-18 03:46:16 +01:00
|
|
|
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.creativetab.CreativeTabs;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2013-04-06 22:57:51 +02:00
|
|
|
import net.minecraft.item.Item;
|
2013-02-18 03:46:16 +01:00
|
|
|
import net.minecraft.item.ItemBlock;
|
2013-04-06 22:57:51 +02:00
|
|
|
import net.minecraft.item.ItemStack;
|
2013-02-18 03:46:16 +01:00
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
|
|
|
public class BlockDimWall extends Block
|
|
|
|
{
|
|
|
|
|
2013-04-17 02:48:49 +02:00
|
|
|
public BlockDimWall(int i, int j, Material par2Material)
|
2013-02-18 03:46:16 +01:00
|
|
|
{
|
2013-03-29 23:19:27 +01:00
|
|
|
super(i, Material.ground);
|
2013-02-18 03:46:16 +01:00
|
|
|
setTickRandomly(true);
|
|
|
|
this.setCreativeTab(CreativeTabs.tabBlock);
|
2013-03-29 23:19:27 +01:00
|
|
|
|
2013-02-18 03:46:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2013-03-29 23:19:27 +01:00
|
|
|
|
|
|
|
public void registerIcons(IconRegister par1IconRegister)
|
|
|
|
{
|
|
|
|
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2());
|
|
|
|
}
|
|
|
|
|
2013-02-18 03:46:16 +01:00
|
|
|
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {}
|
|
|
|
|
2013-04-17 02:48:49 +02:00
|
|
|
protected boolean canSilkHarvest()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-02-18 03:46:16 +01:00
|
|
|
public int quantityDropped(Random par1Random)
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* replaces the block clicked with the held block, instead of placing the block on top of it. Shift click to disable.
|
|
|
|
*/
|
|
|
|
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
|
|
|
|
{
|
2013-05-04 01:34:01 +02:00
|
|
|
if(entityPlayer.getCurrentEquippedItem()!=null)
|
2013-02-18 03:46:16 +01:00
|
|
|
{
|
2013-04-06 22:57:51 +02:00
|
|
|
Item playerEquip = entityPlayer.getCurrentEquippedItem().getItem();
|
|
|
|
|
|
|
|
if(!(playerEquip instanceof ItemBlock))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Block block= Block.blocksList[playerEquip.itemID];
|
|
|
|
if(!Block.isNormalCube(playerEquip.itemID))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if(block instanceof BlockContainer)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-18 03:46:16 +01:00
|
|
|
|
|
|
|
if(entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemBlock)
|
|
|
|
{
|
2013-05-04 01:34:01 +02:00
|
|
|
if(par1World.isRemote)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2013-04-06 22:57:51 +02:00
|
|
|
|
2013-02-18 03:46:16 +01:00
|
|
|
if(!entityPlayer.capabilities.isCreativeMode)
|
|
|
|
{
|
|
|
|
entityPlayer.getCurrentEquippedItem().stackSize--;
|
|
|
|
}
|
2013-03-29 23:19:27 +01:00
|
|
|
par1World.setBlock(par2, par3, par4, entityPlayer.getCurrentEquippedItem().itemID, entityPlayer.getCurrentEquippedItem().getItemDamage(),0);
|
2013-02-18 03:46:16 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2013-04-06 22:57:51 +02:00
|
|
|
else
|
2013-02-18 03:46:16 +01:00
|
|
|
{
|
2013-04-06 22:57:51 +02:00
|
|
|
return false;
|
2013-02-18 03:46:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|