Created all code necessary to summon the portal. I'm awesome, I know.
This commit is contained in:
parent
832ed15060
commit
9b0fa9b052
37 changed files with 915 additions and 89 deletions
|
@ -1,34 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
|
||||
public class DemonPacketAngel extends DemonHoardPacket
|
||||
{
|
||||
@Override
|
||||
public boolean canFitType(DemonType type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRelativeChance(DemonType type, int tier, boolean spawnGuardian)
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int summonDemons(TEDemonPortal teDemonPortal, World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian)
|
||||
{
|
||||
EntityLivingBase entity = new EntityMinorDemonGrunt(world);
|
||||
entity.setPosition(x, y, z);
|
||||
|
||||
world.spawnEntityInWorld(entity);
|
||||
|
||||
teDemonPortal.enthrallDemon(entity);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntEarth;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntFire;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntIce;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntWind;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
|
||||
public class DemonPacketMinorGrunt extends DemonHoardPacket
|
||||
{
|
||||
@Override
|
||||
public boolean canFitType(DemonType type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRelativeChance(DemonType type, int tier, boolean spawnGuardian)
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int summonDemons(TEDemonPortal teDemonPortal, World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian)
|
||||
{
|
||||
EntityMinorDemonGrunt entity;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case FIRE:
|
||||
entity = new EntityMinorDemonGruntFire(world);
|
||||
break;
|
||||
case ICE:
|
||||
entity = new EntityMinorDemonGruntIce(world);
|
||||
break;
|
||||
case WATER:
|
||||
entity = new EntityMinorDemonGruntEarth(world);
|
||||
break;
|
||||
case WIND:
|
||||
entity = new EntityMinorDemonGruntWind(world);
|
||||
break;
|
||||
case NORMAL:
|
||||
default:
|
||||
entity = new EntityMinorDemonGrunt(world);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
entity.setPosition(x, y, z);
|
||||
|
||||
world.spawnEntityInWorld(entity);
|
||||
|
||||
teDemonPortal.enthrallDemon(entity);
|
||||
entity.setAggro(true);
|
||||
entity.setDropCrystal(false);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard;
|
|||
|
||||
public enum DemonType
|
||||
{
|
||||
NORMAL,
|
||||
FIRE,
|
||||
WATER,
|
||||
ICE,
|
||||
|
|
|
@ -25,7 +25,7 @@ import net.minecraft.util.DamageSource;
|
|||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.common.EntityAITargetAggro;
|
||||
import WayofTime.alchemicalWizardry.common.EntityAITargetAggroCloaking;
|
||||
import WayofTime.alchemicalWizardry.common.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.ai.EntityAIOccasionalRangedAttack;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.ai.EntityDemonAIHurtByTarget;
|
||||
|
@ -62,8 +62,8 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
|
||||
this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
|
||||
this.targetTasks.addTask(3, new EntityDemonAIHurtByTarget(this, true));
|
||||
this.targetTasks.addTask(4, new EntityAITargetAggro(this, EntityPlayer.class, 0, false));
|
||||
this.setAggro(true);
|
||||
this.targetTasks.addTask(4, new EntityAITargetAggroCloaking(this, EntityPlayer.class, 0, false, 0));
|
||||
this.setAggro(false);
|
||||
this.setTamed(false);
|
||||
|
||||
demonPortal = new Int3(0,0,0);
|
||||
|
@ -419,6 +419,12 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
public boolean attackEntityAsMob(Entity par1Entity)
|
||||
{
|
||||
int i = this.isTamed() ? 20 : 20;
|
||||
|
||||
if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
|
||||
}
|
||||
|
||||
|
@ -428,6 +434,10 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
@Override
|
||||
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
|
||||
{
|
||||
if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this))
|
||||
{
|
||||
return;
|
||||
}
|
||||
double xCoord;
|
||||
double yCoord;
|
||||
double zCoord;
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.ExplosionProjectile;
|
||||
|
||||
public class EntityMinorDemonGruntEarth extends EntityMinorDemonGrunt
|
||||
{
|
||||
public EntityMinorDemonGruntEarth(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntEarthID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityAsMob(Entity par1Entity)
|
||||
{
|
||||
int i = this.isTamed() ? 20 : 20;
|
||||
if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(par1Entity instanceof EntityLivingBase)
|
||||
{
|
||||
((EntityLivingBase) par1Entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 2));
|
||||
}
|
||||
|
||||
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
|
||||
{
|
||||
if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this))
|
||||
{
|
||||
return;
|
||||
}
|
||||
double xCoord;
|
||||
double yCoord;
|
||||
double zCoord;
|
||||
ExplosionProjectile hol = new ExplosionProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 15, 600, false);
|
||||
this.worldObj.spawnEntityInWorld(hol);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.FireProjectile;
|
||||
|
||||
public class EntityMinorDemonGruntFire extends EntityMinorDemonGrunt
|
||||
{
|
||||
public EntityMinorDemonGruntFire(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntFireID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityAsMob(Entity par1Entity)
|
||||
{
|
||||
int i = this.isTamed() ? 20 : 20;
|
||||
if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
par1Entity.setFire(10);
|
||||
|
||||
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
|
||||
{
|
||||
if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this))
|
||||
{
|
||||
return;
|
||||
}
|
||||
double xCoord;
|
||||
double yCoord;
|
||||
double zCoord;
|
||||
FireProjectile hol = new FireProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 15, 600);
|
||||
this.worldObj.spawnEntityInWorld(hol);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.IceProjectile;
|
||||
|
||||
public class EntityMinorDemonGruntIce extends EntityMinorDemonGrunt
|
||||
{
|
||||
public EntityMinorDemonGruntIce(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntIceID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityAsMob(Entity par1Entity)
|
||||
{
|
||||
int i = this.isTamed() ? 20 : 20;
|
||||
if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
|
||||
{
|
||||
if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this))
|
||||
{
|
||||
return;
|
||||
}
|
||||
double xCoord;
|
||||
double yCoord;
|
||||
double zCoord;
|
||||
IceProjectile hol = new IceProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 15, 600);
|
||||
this.worldObj.spawnEntityInWorld(hol);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.WindGustProjectile;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityMinorDemonGruntWind extends EntityMinorDemonGrunt
|
||||
{
|
||||
public EntityMinorDemonGruntWind(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntWindID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityAsMob(Entity par1Entity)
|
||||
{
|
||||
int i = this.isTamed() ? 20 : 20;
|
||||
if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
|
||||
{
|
||||
if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this))
|
||||
{
|
||||
return;
|
||||
}
|
||||
double xCoord;
|
||||
double yCoord;
|
||||
double zCoord;
|
||||
WindGustProjectile hol = new WindGustProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 15, 600);
|
||||
this.worldObj.spawnEntityInWorld(hol);
|
||||
}
|
||||
}
|
|
@ -32,12 +32,12 @@ public class BlockDemonChest extends BlockChest implements IBlockPortalNode
|
|||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof TEDemonChest)
|
||||
{
|
||||
((TEDemonChest) tile).notifyPortalOfInteraction();
|
||||
}
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
// @Override
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.util.Random;
|
|||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -43,16 +44,18 @@ import com.google.gson.GsonBuilder;
|
|||
|
||||
public class TEDemonPortal extends TileEntity
|
||||
{
|
||||
public static boolean printDebug = false;
|
||||
public DemonType type = DemonType.FIRE;
|
||||
|
||||
public static boolean printDebug = true;
|
||||
|
||||
public static int buildingGridDelay = 25;
|
||||
public static int roadGridDelay = 10;
|
||||
public static int demonHoardDelay = 40;
|
||||
public static float demonRoadChance = 0.6f;
|
||||
public static float demonRoadChance = 0.3f;
|
||||
public static float demonHouseChance = 0.6f;
|
||||
public static float demonPortalChance = 0.5f;
|
||||
public static float demonHoardChance = 1.0f;
|
||||
public static float portalTickRate = 0.1f;
|
||||
public static float portalTickRate = 1f;
|
||||
|
||||
public static int[] tierCostList = new int[]{1000, 5000, 10000};
|
||||
|
||||
|
@ -82,6 +85,8 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
public int buildingStage = -1;
|
||||
|
||||
public int delayBeforeParty = 0;
|
||||
|
||||
public int lockdownTimer;
|
||||
|
||||
public TEDemonPortal()
|
||||
|
@ -287,7 +292,10 @@ public class TEDemonPortal extends TileEntity
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
DemonType[] types = DemonType.values();
|
||||
this.type = types[rand.nextInt(types.length)];
|
||||
|
||||
for (int xIndex = -negXRadius; xIndex <= posXRadius; xIndex++)
|
||||
{
|
||||
for (int zIndex = -negZRadius; zIndex <= posZRadius; zIndex++)
|
||||
|
@ -313,18 +321,52 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
if (this.createRandomBuilding(DemonBuilding.BUILDING_PORTAL, tier) >= 1)
|
||||
{
|
||||
System.out.println("Portal building successfully found!");
|
||||
this.buildingStage = 0;
|
||||
}
|
||||
|
||||
isInitialized = true;
|
||||
}
|
||||
|
||||
public void createParty()
|
||||
{
|
||||
worldObj.createExplosion(null, xCoord + rand.nextInt(10) - rand.nextInt(10), yCoord, zCoord + rand.nextInt(10) - rand.nextInt(10), 5*rand.nextFloat(), false);
|
||||
}
|
||||
|
||||
public void start()
|
||||
{
|
||||
this.delayBeforeParty = 200;
|
||||
}
|
||||
|
||||
/**
|
||||
* Randomly increase one of the cooldowns such that a road, house, or a demon portal tier is caused. Demons are also randomly spawned via this mechanic.
|
||||
*/
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
if(worldObj.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.delayBeforeParty > 0)
|
||||
{
|
||||
this.delayBeforeParty--;
|
||||
|
||||
if(rand.nextInt(20) == 0)
|
||||
{
|
||||
this.createParty();
|
||||
}
|
||||
|
||||
if(delayBeforeParty <= 0)
|
||||
{
|
||||
worldObj.createExplosion(null, xCoord, yCoord, zCoord, 15, false);
|
||||
this.initialize();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isInitialized)
|
||||
{
|
||||
return;
|
||||
|
@ -370,7 +412,7 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
if(this.demonHoardCooldown <= 0)
|
||||
{
|
||||
int complexityCost = this.createRandomDemonHoard(this, tier, DemonType.FIRE, this.isLockedDown());
|
||||
int complexityCost = this.createRandomDemonHoard(this, tier, this.type, this.isLockedDown());
|
||||
if(complexityCost > 0)
|
||||
{
|
||||
this.demonHoardCooldown = TEDemonPortal.demonHoardDelay * complexityCost;
|
||||
|
@ -448,6 +490,8 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
this.pointPool = par1NBTTagCompound.getFloat("pointPool");
|
||||
this.lockdownTimer = par1NBTTagCompound.getInteger("lockdownTimer");
|
||||
this.delayBeforeParty = par1NBTTagCompound.getInteger("delayBeforeParty");
|
||||
this.type = DemonType.valueOf(par1NBTTagCompound.getString("demonType"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -497,6 +541,8 @@ public class TEDemonPortal extends TileEntity
|
|||
par1NBTTagCompound.setInteger("nextDemonPortalDirection", this.nextDemonPortalDirection.ordinal());
|
||||
par1NBTTagCompound.setFloat("pointPool", pointPool);
|
||||
par1NBTTagCompound.setInteger("lockdownTimer", this.lockdownTimer);
|
||||
par1NBTTagCompound.setInteger("delayBeforeParty", delayBeforeParty);
|
||||
par1NBTTagCompound.setString("demonType", this.type.toString());
|
||||
}
|
||||
|
||||
public int createRandomDemonHoard(TEDemonPortal teDemonPortal, int tier, DemonType type, boolean spawnGuardian)
|
||||
|
@ -1170,10 +1216,11 @@ public class TEDemonPortal extends TileEntity
|
|||
{
|
||||
for (DemonBuilding build : TEDemonPortal.buildingList)
|
||||
{
|
||||
if (build.buildingType != DemonBuilding.BUILDING_PORTAL)
|
||||
if (build.buildingType != DemonBuilding.BUILDING_PORTAL || build.buildingTier != buildingTier)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
System.out.println("This one matches!");
|
||||
if (schemMap.containsKey(nextDir))
|
||||
{
|
||||
schemMap.get(nextDir).add(build);
|
||||
|
@ -1436,6 +1483,8 @@ public class TEDemonPortal extends TileEntity
|
|||
{
|
||||
case 0:
|
||||
return rand.nextFloat() < 0.6 ? Blocks.cobblestone : Blocks.mossy_cobblestone;
|
||||
case 1:
|
||||
return Blocks.stonebrick;
|
||||
default:
|
||||
return Blocks.nether_brick;
|
||||
}
|
||||
|
@ -1443,6 +1492,11 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
public int getRoadMeta()
|
||||
{
|
||||
switch(this.tier)
|
||||
{
|
||||
case 1:
|
||||
return rand.nextFloat() < 0.6 ? 1 : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1504,4 +1558,15 @@ public class TEDemonPortal extends TileEntity
|
|||
{
|
||||
this.demonHouseCooldown += addition;
|
||||
}
|
||||
|
||||
public void notifyPortalOfBreak()
|
||||
{
|
||||
for(IHoardDemon demon : hoardList)
|
||||
{
|
||||
if(demon instanceof Entity)
|
||||
{
|
||||
((Entity) demon).setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue