Fix block rods consuming the rod

This commit is contained in:
Vincent Lee committed 2017-01-09 13:39:24 -06:00
1 parent af13e55dc5
commit ec8bcfcc2e
2 files changed
+7 -2

No files matched your search

@@ -61,14 +61,17 @@ public class ItemDirtRod extends ItemMod implements IManaUsingItem, ICraftAchiev
return place(player, world, pos, hand, side, par8, par9, par10, Blocks.DIRT, COST, 0.35F, 0.2F, 0.05F);
}
public static EnumActionResult place(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float par8, float par9, float par10, Block block, int cost, float r, float g, float b) {
public static EnumActionResult place(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ, Block block, int cost, float r, float g, float b) {
ItemStack stack = player.getHeldItem(hand);
if(ManaItemHandler.requestManaExactForTool(stack, player, cost, false)) {
int entities = world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(pos.offset(side), pos.offset(side).add(1, 1, 1))).size();
if(entities == 0) {
ItemStack stackToPlace = new ItemStack(block);
stackToPlace.onItemUse(player, world, pos, hand, side, par8, par9, par10);
player.setHeldItem(hand, stackToPlace);
stackToPlace.onItemUse(player, world, pos, hand, side, hitX, hitY, hitZ);
player.setHeldItem(hand, stack);
if(stackToPlace.isEmpty()) {
ManaItemHandler.requestManaExactForTool(stack, player, cost, true);
@@ -52,7 +52,9 @@ public class ItemSkyDirtRod extends ItemDirtRod {
if(entities == 0) {
ItemStack stackToPlace = new ItemStack(Blocks.DIRT);
player.setHeldItem(hand, stackToPlace);
stackToPlace.onItemUse(player, world, new BlockPos(x, y, z), hand, EnumFacing.DOWN, 0F, 0F, 0F);
player.setHeldItem(hand, stack);
if(stackToPlace.isEmpty()) {
ManaItemHandler.requestManaExactForTool(stack, player, COST * 2, true);