2013-08-16 13:51:33 -07:00
|
|
|
package tconstruct.items.blocks;
|
|
|
|
|
|
2013-12-19 08:15:16 -05:00
|
|
|
import mantle.blocks.abstracts.MultiItemBlock;
|
2013-08-16 13:51:33 -07:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2013-12-31 15:30:34 -05:00
|
|
|
import net.minecraft.init.Blocks;
|
2013-08-16 13:51:33 -07:00
|
|
|
import net.minecraft.item.ItemDye;
|
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
|
2013-12-19 08:15:16 -05:00
|
|
|
public class WoolSlab1Item extends MultiItemBlock
|
2013-08-16 13:51:33 -07:00
|
|
|
{
|
|
|
|
|
Block block;
|
|
|
|
|
|
2013-12-31 15:30:34 -05:00
|
|
|
public WoolSlab1Item(Block b)
|
2013-08-16 13:51:33 -07:00
|
|
|
{
|
2013-12-31 15:30:34 -05:00
|
|
|
super(b, "", "slab", ItemDye.dyeColorNames);
|
2013-12-19 08:15:16 -05:00
|
|
|
this.setSpecialIndex(7, 15);
|
2014-01-09 04:08:38 -05:00
|
|
|
this.block = b;
|
2013-08-16 13:51:33 -07:00
|
|
|
setMaxDamage(0);
|
|
|
|
|
setHasSubtypes(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
|
|
|
|
{
|
2014-01-15 00:34:19 -05:00
|
|
|
int id = world.getBlock(x, y, z);
|
2013-08-16 13:51:33 -07:00
|
|
|
int meta = world.getBlockMetadata(x, y, z);
|
|
|
|
|
int trueMeta = meta % 8;
|
|
|
|
|
boolean flag = (id & 8) != 0;
|
|
|
|
|
|
2014-01-09 04:08:38 -05:00
|
|
|
if ((side == 1 && flag || side == 0 && !flag) && id == this && trueMeta == stack.getItemDamage())
|
2013-08-16 13:51:33 -07:00
|
|
|
{
|
2014-01-16 01:36:18 -05:00
|
|
|
if (world.func_147465_d(x, y, z, Blocks.wool, trueMeta, 3))
|
2013-08-16 13:51:33 -07:00
|
|
|
{
|
2014-01-29 00:41:17 -05:00
|
|
|
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), this.block.field_149762_H.getPlaceSound(),
|
|
|
|
|
(this.block.field_149762_H.getVolume() + 1.0F) / 2.0F, this.block.field_149762_H.getPitch() * 0.8F);
|
2013-08-16 13:51:33 -07:00
|
|
|
--stack.stackSize;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return super.onItemUse(stack, player, world, x, y, z, side, hitX, hitY, hitZ);
|
|
|
|
|
}
|
|
|
|
|
}
|