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

@ -3,7 +3,7 @@ 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.inventory.IInventory;
import net.minecraft.item.ItemBlock;
@ -13,6 +13,7 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
@ -32,7 +33,7 @@ public class RitualEffectEllipsoid extends RitualEffect
World world = ritualStone.getWorldObj();
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)
{
@ -61,7 +62,7 @@ public class RitualEffectEllipsoid extends RitualEffect
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
} else
{
tile = world.getTileEntity(x, y-1, z);
tile = world.getTileEntity(pos.offsetDown());
if(!(tile instanceof IInventory))
{
return;
@ -114,7 +115,7 @@ public class RitualEffectEllipsoid extends RitualEffect
while(j <= ySize)
{
if(y + j < 0)
if(pos.getY() + j < 0)
{
j++;
continue;
@ -143,36 +144,29 @@ public class RitualEffectEllipsoid extends RitualEffect
count--;
Block block = world.getBlock(x + i, y + j, z + k);
if (!block.isAir(world, x + i, y + j, z + k))
BlockPos newPos = pos.add(i, j, k);
if (!world.isAirBlock(newPos))
{
k++;
continue;
} else
{
//This is pulled from the ItemBlock's placing calls
int i1 = placedBlock.getMetadata(stack.getItemDamage());
int j1 = placedBlock.field_150939_a.onBlockPlaced(world, x + i, y + j, z + k, 0, 0, 0, 0, i1);
int newState = placedBlock.getMetadata(stack.getMetadata());
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;
if(stack.stackSize <= 0)
{
inv.setInventorySlotContents(slot, null);
}
this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k));
incrementNext = true;
SoulNetworkHandler.syphonFromNetwork(owner, cost);
}
// world.setBlock(x + i, y + j, z + k, Blocks.stone);
this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k));
incrementNext = true;
SoulNetworkHandler.syphonFromNetwork(owner, cost);
k++;
}
}