Changed the Meteor paradigm to POTENTIALLY allow GT ores to be spawnable with the meteor. Potentially.

This commit is contained in:
WayofTime 2015-01-16 11:22:50 -05:00
parent eb9284faf7
commit 2f0a1c9909
7 changed files with 202 additions and 50 deletions

View file

@ -61,7 +61,7 @@ public class TEDemonPortal extends TileEntity
public static float demonHoardChance = 0.8f;
public static float portalTickRate = 1f;
public static int[] tierCostList = new int[]{1000, 5000, 10000};
public static int[] tierCostList = new int[]{1500};
public static Set<IHoardDemon> hoardList = new HashSet();

View file

@ -0,0 +1,26 @@
package WayofTime.alchemicalWizardry.common.items.routing;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class OutputRoutingFocus extends RoutingFocus
{
public OutputRoutingFocus()
{
super();
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:HarvestGoddessSigil_deactivated");
}
public boolean doesItemMatch(ItemStack keyStack, ItemStack checkedStack)
{
return keyStack != null ? checkedStack != null && keyStack.areItemStacksEqual(keyStack, checkedStack) : false;
}
}

View file

@ -16,6 +16,7 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.Int3;
import WayofTime.alchemicalWizardry.common.items.routing.InputRoutingFocus;
import WayofTime.alchemicalWizardry.common.items.routing.OutputRoutingFocus;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectItemRouting extends RitualEffect
@ -109,6 +110,98 @@ public class RitualEffectItemRouting extends RitualEffect
}
}
}
for(int i=0; i<4; i++)
{
Int3 outputFocusChest = this.getOutputBufferChestLocation(i);
TileEntity outputFocusInv = world.getTileEntity(x + outputFocusChest.xCoord, y + outputFocusChest.yCoord, z + outputFocusChest.zCoord);
if(outputFocusInv instanceof IInventory)
{
IInventory outputFocusInventory = (IInventory)outputFocusInv;
// for(int j=0; j<((IInventory) outputFocusInv).getSizeInventory(); j++)
{
ItemStack stack = ((IInventory) outputFocusInv).getStackInSlot(0);
if(stack != null && stack.getItem() instanceof OutputRoutingFocus) //TODO change to output routing focus
{
boolean transferEverything = true;
for(int j=1; j<outputFocusInventory.getSizeInventory(); j++)
{
if(outputFocusInventory.getStackInSlot(j) != null)
{
transferEverything = false;
break;
}
}
OutputRoutingFocus outputFocus = (OutputRoutingFocus)stack.getItem();
TileEntity outputChest = world.getTileEntity(outputFocus.xCoord(stack), outputFocus.yCoord(stack), outputFocus.zCoord(stack)); //Destination
ForgeDirection inputDirection = outputFocus.getSetDirection(stack);
if(transferEverything)
{
if(outputChest instanceof IInventory)
{
IInventory outputChestInventory = (IInventory)outputChest;
for(int n=0; n<bufferInventory.getSizeInventory(); n++)
{
ItemStack syphonedStack = bufferInventory.getStackInSlot(n);
if(syphonedStack == null)
{
continue;
}
ItemStack newStack = SpellHelper.insertStackIntoInventory(syphonedStack, outputChestInventory, inputDirection);
if(newStack != null && newStack.stackSize <= 0)
{
newStack = null;
}
bufferInventory.setInventorySlotContents(n, newStack);
break;
}
}
}else
{
if(!(outputChest instanceof IInventory))
{
continue;
}
for(int j=1; j<outputFocusInventory.getSizeInventory(); j++)
{
ItemStack keyStack = outputFocusInventory.getStackInSlot(j);
if(keyStack == null)
{
continue;
}
for(int n=0; n<bufferInventory.getSizeInventory(); n++)
{
ItemStack checkStack = bufferInventory.getStackInSlot(n);
if(checkStack == null)
{
continue;
}
if(outputFocus.doesItemMatch(keyStack, checkStack))
{
ItemStack newStack = SpellHelper.insertStackIntoInventory(checkStack, (IInventory)outputChest, inputDirection);
if(newStack != null && newStack.stackSize <= 0)
{
newStack = null;
}
bufferInventory.setInventorySlotContents(n, newStack);
break;
}
}
}
}
}
}
}
}
}
public Int3 getInputBufferChestLocation(int number)
@ -126,6 +219,22 @@ public class RitualEffectItemRouting extends RitualEffect
}
return new Int3(0, 0, 0);
}
public Int3 getOutputBufferChestLocation(int number)
{
switch(number)
{
case 0:
return new Int3(2, 0, 0);
case 1:
return new Int3(-2, 0, 0);
case 2:
return new Int3(0, 0, 2);
case 3:
return new Int3(0, 0, -2);
}
return new Int3(0, 0, 0);
}
@Override
public int getCostPerRefresh()

View file

@ -1,16 +1,15 @@
package WayofTime.alchemicalWizardry.common.summoning.meteor;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
public class MeteorParadigm
{
public List<MeteorParadigmComponent> componentList = new ArrayList();
@ -106,9 +105,16 @@ public class MeteorParadigm
if (randNum < 0)
{
ItemStack blockStack = mpc.getValidBlockParadigm();
world.setBlock(x + i, y + j, z + k, Block.getBlockById(Item.getIdFromItem(blockStack.getItem())), blockStack.getItemDamage(), 3);
hasPlacedBlock = true;
break;
if(blockStack != null && blockStack.getItem() instanceof ItemBlock)
{
((ItemBlock)blockStack.getItem()).placeBlockAt(blockStack, null, world, x + i, y + j, z + k, 0, 0, 0, 0, blockStack.getItemDamage());
world.markBlockForUpdate(x + i, y + j, z + k);
hasPlacedBlock = true;
break;
}
// world.setBlock(x + i, y + j, z + k, Block.getBlockById(Item.getIdFromItem(blockStack.getItem())), blockStack.getItemDamage(), 3);
// hasPlacedBlock = true;
// break;
}
}