More progress
This commit is contained in:
parent
00d6f8eb46
commit
d80afb18f0
64 changed files with 410 additions and 976 deletions
|
@ -17,8 +17,8 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
|
||||
public class ItemSigilLava extends ItemSigilBase
|
||||
{
|
||||
|
@ -28,8 +28,9 @@ public class ItemSigilLava extends ItemSigilBase
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return ActionResult.newResult(EnumActionResult.FAIL, stack);
|
||||
|
||||
|
@ -49,35 +50,36 @@ public class ItemSigilLava extends ItemSigilBase
|
|||
|
||||
if (!world.isBlockModifiable(player, blockpos))
|
||||
{
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
if (!player.canPlayerEdit(blockpos.offset(rayTrace.sideHit), rayTrace.sideHit, stack))
|
||||
{
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
BlockPos blockpos1 = blockpos.offset(rayTrace.sideHit);
|
||||
|
||||
if (!player.canPlayerEdit(blockpos1, rayTrace.sideHit, stack))
|
||||
{
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
if (this.canPlaceLava(world, blockpos1) && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()) && this.tryPlaceLava(world, blockpos1))
|
||||
{
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos blockPos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (world.isRemote || player.isSneaking() || isUnusable(stack))
|
||||
{
|
||||
return EnumActionResult.FAIL;
|
||||
|
@ -88,14 +90,15 @@ public class ItemSigilLava extends ItemSigilBase
|
|||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
if (tile instanceof IFluidHandler)
|
||||
if (tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side))
|
||||
{
|
||||
IFluidHandler handler = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side);
|
||||
FluidStack fluid = new FluidStack(FluidRegistry.LAVA, 1000);
|
||||
int amount = ((IFluidHandler) tile).fill(side, fluid, false);
|
||||
int amount = handler.fill(fluid, false);
|
||||
|
||||
if (amount > 0 && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()))
|
||||
{
|
||||
((IFluidHandler) tile).fill(side, fluid, true);
|
||||
handler.fill(fluid, true);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue