Performance Commit --Too lazy to do the Altar recipe
This commit is contained in:
parent
013367cffa
commit
e5b795fddc
217 changed files with 840 additions and 1244 deletions
|
@ -119,11 +119,10 @@ public class BlockSet
|
|||
{
|
||||
int div = meta / 4;
|
||||
int mod = meta % 4;
|
||||
int[] northSet = new int[]{1 + div*4, 0 + div*4, 3 + div*4, 2 + div*4};
|
||||
int[] eastSet = new int[]{2 + div*4, 3 + div*4, 1 + div*4, 0 + div*4};
|
||||
int[] southSet = new int[]{0 + div*4, 1 + div*4, 2 + div*4, 3 + div*4};
|
||||
int[] westSet = new int[]{3 + div*4, 2 + div*4, 0 + div*4, 1 + div*4};
|
||||
|
||||
int[] northSet = new int[]{1 + div*4, div*4, 3 + div*4, 2 + div*4}; //Second one: 0 +
|
||||
int[] eastSet = new int[]{2 + div*4, 3 + div*4, 1 + div*4, div*4}; //Last one: 0 +
|
||||
int[] southSet = new int[]{div*4, 1 + div*4, 2 + div*4, 3 + div*4}; //First one: 0 +
|
||||
int[] westSet = new int[]{3 + div*4, 2 + div*4, div*4, 1 + div*4}; //Third one: 0 +
|
||||
|
||||
switch (mod)
|
||||
{
|
||||
|
@ -190,11 +189,10 @@ public class BlockSet
|
|||
{
|
||||
int div = meta / 4;
|
||||
int mod = meta % 4;
|
||||
int[] northSet = new int[]{0 + div*4, 2 + div*4, 3 + div*4, 1 + div*4};
|
||||
int[] eastSet = new int[]{1 + div*4, 3 + div*4, 0 + div*4, 2 + div*4};
|
||||
int[] southSet = new int[]{2 + div*4, 0 + div*4, 1 + div*4, 3 + div*4};
|
||||
int[] westSet = new int[]{3 + div*4, 1 + div*4, 2 + div*4, 0 + div*4};
|
||||
|
||||
int[] northSet = new int[]{div * 4, 2 + div * 4, 3 + div * 4, 1 + div * 4}; //First one: 0 +
|
||||
int[] eastSet = new int[]{1 + div*4, 3 + div*4, div*4, 2 + div*4}; //Third one: 0 +
|
||||
int[] southSet = new int[]{2 + div*4, div*4, 1 + div*4, 3 + div*4}; //Second one: 0 +
|
||||
int[] westSet = new int[]{3 + div*4, 1 + div*4, 2 + div*4, div*4}; //Last one: 0 +
|
||||
|
||||
switch (mod)
|
||||
{
|
||||
|
@ -215,10 +213,11 @@ public class BlockSet
|
|||
{
|
||||
int div = meta / 4;
|
||||
int mod = meta % 4;
|
||||
int[] northSet = new int[]{0 + div*4, 2 + div*4, 3 + div*4, 1 + div*4};
|
||||
int[] eastSet = new int[]{1 + div*4, 3 + div*4, 0 + div*4, 2 + div*4};
|
||||
int[] southSet = new int[]{2 + div*4, 0 + div*4, 1 + div*4, 3 + div*4};
|
||||
int[] westSet = new int[]{3 + div*4, 1 + div*4, 2 + div*4, 0 + div*4};
|
||||
int[] northSet = new int[]{div*4, 2 + div*4, 3 + div*4, 1 + div*4}; //First one: 0 +
|
||||
int[] eastSet = new int[]{1 + div*4, 3 + div*4, div*4, 2 + div*4}; //Third one: 0 +
|
||||
int[] southSet = new int[]{2 + div*4, div*4, 1 + div*4, 3 + div*4}; //Second one: 0 +
|
||||
int[] westSet = new int[]{3 + div*4, 1 + div*4, 2 + div*4, div*4}; //Last one: 0 +
|
||||
|
||||
|
||||
|
||||
switch (mod)
|
||||
|
@ -253,7 +252,7 @@ public class BlockSet
|
|||
|
||||
public Block getBlock()
|
||||
{
|
||||
return this.getBlockForString(blockid);
|
||||
return getBlockForString(blockid);
|
||||
}
|
||||
|
||||
public static String getPairedIdForBlock(Block block)
|
||||
|
@ -369,6 +368,6 @@ public class BlockSet
|
|||
public boolean isContained(Block block, int defaultMeta)
|
||||
{
|
||||
Block thisBlock = this.getBlock();
|
||||
return thisBlock == null ? false : thisBlock.equals(block) && this.metadata[0] == defaultMeta;
|
||||
return thisBlock != null && thisBlock.equals(block) && this.metadata[0] == defaultMeta;
|
||||
}
|
||||
}
|
|
@ -129,7 +129,7 @@ public class BuildingSchematic
|
|||
|
||||
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
|
||||
// GridSpaceHolder grid = this.createGSH(); //GridSpaceHolder is not aware of the buildings - need to use the schematic
|
||||
|
||||
List<Int3> positionList = getGriddedPositions(dir);
|
||||
|
||||
|
|
|
@ -59,8 +59,8 @@ public class DemonBuilding
|
|||
|
||||
public Int3 getDoorSpace(ForgeDirection dir)
|
||||
{
|
||||
int x = 0;
|
||||
int z = 0;
|
||||
int x;
|
||||
int z;
|
||||
switch (dir)
|
||||
{
|
||||
case SOUTH:
|
||||
|
|
|
@ -13,9 +13,9 @@ import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal
|
|||
|
||||
public class DemonVillagePath
|
||||
{
|
||||
public int xi;
|
||||
public int yi;
|
||||
public int zi;
|
||||
public int xPos;
|
||||
public int yPos;
|
||||
public int zPos;
|
||||
public ForgeDirection dir;
|
||||
public int length;
|
||||
|
||||
|
@ -25,37 +25,37 @@ public class DemonVillagePath
|
|||
|
||||
public DemonVillagePath(int xi, int yi, int zi, ForgeDirection dir, int length)
|
||||
{
|
||||
this.xi = xi;
|
||||
this.yi = yi;
|
||||
this.zi = zi;
|
||||
this.xPos = xi;
|
||||
this.yPos = yi;
|
||||
this.zPos = zi;
|
||||
this.dir = dir;
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public Int3AndBool constructFullPath(TEDemonPortal portal, World world, int clearance)
|
||||
{
|
||||
int xPos = this.xi;
|
||||
int yPos = this.yi;
|
||||
int zPos = this.zi;
|
||||
int xi = this.xPos;
|
||||
int yi = this.yPos;
|
||||
int zi = this.zPos;
|
||||
int rad = this.getRoadRadius();
|
||||
int value = 0;
|
||||
|
||||
int finalYPos = this.constructPartialPath(portal, world, clearance, xPos - rad * dir.offsetX, yPos, zPos - rad * dir.offsetZ, 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, xPos - rad * dir.offsetX + i * dir.offsetZ, yPos, zPos - rad * dir.offsetZ + i * dir.offsetX, 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 + "");
|
||||
}
|
||||
|
||||
Int3 position = new Int3(xPos, finalYPos, zPos);
|
||||
|
||||
Int3 position = new Int3(xi, finalYPos, zi);
|
||||
|
||||
boolean bool = value >= length + 2 * rad;
|
||||
|
||||
return new Int3AndBool(position, bool);
|
||||
}
|
||||
|
||||
|
||||
public class Int3AndBool
|
||||
{
|
||||
public Int3 coords;
|
||||
|
@ -68,7 +68,7 @@ public class DemonVillagePath
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param portal
|
||||
* @param world
|
||||
* @param clearance
|
||||
|
@ -78,112 +78,108 @@ public class DemonVillagePath
|
|||
* @param dir
|
||||
* @param length
|
||||
* @param doConstruct
|
||||
* @return length if doConstruct, yPos if !doConstruct
|
||||
* @return length if doConstruct, yi if !doConstruct
|
||||
*/
|
||||
public int constructPartialPath(TEDemonPortal portal, World world, int clearance, int xi, int yi, int zi, ForgeDirection dir, int length, boolean doConstruct)
|
||||
{
|
||||
int xPos = xi;
|
||||
int yPos = yi;
|
||||
int zPos = zi;
|
||||
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
int xOffset = i * dir.offsetX;
|
||||
int zOffset = i * dir.offsetZ;
|
||||
|
||||
boolean completed = false;
|
||||
|
||||
|
||||
for (int yOffset = 0; yOffset <= clearance; yOffset++)
|
||||
{
|
||||
int sign = 1;
|
||||
|
||||
Block block1 = world.getBlock(xPos + xOffset, yPos + sign * yOffset, zPos + zOffset);
|
||||
Block highBlock1 = world.getBlock(xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset);
|
||||
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, xPos + xOffset, yPos + sign * yOffset, zPos + zOffset) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset)))
|
||||
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.setBlock(xPos + xOffset, yPos + sign * yOffset, zPos + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3);
|
||||
world.setBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3);
|
||||
}
|
||||
yPos += sign * yOffset;
|
||||
yi += sign * yOffset;
|
||||
completed = true;
|
||||
break;
|
||||
} else if(canGoDown)
|
||||
{
|
||||
sign = -1;
|
||||
Block block2 = world.getBlock(xPos + xOffset, yPos + sign * yOffset, zPos + zOffset);
|
||||
Block highBlock2 = world.getBlock(xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset);
|
||||
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, xPos + xOffset, yPos + sign * yOffset, zPos + zOffset) && this.isBlockReplaceable(block2)) && (this.forceCanTunnelUnder(highBlock2) || highBlock2.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset)))
|
||||
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)
|
||||
{
|
||||
world.setBlock(xPos + xOffset, yPos + sign * yOffset, zPos + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3);
|
||||
world.setBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3);
|
||||
}
|
||||
yPos += sign * yOffset;
|
||||
yi += sign * yOffset;
|
||||
completed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!completed)
|
||||
{
|
||||
boolean returnAmount = true;
|
||||
if(createBridgeInAirIfObstructed)
|
||||
{
|
||||
Block block1 = world.getBlock(xPos + xOffset, yPos, zPos + zOffset);
|
||||
|
||||
if (block1.isReplaceable(world, xPos + xOffset, yPos, zPos + zOffset) || !this.isBlockReplaceable(block1) || !this.forceReplaceBlock(block1))
|
||||
Block block1 = world.getBlock(xi + xOffset, yi, zi + zOffset);
|
||||
|
||||
if (block1.isReplaceable(world, xi + xOffset, yi, zi + zOffset) || !this.isBlockReplaceable(block1) || !this.forceReplaceBlock(block1))
|
||||
{
|
||||
returnAmount = false;
|
||||
|
||||
if(doConstruct)
|
||||
{
|
||||
world.setBlock(xPos + xOffset, yPos, zPos + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3);
|
||||
world.setBlock(xi + xOffset, yi, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3);
|
||||
}
|
||||
}else
|
||||
{
|
||||
returnAmount = true;
|
||||
}
|
||||
|
||||
}else if(this.tunnelIfObstructed)
|
||||
{
|
||||
Block block1 = world.getBlock(xPos + xOffset, yPos, zPos + zOffset);
|
||||
|
||||
if (!block1.isReplaceable(world, xPos + xOffset, yPos, zPos + zOffset) || this.isBlockReplaceable(block1) || !this.forceReplaceBlock(block1))
|
||||
}else if(tunnelIfObstructed)
|
||||
{
|
||||
Block block1 = world.getBlock(xi + xOffset, yi, zi + zOffset);
|
||||
|
||||
if (!block1.isReplaceable(world, xi + xOffset, yi, zi + zOffset) || this.isBlockReplaceable(block1) || !this.forceReplaceBlock(block1))
|
||||
{
|
||||
returnAmount = false;
|
||||
|
||||
if(doConstruct)
|
||||
{
|
||||
world.setBlock(xPos + xOffset, yPos, zPos + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3);
|
||||
world.setBlockToAir(xPos + xOffset, yPos + 1, zPos + zOffset);
|
||||
world.setBlockToAir(xPos + xOffset, yPos + 2, zPos + zOffset);
|
||||
world.setBlockToAir(xPos + xOffset, yPos + 3, zPos + zOffset);
|
||||
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
|
||||
{
|
||||
returnAmount = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(returnAmount)
|
||||
{
|
||||
return doConstruct ? i : yPos;
|
||||
return doConstruct ? i : yi;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return doConstruct ? length : yPos;
|
||||
|
||||
return doConstruct ? length : yi;
|
||||
}
|
||||
|
||||
public Int3 getFinalLocation(World world, int clearance)
|
||||
{
|
||||
int xPos = xi;
|
||||
int yPos = yi;
|
||||
int zPos = zi;
|
||||
int xi = xPos;
|
||||
int yi = yPos;
|
||||
int zi = zPos;
|
||||
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
|
@ -194,29 +190,29 @@ public class DemonVillagePath
|
|||
{
|
||||
int sign = 1;
|
||||
|
||||
Block block1 = world.getBlock(xPos + xOffset, yPos + sign * yOffset, zPos + zOffset);
|
||||
Block highBlock1 = world.getBlock(xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset);
|
||||
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, xPos + xOffset, yPos + sign * yOffset, zPos + zOffset) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset)))
|
||||
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)))
|
||||
{
|
||||
yPos += sign * yOffset;
|
||||
yi += sign * yOffset;
|
||||
break;
|
||||
} else
|
||||
{
|
||||
sign = -1;
|
||||
Block block2 = world.getBlock(xPos + xOffset, yPos + sign * yOffset, zPos + zOffset);
|
||||
Block highBlock2 = world.getBlock(xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset);
|
||||
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, xPos + xOffset, yPos + sign * yOffset, zPos + zOffset) && this.isBlockReplaceable(block2) ) && (this.forceCanTunnelUnder(highBlock2) || highBlock2.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset)))
|
||||
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)))
|
||||
{
|
||||
yPos += sign * yOffset;
|
||||
yi += sign * yOffset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Int3(xPos, yPos, zPos);
|
||||
return new Int3(xi, yi, zi);
|
||||
}
|
||||
|
||||
public int getRoadRadius()
|
||||
|
@ -226,31 +222,16 @@ public class DemonVillagePath
|
|||
|
||||
public boolean isBlockReplaceable(Block block)
|
||||
{
|
||||
if (block.getMaterial() == Material.leaves || block.getMaterial() == Material.vine || block instanceof IRoadWard)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return !block.equals(ModBlocks.blockDemonPortal);
|
||||
return !(block.getMaterial() == Material.leaves || block.getMaterial() == Material.vine || block instanceof IRoadWard) &&!block.equals(ModBlocks.blockDemonPortal);
|
||||
}
|
||||
|
||||
public boolean forceReplaceBlock(Block block)
|
||||
{
|
||||
if(block.getMaterial().isLiquid())
|
||||
{
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return block.getMaterial().isLiquid();
|
||||
}
|
||||
|
||||
public boolean forceCanTunnelUnder(Block block)
|
||||
{
|
||||
if(block instanceof BlockFlower || block == Blocks.double_plant)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return block instanceof BlockFlower || block == Blocks.double_plant;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class GridSpace
|
|||
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return type == this.EMPTY;
|
||||
return type == EMPTY;
|
||||
}
|
||||
|
||||
public static GridSpace getGridFromTag(NBTTagCompound tag)
|
||||
|
@ -67,11 +67,11 @@ public class GridSpace
|
|||
|
||||
public boolean isRoadSegment()
|
||||
{
|
||||
return type == this.ROAD || type == this.CROSSROAD;
|
||||
return type == ROAD || type == CROSSROAD;
|
||||
}
|
||||
|
||||
public boolean isBuilding()
|
||||
{
|
||||
return type == this.HOUSE;
|
||||
return type == HOUSE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,22 +121,18 @@ public class GridSpaceHolder
|
|||
{
|
||||
this.expandAreaInPosX();
|
||||
this.setGridSpace(x, z, space);
|
||||
return;
|
||||
} else if (x < -negXRadius)
|
||||
{
|
||||
this.expandAreaInNegX();
|
||||
this.setGridSpace(x, z, space);
|
||||
return;
|
||||
} else if (z > posZRadius)
|
||||
{
|
||||
this.expandAreaInPosZ();
|
||||
this.setGridSpace(x, z, space);
|
||||
return;
|
||||
} else if (z < -negZRadius)
|
||||
{
|
||||
this.expandAreaInNegZ();
|
||||
this.setGridSpace(x, z, space);
|
||||
return;
|
||||
} else
|
||||
{
|
||||
area[x + negXRadius][z + negZRadius] = space;
|
||||
|
@ -162,8 +158,8 @@ public class GridSpaceHolder
|
|||
if(TEDemonPortal.printDebug)
|
||||
AlchemicalWizardry.logger.info("x: " + i + " z: " + j);
|
||||
|
||||
int xOff = 0;
|
||||
int zOff = 0;
|
||||
int xOff;
|
||||
int zOff;
|
||||
|
||||
switch (dir)
|
||||
{
|
||||
|
@ -211,8 +207,8 @@ public class GridSpaceHolder
|
|||
continue;
|
||||
}
|
||||
|
||||
int xOff = 0;
|
||||
int zOff = 0;
|
||||
int xOff;
|
||||
int zOff;
|
||||
|
||||
switch (dir)
|
||||
{
|
||||
|
@ -255,8 +251,8 @@ public class GridSpaceHolder
|
|||
continue;
|
||||
}
|
||||
|
||||
int xOff = 0;
|
||||
int zOff = 0;
|
||||
int xOff;
|
||||
int zOff;
|
||||
|
||||
switch (dir)
|
||||
{
|
||||
|
|
|
@ -10,8 +10,7 @@ import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal
|
|||
public class EntityDemonAIHurtByTarget extends EntityAIHurtByTarget
|
||||
{
|
||||
boolean entityCallsForHelp;
|
||||
private int revengeTimer;
|
||||
|
||||
|
||||
public EntityDemonAIHurtByTarget(EntityCreature demon, boolean callsForHelp)
|
||||
{
|
||||
super(demon, callsForHelp);
|
||||
|
@ -36,7 +35,6 @@ public class EntityDemonAIHurtByTarget extends EntityAIHurtByTarget
|
|||
}
|
||||
|
||||
this.taskOwner.setAttackTarget(this.taskOwner.getAITarget());
|
||||
this.revengeTimer = this.taskOwner.func_142015_aE();
|
||||
|
||||
if (this.entityCallsForHelp && this.taskOwner instanceof IHoardDemon)
|
||||
{
|
||||
|
|
|
@ -4,5 +4,5 @@ import net.minecraft.entity.IRangedAttackMob;
|
|||
|
||||
public interface IOccasionalRangedAttackMob extends IRangedAttackMob
|
||||
{
|
||||
public boolean shouldUseRangedAttack();
|
||||
boolean shouldUseRangedAttack();
|
||||
}
|
||||
|
|
|
@ -93,10 +93,10 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
|
||||
if (this.isTamed())
|
||||
{
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.maxTamedHealth);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth);
|
||||
} else
|
||||
{
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.maxUntamedHealth);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -296,10 +296,10 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
|
||||
if (par1)
|
||||
{
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.maxTamedHealth);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth);
|
||||
} else
|
||||
{
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.maxUntamedHealth);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
{
|
||||
ItemFood itemfood = (ItemFood) itemstack.getItem();
|
||||
|
||||
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < this.maxTamedHealth)
|
||||
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth)
|
||||
{
|
||||
if (!par1EntityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
|
@ -330,7 +330,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
|
||||
if (itemstack.stackSize <= 0)
|
||||
{
|
||||
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null);
|
||||
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -344,9 +344,9 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
{
|
||||
this.aiSit.setSitting(!this.isSitting());
|
||||
this.isJumping = false;
|
||||
this.setPathToEntity((PathEntity) null);
|
||||
this.setTarget((Entity) null);
|
||||
this.setAttackTarget((EntityLivingBase) null);
|
||||
this.setPathToEntity(null);
|
||||
this.setTarget(null);
|
||||
this.setAttackTarget(null);
|
||||
}
|
||||
|
||||
this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting());
|
||||
|
@ -368,10 +368,10 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
if (this.rand.nextInt(1) == 0)
|
||||
{
|
||||
this.setTamed(true);
|
||||
this.setPathToEntity((PathEntity) null);
|
||||
this.setAttackTarget((EntityLivingBase) null);
|
||||
this.setPathToEntity(null);
|
||||
this.setAttackTarget(null);
|
||||
this.aiSit.setSitting(true);
|
||||
this.setHealth(this.maxTamedHealth);
|
||||
this.setHealth(maxTamedHealth);
|
||||
this.func_152115_b(par1EntityPlayer.getUniqueID().toString());
|
||||
this.playTameEffect(true);
|
||||
this.worldObj.setEntityState(this, (byte) 7);
|
||||
|
@ -479,9 +479,6 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
{
|
||||
return;
|
||||
}
|
||||
double xCoord;
|
||||
double yCoord;
|
||||
double zCoord;
|
||||
HolyProjectile hol = new HolyProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 15, 600);
|
||||
this.worldObj.spawnEntityInWorld(hol);
|
||||
}
|
||||
|
|
|
@ -41,9 +41,6 @@ public class EntityMinorDemonGruntEarth extends EntityMinorDemonGrunt
|
|||
{
|
||||
return;
|
||||
}
|
||||
double xCoord;
|
||||
double yCoord;
|
||||
double zCoord;
|
||||
ExplosionProjectile hol = new ExplosionProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 15, 600, false);
|
||||
this.worldObj.spawnEntityInWorld(hol);
|
||||
}
|
||||
|
|
|
@ -37,9 +37,6 @@ public class EntityMinorDemonGruntFire extends EntityMinorDemonGrunt
|
|||
{
|
||||
return;
|
||||
}
|
||||
double xCoord;
|
||||
double yCoord;
|
||||
double zCoord;
|
||||
FireProjectile hol = new FireProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 15, 600);
|
||||
this.worldObj.spawnEntityInWorld(hol);
|
||||
}
|
||||
|
|
|
@ -38,9 +38,6 @@ public class EntityMinorDemonGruntGuardian extends EntityMinorDemonGrunt
|
|||
{
|
||||
return;
|
||||
}
|
||||
double xCoord;
|
||||
double yCoord;
|
||||
double zCoord;
|
||||
HolyProjectile hol = new HolyProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 20, 600);
|
||||
this.worldObj.spawnEntityInWorld(hol);
|
||||
}
|
||||
|
|
|
@ -45,9 +45,6 @@ public class EntityMinorDemonGruntGuardianEarth extends EntityMinorDemonGruntGua
|
|||
{
|
||||
return;
|
||||
}
|
||||
double xCoord;
|
||||
double yCoord;
|
||||
double zCoord;
|
||||
ExplosionProjectile hol = new ExplosionProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 20, 600, false);
|
||||
this.worldObj.spawnEntityInWorld(hol);
|
||||
}
|
||||
|
|
|
@ -41,9 +41,6 @@ public class EntityMinorDemonGruntGuardianFire extends EntityMinorDemonGruntGuar
|
|||
{
|
||||
return;
|
||||
}
|
||||
double xCoord;
|
||||
double yCoord;
|
||||
double zCoord;
|
||||
FireProjectile hol = new FireProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 20, 600);
|
||||
this.worldObj.spawnEntityInWorld(hol);
|
||||
}
|
||||
|
|
|
@ -38,9 +38,6 @@ public class EntityMinorDemonGruntGuardianIce extends EntityMinorDemonGruntGuard
|
|||
{
|
||||
return;
|
||||
}
|
||||
double xCoord;
|
||||
double yCoord;
|
||||
double zCoord;
|
||||
IceProjectile hol = new IceProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 20, 600);
|
||||
this.worldObj.spawnEntityInWorld(hol);
|
||||
}
|
||||
|
|
|
@ -55,9 +55,6 @@ public class EntityMinorDemonGruntGuardianWind extends EntityMinorDemonGruntGuar
|
|||
{
|
||||
return;
|
||||
}
|
||||
double xCoord;
|
||||
double yCoord;
|
||||
double zCoord;
|
||||
WindGustProjectile hol = new WindGustProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 20, 600);
|
||||
this.worldObj.spawnEntityInWorld(hol);
|
||||
}
|
||||
|
|
|
@ -34,9 +34,6 @@ public class EntityMinorDemonGruntIce extends EntityMinorDemonGrunt
|
|||
{
|
||||
return;
|
||||
}
|
||||
double xCoord;
|
||||
double yCoord;
|
||||
double zCoord;
|
||||
IceProjectile hol = new IceProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 15, 600);
|
||||
this.worldObj.spawnEntityInWorld(hol);
|
||||
}
|
||||
|
|
|
@ -51,9 +51,6 @@ public class EntityMinorDemonGruntWind extends EntityMinorDemonGrunt
|
|||
{
|
||||
return;
|
||||
}
|
||||
double xCoord;
|
||||
double yCoord;
|
||||
double zCoord;
|
||||
WindGustProjectile hol = new WindGustProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 15, 600);
|
||||
this.worldObj.spawnEntityInWorld(hol);
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ import WayofTime.alchemicalWizardry.api.Int3;
|
|||
|
||||
public interface IHoardDemon
|
||||
{
|
||||
public void setPortalLocation(Int3 position);
|
||||
public Int3 getPortalLocation();
|
||||
public boolean thrallDemon(Int3 location);
|
||||
public boolean isSamePortal(IHoardDemon demon);
|
||||
void setPortalLocation(Int3 position);
|
||||
Int3 getPortalLocation();
|
||||
boolean thrallDemon(Int3 location);
|
||||
boolean isSamePortal(IHoardDemon demon);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.List;
|
|||
import java.util.Random;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
|
@ -16,9 +15,6 @@ public class DemonVillageLootRegistry
|
|||
|
||||
public static void init()
|
||||
{
|
||||
ItemStack lifeShardStack = new ItemStack(ModItems.baseItems, 1, 28);
|
||||
ItemStack soulShardStack = new ItemStack(ModItems.baseItems, 1, 29);
|
||||
|
||||
String[] tier1Strings = new String[]{ChestGenHooks.DUNGEON_CHEST, ChestGenHooks.PYRAMID_DESERT_CHEST};
|
||||
for(String str : tier1Strings)
|
||||
{
|
||||
|
|
|
@ -18,9 +18,7 @@ public class BlockDemonChest extends BlockChest implements IBlockPortalNode
|
|||
|
||||
public IInventory func_149951_m(World world, int x, int y, int z)
|
||||
{
|
||||
IInventory object = (IInventory)world.getTileEntity(x, y, z);
|
||||
|
||||
return object;
|
||||
return (IInventory)world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,5 +2,5 @@ package WayofTime.alchemicalWizardry.common.demonVillage.tileEntity;
|
|||
|
||||
public interface ITilePortalNode
|
||||
{
|
||||
public void setPortalLocation(TEDemonPortal teDemonPortal);
|
||||
void setPortalLocation(TEDemonPortal teDemonPortal);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class TEDemonChest extends TileEntityChest implements ITilePortalNode
|
|||
@Override
|
||||
public void checkForAdjacentChests()
|
||||
{
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -426,7 +426,7 @@ public class TEDemonPortal extends TileEntity
|
|||
}
|
||||
}
|
||||
|
||||
if(this.tier < this.tierCostList.length && this.demonHouseCooldown > this.tierCostList[this.tier])
|
||||
if(this.tier < tierCostList.length && this.demonHouseCooldown > tierCostList[this.tier])
|
||||
{
|
||||
this.tier++;
|
||||
|
||||
|
@ -480,7 +480,7 @@ public class TEDemonPortal extends TileEntity
|
|||
int x = i / length;
|
||||
int z = i % length;
|
||||
|
||||
NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i);
|
||||
NBTTagCompound tag = tagList.getCompoundTagAt(i);
|
||||
GridSpace space = GridSpace.getGridFromTag(tag);
|
||||
|
||||
area[x][z] = space;
|
||||
|
@ -519,8 +519,6 @@ public class TEDemonPortal extends TileEntity
|
|||
{
|
||||
for (int j = 0; j <= negZRadius + posZRadius; j++)
|
||||
{
|
||||
int index = i + (negZRadius + posZRadius + 1) * j;
|
||||
|
||||
GridSpace space = area[i][j];
|
||||
NBTTagCompound nextTag;
|
||||
|
||||
|
@ -610,8 +608,6 @@ public class TEDemonPortal extends TileEntity
|
|||
dir = ForgeDirection.NORTH;
|
||||
}
|
||||
|
||||
int length = 5;
|
||||
|
||||
Int3 road = findRoadSpaceFromDirection(dir, (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1);
|
||||
|
||||
int x = road.xCoord;
|
||||
|
@ -988,11 +984,6 @@ public class TEDemonPortal extends TileEntity
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (convertStarter)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int initGridX = gridXi;
|
||||
int initGridZ = gridZi;
|
||||
int initY = yi;
|
||||
|
@ -1139,22 +1130,18 @@ public class TEDemonPortal extends TileEntity
|
|||
{
|
||||
this.expandAreaInPosX();
|
||||
this.setGridSpace(x, z, space);
|
||||
return;
|
||||
} else if (x < -negXRadius)
|
||||
{
|
||||
this.expandAreaInNegX();
|
||||
this.setGridSpace(x, z, space);
|
||||
return;
|
||||
} else if (z > posZRadius)
|
||||
{
|
||||
this.expandAreaInPosZ();
|
||||
this.setGridSpace(x, z, space);
|
||||
return;
|
||||
} else if (z < -negZRadius)
|
||||
{
|
||||
this.expandAreaInNegZ();
|
||||
this.setGridSpace(x, z, space);
|
||||
return;
|
||||
} else
|
||||
{
|
||||
area[x + negXRadius][z + negZRadius] = space;
|
||||
|
@ -1202,10 +1189,10 @@ public class TEDemonPortal extends TileEntity
|
|||
int x = 0;
|
||||
int z = 0;
|
||||
|
||||
GridSpace home = this.getGridSpace(x, z);
|
||||
int yLevel = home.getYLevel();
|
||||
// GridSpace home = this.getGridSpace(x, z);
|
||||
// int yLevel = home.getYLevel();
|
||||
|
||||
GridSpaceHolder grid = this.createGSH();
|
||||
// GridSpaceHolder grid = this.createGSH();
|
||||
|
||||
List<ForgeDirection> directions = new ArrayList();
|
||||
|
||||
|
@ -1249,9 +1236,8 @@ public class TEDemonPortal extends TileEntity
|
|||
|
||||
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);
|
||||
// Int3 portalSpace = build.getDoorSpace(chosenDirection);
|
||||
|
||||
|
||||
this.nextDemonPortalDirection = chosenDirection;
|
||||
this.nextDemonPortalName = build.getName();
|
||||
|
||||
|
@ -1348,7 +1334,7 @@ public class TEDemonPortal extends TileEntity
|
|||
dir = ForgeDirection.NORTH;
|
||||
}
|
||||
|
||||
Int3 space = this.findRoadSpaceFromDirection(dir, 1 * (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1);
|
||||
Int3 space = this.findRoadSpaceFromDirection(dir, (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1); // Second: 1 *
|
||||
|
||||
int x = space.xCoord;
|
||||
int z = space.zCoord;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue