2015-11-22 14:03:51 -08:00
|
|
|
package WayofTime.bloodmagic.block;
|
|
|
|
|
|
|
|
import net.minecraft.block.material.Material;
|
|
|
|
import net.minecraft.block.state.IBlockState;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2016-03-18 13:16:38 -04:00
|
|
|
import net.minecraft.item.ItemStack;
|
2015-11-22 14:03:51 -08:00
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2016-03-18 13:16:38 -04:00
|
|
|
import net.minecraft.util.EnumBlockRenderType;
|
2015-11-22 14:03:51 -08:00
|
|
|
import net.minecraft.util.EnumFacing;
|
2016-03-18 13:16:38 -04:00
|
|
|
import net.minecraft.util.EnumHand;
|
|
|
|
import net.minecraft.util.math.BlockPos;
|
2015-11-22 14:03:51 -08:00
|
|
|
import net.minecraft.world.IBlockAccess;
|
|
|
|
import net.minecraft.world.World;
|
2016-03-18 13:16:38 -04:00
|
|
|
import WayofTime.bloodmagic.BloodMagic;
|
|
|
|
import WayofTime.bloodmagic.api.Constants;
|
|
|
|
import WayofTime.bloodmagic.block.base.BlockStringContainer;
|
|
|
|
import WayofTime.bloodmagic.tile.TilePlinth;
|
|
|
|
import WayofTime.bloodmagic.util.Utils;
|
2015-11-22 14:03:51 -08:00
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
public class BlockPedestal extends BlockStringContainer
|
|
|
|
{
|
|
|
|
public static String[] names = { "pedestal", "plinth" };
|
2015-11-22 14:03:51 -08:00
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
public BlockPedestal()
|
|
|
|
{
|
2016-04-24 10:06:28 -07:00
|
|
|
super(Material.ROCK, names);
|
2015-11-22 14:03:51 -08:00
|
|
|
|
2015-11-28 18:25:46 -08:00
|
|
|
setUnlocalizedName(Constants.Mod.MODID + ".");
|
2015-11-22 14:03:51 -08:00
|
|
|
setCreativeTab(BloodMagic.tabBloodMagic);
|
|
|
|
setHardness(2.0F);
|
|
|
|
setResistance(5.0F);
|
|
|
|
}
|
|
|
|
|
2016-03-22 09:31:47 -04:00
|
|
|
@Override
|
|
|
|
public boolean isOpaqueCube(IBlockState state)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-11-22 14:03:51 -08:00
|
|
|
@Override
|
2016-03-18 13:16:38 -04:00
|
|
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
2015-12-30 15:34:40 -05:00
|
|
|
{
|
|
|
|
switch (getMetaFromState(state))
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
// TileEntity plinth = world.getTileEntity(pos);
|
|
|
|
//
|
|
|
|
// if (plinth!= null && plinth instanceof TilePlinth) {
|
|
|
|
// Utils.insertItemToTile((TilePlinth) plinth, player);
|
|
|
|
// }
|
|
|
|
}
|
2015-11-22 14:03:51 -08:00
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
TileEntity plinth = world.getTileEntity(pos);
|
2015-11-22 14:03:51 -08:00
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
if (plinth == null || player.isSneaking())
|
|
|
|
return false;
|
2015-11-22 14:03:51 -08:00
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
if (plinth instanceof TilePlinth)
|
|
|
|
{
|
|
|
|
Utils.insertItemToTile((TilePlinth) plinth, player);
|
|
|
|
return true;
|
2015-11-22 14:03:51 -08:00
|
|
|
}
|
|
|
|
}
|
2015-12-30 15:34:40 -05:00
|
|
|
}
|
2015-11-22 14:03:51 -08:00
|
|
|
|
2016-03-18 13:16:38 -04:00
|
|
|
world.notifyBlockUpdate(pos, state, state, 3);
|
2015-11-22 14:03:51 -08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-03-18 13:16:38 -04:00
|
|
|
// @Override
|
|
|
|
// public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, BlockPos pos)
|
|
|
|
// {
|
|
|
|
// IBlockState state = blockAccess.getBlockState(pos);
|
|
|
|
//
|
|
|
|
// if (getMetaFromState(state) == 0)
|
|
|
|
// setBlockBounds(0.5F - 0.3125F, 0.0F, 0.5F - 0.3125F, 0.5F + 0.3125F, 0.6F, 0.5F + 0.3125F);
|
|
|
|
// else if (getMetaFromState(state) == 1)
|
|
|
|
// setBlockBounds(0.1F, 0.0F, 0.1F, 1.0F - 0.1F, 0.8F, 1.0F - 0.1F);
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
|
2015-11-22 14:03:51 -08:00
|
|
|
@Override
|
2016-03-18 13:16:38 -04:00
|
|
|
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
|
2015-12-30 15:34:40 -05:00
|
|
|
{
|
2016-03-18 13:16:38 -04:00
|
|
|
return false;
|
2015-11-22 14:03:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-03-18 13:16:38 -04:00
|
|
|
public boolean isFullCube(IBlockState state)
|
2015-12-30 15:34:40 -05:00
|
|
|
{
|
2015-11-22 14:03:51 -08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-03-18 13:16:38 -04:00
|
|
|
public boolean isVisuallyOpaque()
|
2015-12-30 15:34:40 -05:00
|
|
|
{
|
2015-11-22 14:03:51 -08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-03-18 13:16:38 -04:00
|
|
|
@Override
|
|
|
|
public EnumBlockRenderType getRenderType(IBlockState state)
|
|
|
|
{
|
|
|
|
return EnumBlockRenderType.MODEL;
|
|
|
|
}
|
|
|
|
|
2015-11-22 14:03:51 -08:00
|
|
|
@Override
|
2015-12-30 15:34:40 -05:00
|
|
|
public TileEntity createNewTileEntity(World world, int meta)
|
|
|
|
{
|
2015-11-22 14:03:51 -08:00
|
|
|
return meta == 0 ? null : new TilePlinth();
|
|
|
|
}
|
|
|
|
}
|