Finished almost all rituals.

This commit is contained in:
WayofTime 2015-07-29 14:26:37 -04:00
parent 1fbebc56a2
commit 86b753d098
18 changed files with 321 additions and 424 deletions

View file

@ -1,10 +1,8 @@
package WayofTime.alchemicalWizardry.common.rituals; package WayofTime.alchemicalWizardry.common.rituals;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; import java.util.ArrayList;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import java.util.List;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
@ -13,9 +11,11 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import java.util.ArrayList; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import java.util.List; import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
public class RitualEffectAnimalGrowth extends RitualEffect public class RitualEffectAnimalGrowth extends RitualEffect
{ {
@ -39,7 +39,7 @@ public class RitualEffectAnimalGrowth extends RitualEffect
double range = 2; double range = 2;
AxisAlignedBB axisalignedbb = new AxisAlignedBB((double) x, (double) y + 1, (double) z, (double) (x + 1), (double) (y + 3), (double) (z + 1)).expand(range, 0, range); AxisAlignedBB axisalignedbb = new AxisAlignedBB(pos.offsetUp(), pos.add(1, 3, 1)).expand(range, 0, range);
List<EntityAgeable> list = world.getEntitiesWithinAABB(EntityAgeable.class, axisalignedbb); List<EntityAgeable> list = world.getEntitiesWithinAABB(EntityAgeable.class, axisalignedbb);
int entityCount = 0; int entityCount = 0;
@ -79,14 +79,14 @@ public class RitualEffectAnimalGrowth extends RitualEffect
if (hasVirtus && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, breedingCost)) if (hasVirtus && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, breedingCost))
{ {
List<EntityAnimal> animalList = world.getEntitiesWithinAABB(EntityAnimal.class, axisalignedbb); List<EntityAnimal> animalList = world.getEntitiesWithinAABB(EntityAnimal.class, axisalignedbb);
TileEntity tile = world.getTileEntity(x, y + 1, z); TileEntity tile = world.getTileEntity(pos.offsetUp());
IInventory inventory = null; IInventory inventory = null;
if (tile instanceof IInventory) if (tile instanceof IInventory)
{ {
inventory = (IInventory) tile; inventory = (IInventory) tile;
} else } else
{ {
tile = world.getTileEntity(x, y - 1, z); tile = world.getTileEntity(pos.offsetDown());
if (tile instanceof IInventory) if (tile instanceof IInventory)
{ {
inventory = (IInventory) tile; inventory = (IInventory) tile;
@ -112,7 +112,7 @@ public class RitualEffectAnimalGrowth extends RitualEffect
if (stack != null && entityAnimal.isBreedingItem(stack)) if (stack != null && entityAnimal.isBreedingItem(stack))
{ {
inventory.decrStackSize(i, 1); inventory.decrStackSize(i, 1);
entityAnimal.func_146082_f(null); entityAnimal.setInLove(null);
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true); this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
SoulNetworkHandler.syphonFromNetwork(owner, breedingCost); SoulNetworkHandler.syphonFromNetwork(owner, breedingCost);
break; break;

View file

@ -8,8 +8,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 net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry; import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
@ -44,7 +44,7 @@ public class RitualEffectAutoAlchemy extends RitualEffect
int flag = 0; int flag = 0;
TileEntity topEntity = world.getTileEntity(x, y + 1, z); TileEntity topEntity = world.getTileEntity(pos.offsetUp());
if (!(topEntity instanceof IBloodAltar) || !(topEntity instanceof IBloodAltar)) if (!(topEntity instanceof IBloodAltar) || !(topEntity instanceof IBloodAltar))
{ {
return; return;
@ -65,10 +65,10 @@ public class RitualEffectAutoAlchemy extends RitualEffect
IInventory inputInv1 = null; IInventory inputInv1 = null;
IInventory inputInv2 = null; IInventory inputInv2 = null;
TileEntity northEntity = world.getTileEntity(x, y, z - 1); TileEntity northEntity = world.getTileEntity(pos.offsetNorth());
TileEntity southEntity = world.getTileEntity(x, y, z + 1); TileEntity southEntity = world.getTileEntity(pos.offsetSouth());
TileEntity eastEntity = world.getTileEntity(x + 1, y, z); TileEntity eastEntity = world.getTileEntity(pos.offsetEast());
TileEntity westEntity = world.getTileEntity(x - 1, y, z); TileEntity westEntity = world.getTileEntity(pos.offsetWest());
if (northEntity instanceof TEWritingTable) if (northEntity instanceof TEWritingTable)
{ {
@ -271,7 +271,7 @@ public class RitualEffectAutoAlchemy extends RitualEffect
continue; continue;
} }
if(!inputInv1.isItemValidForSlot(j, curItem) || (inputInv1 instanceof ISidedInventory && !((ISidedInventory) inputInv1).canExtractItem(j, curItem, ForgeDirection.DOWN.ordinal()))) if(!inputInv1.isItemValidForSlot(j, curItem) || (inputInv1 instanceof ISidedInventory && !((ISidedInventory) inputInv1).canExtractItem(j, curItem, EnumFacing.DOWN)))
{ {
continue; continue;
} }
@ -385,10 +385,11 @@ public class RitualEffectAutoAlchemy extends RitualEffect
if (flag > 0) if (flag > 0)
{ {
world.markBlockForUpdate(x, y, z + 1); for(EnumFacing face : EnumFacing.HORIZONTALS)
world.markBlockForUpdate(x, y, z - 1); {
world.markBlockForUpdate(x + 1, y, z); world.markBlockForUpdate(pos.offset(face));
world.markBlockForUpdate(x - 1, y, z); }
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * flag); SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * flag);
} }
} }

View file

@ -1,11 +1,9 @@
package WayofTime.alchemicalWizardry.common.rituals; package WayofTime.alchemicalWizardry.common.rituals;
import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRegistry; import java.util.ArrayList;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import java.util.Iterator;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import java.util.List;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -15,10 +13,12 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRegistry;
import java.util.ArrayList; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import java.util.Iterator; import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import java.util.List; import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectBinding extends RitualEffect public class RitualEffectBinding extends RitualEffect
{ {
@ -46,7 +46,7 @@ public class RitualEffectBinding extends RitualEffect
if (ritualStone.getVar1() == 0) if (ritualStone.getVar1() == 0)
{ {
int d0 = 0; int d0 = 0;
AxisAlignedBB axisalignedbb = new AxisAlignedBB((double) x, (double) y + 1, (double) z, (double) (x + 1), (double) (y + 2), (double) (z + 1)).expand(d0, d0, d0); AxisAlignedBB axisalignedbb = new AxisAlignedBB(pos.offsetUp(), pos.add(1, 2, 1)).expand(d0, d0, d0);
List list = world.getEntitiesWithinAABB(EntityItem.class, axisalignedbb); List list = world.getEntitiesWithinAABB(EntityItem.class, axisalignedbb);
Iterator iterator = list.iterator(); Iterator iterator = list.iterator();
EntityItem item; EntityItem item;
@ -66,7 +66,7 @@ public class RitualEffectBinding extends RitualEffect
{ {
ritualStone.setVar1(BindingRegistry.getIndexForItem(itemStack) + 1); ritualStone.setVar1(BindingRegistry.getIndexForItem(itemStack) + 1);
itemStack.stackSize--; itemStack.stackSize--;
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z)); world.addWeatherEffect(new EntityLightningBolt(world, pos.getX(), pos.getY() + 1, pos.getZ()));
ritualStone.setCooldown(ritualStone.getCooldown() - 1); ritualStone.setCooldown(ritualStone.getCooldown() - 1);
if(itemStack.stackSize <= 0) if(itemStack.stackSize <= 0)
{ {
@ -77,7 +77,7 @@ public class RitualEffectBinding extends RitualEffect
if (world.rand.nextInt(10) == 0) if (world.rand.nextInt(10) == 0)
{ {
SpellHelper.sendIndexedParticleToAllAround(world, x, y, z, 20, world.provider.getDimensionId(), 1, x, y, z); SpellHelper.sendIndexedParticleToAllAround(world, pos, 20, world.provider.getDimensionId(), 1, pos);
} }
} }
@ -90,40 +90,8 @@ public class RitualEffectBinding extends RitualEffect
{ {
int lightningPoint = world.rand.nextInt(8); int lightningPoint = world.rand.nextInt(8);
switch (lightningPoint) BlockPos newPos = getPositionForLightning(pos, lightningPoint);
{ world.addWeatherEffect(new EntityLightningBolt(world, newPos.getX(), newPos.getY(), newPos.getZ()));
case 0:
world.addWeatherEffect(new EntityLightningBolt(world, x + 4, y + 3, z + 0));
break;
case 1:
world.addWeatherEffect(new EntityLightningBolt(world, x - 4, y + 3, z + 0));
break;
case 2:
world.addWeatherEffect(new EntityLightningBolt(world, x + 0, y + 3, z + 4));
break;
case 3:
world.addWeatherEffect(new EntityLightningBolt(world, x + 0, y + 3, z - 4));
break;
case 4:
world.addWeatherEffect(new EntityLightningBolt(world, x + 3, y + 3, z + 3));
break;
case 5:
world.addWeatherEffect(new EntityLightningBolt(world, x - 3, y + 3, z + 3));
break;
case 6:
world.addWeatherEffect(new EntityLightningBolt(world, x + 3, y + 3, z - 3));
break;
case 7:
world.addWeatherEffect(new EntityLightningBolt(world, x - 3, y + 3, z - 3));
break;
}
} }
if (ritualStone.getCooldown() <= 0) if (ritualStone.getCooldown() <= 0)
@ -133,7 +101,7 @@ public class RitualEffectBinding extends RitualEffect
if (spawnedItem != null) if (spawnedItem != null)
{ {
EntityItem newItem = new EntityItem(world, x + 0.5, y + 1, z + 0.5, spawnedItem.copy()); EntityItem newItem = new EntityItem(world, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, spawnedItem.copy());
world.spawnEntityInWorld(newItem); world.spawnEntityInWorld(newItem);
} }
@ -143,6 +111,39 @@ public class RitualEffectBinding extends RitualEffect
} }
} }
public BlockPos getPositionForLightning(BlockPos pos, int lightning)
{
switch (lightning)
{
case 0:
return pos.add(4, 3, 0);
case 1:
return pos.add(-4, 3, 0);
case 2:
return pos.add(0, 3, 4);
case 3:
return pos.add(0, 3, -4);
case 4:
return pos.add(3, 3, 3);
case 5:
return pos.add(-3, 3, 3);
case 6:
return pos.add(-3, 3, -3);
case 7:
return pos.add(3, 3, -3);
default:
return pos.add(0, 3, 0);
}
}
@Override @Override
public int getCostPerRefresh() public int getCostPerRefresh()
{ {

View file

@ -1,13 +1,10 @@
package WayofTime.alchemicalWizardry.common.rituals; package WayofTime.alchemicalWizardry.common.rituals;
import WayofTime.alchemicalWizardry.ModBlocks; import java.util.ArrayList;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import java.util.List;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
@ -19,12 +16,17 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
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.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
import WayofTime.alchemicalWizardry.ModBlocks;
import java.util.ArrayList; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import java.util.List; import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth;
public class RitualEffectBiomeChanger extends RitualEffect public class RitualEffectBiomeChanger extends RitualEffect
{ {
@ -43,7 +45,7 @@ public class RitualEffectBiomeChanger extends RitualEffect
if (world.rand.nextInt(15) == 0) if (world.rand.nextInt(15) == 0)
{ {
world.addWeatherEffect(new EntityLightningBolt(world, x - 1 + world.rand.nextInt(3), y + 1, z - 1 + world.rand.nextInt(3))); world.addWeatherEffect(new EntityLightningBolt(world, pos.getX() - 1 + world.rand.nextInt(3), pos.getY() + 1, pos.getZ() - 1 + world.rand.nextInt(3)));
} }
return; return;
@ -89,48 +91,24 @@ public class RitualEffectBiomeChanger extends RitualEffect
{ {
if (boolList[i][j]) if (boolList[i][j])
{ {
if (i - 1 >= 0 && !boolList[i - 1][j]) BlockPos position = pos.add(i - range, 1, j - range);
{
Block block = world.getBlock(x - range + i - 1, y + 1, z - range + j);
for(EnumFacing face : EnumFacing.HORIZONTALS)
{
int iP = i + face.getFrontOffsetX();
int jP = j + face.getFrontOffsetY();
if(iP >= 0 && iP <= 2 * range && jP >= 0 && jP <= 2 * range && !boolList[iP][jP])
{
BlockPos newPos = position.add(face.getDirectionVec());
IBlockState state = world.getBlockState(newPos);
Block block = state.getBlock();
if (!ModBlocks.largeBloodStoneBrick.equals(block) && !ModBlocks.bloodStoneBrick.equals(block)) if (!ModBlocks.largeBloodStoneBrick.equals(block) && !ModBlocks.bloodStoneBrick.equals(block))
{ {
boolList[i - 1][j] = true; boolList[iP][jP] = true;
isReady = false; isReady = false;
} }
} }
if (j - 1 >= 0 && !boolList[i][j - 1])
{
Block block = world.getBlock(x - range + i, y + 1, z - range + j - 1);
if (!ModBlocks.largeBloodStoneBrick.equals(block) && !ModBlocks.bloodStoneBrick.equals(block))
{
boolList[i][j - 1] = true;
isReady = false;
}
}
if (i + 1 <= 2 * range && !boolList[i + 1][j])
{
Block block = world.getBlock(x - range + i + 1, y + 1, z - range + j);
if (!ModBlocks.largeBloodStoneBrick.equals(block) && !ModBlocks.bloodStoneBrick.equals(block))
{
boolList[i + 1][j] = true;
isReady = false;
}
}
if (j + 1 <= 2 * range && !boolList[i][j + 1])
{
Block block = world.getBlock(x - range + i, y + 1, z - range + j + 1);
if (!ModBlocks.largeBloodStoneBrick.equals(block) && !ModBlocks.bloodStoneBrick.equals(block))
{
boolList[i][j + 1] = true;
isReady = false;
}
} }
} }
} }
@ -151,7 +129,8 @@ public class RitualEffectBiomeChanger extends RitualEffect
} }
boolean isItemConsumed = false; boolean isItemConsumed = false;
TileEntity tileEntity = world.getTileEntity(x + i, y, z + j); BlockPos newPos = pos.add(i, 0, j);
TileEntity tileEntity = world.getTileEntity(newPos);
if (!(tileEntity instanceof TEPlinth)) if (!(tileEntity instanceof TEPlinth))
{ {
@ -169,7 +148,7 @@ public class RitualEffectBiomeChanger extends RitualEffect
{ {
if (itemTest instanceof ItemBlock) if (itemTest instanceof ItemBlock)
{ {
Block item = ((ItemBlock) itemTest).field_150939_a; Block item = ((ItemBlock) itemTest).getBlock();
if (item == (Blocks.sand)) if (item == (Blocks.sand))
{ {
humidity -= 0.1f; humidity -= 0.1f;
@ -230,8 +209,8 @@ public class RitualEffectBiomeChanger extends RitualEffect
if (isItemConsumed) if (isItemConsumed)
{ {
tilePlinth.setInventorySlotContents(0, null); tilePlinth.setInventorySlotContents(0, null);
world.markBlockForUpdate(x + i, y, z + j); world.markBlockForUpdate(newPos);
world.addWeatherEffect(new EntityLightningBolt(world, x + i, y + 1, z + j)); world.addWeatherEffect(new EntityLightningBolt(world, newPos.getX(), newPos.getY() + 1, newPos.getZ()));
} }
} }
} }
@ -269,10 +248,11 @@ public class RitualEffectBiomeChanger extends RitualEffect
{ {
if (boolList[i][j]) if (boolList[i][j])
{ {
Chunk chunk = world.getChunkFromBlockCoords(x - range + i, z - range + j); BlockPos newPos = pos.add(i - range, 0, j - range);
Chunk chunk = world.getChunkFromBlockCoords(newPos);
byte[] byteArray = chunk.getBiomeArray(); byte[] byteArray = chunk.getBiomeArray();
int moduX = (x - range + i) % 16; int moduX = (newPos.getX()) % 16;
int moduZ = (z - range + j) % 16; int moduZ = (newPos.getZ()) % 16;
if (moduX < 0) if (moduX < 0)
{ {

View file

@ -1,13 +1,8 @@
package WayofTime.alchemicalWizardry.common.rituals; package WayofTime.alchemicalWizardry.common.rituals;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import java.util.ArrayList;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; import java.util.List;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.ReflectionHelper;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityCreeper;
@ -15,9 +10,14 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import java.util.ArrayList; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import java.util.List; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectContainment extends RitualEffect public class RitualEffectContainment extends RitualEffect
{ {
@ -41,7 +41,7 @@ public class RitualEffectContainment extends RitualEffect
} else } else
{ {
int d0 = 5; int d0 = 5;
List<Entity> entityList = SpellHelper.getEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, d0, d0); List<Entity> entityList = SpellHelper.getEntitiesInRange(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, d0, d0);
boolean flag = false; boolean flag = false;
boolean hasCrepitous = this.canDrainReagent(ritualStone, ReagentRegistry.crepitousReagent, crepitousDrain, false); boolean hasCrepitous = this.canDrainReagent(ritualStone, ReagentRegistry.crepitousReagent, crepitousDrain, false);
boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false); boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
@ -62,9 +62,9 @@ public class RitualEffectContainment extends RitualEffect
} }
double xDif = livingEntity.posX - (x + 0.5); double xDif = livingEntity.posX - (pos.getX() + 0.5);
double yDif = livingEntity.posY - (y + 3); double yDif = livingEntity.posY - (pos.getY() + 3);
double zDif = livingEntity.posZ - (z + 0.5); double zDif = livingEntity.posZ - (pos.getZ() + 0.5);
livingEntity.motionX = -0.05 * xDif; livingEntity.motionX = -0.05 * xDif;
livingEntity.motionY = -0.05 * yDif; livingEntity.motionY = -0.05 * yDif;
livingEntity.motionZ = -0.05 * zDif; livingEntity.motionZ = -0.05 * zDif;

View file

@ -16,8 +16,8 @@ import net.minecraft.item.crafting.CraftingManager;
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.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.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
@ -92,8 +92,8 @@ public class RitualEffectCrafting extends RitualEffect
{ {
int gridSpace = (i+1)*3 + (j+1); int gridSpace = (i+1)*3 + (j+1);
Int3 pos = this.getSlotPositionForDirection(gridSpace, direction); Int3 position = this.getSlotPositionForDirection(gridSpace, direction);
TileEntity inv = world.getTileEntity(x + pos.xCoord, y + pos.yCoord, z + pos.zCoord); TileEntity inv = world.getTileEntity(pos.add(position.xCoord, position.yCoord, position.zCoord));
if(inv instanceof IInventory) if(inv instanceof IInventory)
{ {
if(((IInventory) inv).getSizeInventory() <= slotDesignation || !((IInventory) inv).isItemValidForSlot(slotDesignation, ((IInventory) inv).getStackInSlot(slotDesignation))) if(((IInventory) inv).getSizeInventory() <= slotDesignation || !((IInventory) inv).isItemValidForSlot(slotDesignation, ((IInventory) inv).getStackInSlot(slotDesignation)))
@ -133,10 +133,10 @@ public class RitualEffectCrafting extends RitualEffect
List<IInventory> invList = new ArrayList(); List<IInventory> invList = new ArrayList();
TileEntity northEntity = world.getTileEntity(x, y-1, z - 2); TileEntity northEntity = world.getTileEntity(pos.add(0, -1, -2));
TileEntity southEntity = world.getTileEntity(x, y-1, z + 2); TileEntity southEntity = world.getTileEntity(pos.add(0, -1, 2));
TileEntity eastEntity = world.getTileEntity(x + 2, y-1, z); TileEntity eastEntity = world.getTileEntity(pos.add(2, -1, 0));
TileEntity westEntity = world.getTileEntity(x - 2, y-1, z); TileEntity westEntity = world.getTileEntity(pos.add(-2, -1, 0));
switch(direction) switch(direction)
{ {
@ -239,7 +239,7 @@ public class RitualEffectCrafting extends RitualEffect
if (outputInv != null) if (outputInv != null)
{ {
if(!(!limitToSingleStack ? SpellHelper.canInsertStackFullyIntoInventory(returnStack, outputInv, ForgeDirection.DOWN) : SpellHelper.canInsertStackFullyIntoInventory(returnStack, outputInv, ForgeDirection.DOWN, true, returnStack.getMaxStackSize()))) if(!(!limitToSingleStack ? SpellHelper.canInsertStackFullyIntoInventory(returnStack, outputInv, EnumFacing.DOWN) : SpellHelper.canInsertStackFullyIntoInventory(returnStack, outputInv, EnumFacing.DOWN, true, returnStack.getMaxStackSize())))
{ {
tag.setBoolean("didLastCraftFail", true); tag.setBoolean("didLastCraftFail", true);
return; return;
@ -331,7 +331,7 @@ public class RitualEffectCrafting extends RitualEffect
/* The recipe is valid and the items have been found */ /* The recipe is valid and the items have been found */
SpellHelper.insertStackIntoInventory(CraftingManager.getInstance().findMatchingRecipe(inventory, world), outputInv, ForgeDirection.DOWN); SpellHelper.insertStackIntoInventory(CraftingManager.getInstance().findMatchingRecipe(inventory, world), outputInv, EnumFacing.DOWN);
for(Entry<Integer, Map<Integer, Integer>> entry1 : syphonMap.entrySet()) for(Entry<Integer, Map<Integer, Integer>> entry1 : syphonMap.entrySet())
{ {
@ -366,10 +366,10 @@ public class RitualEffectCrafting extends RitualEffect
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true); this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
} }
world.markBlockForUpdate(x, y-1, z + 2); world.markBlockForUpdate(pos.add(0, 1, 2));
world.markBlockForUpdate(x, y-1, z - 2); world.markBlockForUpdate(pos.add(0, 1, -2));
world.markBlockForUpdate(x + 2, y-1, z); world.markBlockForUpdate(pos.add(2, 1, 0));
world.markBlockForUpdate(x - 2, y-1, z); world.markBlockForUpdate(pos.add(-2, 1, 0));
// long endTime = System.nanoTime(); // long endTime = System.nanoTime();
// //

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
@ -12,8 +13,8 @@ import net.minecraft.item.ItemBlock;
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.ModBlocks; import WayofTime.alchemicalWizardry.ModBlocks;
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;
@ -44,7 +45,7 @@ public class RitualEffectCrushing extends RitualEffect
return; return;
} }
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)
@ -107,30 +108,32 @@ public class RitualEffectCrushing extends RitualEffect
{ {
for (int k = -1; k <= 1; k++) for (int k = -1; k <= 1; k++)
{ {
Block block = world.getBlock(x + i, y + j, z + k); BlockPos newPos = pos.add(i, j, k);
int meta = world.getBlockMetadata(x + i, y + j, z + k); IBlockState state = world.getBlockState(newPos);
if(block.getBlockHardness(world, x + i, y + j, z + k) == -1) Block block = state.getBlock();
if(block.getBlockHardness(world, newPos) == -1)
{ {
continue; continue;
} }
if (block != null && !world.isAirBlock(x + i, y + j, z + k)) if (block != null && !world.isAirBlock(newPos))
{ {
if ((block.equals(ModBlocks.ritualStone) || block.equals(ModBlocks.blockMasterStone)) || SpellHelper.isBlockFluid(block)) if ((block.equals(ModBlocks.ritualStone) || block.equals(ModBlocks.blockMasterStone)) || SpellHelper.isBlockFluid(block))
{ {
continue; continue;
} }
if (isSilkTouch && block.canSilkHarvest(world, null, x + i, y + j, z + k, meta)) if (isSilkTouch && block.canSilkHarvest(world, newPos, state, null))
{ {
ItemStack item = new ItemStack(block, 1, meta); ItemStack item = new ItemStack(block, 1, block.getMetaFromState(state));
ItemStack copyStack = item.copyItemStack(item); ItemStack copyStack = item.copyItemStack(item);
SpellHelper.insertStackIntoInventory(copyStack, tileEntity, ForgeDirection.DOWN); SpellHelper.insertStackIntoInventory(copyStack, tileEntity, EnumFacing.DOWN);
if (copyStack.stackSize > 0) if (copyStack.stackSize > 0)
{ {
world.spawnEntityInWorld(new EntityItem(world, x + 0.4, y + 2, z + 0.5, copyStack)); world.spawnEntityInWorld(new EntityItem(world, pos.getX() + 0.5, pos.getY() + 2, pos.getZ() + 0.5, copyStack));
} }
if (hasCrystallos) if (hasCrystallos)
@ -139,7 +142,7 @@ public class RitualEffectCrushing extends RitualEffect
} }
} else } else
{ {
ArrayList<ItemStack> itemDropList = block.getDrops(world, x + i, y + j, z + k, meta, fortuneLevel); List<ItemStack> itemDropList = block.getDrops(world, newPos, state, fortuneLevel);
if (itemDropList != null) if (itemDropList != null)
{ {
@ -156,10 +159,10 @@ public class RitualEffectCrushing extends RitualEffect
this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, incendiumDrain, true); this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, incendiumDrain, true);
} }
SpellHelper.insertStackIntoInventory(copyStack, tileEntity, ForgeDirection.DOWN); SpellHelper.insertStackIntoInventory(copyStack, tileEntity, EnumFacing.DOWN);
if (copyStack.stackSize > 0) if (copyStack.stackSize > 0)
{ {
world.spawnEntityInWorld(new EntityItem(world, x + 0.4, y + 2, z + 0.5, copyStack)); world.spawnEntityInWorld(new EntityItem(world, pos.getX() + 0.5, pos.getY() + 2, pos.getZ() + 0.5, copyStack));
} }
} }
@ -177,8 +180,8 @@ public class RitualEffectCrushing extends RitualEffect
} }
} }
} }
world.setBlockToAir(x + i, y + j, z + k); world.setBlockToAir(newPos);
world.playSoundEffect(x + i, y + j, z + k, "mob.endermen.portal", 1.0F, 1.0F); world.playSoundEffect(newPos.getX(), newPos.getY(), newPos.getZ(), "mob.endermen.portal", 1.0F, 1.0F);
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()); SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
@ -197,7 +200,7 @@ public class RitualEffectCrushing extends RitualEffect
Item item = stack.getItem(); Item item = stack.getItem();
if (item instanceof ItemBlock) if (item instanceof ItemBlock)
{ {
Block block = ((ItemBlock) item).field_150939_a; Block block = ((ItemBlock) item).getBlock();
if (block == Blocks.cobblestone || block == Blocks.stone) if (block == Blocks.cobblestone || block == Blocks.stone)
{ {
@ -221,7 +224,7 @@ public class RitualEffectCrushing extends RitualEffect
Item item = stack.getItem(); Item item = stack.getItem();
if (item instanceof ItemBlock) if (item instanceof ItemBlock)
{ {
Block block = ((ItemBlock) item).field_150939_a; Block block = ((ItemBlock) item).getBlock();
if (hasIncendium) if (hasIncendium)
{ {
@ -240,65 +243,6 @@ public class RitualEffectCrushing extends RitualEffect
return stack; return stack;
} }
public boolean isSilkTouch(World world, int x, int y, int z)
{
int index = 0;
for (int i = -2; i <= 2; i++)
{
for (int j = -2; j <= 2; j++)
{
int index1 = Math.abs(i);
int index2 = Math.abs(j);
if ((index1 == 2 && (index2 == 2 || index2 == 1)) || (index1 == 1 && index2 == 2))
{
Block block = world.getBlock(x + i, y + 1, z + j);
if (block == Blocks.gold_block)
{
index++;
}
}
}
}
return index >= 12;
}
public int getFortuneLevel(World world, int x, int y, int z)
{
int index = 0;
for (int i = -2; i <= 2; i++)
{
for (int j = -2; j <= 2; j++)
{
int index1 = Math.abs(i);
int index2 = Math.abs(j);
if ((index1 == 2 && (index2 == 2 || index2 == 1)) || (index1 == 1 && index2 == 2))
{
Block block = world.getBlock(x + i, y + 1, z + j);
if (block == Blocks.emerald_block || block == Blocks.diamond_block)
{
index++;
}
}
}
}
if (index >= 12)
{
return 3;
} else if (index >= 8)
{
return 2;
} else if (index >= 4)
{
return 1;
}
return 0;
}
@Override @Override
public int getCostPerRefresh() public int getCostPerRefresh()
{ {

View file

@ -67,7 +67,7 @@ public class RitualEffectDemonPortal extends RitualEffect
{ {
if(rand.nextInt(10) == 0) if(rand.nextInt(10) == 0)
{ {
this.createRandomLightning(world, x, y, z); this.createRandomLightning(world, pos.getX(), pos.getY(), pos.getZ());
} }
reagentAmount += drainAmount; reagentAmount += drainAmount;
@ -81,9 +81,9 @@ public class RitualEffectDemonPortal extends RitualEffect
if(reagentsFulfilled && checkCreatePortal(ritualStone)) if(reagentsFulfilled && checkCreatePortal(ritualStone))
{ {
world.setBlock(x, y+1, z, ModBlocks.blockDemonPortal); world.setBlockState(pos.offsetUp(), ModBlocks.blockDemonPortal.getDefaultState());
TEDemonPortal portal = (TEDemonPortal) world.getTileEntity(x, y + 1, z); TEDemonPortal portal = (TEDemonPortal) world.getTileEntity(pos.offsetUp());
portal.start(); portal.start();
ritualStone.setActive(false); ritualStone.setActive(false);
@ -95,11 +95,12 @@ public class RitualEffectDemonPortal extends RitualEffect
public boolean checkCreatePortal(IMasterRitualStone ritualStone) public boolean checkCreatePortal(IMasterRitualStone ritualStone)
{ {
TileEntity entity = ritualStone.getWorld().getTileEntity(ritualStone.getXCoord(), ritualStone.getYCoord() + 1, ritualStone.getZCoord()); BlockPos pos = ritualStone.getPosition();
TileEntity entity = ritualStone.getWorldObj().getTileEntity(pos.offsetUp());
if(entity instanceof IBloodAltar) if(entity instanceof IBloodAltar)
{ {
IBloodAltar altar = (IBloodAltar)entity; IBloodAltar altar = (IBloodAltar)entity;
if(altar.hasDemonBlood() && ritualStone.getWorld().isAirBlock(ritualStone.getXCoord(), ritualStone.getYCoord() + 2, ritualStone.getZCoord())) if(altar.hasDemonBlood() && ritualStone.getWorldObj().isAirBlock(pos.offsetUp(2)))
{ {
return true; return true;
} }
@ -131,13 +132,11 @@ public class RitualEffectDemonPortal extends RitualEffect
public boolean checkJars(IMasterRitualStone ritualStone) public boolean checkJars(IMasterRitualStone ritualStone)
{ {
int x = ritualStone.getXCoord(); BlockPos position = ritualStone.getPosition();
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
for(Int3 pos : jarLocations) for(Int3 pos : jarLocations)
{ {
if(!(ritualStone.getWorld().getTileEntity(x + pos.xCoord, y + pos.yCoord, z + pos.zCoord) instanceof TEBellJar)) if(!(ritualStone.getWorldObj().getTileEntity(position.add(pos.xCoord, pos.yCoord, pos.zCoord)) instanceof TEBellJar))
{ {
return false; return false;
} }

View file

@ -3,7 +3,7 @@ package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
@ -13,6 +13,7 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
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 WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
@ -32,7 +33,7 @@ public class RitualEffectEllipsoid 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());
if (!(tile instanceof IInventory) || ((IInventory) tile).getSizeInventory() < 3) if (!(tile instanceof IInventory) || ((IInventory) tile).getSizeInventory() < 3)
{ {
@ -61,7 +62,7 @@ public class RitualEffectEllipsoid extends RitualEffect
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80)); entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
} else } else
{ {
tile = world.getTileEntity(x, y-1, z); tile = world.getTileEntity(pos.offsetDown());
if(!(tile instanceof IInventory)) if(!(tile instanceof IInventory))
{ {
return; return;
@ -114,7 +115,7 @@ public class RitualEffectEllipsoid extends RitualEffect
while(j <= ySize) while(j <= ySize)
{ {
if(y + j < 0) if(pos.getY() + j < 0)
{ {
j++; j++;
continue; continue;
@ -143,25 +144,22 @@ public class RitualEffectEllipsoid extends RitualEffect
count--; count--;
Block block = world.getBlock(x + i, y + j, z + k); BlockPos newPos = pos.add(i, j, k);
if (!block.isAir(world, x + i, y + j, z + k)) if (!world.isAirBlock(newPos))
{ {
k++; k++;
continue; continue;
} else } else
{ {
//This is pulled from the ItemBlock's placing calls //This is pulled from the ItemBlock's placing calls
int i1 = placedBlock.getMetadata(stack.getItemDamage()); int newState = placedBlock.getMetadata(stack.getMetadata());
int j1 = placedBlock.field_150939_a.onBlockPlaced(world, x + i, y + j, z + k, 0, 0, 0, 0, i1); IBlockState iblockstate1 = placedBlock.block.onBlockPlaced(world, newPos, EnumFacing.UP, 0, 0, 0, newState, null);
if (placedBlock.placeBlockAt(stack, null, world, x + i, y + j, z + k, 0, 0, 0, 0, j1)) if (placedBlock.placeBlockAt(stack, null, world, pos, EnumFacing.UP, 0, 0, 0, iblockstate1))
{ {
world.playSoundEffect((double)(x + i + 0.5F), (double)(y + j + 0.5F), (double)(z + k + 0.5F), placedBlock.field_150939_a.stepSound.func_150496_b(), (placedBlock.field_150939_a.stepSound.getVolume() + 1.0F) / 2.0F, placedBlock.field_150939_a.stepSound.getPitch() * 0.8F); world.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), placedBlock.block.stepSound.getPlaceSound(), (placedBlock.block.stepSound.getVolume() + 1.0F) / 2.0F, placedBlock.block.stepSound.getFrequency() * 0.8F);
--stack.stackSize; --stack.stackSize;
if(stack.stackSize <= 0)
{
inv.setInventorySlotContents(slot, null);
} }
this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k)); this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k));
@ -169,10 +167,6 @@ public class RitualEffectEllipsoid extends RitualEffect
incrementNext = true; incrementNext = true;
SoulNetworkHandler.syphonFromNetwork(owner, cost); SoulNetworkHandler.syphonFromNetwork(owner, cost);
}
// world.setBlock(x + i, y + j, z + k, Blocks.stone);
k++; k++;
} }
} }

View file

@ -1,21 +1,23 @@
package WayofTime.alchemicalWizardry.common.rituals; package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.ModBlocks; import WayofTime.alchemicalWizardry.ModBlocks;
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.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectEvaporation extends RitualEffect public class RitualEffectEvaporation extends RitualEffect
{ {
@ -40,7 +42,8 @@ public class RitualEffectEvaporation extends RitualEffect
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80)); entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
} else } else
{ {
Block block1 = world.getBlock(x, y - 1, z); IBlockState state1 = world.getBlockState(pos.offsetDown());
Block block1 = state1.getBlock();
int range = this.getRadiusForModifierBlock(block1); int range = this.getRadiusForModifierBlock(block1);
boolean[][][] boolList = new boolean[range * 2 + 1][range * 2 + 1][range * 2 + 1]; boolean[][][] boolList = new boolean[range * 2 + 1][range * 2 + 1][range * 2 + 1];
@ -71,64 +74,25 @@ public class RitualEffectEvaporation extends RitualEffect
{ {
if (boolList[i][j][k]) if (boolList[i][j][k])
{ {
if (i - 1 >= 0 && !boolList[i - 1][j][k]) BlockPos position = pos.add(i - range, j - range, k - range);
{
Block block = world.getBlock(x - range + i - 1, y - range + j, z - range + k);
if (world.isAirBlock(x - range + i - 1, y - range + j, z - range + k) || block == ModBlocks.blockSpectralContainer)
{
boolList[i - 1][j][k] = true;
isReady = false;
}
}
if (j - 1 >= 0 && !boolList[i][j - 1][k]) for(EnumFacing face : EnumFacing.VALUES)
{ {
Block block = world.getBlock(x - range + i, y - range + j - 1, z - range + k); int iP = i + face.getFrontOffsetX();
if (world.isAirBlock(x - range + i, y - range + j - 1, z - range + k) || block == ModBlocks.blockSpectralContainer) int jP = j + face.getFrontOffsetY();
{ int kP = k + face.getFrontOffsetZ();
boolList[i][j - 1][k] = true;
isReady = false;
}
}
if (k - 1 >= 0 && !boolList[i][j][k - 1]) if(iP >= 0 && iP <= 2 * range && jP >= 0 && jP <= 2 * range && kP >= 0 && kP <= 2 * range && !boolList[iP][jP][kP])
{ {
Block block = world.getBlock(x - range + i, y - range + j, z - range + k - 1); BlockPos newPos = position.add(face.getDirectionVec());
if (world.isAirBlock(x - range + i, y - range + j, z - range + k - 1) || block == ModBlocks.blockSpectralContainer) IBlockState state = world.getBlockState(newPos);
Block block = state.getBlock();
if (world.isAirBlock(newPos) || block == ModBlocks.blockSpectralContainer)
{ {
boolList[i][j][k - 1] = true; boolList[iP][jP][kP] = true;
isReady = false; isReady = false;
} }
} }
if (i + 1 <= 2 * range && !boolList[i + 1][j][k])
{
Block block = world.getBlock(x - range + i + 1, y - range + j, z - range + k);
if (world.isAirBlock(x - range + i + 1, y - range + j, z - range + k) || block == ModBlocks.blockSpectralContainer)
{
boolList[i + 1][j][k] = true;
isReady = false;
}
}
if (j + 1 <= 2 * range && !boolList[i][j + 1][k])
{
Block block = world.getBlock(x - range + i, y - range + j + 1, z - range + k);
if (world.isAirBlock(x - range + i, y - range + j + 1, z - range + k) || block == ModBlocks.blockSpectralContainer)
{
boolList[i][j + 1][k] = true;
isReady = false;
}
}
if (k + 1 <= 2 * range && !boolList[i][j][k + 1])
{
Block block = world.getBlock(x - range + i, y - range + j, z - range + k + 1);
if (world.isAirBlock(x - range + i, y - range + j, z - range + k + 1) || block == ModBlocks.blockSpectralContainer)
{
boolList[i][j][k + 1] = true;
isReady = false;
}
} }
} }
} }
@ -147,11 +111,13 @@ public class RitualEffectEvaporation extends RitualEffect
continue; continue;
} }
Block block = world.getBlock(x + i - range, y + j - range, z + k - range); BlockPos newPos = pos.add(i - range, j - range, k - range);
IBlockState state = world.getBlockState(newPos);
Block block = state.getBlock();
if (block == ModBlocks.blockSpectralContainer) if (block == ModBlocks.blockSpectralContainer)
{ {
world.setBlockToAir(x + i - range, y + j - range, z + k - range); world.setBlockToAir(newPos);
} }
} }
} }

View file

@ -1,5 +1,24 @@
package WayofTime.alchemicalWizardry.common.rituals; package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
@ -9,23 +28,6 @@ import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.simple.SpellTeleport; import WayofTime.alchemicalWizardry.common.spell.simple.SpellTeleport;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class RitualEffectExpulsion extends RitualEffect public class RitualEffectExpulsion extends RitualEffect
{ {
@ -52,10 +54,10 @@ public class RitualEffectExpulsion extends RitualEffect
int teleportDistance = hasVirtus ? 300 : 100; int teleportDistance = hasVirtus ? 300 : 100;
int range = hasPotentia ? 50 : 25; int range = hasPotentia ? 50 : 25;
List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range); List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, range, range);
boolean flag = false; boolean flag = false;
TileEntity tile = world.getTileEntity(x, y + 1, z); TileEntity tile = world.getTileEntity(pos.offsetUp());
IInventory inventoryTile = null; IInventory inventoryTile = null;
if (tile instanceof IInventory) if (tile instanceof IInventory)
{ {
@ -116,7 +118,7 @@ public class RitualEffectExpulsion extends RitualEffect
int teleportDistance = hasVirtus ? 300 : 100; int teleportDistance = hasVirtus ? 300 : 100;
int range = hasPotentia ? 50 : 25; int range = hasPotentia ? 50 : 25;
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);
boolean flag = false; boolean flag = false;
for (EntityLivingBase livingEntity : livingList) for (EntityLivingBase livingEntity : livingList)
@ -195,18 +197,22 @@ public class RitualEffectExpulsion extends RitualEffect
double d5 = lastZ; double d5 = lastZ;
SpellTeleport.moveEntityViaTeleport(entityLiving, event.targetX, event.targetY, event.targetZ); SpellTeleport.moveEntityViaTeleport(entityLiving, event.targetX, event.targetY, event.targetZ);
boolean flag = false; boolean flag = false;
int i = MathHelper.floor_double(entityLiving.posX); int i = MathHelper.floor_double(entityLiving.posX);
int j = MathHelper.floor_double(entityLiving.posY); int j = MathHelper.floor_double(entityLiving.posY);
int k = MathHelper.floor_double(entityLiving.posZ); int k = MathHelper.floor_double(entityLiving.posZ);
int l; int l;
if (entityLiving.worldObj.blockExists(i, j, k)) // if (entityLiving.worldObj.blockExists(i, j, k))
{ {
boolean flag1 = false; boolean flag1 = false;
while (!flag1 && j > 0) while (!flag1 && j > 0)
{ {
Block block = entityLiving.worldObj.getBlock(i, j - 1, k); BlockPos newPos = new BlockPos(i, j - 1, k);
IBlockState state = entityLiving.worldObj.getBlockState(newPos);
Block block = state.getBlock();
if (block != null && block.getMaterial().blocksMovement()) if (block != null && block.getMaterial().blocksMovement())
{ {
@ -222,7 +228,7 @@ public class RitualEffectExpulsion extends RitualEffect
{ {
SpellTeleport.moveEntityViaTeleport(entityLiving, entityLiving.posX, entityLiving.posY, entityLiving.posZ); SpellTeleport.moveEntityViaTeleport(entityLiving, entityLiving.posX, entityLiving.posY, entityLiving.posZ);
if (entityLiving.worldObj.getCollidingBoundingBoxes(entityLiving, entityLiving.boundingBox).isEmpty() && !entityLiving.worldObj.isAnyLiquid(entityLiving.boundingBox)) if (entityLiving.worldObj.getCollidingBoundingBoxes(entityLiving, entityLiving.getBoundingBox()).isEmpty() && !entityLiving.worldObj.isAnyLiquid(entityLiving.getBoundingBox()))
{ {
flag = true; flag = true;
} }
@ -246,7 +252,7 @@ public class RitualEffectExpulsion extends RitualEffect
double d7 = d3 + (entityLiving.posX - d3) * d6 + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D; double d7 = d3 + (entityLiving.posX - d3) * d6 + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D;
double d8 = d4 + (entityLiving.posY - d4) * d6 + entityLiving.worldObj.rand.nextDouble() * (double) entityLiving.height; double d8 = d4 + (entityLiving.posY - d4) * d6 + entityLiving.worldObj.rand.nextDouble() * (double) entityLiving.height;
double d9 = d5 + (entityLiving.posZ - d5) * d6 + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D; double d9 = d5 + (entityLiving.posZ - d5) * d6 + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D;
entityLiving.worldObj.spawnParticle("portal", d7, d8, d9, (double) f, (double) f1, (double) f2); entityLiving.worldObj.spawnParticle(EnumParticleTypes.PORTAL, d7, d8, d9, (double) f, (double) f1, (double) f2);
} }
return true; return true;
} }

View file

@ -1,18 +1,18 @@
package WayofTime.alchemicalWizardry.common.rituals; package WayofTime.alchemicalWizardry.common.rituals;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; import java.util.ArrayList;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import java.util.List;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import java.util.ArrayList; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import java.util.List; import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
public class RitualEffectFeatheredEarth extends RitualEffect //Nullifies all fall damage in the area of effect public class RitualEffectFeatheredEarth extends RitualEffect //Nullifies all fall damage in the area of effect
{ {
@ -33,6 +33,10 @@ public class RitualEffectFeatheredEarth extends RitualEffect //Nullifies all fal
if (ritualStone.getCooldown() > 0) if (ritualStone.getCooldown() > 0)
{ {
int x = pos.getX();
int y = pos.getY();
int z = pos.getZ();
world.addWeatherEffect(new EntityLightningBolt(world, x + 4, y + 5, z + 4)); world.addWeatherEffect(new EntityLightningBolt(world, x + 4, y + 5, z + 4));
world.addWeatherEffect(new EntityLightningBolt(world, x + 4, y + 5, z - 4)); world.addWeatherEffect(new EntityLightningBolt(world, x + 4, y + 5, z - 4));
world.addWeatherEffect(new EntityLightningBolt(world, x - 4, y + 5, z - 4)); world.addWeatherEffect(new EntityLightningBolt(world, x - 4, y + 5, z - 4));
@ -46,14 +50,11 @@ public class RitualEffectFeatheredEarth extends RitualEffect //Nullifies all fal
int range = this.getHorizontalRangeForReagent(hasTerrae, hasOrbisTerrae); int range = this.getHorizontalRangeForReagent(hasTerrae, hasOrbisTerrae);
int verticalRange = hasAether ? 60 : 30; int verticalRange = hasAether ? 60 : 30;
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(x, y, z, x + 1, y + 1, z + 1).expand(range, verticalRange, range)); List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)).expand(range, verticalRange, range));
int entityCount = 0; int entityCount = 0;
boolean flag = false; boolean flag = false;
for (EntityLivingBase entity : entities) entityCount += entities.size();
{
entityCount++;
}
if (currentEssence < this.getCostPerRefresh() * entityCount) if (currentEssence < this.getCostPerRefresh() * entityCount)
{ {

View file

@ -50,9 +50,10 @@ public class RitualEffectFeatheredKnife 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, k, j);
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;
} }
} }
@ -68,10 +69,9 @@ public class RitualEffectFeatheredKnife extends RitualEffect
double range = hasReductus ? 8 : 15; double range = hasReductus ? 8 : 15;
double vertRange = hasReductus ? 8 : 20; double vertRange = hasReductus ? 8 : 20;
List<EntityPlayer> list = SpellHelper.getPlayersInRange(world, x + 0.5, y + 0.5, z + 0.5, range, vertRange); List<EntityPlayer> list = SpellHelper.getPlayersInRange(world, pos.getX(), pos.getY(), pos.getZ(), range, vertRange);
int entityCount = 0; int entityCount = 0;
boolean flag = false;
if (currentEssence < this.getCostPerRefresh() * list.size()) if (currentEssence < this.getCostPerRefresh() * list.size())
{ {

View file

@ -32,10 +32,10 @@ public class RitualEffectFlight extends RitualEffect
BlockPos pos = ritualStone.getPosition(); BlockPos pos = ritualStone.getPosition();
int range = 20; int range = 20;
int verticalRange = 30; int verticalRange = 70;
AxisAlignedBB axis = new AxisAlignedBB(x, y, z, x + 1, y + 1, z + 1).expand(range, verticalRange, range); AxisAlignedBB axis = new AxisAlignedBB(pos, pos.add(1, 1, 1)).expand(range, verticalRange, range);
axis.maxY = 256; // axis.maxY = 256;
axis.minY = 0; // axis.minY = 0;
List<EntityPlayer> entities = world.getEntitiesWithinAABB(EntityPlayer.class, axis); List<EntityPlayer> entities = world.getEntitiesWithinAABB(EntityPlayer.class, axis);
int entityCount = 0; int entityCount = 0;

View file

@ -38,7 +38,7 @@ public class RitualEffectFullStomach extends RitualEffect
double horizRange = 16; double horizRange = 16;
double vertRange = 16; double vertRange = 16;
List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(world, x + 0.5, y + 0.5, z + 0.5, horizRange, vertRange); List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, horizRange, vertRange);
if (playerList == null) if (playerList == null)
{ {
@ -50,14 +50,14 @@ public class RitualEffectFullStomach extends RitualEffect
SoulNetworkHandler.causeNauseaToPlayer(owner); SoulNetworkHandler.causeNauseaToPlayer(owner);
} else } else
{ {
TileEntity tile = world.getTileEntity(x, y + 1, z); TileEntity tile = world.getTileEntity(pos.offsetUp());
IInventory inventory = null; IInventory inventory = null;
if (tile instanceof IInventory) if (tile instanceof IInventory)
{ {
inventory = (IInventory) tile; inventory = (IInventory) tile;
} else } else
{ {
tile = world.getTileEntity(x, y - 1, z); tile = world.getTileEntity(pos.offsetDown());
if (tile instanceof IInventory) if (tile instanceof IInventory)
{ {
inventory = (IInventory) tile; inventory = (IInventory) tile;
@ -81,8 +81,8 @@ public class RitualEffectFullStomach extends RitualEffect
{ {
ItemFood foodItem = (ItemFood) stack.getItem(); ItemFood foodItem = (ItemFood) stack.getItem();
int regularHeal = foodItem.func_150905_g(stack); int regularHeal = foodItem.getHealAmount(stack);
float saturatedHeal = foodItem.func_150906_h(stack) * regularHeal * 2.0f; float saturatedHeal = foodItem.getSaturationModifier(stack) * regularHeal * 2.0f;
if (saturatedHeal + satLevel <= 20) if (saturatedHeal + satLevel <= 20)
{ {

View file

@ -1,19 +1,20 @@
package WayofTime.alchemicalWizardry.common.rituals; package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.IGrowable;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
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;
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.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.block.Block;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import net.minecraft.block.IGrowable;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectGrowth extends RitualEffect public class RitualEffectGrowth extends RitualEffect
{ {
@ -55,7 +56,8 @@ public class RitualEffectGrowth extends RitualEffect
{ {
if (this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false)) if (this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false))
{ {
if (SpellHelper.hydrateSoil(world, x + i, y + 1, z + j)) BlockPos newPos = pos.add(i, 1, j);
if (SpellHelper.hydrateSoil(world, newPos))
{ {
this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, true); this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, true);
} }
@ -71,13 +73,15 @@ public class RitualEffectGrowth extends RitualEffect
{ {
for (int j = -range; j <= range; j++) for (int j = -range; j <= range; j++)
{ {
Block block = world.getBlock(x + i, y + 2, z + j); BlockPos newPos = pos.add(i, 2, j);
IBlockState state = world.getBlockState(newPos);
Block block = state.getBlock();
if (block instanceof IPlantable || block instanceof IGrowable) if (block instanceof IPlantable || block instanceof IGrowable)
{ {
{ {
SpellHelper.sendIndexedParticleToAllAround(world, x, y, z, 20, world.provider.getDimensionId(), 3, x, y, z); SpellHelper.sendIndexedParticleToAllAround(world, pos, 20, world.provider.getDimensionId(), 3, pos);
block.updateTick(world, x + i, y + 2, z + j, world.rand); block.updateTick(world, newPos, state, world.rand);
flag++; flag++;
} }
} }

View file

@ -1,21 +1,22 @@
package WayofTime.alchemicalWizardry.common.rituals; package WayofTime.alchemicalWizardry.common.rituals;
import WayofTime.alchemicalWizardry.api.harvest.HarvestRegistry; import java.util.ArrayList;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import java.util.List;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.potion.Potion; import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.harvest.HarvestRegistry;
import java.util.ArrayList; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import java.util.List; import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectHarvest extends RitualEffect public class RitualEffectHarvest extends RitualEffect
{ {
@ -47,7 +48,8 @@ public class RitualEffectHarvest extends RitualEffect
return; return;
} }
Block block = world.getBlock(x, y - 1, z); IBlockState state = world.getBlockState(pos.offsetDown());
Block block = state.getBlock();
int flag = 0; int flag = 0;
int range = this.getRadiusForModifierBlock(block); int range = this.getRadiusForModifierBlock(block);
int vertRange = 4; int vertRange = 4;
@ -58,7 +60,7 @@ public class RitualEffectHarvest extends RitualEffect
{ {
for (int k = -range; k <= range; k++) for (int k = -range; k <= range; k++)
{ {
if (HarvestRegistry.harvestBlock(world, x + i, y + j, z + k) && flag < maxCount) if (HarvestRegistry.harvestBlock(world, pos.add(i, j, k)) && flag < maxCount)
{ {
flag++; flag++;
} }

View file

@ -1,20 +1,20 @@
package WayofTime.alchemicalWizardry.common.rituals; package WayofTime.alchemicalWizardry.common.rituals;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; import java.util.ArrayList;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import java.util.List;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion; import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import java.util.ArrayList; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import java.util.List; import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectHealing extends RitualEffect public class RitualEffectHealing extends RitualEffect
{ {
@ -43,9 +43,8 @@ public class RitualEffectHealing extends RitualEffect
int range = 15 * (hasPraesidium ? 3 : 1); int range = 15 * (hasPraesidium ? 3 : 1);
int vertRange = 15 * (hasPraesidium ? 3 : 1); int vertRange = 15 * (hasPraesidium ? 3 : 1);
List<EntityLivingBase> list = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, vertRange); List<EntityLivingBase> list = SpellHelper.getLivingEntitiesInRange(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, range, vertRange);
int entityCount = 0; int entityCount = 0;
boolean flag = false;
for (EntityLivingBase livingEntity : list) for (EntityLivingBase livingEntity : list)
{ {