Fixed it so that if the Sentient Specters hit each other and they have the same owner they will not attack each other
This commit is contained in:
parent
939e1c3946
commit
5592e8661b
9 changed files with 298 additions and 27 deletions
|
@ -34,6 +34,7 @@ import WayofTime.bloodmagic.BloodMagic;
|
|||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IMultiWillTool;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientSwordEffectProvider;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientTool;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWill;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWillWeapon;
|
||||
|
@ -41,13 +42,14 @@ import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
|||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.client.IMeshProvider;
|
||||
import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill;
|
||||
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
|
||||
import WayofTime.bloodmagic.registry.ModItems;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshProvider, IMultiWillTool
|
||||
public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshProvider, IMultiWillTool, ISentientTool
|
||||
{
|
||||
public static int[] soulBracket = new int[] { 16, 60, 200, 400, 1000 };
|
||||
public static double[] defaultDamageAdded = new double[] { 1, 2, 3, 3.5, 4 };
|
||||
|
@ -538,4 +540,37 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
|
||||
tag.setDouble(Constants.NBT.SOUL_SWORD_DIG_SPEED, speed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player)
|
||||
{
|
||||
World world = player.worldObj;
|
||||
if (!world.isRemote)
|
||||
{
|
||||
this.recalculatePowers(droppedStack, world, player);
|
||||
|
||||
EnumDemonWillType type = this.getCurrentType(droppedStack);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
if (soulsRemaining < 1024)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerDemonWillHandler.consumeDemonWill(type, player, 100);
|
||||
|
||||
EntitySentientSpecter specterEntity = new EntitySentientSpecter(world);
|
||||
specterEntity.setPosition(player.posX, player.posY, player.posZ);
|
||||
world.spawnEntityInWorld(specterEntity);
|
||||
|
||||
specterEntity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, droppedStack.copy());
|
||||
|
||||
specterEntity.setType(this.getCurrentType(droppedStack));
|
||||
specterEntity.setOwner(player);
|
||||
specterEntity.setTamed(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.entity.projectile.EntityTippedArrow;
|
|||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.ItemBow;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -24,13 +25,15 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IMultiWillTool;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientTool;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
|
||||
import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow;
|
||||
import WayofTime.bloodmagic.registry.ModItems;
|
||||
|
||||
public class ItemSentientBow extends ItemBow implements IMultiWillTool//, IMeshProvider
|
||||
public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentientTool//, IMeshProvider
|
||||
{
|
||||
public static int[] soulBracket = new int[] { 16, 60, 200, 400, 1000 };
|
||||
public static double[] defaultDamageAdded = new double[] { 0.25, 0.5, 0.75, 1, 1.25 };
|
||||
|
@ -444,4 +447,37 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool//, IMeshP
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player)
|
||||
{
|
||||
World world = player.worldObj;
|
||||
if (!world.isRemote)
|
||||
{
|
||||
this.recalculatePowers(droppedStack, world, player);
|
||||
|
||||
EnumDemonWillType type = this.getCurrentType(droppedStack);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
if (soulsRemaining < 1024)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerDemonWillHandler.consumeDemonWill(type, player, 100);
|
||||
|
||||
EntitySentientSpecter specterEntity = new EntitySentientSpecter(world);
|
||||
specterEntity.setPosition(player.posX, player.posY, player.posZ);
|
||||
world.spawnEntityInWorld(specterEntity);
|
||||
|
||||
specterEntity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, droppedStack.copy());
|
||||
|
||||
specterEntity.setType(this.getCurrentType(droppedStack));
|
||||
specterEntity.setOwner(player);
|
||||
specterEntity.setTamed(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import WayofTime.bloodmagic.BloodMagic;
|
|||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IMultiWillTool;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientSwordEffectProvider;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientTool;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWill;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWillWeapon;
|
||||
|
@ -41,13 +42,14 @@ import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
|||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.client.IMeshProvider;
|
||||
import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill;
|
||||
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
|
||||
import WayofTime.bloodmagic.registry.ModItems;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon, IMeshProvider, IMultiWillTool
|
||||
public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon, IMeshProvider, IMultiWillTool, ISentientTool
|
||||
{
|
||||
public static int[] soulBracket = new int[] { 16, 60, 200, 400, 1000 };
|
||||
public static double[] defaultDamageAdded = new double[] { 1, 2, 3, 3.5, 4 };
|
||||
|
@ -538,4 +540,37 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
|
||||
tag.setDouble(Constants.NBT.SOUL_SWORD_DIG_SPEED, speed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player)
|
||||
{
|
||||
World world = player.worldObj;
|
||||
if (!world.isRemote)
|
||||
{
|
||||
this.recalculatePowers(droppedStack, world, player);
|
||||
|
||||
EnumDemonWillType type = this.getCurrentType(droppedStack);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
if (soulsRemaining < 1024)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerDemonWillHandler.consumeDemonWill(type, player, 100);
|
||||
|
||||
EntitySentientSpecter specterEntity = new EntitySentientSpecter(world);
|
||||
specterEntity.setPosition(player.posX, player.posY, player.posZ);
|
||||
world.spawnEntityInWorld(specterEntity);
|
||||
|
||||
specterEntity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, droppedStack.copy());
|
||||
|
||||
specterEntity.setType(this.getCurrentType(droppedStack));
|
||||
specterEntity.setOwner(player);
|
||||
specterEntity.setTamed(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import WayofTime.bloodmagic.BloodMagic;
|
|||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IMultiWillTool;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientSwordEffectProvider;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientTool;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWill;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWillWeapon;
|
||||
|
@ -41,13 +42,14 @@ import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
|||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.client.IMeshProvider;
|
||||
import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill;
|
||||
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
|
||||
import WayofTime.bloodmagic.registry.ModItems;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, IMeshProvider, IMultiWillTool
|
||||
public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, IMeshProvider, IMultiWillTool, ISentientTool
|
||||
{
|
||||
public static int[] soulBracket = new int[] { 16, 60, 200, 400, 1000 };
|
||||
public static double[] defaultDamageAdded = new double[] { 1, 2, 3, 3.5, 4 };
|
||||
|
@ -538,4 +540,37 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
|
||||
tag.setDouble(Constants.NBT.SOUL_SWORD_DIG_SPEED, speed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player)
|
||||
{
|
||||
World world = player.worldObj;
|
||||
if (!world.isRemote)
|
||||
{
|
||||
this.recalculatePowers(droppedStack, world, player);
|
||||
|
||||
EnumDemonWillType type = this.getCurrentType(droppedStack);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
if (soulsRemaining < 1024)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerDemonWillHandler.consumeDemonWill(type, player, 100);
|
||||
|
||||
EntitySentientSpecter specterEntity = new EntitySentientSpecter(world);
|
||||
specterEntity.setPosition(player.posX, player.posY, player.posZ);
|
||||
world.spawnEntityInWorld(specterEntity);
|
||||
|
||||
specterEntity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, droppedStack.copy());
|
||||
|
||||
specterEntity.setType(this.getCurrentType(droppedStack));
|
||||
specterEntity.setOwner(player);
|
||||
specterEntity.setTamed(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import WayofTime.bloodmagic.BloodMagic;
|
|||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IMultiWillTool;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientSwordEffectProvider;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientTool;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWill;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWillWeapon;
|
||||
|
@ -46,7 +47,7 @@ import WayofTime.bloodmagic.util.helper.TextHelper;
|
|||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IMeshProvider, IMultiWillTool
|
||||
public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IMeshProvider, IMultiWillTool, ISentientTool
|
||||
{
|
||||
public static int[] soulBracket = new int[] { 16, 60, 200, 400, 1000, 2000, 4000 };
|
||||
public static double[] defaultDamageAdded = new double[] { 1, 1.5, 2, 2.5, 3, 3.5, 4 };
|
||||
|
@ -252,26 +253,6 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
recalculatePowers(stack, world, player);
|
||||
if (!world.isRemote && spawnSpecterOnClick)
|
||||
{
|
||||
EntitySentientSpecter specterEntity = new EntitySentientSpecter(world);
|
||||
specterEntity.setPosition(player.posX, player.posY, player.posZ);
|
||||
world.spawnEntityInWorld(specterEntity);
|
||||
System.out.println("Spawning Specter...");
|
||||
|
||||
ItemStack bowStack = new ItemStack(ModItems.sentientBow);
|
||||
((ItemSentientBow) ModItems.sentientBow).recalculatePowers(bowStack, EnumDemonWillType.CORROSIVE, 1025);
|
||||
|
||||
specterEntity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, bowStack);
|
||||
// specterEntity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, stack.copy());
|
||||
// specterEntity.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(ModItems.sentientArmourHelmet));
|
||||
// specterEntity.setItemStackToSlot(EntityEquipmentSlot.CHEST, new ItemStack(ModItems.sentientArmourChest));
|
||||
// specterEntity.setItemStackToSlot(EntityEquipmentSlot.LEGS, new ItemStack(ModItems.sentientArmourLegs));
|
||||
// specterEntity.setItemStackToSlot(EntityEquipmentSlot.FEET, new ItemStack(ModItems.sentientArmourBoots));
|
||||
specterEntity.setType(this.getCurrentType(stack));
|
||||
specterEntity.setOwner(player);
|
||||
specterEntity.setTamed(true);
|
||||
}
|
||||
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
}
|
||||
|
@ -516,4 +497,37 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
|
||||
tag.setDouble(Constants.NBT.SOUL_SWORD_SPEED, speed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player)
|
||||
{
|
||||
World world = player.worldObj;
|
||||
if (!world.isRemote)
|
||||
{
|
||||
this.recalculatePowers(droppedStack, world, player);
|
||||
|
||||
EnumDemonWillType type = this.getCurrentType(droppedStack);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
if (soulsRemaining < 1024)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerDemonWillHandler.consumeDemonWill(type, player, 100);
|
||||
|
||||
EntitySentientSpecter specterEntity = new EntitySentientSpecter(world);
|
||||
specterEntity.setPosition(player.posX, player.posY, player.posZ);
|
||||
world.spawnEntityInWorld(specterEntity);
|
||||
|
||||
specterEntity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, droppedStack.copy());
|
||||
|
||||
specterEntity.setType(this.getCurrentType(droppedStack));
|
||||
specterEntity.setOwner(player);
|
||||
specterEntity.setTamed(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue