Attempt to fix repository

This commit is contained in:
WayofTime 2015-07-31 12:09:09 -04:00
parent e242207d50
commit 1aac4686db
932 changed files with 39272 additions and 11544 deletions

View file

@ -14,16 +14,15 @@ import net.minecraft.block.BlockTrapDoor;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry.UniqueIdentifier;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.api.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
{
@ -40,7 +39,7 @@ public class BlockSet
{
this.blockid = blockid;
this.metadata = new int[4];
positions = new ArrayList<Int3>();
positions = new ArrayList();
}
public BlockSet(Block block)
@ -277,7 +276,7 @@ public class BlockSet
return GameRegistry.findBlock(modId, name);
}
public int getMetaForDirection(EnumFacing dir)
public int getMetaForDirection(ForgeDirection dir)
{
if (metadata.length < 4)
{
@ -299,7 +298,7 @@ public class BlockSet
}
}
public void buildAtIndex(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, EnumFacing dir, int index, boolean populateInventories, int tier)
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)
@ -334,15 +333,14 @@ public class BlockSet
default:
}
BlockPos newPos = new BlockPos(xCoord + xOff, yCoord + yOff, zCoord + zOff);
world.setBlockState(newPos, block.getStateFromMeta(meta), 3);
world.setBlock(xCoord + xOff, yCoord + yOff, zCoord + zOff, block, meta, 3);
if(populateInventories)
{
this.populateIfIInventory(world, newPos, tier);
this.populateIfIInventory(world, xCoord + xOff, yCoord + yOff, zCoord + zOff, tier);
}
if(block instanceof IBlockPortalNode)
{
TileEntity tile = world.getTileEntity(newPos);
TileEntity tile = world.getTileEntity(xCoord + xOff, yCoord + yOff, zCoord + zOff);
if(tile instanceof ITilePortalNode)
{
((ITilePortalNode) tile).setPortalLocation(teDemonPortal);
@ -350,16 +348,16 @@ public class BlockSet
}
}
public void populateIfIInventory(World world, BlockPos pos, int tier)
public void populateIfIInventory(World world, int x, int y, int z, int tier)
{
TileEntity tile = world.getTileEntity(pos);
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof IInventory)
{
DemonVillageLootRegistry.populateChest((IInventory)tile, tier);
}
}
public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, EnumFacing dir, boolean populateInventories, int tier)
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++)
{

View file

@ -4,10 +4,8 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
@ -30,7 +28,7 @@ public class BuildingSchematic
public BuildingSchematic(String name)
{
this.name = name;
blockList = new ArrayList<BlockSet>();
blockList = new ArrayList();
this.doorX = 0;
this.doorZ = 0;
this.doorY = 0;
@ -54,7 +52,7 @@ public class BuildingSchematic
blockList.add(set);
}
public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, EnumFacing dir, boolean populateInventories)
public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, boolean populateInventories)
{
for (BlockSet set : blockList)
{
@ -88,9 +86,9 @@ public class BuildingSchematic
return new Int3(gridX, doorY, gridZ);
}
public List<Int3> getGriddedPositions(EnumFacing dir)
public List<Int3> getGriddedPositions(ForgeDirection dir)
{
List<Int3> positionList = new ArrayList<Int3>();
List<Int3> positionList = new ArrayList();
for (BlockSet blockSet : blockList)
{
@ -129,7 +127,7 @@ public class BuildingSchematic
return positionList;
}
public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, EnumFacing dir)
public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
{
// GridSpaceHolder grid = this.createGSH(); //GridSpaceHolder is not aware of the buildings - need to use the schematic
@ -139,12 +137,10 @@ public class BuildingSchematic
{
for (Int3 pos : positionList)
{
BlockPos newPos = new BlockPos(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord);
IBlockState state = world.getBlockState(newPos);
Block block = state.getBlock();
Block block = world.getBlock(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord);
if (block != ModBlocks.blockDemonPortal)
{
world.setBlockToAir(newPos);
world.setBlockToAir(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord);
}
}
}

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.demonVillage;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
@ -30,17 +30,17 @@ public class DemonBuilding
return schematic.getName();
}
public boolean isValid(GridSpaceHolder master, int gridX, int gridZ, EnumFacing dir)
public boolean isValid(GridSpaceHolder master, int gridX, int gridZ, ForgeDirection dir)
{
return area.doesContainAll(master, gridX, gridZ, dir);
}
public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, EnumFacing dir, boolean populateInventories)
public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, boolean populateInventories)
{
schematic.buildAll(teDemonPortal, world, xCoord, yCoord, zCoord, dir, populateInventories);
}
public void setAllGridSpaces(int xInit, int zInit, int yLevel, EnumFacing dir, int type, GridSpaceHolder master)
public void setAllGridSpaces(int xInit, int zInit, int yLevel, ForgeDirection dir, int type, GridSpaceHolder master)
{
area.setAllGridSpaces(xInit, zInit, yLevel, dir, type, master);
}
@ -57,7 +57,7 @@ public class DemonBuilding
return scheme.createGSH();
}
public Int3 getDoorSpace(EnumFacing dir)
public Int3 getDoorSpace(ForgeDirection dir)
{
int x;
int z;
@ -84,7 +84,7 @@ public class DemonBuilding
return new Int3(x, doorGridSpace.yCoord, z);
}
public Int3 getGridOffsetFromRoad(EnumFacing sideOfRoad, int yLevel)
public Int3 getGridOffsetFromRoad(ForgeDirection sideOfRoad, int yLevel)
{
Int3 doorSpace = this.getDoorSpace(sideOfRoad);
int x = doorSpace.xCoord;
@ -109,7 +109,7 @@ public class DemonBuilding
return new Int3(x, yLevel, z);
}
public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, EnumFacing dir)
public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
{
schematic.destroyAllInField(world, xCoord, yCoord, zCoord, dir);
}

View file

@ -3,11 +3,9 @@ package WayofTime.alchemicalWizardry.common.demonVillage;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.IRoadWard;
@ -18,19 +16,19 @@ public class DemonVillagePath
public int xPos;
public int yPos;
public int zPos;
public EnumFacing dir;
public ForgeDirection dir;
public int length;
public static boolean canGoDown = true;
public static boolean tunnelIfObstructed = false;
public static boolean createBridgeInAirIfObstructed = false;
public DemonVillagePath(int xi, int yi, int zi, EnumFacing dir2, int length)
public DemonVillagePath(int xi, int yi, int zi, ForgeDirection dir, int length)
{
this.xPos = xi;
this.yPos = yi;
this.zPos = zi;
this.dir = dir2;
this.dir = dir;
this.length = length;
}
@ -42,11 +40,11 @@ public class DemonVillagePath
int rad = this.getRoadRadius();
int value = 0;
int finalYPos = this.constructPartialPath(portal, world, clearance, xi - rad * dir.getFrontOffsetX(), yi, zi - rad * dir.getFrontOffsetZ(), dir, length + rad, false);
int finalYPos = this.constructPartialPath(portal, world, clearance, xi - rad * dir.offsetX, yi, zi - rad * dir.offsetZ, dir, length + rad, false);
for (int i = -rad; i <= rad; i++)
{
value = Math.max(this.constructPartialPath(portal, world, clearance, xi - rad * dir.getFrontOffsetX() + i * dir.getFrontOffsetZ(), yi, zi - rad * dir.getFrontOffsetZ() + i * dir.getFrontOffsetX(), dir, length + 2 * rad, true), value);
value = Math.max(this.constructPartialPath(portal, world, clearance, xi - rad * dir.offsetX + i * dir.offsetZ, yi, zi - rad * dir.offsetZ + i * dir.offsetX, dir, length + 2 * rad, true), value);
if(TEDemonPortal.printDebug)
System.out.println("" + (length + 2 * rad) + ", " + value + "");
}
@ -82,12 +80,12 @@ public class DemonVillagePath
* @param doConstruct
* @return length if doConstruct, yi if !doConstruct
*/
public int constructPartialPath(TEDemonPortal portal, World world, int clearance, int xi, int yi, int zi, EnumFacing dir, int length, boolean doConstruct)
public int constructPartialPath(TEDemonPortal portal, World world, int clearance, int xi, int yi, int zi, ForgeDirection dir, int length, boolean doConstruct)
{
for (int i = 0; i < length; i++)
{
int xOffset = i * dir.getFrontOffsetX();
int zOffset = i * dir.getFrontOffsetZ();
int xOffset = i * dir.offsetX;
int zOffset = i * dir.offsetZ;
boolean completed = false;
@ -95,19 +93,14 @@ public class DemonVillagePath
{
int sign = 1;
BlockPos pos1 = new BlockPos(xi + xOffset, yi + sign * yOffset, zi + zOffset);
BlockPos highPos1 = pos1.offsetUp();
IBlockState state1 = world.getBlockState(pos1);
IBlockState highState1 = world.getBlockState(highPos1);
Block block1 = state1.getBlock();
Block highBlock1 = highState1.getBlock();
Block block1 = world.getBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset);
Block highBlock1 = world.getBlock(xi + xOffset, yi + sign * yOffset + 1, zi + zOffset);
if ((this.forceReplaceBlock(block1))||(!block1.isReplaceable(world, pos1) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, highPos1)))
if ((this.forceReplaceBlock(block1))||(!block1.isReplaceable(world, xi + xOffset, yi + sign * yOffset, zi + zOffset) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, xi + xOffset, yi + sign * yOffset + 1, zi + zOffset)))
{
if(doConstruct)
{
world.setBlockState(pos1, portal.getRoadState(), 3);
world.setBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3);
}
yi += sign * yOffset;
completed = true;
@ -115,19 +108,14 @@ public class DemonVillagePath
} else if(canGoDown)
{
sign = -1;
pos1 = new BlockPos(xi + xOffset, yi + sign * yOffset, zi + zOffset);
highPos1 = pos1.offsetUp();
state1 = world.getBlockState(pos1);
highState1 = world.getBlockState(highPos1);
block1 = state1.getBlock();
highBlock1 = highState1.getBlock();
Block block2 = world.getBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset);
Block highBlock2 = world.getBlock(xi + xOffset, yi + sign * yOffset + 1, zi + zOffset);
if ((this.forceReplaceBlock(block1))||(!block1.isReplaceable(world, pos1) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, highPos1)))
if ((this.forceReplaceBlock(block2))||(!block2.isReplaceable(world, xi + xOffset, yi + sign * yOffset, zi + zOffset) && this.isBlockReplaceable(block2)) && (this.forceCanTunnelUnder(highBlock2) || highBlock2.isReplaceable(world, xi + xOffset, yi + sign * yOffset + 1, zi + zOffset)))
{
if(doConstruct)
if(doConstruct)
{
world.setBlockState(pos1, portal.getRoadState(), 3);
world.setBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3);
}
yi += sign * yOffset;
completed = true;
@ -141,17 +129,15 @@ public class DemonVillagePath
boolean returnAmount = true;
if(createBridgeInAirIfObstructed)
{
BlockPos pos1 = new BlockPos(xi + xOffset, yi, zi + zOffset);
IBlockState state1 = world.getBlockState(pos1);
Block block1 = state1.getBlock();
Block block1 = world.getBlock(xi + xOffset, yi, zi + zOffset);
if (block1.isReplaceable(world, pos1) || !this.isBlockReplaceable(block1) || !this.forceReplaceBlock(block1))
if (block1.isReplaceable(world, xi + xOffset, yi, zi + zOffset) || !this.isBlockReplaceable(block1) || !this.forceReplaceBlock(block1))
{
returnAmount = false;
if(doConstruct)
{
world.setBlockState(pos1, portal.getRoadState(), 3);
world.setBlock(xi + xOffset, yi, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3);
}
}else
{
@ -160,20 +146,18 @@ public class DemonVillagePath
}else if(tunnelIfObstructed)
{
BlockPos pos1 = new BlockPos(xi + xOffset, yi, zi + zOffset);
IBlockState state1 = world.getBlockState(pos1);
Block block1 = state1.getBlock();
Block block1 = world.getBlock(xi + xOffset, yi, zi + zOffset);
if (!block1.isReplaceable(world, pos1) || this.isBlockReplaceable(block1) || !this.forceReplaceBlock(block1))
if (!block1.isReplaceable(world, xi + xOffset, yi, zi + zOffset) || this.isBlockReplaceable(block1) || !this.forceReplaceBlock(block1))
{
returnAmount = false;
if(doConstruct)
{
world.setBlockState(pos1, portal.getRoadState(), 3);
world.setBlockToAir(pos1.offsetUp(1));
world.setBlockToAir(pos1.offsetUp(2));
world.setBlockToAir(pos1.offsetUp(3));
world.setBlock(xi + xOffset, yi, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3);
world.setBlockToAir(xi + xOffset, yi + 1, zi + zOffset);
world.setBlockToAir(xi + xOffset, yi + 2, zi + zOffset);
world.setBlockToAir(xi + xOffset, yi + 3, zi + zOffset);
}
}else
{
@ -199,37 +183,27 @@ public class DemonVillagePath
for (int i = 0; i < length; i++)
{
int xOffset = i * dir.getFrontOffsetX();
int zOffset = i * dir.getFrontOffsetZ();
int xOffset = i * dir.offsetX;
int zOffset = i * dir.offsetZ;
for (int yOffset = 0; yOffset <= clearance; yOffset++)
{
int sign = 1;
BlockPos pos1 = new BlockPos(xi + xOffset, yi + sign * yOffset, zi + zOffset);
BlockPos highPos1 = pos1.offsetUp();
IBlockState state1 = world.getBlockState(pos1);
IBlockState highState1 = world.getBlockState(highPos1);
Block block1 = state1.getBlock();
Block highBlock1 = highState1.getBlock();
Block block1 = world.getBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset);
Block highBlock1 = world.getBlock(xi + xOffset, yi + sign * yOffset + 1, zi + zOffset);
if ((this.forceReplaceBlock(block1))||(!block1.isReplaceable(world, pos1) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, highPos1)))
if ((this.forceReplaceBlock(block1))||(!block1.isReplaceable(world, xi + xOffset, yi + sign * yOffset, zi + zOffset) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, xi + xOffset, yi + sign * yOffset + 1, zi + zOffset)))
{
yi += sign * yOffset;
break;
} else
{
sign = -1;
BlockPos pos2 = new BlockPos(xi + xOffset, yi + sign * yOffset, zi + zOffset);
BlockPos highPos2 = pos2.offsetUp();
IBlockState state2 = world.getBlockState(pos2);
IBlockState highState2 = world.getBlockState(highPos2);
Block block2 = state2.getBlock();
Block highBlock2 = highState2.getBlock();
Block block2 = world.getBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset);
Block highBlock2 = world.getBlock(xi + xOffset, yi + sign * yOffset + 1, zi + zOffset);
if ((this.forceReplaceBlock(block2))||(!block2.isReplaceable(world, pos2) && this.isBlockReplaceable(block2) ) && (this.forceCanTunnelUnder(highBlock2) || highBlock2.isReplaceable(world, highPos2)))
if ((this.forceReplaceBlock(block2))||(!block2.isReplaceable(world, xi + xOffset, yi + sign * yOffset, zi + zOffset) && this.isBlockReplaceable(block2) ) && (this.forceCanTunnelUnder(highBlock2) || highBlock2.isReplaceable(world, xi + xOffset, yi + sign * yOffset + 1, zi + zOffset)))
{
yi += sign * yOffset;
break;

View file

@ -1,13 +1,11 @@
package WayofTime.alchemicalWizardry.common.demonVillage;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class GridSpaceHolder
{
@ -141,7 +139,7 @@ public class GridSpaceHolder
}
}
public boolean doesContainAll(GridSpaceHolder master, int xInit, int zInit, EnumFacing dir)
public boolean doesContainAll(GridSpaceHolder master, int xInit, int zInit, ForgeDirection dir)
{
if (master != null)
{
@ -193,7 +191,7 @@ public class GridSpaceHolder
return false;
}
public void setAllGridSpaces(int xInit, int zInit, int yLevel, EnumFacing dir, int type, GridSpaceHolder master)
public void setAllGridSpaces(int xInit, int zInit, int yLevel, ForgeDirection dir, int type, GridSpaceHolder master)
{
if(TEDemonPortal.printDebug)
AlchemicalWizardry.logger.info("Grid space selected: (" + xInit + "," + zInit + ")");
@ -241,7 +239,7 @@ public class GridSpaceHolder
}
}
public void destroyAllInGridSpaces(World world, int xCoord, int yCoord, int zCoord, EnumFacing dir)
public void destroyAllInGridSpaces(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
{
for (int i = -negXRadius; i <= posXRadius; i++)
{
@ -280,14 +278,12 @@ public class GridSpaceHolder
{
for (int m = -2; m <= 2; m++)
{
BlockPos newPos = new BlockPos(xCoord + xOff * 5 + l, yCoord, zCoord + zOff * 5 + m);
IBlockState state = world.getBlockState(newPos);
Block block = state.getBlock();
Block block = world.getBlock(xCoord + xOff * 5 + l, yCoord, zCoord + zOff * 5 + m);
if (block == ModBlocks.blockDemonPortal)
{
continue;
}
world.setBlockToAir(newPos);
world.setBlockToAir(xCoord + xOff * 5 + l, yCoord, zCoord + zOff * 5 + m);
}
}
}

View file

@ -0,0 +1,8 @@
package WayofTime.alchemicalWizardry.common.demonVillage;
import net.minecraft.nbt.NBTTagCompound;
public class TileBlockSet extends BlockSet
{
public NBTTagCompound tag;
}

View file

@ -24,6 +24,7 @@ public class EntityAIOccasionalRangedAttack extends EntityAIBase
private int maxRangedAttackTime;
private float field_96562_i;
private float field_82642_h;
private static final String __OBFID = "CL_00001609";
private double range;
public EntityAIOccasionalRangedAttack(IOccasionalRangedAttackMob p_i1649_1_, double p_i1649_2_, int p_i1649_4_, float p_i1649_5_, double range)
@ -109,7 +110,7 @@ public class EntityAIOccasionalRangedAttack extends EntityAIBase
*/
public void updateTask()
{
double d0 = this.entityHost.getDistanceSq(this.attackTarget.posX, this.attackTarget.getBoundingBox().minY, this.attackTarget.posZ);
double d0 = this.entityHost.getDistanceSq(this.attackTarget.posX, this.attackTarget.boundingBox.minY, this.attackTarget.posZ);
boolean flag = this.entityHost.getEntitySenses().canSee(this.attackTarget);
if (flag)

View file

@ -3,7 +3,7 @@ package WayofTime.alchemicalWizardry.common.demonVillage.ai;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
@ -20,14 +20,14 @@ public class EntityDemonAIHurtByTarget extends EntityAIHurtByTarget
@Override
public void startExecuting()
{
BlockPos portalPosition = ((IHoardDemon)this.taskOwner).getPortalLocation();
Int3 portalPosition = ((IHoardDemon)this.taskOwner).getPortalLocation();
if(portalPosition == null)
{
super.startExecuting();
return;
}
TileEntity portal = this.taskOwner.worldObj.getTileEntity(portalPosition);
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())))
{
@ -36,7 +36,7 @@ public class EntityDemonAIHurtByTarget extends EntityAIHurtByTarget
this.taskOwner.setAttackTarget(this.taskOwner.getAITarget());
if (this.entityCallsForHelp)
if (this.entityCallsForHelp && this.taskOwner instanceof IHoardDemon)
{
if(portal instanceof TEDemonPortal)
@ -45,7 +45,7 @@ public class EntityDemonAIHurtByTarget extends EntityAIHurtByTarget
}
// double d0 = this.getTargetDistance();
// List list = this.taskOwner.worldObj.getEntitiesWithinAABB(this.taskOwner.getClass(), new AxisAlignedBB(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));
// 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())

View file

@ -5,7 +5,10 @@ import net.minecraft.world.World;
public abstract class DemonHoardPacket
{
public DemonHoardPacket() {}
public DemonHoardPacket()
{
}
public abstract int summonDemons(TEDemonPortal teDemonPortal, World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian);

View file

@ -9,7 +9,7 @@ import net.minecraft.world.World;
public class DemonPacketRegistry
{
public static Map<String, DemonHoardPacket> packetMap = new HashMap<String, DemonHoardPacket>();
public static Map<String, DemonHoardPacket> packetMap = new HashMap();
public static boolean registerDemonPacket(String string, DemonHoardPacket packet)
{

View file

@ -20,11 +20,11 @@ import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.LocalRitualStorage;
import WayofTime.alchemicalWizardry.common.EntityAITargetAggroCloaking;
@ -34,6 +34,7 @@ import WayofTime.alchemicalWizardry.common.demonVillage.ai.IOccasionalRangedAtta
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.rituals.LocalStorageAlphaPact;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRangedAttackMob, IHoardDemon
@ -42,7 +43,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);
private boolean isAngry = true;
private BlockPos demonPortal;
private Int3 demonPortal;
private static float maxTamedHealth = 200.0F;
private static float maxUntamedHealth = 200.0F;
@ -53,7 +54,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
{
super(par1World, AlchemicalWizardry.entityMinorDemonGruntID);
this.setSize(0.7F, 1.8F);
// this.getNavigator().setAvoidsWater(true);
this.getNavigator().setAvoidsWater(true);
this.tasks.addTask(1, new EntityAISwimming(this));
this.tasks.addTask(2, this.aiSit);
this.tasks.addTask(3, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
@ -67,7 +68,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
this.setAggro(false);
this.setTamed(false);
demonPortal = new BlockPos(0,0,0);
demonPortal = new Int3(0,0,0);
if (par1World != null && !par1World.isRemote)
{
@ -127,13 +128,13 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
}
@Override
public void setPortalLocation(BlockPos position)
public void setPortalLocation(Int3 position)
{
this.demonPortal = position;
}
@Override
public BlockPos getPortalLocation()
public Int3 getPortalLocation()
{
return this.demonPortal;
}
@ -175,25 +176,23 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
@Override
public void writeEntityToNBT(NBTTagCompound tag)
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeEntityToNBT(tag);
tag.setBoolean("Angry", this.isAngry());
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setBoolean("Angry", this.isAngry());
tag.setInteger("xCoord", this.demonPortal.getX());
tag.setInteger("yCoord", this.demonPortal.getY());
tag.setInteger("zCoord", this.demonPortal.getZ());
this.demonPortal.writeToNBT(par1NBTTagCompound);
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
@Override
public void readEntityFromNBT(NBTTagCompound tag)
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readEntityFromNBT(tag);
this.setAngry(tag.getBoolean("Angry"));
this.demonPortal = new BlockPos(tag.getInteger("xCoord"), tag.getInteger("yCoord"), tag.getInteger("zCoord"));
super.readEntityFromNBT(par1NBTTagCompound);
this.setAngry(par1NBTTagCompound.getBoolean("Angry"));
this.demonPortal = Int3.readFromNBT(par1NBTTagCompound);
this.setCombatTask();
}
@ -253,7 +252,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
{
if(!this.enthralled)
{
TileEntity tile = this.worldObj.getTileEntity(this.demonPortal);
TileEntity tile = this.worldObj.getTileEntity(this.demonPortal.xCoord, this.demonPortal.yCoord, this.demonPortal.zCoord);
if(tile instanceof TEDemonPortal)
{
((TEDemonPortal) tile).enthrallDemon(this);
@ -262,12 +261,12 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
{
IMasterRitualStone stone = (IMasterRitualStone)tile;
LocalRitualStorage stor = stone.getLocalStorage();
// if(stor instanceof LocalStorageAlphaPact)
// {
// LocalStorageAlphaPact storage = (LocalStorageAlphaPact)stor;
//
// storage.thrallDemon(this);
// }
if(stor instanceof LocalStorageAlphaPact)
{
LocalStorageAlphaPact storage = (LocalStorageAlphaPact)stor;
storage.thrallDemon(this);
}
}
}
super.onUpdate();
@ -326,7 +325,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
--itemstack.stackSize;
}
this.heal((float) itemfood.getHealAmount(itemstack));
this.heal((float) itemfood.func_150905_g(itemstack));
if (itemstack.stackSize <= 0)
{
@ -344,8 +343,8 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
{
this.aiSit.setSitting(!this.isSitting());
this.isJumping = false;
// this.setPathToEntity(null);
// this.setTarget(null);
this.setPathToEntity(null);
this.setTarget(null);
this.setAttackTarget(null);
}
@ -368,7 +367,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
if (this.rand.nextInt(1) == 0)
{
this.setTamed(true);
// this.setPathToEntity(null);
this.setPathToEntity(null);
this.setAttackTarget(null);
this.aiSit.setSitting(true);
this.setHealth(maxTamedHealth);
@ -501,7 +500,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
}
@Override
public boolean thrallDemon(BlockPos location)
public boolean thrallDemon(Int3 location)
{
this.setPortalLocation(location);
return true;
@ -510,9 +509,9 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
@Override
public boolean isSamePortal(IHoardDemon demon)
{
BlockPos position = demon.getPortalLocation();
TileEntity portal = worldObj.getTileEntity(this.demonPortal);
Int3 position = demon.getPortalLocation();
TileEntity portal = worldObj.getTileEntity(this.demonPortal.xCoord, this.demonPortal.yCoord, this.demonPortal.zCoord);
return portal instanceof TEDemonPortal && portal == worldObj.getTileEntity(position);
return portal instanceof TEDemonPortal ? portal == worldObj.getTileEntity(position.xCoord, position.yCoord, position.zCoord) : false;
}
}

View file

@ -1,14 +1,11 @@
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon;
import net.minecraft.util.BlockPos;
import WayofTime.alchemicalWizardry.api.Int3;
public interface IHoardDemon
{
void setPortalLocation(BlockPos position);
BlockPos getPortalLocation();
boolean thrallDemon(BlockPos location);
void setPortalLocation(Int3 position);
Int3 getPortalLocation();
boolean thrallDemon(Int3 location);
boolean isSamePortal(IHoardDemon demon);
}

View file

@ -11,14 +11,14 @@ import WayofTime.alchemicalWizardry.ModItems;
public class DemonVillageLootRegistry
{
public static ArrayList<WeightedRandomChestContent> list1 = new ArrayList<WeightedRandomChestContent>();
public static ArrayList<WeightedRandomChestContent> list1 = new ArrayList();
public static void init()
{
String[] tier1Strings = new String[]{ChestGenHooks.DUNGEON_CHEST, ChestGenHooks.PYRAMID_DESERT_CHEST};
for(String str : tier1Strings)
{
List<WeightedRandomChestContent> contents = ChestGenHooks.getItems(str, new Random());
WeightedRandomChestContent[] contents = ChestGenHooks.getItems(str, new Random());
if(contents != null)
{
for(WeightedRandomChestContent content : contents)
@ -34,6 +34,16 @@ public class DemonVillageLootRegistry
public static void populateChest(IInventory tile, int tier)
{
WeightedRandomChestContent.generateChestContents(new Random(), list1, tile, tile.getSizeInventory() / 3);
WeightedRandomChestContent.generateChestContents(new Random(), toArray(list1), tile, tile.getSizeInventory() / 3);
}
public static WeightedRandomChestContent[] toArray(List<WeightedRandomChestContent> aList)
{
int size = aList.size();
WeightedRandomChestContent[] contents = new WeightedRandomChestContent[size];
contents = aList.toArray(contents);
return contents;
}
}

View file

@ -1,9 +1,9 @@
package WayofTime.alchemicalWizardry.common.demonVillage.tileEntity;
import net.minecraft.block.Block;
import net.minecraft.block.BlockChest;
import net.minecraft.block.state.IBlockState;
import net.minecraft.inventory.IInventory;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
@ -12,10 +12,15 @@ public class BlockDemonChest extends BlockChest implements IBlockPortalNode
public BlockDemonChest()
{
super(0);
this.setHardness(2.5F).setStepSound(soundTypeWood).setUnlocalizedName("demonChest");
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)
{
return (IInventory)world.getTileEntity(x, y, z);
}
@Override
public TileEntity createNewTileEntity(World var1, int var2)
{
@ -23,18 +28,18 @@ public class BlockDemonChest extends BlockChest implements IBlockPortalNode
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
{
TileEntity tile = world.getTileEntity(pos);
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TEDemonChest)
{
((TEDemonChest) tile).notifyPortalOfInteraction();
}
super.breakBlock(world, pos, state);
super.breakBlock(world, x, y, z, block, meta);
}
@Override
public boolean canPlaceBlockAt(World world, BlockPos pos)
public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
{
return true;
}

View file

@ -1,17 +1,16 @@
package WayofTime.alchemicalWizardry.common.demonVillage.tileEntity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.BlockPos;
import WayofTime.alchemicalWizardry.api.Int3;
public class TEDemonChest extends TileEntityChest implements ITilePortalNode
{
public BlockPos portalLocation = BlockPos.ORIGIN;
public Int3 portalLocation = new Int3(0,0,0);
@Override
public String getName()
public String getInventoryName()
{
return "Demon's Chest";
}
@ -21,42 +20,42 @@ public class TEDemonChest extends TileEntityChest implements ITilePortalNode
{
super.readFromNBT(tag);
NBTTagCompound portalTag = tag.getCompoundTag("portalLocation");
portalLocation = new BlockPos(portalTag.getInteger("xCoord"), portalTag.getInteger("yCoord"), portalTag.getInteger("zCoord"));
portalLocation = Int3.readFromNBT(portalTag);
}
@Override
public void writeToNBT(NBTTagCompound tag)
{
super.writeToNBT(tag);
NBTTagCompound portalTag = new NBTTagCompound();
portalTag.setInteger("xCoord", portalLocation.getX());
portalTag.setInteger("yCoord", portalLocation.getY());
portalTag.setInteger("zCoord", portalLocation.getZ());
NBTTagCompound portalTag = portalLocation.writeToNBT(new NBTTagCompound());
tag.setTag("portalLocation", portalTag);
}
@Override
public void openInventory(EntityPlayer player)
public void openInventory()
{
super.openInventory(player);
super.openInventory();
this.notifyPortalOfInteraction();
}
@Override
public void checkForAdjacentChests() {}
public void checkForAdjacentChests()
{
}
@Override
public void setPortalLocation(TEDemonPortal teDemonPortal)
{
if(teDemonPortal != null)
{
portalLocation = teDemonPortal.getPos();
portalLocation = new Int3(teDemonPortal.xCoord, teDemonPortal.yCoord, teDemonPortal.zCoord);
}
}
public TEDemonPortal getDemonPortal()
{
TileEntity tile = worldObj.getTileEntity(portalLocation);
TileEntity tile = worldObj.getTileEntity(portalLocation.xCoord, portalLocation.yCoord, portalLocation.zCoord);
if(tile instanceof TEDemonPortal)
{
return (TEDemonPortal)tile;
@ -72,6 +71,6 @@ public class TEDemonChest extends TileEntityChest implements ITilePortalNode
return;
}
portal.notifyDemons(pos.getX(), pos.getY(), pos.getZ(), 50);
portal.notifyDemons(xCoord, yCoord, zCoord, 50);
}
}

View file

@ -15,7 +15,6 @@ import java.util.Random;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLivingBase;
@ -23,11 +22,9 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
@ -45,7 +42,7 @@ import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardD
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
public class TEDemonPortal extends TileEntity
{
public DemonType type = DemonType.FIRE;
@ -66,9 +63,9 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
public static int[] tierCostList = new int[]{1500};
public Set<IHoardDemon> hoardList = new HashSet<IHoardDemon>();
public Set<IHoardDemon> hoardList = new HashSet();
public static List<DemonBuilding> buildingList = new ArrayList<DemonBuilding>();
public static List<DemonBuilding> buildingList = new ArrayList();
public Random rand = new Random();
private GridSpace[][] area;
@ -88,7 +85,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
public float pointPool;
public String nextDemonPortalName = "";
public EnumFacing nextDemonPortalDirection = EnumFacing.DOWN;
public ForgeDirection nextDemonPortalDirection = ForgeDirection.DOWN;
public int buildingStage = -1;
@ -119,7 +116,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
isInitialized = false;
this.setGridSpace(0, 0, new GridSpace(GridSpace.MAIN_PORTAL, pos.getY()));
this.setGridSpace(0, 0, new GridSpace(GridSpace.MAIN_PORTAL, yCoord));
this.houseCooldown = 0;
this.roadCooldown = 0;
@ -168,7 +165,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
{
float totalChance = 0;
Map<String, Float> map = new HashMap<String, Float>();
Map<String, Float> map = new HashMap();
map.put("roadChance", this.getRoadChance());
map.put("houseChance", this.getHouseChance());
map.put("demonPortalChance", this.getDemonPortalChance());
@ -285,7 +282,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
{
if(demon instanceof IHoardDemon)
{
boolean enthrall = ((IHoardDemon) demon).thrallDemon(pos);
boolean enthrall = ((IHoardDemon) demon).thrallDemon(new Int3(this.xCoord, this.yCoord, this.zCoord));
if(enthrall)
{
this.hoardList.add((IHoardDemon)demon);
@ -309,10 +306,10 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
{
if (Math.abs(xIndex) == 1 || Math.abs(zIndex) == 1)
{
this.setGridSpace(xIndex, zIndex, new GridSpace(GridSpace.ROAD, pos.getY()));
this.setGridSpace(xIndex, zIndex, new GridSpace(GridSpace.ROAD, yCoord));
} else if (xIndex == 0 && zIndex == 0)
{
this.setGridSpace(0, 0, new GridSpace(GridSpace.MAIN_PORTAL, pos.getY()));
this.setGridSpace(0, 0, new GridSpace(GridSpace.MAIN_PORTAL, yCoord));
} else
{
this.setGridSpace(xIndex, zIndex, new GridSpace());
@ -337,7 +334,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
public void createParty()
{
worldObj.createExplosion(null, pos.getX() + rand.nextInt(10) - rand.nextInt(10), pos.getY(), pos.getZ() + rand.nextInt(10) - rand.nextInt(10), 5*rand.nextFloat(), false);
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()
@ -349,7 +346,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
* 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 update()
public void updateEntity()
{
if(worldObj.isRemote)
{
@ -367,7 +364,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
if(delayBeforeParty <= 0)
{
worldObj.createExplosion(null, pos.getX(), pos.getY(), pos.getZ(), 15, false);
worldObj.createExplosion(null, xCoord, yCoord, zCoord, 15, false);
this.initialize();
}
@ -496,7 +493,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
this.nextDemonPortalName = par1NBTTagCompound.getString("nextDemonPortalName");
this.buildingStage = par1NBTTagCompound.getInteger("buildingStage");
this.nextDemonPortalDirection = EnumFacing.getFront(par1NBTTagCompound.getInteger("nextDemonPortalDirection"));
this.nextDemonPortalDirection = ForgeDirection.getOrientation(par1NBTTagCompound.getInteger("nextDemonPortalDirection"));
this.pointPool = par1NBTTagCompound.getFloat("pointPool");
this.lockdownTimer = par1NBTTagCompound.getInteger("lockdownTimer");
@ -556,24 +553,24 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
public int createRandomDemonHoard(TEDemonPortal teDemonPortal, int tier, DemonType type, boolean spawnGuardian)
{
int next = rand.nextInt(4);
EnumFacing dir;
ForgeDirection dir;
switch (next)
{
case 0:
dir = EnumFacing.NORTH;
dir = ForgeDirection.NORTH;
break;
case 1:
dir = EnumFacing.SOUTH;
dir = ForgeDirection.SOUTH;
break;
case 2:
dir = EnumFacing.EAST;
dir = ForgeDirection.EAST;
break;
case 3:
dir = EnumFacing.WEST;
dir = ForgeDirection.WEST;
break;
default:
dir = EnumFacing.NORTH;
dir = ForgeDirection.NORTH;
}
Int3 road = findRoadSpaceFromDirection(dir, (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1);
@ -585,30 +582,30 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
if(TEDemonPortal.printDebug)
System.out.println("Spawning Demons");
return DemonPacketRegistry.spawnDemons(teDemonPortal, worldObj, pos.getX() + road.xCoord * 5, road.yCoord + 1, pos.getZ() + 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
{
int next = rand.nextInt(4);
EnumFacing dir;
ForgeDirection dir;
switch (next)
{
case 0:
dir = EnumFacing.NORTH;
dir = ForgeDirection.NORTH;
break;
case 1:
dir = EnumFacing.SOUTH;
dir = ForgeDirection.SOUTH;
break;
case 2:
dir = EnumFacing.EAST;
dir = ForgeDirection.EAST;
break;
case 3:
dir = EnumFacing.WEST;
dir = ForgeDirection.WEST;
break;
default:
dir = EnumFacing.NORTH;
dir = ForgeDirection.NORTH;
}
Int3 road = findRoadSpaceFromDirection(dir, (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1);
@ -620,7 +617,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
if(printDebug)
AlchemicalWizardry.logger.info("X: " + x + " Z: " + z + " Direction: " + dir.toString());
List<EnumFacing> directions = this.findValidExtentionDirection(x, z);
List<ForgeDirection> directions = this.findValidExtentionDirection(x, z);
if (directions.size() <= 0)
{
@ -630,9 +627,9 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
int maxDistance = 5;
int distance = 0;
EnumFacing dominantDirection = null;
ForgeDirection dominantDirection = null;
for (EnumFacing direction : directions)
for (ForgeDirection direction : directions)
{
int amt = this.getLength(direction, maxDistance, x, z);
if (amt > distance)
@ -659,9 +656,9 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
return distance;
}
public List<EnumFacing> findValidExtentionDirection(int x, int z)
public List<ForgeDirection> findValidExtentionDirection(int x, int z)
{
List<EnumFacing> directions = new LinkedList<EnumFacing>();
List<ForgeDirection> directions = new LinkedList();
if (this.getGridSpace(x, z) == null || !this.getGridSpace(x, z).isRoadSegment())
{
@ -671,41 +668,41 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
GridSpace nextGrid = this.getGridSpace(x + 1, z);
if (nextGrid.isEmpty())
{
directions.add(EnumFacing.EAST);
directions.add(ForgeDirection.EAST);
}
nextGrid = this.getGridSpace(x - 1, z);
if (nextGrid.isEmpty())
{
directions.add(EnumFacing.WEST);
directions.add(ForgeDirection.WEST);
}
nextGrid = this.getGridSpace(x, z + 1);
if (nextGrid.isEmpty())
{
directions.add(EnumFacing.SOUTH);
directions.add(ForgeDirection.SOUTH);
}
nextGrid = this.getGridSpace(x, z - 1);
if (nextGrid.isEmpty())
{
directions.add(EnumFacing.NORTH);
directions.add(ForgeDirection.NORTH);
}
return directions;
}
public int getLength(EnumFacing dir, int maxLength, int x, int z) //Number of spaces forward
public int getLength(ForgeDirection dir, int maxLength, int x, int z) //Number of spaces forward
{
for (int i = 1; i <= maxLength; i++)
{
GridSpace space = this.getGridSpace(x + i * dir.getFrontOffsetX(), z + i * dir.getFrontOffsetZ());
GridSpace space = this.getGridSpace(x + i * dir.offsetX, z + i * dir.offsetZ);
if (space.isEmpty())
{
for (int k = 1; k <= this.getRoadSpacer(); k++)
{
GridSpace space1 = this.getGridSpace(x + i * dir.getFrontOffsetX() + dir.getFrontOffsetZ() * k, z + i * dir.getFrontOffsetZ() + dir.getFrontOffsetX() * k);
GridSpace space2 = this.getGridSpace(x + i * dir.getFrontOffsetX() - dir.getFrontOffsetZ() * k, z + i * dir.getFrontOffsetZ() - dir.getFrontOffsetX() * k);
GridSpace space1 = this.getGridSpace(x + i * dir.offsetX + dir.offsetZ * k, z + i * dir.offsetZ + dir.offsetX * k);
GridSpace space2 = this.getGridSpace(x + i * dir.offsetX - dir.offsetZ * k, z + i * dir.offsetZ - dir.offsetX * k);
if (space1.isRoadSegment() || space2.isRoadSegment())
{
@ -726,10 +723,10 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
return maxLength;
}
public Int3 findRoadSpaceFromDirection(EnumFacing dir, int amount) //TODO
public Int3 findRoadSpaceFromDirection(ForgeDirection dir, int amount) //TODO
{
int index = 0;
if (dir == EnumFacing.NORTH)
if (dir == ForgeDirection.NORTH)
{
if(printDebug)
System.out.print("NORTH!");
@ -748,7 +745,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
}
}
}
} else if (dir == EnumFacing.SOUTH)
} else if (dir == ForgeDirection.SOUTH)
{
for (int i = negZRadius + Math.min(posZRadius, limit); i >= Math.max(0, -limit + negZRadius); i--)
{
@ -765,7 +762,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
}
}
}
} else if (dir == EnumFacing.EAST)
} else if (dir == ForgeDirection.EAST)
{
for (int i = negXRadius + Math.min(posXRadius, limit); i >= Math.max(0, -limit + negXRadius); i--)
{
@ -782,7 +779,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
}
}
}
} else if (dir == EnumFacing.WEST)
} else if (dir == ForgeDirection.WEST)
{
for (int i = Math.max(0, -limit + negXRadius); i <= negXRadius + Math.min(posXRadius, limit); i++)
{
@ -804,10 +801,10 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
return new Int3(0, 0, 0);
}
public Int3 findEmptySpaceNearRoad(EnumFacing dir, int amount, int closeness)
public Int3 findEmptySpaceNearRoad(ForgeDirection dir, int amount, int closeness)
{
int index = 0;
if (dir == EnumFacing.NORTH)
if (dir == ForgeDirection.NORTH)
{
if(printDebug)
System.out.print("NORTH!");
@ -831,7 +828,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
}
}
}
} else if (dir == EnumFacing.SOUTH)
} else if (dir == ForgeDirection.SOUTH)
{
for (int i = negZRadius + posZRadius; i >= 0; i--)
{
@ -853,7 +850,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
}
}
}
} else if (dir == EnumFacing.EAST)
} else if (dir == ForgeDirection.EAST)
{
for (int i = negXRadius + posXRadius; i >= 0; i--)
{
@ -875,7 +872,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
}
}
}
} else if (dir == EnumFacing.WEST)
} else if (dir == ForgeDirection.WEST)
{
for (int i = 0; i <= negXRadius + posXRadius; i++)
{
@ -902,10 +899,10 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
return new Int3(0, 0, 0);
}
public Int3 findEmptySpaceFromDirection(EnumFacing dir, int amount)
public Int3 findEmptySpaceFromDirection(ForgeDirection dir, int amount)
{
int index = 0;
if (dir == EnumFacing.NORTH)
if (dir == ForgeDirection.NORTH)
{
if(printDebug)
System.out.print("NORTH!");
@ -924,7 +921,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
}
}
}
} else if (dir == EnumFacing.SOUTH)
} else if (dir == ForgeDirection.SOUTH)
{
for (int i = negZRadius + posZRadius; i >= 0; i--)
{
@ -941,7 +938,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
}
}
}
} else if (dir == EnumFacing.EAST)
} else if (dir == ForgeDirection.EAST)
{
for (int i = negXRadius + posXRadius; i >= 0; i--)
{
@ -958,7 +955,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
}
}
}
} else if (dir == EnumFacing.WEST)
} else if (dir == ForgeDirection.WEST)
{
for (int i = 0; i <= negXRadius + posXRadius; i++)
{
@ -980,7 +977,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
return new Int3(0, 0, 0);
}
public int createGriddedRoad(int gridXi, int yi, int gridZi, EnumFacing dir, int gridLength, boolean convertStarter) //Total grid length
public int createGriddedRoad(int gridXi, int yi, int gridZi, ForgeDirection dir, int gridLength, boolean convertStarter) //Total grid length
{
if (gridLength == 0 || gridLength == 1)
{
@ -995,13 +992,13 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
{
this.setGridSpace(initGridX, initGridZ, new GridSpace(GridSpace.CROSSROAD, initY));
DemonCrosspath crosspath = new DemonCrosspath(pos.getX() + initGridX * 5, initY, pos.getZ() + initGridZ * 5);
DemonCrosspath crosspath = new DemonCrosspath(xCoord + initGridX * 5, initY, zCoord + initGridZ * 5);
crosspath.createCrosspath(worldObj);
}
for (int index = 0; index < gridLength - 1; index++)
{
DemonVillagePath path = new DemonVillagePath(pos.getX() + initGridX * 5, initY, pos.getZ() + initGridZ * 5, dir, 6);
DemonVillagePath path = new DemonVillagePath(xCoord + initGridX * 5, initY, zCoord + initGridZ * 5, dir, 6);
Int3AndBool temp = path.constructFullPath(this, worldObj, this.getRoadStepClearance());
Int3 next = temp.coords;
@ -1018,8 +1015,8 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
return index;
}
initGridX += dir.getFrontOffsetX();
initGridZ += dir.getFrontOffsetZ();
initGridX += dir.offsetX;
initGridZ += dir.offsetZ;
if (!this.getGridSpace(initGridX, initGridZ).isRoadSegment())
{
@ -1160,10 +1157,10 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
//
// this.initialize();
//
// if (EnumFacing.getOrientation(side) == EnumFacing.UP)
// if (ForgeDirection.getOrientation(side) == ForgeDirection.UP)
// {
// this.createRandomBuilding(DemonBuilding.BUILDING_HOUSE, 0);
// } else if (EnumFacing.getOrientation(side) == EnumFacing.DOWN)
// } else if (ForgeDirection.getOrientation(side) == ForgeDirection.DOWN)
// {
// this.createRandomBuilding(DemonBuilding.BUILDING_PORTAL, 0);
// } else
@ -1197,11 +1194,11 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
// GridSpaceHolder grid = this.createGSH();
List<EnumFacing> directions = new ArrayList<EnumFacing>();
List<ForgeDirection> directions = new ArrayList();
for (int i = 2; i < 6; i++)
{
EnumFacing testDir = EnumFacing.getFront(i);
ForgeDirection testDir = ForgeDirection.getOrientation(i);
directions.add(testDir);
}
@ -1210,9 +1207,9 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
return 0;
}
HashMap<EnumFacing, List<DemonBuilding>> schemMap = new HashMap<EnumFacing, List<DemonBuilding>>();
HashMap<ForgeDirection, List<DemonBuilding>> schemMap = new HashMap();
for (EnumFacing nextDir : directions)
for (ForgeDirection nextDir : directions)
{
for (DemonBuilding build : TEDemonPortal.buildingList)
{
@ -1226,7 +1223,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
schemMap.get(nextDir).add(build);
} else
{
schemMap.put(nextDir, new ArrayList<DemonBuilding>());
schemMap.put(nextDir, new ArrayList());
schemMap.get(nextDir).add(build);
}
}
@ -1237,7 +1234,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
return 0;
}
EnumFacing chosenDirection = (EnumFacing) schemMap.keySet().toArray()[new Random().nextInt(schemMap.keySet().size())];
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 portalSpace = build.getDoorSpace(chosenDirection);
@ -1279,7 +1276,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
GridSpaceHolder grid = this.createGSH();
EnumFacing chosenDirection = this.nextDemonPortalDirection;
ForgeDirection chosenDirection = this.nextDemonPortalDirection;
Int3 portalSpace = build.getDoorSpace(chosenDirection);
int yOffset = portalSpace.yCoord;
@ -1291,9 +1288,9 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
case 1:
int yDestination = yLevel + yOffset;
if(pos.getY() != yDestination)
if(yCoord != yDestination)
{
BlockTeleposer.swapBlocks(this, worldObj, worldObj, pos, new BlockPos(pos.getX(), yDestination, pos.getZ()));
BlockTeleposer.swapBlocks(this, worldObj, worldObj, xCoord, yCoord, zCoord, xCoord, yDestination, zCoord);
}else
{
//Nuthin - just as a reminder that we can now increment properly
@ -1301,9 +1298,9 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
break;
case 2:
build.destroyAllInField(worldObj, pos.getX() + (x) * 5, yLevel, pos.getZ() + (z) * 5, chosenDirection.getOpposite());
build.destroyAllInField(worldObj, xCoord + (x) * 5, yLevel, zCoord + (z) * 5, chosenDirection.getOpposite());
build.buildAll(this, worldObj, pos.getX() + (x) * 5, yLevel, pos.getZ() + (z) * 5, chosenDirection.getOpposite(), true);
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;
@ -1317,24 +1314,24 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
public int createRandomHouse(int buildingTier)
{
int next = rand.nextInt(4);
EnumFacing dir;
ForgeDirection dir;
switch (next)
{
case 0:
dir = EnumFacing.NORTH;
dir = ForgeDirection.NORTH;
break;
case 1:
dir = EnumFacing.SOUTH;
dir = ForgeDirection.SOUTH;
break;
case 2:
dir = EnumFacing.EAST;
dir = ForgeDirection.EAST;
break;
case 3:
dir = EnumFacing.WEST;
dir = ForgeDirection.WEST;
break;
default:
dir = EnumFacing.NORTH;
dir = ForgeDirection.NORTH;
}
Int3 space = this.findRoadSpaceFromDirection(dir, (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1); // Second: 1 *
@ -1353,12 +1350,12 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
return 0;
}
List<EnumFacing> directions = new ArrayList<EnumFacing>();
List<ForgeDirection> directions = new ArrayList();
for (int i = 2; i < 6; i++)
{
EnumFacing testDir = EnumFacing.getFront(i);
if (this.getGridSpace(x + testDir.getFrontOffsetX(), z + testDir.getFrontOffsetZ()).isEmpty())
ForgeDirection testDir = ForgeDirection.getOrientation(i);
if (this.getGridSpace(x + testDir.offsetX, z + testDir.offsetZ).isEmpty())
{
directions.add(testDir);
}
@ -1369,9 +1366,9 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
return 0;
}
HashMap<EnumFacing, List<DemonBuilding>> schemMap = new HashMap<EnumFacing, List<DemonBuilding>>();
HashMap<ForgeDirection, List<DemonBuilding>> schemMap = new HashMap();
for (EnumFacing nextDir : directions)
for (ForgeDirection nextDir : directions)
{
for (DemonBuilding build : TEDemonPortal.buildingList)
{
@ -1390,7 +1387,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
schemMap.get(nextDir).add(build);
} else
{
schemMap.put(nextDir, new ArrayList<DemonBuilding>());
schemMap.put(nextDir, new ArrayList());
schemMap.get(nextDir).add(build);
}
} else
@ -1406,18 +1403,22 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
return 0;
}
EnumFacing chosenDirection = (EnumFacing) schemMap.keySet().toArray()[new Random().nextInt(schemMap.keySet().size())];
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, pos.getX() + (x + xOff) * 5, yLevel, pos.getZ() + (z + zOff) * 5, chosenDirection.getOpposite());
build.buildAll(this, worldObj, pos.getX() + (x + xOff) * 5, yLevel, pos.getZ() + (z + zOff) * 5, chosenDirection.getOpposite(), true);
build.destroyAllInField(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);
DemonVillagePath path = new DemonVillagePath(xCoord + (x) * 5, yLevel, zCoord + (z) * 5, chosenDirection, 2);
Int3AndBool temp = path.constructFullPath(this, worldObj, this.getRoadStepClearance());
return build.getNumberOfGridSpaces();
}
@ -1445,9 +1446,14 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
return -1;
}
public void createRoad(int xi, int yi, int zi, EnumFacing dir, int length, boolean doesNotDrop)
public void createRoad(int xi, int yi, int zi, ForgeDirection dir, int length, boolean doesNotDrop)
{
if (dir.getFrontOffsetY() != 0)
int curX = xi;
int curY = yi;
int curZ = zi;
int roadRadius = this.getRoadRadius();
if (dir.offsetY != 0)
{
return;
}
@ -1489,11 +1495,6 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
}
return 0;
}
public IBlockState getRoadState()
{
return getRoadBlock().getStateFromMeta(getRoadMeta());
}
public int getRoadStepClearance()
{