Work on demons continues.
This commit is contained in:
parent
b661d72f88
commit
ce4b571010
8 changed files with 87 additions and 26 deletions
|
@ -9,9 +9,9 @@ public abstract class DemonHoardPacket
|
|||
|
||||
}
|
||||
|
||||
public abstract int summonDemons(World world, int x, int y, int z, DemonType type, int tier);
|
||||
public abstract int summonDemons(World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian);
|
||||
|
||||
public abstract boolean canFitType(DemonType type);
|
||||
|
||||
public abstract float getRelativeChance(DemonType type, int tier);
|
||||
public abstract float getRelativeChance(DemonType type, int tier, boolean spawnGuardian);
|
||||
}
|
||||
|
|
|
@ -13,13 +13,13 @@ public class DemonPacketAngel extends DemonHoardPacket
|
|||
}
|
||||
|
||||
@Override
|
||||
public float getRelativeChance(DemonType type, int tier)
|
||||
public float getRelativeChance(DemonType type, int tier, boolean spawnGuardian)
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int summonDemons(World world, int x, int y, int z, DemonType type, int tier)
|
||||
public int summonDemons(World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian)
|
||||
{
|
||||
Entity entity = new EntityFallenAngel(world);
|
||||
entity.setPosition(x, y, z);
|
||||
|
|
|
@ -22,7 +22,7 @@ public class DemonPacketRegistry
|
|||
return false;
|
||||
}
|
||||
|
||||
public static String getDemonPacketName(DemonType type, int tier)
|
||||
public static String getDemonPacketName(DemonType type, int tier, boolean spawnGuardian)
|
||||
{
|
||||
float totalChance = 0;
|
||||
|
||||
|
@ -35,7 +35,7 @@ public class DemonPacketRegistry
|
|||
continue;
|
||||
}
|
||||
|
||||
totalChance += packet.getRelativeChance(type, tier);
|
||||
totalChance += packet.getRelativeChance(type, tier, spawnGuardian);
|
||||
}
|
||||
|
||||
for(Entry<String, DemonHoardPacket> entry : packetMap.entrySet())
|
||||
|
@ -47,7 +47,7 @@ public class DemonPacketRegistry
|
|||
continue;
|
||||
}
|
||||
|
||||
float relativeChance = packet.getRelativeChance(type, tier);
|
||||
float relativeChance = packet.getRelativeChance(type, tier, spawnGuardian);
|
||||
|
||||
if(relativeChance >= totalChance)
|
||||
{
|
||||
|
@ -61,18 +61,18 @@ public class DemonPacketRegistry
|
|||
return "";
|
||||
}
|
||||
|
||||
public static int spawnDemons(World world, int x, int y, int z, DemonType type, int tier)
|
||||
public static int spawnDemons(World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian)
|
||||
{
|
||||
return spawnDemons(world, x, y, z, getDemonPacketName(type, tier), type, tier);
|
||||
return spawnDemons(world, x, y, z, getDemonPacketName(type, tier, spawnGuardian), type, tier, spawnGuardian);
|
||||
}
|
||||
|
||||
public static int spawnDemons(World world, int x, int y, int z, String name, DemonType type, int tier)
|
||||
public static int spawnDemons(World world, int x, int y, int z, String name, DemonType type, int tier, boolean spawnGuardian)
|
||||
{
|
||||
DemonHoardPacket packet = packetMap.get(name);
|
||||
|
||||
if(packet != null)
|
||||
{
|
||||
return packet.summonDemons(world, x, y, z, type, tier);
|
||||
return packet.summonDemons(world, x, y, z, type, tier, spawnGuardian);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -70,6 +70,11 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IRangedAttackM
|
|||
//this.isImmuneToFire = true;
|
||||
}
|
||||
|
||||
public boolean isTameable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes()
|
||||
{
|
||||
|
@ -77,7 +82,6 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IRangedAttackM
|
|||
//This line affects the speed of the monster
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D);
|
||||
|
||||
//My guess is that this will alter the max health
|
||||
if (this.isTamed())
|
||||
{
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.maxTamedHealth);
|
||||
|
@ -126,6 +130,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IRangedAttackM
|
|||
/**
|
||||
* main AI tick function, replaces updateEntityActionState
|
||||
*/
|
||||
@Override
|
||||
protected void updateAITick()
|
||||
{
|
||||
this.dataWatcher.updateObject(18, Float.valueOf(this.getHealth()));
|
||||
|
@ -134,6 +139,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IRangedAttackM
|
|||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeEntityToNBT(par1NBTTagCompound);
|
||||
|
@ -145,6 +151,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IRangedAttackM
|
|||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readEntityFromNBT(par1NBTTagCompound);
|
||||
|
@ -220,11 +227,13 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IRangedAttackM
|
|||
* The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently
|
||||
* use in wolves.
|
||||
*/
|
||||
@Override
|
||||
public int getVerticalFaceSpeed()
|
||||
{
|
||||
return this.isSitting() ? 20 : super.getVerticalFaceSpeed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTamed(boolean par1)
|
||||
{
|
||||
super.setTamed(par1);
|
||||
|
@ -286,7 +295,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IRangedAttackM
|
|||
|
||||
this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting());
|
||||
}
|
||||
} else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry())
|
||||
} else if (this.isTameable() && itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry())
|
||||
{
|
||||
if (!par1EntityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue