Fix to Full Stomach ritual, adding new system for summoning registry
This commit is contained in:
parent
3360a4d85c
commit
dc1357739b
|
@ -14,6 +14,7 @@ import WayofTime.alchemicalWizardry.common.*;
|
|||
import WayofTime.alchemicalWizardry.common.alchemy.CombinedPotionRegistry;
|
||||
import WayofTime.alchemicalWizardry.common.block.ArmourForge;
|
||||
import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.UpgradedAltars;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.*;
|
||||
import WayofTime.alchemicalWizardry.common.harvest.BloodMagicHarvestHandler;
|
||||
import WayofTime.alchemicalWizardry.common.harvest.CactusReedHarvestHandler;
|
||||
|
@ -163,20 +164,20 @@ public class AlchemicalWizardry
|
|||
public static int greaterLengtheningCatalystDungeonChance;
|
||||
|
||||
//Mob IDs
|
||||
public static int entityFallenAngelID = 20;
|
||||
public static int entityLowerGuardianID = 21;
|
||||
public static int entityBileDemonID = 22;
|
||||
public static int entityWingedFireDemonID = 23;
|
||||
public static int entitySmallEarthGolemID = 24;
|
||||
public static int entityIceDemonID = 25;
|
||||
public static int entityBoulderFistID = 26;
|
||||
public static int entityShadeID = 27;
|
||||
public static int entityAirElementalID = 28;
|
||||
public static int entityWaterElementalID = 29;
|
||||
public static int entityEarthElementalID = 30;
|
||||
public static int entityFireElementalID = 31;
|
||||
public static int entityShadeElementalID = 32;
|
||||
public static int entityHolyElementalID = 33;
|
||||
public static String entityFallenAngelID = "AW001FallenAngel";
|
||||
public static String entityLowerGuardianID = "AW001";
|
||||
public static String entityBileDemonID = "AW001";
|
||||
public static String entityWingedFireDemonID = "AW001";
|
||||
public static String entitySmallEarthGolemID = "AW001";
|
||||
public static String entityIceDemonID = "AW001";
|
||||
public static String entityBoulderFistID = "AW001";
|
||||
public static String entityShadeID = "AW001";
|
||||
public static String entityAirElementalID = "AW001";
|
||||
public static String entityWaterElementalID = "AW001";
|
||||
public static String entityEarthElementalID = "AW001";
|
||||
public static String entityFireElementalID = "AW001";
|
||||
public static String entityShadeElementalID = "AW001";
|
||||
public static String entityHolyElementalID = "AW001";
|
||||
|
||||
|
||||
public static Fluid lifeEssenceFluid;
|
||||
|
@ -606,20 +607,20 @@ public class AlchemicalWizardry
|
|||
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityHolyElementalID), new ItemStack[]{sanctusStack, sanctusStack, sanctusStack, sanctusStack, sanctusStack, sanctusStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
|
||||
|
||||
//Custom mobs
|
||||
EntityRegistry.registerModEntity(EntityFallenAngel.class, "FallenAngel", this.entityFallenAngelID, this, 80, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityLowerGuardian.class, "LowerGuardian", this.entityLowerGuardianID, this, 80, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityBileDemon.class, "BileDemon", this.entityBileDemonID, this, 80, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityWingedFireDemon.class, "WingedFireDemon", this.entityWingedFireDemonID, this, 80, 3, true);
|
||||
EntityRegistry.registerModEntity(EntitySmallEarthGolem.class, "SmallEarthGolem", this.entitySmallEarthGolemID, this, 80, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityIceDemon.class, "IceDemon", this.entityIceDemonID, this, 80, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityBoulderFist.class, "BoulderFist", this.entityBoulderFistID, this, 80, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityShade.class, "Shade", this.entityShadeID, this, 80, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityAirElemental.class, "AirElemental", this.entityAirElementalID, this, 120, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityWaterElemental.class, "WaterElemental", this.entityWaterElementalID, this, 120, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityEarthElemental.class, "EarthElemental", this.entityEarthElementalID, this, 120, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityFireElemental.class, "FireElemental", this.entityFireElementalID, this, 120, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityShadeElemental.class, "ShadeElemental", this.entityShadeElementalID, this, 120, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityHolyElemental.class, "HolyElemental", this.entityHolyElementalID, this, 120, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityFallenAngel.class, "FallenAngel", 20, this, 80, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityLowerGuardian.class, "LowerGuardian", 21, this, 80, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityBileDemon.class, "BileDemon", 22, this, 80, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityWingedFireDemon.class, "WingedFireDemon", 23, this, 80, 3, true);
|
||||
EntityRegistry.registerModEntity(EntitySmallEarthGolem.class, "SmallEarthGolem", 24, this, 80, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityIceDemon.class, "IceDemon", 25, this, 80, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityBoulderFist.class, "BoulderFist", 26, this, 80, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityShade.class, "Shade", 27, this, 80, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityAirElemental.class, "AirElemental", 28, this, 120, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityWaterElemental.class, "WaterElemental", 29, this, 120, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityEarthElemental.class, "EarthElemental", 30, this, 120, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityFireElemental.class, "FireElemental", 31, this, 120, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityShadeElemental.class, "ShadeElemental", 32, this, 120, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityHolyElemental.class, "HolyElemental", 33, this, 120, 3, true);
|
||||
|
||||
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.standardBindingAgent), 1, 3, this.standardBindingAgentDungeonChance));
|
||||
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.mundanePowerCatalyst), 1, 1, this.mundanePowerCatalystDungeonChance));
|
||||
|
|
|
@ -5,16 +5,16 @@ import net.minecraft.world.World;
|
|||
|
||||
public abstract class SummoningHelper
|
||||
{
|
||||
protected int id;
|
||||
protected String id;
|
||||
|
||||
public SummoningHelper(int id)
|
||||
public SummoningHelper(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public abstract EntityLivingBase getEntity(World worldObj);
|
||||
|
||||
public int getSummoningHelperID()
|
||||
public String getSummoningHelperID()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
|
|
@ -55,11 +55,11 @@ public class SummoningRegistry
|
|||
return null;
|
||||
}
|
||||
|
||||
public static EntityLivingBase getEntityWithID(World worldObj, int id)
|
||||
public static EntityLivingBase getEntityWithID(World worldObj, String id)
|
||||
{
|
||||
for (SummoningRegistryComponent src : summoningList)
|
||||
{
|
||||
if (src.getSummoningHelperID() == id)
|
||||
if (src.getSummoningHelperID().equals(id))
|
||||
{
|
||||
return src.getEntity(worldObj);
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ public class SummoningRegistryComponent
|
|||
}
|
||||
}
|
||||
|
||||
public int getSummoningHelperID()
|
||||
public String getSummoningHelperID()
|
||||
{
|
||||
return this.summoningHelper.getSummoningHelperID();
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.event.AnvilUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
|
@ -29,13 +30,15 @@ import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn;
|
|||
import vazkii.botania.api.internal.IManaBurst;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.items.BoundArmour;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class AlchemicalWizardryEventHooks
|
||||
{
|
||||
|
@ -46,6 +49,16 @@ public class AlchemicalWizardryEventHooks
|
|||
public static Map<Integer, List<CoordAndRange>> respawnMap = new HashMap();
|
||||
public static Map<Integer, List<CoordAndRange>> forceSpawnMap = new HashMap();
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onAnvilUpdateEvent(AnvilUpdateEvent event)
|
||||
{
|
||||
if(event.isCancelable() && event.left != null && event.left.getItem() instanceof BoundArmour && event.right != null)
|
||||
{
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerDamageEvent(LivingAttackEvent event)
|
||||
{
|
||||
|
@ -108,6 +121,7 @@ public class AlchemicalWizardryEventHooks
|
|||
|
||||
if (event.entityLiving instanceof EntityCreeper)
|
||||
{
|
||||
GameRegistry d;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEDemonPortal;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package WayofTime.alchemicalWizardry.common.tileEntity;
|
||||
package WayofTime.alchemicalWizardry.common.demonVillage.tileEntity;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
|
@ -39,8 +39,9 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
public static int buildingGridDelay = 25;
|
||||
public static int roadGridDelay = 10;
|
||||
public static int demonHoardDelay = 10;
|
||||
|
||||
public static int[] tierCostList = new int[]{1000, 50000, 55000};
|
||||
public static int[] tierCostList = new int[]{1000, 5000, 10000};
|
||||
|
||||
public static List<DemonBuilding> buildingList = new ArrayList();
|
||||
public Random rand = new Random();
|
||||
|
@ -56,7 +57,10 @@ public class TEDemonPortal extends TileEntity
|
|||
public int houseCooldown;
|
||||
public int roadCooldown;
|
||||
public int tier; //Tier of the demon portal - Should select buildings 2 below to this
|
||||
public int totalPoints;
|
||||
public int demonHouseCooldown;
|
||||
public int demonHoardCooldown;
|
||||
|
||||
public float pointPool;
|
||||
|
||||
public String nextDemonPortalName = "";
|
||||
public ForgeDirection nextDemonPortalDirection = ForgeDirection.DOWN;
|
||||
|
@ -93,13 +97,14 @@ public class TEDemonPortal extends TileEntity
|
|||
this.tier = 0;
|
||||
}
|
||||
|
||||
public void decreaseRandomCooldown(int amount)
|
||||
public boolean decreaseRandomCooldown(int amount)
|
||||
{
|
||||
float totalChance = 0;
|
||||
|
||||
Map<String, Float> map = new HashMap();
|
||||
map.put("roadChance", 0.3f);
|
||||
map.put("houseChance", 0.6f);
|
||||
map.put("roadChance", 0.6f);
|
||||
map.put("houseChance", 0.3f);
|
||||
map.put("demonPortalChance", 0.5f);
|
||||
|
||||
String action = "";
|
||||
|
||||
|
@ -125,11 +130,28 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
if(action.equals("roadChance"))
|
||||
{
|
||||
roadCooldown -= amount;
|
||||
if(roadCooldown > 0)
|
||||
{
|
||||
roadCooldown -= amount;
|
||||
}else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}else if(action.equals("houseChance"))
|
||||
{
|
||||
houseCooldown -= amount;
|
||||
}
|
||||
if(houseCooldown > 0)
|
||||
{
|
||||
houseCooldown -= amount;
|
||||
}else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}else if(action.equals("demonPortalChance"))
|
||||
{
|
||||
demonHouseCooldown += amount;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void initialize()
|
||||
|
@ -158,10 +180,14 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
this.houseCooldown = TEDemonPortal.buildingGridDelay;
|
||||
this.roadCooldown = TEDemonPortal.roadGridDelay;
|
||||
this.demonHoardCooldown = TEDemonPortal.demonHoardDelay;
|
||||
|
||||
isInitialized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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()
|
||||
{
|
||||
|
@ -170,6 +196,9 @@ public class TEDemonPortal extends TileEntity
|
|||
return;
|
||||
}
|
||||
|
||||
this.incrementPoints();
|
||||
this.assignPoints();
|
||||
|
||||
System.out.println("Roads: " + roadCooldown + " Buildings: " + houseCooldown);
|
||||
|
||||
if(buildingStage >= 0 && buildingStage <=2)
|
||||
|
@ -179,41 +208,37 @@ public class TEDemonPortal extends TileEntity
|
|||
buildingStage++;
|
||||
return;
|
||||
}
|
||||
|
||||
// if (this.hasLocationChanged)
|
||||
// {
|
||||
// if (this.changePortalLocation())
|
||||
// {
|
||||
// if(printDebug)
|
||||
// System.out.println("Changed portal location.");
|
||||
// return;
|
||||
// } else
|
||||
// {
|
||||
// if(printDebug)
|
||||
// System.out.println("Going back to normal, have a nice day!");
|
||||
// this.hasLocationChanged = false;
|
||||
// }
|
||||
// }
|
||||
|
||||
if (this.roadCooldown <= 0)
|
||||
if(this.roadCooldown <= 0)
|
||||
{
|
||||
int roadsMade = this.createRandomRoad();
|
||||
if (roadsMade > 0)
|
||||
{
|
||||
this.roadCooldown = TEDemonPortal.roadGridDelay * roadsMade;
|
||||
this.totalPoints += this.roadCooldown;
|
||||
//this.demonHouseCooldown += this.roadCooldown;
|
||||
}
|
||||
} else if (this.houseCooldown <= 0)
|
||||
}
|
||||
|
||||
if(this.houseCooldown <= 0)
|
||||
{
|
||||
int gridsUsed = this.createRandomBuilding(DemonBuilding.BUILDING_HOUSE, tier);
|
||||
if (gridsUsed > 0)
|
||||
{
|
||||
this.houseCooldown = TEDemonPortal.buildingGridDelay * gridsUsed;
|
||||
this.totalPoints += this.houseCooldown;
|
||||
//this.demonHouseCooldown += this.houseCooldown;
|
||||
}
|
||||
}
|
||||
|
||||
if(this.demonHoardCooldown <= 0)
|
||||
{
|
||||
int complexityCost = this.createRandomDemonHoard(tier);
|
||||
if(complexityCost > 0)
|
||||
{
|
||||
this.demonHoardCooldown = TEDemonPortal.demonHoardDelay * complexityCost;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.tier < this.tierCostList.length && this.totalPoints > this.tierCostList[this.tier])
|
||||
if(this.tier < this.tierCostList.length && this.demonHouseCooldown > this.tierCostList[this.tier])
|
||||
{
|
||||
this.tier++;
|
||||
|
||||
|
@ -223,8 +248,25 @@ public class TEDemonPortal extends TileEntity
|
|||
}
|
||||
}
|
||||
|
||||
this.houseCooldown = Math.max(0, this.houseCooldown - 1); //Current dummy implementation of the increasing costs
|
||||
this.roadCooldown = Math.max(0, this.roadCooldown - 1);
|
||||
|
||||
// this.houseCooldown = Math.max(0, this.houseCooldown - 1); //Current dummy implementation of the increasing costs
|
||||
// this.roadCooldown = Math.max(0, this.roadCooldown - 1);
|
||||
}
|
||||
|
||||
public void assignPoints()
|
||||
{
|
||||
if((int)this.pointPool > 0)
|
||||
{
|
||||
if(this.decreaseRandomCooldown((int)this.pointPool))
|
||||
{
|
||||
this.pointPool -= (int)this.pointPool;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void incrementPoints()
|
||||
{
|
||||
this.pointPool += 1f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -237,6 +279,7 @@ public class TEDemonPortal extends TileEntity
|
|||
this.posZRadius = par1NBTTagCompound.getInteger("posZRadius");
|
||||
this.houseCooldown = par1NBTTagCompound.getInteger("houseCooldown");
|
||||
this.roadCooldown = par1NBTTagCompound.getInteger("roadCooldown");
|
||||
this.demonHoardCooldown = par1NBTTagCompound.getInteger("demonHoardCooldown");
|
||||
|
||||
area = new GridSpace[negXRadius + posXRadius + 1][negZRadius + posZRadius + 1];
|
||||
|
||||
|
@ -258,11 +301,13 @@ public class TEDemonPortal extends TileEntity
|
|||
this.isInitialized = par1NBTTagCompound.getBoolean("init");
|
||||
|
||||
this.tier = par1NBTTagCompound.getInteger("tier");
|
||||
this.totalPoints = par1NBTTagCompound.getInteger("totalPoints");
|
||||
this.demonHouseCooldown = par1NBTTagCompound.getInteger("demonHouseCooldown");
|
||||
|
||||
this.nextDemonPortalName = par1NBTTagCompound.getString("nextDemonPortalName");
|
||||
this.buildingStage = par1NBTTagCompound.getInteger("buildingStage");
|
||||
this.nextDemonPortalDirection = ForgeDirection.getOrientation(par1NBTTagCompound.getInteger("nextDemonPortalDirection"));
|
||||
|
||||
this.pointPool = par1NBTTagCompound.getFloat("pointPool");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -275,6 +320,7 @@ public class TEDemonPortal extends TileEntity
|
|||
par1NBTTagCompound.setInteger("posZRadius", posZRadius);
|
||||
par1NBTTagCompound.setInteger("houseCooldown", houseCooldown);
|
||||
par1NBTTagCompound.setInteger("roadCooldown", roadCooldown);
|
||||
par1NBTTagCompound.setInteger("demonHoardCooldown", demonHoardCooldown);
|
||||
|
||||
NBTTagList gridList = new NBTTagList();
|
||||
|
||||
|
@ -303,14 +349,22 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
par1NBTTagCompound.setBoolean("init", this.isInitialized);
|
||||
par1NBTTagCompound.setInteger("tier", this.tier);
|
||||
par1NBTTagCompound.setInteger("totalPoints", this.totalPoints);
|
||||
par1NBTTagCompound.setInteger("demonHouseCooldown", this.demonHouseCooldown);
|
||||
|
||||
par1NBTTagCompound.setString("nextDemonPortalName", nextDemonPortalName);
|
||||
par1NBTTagCompound.setInteger("buildingStage", buildingStage);
|
||||
|
||||
par1NBTTagCompound.setInteger("nextDemonPortalDirection", this.nextDemonPortalDirection.ordinal());
|
||||
par1NBTTagCompound.setFloat("pointPool", pointPool);
|
||||
}
|
||||
|
||||
public int createRandomDemonHoard(int tier)
|
||||
{
|
||||
|
||||
|
||||
return 10;
|
||||
}
|
||||
|
||||
public int createRandomRoad() //Return the number of road spaces
|
||||
{
|
||||
int next = rand.nextInt(4);
|
||||
|
@ -1062,159 +1116,87 @@ public class TEDemonPortal extends TileEntity
|
|||
dir = ForgeDirection.NORTH;
|
||||
}
|
||||
|
||||
boolean newProtocol = true;
|
||||
Int3 space = this.findRoadSpaceFromDirection(dir, 1 * (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1);
|
||||
|
||||
if (newProtocol)
|
||||
int x = space.xCoord;
|
||||
int z = space.zCoord;
|
||||
int yLevel = space.yCoord;
|
||||
|
||||
if(printDebug)
|
||||
System.out.println("Road space - x: " + x + " z: " + z);
|
||||
|
||||
GridSpaceHolder grid = this.createGSH();
|
||||
|
||||
if (!this.getGridSpace(x, z).isRoadSegment())
|
||||
{
|
||||
Int3 space = this.findRoadSpaceFromDirection(dir, 1 * (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int x = space.xCoord;
|
||||
int z = space.zCoord;
|
||||
int yLevel = space.yCoord;
|
||||
List<ForgeDirection> directions = new ArrayList();
|
||||
|
||||
if(printDebug)
|
||||
System.out.println("Road space - x: " + x + " z: " + z);
|
||||
|
||||
GridSpaceHolder grid = this.createGSH();
|
||||
|
||||
if (!this.getGridSpace(x, z).isRoadSegment())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
List<ForgeDirection> directions = new ArrayList();
|
||||
|
||||
for (int i = 2; i < 6; i++)
|
||||
{
|
||||
ForgeDirection testDir = ForgeDirection.getOrientation(i);
|
||||
if (this.getGridSpace(x + testDir.offsetX, z + testDir.offsetZ).isEmpty())
|
||||
{
|
||||
directions.add(testDir);
|
||||
}
|
||||
}
|
||||
|
||||
if (directions.isEmpty())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HashMap<ForgeDirection, List<DemonBuilding>> schemMap = new HashMap();
|
||||
|
||||
for (ForgeDirection nextDir : directions)
|
||||
{
|
||||
for (DemonBuilding build : TEDemonPortal.buildingList)
|
||||
{
|
||||
if (build.buildingTier != buildingTier || build.buildingType != DemonBuilding.BUILDING_HOUSE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Int3 offsetSpace = build.getGridOffsetFromRoad(nextDir, yLevel);
|
||||
int xOff = offsetSpace.xCoord;
|
||||
int zOff = offsetSpace.zCoord;
|
||||
|
||||
if (build.isValid(grid, x + xOff, z + zOff, nextDir.getOpposite()))
|
||||
{
|
||||
if (schemMap.containsKey(nextDir))
|
||||
{
|
||||
schemMap.get(nextDir).add(build);
|
||||
} else
|
||||
{
|
||||
schemMap.put(nextDir, new ArrayList());
|
||||
schemMap.get(nextDir).add(build);
|
||||
}
|
||||
} else
|
||||
{
|
||||
System.out.println("This ISN'T valid!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (schemMap.keySet().isEmpty())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ForgeDirection chosenDirection = (ForgeDirection) schemMap.keySet().toArray()[new Random().nextInt(schemMap.keySet().size())];
|
||||
DemonBuilding build = schemMap.get(chosenDirection).get(new Random().nextInt(schemMap.get(chosenDirection).size()));
|
||||
|
||||
Int3 offsetSpace = build.getGridOffsetFromRoad(chosenDirection, yLevel);
|
||||
int xOff = offsetSpace.xCoord;
|
||||
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.setAllGridSpaces(x + xOff, z + zOff, yLevel, chosenDirection.getOpposite(), GridSpace.HOUSE, grid);
|
||||
this.loadGSH(grid);
|
||||
|
||||
return build.getNumberOfGridSpaces();
|
||||
} else
|
||||
for (int i = 2; i < 6; i++)
|
||||
{
|
||||
Int3 space = findEmptySpaceNearRoad(dir, 3 * (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1, 2);
|
||||
|
||||
int x = space.xCoord;
|
||||
int z = space.zCoord;
|
||||
int yLevel = space.yCoord;
|
||||
|
||||
GridSpace newSpace = this.getGridSpace(x, z);
|
||||
if (!newSpace.isEmpty())
|
||||
ForgeDirection testDir = ForgeDirection.getOrientation(i);
|
||||
if (this.getGridSpace(x + testDir.offsetX, z + testDir.offsetZ).isEmpty())
|
||||
{
|
||||
return 0;
|
||||
directions.add(testDir);
|
||||
}
|
||||
}
|
||||
|
||||
if (yLevel == -1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (directions.isEmpty())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
GridSpaceHolder grid = this.createGSH();
|
||||
|
||||
ForgeDirection chosenDirection = ForgeDirection.NORTH;
|
||||
|
||||
HashMap<ForgeDirection, List<DemonBuilding>> bigList = new HashMap();
|
||||
HashMap<ForgeDirection, List<DemonBuilding>> schemMap = new HashMap();
|
||||
|
||||
for (ForgeDirection nextDir : directions)
|
||||
{
|
||||
for (DemonBuilding build : TEDemonPortal.buildingList)
|
||||
{
|
||||
for (int i = 2; i < 6; i++)
|
||||
if (build.buildingTier != buildingTier || build.buildingType != DemonBuilding.BUILDING_HOUSE)
|
||||
{
|
||||
chosenDirection = ForgeDirection.getOrientation(i);
|
||||
System.out.println("" + chosenDirection.toString());
|
||||
if (build.isValid(grid, x, z, chosenDirection))
|
||||
continue;
|
||||
}
|
||||
Int3 offsetSpace = build.getGridOffsetFromRoad(nextDir, yLevel);
|
||||
int xOff = offsetSpace.xCoord;
|
||||
int zOff = offsetSpace.zCoord;
|
||||
|
||||
if (build.isValid(grid, x + xOff, z + zOff, nextDir.getOpposite()))
|
||||
{
|
||||
if (schemMap.containsKey(nextDir))
|
||||
{
|
||||
System.out.println("Valid!");
|
||||
if (bigList.containsKey(chosenDirection))
|
||||
{
|
||||
bigList.get(chosenDirection).add(build);
|
||||
} else
|
||||
{
|
||||
bigList.put(chosenDirection, new ArrayList());
|
||||
bigList.get(chosenDirection).add(build);
|
||||
}
|
||||
schemMap.get(nextDir).add(build);
|
||||
} else
|
||||
{
|
||||
schemMap.put(nextDir, new ArrayList());
|
||||
schemMap.get(nextDir).add(build);
|
||||
}
|
||||
} else
|
||||
{
|
||||
System.out.println("This ISN'T valid!");
|
||||
}
|
||||
}
|
||||
|
||||
chosenDirection = ForgeDirection.getOrientation(new Random().nextInt(4) + 2); //Change to favour a direction with a road nearby
|
||||
|
||||
List<DemonBuilding> buildingList = bigList.get(chosenDirection);
|
||||
DemonBuilding build;
|
||||
|
||||
if (buildingList != null && buildingList.size() > 0)
|
||||
{
|
||||
build = buildingList.get(new Random().nextInt(buildingList.size()));
|
||||
} else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
//TODO: Finish the selection algorythm
|
||||
//TODO: Should favour those directions that have a road right next to them.
|
||||
|
||||
build.buildAll(worldObj, xCoord + x * 5, yLevel, zCoord + z * 5, chosenDirection);
|
||||
build.setAllGridSpaces(x, z, yLevel, chosenDirection, GridSpace.HOUSE, grid);
|
||||
this.loadGSH(grid);
|
||||
|
||||
return build.getNumberOfGridSpaces();
|
||||
// System.out.println("X: " + x + " Z: " + z + " Direction: " + chosenDirection.toString());
|
||||
}
|
||||
|
||||
if (schemMap.keySet().isEmpty())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ForgeDirection chosenDirection = (ForgeDirection) schemMap.keySet().toArray()[new Random().nextInt(schemMap.keySet().size())];
|
||||
DemonBuilding build = schemMap.get(chosenDirection).get(new Random().nextInt(schemMap.get(chosenDirection).size()));
|
||||
|
||||
Int3 offsetSpace = build.getGridOffsetFromRoad(chosenDirection, yLevel);
|
||||
int xOff = offsetSpace.xCoord;
|
||||
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.setAllGridSpaces(x + xOff, z + zOff, yLevel, chosenDirection.getOpposite(), GridSpace.HOUSE, grid);
|
||||
this.loadGSH(grid);
|
||||
|
||||
return build.getNumberOfGridSpaces();
|
||||
}
|
||||
|
||||
public int findNearestRoadYLevel(int xCoord, int zCoord, int maxDistance)
|
||||
|
@ -1332,13 +1314,8 @@ public class TEDemonPortal extends TileEntity
|
|||
}
|
||||
}
|
||||
|
||||
public int getTotalPoints()
|
||||
{
|
||||
return this.totalPoints;
|
||||
}
|
||||
|
||||
public void addToPoints(int addition)
|
||||
{
|
||||
this.totalPoints += addition;
|
||||
this.demonHouseCooldown += addition;
|
||||
}
|
||||
}
|
|
@ -14,9 +14,9 @@ import net.minecraft.world.World;
|
|||
public class EntityDemon extends EntityTameable implements IDemon
|
||||
{
|
||||
private boolean isAggro;
|
||||
private int demonID;
|
||||
private String demonID;
|
||||
|
||||
public EntityDemon(World par1World, int demonID)
|
||||
public EntityDemon(World par1World, String demonID)
|
||||
{
|
||||
super(par1World);
|
||||
this.demonID = demonID;
|
||||
|
@ -49,7 +49,9 @@ public class EntityDemon extends EntityTameable implements IDemon
|
|||
|
||||
protected void dropFewItems(boolean par1, int par2)
|
||||
{
|
||||
ItemStack drop = new ItemStack(ModItems.demonPlacer, 1, this.getDemonID());
|
||||
ItemStack drop = new ItemStack(ModItems.demonPlacer);
|
||||
|
||||
DemonPlacer.setDemonString(drop, this.getDemonID());
|
||||
|
||||
if ((this.getOwner() instanceof EntityPlayer))
|
||||
{
|
||||
|
@ -92,7 +94,7 @@ public class EntityDemon extends EntityTameable implements IDemon
|
|||
}
|
||||
}
|
||||
|
||||
public int getDemonID()
|
||||
public String getDemonID()
|
||||
{
|
||||
return this.demonID;
|
||||
}
|
||||
|
|
|
@ -32,9 +32,9 @@ public class EntityElemental extends EntityDemon
|
|||
private static float maxTamedHealth = 100.0F;
|
||||
private static float maxUntamedHealth = 100.0F;
|
||||
|
||||
public EntityElemental(World par1World, int demonID)
|
||||
public EntityElemental(World par1World, String entityAirElementalID)
|
||||
{
|
||||
super(par1World, demonID);
|
||||
super(par1World, entityAirElementalID);
|
||||
this.setSize(0.5F, 1.0F);
|
||||
this.setAggro(false);
|
||||
this.setTamed(false);
|
||||
|
|
|
@ -677,7 +677,7 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA
|
|||
|
||||
public int getItemEnchantability()
|
||||
{
|
||||
return 0;
|
||||
return Integer.MIN_VALUE;
|
||||
}
|
||||
|
||||
public boolean getIsInvisible(ItemStack armourStack)
|
||||
|
|
|
@ -68,7 +68,8 @@ public class DemonPlacer extends Item
|
|||
d0 = 0.5D;
|
||||
}
|
||||
|
||||
Entity entity = spawnCreature(par3World, par1ItemStack.getItemDamage(), (double) par4 + 0.5D, (double) par5 + d0, (double) par6 + 0.5D, par1ItemStack);
|
||||
String demonName = DemonPlacer.getDemonString(par1ItemStack);
|
||||
Entity entity = spawnCreature(par3World, demonName, (double) par4 + 0.5D, (double) par5 + d0, (double) par6 + 0.5D, par1ItemStack);
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
|
@ -122,7 +123,8 @@ public class DemonPlacer extends Item
|
|||
|
||||
if (par2World.getBlock(i, j, k).getMaterial() == Material.water)
|
||||
{
|
||||
Entity entity = spawnCreature(par2World, par1ItemStack.getItemDamage(), (double) i, (double) j, (double) k, par1ItemStack);
|
||||
String demonName = DemonPlacer.getDemonString(par1ItemStack);
|
||||
Entity entity = spawnCreature(par2World, demonName, (double) i, (double) j, (double) k, par1ItemStack);
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
|
@ -148,7 +150,7 @@ public class DemonPlacer extends Item
|
|||
* Spawns the creature specified by the egg's type in the location specified by the last three parameters.
|
||||
* Parameters: world, entityID, x, y, z.
|
||||
*/
|
||||
public static Entity spawnCreature(World par0World, int par1, double par2, double par4, double par6, ItemStack itemStack)
|
||||
public static Entity spawnCreature(World par0World, String par1, double par2, double par4, double par6, ItemStack itemStack)
|
||||
{
|
||||
Entity entity = null;
|
||||
|
||||
|
@ -198,6 +200,26 @@ public class DemonPlacer extends Item
|
|||
|
||||
return par1ItemStack.stackTagCompound.getString("ownerName");
|
||||
}
|
||||
|
||||
public static void setDemonString(ItemStack itemStack, String demonName)
|
||||
{
|
||||
if (itemStack.stackTagCompound == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemStack.stackTagCompound.setString("demonName", demonName);
|
||||
}
|
||||
|
||||
public static String getDemonString(ItemStack itemStack)
|
||||
{
|
||||
if (itemStack.stackTagCompound == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
return itemStack.stackTagCompound.getString("demonName");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.FoodStats;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.FoodStats;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RitualEffectFullStomach extends RitualEffect
|
||||
{
|
||||
|
@ -86,7 +87,11 @@ public class RitualEffectFullStomach extends RitualEffect
|
|||
|
||||
if (saturatedHeal + satLevel <= 20)
|
||||
{
|
||||
foodStats.setFoodSaturationLevel(saturatedHeal + satLevel);
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
foodStats.writeNBT(nbt);
|
||||
nbt.setFloat("foodSaturationLevel", saturatedHeal + satLevel);
|
||||
foodStats.readNBT(nbt);
|
||||
|
||||
inventory.decrStackSize(i, 1);
|
||||
count++;
|
||||
break;
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.world.World;
|
|||
|
||||
public class SummoningFallenAngel extends SummoningHelper
|
||||
{
|
||||
public SummoningFallenAngel(int id)
|
||||
public SummoningFallenAngel(String id)
|
||||
{
|
||||
super(id);
|
||||
}
|
||||
|
|
|
@ -10,79 +10,79 @@ import net.minecraft.world.World;
|
|||
|
||||
public class SummoningHelperAW extends SummoningHelper
|
||||
{
|
||||
public SummoningHelperAW(int id)
|
||||
public SummoningHelperAW(String id)
|
||||
{
|
||||
super(id);
|
||||
}
|
||||
|
||||
public EntityLivingBase getEntity(World worldObj)
|
||||
{
|
||||
if (this.id == AlchemicalWizardry.entityFallenAngelID)
|
||||
if (this.id.equals(AlchemicalWizardry.entityFallenAngelID))
|
||||
{
|
||||
return new EntityFallenAngel(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityLowerGuardianID)
|
||||
if (this.id.equals(AlchemicalWizardry.entityLowerGuardianID))
|
||||
{
|
||||
return new EntityLowerGuardian(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityBileDemonID)
|
||||
if (this.id.equals(AlchemicalWizardry.entityBileDemonID))
|
||||
{
|
||||
return new EntityBileDemon(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityWingedFireDemonID)
|
||||
if (this.id.equals(AlchemicalWizardry.entityWingedFireDemonID))
|
||||
{
|
||||
return new EntityWingedFireDemon(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entitySmallEarthGolemID)
|
||||
if (this.id.equals(AlchemicalWizardry.entitySmallEarthGolemID))
|
||||
{
|
||||
return new EntitySmallEarthGolem(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityIceDemonID)
|
||||
if (this.id.equals(AlchemicalWizardry.entityIceDemonID))
|
||||
{
|
||||
return new EntityIceDemon(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityBoulderFistID)
|
||||
if (this.id.equals(AlchemicalWizardry.entityBoulderFistID))
|
||||
{
|
||||
return new EntityBoulderFist(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityShadeID)
|
||||
if (this.id.equals(AlchemicalWizardry.entityShadeID))
|
||||
{
|
||||
return new EntityShade(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityAirElementalID)
|
||||
if (this.id.equals(AlchemicalWizardry.entityAirElementalID))
|
||||
{
|
||||
return new EntityAirElemental(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityWaterElementalID)
|
||||
if (this.id.equals(AlchemicalWizardry.entityWaterElementalID))
|
||||
{
|
||||
return new EntityWaterElemental(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityEarthElementalID)
|
||||
if (this.id.equals(AlchemicalWizardry.entityEarthElementalID))
|
||||
{
|
||||
return new EntityEarthElemental(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityFireElementalID)
|
||||
if (this.id.equals(AlchemicalWizardry.entityFireElementalID))
|
||||
{
|
||||
return new EntityFireElemental(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityShadeElementalID)
|
||||
if (this.id.equals(AlchemicalWizardry.entityShadeElementalID))
|
||||
{
|
||||
return new EntityShadeElemental(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityHolyElementalID)
|
||||
if (this.id.equals(AlchemicalWizardry.entityHolyElementalID))
|
||||
{
|
||||
return new EntityHolyElemental(worldObj);
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public class SummoningHelperAW extends SummoningHelper
|
|||
return new EntityPig(worldObj);
|
||||
}
|
||||
|
||||
public int getSummoningHelperID()
|
||||
public String getSummoningHelperID()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ item.sanguineBoots.name=Sanguine Boots
|
|||
item.itemAttunedCrystal.name=Alchemic Router
|
||||
item.itemTankSegmenter.name=Alchemic Segmenter
|
||||
item.destinationClearer.name=Alchemic Cleanser
|
||||
|
||||
item.demonPlacer.name=Demon Crystal
|
||||
#Creative Tab
|
||||
itemGroup.tabBloodMagic=Blood Magic
|
||||
|
||||
|
|
Loading…
Reference in a new issue