Everything else except sigils

This commit is contained in:
Nicholas Ignoffo 2017-01-01 22:26:42 -08:00
parent 128b3d29b0
commit 51e10eaad2
46 changed files with 289 additions and 354 deletions

View file

@ -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));

View file

@ -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)

View file

@ -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());

View file

@ -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());

View file

@ -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());

View file

@ -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());

View file

@ -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());

View file

@ -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++)
{

View file

@ -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));