1.0.1d push

This commit is contained in:
WayofTime 2014-05-04 18:11:09 -04:00
parent e13818e2da
commit 1c0deadfc6
129 changed files with 4403 additions and 2247 deletions

View file

@ -1,9 +1,5 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
@ -11,7 +7,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
@ -27,14 +22,13 @@ import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.IFluidTank;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipe;
import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.altarRecipeRegistry.AltarRecipe;
import WayofTime.alchemicalWizardry.common.altarRecipeRegistry.AltarRecipeRegistry;
import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.AltarUpgradeComponent;
import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.UpgradedAltars;
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFluidHandler
@ -583,12 +577,12 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
{
ItemStack returnedItem = getStackInSlot(0);
if (!(returnedItem.getItem() instanceof EnergyBattery))
if (!(returnedItem.getItem() instanceof IBloodOrb))
{
return;
}
EnergyBattery item = (EnergyBattery) (returnedItem.getItem());
IBloodOrb item = (IBloodOrb) (returnedItem.getItem());
NBTTagCompound itemTag = returnedItem.stackTagCompound;
if (itemTag == null)

View file

@ -4,11 +4,12 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.common.rituals.Rituals;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class TEMasterStone extends TileEntity
public class TEMasterStone extends TileEntity implements IMasterRitualStone
{
private int currentRitual;
private boolean isActive;
@ -26,6 +27,7 @@ public class TEMasterStone extends TileEntity
cooldown = 0;
var1 = 0;
direction = 0;
varString1 = "";
}
@Override
@ -38,7 +40,7 @@ public class TEMasterStone extends TileEntity
cooldown = par1NBTTagCompound.getInteger("cooldown");
var1 = par1NBTTagCompound.getInteger("var1");
direction = par1NBTTagCompound.getInteger("direction");
varString1 = par1NBTTagCompound.getString("varString1");
// varString1 = par1NBTTagCompound.getString("varString1");
}
@Override
@ -51,7 +53,7 @@ public class TEMasterStone extends TileEntity
par1NBTTagCompound.setInteger("cooldown", cooldown);
par1NBTTagCompound.setInteger("var1", var1);
par1NBTTagCompound.setInteger("direction", direction);
par1NBTTagCompound.setString(varString1, "varString1");
// par1NBTTagCompound.setString("varString1", varString1);
}
public void activateRitual(World world, int crystalLevel)
@ -183,16 +185,6 @@ public class TEMasterStone extends TileEntity
{
return this.var1;
}
public void setVarString1(String newVar)
{
this.varString1 = newVar;
}
public String getVarString1()
{
return this.varString1;
}
public void setActive(boolean active)
{
@ -203,4 +195,28 @@ public class TEMasterStone extends TileEntity
{
return this.direction;
}
@Override
public World getWorld()
{
return this.getWorldObj();
}
@Override
public int getXCoord()
{
return xCoord;
}
@Override
public int getYCoord()
{
return yCoord;
}
@Override
public int getZCoord()
{
return zCoord;
}
}

View file

@ -16,12 +16,12 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistry;
import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistryComponent;
import WayofTime.alchemicalWizardry.common.IDemon;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.PlinthComponent;
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
import WayofTime.alchemicalWizardry.common.summoning.SummoningRegistry;
import WayofTime.alchemicalWizardry.common.summoning.SummoningRegistryComponent;
public class TEPlinth extends TileEntity implements IInventory
{

View file

@ -0,0 +1,149 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fluids.IFluidBlock;
import WayofTime.alchemicalWizardry.ModBlocks;
public class TESpectralContainer extends TileEntity
{
private ItemStack[] inv;
private int ticksRemaining;
public TESpectralContainer()
{
this.inv = new ItemStack[1];
ticksRemaining = 0;
}
@Override
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
NBTTagList tagList = par1NBTTagCompound.getTagList("Inventory", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < tagList.tagCount(); i++)
{
NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i);
int slot = tag.getByte("Slot");
if (slot >= 0 && slot < inv.length)
{
inv[slot] = ItemStack.loadItemStackFromNBT(tag);
}
}
ticksRemaining = par1NBTTagCompound.getInteger("ticksRemaining");
}
@Override
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
NBTTagList itemList = new NBTTagList();
for (int i = 0; i < inv.length; i++)
{
ItemStack stack = inv[i];
if (inv[i] != null)
{
NBTTagCompound tag = new NBTTagCompound();
tag.setByte("Slot", (byte) i);
inv[i].writeToNBT(tag);
itemList.appendTag(tag);
}
}
par1NBTTagCompound.setTag("Inventory", itemList);
par1NBTTagCompound.setInteger("ticksRemaining", ticksRemaining);
}
@Override
public void updateEntity()
{
super.updateEntity();
this.ticksRemaining--;
if(this.ticksRemaining<=0)
{
this.returnContainedBlock();
}
}
public static boolean createSpectralBlockAtLocation(World world, int x, int y, int z, int duration)
{
Block block = world.getBlock(x, y, z);
if(block==null)
{
return false;
}
if(world.getTileEntity(x, y, z)==null || block instanceof IFluidBlock)
{
int meta = world.getBlockMetadata(x, y, z);
ItemStack item = new ItemStack(block, 1, meta);
world.setBlock(x, y, z, ModBlocks.blockSpectralContainer);
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TESpectralContainer)
{
((TESpectralContainer) tile).setContainedItem(item);
((TESpectralContainer) tile).setDuration(duration);
return true;
}
}
return false;
}
public void setDuration(int dur)
{
this.ticksRemaining = dur;
}
public void resetDuration(int dur)
{
if(this.ticksRemaining<dur)
{
this.ticksRemaining = dur;
}
}
public void setContainedItem(ItemStack item)
{
this.inv[0] = item;
}
public void returnContainedBlock()
{
ItemStack item = this.inv[0];
if(item!=null)
{
if(item.getItem() instanceof ItemBlock)
{
Block block = ((ItemBlock)item.getItem()).field_150939_a;
int meta = item.getItemDamage();
if(block != null)
{
this.worldObj.setBlock(xCoord, yCoord, zCoord, block, meta, 6);
}
}
}else
{
this.worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
}
}

View file

@ -10,12 +10,12 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.Constants;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemicalPotionCreationHandler;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
import WayofTime.alchemicalWizardry.common.IBindingAgent;
import WayofTime.alchemicalWizardry.common.ICatalyst;
import WayofTime.alchemicalWizardry.common.IFillingAgent;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.alchemy.AlchemicalPotionCreationHandler;
import WayofTime.alchemicalWizardry.common.alchemy.AlchemyRecipeRegistry;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
@ -696,10 +696,7 @@ public class TEWritingTable extends TileEntity implements IInventory
progress = 0;
this.setInventorySlotContents(6, getResultingItemStack());
for (int i = 0; i < 5; i++)
{
this.decrStackSize(i + 1, 1);
}
this.decrementSlots(AlchemyRecipeRegistry.getRecipeForItemStack(getResultingItemStack()));
if (worldObj != null)
{
@ -727,10 +724,7 @@ public class TEWritingTable extends TileEntity implements IInventory
result.stackSize += getStackInSlot(6).stackSize;
this.setInventorySlotContents(6, result);
for (int i = 0; i < 5; i++)
{
this.decrStackSize(i + 1, 1);
}
this.decrementSlots(AlchemyRecipeRegistry.getRecipeForItemStack(getResultingItemStack()));
if (worldObj != null)
{
@ -742,4 +736,31 @@ public class TEWritingTable extends TileEntity implements IInventory
//worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
public void decrementSlots(ItemStack[] recipe)
{
boolean[] decrementedList = new boolean[]{false,false,false,false,false};
for(int i=0; i<(Math.min(recipe.length,5)); i++)
{
ItemStack decStack = recipe[i];
if(decStack == null)
{
continue;
}
for(int j=0; j<5; j++)
{
ItemStack testStack = this.getStackInSlot(j+1);
if(testStack != null && testStack.isItemEqual(decStack) && !(decrementedList[j]))
{
this.decrStackSize(j+1, 1);
decrementedList[j] = true;
break;
}
}
}
}
}

View file

@ -1,11 +1,12 @@
package WayofTime.alchemicalWizardry.common.tileEntity.container;
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
public class ContainerWritingTable extends Container
{
@ -61,26 +62,23 @@ public class ContainerWritingTable extends Container
ItemStack stackInSlot = slotObject.getStack();
stack = stackInSlot.copy();
if (slot == 7)
//merges the item into player inventory since its in the tileEntity
if (slot <= 6)
{
if (!this.mergeItemStack(stackInSlot, 7, 35, true))
if (!this.mergeItemStack(stackInSlot, 7, 43, true))
{
return null;
}
slotObject.onSlotChange(stackInSlot, stack);
}
//merges the item into player inventory since its in the tileEntity
if (slot < 6)
else if(stack.getItem() instanceof IBloodOrb)
{
if (!this.mergeItemStack(stackInSlot, 7, 35, true))
if (!this.mergeItemStack(stackInSlot, 0, 1, false))
{
return null;
}
}
//places it into the tileEntity is possible since its in the player inventory
else if (!this.mergeItemStack(stackInSlot, 0, 6, false))
else if (!this.mergeItemStack(stackInSlot, 1, 6, false))
{
return null;
}