Everything else except sigils
This commit is contained in:
parent
128b3d29b0
commit
51e10eaad2
|
@ -7,6 +7,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
|
@ -35,7 +36,7 @@ public class ItemActivationCrystal extends ItemBindableBase implements IVariantP
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (int i = 0; i < names.length; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
|
|
|
@ -57,15 +57,16 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP
|
|||
}
|
||||
|
||||
@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 (world.isRemote)
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
ChatUtil.sendNoSpam(player, TextHelper.localizeEffect("chat.BloodMagic.altarMaker.creativeOnly"));
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
|
@ -79,12 +80,12 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP
|
|||
|
||||
setTierToBuild(EnumAltarTier.values()[stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER)]);
|
||||
ChatUtil.sendNoSpam(player, TextHelper.localizeEffect("chat.BloodMagic.altarMaker.setTier", NumeralHelper.toRoman(stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1)));
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
RayTraceResult rayTrace = rayTrace(world, player, false);
|
||||
if (rayTrace == null || rayTrace.typeOfHit == RayTraceResult.Type.MISS || rayTrace.typeOfHit == RayTraceResult.Type.ENTITY)
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
if (rayTrace.typeOfHit == RayTraceResult.Type.BLOCK && world.getBlockState(rayTrace.getBlockPos()).getBlock() instanceof BlockAltar)
|
||||
{
|
||||
|
@ -95,7 +96,7 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP
|
|||
world.notifyBlockUpdate(rayTrace.getBlockPos(), state, state, 3);
|
||||
}
|
||||
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -132,7 +133,7 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP
|
|||
|
||||
public String destroyAltar(EntityPlayer player)
|
||||
{
|
||||
World world = player.worldObj;
|
||||
World world = player.getEntityWorld();
|
||||
if (world.isRemote)
|
||||
return "";
|
||||
|
||||
|
|
|
@ -43,8 +43,9 @@ public class ItemArcaneAshes extends Item implements IVariantProvider
|
|||
}
|
||||
|
||||
@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);
|
||||
BlockPos newPos = blockPos.offset(side);
|
||||
|
||||
if (world.isAirBlock(newPos))
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
@ -41,42 +42,43 @@ public class ItemBloodOrb extends ItemBindableBase implements IBloodOrb, IBindab
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (int i = 0; i < OrbRegistry.getSize(); i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
}
|
||||
|
||||
@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 (world == null)
|
||||
return super.onItemRightClick(stack, null, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
world.playSound(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,
|
||||
// 20, world.provider.getDimensionId(), 4, posX, posY, posZ);
|
||||
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
if (!stack.hasTagCompound())
|
||||
{
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
if (Strings.isNullOrEmpty(getOwnerUUID(stack)))
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
if (world.isRemote)
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
if (getOwnerUUID(stack).equals(PlayerHelper.getUsernameFromPlayer(player)))
|
||||
NetworkHelper.setMaxOrb(NetworkHelper.getSoulNetwork(getOwnerUUID(stack)), getOrbLevel(stack.getItemDamage()));
|
||||
|
||||
NetworkHelper.getSoulNetwork(getOwnerUUID(stack)).add(200, getMaxEssence(stack.getItemDamage()));
|
||||
NetworkHelper.getSoulNetwork(player).hurtPlayer(player, 200);
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,6 +6,7 @@ import WayofTime.bloodmagic.client.IVariantProvider;
|
|||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
|
@ -29,7 +30,7 @@ public class ItemBloodShard extends Item implements IVariantProvider
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (int i = 0; i < names.length; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
|
|
|
@ -104,9 +104,8 @@ public class ItemBoundAxe extends ItemBoundTool implements IMeshProvider
|
|||
{
|
||||
List<ItemStack> itemDrops = blockStack.getBlock().getDrops(world, blockPos, world.getBlockState(blockPos), fortuneLvl);
|
||||
|
||||
if (itemDrops != null)
|
||||
for (ItemStack stacks : itemDrops)
|
||||
drops.add(ItemStackWrapper.getHolder(stacks));
|
||||
for (ItemStack stacks : itemDrops)
|
||||
drops.add(ItemStackWrapper.getHolder(stacks));
|
||||
}
|
||||
|
||||
world.setBlockToAir(blockPos);
|
||||
|
@ -127,8 +126,8 @@ public class ItemBoundAxe extends ItemBoundTool implements IMeshProvider
|
|||
Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(equipmentSlot);
|
||||
if (equipmentSlot == EntityEquipmentSlot.MAINHAND)
|
||||
{
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getActivated(stack) ? 11 : 2, 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool modifier", -3.0, 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getActivated(stack) ? 11 : 2, 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool modifier", -3.0, 0));
|
||||
}
|
||||
return multimap;
|
||||
}
|
||||
|
|
|
@ -119,10 +119,8 @@ public class ItemBoundPickaxe extends ItemBoundTool implements IMeshProvider
|
|||
else
|
||||
{
|
||||
List<ItemStack> itemDrops = blockStack.getBlock().getDrops(world, blockPos, world.getBlockState(blockPos), fortuneLvl);
|
||||
|
||||
if (itemDrops != null)
|
||||
for (ItemStack stacks : itemDrops)
|
||||
drops.add(ItemStackWrapper.getHolder(stacks));
|
||||
for (ItemStack stacks : itemDrops)
|
||||
drops.add(ItemStackWrapper.getHolder(stacks));
|
||||
}
|
||||
|
||||
world.setBlockToAir(blockPos);
|
||||
|
@ -143,8 +141,8 @@ public class ItemBoundPickaxe extends ItemBoundTool implements IMeshProvider
|
|||
Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(equipmentSlot);
|
||||
if (equipmentSlot == EntityEquipmentSlot.MAINHAND)
|
||||
{
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getActivated(stack) ? 5 : 2, 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool modifier", -2.5, 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getActivated(stack) ? 5 : 2, 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool modifier", -2.5, 0));
|
||||
}
|
||||
return multimap;
|
||||
}
|
||||
|
|
|
@ -103,10 +103,8 @@ public class ItemBoundShovel extends ItemBoundTool implements IMeshProvider
|
|||
else
|
||||
{
|
||||
List<ItemStack> itemDrops = blockStack.getBlock().getDrops(world, blockPos, world.getBlockState(blockPos), fortuneLvl);
|
||||
|
||||
if (itemDrops != null)
|
||||
for (ItemStack stacks : itemDrops)
|
||||
drops.add(ItemStackWrapper.getHolder(stacks));
|
||||
for (ItemStack stacks : itemDrops)
|
||||
drops.add(ItemStackWrapper.getHolder(stacks));
|
||||
}
|
||||
|
||||
world.setBlockToAir(blockPos);
|
||||
|
@ -127,8 +125,8 @@ public class ItemBoundShovel extends ItemBoundTool implements IMeshProvider
|
|||
Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(equipmentSlot);
|
||||
if (equipmentSlot == EntityEquipmentSlot.MAINHAND)
|
||||
{
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", 5, 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool modifier", -2.5, 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", 5, 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool modifier", -2.5, 0));
|
||||
}
|
||||
return multimap;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -50,8 +51,9 @@ public class ItemBoundSword extends ItemSword implements IBindable, IActivatable
|
|||
}
|
||||
|
||||
@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 (player.isSneaking())
|
||||
setActivatedState(stack, !getActivated(stack));
|
||||
|
||||
|
@ -65,7 +67,7 @@ public class ItemBoundSword extends ItemSword implements IBindable, IActivatable
|
|||
// return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
|
||||
// }
|
||||
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -88,7 +90,7 @@ public class ItemBoundSword extends ItemSword implements IBindable, IActivatable
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems)
|
||||
public void getSubItems(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> subItems)
|
||||
{
|
||||
subItems.add(Utils.setUnbreakable(new ItemStack(itemIn)));
|
||||
}
|
||||
|
@ -115,8 +117,8 @@ public class ItemBoundSword extends ItemSword implements IBindable, IActivatable
|
|||
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
|
||||
if (equipmentSlot == EntityEquipmentSlot.MAINHAND)
|
||||
{
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getActivated(stack) ? 8 : 2, 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.4, 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getActivated(stack) ? 8 : 2, 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.4, 0));
|
||||
}
|
||||
return multimap;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import net.minecraft.item.ItemTool;
|
|||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
@ -80,7 +81,7 @@ public class ItemBoundTool extends ItemTool implements IBindable, IActivatable
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems)
|
||||
public void getSubItems(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> subItems)
|
||||
{
|
||||
subItems.add(Utils.setUnbreakable(new ItemStack(itemIn)));
|
||||
}
|
||||
|
@ -125,8 +126,9 @@ public class ItemBoundTool extends ItemTool implements IBindable, IActivatable
|
|||
}
|
||||
|
||||
@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 (player.isSneaking())
|
||||
setActivatedState(stack, !getActivated(stack));
|
||||
|
||||
|
@ -140,7 +142,7 @@ public class ItemBoundTool extends ItemTool implements IBindable, IActivatable
|
|||
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -244,12 +246,12 @@ public class ItemBoundTool extends ItemTool implements IBindable, IActivatable
|
|||
|
||||
while (count >= maxStackSize)
|
||||
{
|
||||
world.spawnEntityInWorld(new EntityItem(world, posToDrop.getX(), posToDrop.getY(), posToDrop.getZ(), stack.toStack(maxStackSize)));
|
||||
world.spawnEntity(new EntityItem(world, posToDrop.getX(), posToDrop.getY(), posToDrop.getZ(), stack.toStack(maxStackSize)));
|
||||
count -= maxStackSize;
|
||||
}
|
||||
|
||||
if (count > 0)
|
||||
world.spawnEntityInWorld(new EntityItem(world, posToDrop.getX(), posToDrop.getY(), posToDrop.getZ(), stack.toStack(count)));
|
||||
world.spawnEntity(new EntityItem(world, posToDrop.getX(), posToDrop.getY(), posToDrop.getZ(), stack.toStack(count)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import lombok.Getter;
|
|||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -113,7 +114,7 @@ public class ItemComponent extends Item implements IVariantProvider
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (int i = 0; i < names.size(); i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
|
@ -136,7 +137,7 @@ public class ItemComponent extends Item implements IVariantProvider
|
|||
public static ItemStack getStack(String key, int stackSize)
|
||||
{
|
||||
ItemStack stack = getStack(key);
|
||||
stack.stackSize = stackSize;
|
||||
stack.setCount(stackSize);
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class ItemDaggerOfSacrifice extends Item implements IVariantProvider
|
|||
@Override
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
|
||||
{
|
||||
if (target == null || attacker == null || attacker.worldObj.isRemote || (attacker instanceof EntityPlayer && !(attacker instanceof EntityPlayerMP)))
|
||||
if (target == null || attacker == null || attacker.getEntityWorld().isRemote || (attacker instanceof EntityPlayer && !(attacker instanceof EntityPlayerMP)))
|
||||
return false;
|
||||
|
||||
if (!target.isNonBoss())
|
||||
|
@ -67,9 +67,9 @@ public class ItemDaggerOfSacrifice extends Item implements IVariantProvider
|
|||
lifeEssence = (int) (lifeEssence * (1 + PurificationHelper.getCurrentPurity((EntityAnimal) target)));
|
||||
}
|
||||
|
||||
if (PlayerSacrificeHelper.findAndFillAltar(attacker.worldObj, target, lifeEssence, true))
|
||||
if (PlayerSacrificeHelper.findAndFillAltar(attacker.getEntityWorld(), target, lifeEssence, true))
|
||||
{
|
||||
target.worldObj.playSound(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.getEntityWorld().playSound(null, target.posX, target.posY, target.posZ, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (target.getEntityWorld().rand.nextFloat() - target.getEntityWorld().rand.nextFloat()) * 0.8F);
|
||||
target.setHealth(-1);
|
||||
target.onDeath(BloodMagicAPI.getDamageSource());
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import lombok.Getter;
|
|||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -60,7 +61,7 @@ public class ItemDemonCrystal extends Item implements IDiscreteDemonWill, IVaria
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (int i = 0; i < names.size(); i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
|
@ -74,18 +75,18 @@ public class ItemDemonCrystal extends Item implements IDiscreteDemonWill, IVaria
|
|||
@Override
|
||||
public double getWill(ItemStack willStack)
|
||||
{
|
||||
return getDiscretization(willStack) * willStack.stackSize;
|
||||
return getDiscretization(willStack) * willStack.getCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double drainWill(ItemStack willStack, double drainAmount)
|
||||
{
|
||||
double discretization = getDiscretization(willStack);
|
||||
int drainedNumber = (int) Math.floor(Math.min(willStack.stackSize * discretization, drainAmount) / discretization);
|
||||
int drainedNumber = (int) Math.floor(Math.min(willStack.getCount() * discretization, drainAmount) / discretization);
|
||||
|
||||
if (drainedNumber > 0)
|
||||
{
|
||||
willStack.stackSize -= drainedNumber;
|
||||
willStack.shrink(drainedNumber);
|
||||
return drainedNumber * discretization;
|
||||
}
|
||||
|
||||
|
@ -101,7 +102,7 @@ public class ItemDemonCrystal extends Item implements IDiscreteDemonWill, IVaria
|
|||
@Override
|
||||
public EnumDemonWillType getType(ItemStack willStack)
|
||||
{
|
||||
return EnumDemonWillType.values()[MathHelper.clamp_int(willStack.getMetadata(), 0, EnumDemonWillType.values().length - 1)];
|
||||
return EnumDemonWillType.values()[MathHelper.clamp(willStack.getMetadata(), 0, EnumDemonWillType.values().length - 1)];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -56,8 +56,9 @@ public class ItemExperienceBook extends Item implements IVariantProvider
|
|||
}
|
||||
|
||||
@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 (!world.isRemote)
|
||||
{
|
||||
if (player.isSneaking())
|
||||
|
@ -95,7 +96,7 @@ public class ItemExperienceBook extends Item implements IVariantProvider
|
|||
if (player.experienceLevel % 5 == 0)
|
||||
{
|
||||
float f = player.experienceLevel > 30 ? 1.0F : (float) player.experienceLevel / 30.0F;
|
||||
player.worldObj.playSound((EntityPlayer) null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_PLAYER_LEVELUP, player.getSoundCategory(), f * 0.75F, 1.0F);
|
||||
player.getEntityWorld().playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_PLAYER_LEVELUP, player.getSoundCategory(), f * 0.75F, 1.0F);
|
||||
}
|
||||
} else
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
@ -45,7 +46,7 @@ public class ItemInscriptionTool extends ItemBindableBase implements IVariantPro
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (int i = 1; i < EnumRuneType.values().length; i++)
|
||||
{
|
||||
|
@ -56,8 +57,9 @@ public class ItemInscriptionTool extends ItemBindableBase implements IVariantPro
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
|
||||
if (state.getBlock() instanceof BlockRitualStone && !((BlockRitualStone) state.getBlock()).isRuneType(world, pos, getType(stack)))
|
||||
|
|
|
@ -34,7 +34,7 @@ public class ItemLavaCrystal extends ItemBindableBase implements IFuelHandler, I
|
|||
NetworkHelper.getSoulNetwork(this.getOwnerUUID(itemStack)).syphon(25);
|
||||
ItemStack copiedStack = itemStack.copy();
|
||||
copiedStack.setItemDamage(copiedStack.getItemDamage());
|
||||
copiedStack.stackSize = 1;
|
||||
copiedStack.setCount(1);
|
||||
return copiedStack;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,11 +15,7 @@ import net.minecraft.item.ItemBlock;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
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.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -81,15 +77,16 @@ public class ItemRitualDiviner extends Item implements IVariantProvider
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (int i = 0; i < names.length; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (player.isSneaking())
|
||||
{
|
||||
if (world.isRemote)
|
||||
|
@ -214,12 +211,11 @@ public class ItemRitualDiviner extends Item implements IVariantProvider
|
|||
return true;
|
||||
}
|
||||
|
||||
ItemStack[] inventory = player.inventory.mainInventory;
|
||||
for (int i = 0; i < inventory.length; i++)
|
||||
NonNullList<ItemStack> inventory = player.inventory.mainInventory;
|
||||
for (ItemStack newStack : inventory)
|
||||
{
|
||||
ItemStack newStack = inventory[i];
|
||||
if (newStack == null)
|
||||
{
|
||||
if (newStack.isEmpty()) {
|
||||
|
||||
continue;
|
||||
}
|
||||
Item item = newStack.getItem();
|
||||
|
@ -228,12 +224,7 @@ public class ItemRitualDiviner extends Item implements IVariantProvider
|
|||
Block block = ((ItemBlock) item).getBlock();
|
||||
if (block == ModBlocks.RITUAL_STONE)
|
||||
{
|
||||
newStack.stackSize--;
|
||||
if (newStack.stackSize <= 0)
|
||||
{
|
||||
inventory[i] = null;
|
||||
}
|
||||
|
||||
newStack.shrink(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -344,8 +335,9 @@ public class ItemRitualDiviner extends Item implements IVariantProvider
|
|||
}
|
||||
|
||||
@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);
|
||||
RayTraceResult ray = this.rayTrace(world, player, false);
|
||||
if (ray != null && ray.typeOfHit == RayTraceResult.Type.BLOCK)
|
||||
{
|
||||
|
@ -372,7 +364,7 @@ public class ItemRitualDiviner extends Item implements IVariantProvider
|
|||
{
|
||||
EntityPlayer player = (EntityPlayer) entityLiving;
|
||||
|
||||
RayTraceResult ray = this.rayTrace(player.worldObj, player, false);
|
||||
RayTraceResult ray = this.rayTrace(player.getEntityWorld(), player, false);
|
||||
if (ray != null && ray.typeOfHit == RayTraceResult.Type.BLOCK)
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -9,10 +9,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
|
@ -71,8 +68,9 @@ public class ItemRitualReader extends Item implements IVariantProvider
|
|||
}
|
||||
|
||||
@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);
|
||||
RayTraceResult ray = this.rayTrace(world, player, false);
|
||||
if (ray != null && ray.typeOfHit == RayTraceResult.Type.BLOCK)
|
||||
{
|
||||
|
@ -93,8 +91,9 @@ public class ItemRitualReader extends Item implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (!world.isRemote)
|
||||
{
|
||||
EnumRitualReaderState state = this.getState(stack);
|
||||
|
@ -123,11 +122,11 @@ public class ItemRitualReader extends Item implements IVariantProvider
|
|||
break;
|
||||
case SET_WILL_TYPES:
|
||||
List<EnumDemonWillType> typeList = new ArrayList<EnumDemonWillType>();
|
||||
ItemStack[] inv = player.inventory.mainInventory;
|
||||
NonNullList<ItemStack> inv = player.inventory.mainInventory;
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
ItemStack testStack = inv[i];
|
||||
if (testStack == null)
|
||||
ItemStack testStack = inv.get(i);
|
||||
if (testStack.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -177,7 +176,7 @@ public class ItemRitualReader extends Item implements IVariantProvider
|
|||
}
|
||||
}
|
||||
|
||||
return super.onItemUse(stack, player, world, pos, hand, facing, hitX, hitY, hitZ);
|
||||
return super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
public BlockPos getBlockPos(ItemStack stack)
|
||||
|
|
|
@ -63,7 +63,7 @@ public class ItemSacrificialDagger extends Item implements IMeshProvider
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (int i = 0; i < names.length; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
|
@ -81,7 +81,7 @@ public class ItemSacrificialDagger extends Item implements IMeshProvider
|
|||
@Override
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBase entityLiving, int timeLeft)
|
||||
{
|
||||
if (entityLiving instanceof EntityPlayer && !entityLiving.worldObj.isRemote)
|
||||
if (entityLiving instanceof EntityPlayer && !entityLiving.getEntityWorld().isRemote)
|
||||
PlayerSacrificeHelper.sacrificePlayerHealth((EntityPlayer) entityLiving);
|
||||
}
|
||||
|
||||
|
@ -98,10 +98,11 @@ public class ItemSacrificialDagger extends Item implements IMeshProvider
|
|||
}
|
||||
|
||||
@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 super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
if (this.canUseForSacrifice(stack))
|
||||
{
|
||||
|
@ -124,7 +125,7 @@ public class ItemSacrificialDagger extends Item implements IMeshProvider
|
|||
{
|
||||
SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(player, true, true, ConfigHandler.sacrificialDaggerDamage, lpAdded);
|
||||
if (MinecraftForge.EVENT_BUS.post(evt))
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
if (evt.shouldDrainHealth)
|
||||
{
|
||||
|
@ -140,7 +141,7 @@ public class ItemSacrificialDagger extends Item implements IMeshProvider
|
|||
}
|
||||
|
||||
if (!evt.shouldFillAltar)
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
lpAdded = evt.lpAdded;
|
||||
}
|
||||
|
@ -154,12 +155,12 @@ public class ItemSacrificialDagger extends Item implements IMeshProvider
|
|||
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))
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
// TODO - Check if SoulFray is active
|
||||
PlayerSacrificeHelper.findAndFillAltar(world, player, lpAdded, false);
|
||||
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -44,10 +44,10 @@ public class ItemSanguineBook extends Item implements IVariantProvider, IAltarMa
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (world.isRemote)
|
||||
return super.onItemUse(stack, player, world, pos, hand, facing, hitX, hitY, hitZ);
|
||||
return super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
|
||||
|
||||
IBlockState hitState = world.getBlockState(pos);
|
||||
if (player.isSneaking())
|
||||
|
@ -60,19 +60,20 @@ public class ItemSanguineBook extends Item implements IVariantProvider, IAltarMa
|
|||
if (!docs.isEmpty())
|
||||
{
|
||||
ChatUtil.sendNoSpam(player, docs.toArray(new ITextComponent[docs.size()]));
|
||||
return super.onItemUse(stack, player, world, pos, hand, facing, hitX, hitY, hitZ);
|
||||
return super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.onItemUse(stack, player, world, pos, hand, facing, hitX, hitY, hitZ);
|
||||
return super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@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 (world.isRemote)
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
|
||||
|
@ -87,10 +88,10 @@ public class ItemSanguineBook extends Item implements IVariantProvider, IAltarMa
|
|||
currentDisplayedTier = EnumAltarTier.values()[stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER)];
|
||||
ChatUtil.sendNoSpam(player, TextHelper.localizeEffect("chat.BloodMagic.altarMaker.setTier", NumeralHelper.toRoman(stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1)));
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public boolean trySetDisplayedTier(World world, BlockPos pos)
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
|
@ -32,7 +33,7 @@ public class ItemSlate extends Item implements IVariantProvider
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (int i = 0; i < names.length; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -47,14 +48,14 @@ public class ItemTelepositionFocus extends ItemBindableBase implements IVariantP
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (int i = 0; i < names.length; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
if (player.isSneaking())
|
||||
{
|
||||
|
@ -62,11 +63,11 @@ public class ItemTelepositionFocus extends ItemBindableBase implements IVariantP
|
|||
|
||||
if (mop != null && mop.typeOfHit == RayTraceResult.Type.BLOCK)
|
||||
{
|
||||
setBlockPos(stack, world, mop.getBlockPos());
|
||||
setBlockPos(player.getHeldItem(hand), world, mop.getBlockPos());
|
||||
}
|
||||
}
|
||||
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -41,41 +42,42 @@ public class ItemUpgradeTome extends Item implements IVariantProvider
|
|||
}
|
||||
|
||||
@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 (world.isRemote)
|
||||
{
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
LivingArmourUpgrade upgrade = LivingUpgrades.getUpgrade(stack);
|
||||
if (upgrade == null)
|
||||
{
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
if (chestStack != null && chestStack.getItem() instanceof ItemLivingArmour)
|
||||
if (chestStack.getItem() instanceof ItemLivingArmour)
|
||||
{
|
||||
LivingArmour armour = ItemLivingArmour.getLivingArmourFromStack(chestStack);
|
||||
if (armour == null)
|
||||
{
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
if (armour.upgradeArmour(player, upgrade))
|
||||
{
|
||||
ItemLivingArmour.setLivingArmour(chestStack, armour);
|
||||
// ((ItemLivingArmour) chestStack.getItem()).setLivingArmour(stack, armour, false);
|
||||
stack.stackSize--;
|
||||
stack.shrink(1);
|
||||
}
|
||||
}
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (Entry<String, Integer> entry : LivingArmourHandler.upgradeMaxLevelMap.entrySet())
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
|
@ -35,7 +36,7 @@ public class ItemUpgradeTrainer extends Item implements IUpgradeTrainer, IVarian
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
list.add(new ItemStack(this));
|
||||
for (Entry<String, Integer> entry : LivingArmourHandler.upgradeMaxLevelMap.entrySet())
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -67,7 +68,7 @@ public class ItemCuttingFluid extends Item implements IVariantProvider, ICustomA
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (int i = 0; i < names.size(); i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraft.potion.PotionEffect;
|
|||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -68,7 +69,7 @@ public class ItemLivingArmourPointsUpgrade extends Item implements IVariantProvi
|
|||
|
||||
if (player == null || !player.capabilities.isCreativeMode)
|
||||
{
|
||||
--stack.stackSize;
|
||||
stack.shrink(1);
|
||||
}
|
||||
|
||||
if (!worldIn.isRemote)
|
||||
|
@ -109,10 +110,10 @@ public class ItemLivingArmourPointsUpgrade extends Item implements IVariantProvi
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
|
||||
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand)
|
||||
{
|
||||
playerIn.setActiveHand(hand);
|
||||
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemStackIn);
|
||||
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, playerIn.getHeldItem(hand));
|
||||
}
|
||||
|
||||
private void buildItemList()
|
||||
|
@ -128,7 +129,7 @@ public class ItemLivingArmourPointsUpgrade extends Item implements IVariantProvi
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (int i = 0; i < names.size(); i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
|
@ -151,7 +152,7 @@ public class ItemLivingArmourPointsUpgrade extends Item implements IVariantProvi
|
|||
public static ItemStack getStack(String key, int stackSize)
|
||||
{
|
||||
ItemStack stack = getStack(key);
|
||||
stack.stackSize = stackSize;
|
||||
stack.setCount(stackSize);
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ISpecialArmor;
|
||||
|
@ -173,12 +174,12 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMes
|
|||
|
||||
int maxAbsorption = 100000;
|
||||
|
||||
if (source.equals(DamageSource.drown))
|
||||
if (source.equals(DamageSource.DROWN))
|
||||
{
|
||||
return new ArmorProperties(-1, 0, 0);
|
||||
}
|
||||
|
||||
if (source.equals(DamageSource.outOfWorld))
|
||||
if (source.equals(DamageSource.OUT_OF_WORLD))
|
||||
{
|
||||
return new ArmorProperties(-1, 0, 0);
|
||||
}
|
||||
|
@ -191,7 +192,7 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMes
|
|||
ItemStack leggings = player.getItemStackFromSlot(EntityEquipmentSlot.LEGS);
|
||||
ItemStack boots = player.getItemStackFromSlot(EntityEquipmentSlot.FEET);
|
||||
|
||||
if (helmet == null || leggings == null || boots == null)
|
||||
if (helmet.isEmpty() || leggings.isEmpty() || boots.isEmpty())
|
||||
{
|
||||
damageAmount *= (armourReduction);
|
||||
|
||||
|
@ -371,18 +372,18 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMes
|
|||
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
|
||||
if (slot == EntityEquipmentSlot.CHEST)
|
||||
{
|
||||
multimap.put(SharedMonsterAttributes.MAX_HEALTH.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(0, 318145), "Armor modifier", this.getHealthBonus(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.KNOCKBACK_RESISTANCE.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(0, 8145), "Armor modifier", this.getKnockbackResistance(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(0, 94021), "Armor modifier", this.getSpeedBoost(stack), 2));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(0, 96721), "Armor modifier", this.getDamageBoost(stack), 2));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(0, 73245), "Armor modifier", this.getAttackSpeedBoost(stack), 2));
|
||||
multimap.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(new UUID(0, 318145), "Armor modifier", this.getHealthBonus(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.KNOCKBACK_RESISTANCE.getName(), new AttributeModifier(new UUID(0, 8145), "Armor modifier", this.getKnockbackResistance(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getName(), new AttributeModifier(new UUID(0, 94021), "Armor modifier", this.getSpeedBoost(stack), 2));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(new UUID(0, 96721), "Armor modifier", this.getDamageBoost(stack), 2));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(new UUID(0, 73245), "Armor modifier", this.getAttackSpeedBoost(stack), 2));
|
||||
}
|
||||
return multimap;
|
||||
}
|
||||
|
||||
public static void revertAllArmour(EntityPlayer player)
|
||||
{
|
||||
ItemStack[] armourInventory = player.inventory.armorInventory;
|
||||
NonNullList<ItemStack> armourInventory = player.inventory.armorInventory;
|
||||
for (ItemStack stack : armourInventory)
|
||||
{
|
||||
if (stack != null && stack.getItem() instanceof ItemSentientArmour)
|
||||
|
@ -423,9 +424,7 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMes
|
|||
}
|
||||
|
||||
NBTTagCompound tag = omegaTag.getCompoundTag("armour");
|
||||
ItemStack armourStack = ItemStack.loadItemStackFromNBT(tag);
|
||||
|
||||
return armourStack;
|
||||
return new ItemStack(tag);
|
||||
}
|
||||
|
||||
public static boolean convertPlayerArmour(EnumDemonWillType type, double will, EntityPlayer player)
|
||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack;
|
||||
|
@ -20,7 +21,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemBlockBloodTank extends ItemBlock implements IFluidContainerItem
|
||||
public class ItemBlockBloodTank extends ItemBlock
|
||||
{
|
||||
public ItemBlockBloodTank(Block block)
|
||||
{
|
||||
|
@ -68,98 +69,17 @@ public class ItemBlockBloodTank extends ItemBlock implements IFluidContainerItem
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (int i = 0; i < TileBloodTank.CAPACITIES.length; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack getFluid(ItemStack stack)
|
||||
{
|
||||
if (stack.hasTagCompound() && stack.getTagCompound().hasKey(Constants.NBT.TANK) && !stack.getTagCompound().getCompoundTag(Constants.NBT.TANK).getString("FluidName").equals(""))
|
||||
{
|
||||
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(Constants.NBT.TANK);
|
||||
return FluidStack.loadFluidStackFromNBT(tag);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity(ItemStack container)
|
||||
{
|
||||
return container != null && Block.getBlockFromItem(container.getItem()) instanceof BlockBloodTank ? TileBloodTank.CAPACITIES[container.getMetadata()] * Fluid.BUCKET_VOLUME : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ItemStack stack, FluidStack resource, boolean doFill)
|
||||
{
|
||||
if (resource == null || stack.stackSize != 1)
|
||||
return 0;
|
||||
|
||||
int fillAmount = 0, capacity = getCapacity(stack);
|
||||
NBTTagCompound tag = stack.getTagCompound(), fluidTag = null;
|
||||
FluidStack fluid = null;
|
||||
|
||||
if (tag == null || !tag.hasKey(Constants.NBT.TANK) || (fluidTag = tag.getCompoundTag(Constants.NBT.TANK)) == null || (fluid = FluidStack.loadFluidStackFromNBT(fluidTag)) == null)
|
||||
fillAmount = Math.min(capacity, resource.amount);
|
||||
|
||||
if (fluid == null)
|
||||
{
|
||||
if (doFill)
|
||||
{
|
||||
fluid = resource.copy();
|
||||
fluid.amount = 0;
|
||||
}
|
||||
}
|
||||
else if (!fluid.isFluidEqual(resource))
|
||||
return 0;
|
||||
else
|
||||
fillAmount = Math.min(capacity - fluid.amount, resource.amount);
|
||||
|
||||
fillAmount = Math.max(fillAmount, 0);
|
||||
|
||||
if (doFill)
|
||||
{
|
||||
if (tag == null)
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
|
||||
tag = stack.getTagCompound();
|
||||
fluid.amount += fillAmount;
|
||||
tag.setTag(Constants.NBT.TANK, fluid.writeToNBT(fluidTag == null ? new NBTTagCompound() : fluidTag));
|
||||
}
|
||||
|
||||
return fillAmount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ItemStack stack, int maxDrain, boolean doDrain)
|
||||
{
|
||||
NBTTagCompound tag = stack.getTagCompound(), fluidTag = null;
|
||||
FluidStack fluid;
|
||||
|
||||
if (tag == null || !tag.hasKey(Constants.NBT.TANK) || (fluidTag = tag.getCompoundTag(Constants.NBT.TANK)) == null || (fluid = FluidStack.loadFluidStackFromNBT(fluidTag)) == null)
|
||||
{
|
||||
if (fluidTag != null)
|
||||
tag.removeTag(Constants.NBT.TANK);
|
||||
return null;
|
||||
}
|
||||
|
||||
int drainAmount = Math.min(maxDrain, fluid.amount);
|
||||
|
||||
if (doDrain)
|
||||
{
|
||||
tag.removeTag(Constants.NBT.TANK);
|
||||
fluid.amount -= drainAmount;
|
||||
if (fluid.amount > 0)
|
||||
fill(stack, fluid, true);
|
||||
}
|
||||
|
||||
fluid.amount = drainAmount;
|
||||
return fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt)
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@ public class ItemBlockEnum<E extends Enum<E> & IStringSerializable> extends Item
|
|||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack)
|
||||
{
|
||||
return getBlock().getUnlocalizedName() + getBlock().getTypes()[MathHelper.clamp_int(stack.getItemDamage(), 0, 15)].getName();
|
||||
return getBlock().getUnlocalizedName() + getBlock().getTypes()[MathHelper.clamp(stack.getItemDamage(), 0, 15)].getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,7 +22,7 @@ public class ItemBlockString extends ItemBlock {
|
|||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return getBlock().getUnlocalizedName() + "." + getBlock().getTypes()[MathHelper.clamp_int(stack.getItemDamage(), 0, 15)];
|
||||
return getBlock().getUnlocalizedName() + "." + getBlock().getTypes()[MathHelper.clamp(stack.getItemDamage(), 0, 15)];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -38,8 +38,9 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator, I
|
|||
}
|
||||
|
||||
@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 (world.isRemote)
|
||||
return ActionResult.newResult(EnumActionResult.FAIL, stack);
|
||||
|
||||
|
@ -47,7 +48,7 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator, I
|
|||
|
||||
if (rayTrace == null)
|
||||
{
|
||||
return super.onItemRightClick(stack, world, player, EnumHand.MAIN_HAND);
|
||||
return super.onItemRightClick(world, player, EnumHand.MAIN_HAND);
|
||||
} else
|
||||
{
|
||||
if (rayTrace.typeOfHit == RayTraceResult.Type.BLOCK)
|
||||
|
@ -55,7 +56,7 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator, I
|
|||
TileEntity tile = world.getTileEntity(rayTrace.getBlockPos());
|
||||
|
||||
if (!(tile instanceof IBloodAltar))
|
||||
return super.onItemRightClick(stack, world, player, EnumHand.MAIN_HAND);
|
||||
return super.onItemRightClick(world, player, EnumHand.MAIN_HAND);
|
||||
|
||||
LPContainer.tryAndFillAltar((IBloodAltar) tile, stack, world, rayTrace.getBlockPos());
|
||||
}
|
||||
|
|
|
@ -54,8 +54,9 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato
|
|||
}
|
||||
|
||||
@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 (world.isRemote)
|
||||
return ActionResult.newResult(EnumActionResult.FAIL, stack);
|
||||
|
||||
|
@ -63,7 +64,7 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato
|
|||
|
||||
if (position == null)
|
||||
{
|
||||
return super.onItemRightClick(stack, world, player, EnumHand.MAIN_HAND);
|
||||
return super.onItemRightClick(world, player, EnumHand.MAIN_HAND);
|
||||
} else
|
||||
{
|
||||
if (position.typeOfHit == RayTraceResult.Type.BLOCK)
|
||||
|
@ -71,7 +72,7 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato
|
|||
TileEntity tile = world.getTileEntity(position.getBlockPos());
|
||||
|
||||
if (!(tile instanceof IBloodAltar))
|
||||
return super.onItemRightClick(stack, world, player, EnumHand.MAIN_HAND);
|
||||
return super.onItemRightClick(world, player, EnumHand.MAIN_HAND);
|
||||
|
||||
LPContainer.tryAndFillAltar((IBloodAltar) tile, stack, world, position.getBlockPos());
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public class ContainerHolding extends Container
|
|||
{
|
||||
super.onContainerClosed(entityPlayer);
|
||||
|
||||
if (!entityPlayer.worldObj.isRemote)
|
||||
if (!entityPlayer.getEntityWorld().isRemote)
|
||||
{
|
||||
saveInventory(entityPlayer);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public class ContainerHolding extends Container
|
|||
{
|
||||
super.detectAndSendChanges();
|
||||
|
||||
if (!player.worldObj.isRemote)
|
||||
if (!player.getEntityWorld().isRemote)
|
||||
{
|
||||
saveInventory(player);
|
||||
}
|
||||
|
@ -79,8 +79,8 @@ public class ContainerHolding extends Container
|
|||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex)
|
||||
{
|
||||
ItemStack stack = null;
|
||||
Slot slotObject = (Slot) inventorySlots.get(slotIndex);
|
||||
ItemStack stack = ItemStack.EMPTY;
|
||||
Slot slotObject = inventorySlots.get(slotIndex);
|
||||
int slots = inventorySlots.size();
|
||||
|
||||
if (slotObject != null && slotObject.getHasStack())
|
||||
|
@ -94,11 +94,11 @@ public class ContainerHolding extends Container
|
|||
{
|
||||
if (!this.mergeItemStack(stackInSlot, ItemSigilHolding.inventorySize, slots, false))
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!this.mergeItemStack(stackInSlot, 0, ItemSigilHolding.inventorySize, false))
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (stack.getItem() instanceof ItemSigilHolding)
|
||||
{
|
||||
|
@ -106,28 +106,28 @@ public class ContainerHolding extends Container
|
|||
{
|
||||
if (!this.mergeItemStack(stackInSlot, ItemSigilHolding.inventorySize + (PLAYER_INVENTORY_ROWS * PLAYER_INVENTORY_COLUMNS), inventorySlots.size(), false))
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!this.mergeItemStack(stackInSlot, ItemSigilHolding.inventorySize, ItemSigilHolding.inventorySize + (PLAYER_INVENTORY_ROWS * PLAYER_INVENTORY_COLUMNS), false))
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
if (stackInSlot.stackSize == 0)
|
||||
if (stackInSlot.isEmpty())
|
||||
{
|
||||
slotObject.putStack(null);
|
||||
slotObject.putStack(ItemStack.EMPTY);
|
||||
} else
|
||||
{
|
||||
slotObject.onSlotChanged();
|
||||
}
|
||||
|
||||
if (stackInSlot.stackSize == stack.stackSize)
|
||||
if (stackInSlot.getCount() == stack.getCount())
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
slotObject.onPickupFromSlot(player, stackInSlot);
|
||||
slotObject.onTake(player, stackInSlot);
|
||||
}
|
||||
|
||||
return stack;
|
||||
|
|
|
@ -40,7 +40,7 @@ public class InventoryHolding extends ItemInventory
|
|||
{
|
||||
ItemStack itemStack = entityPlayer.inventory.getStackInSlot(i);
|
||||
|
||||
if (itemStack != null && Utils.hasUUID(itemStack))
|
||||
if (!itemStack.isEmpty() && Utils.hasUUID(itemStack))
|
||||
{
|
||||
if (itemStack.getTagCompound().getLong(Constants.NBT.MOST_SIG) == parentStackUUID.getMostSignificantBits() && itemStack.getTagCompound().getLong(Constants.NBT.LEAST_SIG) == parentStackUUID.getLeastSignificantBits())
|
||||
{
|
||||
|
|
|
@ -62,7 +62,7 @@ public class ItemInventory implements IInventory
|
|||
|
||||
if (j >= 0 && j < inventory.length)
|
||||
{
|
||||
inventory[j] = ItemStack.loadItemStackFromNBT(data);
|
||||
inventory[j] = new ItemStack(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,22 +123,22 @@ public class ItemInventory implements IInventory
|
|||
@Override
|
||||
public ItemStack decrStackSize(int index, int count)
|
||||
{
|
||||
if (inventory[index] != null)
|
||||
if (!inventory[index].isEmpty())
|
||||
{
|
||||
// if (!worldObj.isRemote)
|
||||
// worldObj.markBlockForUpdate(this.pos);
|
||||
|
||||
if (inventory[index].stackSize <= count)
|
||||
if (inventory[index].getCount() <= count)
|
||||
{
|
||||
ItemStack itemStack = inventory[index];
|
||||
inventory[index] = null;
|
||||
inventory[index] = ItemStack.EMPTY;
|
||||
markDirty();
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
ItemStack itemStack = inventory[index].splitStack(count);
|
||||
if (inventory[index].stackSize == 0)
|
||||
inventory[index] = null;
|
||||
if (inventory[index].isEmpty())
|
||||
inventory[index] = ItemStack.EMPTY;
|
||||
|
||||
markDirty();
|
||||
return itemStack;
|
||||
|
@ -153,7 +153,7 @@ public class ItemInventory implements IInventory
|
|||
if (inventory[slot] != null)
|
||||
{
|
||||
ItemStack itemStack = inventory[slot];
|
||||
setInventorySlotContents(slot, null);
|
||||
setInventorySlotContents(slot, ItemStack.EMPTY);
|
||||
return itemStack;
|
||||
}
|
||||
return null;
|
||||
|
@ -163,8 +163,8 @@ public class ItemInventory implements IInventory
|
|||
public void setInventorySlotContents(int slot, ItemStack stack)
|
||||
{
|
||||
inventory[slot] = stack;
|
||||
if (stack != null && stack.stackSize > getInventoryStackLimit())
|
||||
stack.stackSize = getInventoryStackLimit();
|
||||
if (stack.getCount() > getInventoryStackLimit())
|
||||
stack.setCount(getInventoryStackLimit());
|
||||
markDirty();
|
||||
// if (!worldObj.isRemote)
|
||||
// worldObj.markBlockForUpdate(this.pos);
|
||||
|
@ -177,7 +177,7 @@ public class ItemInventory implements IInventory
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player)
|
||||
public boolean isUsableByPlayer(EntityPlayer player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -251,6 +251,11 @@ public class ItemInventory implements IInventory
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canInventoryBeManipulated()
|
||||
{
|
||||
return masterStack != null;
|
||||
|
|
|
@ -53,8 +53,9 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand)
|
||||
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (world.isRemote)
|
||||
{
|
||||
return EnumActionResult.PASS;
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
@ -49,7 +50,7 @@ public class ItemRouterFilter extends Item implements IItemFilterProvider, IVari
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (int i = 0; i < names.length; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
|
@ -110,7 +111,7 @@ public class ItemRouterFilter extends Item implements IItemFilterProvider, IVari
|
|||
@Override
|
||||
public IItemFilter getOutputItemFilter(ItemStack filterStack, TileEntity tile, IItemHandler handler)
|
||||
{
|
||||
IItemFilter testFilter = new TestItemFilter();
|
||||
IItemFilter testFilter;
|
||||
|
||||
switch (filterStack.getMetadata())
|
||||
{
|
||||
|
@ -142,9 +143,9 @@ public class ItemRouterFilter extends Item implements IItemFilterProvider, IVari
|
|||
}
|
||||
|
||||
ItemStack ghostStack = GhostItemHelper.getStackFromGhost(stack);
|
||||
if (ghostStack.stackSize == 0)
|
||||
if (ghostStack.isEmpty())
|
||||
{
|
||||
ghostStack.stackSize = Integer.MAX_VALUE;
|
||||
ghostStack.setCount(Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
filteredList.add(ghostStack);
|
||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -43,7 +44,7 @@ public class ItemMonsterSoul extends Item implements IDemonWill, IVariantProvide
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (int i = 0; i < names.length; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -33,10 +34,10 @@ public class ItemSentientArmourGem extends Item
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
boolean hasSentientArmour = false;
|
||||
ItemStack[] armourInventory = player.inventory.armorInventory;
|
||||
NonNullList<ItemStack> armourInventory = player.inventory.armorInventory;
|
||||
for (ItemStack armourStack : armourInventory)
|
||||
{
|
||||
if (armourStack != null && armourStack.getItem() instanceof ItemSentientArmour)
|
||||
|
@ -57,14 +58,14 @@ public class ItemSentientArmourGem extends Item
|
|||
ItemSentientArmour.convertPlayerArmour(type, will, player);
|
||||
}
|
||||
|
||||
return new ActionResult<ItemStack>(EnumActionResult.PASS, stack);
|
||||
return new ActionResult<ItemStack>(EnumActionResult.PASS, player.getHeldItem(hand));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
boolean hasSentientArmour = false;
|
||||
ItemStack[] armourInventory = player.inventory.armorInventory;
|
||||
NonNullList<ItemStack> armourInventory = player.inventory.armorInventory;
|
||||
for (ItemStack armourStack : armourInventory)
|
||||
{
|
||||
if (armourStack != null && armourStack.getItem() instanceof ItemSentientArmour)
|
||||
|
|
|
@ -100,7 +100,7 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
|
||||
{
|
||||
return ModItems.ITEM_DEMON_CRYSTAL == repair.getItem() ? true : super.getIsRepairable(toRepair, repair);
|
||||
return ModItems.ITEM_DEMON_CRYSTAL == repair.getItem() || super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
|
||||
public void recalculatePowers(ItemStack stack, World world, EntityPlayer player)
|
||||
|
@ -224,7 +224,7 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
if (attacker instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer attackerPlayer = (EntityPlayer) attacker;
|
||||
this.recalculatePowers(stack, attackerPlayer.worldObj, attackerPlayer);
|
||||
this.recalculatePowers(stack, attackerPlayer.getEntityWorld(), attackerPlayer);
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
double will = PlayerDemonWillHandler.getTotalDemonWill(type, attackerPlayer);
|
||||
int willBracket = this.getLevel(stack, will);
|
||||
|
@ -232,7 +232,7 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
applyEffectToEntity(type, willBracket, target, attackerPlayer);
|
||||
|
||||
ItemStack offStack = attackerPlayer.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
|
||||
if (offStack != null && offStack.getItem() instanceof ISentientSwordEffectProvider)
|
||||
if (offStack.getItem() instanceof ISentientSwordEffectProvider)
|
||||
{
|
||||
ISentientSwordEffectProvider provider = (ISentientSwordEffectProvider) offStack.getItem();
|
||||
if (provider.providesEffectForWill(type))
|
||||
|
@ -273,11 +273,11 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
recalculatePowers(stack, world, player);
|
||||
recalculatePowers(player.getHeldItem(hand), world, player);
|
||||
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -314,7 +314,7 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
recalculatePowers(stack, player.worldObj, player);
|
||||
recalculatePowers(stack, player.getEntityWorld(), player);
|
||||
|
||||
double drain = this.getDrainOfActivatedSword(stack);
|
||||
if (drain > 0)
|
||||
|
@ -365,7 +365,7 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
{
|
||||
List<ItemStack> soulList = new ArrayList<ItemStack>();
|
||||
|
||||
if (killedEntity.worldObj.getDifficulty() != EnumDifficulty.PEACEFUL && !(killedEntity instanceof IMob))
|
||||
if (killedEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(killedEntity instanceof IMob))
|
||||
{
|
||||
return soulList;
|
||||
}
|
||||
|
@ -378,9 +378,9 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
|
||||
for (int i = 0; i <= looting; i++)
|
||||
{
|
||||
if (i == 0 || attackingEntity.worldObj.rand.nextDouble() < 0.4)
|
||||
if (i == 0 || attackingEntity.getEntityWorld().rand.nextDouble() < 0.4)
|
||||
{
|
||||
ItemStack soulStack = soul.createWill(type.ordinal(), willModifier * (this.getDropOfActivatedSword(stack) * attackingEntity.worldObj.rand.nextDouble() + this.getStaticDropOfActivatedSword(stack)) * killedEntity.getMaxHealth() / 20d);
|
||||
ItemStack soulStack = soul.createWill(type.ordinal(), willModifier * (this.getDropOfActivatedSword(stack) * attackingEntity.getEntityWorld().rand.nextDouble() + this.getStaticDropOfActivatedSword(stack)) * killedEntity.getMaxHealth() / 20d);
|
||||
soulList.add(soulStack);
|
||||
}
|
||||
}
|
||||
|
@ -395,10 +395,10 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
|
||||
if (slot == EntityEquipmentSlot.MAINHAND)
|
||||
{
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getDamageOfActivatedSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", this.getAttackSpeedOfSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MAX_HEALTH.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(0, 31818145), "Weapon modifier", this.getHealthBonusOfSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(0, 4218052), "Weapon modifier", this.getSpeedOfSword(stack), 2));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getDamageOfActivatedSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", this.getAttackSpeedOfSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(new UUID(0, 31818145), "Weapon modifier", this.getHealthBonusOfSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getName(), new AttributeModifier(new UUID(0, 4218052), "Weapon modifier", this.getSpeedOfSword(stack), 2));
|
||||
}
|
||||
|
||||
return multimap;
|
||||
|
@ -543,7 +543,7 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
@Override
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player)
|
||||
{
|
||||
World world = player.worldObj;
|
||||
World world = player.getEntityWorld();
|
||||
if (!world.isRemote)
|
||||
{
|
||||
this.recalculatePowers(droppedStack, world, player);
|
||||
|
@ -559,7 +559,7 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
|
||||
EntitySentientSpecter specterEntity = new EntitySentientSpecter(world);
|
||||
specterEntity.setPosition(player.posX, player.posY, player.posZ);
|
||||
world.spawnEntityInWorld(specterEntity);
|
||||
world.spawnEntity(specterEntity);
|
||||
|
||||
specterEntity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, droppedStack.copy());
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
} else
|
||||
{
|
||||
ItemStack itemstack = entityIn.getActiveItemStack();
|
||||
return itemstack != null && itemstack.getItem() == ModItems.SENTIENT_BOW ? (float) (stack.getMaxItemUseDuration() - entityIn.getItemInUseCount()) / 20.0F : 0.0F;
|
||||
return !itemstack.isEmpty() && itemstack.getItem() == ModItems.SENTIENT_BOW ? (float) (stack.getMaxItemUseDuration() - entityIn.getItemInUseCount()) / 20.0F : 0.0F;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -85,7 +85,7 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
|
||||
{
|
||||
return ModItems.ITEM_DEMON_CRYSTAL == repair.getItem() ? true : super.getIsRepairable(toRepair, repair);
|
||||
return ModItems.ITEM_DEMON_CRYSTAL == repair.getItem() || super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
|
||||
public void recalculatePowers(ItemStack stack, World world, EntityPlayer player)
|
||||
|
@ -275,10 +275,11 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
}
|
||||
|
||||
@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);
|
||||
this.recalculatePowers(stack, world, player);
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
public EntityTippedArrow getArrowEntity(World world, ItemStack stack, EntityLivingBase target, EntityLivingBase user, float velocity)
|
||||
|
@ -294,7 +295,7 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
double d0 = target.posX - user.posX;
|
||||
double d1 = target.getEntityBoundingBox().minY + (double) (target.height / 3.0F) - entityArrow.posY;
|
||||
double d2 = target.posZ - user.posZ;
|
||||
double d3 = (double) MathHelper.sqrt_double(d0 * d0 + d2 * d2);
|
||||
double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
|
||||
entityArrow.setThrowableHeading(d0, d1 + d3 * 0.05, d2, newArrowVelocity, 0);
|
||||
|
||||
if (newArrowVelocity == 0)
|
||||
|
@ -405,16 +406,16 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
entityArrow.pickupStatus = EntityArrow.PickupStatus.CREATIVE_ONLY;
|
||||
}
|
||||
|
||||
world.spawnEntityInWorld(entityArrow);
|
||||
world.spawnEntity(entityArrow);
|
||||
}
|
||||
|
||||
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + arrowVelocity * 0.5F);
|
||||
|
||||
if (!flag1)
|
||||
{
|
||||
--itemstack.stackSize;
|
||||
itemstack.shrink(1);
|
||||
|
||||
if (itemstack.stackSize == 0)
|
||||
if (itemstack.isEmpty())
|
||||
{
|
||||
player.inventory.deleteStack(itemstack);
|
||||
}
|
||||
|
@ -453,7 +454,7 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
@Override
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player)
|
||||
{
|
||||
World world = player.worldObj;
|
||||
World world = player.getEntityWorld();
|
||||
if (!world.isRemote)
|
||||
{
|
||||
this.recalculatePowers(droppedStack, world, player);
|
||||
|
@ -469,7 +470,7 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
|
||||
EntitySentientSpecter specterEntity = new EntitySentientSpecter(world);
|
||||
specterEntity.setPosition(player.posX, player.posY, player.posZ);
|
||||
world.spawnEntityInWorld(specterEntity);
|
||||
world.spawnEntity(specterEntity);
|
||||
|
||||
specterEntity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, droppedStack.copy());
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
if (attacker instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer attackerPlayer = (EntityPlayer) attacker;
|
||||
this.recalculatePowers(stack, attackerPlayer.worldObj, attackerPlayer);
|
||||
this.recalculatePowers(stack, attackerPlayer.getEntityWorld(), attackerPlayer);
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
double will = PlayerDemonWillHandler.getTotalDemonWill(type, attackerPlayer);
|
||||
int willBracket = this.getLevel(stack, will);
|
||||
|
@ -232,7 +232,7 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
applyEffectToEntity(type, willBracket, target, attackerPlayer);
|
||||
|
||||
ItemStack offStack = attackerPlayer.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
|
||||
if (offStack != null && offStack.getItem() instanceof ISentientSwordEffectProvider)
|
||||
if (offStack.getItem() instanceof ISentientSwordEffectProvider)
|
||||
{
|
||||
ISentientSwordEffectProvider provider = (ISentientSwordEffectProvider) offStack.getItem();
|
||||
if (provider.providesEffectForWill(type))
|
||||
|
@ -273,11 +273,10 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
recalculatePowers(stack, world, player);
|
||||
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
recalculatePowers(player.getHeldItem(hand), world, player);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -314,7 +313,7 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
recalculatePowers(stack, player.worldObj, player);
|
||||
recalculatePowers(stack, player.getEntityWorld(), player);
|
||||
|
||||
double drain = this.getDrainOfActivatedSword(stack);
|
||||
if (drain > 0)
|
||||
|
@ -365,7 +364,7 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
{
|
||||
List<ItemStack> soulList = new ArrayList<ItemStack>();
|
||||
|
||||
if (killedEntity.worldObj.getDifficulty() != EnumDifficulty.PEACEFUL && !(killedEntity instanceof IMob))
|
||||
if (killedEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(killedEntity instanceof IMob))
|
||||
{
|
||||
return soulList;
|
||||
}
|
||||
|
@ -378,9 +377,9 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
|
||||
for (int i = 0; i <= looting; i++)
|
||||
{
|
||||
if (i == 0 || attackingEntity.worldObj.rand.nextDouble() < 0.4)
|
||||
if (i == 0 || attackingEntity.getEntityWorld().rand.nextDouble() < 0.4)
|
||||
{
|
||||
ItemStack soulStack = soul.createWill(type.ordinal(), willModifier * (this.getDropOfActivatedSword(stack) * attackingEntity.worldObj.rand.nextDouble() + this.getStaticDropOfActivatedSword(stack)) * killedEntity.getMaxHealth() / 20d);
|
||||
ItemStack soulStack = soul.createWill(type.ordinal(), willModifier * (this.getDropOfActivatedSword(stack) * attackingEntity.getEntityWorld().rand.nextDouble() + this.getStaticDropOfActivatedSword(stack)) * killedEntity.getMaxHealth() / 20d);
|
||||
soulList.add(soulStack);
|
||||
}
|
||||
}
|
||||
|
@ -395,10 +394,10 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
|
||||
if (slot == EntityEquipmentSlot.MAINHAND)
|
||||
{
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getDamageOfActivatedSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", this.getAttackSpeedOfSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MAX_HEALTH.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(0, 31818145), "Weapon modifier", this.getHealthBonusOfSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(0, 4218052), "Weapon modifier", this.getSpeedOfSword(stack), 2));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getDamageOfActivatedSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", this.getAttackSpeedOfSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(new UUID(0, 31818145), "Weapon modifier", this.getHealthBonusOfSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getName(), new AttributeModifier(new UUID(0, 4218052), "Weapon modifier", this.getSpeedOfSword(stack), 2));
|
||||
}
|
||||
|
||||
return multimap;
|
||||
|
@ -543,7 +542,7 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
@Override
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player)
|
||||
{
|
||||
World world = player.worldObj;
|
||||
World world = player.getEntityWorld();
|
||||
if (!world.isRemote)
|
||||
{
|
||||
this.recalculatePowers(droppedStack, world, player);
|
||||
|
@ -559,7 +558,7 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
|
||||
EntitySentientSpecter specterEntity = new EntitySentientSpecter(world);
|
||||
specterEntity.setPosition(player.posX, player.posY, player.posZ);
|
||||
world.spawnEntityInWorld(specterEntity);
|
||||
world.spawnEntity(specterEntity);
|
||||
|
||||
specterEntity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, droppedStack.copy());
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
|
||||
{
|
||||
return ModItems.ITEM_DEMON_CRYSTAL == repair.getItem() ? true : super.getIsRepairable(toRepair, repair);
|
||||
return ModItems.ITEM_DEMON_CRYSTAL == repair.getItem() || super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
|
||||
public void recalculatePowers(ItemStack stack, World world, EntityPlayer player)
|
||||
|
@ -224,7 +224,7 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
if (attacker instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer attackerPlayer = (EntityPlayer) attacker;
|
||||
this.recalculatePowers(stack, attackerPlayer.worldObj, attackerPlayer);
|
||||
this.recalculatePowers(stack, attackerPlayer.getEntityWorld(), attackerPlayer);
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
double will = PlayerDemonWillHandler.getTotalDemonWill(type, attackerPlayer);
|
||||
int willBracket = this.getLevel(stack, will);
|
||||
|
@ -232,7 +232,7 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
applyEffectToEntity(type, willBracket, target, attackerPlayer);
|
||||
|
||||
ItemStack offStack = attackerPlayer.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
|
||||
if (offStack != null && offStack.getItem() instanceof ISentientSwordEffectProvider)
|
||||
if (offStack.getItem() instanceof ISentientSwordEffectProvider)
|
||||
{
|
||||
ISentientSwordEffectProvider provider = (ISentientSwordEffectProvider) offStack.getItem();
|
||||
if (provider.providesEffectForWill(type))
|
||||
|
@ -273,11 +273,11 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
recalculatePowers(stack, world, player);
|
||||
recalculatePowers(player.getHeldItem(hand), world, player);
|
||||
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -314,7 +314,7 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
recalculatePowers(stack, player.worldObj, player);
|
||||
recalculatePowers(stack, player.getEntityWorld(), player);
|
||||
|
||||
double drain = this.getDrainOfActivatedSword(stack);
|
||||
if (drain > 0)
|
||||
|
@ -365,7 +365,7 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
{
|
||||
List<ItemStack> soulList = new ArrayList<ItemStack>();
|
||||
|
||||
if (killedEntity.worldObj.getDifficulty() != EnumDifficulty.PEACEFUL && !(killedEntity instanceof IMob))
|
||||
if (killedEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(killedEntity instanceof IMob))
|
||||
{
|
||||
return soulList;
|
||||
}
|
||||
|
@ -378,9 +378,9 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
|
||||
for (int i = 0; i <= looting; i++)
|
||||
{
|
||||
if (i == 0 || attackingEntity.worldObj.rand.nextDouble() < 0.4)
|
||||
if (i == 0 || attackingEntity.getEntityWorld().rand.nextDouble() < 0.4)
|
||||
{
|
||||
ItemStack soulStack = soul.createWill(type.ordinal(), willModifier * (this.getDropOfActivatedSword(stack) * attackingEntity.worldObj.rand.nextDouble() + this.getStaticDropOfActivatedSword(stack)) * killedEntity.getMaxHealth() / 20d);
|
||||
ItemStack soulStack = soul.createWill(type.ordinal(), willModifier * (this.getDropOfActivatedSword(stack) * attackingEntity.getEntityWorld().rand.nextDouble() + this.getStaticDropOfActivatedSword(stack)) * killedEntity.getMaxHealth() / 20d);
|
||||
soulList.add(soulStack);
|
||||
}
|
||||
}
|
||||
|
@ -395,10 +395,10 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
|
||||
if (slot == EntityEquipmentSlot.MAINHAND)
|
||||
{
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getDamageOfActivatedSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", this.getAttackSpeedOfSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MAX_HEALTH.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(0, 31818145), "Weapon modifier", this.getHealthBonusOfSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(0, 4218052), "Weapon modifier", this.getSpeedOfSword(stack), 2));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getDamageOfActivatedSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", this.getAttackSpeedOfSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(new UUID(0, 31818145), "Weapon modifier", this.getHealthBonusOfSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getName(), new AttributeModifier(new UUID(0, 4218052), "Weapon modifier", this.getSpeedOfSword(stack), 2));
|
||||
}
|
||||
|
||||
return multimap;
|
||||
|
@ -543,7 +543,7 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
@Override
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player)
|
||||
{
|
||||
World world = player.worldObj;
|
||||
World world = player.getEntityWorld();
|
||||
if (!world.isRemote)
|
||||
{
|
||||
this.recalculatePowers(droppedStack, world, player);
|
||||
|
@ -559,7 +559,7 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
|
||||
EntitySentientSpecter specterEntity = new EntitySentientSpecter(world);
|
||||
specterEntity.setPosition(player.posX, player.posY, player.posZ);
|
||||
world.spawnEntityInWorld(specterEntity);
|
||||
world.spawnEntity(specterEntity);
|
||||
|
||||
specterEntity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, droppedStack.copy());
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
|
||||
{
|
||||
return ModItems.ITEM_DEMON_CRYSTAL == repair.getItem() ? true : super.getIsRepairable(toRepair, repair);
|
||||
return ModItems.ITEM_DEMON_CRYSTAL == repair.getItem() || super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
|
||||
public void recalculatePowers(ItemStack stack, World world, EntityPlayer player)
|
||||
|
@ -196,7 +196,7 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
if (attacker instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer attackerPlayer = (EntityPlayer) attacker;
|
||||
this.recalculatePowers(stack, attackerPlayer.worldObj, attackerPlayer);
|
||||
this.recalculatePowers(stack, attackerPlayer.getEntityWorld(), attackerPlayer);
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
double will = PlayerDemonWillHandler.getTotalDemonWill(type, attackerPlayer);
|
||||
int willBracket = this.getLevel(stack, will);
|
||||
|
@ -204,7 +204,7 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
applyEffectToEntity(type, willBracket, target, attackerPlayer);
|
||||
|
||||
ItemStack offStack = attackerPlayer.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
|
||||
if (offStack != null && offStack.getItem() instanceof ISentientSwordEffectProvider)
|
||||
if (offStack.getItem() instanceof ISentientSwordEffectProvider)
|
||||
{
|
||||
ISentientSwordEffectProvider provider = (ISentientSwordEffectProvider) offStack.getItem();
|
||||
if (provider.providesEffectForWill(type))
|
||||
|
@ -245,11 +245,10 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
recalculatePowers(stack, world, player);
|
||||
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
recalculatePowers(player.getHeldItem(hand), world, player);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -286,7 +285,7 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
recalculatePowers(stack, player.worldObj, player);
|
||||
recalculatePowers(stack, player.getEntityWorld(), player);
|
||||
|
||||
double drain = this.getDrainOfActivatedSword(stack);
|
||||
if (drain > 0)
|
||||
|
@ -337,7 +336,7 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
{
|
||||
List<ItemStack> soulList = new ArrayList<ItemStack>();
|
||||
|
||||
if (killedEntity.worldObj.getDifficulty() != EnumDifficulty.PEACEFUL && !(killedEntity instanceof IMob))
|
||||
if (killedEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(killedEntity instanceof IMob))
|
||||
{
|
||||
return soulList;
|
||||
}
|
||||
|
@ -350,9 +349,9 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
|
||||
for (int i = 0; i <= looting; i++)
|
||||
{
|
||||
if (i == 0 || attackingEntity.worldObj.rand.nextDouble() < 0.4)
|
||||
if (i == 0 || attackingEntity.getEntityWorld().rand.nextDouble() < 0.4)
|
||||
{
|
||||
ItemStack soulStack = soul.createWill(type.ordinal(), willModifier * (this.getDropOfActivatedSword(stack) * attackingEntity.worldObj.rand.nextDouble() + this.getStaticDropOfActivatedSword(stack)) * killedEntity.getMaxHealth() / 20d);
|
||||
ItemStack soulStack = soul.createWill(type.ordinal(), willModifier * (this.getDropOfActivatedSword(stack) * attackingEntity.getEntityWorld().rand.nextDouble() + this.getStaticDropOfActivatedSword(stack)) * killedEntity.getMaxHealth() / 20d);
|
||||
soulList.add(soulStack);
|
||||
}
|
||||
}
|
||||
|
@ -367,10 +366,10 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
|
||||
if (slot == EntityEquipmentSlot.MAINHAND)
|
||||
{
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getDamageOfActivatedSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", this.getAttackSpeedOfSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MAX_HEALTH.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(0, 31818145), "Weapon modifier", this.getHealthBonusOfSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(0, 4218052), "Weapon modifier", this.getSpeedOfSword(stack), 2));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getDamageOfActivatedSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", this.getAttackSpeedOfSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(new UUID(0, 31818145), "Weapon modifier", this.getHealthBonusOfSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getName(), new AttributeModifier(new UUID(0, 4218052), "Weapon modifier", this.getSpeedOfSword(stack), 2));
|
||||
}
|
||||
|
||||
return multimap;
|
||||
|
@ -498,7 +497,7 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
@Override
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player)
|
||||
{
|
||||
World world = player.worldObj;
|
||||
World world = player.getEntityWorld();
|
||||
if (!world.isRemote)
|
||||
{
|
||||
this.recalculatePowers(droppedStack, world, player);
|
||||
|
@ -514,7 +513,7 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
|
||||
EntitySentientSpecter specterEntity = new EntitySentientSpecter(world);
|
||||
specterEntity.setPosition(player.posX, player.posY, player.posZ);
|
||||
world.spawnEntityInWorld(specterEntity);
|
||||
world.spawnEntity(specterEntity);
|
||||
|
||||
specterEntity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, droppedStack.copy());
|
||||
|
||||
|
|
|
@ -12,10 +12,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -52,8 +49,9 @@ public class ItemSoulGem extends Item implements IDemonWillGem, IMeshProvider, I
|
|||
}
|
||||
|
||||
@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);
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
double drain = Math.min(this.getWill(type, stack), this.getMaxWill(type, stack) / 10);
|
||||
|
||||
|
@ -95,7 +93,7 @@ public class ItemSoulGem extends Item implements IDemonWillGem, IMeshProvider, I
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (int i = 0; i < names.length; i++)
|
||||
{
|
||||
|
|
|
@ -10,10 +10,7 @@ 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.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -40,23 +37,24 @@ public class ItemSoulSnare extends Item implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
|
||||
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand)
|
||||
{
|
||||
ItemStack stack = playerIn.getHeldItem(hand);
|
||||
if (!playerIn.capabilities.isCreativeMode)
|
||||
{
|
||||
--itemStackIn.stackSize;
|
||||
stack.shrink(1);
|
||||
}
|
||||
|
||||
worldIn.playSound((EntityPlayer) null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
|
||||
worldIn.playSound(null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
|
||||
|
||||
if (!worldIn.isRemote)
|
||||
{
|
||||
EntitySoulSnare snare = new EntitySoulSnare(worldIn, playerIn);
|
||||
snare.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
|
||||
worldIn.spawnEntityInWorld(snare);
|
||||
worldIn.spawnEntity(snare);
|
||||
}
|
||||
|
||||
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemStackIn);
|
||||
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -67,7 +65,7 @@ public class ItemSoulSnare extends Item implements IVariantProvider
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (int i = 0; i < names.length; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
|
|
Loading…
Reference in a new issue