Items (27 errors)

This commit is contained in:
WayofTime 2016-03-18 16:50:33 -04:00
parent 000c4c5692
commit ac3ac8d272
11 changed files with 146 additions and 112 deletions

View file

@ -4,10 +4,14 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -52,15 +56,15 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP
} }
@Override @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) if (world.isRemote)
return stack; return super.onItemRightClick(stack, world, player, hand);
if (!player.capabilities.isCreativeMode) if (!player.capabilities.isCreativeMode)
{ {
ChatUtil.sendNoSpam(player, TextHelper.localizeEffect("chat.BloodMagic.altarMaker.creativeOnly")); ChatUtil.sendNoSpam(player, TextHelper.localizeEffect("chat.BloodMagic.altarMaker.creativeOnly"));
return stack; return super.onItemRightClick(stack, world, player, hand);
} }
stack = NBTHelper.checkNBT(stack); stack = NBTHelper.checkNBT(stack);
@ -74,22 +78,23 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP
setTierToBuild(EnumAltarTier.values()[stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER)]); setTierToBuild(EnumAltarTier.values()[stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER)]);
ChatUtil.sendNoSpam(player, TextHelper.localizeEffect("chat.BloodMagic.altarMaker.setTier", stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1)); ChatUtil.sendNoSpam(player, TextHelper.localizeEffect("chat.BloodMagic.altarMaker.setTier", stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1));
return stack; return super.onItemRightClick(stack, world, player, hand);
} }
MovingObjectPosition mop = getMovingObjectPositionFromPlayer(world, player, false); RayTraceResult mop = getMovingObjectPositionFromPlayer(world, player, false);
if (mop == null || mop.typeOfHit == MovingObjectPosition.MovingObjectType.MISS || mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) if (mop == null || mop.typeOfHit == RayTraceResult.Type.MISS || mop.typeOfHit == RayTraceResult.Type.ENTITY)
return stack; return super.onItemRightClick(stack, world, player, hand);
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && world.getBlockState(mop.getBlockPos()).getBlock() instanceof BlockAltar) if (mop.typeOfHit == RayTraceResult.Type.BLOCK && world.getBlockState(mop.getBlockPos()).getBlock() instanceof BlockAltar)
{ {
ChatUtil.sendNoSpam(player, TextHelper.localizeEffect("chat.BloodMagic.altarMaker.building", tierToBuild)); ChatUtil.sendNoSpam(player, TextHelper.localizeEffect("chat.BloodMagic.altarMaker.building", tierToBuild));
buildAltar(world, mop.getBlockPos()); buildAltar(world, mop.getBlockPos());
IBlockState state = world.getBlockState(mop.getBlockPos());
world.markBlockForUpdate(mop.getBlockPos()); world.notifyBlockUpdate(mop.getBlockPos(), state, state, 3);
} }
return stack; return super.onItemRightClick(stack, world, player, hand);
} }
@Override @Override
@ -130,8 +135,9 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP
if (world.isRemote) if (world.isRemote)
return ""; return "";
MovingObjectPosition mop = getMovingObjectPositionFromPlayer(world, player, false); RayTraceResult mop = getMovingObjectPositionFromPlayer(world, player, false);
BlockPos pos = mop.getBlockPos(); BlockPos pos = mop.getBlockPos();
IBlockState state = world.getBlockState(pos);
EnumAltarTier altarTier = BloodAltar.getAltarTier(world, pos); EnumAltarTier altarTier = BloodAltar.getAltarTier(world, pos);
if (altarTier.equals(EnumAltarTier.ONE)) if (altarTier.equals(EnumAltarTier.ONE))
@ -141,13 +147,14 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP
for (AltarComponent altarComponent : altarTier.getAltarComponents()) for (AltarComponent altarComponent : altarTier.getAltarComponents())
{ {
BlockPos componentPos = pos.add(altarComponent.getOffset()); BlockPos componentPos = pos.add(altarComponent.getOffset());
IBlockState componentState = world.getBlockState(pos);
world.setBlockToAir(componentPos); world.setBlockToAir(componentPos);
world.markBlockForUpdate(componentPos); world.notifyBlockUpdate(componentPos, componentState, componentState, 3);
} }
} }
world.markBlockForUpdate(pos); world.notifyBlockUpdate(pos, state, state, 3);
return String.valueOf(altarTier.toInt()); return String.valueOf(altarTier.toInt());
} }
} }

View file

@ -6,7 +6,9 @@ import java.util.List;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
@ -40,7 +42,7 @@ public class ItemArcaneAshes extends Item implements IVariantProvider
} }
@Override @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)
{ {
BlockPos newPos = blockPos.offset(side); BlockPos newPos = blockPos.offset(side);
@ -52,10 +54,10 @@ public class ItemArcaneAshes extends Item implements IVariantProvider
stack.damageItem(1, player); stack.damageItem(1, player);
} }
return true; return EnumActionResult.SUCCESS;
} }
return false; return EnumActionResult.FAIL;
} }
@Override @Override

View file

@ -1,5 +1,14 @@
package WayofTime.bloodmagic.item; package WayofTime.bloodmagic.item;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.SoundCategory;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.BloodMagicAPI; import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.Constants; import WayofTime.bloodmagic.api.Constants;
@ -9,14 +18,8 @@ import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper; import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper; import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import WayofTime.bloodmagic.util.helper.TextHelper; import WayofTime.bloodmagic.util.helper.TextHelper;
import com.google.common.base.Strings;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List; import com.google.common.base.Strings;
public class ItemBindable extends Item implements IBindable public class ItemBindable extends Item implements IBindable
{ {
@ -64,12 +67,8 @@ public class ItemBindable extends Item implements IBindable
} else } else
{ {
double posX = player.posX;
double posY = player.posY;
double posZ = player.posZ;
// SpellHelper.sendIndexedParticleToAllAround(player.worldObj, posX,posY, posZ, 20, player.worldObj.provider.getDimensionId(), 4, posX, posY, posZ); // SpellHelper.sendIndexedParticleToAllAround(player.worldObj, posX,posY, posZ, 20, player.worldObj.provider.getDimensionId(), 4, posX, posY, posZ);
player.worldObj.playSoundEffect((double) ((float) posX + 0.5F), (double) ((float) posY + 0.5F), (double) ((float) posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.8F); player.worldObj.playSound((EntityPlayer) null, player.posX, player.posY, player.posZ, SoundEvents.block_fire_extinguish, SoundCategory.BLOCKS, 0.5F, 2.6F + (player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.8F);
} }
return true; return true;
} }

View file

@ -1,5 +1,18 @@
package WayofTime.bloodmagic.item; package WayofTime.bloodmagic.item;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.api.Constants; import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.iface.IBindable; import WayofTime.bloodmagic.api.iface.IBindable;
import WayofTime.bloodmagic.api.orb.BloodOrb; import WayofTime.bloodmagic.api.orb.BloodOrb;
@ -8,16 +21,8 @@ import WayofTime.bloodmagic.api.registry.OrbRegistry;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper; import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper; import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import WayofTime.bloodmagic.util.helper.TextHelper; import WayofTime.bloodmagic.util.helper.TextHelper;
import com.google.common.base.Strings;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List; import com.google.common.base.Strings;
public class ItemBloodOrb extends ItemBindable implements IBloodOrb, IBindable public class ItemBloodOrb extends ItemBindable implements IBloodOrb, IBindable
{ {
@ -43,38 +48,38 @@ public class ItemBloodOrb extends ItemBindable implements IBloodOrb, IBindable
} }
@Override @Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
{ {
if (world == null) if (world == null)
return stack; return super.onItemRightClick(stack, world, player, hand);
double posX = player.posX; double posX = player.posX;
double posY = player.posY; double posY = player.posY;
double posZ = player.posZ; double posZ = player.posZ;
world.playSoundEffect((double) ((float) posX + 0.5F), (double) ((float) posY + 0.5F), (double) ((float) posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F); world.playSound((EntityPlayer) null, player.posX, player.posY, player.posZ, SoundEvents.block_fire_extinguish, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
// SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ, // SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ,
// 20, world.provider.getDimensionId(), 4, posX, posY, posZ); // 20, world.provider.getDimensionId(), 4, posX, posY, posZ);
if (PlayerHelper.isFakePlayer(player)) if (PlayerHelper.isFakePlayer(player))
return stack; return super.onItemRightClick(stack, world, player, hand);
if (!stack.hasTagCompound()) if (!stack.hasTagCompound())
{ {
return stack; return super.onItemRightClick(stack, world, player, hand);
} }
if (Strings.isNullOrEmpty(stack.getTagCompound().getString(Constants.NBT.OWNER_UUID))) if (Strings.isNullOrEmpty(stack.getTagCompound().getString(Constants.NBT.OWNER_UUID)))
return stack; return super.onItemRightClick(stack, world, player, hand);
if (world.isRemote) if (world.isRemote)
return stack; return super.onItemRightClick(stack, world, player, hand);
if (stack.getTagCompound().getString(Constants.NBT.OWNER_UUID).equals(PlayerHelper.getUsernameFromPlayer(player))) if (stack.getTagCompound().getString(Constants.NBT.OWNER_UUID).equals(PlayerHelper.getUsernameFromPlayer(player)))
NetworkHelper.setMaxOrb(NetworkHelper.getSoulNetwork(stack.getTagCompound().getString(Constants.NBT.OWNER_UUID)), getOrbLevel(stack.getItemDamage())); NetworkHelper.setMaxOrb(NetworkHelper.getSoulNetwork(stack.getTagCompound().getString(Constants.NBT.OWNER_UUID)), getOrbLevel(stack.getItemDamage()));
NetworkHelper.getSoulNetwork(stack.getTagCompound().getString(Constants.NBT.OWNER_UUID)).addLifeEssence(200, getMaxEssence(stack.getItemDamage())); NetworkHelper.getSoulNetwork(stack.getTagCompound().getString(Constants.NBT.OWNER_UUID)).addLifeEssence(200, getMaxEssence(stack.getItemDamage()));
hurtPlayer(player, 200); hurtPlayer(player, 200);
return stack; return super.onItemRightClick(stack, world, player, hand);
} }
@Override @Override

View file

@ -1,5 +1,22 @@
package WayofTime.bloodmagic.item; package WayofTime.bloodmagic.item;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.ConfigHandler; import WayofTime.bloodmagic.ConfigHandler;
import WayofTime.bloodmagic.api.BloodMagicAPI; import WayofTime.bloodmagic.api.BloodMagicAPI;
@ -7,20 +24,6 @@ import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.DamageSourceBloodMagic; import WayofTime.bloodmagic.api.DamageSourceBloodMagic;
import WayofTime.bloodmagic.api.altar.IBloodAltar; import WayofTime.bloodmagic.api.altar.IBloodAltar;
import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.client.IVariantProvider;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import java.util.ArrayList;
import java.util.List;
public class ItemDaggerOfSacrifice extends Item implements IVariantProvider public class ItemDaggerOfSacrifice extends Item implements IVariantProvider
{ {
@ -40,7 +43,7 @@ public class ItemDaggerOfSacrifice extends Item implements IVariantProvider
if (target == null || attacker == null || attacker.worldObj.isRemote || (attacker instanceof EntityPlayer && !(attacker instanceof EntityPlayerMP))) if (target == null || attacker == null || attacker.worldObj.isRemote || (attacker instanceof EntityPlayer && !(attacker instanceof EntityPlayerMP)))
return false; return false;
if (target.isChild() || target instanceof EntityPlayer || target instanceof IBossDisplayData) if (target.isChild() || target instanceof EntityPlayer)
return false; return false;
if (target.isDead || target.getHealth() < 0.5F) if (target.isDead || target.getHealth() < 0.5F)
@ -60,7 +63,7 @@ public class ItemDaggerOfSacrifice extends Item implements IVariantProvider
double posX = target.posX; double posX = target.posX;
double posY = target.posY; double posY = target.posY;
double posZ = target.posZ; double posZ = target.posZ;
target.worldObj.playSoundEffect((double) ((float) posX + 0.5F), (double) ((float) posY + 0.5F), (double) ((float) posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (target.worldObj.rand.nextFloat() - target.worldObj.rand.nextFloat()) * 0.8F); target.worldObj.playSound((EntityPlayer) null, target.posX, target.posY, target.posZ, SoundEvents.block_fire_extinguish, SoundCategory.BLOCKS, 0.5F, 2.6F + (target.worldObj.rand.nextFloat() - target.worldObj.rand.nextFloat()) * 0.8F);
target.setHealth(-1); target.setHealth(-1);
target.onDeath(new DamageSourceBloodMagic()); target.onDeath(new DamageSourceBloodMagic());
} }

View file

@ -1,23 +1,25 @@
package WayofTime.bloodmagic.item; package WayofTime.bloodmagic.item;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants; import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType; import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.api.soul.IDiscreteDemonWill; import WayofTime.bloodmagic.api.soul.IDiscreteDemonWill;
import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.registry.ModItems; import WayofTime.bloodmagic.registry.ModItems;
import lombok.Getter;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import java.util.ArrayList;
import java.util.List;
public class ItemDemonCrystal extends Item implements IDiscreteDemonWill, IVariantProvider public class ItemDemonCrystal extends Item implements IDiscreteDemonWill, IVariantProvider
{ {

View file

@ -9,7 +9,9 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
@ -56,7 +58,7 @@ public class ItemInscriptionTool extends ItemBindable implements IVariantProvide
} }
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{ {
IBlockState state = world.getBlockState(pos); IBlockState state = world.getBlockState(pos);
@ -72,10 +74,10 @@ public class ItemInscriptionTool extends ItemBindable implements IVariantProvide
if (uses <= 0) if (uses <= 0)
player.inventory.setInventorySlotContents(player.inventory.currentItem, null); player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
} }
return true; return EnumActionResult.SUCCESS;
} }
return false; return EnumActionResult.FAIL;
} }
@Override @Override

View file

@ -1,20 +1,23 @@
package WayofTime.bloodmagic.item; package WayofTime.bloodmagic.item;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraftforge.fml.common.IFuelHandler;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import WayofTime.bloodmagic.api.Constants; import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper; import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.client.IVariantProvider;
import com.google.common.base.Strings;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraftforge.fml.common.IFuelHandler;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import java.util.ArrayList; import com.google.common.base.Strings;
import java.util.List;
public class ItemLavaCrystal extends ItemBindable implements IFuelHandler, IVariantProvider public class ItemLavaCrystal extends ItemBindable implements IFuelHandler, IVariantProvider
{ {
@ -70,7 +73,7 @@ public class ItemLavaCrystal extends ItemBindable implements IFuelHandler, IVari
EntityPlayer player = PlayerHelper.getPlayerFromUUID(getBindableOwner(fuel)); EntityPlayer player = PlayerHelper.getPlayerFromUUID(getBindableOwner(fuel));
if (player != null) if (player != null)
{ {
player.addPotionEffect(new PotionEffect(Potion.confusion.getId(), 99)); player.addPotionEffect(new PotionEffect(MobEffects.confusion, 99));
} }
} }

View file

@ -125,7 +125,7 @@ public class ItemRitualDiviner extends Item implements IVariantProvider
RitualHelper.setRuneType(world, newPos, component.getRuneType()); RitualHelper.setRuneType(world, newPos, component.getRuneType());
return true; return true;
} }
} else if (block.isAir(world, newPos)) } else if (block.isAir(state, world, newPos))
{ {
if (!consumeStone(stack, world, player)) if (!consumeStone(stack, world, player))
{ {
@ -559,18 +559,17 @@ public class ItemRitualDiviner extends Item implements IVariantProvider
public static void spawnParticles(World worldIn, BlockPos pos, int amount) public static void spawnParticles(World worldIn, BlockPos pos, int amount)
{ {
IBlockState state = worldIn.getBlockState(pos);
Block block = worldIn.getBlockState(pos).getBlock(); Block block = worldIn.getBlockState(pos).getBlock();
if (block.isAir(worldIn, pos)) if (block.isAir(state, worldIn, pos))
{ {
block.setBlockBoundsBasedOnState(worldIn, pos);
for (int i = 0; i < amount; ++i) for (int i = 0; i < amount; ++i)
{ {
double d0 = itemRand.nextGaussian() * 0.02D; double d0 = itemRand.nextGaussian() * 0.02D;
double d1 = itemRand.nextGaussian() * 0.02D; double d1 = itemRand.nextGaussian() * 0.02D;
double d2 = itemRand.nextGaussian() * 0.02D; double d2 = itemRand.nextGaussian() * 0.02D;
worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double) ((float) pos.getX() + itemRand.nextFloat()), (double) pos.getY() + (double) itemRand.nextFloat() * block.getBlockBoundsMaxY(), (double) ((float) pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]); worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double) ((float) pos.getX() + itemRand.nextFloat()), (double) pos.getY() + (double) itemRand.nextFloat(), (double) ((float) pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]);
} }
} else } else
{ {

View file

@ -6,13 +6,20 @@ import java.util.List;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.EnumAction; import net.minecraft.item.EnumAction;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
@ -70,9 +77,10 @@ public class ItemSacrificialDagger extends Item implements IVariantProvider
} }
@Override @Override
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int itemInUseCount) public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBase entityLiving, int timeLeft)
{ {
PlayerSacrificeHelper.sacrificePlayerHealth(player); if (entityLiving instanceof EntityPlayer)
PlayerSacrificeHelper.sacrificePlayerHealth((EntityPlayer) entityLiving);
} }
@Override @Override
@ -88,21 +96,21 @@ public class ItemSacrificialDagger extends Item implements IVariantProvider
} }
@Override @Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
{ {
if (PlayerHelper.isFakePlayer(player)) if (PlayerHelper.isFakePlayer(player))
return stack; return super.onItemRightClick(stack, world, player, hand);
if (this.canUseForSacrifice(stack)) if (this.canUseForSacrifice(stack))
{ {
player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); player.setActiveHand(hand);
return stack; return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
} }
int lpAdded = 200; int lpAdded = 200;
MovingObjectPosition mop = getMovingObjectPositionFromPlayer(world, player, false); RayTraceResult mop = getMovingObjectPositionFromPlayer(world, player, false);
if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) if (mop != null && mop.typeOfHit == RayTraceResult.Type.BLOCK)
{ {
TileEntity tile = world.getTileEntity(mop.getBlockPos()); TileEntity tile = world.getTileEntity(mop.getBlockPos());
@ -114,7 +122,7 @@ public class ItemSacrificialDagger extends Item implements IVariantProvider
{ {
SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(player, true, true, 2, lpAdded); SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(player, true, true, 2, lpAdded);
if (MinecraftForge.EVENT_BUS.post(evt)) if (MinecraftForge.EVENT_BUS.post(evt))
return stack; return super.onItemRightClick(stack, world, player, hand);
if (evt.shouldDrainHealth) if (evt.shouldDrainHealth)
{ {
@ -130,7 +138,7 @@ public class ItemSacrificialDagger extends Item implements IVariantProvider
} }
if (!evt.shouldFillAltar) if (!evt.shouldFillAltar)
return stack; return super.onItemRightClick(stack, world, player, hand);
lpAdded = evt.lpAdded; lpAdded = evt.lpAdded;
} }
@ -138,18 +146,18 @@ public class ItemSacrificialDagger extends Item implements IVariantProvider
double posX = player.posX; double posX = player.posX;
double posY = player.posY; double posY = player.posY;
double posZ = player.posZ; double posZ = player.posZ;
world.playSoundEffect((double) ((float) posX + 0.5F), (double) ((float) posY + 0.5F), (double) ((float) posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F); world.playSound((EntityPlayer) null, player.posX, player.posY, player.posZ, SoundEvents.block_fire_extinguish, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
for (int l = 0; l < 8; ++l) for (int l = 0; l < 8; ++l)
world.spawnParticle(EnumParticleTypes.REDSTONE, posX + Math.random() - Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), 0, 0, 0); world.spawnParticle(EnumParticleTypes.REDSTONE, posX + Math.random() - Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), 0, 0, 0);
if (!world.isRemote && PlayerHelper.isFakePlayer(player)) if (!world.isRemote && PlayerHelper.isFakePlayer(player))
return stack; return super.onItemRightClick(stack, world, player, hand);
// TODO - Check if SoulFray is active // TODO - Check if SoulFray is active
findAndFillAltar(world, player, lpAdded); findAndFillAltar(world, player, lpAdded);
return stack; return super.onItemRightClick(stack, world, player, hand);
} }
@Override @Override

View file

@ -11,12 +11,16 @@ import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.util.helper.TextHelper; import WayofTime.bloodmagic.util.helper.TextHelper;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
@ -38,25 +42,25 @@ public class ItemUpgradeTome extends Item implements IVariantProvider
} }
@Override @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) if (world.isRemote)
{ {
return stack; return super.onItemRightClick(stack, world, player, hand);
} }
LivingArmourUpgrade upgrade = ItemUpgradeTome.getUpgrade(stack); LivingArmourUpgrade upgrade = ItemUpgradeTome.getUpgrade(stack);
if (upgrade == null) if (upgrade == null)
{ {
return stack; return super.onItemRightClick(stack, world, player, hand);
} }
ItemStack chestStack = player.getCurrentArmor(2); ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
if (chestStack != null && chestStack.getItem() instanceof ItemLivingArmour) if (chestStack != null && chestStack.getItem() instanceof ItemLivingArmour)
{ {
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack); LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour == null) if (armour == null)
{ {
return stack; return super.onItemRightClick(stack, world, player, hand);
} }
if (armour.upgradeArmour(player, upgrade)) if (armour.upgradeArmour(player, upgrade))
@ -66,7 +70,7 @@ public class ItemUpgradeTome extends Item implements IVariantProvider
stack.stackSize--; stack.stackSize--;
} }
} }
return stack; return super.onItemRightClick(stack, world, player, hand);
} }
@Override @Override