Added demon chests, started working on loot system, improved demon AI
This commit is contained in:
parent
98e7d6ede7
commit
37d0fc69f1
|
@ -1,9 +1,47 @@
|
|||
package WayofTime.alchemicalWizardry;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.block.*;
|
||||
import WayofTime.alchemicalWizardry.common.items.*;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import WayofTime.alchemicalWizardry.common.block.ArmourForge;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockAlchemicCalcinator;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockAltar;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockBelljar;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockBloodLightSource;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockConduit;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockDemonPortal;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockHomHeart;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockMasterStone;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockPedestal;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockPlinth;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockReagentConduit;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockSchematicSaver;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockSocket;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockSpectralContainer;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockSpellEffect;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockSpellEnhancement;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockSpellModifier;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockSpellParadigm;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockWritingTable;
|
||||
import WayofTime.alchemicalWizardry.common.block.BloodRune;
|
||||
import WayofTime.alchemicalWizardry.common.block.BloodStoneBrick;
|
||||
import WayofTime.alchemicalWizardry.common.block.EfficiencyRune;
|
||||
import WayofTime.alchemicalWizardry.common.block.EmptySocket;
|
||||
import WayofTime.alchemicalWizardry.common.block.ImperfectRitualStone;
|
||||
import WayofTime.alchemicalWizardry.common.block.LargeBloodStoneBrick;
|
||||
import WayofTime.alchemicalWizardry.common.block.LifeEssenceBlock;
|
||||
import WayofTime.alchemicalWizardry.common.block.RitualStone;
|
||||
import WayofTime.alchemicalWizardry.common.block.RuneOfSacrifice;
|
||||
import WayofTime.alchemicalWizardry.common.block.RuneOfSelfSacrifice;
|
||||
import WayofTime.alchemicalWizardry.common.block.SpectralBlock;
|
||||
import WayofTime.alchemicalWizardry.common.block.SpeedRune;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.BlockDemonChest;
|
||||
import WayofTime.alchemicalWizardry.common.items.ItemBlockCrystalBelljar;
|
||||
import WayofTime.alchemicalWizardry.common.items.ItemBloodRuneBlock;
|
||||
import WayofTime.alchemicalWizardry.common.items.ItemSpellEffectBlock;
|
||||
import WayofTime.alchemicalWizardry.common.items.ItemSpellEnhancementBlock;
|
||||
import WayofTime.alchemicalWizardry.common.items.ItemSpellModifierBlock;
|
||||
import WayofTime.alchemicalWizardry.common.items.ItemSpellParadigmBlock;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
|
@ -48,6 +86,7 @@ public class ModBlocks
|
|||
public static Block blockReagentConduit;
|
||||
public static Block blockAlchemicCalcinator;
|
||||
public static Block blockCrystalBelljar;
|
||||
public static Block blockDemonChest;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
|
@ -83,7 +122,8 @@ public class ModBlocks
|
|||
blockReagentConduit = new BlockReagentConduit();
|
||||
blockAlchemicCalcinator = new BlockAlchemicCalcinator();
|
||||
blockCrystalBelljar = new BlockBelljar();
|
||||
|
||||
blockDemonChest = new BlockDemonChest();
|
||||
|
||||
blockLifeEssence = new LifeEssenceBlock();
|
||||
}
|
||||
|
||||
|
@ -125,6 +165,7 @@ public class ModBlocks
|
|||
GameRegistry.registerBlock(ModBlocks.blockReagentConduit, "blockReagentConduit");
|
||||
GameRegistry.registerBlock(ModBlocks.blockAlchemicCalcinator, "blockAlchemicCalcinator");
|
||||
GameRegistry.registerBlock(ModBlocks.blockCrystalBelljar, ItemBlockCrystalBelljar.class, "blockCrystalBelljar");
|
||||
GameRegistry.registerBlock(ModBlocks.blockDemonChest, "blockDemonChest");
|
||||
}
|
||||
|
||||
public static void registerBlocksInInit()
|
||||
|
|
|
@ -1,17 +1,24 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.Int3;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLadder;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.common.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.loot.DemonVillageLootRegistry;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.IBlockPortalNode;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.ITilePortalNode;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
|
||||
|
||||
public class BlockSet
|
||||
{
|
||||
protected String blockid;
|
||||
|
@ -80,6 +87,28 @@ public class BlockSet
|
|||
metadata = southUpSet;
|
||||
break;
|
||||
}
|
||||
}else if(block instanceof BlockLadder)
|
||||
{
|
||||
int[] northSet = new int[]{2, 3, 0, 1};
|
||||
int[] eastSet = new int[]{1, 0, 2, 3};
|
||||
int[] southSet = new int[]{3, 2, 1, 0};
|
||||
int[] westSet = new int[]{0, 1, 3, 2};
|
||||
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
metadata = westSet;
|
||||
break;
|
||||
case 1:
|
||||
metadata = eastSet;
|
||||
break;
|
||||
case 2:
|
||||
metadata = northSet;
|
||||
break;
|
||||
case 3:
|
||||
metadata = southSet;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,7 +170,7 @@ public class BlockSet
|
|||
}
|
||||
}
|
||||
|
||||
public void buildAtIndex(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, int index)
|
||||
public void buildAtIndex(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, int index, boolean populateInventories, int tier)
|
||||
{
|
||||
Block block = this.getBlock();
|
||||
if (index >= positions.size() || block == null)
|
||||
|
@ -177,13 +206,34 @@ public class BlockSet
|
|||
}
|
||||
|
||||
world.setBlock(xCoord + xOff, yCoord + yOff, zCoord + zOff, block, meta, 3);
|
||||
if(populateInventories)
|
||||
{
|
||||
this.populateIfIInventory(world, xCoord + xOff, yCoord + yOff, zCoord + zOff, tier);
|
||||
}
|
||||
if(block instanceof IBlockPortalNode)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(xCoord + xOff, yCoord + yOff, zCoord + zOff);
|
||||
if(tile instanceof ITilePortalNode)
|
||||
{
|
||||
((ITilePortalNode) tile).setPortalLocation(teDemonPortal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void populateIfIInventory(World world, int x, int y, int z, int tier)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof IInventory)
|
||||
{
|
||||
DemonVillageLootRegistry.populateChest((IInventory)tile, tier);
|
||||
}
|
||||
}
|
||||
|
||||
public void buildAll(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
|
||||
public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, boolean populateInventories, int tier)
|
||||
{
|
||||
for (int i = 0; i < positions.size(); i++)
|
||||
{
|
||||
this.buildAtIndex(world, xCoord, yCoord, zCoord, dir, i);
|
||||
this.buildAtIndex(teDemonPortal, world, xCoord, yCoord, zCoord, dir, i, populateInventories, tier);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.Int3;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
|
||||
public class BuildingSchematic
|
||||
{
|
||||
public String name;
|
||||
|
@ -51,11 +52,11 @@ public class BuildingSchematic
|
|||
blockList.add(set);
|
||||
}
|
||||
|
||||
public void buildAll(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
|
||||
public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, boolean populateInventories)
|
||||
{
|
||||
for (BlockSet set : blockList)
|
||||
{
|
||||
set.buildAll(world, xCoord, yCoord, zCoord, dir);
|
||||
set.buildAll(teDemonPortal, world, xCoord, yCoord, zCoord, dir, populateInventories, this.buildingTier);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.Int3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.common.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
|
||||
public class DemonBuilding
|
||||
{
|
||||
|
@ -34,9 +35,9 @@ public class DemonBuilding
|
|||
return area.doesContainAll(master, gridX, gridZ, dir);
|
||||
}
|
||||
|
||||
public void buildAll(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
|
||||
public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, boolean populateInventories)
|
||||
{
|
||||
schematic.buildAll(world, xCoord, yCoord, zCoord, dir);
|
||||
schematic.buildAll(teDemonPortal, world, xCoord, yCoord, zCoord, dir, populateInventories);
|
||||
}
|
||||
|
||||
public void setAllGridSpaces(int xInit, int zInit, int yLevel, ForgeDirection dir, int type, GridSpaceHolder master)
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.ai;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.ai.EntityAIHurtByTarget;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import WayofTime.alchemicalWizardry.common.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
|
@ -25,37 +21,44 @@ public class EntityDemonAIHurtByTarget extends EntityAIHurtByTarget
|
|||
@Override
|
||||
public void startExecuting()
|
||||
{
|
||||
Int3 portalPosition = ((IHoardDemon)this.taskOwner).getPortalLocation();
|
||||
if(portalPosition == null)
|
||||
{
|
||||
super.startExecuting();
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity portal = this.taskOwner.worldObj.getTileEntity(portalPosition.xCoord, portalPosition.yCoord, portalPosition.zCoord);
|
||||
|
||||
if((this.taskOwner.getAITarget() instanceof IHoardDemon && portalPosition.equals(((IHoardDemon)this.taskOwner.getAITarget()).getPortalLocation())))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.taskOwner.setAttackTarget(this.taskOwner.getAITarget());
|
||||
this.revengeTimer = this.taskOwner.func_142015_aE();
|
||||
|
||||
if (this.entityCallsForHelp && this.taskOwner instanceof IHoardDemon)
|
||||
{
|
||||
Int3 portalPosition = ((IHoardDemon)this.taskOwner).getPortalLocation();
|
||||
if(portalPosition == null)
|
||||
{
|
||||
super.startExecuting();
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity portal = this.taskOwner.worldObj.getTileEntity(portalPosition.xCoord, portalPosition.yCoord, portalPosition.zCoord);
|
||||
if(portal instanceof TEDemonPortal)
|
||||
{
|
||||
{
|
||||
((TEDemonPortal) portal).notifyDemons(taskOwner, this.taskOwner.getAITarget(), 25);
|
||||
}
|
||||
|
||||
double d0 = this.getTargetDistance();
|
||||
List list = this.taskOwner.worldObj.getEntitiesWithinAABB(this.taskOwner.getClass(), AxisAlignedBB.getBoundingBox(this.taskOwner.posX, this.taskOwner.posY, this.taskOwner.posZ, this.taskOwner.posX + 1.0D, this.taskOwner.posY + 1.0D, this.taskOwner.posZ + 1.0D).expand(d0, 10.0D, d0));
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
EntityCreature entitycreature = (EntityCreature)iterator.next();
|
||||
|
||||
if (this.taskOwner != entitycreature && entitycreature.getAttackTarget() == null && !entitycreature.isOnSameTeam(this.taskOwner.getAITarget()))
|
||||
{
|
||||
entitycreature.setAttackTarget(this.taskOwner.getAITarget());
|
||||
}
|
||||
}
|
||||
// double d0 = this.getTargetDistance();
|
||||
// List list = this.taskOwner.worldObj.getEntitiesWithinAABB(this.taskOwner.getClass(), AxisAlignedBB.getBoundingBox(this.taskOwner.posX, this.taskOwner.posY, this.taskOwner.posZ, this.taskOwner.posX + 1.0D, this.taskOwner.posY + 1.0D, this.taskOwner.posZ + 1.0D).expand(d0, 10.0D, d0));
|
||||
// Iterator iterator = list.iterator();
|
||||
//
|
||||
// while (iterator.hasNext())
|
||||
// {
|
||||
// EntityCreature entitycreature = (EntityCreature)iterator.next();
|
||||
//
|
||||
// if (this.taskOwner != entitycreature && entitycreature.getAttackTarget() == null && !entitycreature.isOnSameTeam(this.taskOwner.getAITarget()))
|
||||
// {
|
||||
// entitycreature.setAttackTarget(this.taskOwner.getAITarget());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
super.startExecuting();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class DemonHoardPacket
|
||||
|
@ -9,7 +10,7 @@ public abstract class DemonHoardPacket
|
|||
|
||||
}
|
||||
|
||||
public abstract int summonDemons(World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian);
|
||||
public abstract int summonDemons(TEDemonPortal teDemonPortal, World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian);
|
||||
|
||||
public abstract boolean canFitType(DemonType type);
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityFallenAngel;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
|
||||
public class DemonPacketAngel extends DemonHoardPacket
|
||||
{
|
||||
|
@ -19,12 +20,15 @@ public class DemonPacketAngel extends DemonHoardPacket
|
|||
}
|
||||
|
||||
@Override
|
||||
public int summonDemons(World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian)
|
||||
public int summonDemons(TEDemonPortal teDemonPortal, World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian)
|
||||
{
|
||||
Entity entity = new EntityFallenAngel(world);
|
||||
EntityLivingBase entity = new EntityMinorDemonGrunt(world);
|
||||
entity.setPosition(x, y, z);
|
||||
|
||||
world.spawnEntityInWorld(entity);
|
||||
|
||||
teDemonPortal.enthrallDemon(entity);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class DemonPacketRegistry
|
||||
|
@ -61,18 +62,18 @@ public class DemonPacketRegistry
|
|||
return "";
|
||||
}
|
||||
|
||||
public static int spawnDemons(World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian)
|
||||
public static int spawnDemons(TEDemonPortal teDemonPortal, World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian)
|
||||
{
|
||||
return spawnDemons(world, x, y, z, getDemonPacketName(type, tier, spawnGuardian), type, tier, spawnGuardian);
|
||||
return spawnDemons(teDemonPortal, 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, boolean spawnGuardian)
|
||||
public static int spawnDemons(TEDemonPortal teDemonPortal, 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, spawnGuardian);
|
||||
return packet.summonDemons(teDemonPortal, world, x, y, z, type, tier, spawnGuardian);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -5,7 +5,6 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
|
||||
import net.minecraft.entity.ai.EntityAIFollowOwner;
|
||||
import net.minecraft.entity.ai.EntityAIHurtByTarget;
|
||||
import net.minecraft.entity.ai.EntityAILookIdle;
|
||||
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
|
||||
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
|
||||
|
@ -21,13 +20,16 @@ import net.minecraft.item.ItemFood;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.pathfinding.PathEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.common.EntityAITargetAggro;
|
||||
import WayofTime.alchemicalWizardry.common.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.ai.EntityAIOccasionalRangedAttack;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.ai.EntityDemonAIHurtByTarget;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.ai.IOccasionalRangedAttackMob;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityDemon;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
@ -37,11 +39,13 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
private EntityAIOccasionalRangedAttack aiArrowAttack = new EntityAIOccasionalRangedAttack(this, 1.0D, 40, 40, 15.0F, 5);
|
||||
private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);
|
||||
|
||||
private boolean isAngry = false;
|
||||
private boolean isAngry = true;
|
||||
private Int3 demonPortal;
|
||||
|
||||
private static float maxTamedHealth = 50.0F;
|
||||
private static float maxUntamedHealth = 50.0F;
|
||||
private static float maxTamedHealth = 200.0F;
|
||||
private static float maxUntamedHealth = 200.0F;
|
||||
|
||||
private boolean enthralled = false;
|
||||
|
||||
public EntityMinorDemonGrunt(World par1World)
|
||||
{
|
||||
|
@ -56,7 +60,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
this.tasks.addTask(6, new EntityAILookIdle(this));
|
||||
this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
|
||||
this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
|
||||
this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));
|
||||
this.targetTasks.addTask(3, new EntityDemonAIHurtByTarget(this, true));
|
||||
this.targetTasks.addTask(4, new EntityAITargetAggro(this, EntityPlayer.class, 0, false));
|
||||
this.setAggro(false);
|
||||
this.setTamed(false);
|
||||
|
@ -215,6 +219,15 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
if(!this.enthralled)
|
||||
{
|
||||
TileEntity tile = this.worldObj.getTileEntity(this.demonPortal.xCoord, this.demonPortal.yCoord, this.demonPortal.zCoord);
|
||||
if(tile instanceof TEDemonPortal)
|
||||
{
|
||||
((TEDemonPortal) tile).enthrallDemon(this);
|
||||
this.enthralled = true;
|
||||
}
|
||||
}
|
||||
super.onUpdate();
|
||||
}
|
||||
|
||||
|
@ -437,4 +450,11 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean thrallDemon(TEDemonPortal teDemonPortal)
|
||||
{
|
||||
this.setPortalLocation(new Int3(teDemonPortal.xCoord, teDemonPortal.yCoord, teDemonPortal.zCoord));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
|
||||
public interface IHoardDemon
|
||||
{
|
||||
public void setPortalLocation(Int3 position);
|
||||
public Int3 getPortalLocation();
|
||||
public boolean thrallDemon(TEDemonPortal teDemonPortal);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.loot;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
|
||||
public class DemonVillageLootRegistry
|
||||
{
|
||||
public static ArrayList<WeightedRandomChestContent> list = new ArrayList();
|
||||
|
||||
static
|
||||
{
|
||||
list.add(new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 10));
|
||||
}
|
||||
|
||||
public static void populateChest(IInventory tile, int tier)
|
||||
{
|
||||
WeightedRandomChestContent.generateChestContents(new Random(), toArray(list), tile, 10);
|
||||
}
|
||||
|
||||
public static WeightedRandomChestContent[] toArray(List<WeightedRandomChestContent> aList)
|
||||
{
|
||||
int size = aList.size();
|
||||
WeightedRandomChestContent[] contents = new WeightedRandomChestContent[size];
|
||||
|
||||
contents = aList.toArray(contents);
|
||||
|
||||
return contents;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.tileEntity;
|
||||
|
||||
import net.minecraft.block.BlockChest;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
|
||||
public class BlockDemonChest extends BlockChest implements IBlockPortalNode
|
||||
{
|
||||
public BlockDemonChest()
|
||||
{
|
||||
super(0);
|
||||
this.setHardness(2.5F).setStepSound(soundTypeWood).setBlockName("demonChest");
|
||||
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
public IInventory func_149951_m(World world, int x, int y, int z)
|
||||
{
|
||||
IInventory object = (IInventory)world.getTileEntity(x, y, z);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2)
|
||||
{
|
||||
return new TEDemonChest();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.tileEntity;
|
||||
|
||||
public interface IBlockPortalNode
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.tileEntity;
|
||||
|
||||
public interface ITilePortalNode
|
||||
{
|
||||
public void setPortalLocation(TEDemonPortal teDemonPortal);
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.tileEntity;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityChest;
|
||||
import WayofTime.alchemicalWizardry.common.Int3;
|
||||
|
||||
public class TEDemonChest extends TileEntityChest implements ITilePortalNode
|
||||
{
|
||||
public Int3 portalLocation = new Int3(0,0,0);
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
{
|
||||
return "Demon's Chest";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT(tag);
|
||||
NBTTagCompound portalTag = tag.getCompoundTag("portalLocation");
|
||||
portalLocation = Int3.readFromNBT(portalTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(tag);
|
||||
NBTTagCompound portalTag = portalLocation.writeToNBT(new NBTTagCompound());
|
||||
tag.setTag("portalLocation", portalTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkForAdjacentChests()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPortalLocation(TEDemonPortal teDemonPortal)
|
||||
{
|
||||
if(teDemonPortal != null)
|
||||
{
|
||||
portalLocation = new Int3(teDemonPortal.xCoord, teDemonPortal.yCoord, teDemonPortal.zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
public TEDemonPortal getDemonPortal()
|
||||
{
|
||||
TileEntity tile = worldObj.getTileEntity(portalLocation.xCoord, portalLocation.yCoord, portalLocation.zCoord);
|
||||
if(tile instanceof TEDemonPortal)
|
||||
{
|
||||
return (TEDemonPortal)tile;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void notifyPortalOfInteraction()
|
||||
{
|
||||
TEDemonPortal portal = this.getDemonPortal();
|
||||
if(portal == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
portal.notifyDemons(xCoord, yCoord, zCoord, 25);
|
||||
}
|
||||
}
|
|
@ -33,7 +33,7 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
public static int buildingGridDelay = 25;
|
||||
public static int roadGridDelay = 10;
|
||||
public static int demonHoardDelay = 10;
|
||||
public static int demonHoardDelay = 40;
|
||||
|
||||
public static int[] tierCostList = new int[]{1000, 5000, 10000};
|
||||
|
||||
|
@ -202,7 +202,6 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
public void notifyDemons(EntityLivingBase demon, EntityLivingBase target, double radius) //TODO
|
||||
{
|
||||
// if (this.taskOwner != entitycreature && entitycreature.getAttackTarget() == null && !entitycreature.isOnSameTeam(this.taskOwner.getAITarget()))
|
||||
for(IHoardDemon thrallDemon : this.hoardList)
|
||||
{
|
||||
if(thrallDemon instanceof EntityCreature)
|
||||
|
@ -220,6 +219,30 @@ public class TEDemonPortal extends TileEntity
|
|||
if((xi-xf)*(xi-xf) + (yi-yf)*(yi-yf) + (zi-zf)*(zi-zf) <= radius*radius)
|
||||
{
|
||||
((EntityCreature) thrallDemon).setAttackTarget(target);
|
||||
}else
|
||||
{
|
||||
((EntityCreature) thrallDemon).getNavigator().tryMoveToEntityLiving(target, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyDemons(int xf, int yf, int zf, double radius)
|
||||
{
|
||||
for(IHoardDemon thrallDemon : this.hoardList)
|
||||
{
|
||||
if(thrallDemon instanceof EntityCreature)
|
||||
{
|
||||
if(((EntityCreature) thrallDemon).getAttackTarget() == null)
|
||||
{
|
||||
double xi = ((EntityCreature) thrallDemon).posX;
|
||||
double yi = ((EntityCreature) thrallDemon).posY;
|
||||
double zi = ((EntityCreature) thrallDemon).posZ;
|
||||
|
||||
if((xi-xf)*(xi-xf) + (yi-yf)*(yi-yf) + (zi-zf)*(zi-zf) <= radius*radius)
|
||||
{
|
||||
((EntityCreature) thrallDemon).getNavigator().tryMoveToXYZ(xf, yf, zf, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -230,7 +253,11 @@ public class TEDemonPortal extends TileEntity
|
|||
{
|
||||
if(demon instanceof IHoardDemon)
|
||||
{
|
||||
this.hoardList.add((IHoardDemon)demon);
|
||||
boolean enthrall = ((IHoardDemon) demon).thrallDemon(this);
|
||||
if(enthrall)
|
||||
{
|
||||
this.hoardList.add((IHoardDemon)demon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -312,7 +339,7 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
if(this.demonHoardCooldown <= 0)
|
||||
{
|
||||
int complexityCost = this.createRandomDemonHoard(tier, DemonType.FIRE, this.isLockedDown());
|
||||
int complexityCost = this.createRandomDemonHoard(this, tier, DemonType.FIRE, this.isLockedDown());
|
||||
if(complexityCost > 0)
|
||||
{
|
||||
this.demonHoardCooldown = TEDemonPortal.demonHoardDelay * complexityCost;
|
||||
|
@ -441,7 +468,7 @@ public class TEDemonPortal extends TileEntity
|
|||
par1NBTTagCompound.setInteger("lockdownTimer", this.lockdownTimer);
|
||||
}
|
||||
|
||||
public int createRandomDemonHoard(int tier, DemonType type, boolean spawnGuardian)
|
||||
public int createRandomDemonHoard(TEDemonPortal teDemonPortal, int tier, DemonType type, boolean spawnGuardian)
|
||||
{
|
||||
int next = rand.nextInt(4);
|
||||
ForgeDirection dir;
|
||||
|
@ -470,7 +497,7 @@ public class TEDemonPortal extends TileEntity
|
|||
return 0;
|
||||
}
|
||||
|
||||
return DemonPacketRegistry.spawnDemons(worldObj, xCoord + road.xCoord * 5, yCoord + road.yCoord, zCoord + road.zCoord * 5, type, tier, spawnGuardian);
|
||||
return DemonPacketRegistry.spawnDemons(teDemonPortal, worldObj, xCoord + road.xCoord * 5, road.yCoord + 1, zCoord + road.zCoord * 5, type, tier, spawnGuardian);
|
||||
}
|
||||
|
||||
public int createRandomRoad() //Return the number of road spaces
|
||||
|
@ -1190,7 +1217,7 @@ public class TEDemonPortal extends TileEntity
|
|||
case 2:
|
||||
build.destroyAllInField(worldObj, xCoord + (x) * 5, yLevel, zCoord + (z) * 5, chosenDirection.getOpposite());
|
||||
|
||||
build.buildAll(worldObj, xCoord + (x) * 5, yLevel, zCoord + (z) * 5, chosenDirection.getOpposite());
|
||||
build.buildAll(this, worldObj, xCoord + (x) * 5, yLevel, zCoord + (z) * 5, chosenDirection.getOpposite(), true);
|
||||
build.setAllGridSpaces(x, z, yLevel, chosenDirection.getOpposite(), GridSpace.MAIN_PORTAL, grid);
|
||||
this.loadGSH(grid);
|
||||
break;
|
||||
|
@ -1300,7 +1327,7 @@ public class TEDemonPortal extends TileEntity
|
|||
int zOff = offsetSpace.zCoord;
|
||||
|
||||
build.destroyAllInField(worldObj, xCoord + (x + xOff) * 5, yLevel, zCoord + (z + zOff) * 5, chosenDirection.getOpposite());
|
||||
build.buildAll(worldObj, xCoord + (x + xOff) * 5, yLevel, zCoord + (z + zOff) * 5, chosenDirection.getOpposite());
|
||||
build.buildAll(this, worldObj, xCoord + (x + xOff) * 5, yLevel, zCoord + (z + zOff) * 5, chosenDirection.getOpposite(), true);
|
||||
build.setAllGridSpaces(x + xOff, z + zOff, yLevel, chosenDirection.getOpposite(), GridSpace.HOUSE, grid);
|
||||
this.loadGSH(grid);
|
||||
|
||||
|
|
Loading…
Reference in a new issue