Sigils (257 errors)

This commit is contained in:
WayofTime 2016-03-18 15:38:26 -04:00
parent d05d3b90df
commit f95949a1c8
14 changed files with 150 additions and 140 deletions

View file

@ -1,20 +1,25 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import net.minecraft.block.BlockCauldron;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import WayofTime.bloodmagic.api.Constants;
public class ItemSigilWater extends ItemSigilBase
{
@ -25,52 +30,50 @@ public class ItemSigilWater extends ItemSigilBase
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
{
if (!world.isRemote && !isUnusable(stack))
{
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, false);
RayTraceResult movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, false);
if (movingobjectposition != null)
{
ItemStack ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(player, world, stack, movingobjectposition);
ActionResult<ItemStack> ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(player, world, stack, movingobjectposition);
if (ret != null)
return ret;
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
if (movingobjectposition.typeOfHit == RayTraceResult.Type.BLOCK)
{
BlockPos blockpos = movingobjectposition.getBlockPos();
if (!world.isBlockModifiable(player, blockpos))
return stack;
return super.onItemRightClick(stack, world, player, hand);
if (!player.canPlayerEdit(blockpos.offset(movingobjectposition.sideHit), movingobjectposition.sideHit, stack))
return stack;
return super.onItemRightClick(stack, world, player, hand);
BlockPos blockpos1 = blockpos.offset(movingobjectposition.sideHit);
if (!player.canPlayerEdit(blockpos1, movingobjectposition.sideHit, stack))
return stack;
return super.onItemRightClick(stack, world, player, hand);
if (this.canPlaceWater(world, blockpos1) && syphonNetwork(stack, player, getLPUsed()) && this.tryPlaceWater(world, blockpos1))
return stack;
return super.onItemRightClick(stack, world, player, hand);
}
}
}
return stack;
return super.onItemRightClick(stack, world, player, hand);
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ)
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
super.onItemUse(stack, player, world, blockPos, side, hitX, hitY, hitZ);
if (world.isRemote || player.isSneaking() || isUnusable(stack))
return false;
return EnumActionResult.FAIL;
if (!world.canMineBlockBody(player, blockPos))
return false;
return EnumActionResult.FAIL;
TileEntity tile = world.getTileEntity(blockPos);
if (tile instanceof IFluidHandler)
@ -80,22 +83,22 @@ public class ItemSigilWater extends ItemSigilBase
if (amount > 0 && syphonNetwork(stack, player, getLPUsed()))
((IFluidHandler) tile).fill(side, fluid, true);
return false;
return EnumActionResult.FAIL;
}
if (world.getBlockState(blockPos).getBlock() == Blocks.cauldron && syphonNetwork(stack, player, getLPUsed()))
{
world.setBlockState(blockPos, Blocks.cauldron.getDefaultState().withProperty(BlockCauldron.LEVEL, 3));
return true;
return EnumActionResult.SUCCESS;
}
BlockPos newPos = blockPos.offset(side);
return player.canPlayerEdit(newPos, side, stack) && this.canPlaceWater(world, newPos) && syphonNetwork(stack, player, getLPUsed()) && this.tryPlaceWater(world, newPos);
return (player.canPlayerEdit(newPos, side, stack) && this.canPlaceWater(world, newPos) && syphonNetwork(stack, player, getLPUsed()) && this.tryPlaceWater(world, newPos)) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
}
public boolean canPlaceWater(World world, BlockPos blockPos)
{
if (!world.isAirBlock(blockPos) && world.getBlockState(blockPos).getBlock().getMaterial().isSolid())
if (!world.isAirBlock(blockPos) && world.getBlockState(blockPos).getBlock().getMaterial(world.getBlockState(blockPos)).isSolid())
return false;
else if ((world.getBlockState(blockPos).getBlock() == Blocks.water || world.getBlockState(blockPos).getBlock() == Blocks.flowing_water) && world.getBlockState(blockPos).getBlock().getMetaFromState(world.getBlockState(blockPos)) == 0)
return false;
@ -106,7 +109,7 @@ public class ItemSigilWater extends ItemSigilBase
public boolean tryPlaceWater(World worldIn, BlockPos pos)
{
Material material = worldIn.getBlockState(pos).getBlock().getMaterial();
Material material = worldIn.getBlockState(pos).getBlock().getMaterial(worldIn.getBlockState(pos));
boolean notSolid = !material.isSolid();
if (!worldIn.isAirBlock(pos) && !notSolid)
@ -119,7 +122,7 @@ public class ItemSigilWater extends ItemSigilBase
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
worldIn.playSoundEffect((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);
worldIn.playSound((EntityPlayer) null, i, j, k, SoundEvents.block_fire_extinguish, SoundCategory.BLOCKS, 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);
for (int l = 0; l < 8; ++l)
worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D, 0);