Fix #398, Fixed DemonPlacer so that it would spawn the demons with the owners.

This commit is contained in:
WayofTime 2015-07-27 13:36:47 -04:00
parent 79f86a3a37
commit 6470d91ff9

View file

@ -1,9 +1,7 @@
package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistry;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityDemon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@ -22,8 +20,11 @@ import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import java.util.List;
import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistry;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityDemon;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class DemonPlacer extends Item
{
@ -74,6 +75,8 @@ public class DemonPlacer extends Item
((EntityLiving) entity).setCustomNameTag(par1ItemStack.getDisplayName());
}
if (!par2EntityPlayer.capabilities.isCreativeMode)
{
--par1ItemStack.stackSize;
@ -162,12 +165,16 @@ public class DemonPlacer extends Item
entityliving.renderYawOffset = entityliving.rotationYaw;
if (entityliving instanceof EntityDemon)
{
((EntityDemon) entityliving).func_152115_b(DemonPlacer.getOwnerName(itemStack));
Entity owner = SpellHelper.getPlayerForUsername(DemonPlacer.getOwnerName(itemStack));
if(owner != null)
{
((EntityDemon) entityliving).func_152115_b(owner.getPersistentID().toString());
if (!DemonPlacer.getOwnerName(itemStack).equals(""))
{
((EntityDemon) entityliving).setTamed(true);
}
if (!DemonPlacer.getOwnerName(itemStack).equals(""))
{
((EntityDemon) entityliving).setTamed(true);
}
}
}
par0World.spawnEntityInWorld(entity);