Reworked more rituals, allowed Int3 to be created from BlockPos - note for future, may replace Int3 with Vec3i for future use

This commit is contained in:
WayofTime 2015-07-29 11:25:11 -04:00
parent 14d603e99c
commit f046b07a82
13 changed files with 90 additions and 87 deletions

View file

@ -1,6 +1,7 @@
package WayofTime.alchemicalWizardry.api; package WayofTime.alchemicalWizardry.api;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.BlockPos;
public class Int3 public class Int3
@ -9,6 +10,11 @@ public class Int3
public int yCoord; public int yCoord;
public int zCoord; public int zCoord;
public Int3(BlockPos pos)
{
this(pos.getX(), pos.getY(), pos.getZ());
}
public Int3(int xCoord, int yCoord, int zCoord) public Int3(int xCoord, int yCoord, int zCoord)
{ {
this.xCoord = xCoord; this.xCoord = xCoord;

View file

@ -1,8 +1,8 @@
package WayofTime.alchemicalWizardry.common.items.routing; package WayofTime.alchemicalWizardry.common.items.routing;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraftforge.fml.relauncher.Side;
import cpw.mods.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly;
import cpw.mods.fml.relauncher.SideOnly; import codechicken.lib.render.TextureUtils.IIconRegister;
public class InputRoutingFocus extends RoutingFocus public class InputRoutingFocus extends RoutingFocus
{ {

View file

@ -8,10 +8,11 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.api.RoutingFocusLogic; import WayofTime.alchemicalWizardry.api.RoutingFocusLogic;
@ -41,18 +42,18 @@ public class RoutingFocus extends Item
// //
// public void cycleDirection(ItemStack itemStack) // public void cycleDirection(ItemStack itemStack)
// { // {
// ForgeDirection dir = this.getSetDirection(itemStack); // EnumFacing dir = this.getSetDirection(itemStack);
// int direction = dir.ordinal(); // int direction = dir.ordinal();
// direction++; // direction++;
// if(direction >= ForgeDirection.VALID_DIRECTIONS.length) // if(direction >= EnumFacing.VALID_DIRECTIONS.length)
// { // {
// direction = 0; // direction = 0;
// } // }
// //
// this.setSetDirection(itemStack, ForgeDirection.getOrientation(direction)); // this.setSetDirection(itemStack, EnumFacing.getOrientation(direction));
// } // }
public ForgeDirection getSetDirection(ItemStack itemStack) public EnumFacing getSetDirection(ItemStack itemStack)
{ {
if(!itemStack.hasTagCompound()) if(!itemStack.hasTagCompound())
{ {
@ -61,10 +62,10 @@ public class RoutingFocus extends Item
NBTTagCompound tag = itemStack.getTagCompound(); NBTTagCompound tag = itemStack.getTagCompound();
return ForgeDirection.getOrientation(tag.getInteger("direction")); return EnumFacing.getFront(tag.getInteger("direction"));
} }
public void setSetDirection(ItemStack itemStack, ForgeDirection dir) public void setSetDirection(ItemStack itemStack, EnumFacing dir)
{ {
if(!itemStack.hasTagCompound()) if(!itemStack.hasTagCompound())
{ {
@ -96,14 +97,14 @@ public class RoutingFocus extends Item
} }
@Override @Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{ {
if(world.isRemote) if(world.isRemote)
{ {
return false; return false;
} }
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(pos);
if(tile instanceof IInventory) if(tile instanceof IInventory)
{ {
if(player.isSneaking()) if(player.isSneaking())
@ -111,7 +112,7 @@ public class RoutingFocus extends Item
if(this instanceof ILimitedRoutingFocus) if(this instanceof ILimitedRoutingFocus)
{ {
int pastAmount = ((ILimitedRoutingFocus)this).getRoutingFocusLimit(stack); int pastAmount = ((ILimitedRoutingFocus)this).getRoutingFocusLimit(stack);
int amount = SpellHelper.getNumberOfItemsInInventory((IInventory)tile, ForgeDirection.getOrientation(side)); int amount = SpellHelper.getNumberOfItemsInInventory((IInventory)tile, side);
if(amount != pastAmount) if(amount != pastAmount)
{ {
((ILimitedRoutingFocus)this).setRoutingFocusLimit(stack, amount); ((ILimitedRoutingFocus)this).setRoutingFocusLimit(stack, amount);
@ -120,8 +121,8 @@ public class RoutingFocus extends Item
} }
} }
this.setCoordinates(stack, x, y, z); this.setCoordinates(stack, pos);
this.setSetDirection(stack, ForgeDirection.getOrientation(side)); this.setSetDirection(stack, side);
return true; return true;
} }
@ -129,7 +130,7 @@ public class RoutingFocus extends Item
return true; return true;
} }
public void setCoordinates(ItemStack itemStack, int x, int y, int z) public void setCoordinates(ItemStack itemStack, BlockPos pos)
{ {
if(!itemStack.hasTagCompound()) if(!itemStack.hasTagCompound())
{ {
@ -138,9 +139,9 @@ public class RoutingFocus extends Item
NBTTagCompound tag = itemStack.getTagCompound(); NBTTagCompound tag = itemStack.getTagCompound();
tag.setInteger("xCoord", x); tag.setInteger("xCoord", pos.getX());
tag.setInteger("yCoord", y); tag.setInteger("yCoord", pos.getY());
tag.setInteger("zCoord", z); tag.setInteger("zCoord", pos.getZ());
} }
public int xCoord(ItemStack itemStack) public int xCoord(ItemStack itemStack)

View file

@ -37,7 +37,7 @@ public class RitualEffectInterdiction extends RitualEffect
{ {
int d0 = 5; int d0 = 5;
List<EntityLivingBase> list = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, d0, d0); List<EntityLivingBase> list = SpellHelper.getLivingEntitiesInRange(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, d0, d0);
boolean flag = false; boolean flag = false;
boolean hasOffensa = this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false); boolean hasOffensa = this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false);
@ -47,9 +47,9 @@ public class RitualEffectInterdiction extends RitualEffect
{ {
if (!((!hasOffensa && entityLiving instanceof EntityPlayer) && (SpellHelper.getUsername((EntityPlayer) entityLiving).equals(owner)))) if (!((!hasOffensa && entityLiving instanceof EntityPlayer) && (SpellHelper.getUsername((EntityPlayer) entityLiving).equals(owner))))
{ {
double xDif = entityLiving.posX - x; double xDif = entityLiving.posX - (pos.getX() - 0.5);
double yDif = entityLiving.posY - (y + 1); double yDif = entityLiving.posY - ((pos.getY() - 0.5) + 1);
double zDif = entityLiving.posZ - z; double zDif = entityLiving.posZ - (pos.getZ() - 0.5);
entityLiving.motionX = 0.1 * xDif; entityLiving.motionX = 0.1 * xDif;
entityLiving.motionY = 0.1 * yDif; entityLiving.motionY = 0.1 * yDif;
entityLiving.motionZ = 0.1 * zDif; entityLiving.motionZ = 0.1 * zDif;
@ -77,7 +77,7 @@ public class RitualEffectInterdiction extends RitualEffect
int horizontalRadius = 5; int horizontalRadius = 5;
int verticalRadius = 5; int verticalRadius = 5;
List<EntityItem> itemList = world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(x, y, z, x + 1, y + 1, z + 1).expand(horizontalRadius, verticalRadius, horizontalRadius)); List<EntityItem> itemList = world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)).expand(horizontalRadius, verticalRadius, horizontalRadius));
if (itemList != null) if (itemList != null)
{ {
@ -85,9 +85,9 @@ public class RitualEffectInterdiction extends RitualEffect
for (EntityItem entity : itemList) for (EntityItem entity : itemList)
{ {
double xDif = entity.posX - x; double xDif = entity.posX - (pos.getX() - 0.5);
double yDif = entity.posY - (y + 1); double yDif = entity.posY - ((pos.getY() - 0.5) + 1);
double zDif = entity.posZ - z; double zDif = entity.posZ - (pos.getZ() - 0.5);
entity.motionX = 0.1 * xDif; entity.motionX = 0.1 * xDif;
entity.motionY = 0.1 * yDif; entity.motionY = 0.1 * yDif;
entity.motionZ = 0.1 * zDif; entity.motionZ = 0.1 * zDif;

View file

@ -11,8 +11,8 @@ import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.api.RoutingFocusParadigm; import WayofTime.alchemicalWizardry.api.RoutingFocusParadigm;
import WayofTime.alchemicalWizardry.api.RoutingFocusPosAndFacing; import WayofTime.alchemicalWizardry.api.RoutingFocusPosAndFacing;
@ -48,7 +48,8 @@ public class RitualEffectItemRouting extends RitualEffect
for(int i=0; i<4; i++) //Check output foci chests, return if none available for(int i=0; i<4; i++) //Check output foci chests, return if none available
{ {
Int3 outputFocusChest = this.getOutputBufferChestLocation(i); Int3 outputFocusChest = this.getOutputBufferChestLocation(i);
TileEntity outputFocusInv = world.getTileEntity(x + outputFocusChest.xCoord, y + outputFocusChest.yCoord, z + outputFocusChest.zCoord); BlockPos newPos = pos.add(outputFocusChest.xCoord, outputFocusChest.yCoord, outputFocusChest.zCoord);
TileEntity outputFocusInv = world.getTileEntity(newPos);
if(outputFocusInv instanceof IInventory) if(outputFocusInv instanceof IInventory)
{ {
outputList.add((IInventory)outputFocusInv); outputList.add((IInventory)outputFocusInv);
@ -68,7 +69,7 @@ public class RitualEffectItemRouting extends RitualEffect
RoutingFocusParadigm parad = new RoutingFocusParadigm(); RoutingFocusParadigm parad = new RoutingFocusParadigm();
TileEntity outputChest = null; //Destination TileEntity outputChest = null; //Destination
ForgeDirection inputDirection; EnumFacing inputDirection;
{ {
IInventory outputChestInventory = null; IInventory outputChestInventory = null;
@ -108,9 +109,9 @@ public class RitualEffectItemRouting extends RitualEffect
continue; continue;
} }
inputDirection = posAndFacing.facing; inputDirection = posAndFacing.facing;
if(outputChest == null || !posAndFacing.location.equals(new Int3(outputChest.xCoord, outputChest.yCoord, outputChest.zCoord))) if(outputChest == null || !posAndFacing.location.equals(new Int3(outputChest.getPos())))
{ {
outputChest = world.getTileEntity(posAndFacing.location.xCoord, posAndFacing.location.yCoord, posAndFacing.location.zCoord); outputChest = world.getTileEntity(new BlockPos(posAndFacing.location.xCoord, posAndFacing.location.yCoord, posAndFacing.location.zCoord));
if(outputChest instanceof IInventory) if(outputChest instanceof IInventory)
{ {
outputChestInventory = (IInventory)outputChest; outputChestInventory = (IInventory)outputChest;
@ -123,7 +124,7 @@ public class RitualEffectItemRouting extends RitualEffect
for(int i=0; i<4; i++) for(int i=0; i<4; i++)
{ {
Int3 inputFocusChest = this.getInputBufferChestLocation(i); Int3 inputFocusChest = this.getInputBufferChestLocation(i);
TileEntity inputFocusInv = world.getTileEntity(x + inputFocusChest.xCoord, y + inputFocusChest.yCoord, z + inputFocusChest.zCoord); TileEntity inputFocusInv = world.getTileEntity(pos.add(inputFocusChest.xCoord, inputFocusChest.yCoord, inputFocusChest.zCoord));
if(inputFocusInv instanceof IInventory) if(inputFocusInv instanceof IInventory)
{ {
for(int ji=0; ji<((IInventory) inputFocusInv).getSizeInventory(); ji++) //Iterate through foci inventory for(int ji=0; ji<((IInventory) inputFocusInv).getSizeInventory(); ji++) //Iterate through foci inventory
@ -132,15 +133,15 @@ public class RitualEffectItemRouting extends RitualEffect
if(inputFocusStack != null && inputFocusStack.getItem() instanceof InputRoutingFocus) if(inputFocusStack != null && inputFocusStack.getItem() instanceof InputRoutingFocus)
{ {
InputRoutingFocus inputFocus = (InputRoutingFocus)inputFocusStack.getItem(); InputRoutingFocus inputFocus = (InputRoutingFocus)inputFocusStack.getItem();
TileEntity inputChest = world.getTileEntity(inputFocus.xCoord(inputFocusStack), inputFocus.yCoord(inputFocusStack), inputFocus.zCoord(inputFocusStack)); TileEntity inputChest = world.getTileEntity(new BlockPos(inputFocus.xCoord(inputFocusStack), inputFocus.yCoord(inputFocusStack), inputFocus.zCoord(inputFocusStack)));
if(inputChest instanceof IInventory) if(inputChest instanceof IInventory)
{ {
IInventory inputChestInventory = (IInventory)inputChest; IInventory inputChestInventory = (IInventory)inputChest;
ForgeDirection syphonDirection = inputFocus.getSetDirection(inputFocusStack); EnumFacing syphonDirection = inputFocus.getSetDirection(inputFocusStack);
boolean[] canSyphonList = new boolean[inputChestInventory.getSizeInventory()]; boolean[] canSyphonList = new boolean[inputChestInventory.getSizeInventory()];
if(inputChest instanceof ISidedInventory) if(inputChest instanceof ISidedInventory)
{ {
int[] validSlots = ((ISidedInventory) inputChest).getAccessibleSlotsFromSide(syphonDirection.ordinal()); int[] validSlots = ((ISidedInventory) inputChest).getSlotsForFace(syphonDirection);
for(int in : validSlots) for(int in : validSlots)
{ {
canSyphonList[in] = true; canSyphonList[in] = true;
@ -158,7 +159,7 @@ public class RitualEffectItemRouting extends RitualEffect
if(canSyphonList[ni]) if(canSyphonList[ni])
{ {
ItemStack syphonedStack = inputChestInventory.getStackInSlot(ni); //Has a syphoned item linked, next need to find a destination ItemStack syphonedStack = inputChestInventory.getStackInSlot(ni); //Has a syphoned item linked, next need to find a destination
if(syphonedStack == null || (inputChestInventory instanceof ISidedInventory && !((ISidedInventory)inputChestInventory).canExtractItem(ni, syphonedStack, syphonDirection.ordinal()))) if(syphonedStack == null || (inputChestInventory instanceof ISidedInventory && !((ISidedInventory)inputChestInventory).canExtractItem(ni, syphonedStack, syphonDirection)))
{ {
continue; continue;
} }

View file

@ -8,8 +8,8 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
@ -32,7 +32,7 @@ public class RitualEffectItemSuction extends RitualEffect
World world = ritualStone.getWorldObj(); World world = ritualStone.getWorldObj();
BlockPos pos = ritualStone.getPosition(); BlockPos pos = ritualStone.getPosition();
TileEntity tile = world.getTileEntity(x, y + 1, z); TileEntity tile = world.getTileEntity(pos.offsetUp());
IInventory tileEntity; IInventory tileEntity;
if (tile instanceof IInventory) if (tile instanceof IInventory)
@ -53,7 +53,7 @@ public class RitualEffectItemSuction extends RitualEffect
SoulNetworkHandler.causeNauseaToPlayer(owner); SoulNetworkHandler.causeNauseaToPlayer(owner);
} else } else
{ {
List<EntityItem> itemDropList = SpellHelper.getItemsInRange(world, x + 0.5f, y + 0.5f, z + 0.5f, 10, 10); List<EntityItem> itemDropList = SpellHelper.getItemsInRange(world, pos.getX() + 0.5f, pos.getY() + 0.5f, pos.getZ() + 0.5f, 10, 10);
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
@ -65,16 +65,16 @@ public class RitualEffectItemSuction extends RitualEffect
for (EntityItem itemEntity : itemDropList) for (EntityItem itemEntity : itemDropList)
{ {
hasReductus = hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); // hasReductus = hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
if (hasReductus && itemEntity.age < this.timeDelayMin) // if (hasReductus && itemEntity.age < this.timeDelayMin)
{ // {
continue; // continue;
} // }
ItemStack item = itemEntity.getEntityItem(); ItemStack item = itemEntity.getEntityItem();
ItemStack copyStack = itemEntity.getEntityItem().copy(); ItemStack copyStack = itemEntity.getEntityItem().copy();
int pastAmount = copyStack.stackSize; int pastAmount = copyStack.stackSize;
ItemStack newStack = SpellHelper.insertStackIntoInventory(copyStack, tileEntity, ForgeDirection.DOWN); ItemStack newStack = SpellHelper.insertStackIntoInventory(copyStack, tileEntity, EnumFacing.DOWN);
if (newStack != null && newStack.stackSize < pastAmount) if (newStack != null && newStack.stackSize < pastAmount)
{ {

View file

@ -31,7 +31,7 @@ public class RitualEffectJumping extends RitualEffect
BlockPos pos = ritualStone.getPosition(); BlockPos pos = ritualStone.getPosition();
double range = 0.5; double range = 0.5;
List<EntityLivingBase> livingList = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 1.5, z + 0.5, range, range); List<EntityLivingBase> livingList = SpellHelper.getLivingEntitiesInRange(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, range, range);
if (currentEssence < this.getCostPerRefresh() * livingList.size()) if (currentEssence < this.getCostPerRefresh() * livingList.size())
{ {

View file

@ -35,7 +35,7 @@ public class RitualEffectLeap extends RitualEffect
double range = 2.0; double range = 2.0;
List<EntityLivingBase> livingList = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range); List<EntityLivingBase> livingList = SpellHelper.getLivingEntitiesInRange(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, range, range);
if (livingList == null) if (livingList == null)
{ {

View file

@ -5,8 +5,8 @@ import java.util.List;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.fluids.IFluidHandler;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
@ -37,9 +37,10 @@ public class RitualEffectLifeConduit extends RitualEffect
{ {
for (int k = -10; k <= 10; k++) for (int k = -10; k <= 10; k++)
{ {
if (world.getTileEntity(x + i, y + k, z + j) instanceof IBloodAltar) BlockPos newPos = pos.add(i, j, k);
if (world.getTileEntity(newPos) instanceof IBloodAltar)
{ {
tileAltar = (IBloodAltar) world.getTileEntity(x + i, y + k, z + j); tileAltar = (IBloodAltar) world.getTileEntity(newPos);
testFlag = true; testFlag = true;
} }
} }
@ -60,7 +61,7 @@ public class RitualEffectLifeConduit extends RitualEffect
int vertRange = 20; int vertRange = 20;
EntityPlayer entityOwner = null; EntityPlayer entityOwner = null;
List<EntityPlayer> list = SpellHelper.getPlayersInRange(world, x, y, z, d0, vertRange); List<EntityPlayer> list = SpellHelper.getPlayersInRange(world, pos.getX(), pos.getY(), pos.getZ(), d0, vertRange);
for (EntityPlayer player : list) for (EntityPlayer player : list)
{ {
@ -75,10 +76,10 @@ public class RitualEffectLifeConduit extends RitualEffect
return; return;
} }
int fillAmount = Math.min(currentEssence / 2, ((IFluidHandler)tileAltar).fill(ForgeDirection.UP, new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 10000), false)); int fillAmount = Math.min(currentEssence / 2, ((IFluidHandler)tileAltar).fill(EnumFacing.UP, new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 10000), false));
{ {
((IFluidHandler)tileAltar).fill(ForgeDirection.UP, new FluidStack(AlchemicalWizardry.lifeEssenceFluid, fillAmount), true); ((IFluidHandler)tileAltar).fill(EnumFacing.UP, new FluidStack(AlchemicalWizardry.lifeEssenceFluid, fillAmount), true);
if (entityOwner.getHealth() > 2.0f && fillAmount != 0) if (entityOwner.getHealth() > 2.0f && fillAmount != 0)
{ {
entityOwner.setHealth(2.0f); entityOwner.setHealth(2.0f);

View file

@ -8,6 +8,7 @@ import java.util.Map;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockOre; import net.minecraft.block.BlockOre;
import net.minecraft.block.BlockRedstoneOre; import net.minecraft.block.BlockRedstoneOre;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -87,9 +88,7 @@ public class RitualEffectMagnetic extends RitualEffect
SoulNetworkHandler.causeNauseaToPlayer(owner); SoulNetworkHandler.causeNauseaToPlayer(owner);
} else } else
{ {
int xRep = 0; BlockPos posRep = null;
int yRep = 0;
int zRep = 0;
boolean replace = false; boolean replace = false;
outer: outer:
@ -99,11 +98,10 @@ public class RitualEffectMagnetic extends RitualEffect
{ {
for (int k = -1; k <= 1; k++) for (int k = -1; k <= 1; k++)
{ {
if ((!replace) && world.isAirBlock(x + i, y + j, z + k)) BlockPos newPos = pos.add(i, j, k);
if ((!replace) && world.isAirBlock(newPos))
{ {
xRep = x + i; posRep = newPos;
yRep = y + j;
zRep = z + k;
replace = true; replace = true;
break outer; break outer;
} }
@ -115,7 +113,7 @@ public class RitualEffectMagnetic extends RitualEffect
{ {
Int3 lastPos = this.getLastPosition(ritualStone.getCustomRitualTag()); Int3 lastPos = this.getLastPosition(ritualStone.getCustomRitualTag());
int j = y - 1; int j = pos.getY() - 1;
int i = 0; int i = 0;
int k = 0; int k = 0;
@ -132,13 +130,14 @@ public class RitualEffectMagnetic extends RitualEffect
{ {
while(k <= radius) while(k <= radius)
{ {
Block block = world.getBlock(x + i, j, z + k); BlockPos newPos = new BlockPos(pos.getX() + i, j, pos.getZ() + k);
int meta = world.getBlockMetadata(x + i, j, z + k); IBlockState state = world.getBlockState(newPos);
Block block = state.getBlock();
if (isBlockOre(block, meta)) if (isBlockOre(block, block.getMetaFromState(state)))
{ {
//Allow swapping code. This means the searched block is an ore. //Allow swapping code. This means the searched block is an ore.
BlockTeleposer.swapBlocks(this, world, world, x + i, j, z + k, xRep, yRep, zRep); BlockTeleposer.swapBlocks(this, world, world, newPos, posRep);
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()); SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
if (hasPotentia) if (hasPotentia)
@ -171,7 +170,7 @@ public class RitualEffectMagnetic extends RitualEffect
return; return;
} }
j = y - 1; j = pos.getY() - 1;
this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k)); this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k));
return; return;
} }

View file

@ -34,16 +34,16 @@ public class RitualEffectOmegaStalling extends RitualEffect
return; return;
} }
TileEntity tile = world.getTileEntity(x, y + 5, z); TileEntity tile = world.getTileEntity(pos.offsetUp(5));
if(tile instanceof TileEntityBeacon) if(tile instanceof TileEntityBeacon)
{ {
int levels = ((TileEntityBeacon) tile).getLevels(); int levels = ((TileEntityBeacon) tile).getField(0);
if(levels >= 4) if(levels >= 4)
{ {
int horizontalRadius = 100; int horizontalRadius = 100;
int verticalRadius = 100; int verticalRadius = 100;
List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(world, x + 0.5, y + 0.5, z + 0.5, horizontalRadius, verticalRadius); List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, horizontalRadius, verticalRadius);
for(EntityPlayer player : playerList) for(EntityPlayer player : playerList)
{ {

View file

@ -12,7 +12,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler; import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;

View file

@ -1,17 +1,17 @@
package WayofTime.alchemicalWizardry.common.rituals; package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardryEventHooks; import WayofTime.alchemicalWizardry.common.AlchemicalWizardryEventHooks;
import WayofTime.alchemicalWizardry.common.CoordAndRange; import WayofTime.alchemicalWizardry.common.CoordAndRange;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
public class RitualEffectSpawnWard extends RitualEffect public class RitualEffectSpawnWard extends RitualEffect
{ {
@ -39,34 +39,30 @@ public class RitualEffectSpawnWard extends RitualEffect
List<CoordAndRange> list = AlchemicalWizardryEventHooks.respawnMap.get(new Integer(dimension)); List<CoordAndRange> list = AlchemicalWizardryEventHooks.respawnMap.get(new Integer(dimension));
if (list != null) if (list != null)
{ {
if (!list.contains(new CoordAndRange(x, y, z, horizRange, vertRange))) if (!list.contains(new CoordAndRange(pos, horizRange, vertRange)))
{ {
boolean hasFoundAndRemoved = false;
for (CoordAndRange coords : list) for (CoordAndRange coords : list)
{ {
int xLocation = coords.xCoord; BlockPos locationPos = coords.getPos();
int yLocation = coords.yCoord;
int zLocation = coords.zCoord;
if (xLocation == x && yLocation == y && zLocation == z) if (locationPos.equals(pos))
{ {
list.remove(coords); list.remove(coords);
hasFoundAndRemoved = true;
break; break;
} }
} }
list.add(new CoordAndRange(x, y, z, horizRange, vertRange)); list.add(new CoordAndRange(pos, horizRange, vertRange));
} }
} else } else
{ {
list = new LinkedList(); list = new LinkedList();
list.add(new CoordAndRange(x, y, z, horizRange, vertRange)); list.add(new CoordAndRange(pos, horizRange, vertRange));
AlchemicalWizardryEventHooks.respawnMap.put(new Integer(dimension), list); AlchemicalWizardryEventHooks.respawnMap.put(new Integer(dimension), list);
} }
} else } else
{ {
List<CoordAndRange> list = new LinkedList(); List<CoordAndRange> list = new LinkedList();
list.add(new CoordAndRange(x, y, z, horizRange, vertRange)); list.add(new CoordAndRange(pos, horizRange, vertRange));
AlchemicalWizardryEventHooks.respawnMap.put(new Integer(dimension), list); AlchemicalWizardryEventHooks.respawnMap.put(new Integer(dimension), list);
} }