Anti-comments sweep!

This commit is contained in:
Tombenpotter 2014-10-13 22:33:20 +02:00
parent e6a10f3f06
commit dea1f87078
454 changed files with 23594 additions and 26739 deletions

View file

@ -1,5 +1,12 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@ -10,258 +17,251 @@ import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory
{
protected ItemStack[] inv;
protected ReagentContainer bufferTank = new ReagentContainer(Reagent.REAGENT_SIZE * 2);
protected int bufferTransferRate = 20;
private int lpPerTick = 10;
private int ticksPerReagent = 200;
public int progress;
public TEAlchemicCalcinator()
{
super(1, Reagent.REAGENT_SIZE * 4);
this.inv = new ItemStack[2];
this.tickRate = 20;
this.maxConnextions = 1;
this.progress = 0;
}
@Override
public void readFromNBT(NBTTagCompound tag)
{
super.readFromNBT(tag);
bufferTransferRate = tag.getInteger("bufferTransferRate");
progress = tag.getInteger("progress");
NBTTagCompound bufferTankTag = tag.getCompoundTag("bufferTank");
this.bufferTank = ReagentContainer.readFromNBT(bufferTankTag);
NBTTagList tagList = tag.getTagList("Inventory",Constants.NBT.TAG_COMPOUND);
protected ItemStack[] inv;
protected ReagentContainer bufferTank = new ReagentContainer(Reagent.REAGENT_SIZE * 2);
protected int bufferTransferRate = 20;
private int lpPerTick = 10;
private int ticksPerReagent = 200;
public int progress;
public TEAlchemicCalcinator()
{
super(1, Reagent.REAGENT_SIZE * 4);
this.inv = new ItemStack[2];
this.tickRate = 20;
this.maxConnextions = 1;
this.progress = 0;
}
@Override
public void readFromNBT(NBTTagCompound tag)
{
super.readFromNBT(tag);
bufferTransferRate = tag.getInteger("bufferTransferRate");
progress = tag.getInteger("progress");
NBTTagCompound bufferTankTag = tag.getCompoundTag("bufferTank");
this.bufferTank = ReagentContainer.readFromNBT(bufferTankTag);
NBTTagList tagList = tag.getTagList("Inventory", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < tagList.tagCount(); i++)
{
NBTTagCompound savedTag = (NBTTagCompound) tagList.getCompoundTagAt(i);
if(savedTag.getBoolean("Empty"))
if (savedTag.getBoolean("Empty"))
{
inv[i] = null;
}else
inv[i] = null;
} else
{
inv[i] = ItemStack.loadItemStackFromNBT(savedTag);
}
}
}
@Override
public void writeToNBT(NBTTagCompound tag)
{
super.writeToNBT(tag);
tag.setInteger("bufferTransferRate", bufferTransferRate);
tag.setInteger("progress", progress);
NBTTagCompound bufferTankTag = new NBTTagCompound();
this.bufferTank.writeToNBT(bufferTankTag);
tag.setTag("bufferTank", bufferTankTag);
NBTTagList itemList = new NBTTagList();
}
for (int i = 0; i < inv.length; i++)
{
ItemStack stack = inv[i];
NBTTagCompound savedTag = new NBTTagCompound();
if (inv[i] != null)
{
inv[i].writeToNBT(savedTag);
}else
{
savedTag.setBoolean("Empty", true);
}
itemList.appendTag(savedTag);
}
@Override
public void writeToNBT(NBTTagCompound tag)
{
super.writeToNBT(tag);
tag.setInteger("bufferTransferRate", bufferTransferRate);
tag.setInteger("progress", progress);
tag.setTag("Inventory", itemList);
}
@Override
public void updateEntity()
{
super.updateEntity();
if(!worldObj.isRemote)
{
moveBufferToMain();
tickProgress();
}
}
public void moveBufferToMain()
{
ReagentStack amountStack = this.bufferTank.drain(bufferTransferRate, false);
int drainAmount = this.fill(ForgeDirection.UNKNOWN, amountStack, false);
if(drainAmount > 0)
{
ReagentStack drainedStack = this.bufferTank.drain(drainAmount, true);
this.fill(ForgeDirection.UNKNOWN, drainedStack, true);
}
}
public void tickProgress()
{
ItemStack reagentItemStack = this.getStackInSlot(1);
if(reagentItemStack == null)
{
progress = 0;
return;
}
ReagentStack possibleReagent = ReagentRegistry.getReagentStackForItem(reagentItemStack);
if(possibleReagent == null || !this.canReagentFitBuffer(possibleReagent))
{
return;
}
ItemStack orbStack = this.getStackInSlot(0);
if(orbStack == null || !(orbStack.getItem() instanceof IBloodOrb))
{
return;
}
if(!SoulNetworkHandler.canSyphonFromOnlyNetwork(orbStack, lpPerTick))
{
SoulNetworkHandler.causeNauseaToPlayer(orbStack);
return;
}
SoulNetworkHandler.syphonFromNetwork(orbStack, lpPerTick);
progress++;
if (worldObj.getWorldTime() % 4 == 0)
{
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
if(progress >= this.ticksPerReagent)
{
progress = 0;
this.bufferTank.fill(possibleReagent, true);
this.decrStackSize(1, 1);
}
}
public boolean canReagentFitBuffer(ReagentStack stack)
{
int amount = this.bufferTank.fill(stack, false);
NBTTagCompound bufferTankTag = new NBTTagCompound();
return amount >= stack.amount;
}
@Override
public void readClientNBT(NBTTagCompound tag)
{
super.readClientNBT(tag);
NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
int size = tagList.tagCount();
this.tanks = new ReagentContainer[size];
for(int i=0; i<size; i++)
{
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
this.tanks[i] = ReagentContainer.readFromNBT(savedTag);
}
NBTTagList invTagList = tag.getTagList("Inventory",Constants.NBT.TAG_COMPOUND);
this.bufferTank.writeToNBT(bufferTankTag);
tag.setTag("bufferTank", bufferTankTag);
for (int i = 0; i < invTagList.tagCount(); i++)
{
NBTTagCompound savedTag = (NBTTagCompound) invTagList.getCompoundTagAt(i);
if(savedTag.getBoolean("Empty"))
{
inv[i] = null;
}else
{
inv[i] = ItemStack.loadItemStackFromNBT(savedTag);
}
}
}
@Override
public void writeClientNBT(NBTTagCompound tag)
{
super.writeClientNBT(tag);
NBTTagList tagList = new NBTTagList();
for(int i=0; i<this.tanks.length; i++)
{
NBTTagCompound savedTag = new NBTTagCompound();
if(this.tanks[i] != null)
{
this.tanks[i].writeToNBT(savedTag);
}
tagList.appendTag(savedTag);
}
tag.setTag("reagentTanks", tagList);
NBTTagList itemList = new NBTTagList();
for (int i = 0; i < inv.length; i++)
{
ItemStack stack = inv[i];
NBTTagCompound savedTag = new NBTTagCompound();
if (inv[i] != null)
{
inv[i].writeToNBT(savedTag);
}else
} else
{
savedTag.setBoolean("Empty", true);
savedTag.setBoolean("Empty", true);
}
itemList.appendTag(savedTag);
}
tag.setTag("Inventory", itemList);
}
@Override
public Packet getDescriptionPacket()
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeClientNBT(nbttagcompound);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{
super.onDataPacket(net, packet);
readClientNBT(packet.func_148857_g());
}
}
@Override
@Override
public void updateEntity()
{
super.updateEntity();
if (!worldObj.isRemote)
{
moveBufferToMain();
tickProgress();
}
}
public void moveBufferToMain()
{
ReagentStack amountStack = this.bufferTank.drain(bufferTransferRate, false);
int drainAmount = this.fill(ForgeDirection.UNKNOWN, amountStack, false);
if (drainAmount > 0)
{
ReagentStack drainedStack = this.bufferTank.drain(drainAmount, true);
this.fill(ForgeDirection.UNKNOWN, drainedStack, true);
}
}
public void tickProgress()
{
ItemStack reagentItemStack = this.getStackInSlot(1);
if (reagentItemStack == null)
{
progress = 0;
return;
}
ReagentStack possibleReagent = ReagentRegistry.getReagentStackForItem(reagentItemStack);
if (possibleReagent == null || !this.canReagentFitBuffer(possibleReagent))
{
return;
}
ItemStack orbStack = this.getStackInSlot(0);
if (orbStack == null || !(orbStack.getItem() instanceof IBloodOrb))
{
return;
}
if (!SoulNetworkHandler.canSyphonFromOnlyNetwork(orbStack, lpPerTick))
{
SoulNetworkHandler.causeNauseaToPlayer(orbStack);
return;
}
SoulNetworkHandler.syphonFromNetwork(orbStack, lpPerTick);
progress++;
if (worldObj.getWorldTime() % 4 == 0)
{
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
if (progress >= this.ticksPerReagent)
{
progress = 0;
this.bufferTank.fill(possibleReagent, true);
this.decrStackSize(1, 1);
}
}
public boolean canReagentFitBuffer(ReagentStack stack)
{
int amount = this.bufferTank.fill(stack, false);
return amount >= stack.amount;
}
@Override
public void readClientNBT(NBTTagCompound tag)
{
super.readClientNBT(tag);
NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
int size = tagList.tagCount();
this.tanks = new ReagentContainer[size];
for (int i = 0; i < size; i++)
{
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
this.tanks[i] = ReagentContainer.readFromNBT(savedTag);
}
NBTTagList invTagList = tag.getTagList("Inventory", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < invTagList.tagCount(); i++)
{
NBTTagCompound savedTag = (NBTTagCompound) invTagList.getCompoundTagAt(i);
if (savedTag.getBoolean("Empty"))
{
inv[i] = null;
} else
{
inv[i] = ItemStack.loadItemStackFromNBT(savedTag);
}
}
}
@Override
public void writeClientNBT(NBTTagCompound tag)
{
super.writeClientNBT(tag);
NBTTagList tagList = new NBTTagList();
for (int i = 0; i < this.tanks.length; i++)
{
NBTTagCompound savedTag = new NBTTagCompound();
if (this.tanks[i] != null)
{
this.tanks[i].writeToNBT(savedTag);
}
tagList.appendTag(savedTag);
}
tag.setTag("reagentTanks", tagList);
NBTTagList itemList = new NBTTagList();
for (int i = 0; i < inv.length; i++)
{
ItemStack stack = inv[i];
NBTTagCompound savedTag = new NBTTagCompound();
if (inv[i] != null)
{
inv[i].writeToNBT(savedTag);
} else
{
savedTag.setBoolean("Empty", true);
}
itemList.appendTag(savedTag);
}
tag.setTag("Inventory", itemList);
}
@Override
public Packet getDescriptionPacket()
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeClientNBT(nbttagcompound);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{
super.onDataPacket(net, packet);
readClientNBT(packet.func_148857_g());
}
@Override
public int getSizeInventory()
{
return inv.length;
@ -277,12 +277,12 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory
public void setInventorySlotContents(int slot, ItemStack stack)
{
inv[slot] = stack;
if (stack != null && stack.stackSize > getInventoryStackLimit())
{
stack.stackSize = getInventoryStackLimit();
}
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
@ -345,32 +345,32 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory
{
}
@Override
public String getInventoryName()
{
return "AlchemicCalcinator";
}
@Override
public String getInventoryName()
{
return "AlchemicCalcinator";
}
@Override
public boolean hasCustomInventoryName()
{
return false;
}
@Override
public boolean hasCustomInventoryName()
{
return false;
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack itemStack)
{
return true;
}
@Override
@Override
public boolean isItemValidForSlot(int slot, ItemStack itemStack)
{
return true;
}
@Override
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill)
{
if(doFill && !worldObj.isRemote)
{
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return super.fill(from, resource, doFill);
}
{
if (doFill && !worldObj.isRemote)
{
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return super.fill(from, resource, doFill);
}
}

View file

@ -1,7 +1,15 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import java.util.List;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
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.api.tile.IBloodAltar;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.AltarUpgradeComponent;
import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.UpgradedAltars;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
@ -18,33 +26,17 @@ import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidEvent;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.IFluidTank;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
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.api.tile.IBloodAltar;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.AltarUpgradeComponent;
import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.UpgradedAltars;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraftforge.fluids.*;
import java.util.List;
public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFluidHandler, IBloodAltar
{
public static final int sizeInv = 1;
public static final int sizeInv = 1;
private ItemStack[] inv;
private int resultID;
private int resultDamage;
private int upgradeLevel;
//public final LiquidTank tank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME * 10);
protected FluidStack fluid;
public int capacity;
private boolean isActive;
@ -66,7 +58,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
protected FluidStack fluidInput;
private int progress;
private int hasChanged = 0;
private int lockdownDuration;
public TEAltar()
@ -94,14 +86,14 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
public int getRSPowerOutput()
{
return 5;
return 5;
}
@Override
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
NBTTagList tagList = par1NBTTagCompound.getTagList("Inventory",Constants.NBT.TAG_COMPOUND);
NBTTagList tagList = par1NBTTagCompound.getTagList("Inventory", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < tagList.tagCount(); i++)
{
@ -327,13 +319,11 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
@Override
public void openInventory()
{
// TODO Auto-generated method stub
}
@Override
public void closeInventory()
{
// TODO Auto-generated method stub
}
//IFluidTank methods
@ -457,8 +447,6 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
if (fluidInput == null)
{
fluidInput = new FluidStack(resource, Math.min(bufferCapacity, resource.amount));
//The tile is never null, so we dont need this
if (tile != null)
{
FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this));
@ -483,7 +471,6 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
fluidInput.amount = bufferCapacity;
}
//Never null, so not needed :P
if (tile != null)
{
FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this));
@ -518,7 +505,6 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
fluidOutput = null;
}
//This is never null, so its un needed :D
if (this != null)
{
FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluidOutput, this.worldObj, this.xCoord, this.yCoord, this.zCoord, this));
@ -542,30 +528,28 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
@Override
public void updateEntity()
{
//this.capacity=(int) (10000*this.capacityMultiplier);
if(this.lockdownDuration > 0)
{
this.lockdownDuration --;
}
if (this.lockdownDuration > 0)
{
this.lockdownDuration--;
}
if (!worldObj.isRemote && worldObj.getWorldTime() % 20 == 0)
{
//TODO
{
Block block = worldObj.getBlock(xCoord+1, yCoord, zCoord);
block.onNeighborBlockChange(worldObj, xCoord+1, yCoord, zCoord, block);
block = worldObj.getBlock(xCoord-1, yCoord, zCoord);
block.onNeighborBlockChange(worldObj, xCoord-1, yCoord, zCoord, block);
block = worldObj.getBlock(xCoord, yCoord+1, zCoord);
block.onNeighborBlockChange(worldObj, xCoord, yCoord+1, zCoord, block);
block = worldObj.getBlock(xCoord, yCoord-1, zCoord);
block.onNeighborBlockChange(worldObj, xCoord, yCoord-1, zCoord, block);
block = worldObj.getBlock(xCoord, yCoord, zCoord+1);
block.onNeighborBlockChange(worldObj, xCoord, yCoord, zCoord+1, block);
block = worldObj.getBlock(xCoord, yCoord, zCoord-1);
block.onNeighborBlockChange(worldObj, xCoord, yCoord, zCoord-1, block);
}
{
Block block = worldObj.getBlock(xCoord + 1, yCoord, zCoord);
block.onNeighborBlockChange(worldObj, xCoord + 1, yCoord, zCoord, block);
block = worldObj.getBlock(xCoord - 1, yCoord, zCoord);
block.onNeighborBlockChange(worldObj, xCoord - 1, yCoord, zCoord, block);
block = worldObj.getBlock(xCoord, yCoord + 1, zCoord);
block.onNeighborBlockChange(worldObj, xCoord, yCoord + 1, zCoord, block);
block = worldObj.getBlock(xCoord, yCoord - 1, zCoord);
block.onNeighborBlockChange(worldObj, xCoord, yCoord - 1, zCoord, block);
block = worldObj.getBlock(xCoord, yCoord, zCoord + 1);
block.onNeighborBlockChange(worldObj, xCoord, yCoord, zCoord + 1, block);
block = worldObj.getBlock(xCoord, yCoord, zCoord - 1);
block.onNeighborBlockChange(worldObj, xCoord, yCoord, zCoord - 1, block);
}
int syphonMax = (int) (20 * this.dislocationMultiplier);
int fluidInputted = 0;
int fluidOutputted = 0;
@ -577,34 +561,34 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
fluidOutputted = Math.min(this.fluid.amount, fluidOutputted);
this.fluidOutput.amount += fluidOutputted;
this.fluid.amount -= fluidOutputted;
if(AlchemicalWizardry.lockdownAltar)
if (AlchemicalWizardry.lockdownAltar)
{
List<EntityPlayer> list = SpellHelper.getPlayersInRange(worldObj, xCoord+0.5, yCoord+0.5, zCoord+0.5, 15, 15);
List<EntityPlayer> list = SpellHelper.getPlayersInRange(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 15, 15);
boolean hasHighRegen = false;
for(EntityPlayer player : list)
for (EntityPlayer player : list)
{
PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration);
if(regenEffect != null && regenEffect.getAmplifier() >= 2)
{
this.lockdownDuration += 20;
}
}
}
if(AlchemicalWizardry.causeHungerWithRegen)
{
List<EntityPlayer> list = SpellHelper.getPlayersInRange(worldObj, xCoord+0.5, yCoord+0.5, zCoord+0.5, 15, 15);
for(EntityPlayer player : list)
{
PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration);
if(regenEffect != null && regenEffect.getAmplifier() > 0)
{
player.addPotionEffect(new PotionEffect(Potion.hunger.id, 40, regenEffect.getAmplifier()*2 - 2));
}
}
PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration);
if (regenEffect != null && regenEffect.getAmplifier() >= 2)
{
this.lockdownDuration += 20;
}
}
}
}
if (AlchemicalWizardry.causeHungerWithRegen)
{
List<EntityPlayer> list = SpellHelper.getPlayersInRange(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 15, 15);
for (EntityPlayer player : list)
{
PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration);
if (regenEffect != null && regenEffect.getAmplifier() > 0)
{
player.addPotionEffect(new PotionEffect(Potion.hunger.id, 40, regenEffect.getAmplifier() * 2 - 2));
}
}
}
}
if (worldObj.getWorldTime() % 100 == 0)
{
@ -627,32 +611,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
{
return;
}
//
// int range = 5;
//
// for(int i=-range; i<=range; i++)
// {
// for(int j=-range; j<=range; j++)
// {
// for(int k=-range; k<=range; k++)
// {
// Block block = worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k);
// int meta = worldObj.getBlockMetadata(xCoord + i, yCoord + j, zCoord + k);
//
// List<ItemStack> list = block.getDrops(worldObj, xCoord + i, yCoord + j, zCoord + k, meta, 1);
// for(ItemStack stack : list)
// {
// String str = stack.getUnlocalizedName();
// if(str.contains("fallenKanade"))
// {
// System.out.println("" + str);
// }
// }
// }
// }
// }
//o,o this is always true
if (worldTime % 1 == 0)
{
if (!canBeFilled)
@ -669,8 +628,6 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
fluid.amount = fluid.amount - liquidDrained;
progress += liquidDrained;
//getStackInSlot(0).setItemDamage(getStackInSlot(0).getItemDamage() + liquidDrained);
if (worldTime % 4 == 0)
{
@ -681,28 +638,18 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
{
ItemStack result = null;
result = AltarRecipeRegistry.getItemForItemAndTier(this.getStackInSlot(0), this.upgradeLevel);
if(result!=null)
if (result != null)
{
result.stackSize*=stackSize;
result.stackSize *= stackSize;
}
// if (!isResultBlock)
// {
// result = new ItemStack(resultID, stackSize, resultDamage);
// } else
// {
// result = new ItemStack(Block.blocksList[resultID], stackSize, 0);
// }
setInventorySlotContents(0, result);
progress = 0;
for (int i = 0; i < 8; i++)
{
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 4, xCoord+0.5f, yCoord+1.0f, zCoord+0.5f);
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 4, xCoord + 0.5f, yCoord + 1.0f, zCoord + 0.5f);
}
//setInventorySlotContents(1, null);
this.isActive = false;
}
} else if (progress > 0)
@ -737,8 +684,6 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
{
return;
}
//EntityPlayer owner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(itemTag.getString("ownerName"));
World world = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
@ -749,13 +694,9 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
}
int currentEssence = data.currentEssence;
// if(owner==null){return;}
// NBTTagCompound playerTag = owner.getEntityData();
// if(playerTag==null){return;}
//int currentEssence=playerTag.getInteger("currentEssence");
if (fluid != null && fluid.amount >= 1)
{
{
int liquidDrained = Math.min((int) (upgradeLevel >= 2 ? consumptionRate * (1 + consumptionMultiplier) : consumptionRate), fluid.amount);
if (liquidDrained > (item.getMaxEssence() * this.orbCapacityMultiplier - currentEssence))
@ -769,36 +710,19 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
}
fluid.amount = fluid.amount - liquidDrained;
// int maxAmount = (int) Math.min(item.getMaxEssence() - consumptionRate * (1 + consumptionMultiplier), consumptionRate * (1 + consumptionMultiplier));
// fluid.amount -= maxAmount;
data.currentEssence = liquidDrained + data.currentEssence;
data.markDirty();
// playerTag.setInteger("currentEssence", currentEssence+maxAmount);
if (worldTime % 4 == 0)
{
//PacketDispatcher.sendPacketToAllAround(xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, getParticlePacket(xCoord, yCoord, zCoord, (short) 3));
SpellHelper.sendIndexedParticleToAllAround(world, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 3, xCoord, yCoord, zCoord);
}
}
}
if (worldObj != null)
{
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
//AlchemicalWizardry.proxy.getClientWorld().markBlockForUpdate(xCoord, yCoord, zCoord);
//PacketDispatcher.sendPacketToAllAround(xCoord, yCoord, zCoord, 10, 1, getDescriptionPacket());
/*
progress++;
if(progress>=liquidRequired)
{
setActive();
setInventorySlotContents(0, new ItemStack(AlchemicalWizardry.weakBloodOrb));
}
*/
}
}
@ -814,14 +738,14 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
public void sacrificialDaggerCall(int amount, boolean isSacrifice)
{
if(!isSacrifice && this.lockdownDuration > 0)
{
int amt = (int) Math.min(bufferCapacity - fluidInput.amount, (isSacrifice ? 1 + sacrificeEfficiencyMultiplier : 1 + selfSacrificeEfficiencyMultiplier) * amount);
fluidInput.amount += amt;
}else
{
if (!isSacrifice && this.lockdownDuration > 0)
{
int amt = (int) Math.min(bufferCapacity - fluidInput.amount, (isSacrifice ? 1 + sacrificeEfficiencyMultiplier : 1 + selfSacrificeEfficiencyMultiplier) * amount);
fluidInput.amount += amt;
} else
{
fluid.amount += Math.min(capacity - fluid.amount, (isSacrifice ? 1 + sacrificeEfficiencyMultiplier : 1 + selfSacrificeEfficiencyMultiplier) * amount);
}
}
}
@Override
@ -852,9 +776,9 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
}
}
FluidStack flMain = new FluidStack(fluidData[0],fluidData[1]);
FluidStack flIn = new FluidStack(fluidData[2],fluidData[3]);
FluidStack flOut = new FluidStack(fluidData[4],fluidData[5]);
FluidStack flMain = new FluidStack(fluidData[0], fluidData[1]);
FluidStack flIn = new FluidStack(fluidData[2], fluidData[3]);
FluidStack flOut = new FluidStack(fluidData[4], fluidData[5]);
this.setMainFluid(flMain);
this.setInputFluid(flIn);
@ -910,15 +834,15 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
progress = 0;
}
if(AltarRecipeRegistry.isRequiredItemValid(getStackInSlot(0), upgradeLevel))
if (AltarRecipeRegistry.isRequiredItemValid(getStackInSlot(0), upgradeLevel))
{
AltarRecipe recipe = AltarRecipeRegistry.getAltarRecipeForItemAndTier(getStackInSlot(0), upgradeLevel);
this.isActive = true;
this.liquidRequired = recipe.getLiquidRequired();
this.canBeFilled = recipe.getCanBeFilled();
this.consumptionRate = recipe.getConsumptionRate();
this.drainRate = recipe.drainRate;
return;
AltarRecipe recipe = AltarRecipeRegistry.getAltarRecipeForItemAndTier(getStackInSlot(0), upgradeLevel);
this.isActive = true;
this.liquidRequired = recipe.getLiquidRequired();
this.canBeFilled = recipe.getCanBeFilled();
this.consumptionRate = recipe.getConsumptionRate();
this.drainRate = recipe.drainRate;
return;
}
isActive = false;
@ -966,7 +890,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
this.efficiencyMultiplier = (float) Math.pow(0.85, upgrades.getSpeedUpgrades());
this.sacrificeEfficiencyMultiplier = (float) (0.10 * upgrades.getSacrificeUpgrades());
this.selfSacrificeEfficiencyMultiplier = (float) (0.10 * upgrades.getSelfSacrificeUpgrades());
this.capacityMultiplier = (float) ((1*Math.pow(1.10,upgrades.getBetterCapacitiveUpgrades()) + 0.20 * upgrades.getAltarCapacitiveUpgrades()));
this.capacityMultiplier = (float) ((1 * Math.pow(1.10, upgrades.getBetterCapacitiveUpgrades()) + 0.20 * upgrades.getAltarCapacitiveUpgrades()));
//TODO finalize values
this.dislocationMultiplier = (float) (Math.pow(1.2, upgrades.getDisplacementUpgrades()));
this.orbCapacityMultiplier = (float) (1 + 0.02 * upgrades.getOrbCapacitiveUpgrades());
@ -989,46 +913,6 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
}
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
// for (int x = -1; x <= 1; x++)
// {
// for (int z = -1; z <= 1; z++)
// {
// if (!(x == 0 && z == 0))
// {
// Block block = Block.blocksList[worldObj.getBlockId(xCoord + x, yCoord - 1, zCoord + z)];
//
// if (!(block instanceof BloodRune))
// {
// checkUpgrade = false;
// this.isUpgraded = false;
// return;
// }
//
// if ((z == 0 && (x == -1 || x == 1)) || (x == 0 && (z == -1 || z == 1)))
// {
// switch (((BloodRune)block).getRuneEffect())
// {
// case 1:
// speedUpgrades++;
//
// case 2:
// efficiencyUpgrades++;
//
// case 3:
// sacrificeUpgrades++;
//
// case 4:
// selfSacrificeUpgrades++;
// }
// }
// }
// }
// }
// this.isUpgraded = checkUpgrade;
// this.consumptionMultiplier = (float)(0.20 * speedUpgrades);
// this.efficiencyMultiplier = (float)Math.pow(0.80, efficiencyUpgrades);
// this.sacrificeEfficiencyMultiplier = (float)(0.10 * sacrificeUpgrades);
// this.selfSacrificeEfficiencyMultiplier = (float)(0.10 * sacrificeUpgrades);
}
@Override
@ -1048,28 +932,9 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
resource = resource.copy();
int totalUsed = 0;
//TileTank tankToFill = getBottomTank();
int used = this.fill(resource, doFill);
resource.amount -= used;
totalUsed += used;
//FluidStack liquid = tankToFill.tank.getFluid();
// if (liquid != null && liquid.amount > 0 && !liquid.isFluidEqual(resource))
// {
// return 0;
// }
// while (tankToFill != null && resource.amount > 0)
// {
// int used = tankToFill.tank.fill(resource, doFill);
// resource.amount -= used;
// if (used > 0)
// {
// tankToFill.hasUpdate = true;
// }
//
//
// totalUsed += used;
// tankToFill = getTankAbove(tankToFill);
// }
this.startCycle();
return totalUsed;
}
@ -1099,7 +964,6 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
@Override
public boolean canFill(ForgeDirection from, Fluid fluid)
{
// TODO Auto-generated method stub
//I changed this, since fluidstack != fluid... :p dunno if it was a accident? so you might wanna check this
return this.fluidInput != null && this.fluid.getFluid().equals(fluidInput.getFluid());
}
@ -1107,14 +971,12 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid)
{
// TODO Auto-generated method stub
return true;
}
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection from)
{
// TODO Auto-generated method stub
FluidTank compositeTank = new FluidTank(capacity);
compositeTank.setFluid(fluid);
return new FluidTankInfo[]{compositeTank.getInfo()};
@ -1122,37 +984,37 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
public int[] buildFluidList()
{
int[] sortList = new int[6];
int[] sortList = new int[6];
if(this.fluid == null)
{
sortList[0] = AlchemicalWizardry.lifeEssenceFluid.getID();
sortList[1] = 0;
}else
{
sortList[0] = this.fluid.fluidID;
sortList[1] = this.fluid.amount;
}
if (this.fluid == null)
{
sortList[0] = AlchemicalWizardry.lifeEssenceFluid.getID();
sortList[1] = 0;
} else
{
sortList[0] = this.fluid.fluidID;
sortList[1] = this.fluid.amount;
}
if(this.fluidInput == null)
{
sortList[2] = AlchemicalWizardry.lifeEssenceFluid.getID();
sortList[3] = 0;
}else
{
sortList[2] = this.fluidInput.fluidID;
sortList[3] = this.fluidInput.amount;
}
if (this.fluidInput == null)
{
sortList[2] = AlchemicalWizardry.lifeEssenceFluid.getID();
sortList[3] = 0;
} else
{
sortList[2] = this.fluidInput.fluidID;
sortList[3] = this.fluidInput.amount;
}
if(this.fluidOutput == null)
{
sortList[4] = AlchemicalWizardry.lifeEssenceFluid.getID();
sortList[5] = 0;
}else
{
sortList[4] = this.fluidOutput.fluidID;
sortList[5] = this.fluidOutput.amount;
}
if (this.fluidOutput == null)
{
sortList[4] = AlchemicalWizardry.lifeEssenceFluid.getID();
sortList[5] = 0;
} else
{
sortList[4] = this.fluidOutput.fluidID;
sortList[5] = this.fluidOutput.amount;
}
return sortList;
}
@ -1166,14 +1028,14 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
public void sendMoreChatInfoToPlayer(EntityPlayer player)
{
if(getStackInSlot(0) != null)
{
int stackSize = getStackInSlot(0).stackSize;
if (getStackInSlot(0) != null)
{
int stackSize = getStackInSlot(0).stackSize;
player.addChatMessage(new ChatComponentText("Altar's Progress: " + progress + "LP/" + liquidRequired * stackSize + "LP"));
player.addChatMessage(new ChatComponentText("Consumption rate: " + (int)(consumptionRate * (1+consumptionMultiplier)) + "LP/t"));
}
player.addChatMessage(new ChatComponentText("Altar's Current Essence: " + this.fluid.amount + "LP"));
player.addChatMessage(new ChatComponentText(" Input tank: " + this.fluidInput.amount + "LP"));
player.addChatMessage(new ChatComponentText(" Output tank: " + this.fluidOutput.amount + "LP"));
player.addChatMessage(new ChatComponentText("Consumption rate: " + (int) (consumptionRate * (1 + consumptionMultiplier)) + "LP/t"));
}
player.addChatMessage(new ChatComponentText("Altar's Current Essence: " + this.fluid.amount + "LP"));
player.addChatMessage(new ChatComponentText(" Input tank: " + this.fluidInput.amount + "LP"));
player.addChatMessage(new ChatComponentText(" Output tank: " + this.fluidOutput.amount + "LP"));
}
}

View file

@ -1,158 +1,121 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack;
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.minecraftforge.common.util.Constants;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack;
public class TEBellJar extends TEReagentConduit
{
public TEBellJar()
{
super(1, 16000);
this.maxConnextions = 1;
this.affectedByRedstone = false;
}
public int getRSPowerOutput()
{
ReagentContainer thisTank = this.tanks[0];
if(thisTank != null)
{
ReagentStack stack = thisTank.getReagent();
if(stack != null)
{
return (15*stack.amount/thisTank.getCapacity());
}
}
return 0;
}
public static ReagentContainerInfo[] getContainerInfoFromItem(ItemStack stack)
{
if(stack != null && stack.getItem() instanceof ItemBlock && ModBlocks.blockCrystalBelljar == ((ItemBlock)stack.getItem()).field_150939_a)
{
NBTTagCompound tag = stack.getTagCompound();
if(tag != null)
{
NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
int size = tagList.tagCount();
ReagentContainer[] tanks = new ReagentContainer[size];
ReagentContainerInfo[] infos = new ReagentContainerInfo[size];
for(int i=0; i<size; i++)
{
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
tanks[i] = ReagentContainer.readFromNBT(savedTag);
if(tanks[i] != null)
{
infos[i] = tanks[i].getInfo();
}
}
return infos;
}
}
return new ReagentContainerInfo[0];
}
public void readTankNBTOnPlace(NBTTagCompound tag)
{
NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
public class TEBellJar extends TEReagentConduit
{
public TEBellJar()
{
super(1, 16000);
this.maxConnextions = 1;
this.affectedByRedstone = false;
}
public int getRSPowerOutput()
{
ReagentContainer thisTank = this.tanks[0];
if (thisTank != null)
{
ReagentStack stack = thisTank.getReagent();
if (stack != null)
{
return (15 * stack.amount / thisTank.getCapacity());
}
}
return 0;
}
public static ReagentContainerInfo[] getContainerInfoFromItem(ItemStack stack)
{
if (stack != null && stack.getItem() instanceof ItemBlock && ModBlocks.blockCrystalBelljar == ((ItemBlock) stack.getItem()).field_150939_a)
{
NBTTagCompound tag = stack.getTagCompound();
if (tag != null)
{
NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
int size = tagList.tagCount();
ReagentContainer[] tanks = new ReagentContainer[size];
ReagentContainerInfo[] infos = new ReagentContainerInfo[size];
for (int i = 0; i < size; i++)
{
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
tanks[i] = ReagentContainer.readFromNBT(savedTag);
if (tanks[i] != null)
{
infos[i] = tanks[i].getInfo();
}
}
return infos;
}
}
return new ReagentContainerInfo[0];
}
public void readTankNBTOnPlace(NBTTagCompound tag)
{
NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
int size = tagList.tagCount();
this.tanks = new ReagentContainer[size];
for(int i=0; i<size; i++)
for (int i = 0; i < size; i++)
{
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
this.tanks[i] = ReagentContainer.readFromNBT(savedTag);
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
this.tanks[i] = ReagentContainer.readFromNBT(savedTag);
}
}
public void writeTankNBT(NBTTagCompound tag)
{
NBTTagList tagList = new NBTTagList();
for(int i=0; i<this.tanks.length; i++)
}
public void writeTankNBT(NBTTagCompound tag)
{
NBTTagList tagList = new NBTTagList();
for (int i = 0; i < this.tanks.length; i++)
{
NBTTagCompound savedTag = new NBTTagCompound();
if(this.tanks[i] != null)
{
this.tanks[i].writeToNBT(savedTag);
}
tagList.appendTag(savedTag);
NBTTagCompound savedTag = new NBTTagCompound();
if (this.tanks[i] != null)
{
this.tanks[i].writeToNBT(savedTag);
}
tagList.appendTag(savedTag);
}
tag.setTag("reagentTanks", tagList);
}
// @Override
// public void readClientNBT(NBTTagCompound tag)
// {
// super.readClientNBT(tag);
//
// NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
//
// int size = tagList.tagCount();
// this.tanks = new ReagentContainer[size];
//
// for(int i=0; i<size; i++)
// {
// NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
// this.tanks[i] = ReagentContainer.readFromNBT(savedTag);
// }
// }
//
// @Override
// public void writeClientNBT(NBTTagCompound tag)
// {
// super.writeClientNBT(tag);
//
// NBTTagList tagList = new NBTTagList();
//
// for(int i=0; i<this.tanks.length; i++)
// {
// NBTTagCompound savedTag = new NBTTagCompound();
// if(this.tanks[i] != null)
// {
// this.tanks[i].writeToNBT(savedTag);
// }
// tagList.appendTag(savedTag);
// }
//
// tag.setTag("reagentTanks", tagList);
// }
@Override
public void updateEntity()
{
super.updateEntity();
if(hasChanged == 1)
{
Block block = worldObj.getBlock(xCoord+1, yCoord, zCoord);
block.onNeighborBlockChange(worldObj, xCoord+1, yCoord, zCoord, block);
block = worldObj.getBlock(xCoord-1, yCoord, zCoord);
block.onNeighborBlockChange(worldObj, xCoord-1, yCoord, zCoord, block);
block = worldObj.getBlock(xCoord, yCoord+1, zCoord);
block.onNeighborBlockChange(worldObj, xCoord, yCoord+1, zCoord, block);
block = worldObj.getBlock(xCoord, yCoord-1, zCoord);
block.onNeighborBlockChange(worldObj, xCoord, yCoord-1, zCoord, block);
block = worldObj.getBlock(xCoord, yCoord, zCoord+1);
block.onNeighborBlockChange(worldObj, xCoord, yCoord, zCoord+1, block);
block = worldObj.getBlock(xCoord, yCoord, zCoord-1);
block.onNeighborBlockChange(worldObj, xCoord, yCoord, zCoord-1, block);
}
}
}
@Override
public void updateEntity()
{
super.updateEntity();
if (hasChanged == 1)
{
Block block = worldObj.getBlock(xCoord + 1, yCoord, zCoord);
block.onNeighborBlockChange(worldObj, xCoord + 1, yCoord, zCoord, block);
block = worldObj.getBlock(xCoord - 1, yCoord, zCoord);
block.onNeighborBlockChange(worldObj, xCoord - 1, yCoord, zCoord, block);
block = worldObj.getBlock(xCoord, yCoord + 1, zCoord);
block.onNeighborBlockChange(worldObj, xCoord, yCoord + 1, zCoord, block);
block = worldObj.getBlock(xCoord, yCoord - 1, zCoord);
block.onNeighborBlockChange(worldObj, xCoord, yCoord - 1, zCoord, block);
block = worldObj.getBlock(xCoord, yCoord, zCoord + 1);
block.onNeighborBlockChange(worldObj, xCoord, yCoord, zCoord + 1, block);
block = worldObj.getBlock(xCoord, yCoord, zCoord - 1);
block.onNeighborBlockChange(worldObj, xCoord, yCoord, zCoord - 1, block);
}
}
}

View file

@ -1,9 +1,7 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
import net.minecraft.nbt.NBTTagCompound;
public class TEConduit extends TESpellBlock
{
@ -26,9 +24,9 @@ public class TEConduit extends TESpellBlock
}
@Override
protected void applySpellChange(SpellParadigm parad)
{
return;
}
@Override
protected void applySpellChange(SpellParadigm parad)
{
return;
}
}

View file

@ -1,5 +1,7 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.common.spell.simple.HomSpell;
import WayofTime.alchemicalWizardry.common.spell.simple.HomSpellRegistry;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
@ -7,8 +9,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntitySkull;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.simple.HomSpell;
import WayofTime.alchemicalWizardry.common.spell.simple.HomSpellRegistry;
public class TEHomHeart extends TileEntity
{
@ -41,8 +41,6 @@ public class TEHomHeart extends TileEntity
spell.onEnvironmentalRightClick(par1ItemStack, par2World, par3EntityPlayer);
break;
}
//spell.onOffensiveRangedRightClick(par1ItemStack, par2World, par3EntityPlayer);
}
return 0;

View file

@ -6,6 +6,5 @@ public class TEImperfectRitualStone extends TileEntity
{
public TEImperfectRitualStone()
{
// TODO Auto-generated constructor stub
}
}

View file

@ -1,9 +1,10 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.*;
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;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
@ -17,16 +18,10 @@ import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class TEMasterStone extends TileEntity implements IMasterRitualStone
{
@ -39,17 +34,17 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
private int direction;
public boolean isRunning;
public int runningTime;
private NBTTagCompound customRitualTag;
protected ReagentContainer[] tanks;
protected Map<Reagent, Integer> attunedTankMap;
public TEMasterStone()
{
tanks = new ReagentContainer[]{new ReagentContainer(1000),new ReagentContainer(1000),new ReagentContainer(1000)};
this.attunedTankMap = new HashMap();
tanks = new ReagentContainer[]{new ReagentContainer(1000), new ReagentContainer(1000), new ReagentContainer(1000)};
this.attunedTankMap = new HashMap();
isActive = false;
owner = "";
cooldown = 0;
@ -59,49 +54,49 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
currentRitualString = "";
isRunning = false;
runningTime = 0;
this.customRitualTag = new NBTTagCompound();
}
public void readClientNBT(NBTTagCompound tag)
{
currentRitualString = tag.getString("currentRitualString");
currentRitualString = tag.getString("currentRitualString");
isRunning = tag.getBoolean("isRunning");
runningTime = tag.getInteger("runningTime");
NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
int size = tagList.tagCount();
this.tanks = new ReagentContainer[size];
for(int i=0; i<size; i++)
for (int i = 0; i < size; i++)
{
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
this.tanks[i] = ReagentContainer.readFromNBT(savedTag);
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
this.tanks[i] = ReagentContainer.readFromNBT(savedTag);
}
}
public void writeClientNBT(NBTTagCompound tag)
{
tag.setString("currentRitualString", currentRitualString);
tag.setString("currentRitualString", currentRitualString);
tag.setBoolean("isRunning", isRunning);
tag.setInteger("runningTime",runningTime);
tag.setInteger("runningTime", runningTime);
NBTTagList tagList = new NBTTagList();
for(int i=0; i<this.tanks.length; i++)
for (int i = 0; i < this.tanks.length; i++)
{
NBTTagCompound savedTag = new NBTTagCompound();
if(this.tanks[i] != null)
{
this.tanks[i].writeToNBT(savedTag);
}
tagList.appendTag(savedTag);
NBTTagCompound savedTag = new NBTTagCompound();
if (this.tanks[i] != null)
{
this.tanks[i].writeToNBT(savedTag);
}
tagList.appendTag(savedTag);
}
tag.setTag("reagentTanks", tagList);
}
@Override
public void readFromNBT(NBTTagCompound tag)
{
@ -114,27 +109,27 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
currentRitualString = tag.getString("currentRitualString");
isRunning = tag.getBoolean("isRunning");
runningTime = tag.getInteger("runningTime");
NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
int size = tagList.tagCount();
this.tanks = new ReagentContainer[size];
for(int i=0; i<size; i++)
for (int i = 0; i < size; i++)
{
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
this.tanks[i] = ReagentContainer.readFromNBT(savedTag);
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
this.tanks[i] = ReagentContainer.readFromNBT(savedTag);
}
NBTTagList attunedTagList = tag.getTagList("attunedTankMap", Constants.NBT.TAG_COMPOUND);
for(int i=0; i<attunedTagList.tagCount(); i++)
for (int i = 0; i < attunedTagList.tagCount(); i++)
{
NBTTagCompound savedTag = attunedTagList.getCompoundTagAt(i);
Reagent reagent = ReagentRegistry.getReagentForKey(savedTag.getString("reagent"));
this.attunedTankMap.put(reagent, savedTag.getInteger("amount"));
NBTTagCompound savedTag = attunedTagList.getCompoundTagAt(i);
Reagent reagent = ReagentRegistry.getReagentForKey(savedTag.getString("reagent"));
this.attunedTankMap.put(reagent, savedTag.getInteger("amount"));
}
customRitualTag = tag.getCompoundTag("customRitualTag");
}
@ -149,49 +144,49 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
tag.setInteger("direction", direction);
tag.setString("currentRitualString", currentRitualString);
tag.setBoolean("isRunning", isRunning);
tag.setInteger("runningTime",runningTime);
tag.setInteger("runningTime", runningTime);
NBTTagList tagList = new NBTTagList();
for(int i=0; i<this.tanks.length; i++)
for (int i = 0; i < this.tanks.length; i++)
{
NBTTagCompound savedTag = new NBTTagCompound();
if(this.tanks[i] != null)
{
this.tanks[i].writeToNBT(savedTag);
}
tagList.appendTag(savedTag);
NBTTagCompound savedTag = new NBTTagCompound();
if (this.tanks[i] != null)
{
this.tanks[i].writeToNBT(savedTag);
}
tagList.appendTag(savedTag);
}
tag.setTag("reagentTanks", tagList);
NBTTagList attunedTagList = new NBTTagList();
for(Entry<Reagent, Integer> entry : this.attunedTankMap.entrySet())
for (Entry<Reagent, Integer> entry : this.attunedTankMap.entrySet())
{
NBTTagCompound savedTag = new NBTTagCompound();
savedTag.setString("reagent", ReagentRegistry.getKeyForReagent(entry.getKey()));
savedTag.setInteger("amount", entry.getValue());
attunedTagList.appendTag(savedTag);
NBTTagCompound savedTag = new NBTTagCompound();
savedTag.setString("reagent", ReagentRegistry.getKeyForReagent(entry.getKey()));
savedTag.setInteger("amount", entry.getValue());
attunedTagList.appendTag(savedTag);
}
tag.setTag("attunedTankMap", attunedTagList);
tag.setTag("customRitualTag", customRitualTag);
}
public void activateRitual(World world, int crystalLevel, EntityPlayer player)
{
if (world.isRemote)
if (world.isRemote)
{
return;
}
String testRitual = Rituals.checkValidRitual(world, xCoord, yCoord, zCoord);
if (testRitual.equals(""))
{
player.addChatMessage(new ChatComponentText("Nothing appears to have happened..."));
player.addChatMessage(new ChatComponentText("Nothing appears to have happened..."));
return;
}
@ -199,7 +194,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
if (!testLevel)
{
player.addChatMessage(new ChatComponentText("Your crystal vibrates pathetically."));
player.addChatMessage(new ChatComponentText("Your crystal vibrates pathetically."));
return;
}
@ -217,30 +212,30 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
if (currentEssence < Rituals.getCostForActivation(testRitual))
{
player.addChatMessage(new ChatComponentText("You feel a pull, but you are too weak to push any further."));
player.addChatMessage(new ChatComponentText("You feel a pull, but you are too weak to push any further."));
return;
}
if (!world.isRemote)
{
if(!Rituals.startRitual(this, testRitual, player))
{
player.addChatMessage(new ChatComponentText("The ritual appears to actively resist you!"));
return;
}else
{
data.currentEssence = currentEssence - Rituals.getCostForActivation(testRitual);
if (!Rituals.startRitual(this, testRitual, player))
{
player.addChatMessage(new ChatComponentText("The ritual appears to actively resist you!"));
return;
} else
{
data.currentEssence = currentEssence - Rituals.getCostForActivation(testRitual);
data.markDirty();
player.addChatMessage(new ChatComponentText("A rush of energy flows through the ritual!"));
player.addChatMessage(new ChatComponentText("A rush of energy flows through the ritual!"));
for (int i = 0; i < 12; i++)
{
SpellHelper.sendIndexedParticleToAllAround(world, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
}
}
}
cooldown = Rituals.getInitialCooldown(testRitual);
@ -259,20 +254,20 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
public void useOnRitualBroken()
{
Rituals.onRitualBroken(this, this.currentRitualString);
Rituals.onRitualBroken(this, this.currentRitualString);
}
@Override
public void updateEntity()
{
if(isRunning && runningTime < 100)
{
runningTime++;
}else if(!isRunning && runningTime > 0)
{
runningTime--;
}
if (isRunning && runningTime < 100)
{
runningTime++;
} else if (!isRunning && runningTime > 0)
{
runningTime--;
}
if (!isActive)
{
return;
@ -292,7 +287,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
if (!testRunes)
{
Rituals.onRitualBroken(this, currentRitualString);
Rituals.onRitualBroken(this, currentRitualString);
isActive = false;
currentRitualString = "";
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
@ -302,19 +297,19 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
if (worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0)
{
if(isRunning)
{
isRunning = false;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
if (isRunning)
{
isRunning = false;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return;
}else
} else
{
if(!isRunning)
{
isRunning = true;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
if (!isRunning)
{
isRunning = true;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
performRitual(worldObj, xCoord, yCoord, zCoord, currentRitualString);
@ -362,174 +357,168 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
return this.direction;
}
@Override
public World getWorld()
{
return this.getWorldObj();
}
@Override
public World getWorld()
{
return this.getWorldObj();
}
@Override
public int getXCoord()
{
return xCoord;
}
@Override
public int getXCoord()
{
return xCoord;
}
@Override
public int getYCoord()
{
return yCoord;
}
@Override
public int getYCoord()
{
return yCoord;
}
@Override
public int getZCoord()
{
return zCoord;
}
public String getCurrentRitual()
{
return this.currentRitualString;
}
public void setCurrentRitual(String str)
{
this.currentRitualString = str;
}
// @Override
// public Packet getDescriptionPacket()
// {
// return NewPacketHandler.getPacket(this);
// }
@Override
public Packet getDescriptionPacket()
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeClientNBT(nbttagcompound);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{
super.onDataPacket(net, packet);
readClientNBT(packet.func_148857_g());
}
public AxisAlignedBB getRenderBoundingBox()
{
double renderExtention = 1.0d;
AxisAlignedBB bb = AxisAlignedBB. getBoundingBox(xCoord-renderExtention, yCoord-renderExtention, zCoord-renderExtention, xCoord+1+renderExtention, yCoord+1+renderExtention, zCoord+1+renderExtention);
return bb;
}
/* ISegmentedReagentHandler */
@Override
public int getZCoord()
{
return zCoord;
}
public String getCurrentRitual()
{
return this.currentRitualString;
}
public void setCurrentRitual(String str)
{
this.currentRitualString = str;
}
@Override
public Packet getDescriptionPacket()
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeClientNBT(nbttagcompound);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{
super.onDataPacket(net, packet);
readClientNBT(packet.func_148857_g());
}
public AxisAlignedBB getRenderBoundingBox()
{
double renderExtention = 1.0d;
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(xCoord - renderExtention, yCoord - renderExtention, zCoord - renderExtention, xCoord + 1 + renderExtention, yCoord + 1 + renderExtention, zCoord + 1 + renderExtention);
return bb;
}
/* ISegmentedReagentHandler */
@Override
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill)
{
if(doFill)
{
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
int totalFill = 0;
boolean useTankLimit = !this.attunedTankMap.isEmpty();
if(resource != null)
{
int totalTanksFillable = useTankLimit ? this.getTanksTunedToReagent(resource.reagent) : this.tanks.length;
int tanksFilled = 0;
if (doFill)
{
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
int maxFill = resource.amount;
for(int i=this.tanks.length-1; i>=0; i--)
{
ReagentStack remainingStack = resource.copy();
remainingStack.amount = maxFill - totalFill;
boolean doesReagentMatch = tanks[i].getReagent() == null ? false : tanks[i].getReagent().isReagentEqual(remainingStack);
if(doesReagentMatch)
{
totalFill += tanks[i].fill(remainingStack, doFill);
tanksFilled++;
}else
{
continue;
}
if(totalFill >= maxFill || tanksFilled >= totalTanksFillable)
{
return totalFill;
}
}
if(tanksFilled >= totalTanksFillable)
{
return totalFill;
}
for(int i=this.tanks.length-1; i>=0; i--)
{
ReagentStack remainingStack = resource.copy();
remainingStack.amount = maxFill - totalFill;
boolean isTankEmpty = tanks[i].getReagent() == null;
if(isTankEmpty)
{
totalFill += tanks[i].fill(remainingStack, doFill);
tanksFilled++;
}else
{
continue;
}
if(totalFill >= maxFill || tanksFilled >= totalTanksFillable)
{
return totalFill;
}
}
}
int totalFill = 0;
boolean useTankLimit = !this.attunedTankMap.isEmpty();
if (resource != null)
{
int totalTanksFillable = useTankLimit ? this.getTanksTunedToReagent(resource.reagent) : this.tanks.length;
int tanksFilled = 0;
int maxFill = resource.amount;
for (int i = this.tanks.length - 1; i >= 0; i--)
{
ReagentStack remainingStack = resource.copy();
remainingStack.amount = maxFill - totalFill;
boolean doesReagentMatch = tanks[i].getReagent() == null ? false : tanks[i].getReagent().isReagentEqual(remainingStack);
if (doesReagentMatch)
{
totalFill += tanks[i].fill(remainingStack, doFill);
tanksFilled++;
} else
{
continue;
}
if (totalFill >= maxFill || tanksFilled >= totalTanksFillable)
{
return totalFill;
}
}
if (tanksFilled >= totalTanksFillable)
{
return totalFill;
}
for (int i = this.tanks.length - 1; i >= 0; i--)
{
ReagentStack remainingStack = resource.copy();
remainingStack.amount = maxFill - totalFill;
boolean isTankEmpty = tanks[i].getReagent() == null;
if (isTankEmpty)
{
totalFill += tanks[i].fill(remainingStack, doFill);
tanksFilled++;
} else
{
continue;
}
if (totalFill >= maxFill || tanksFilled >= totalTanksFillable)
{
return totalFill;
}
}
}
return totalFill;
}
@Override
public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain)
{
if(resource == null)
{
return null;
}
if(doDrain)
{
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
int maxDrain = resource.amount;
Reagent reagent = resource.reagent;
int drained = 0;
for(int i=0; i<tanks.length; i++)
{
if(drained >= maxDrain)
{
break;
}
if (resource.isReagentEqual(tanks[i].getReagent()))
if (resource == null)
{
return null;
}
if (doDrain)
{
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
int maxDrain = resource.amount;
Reagent reagent = resource.reagent;
int drained = 0;
for (int i = 0; i < tanks.length; i++)
{
if (drained >= maxDrain)
{
ReagentStack drainStack = tanks[i].drain(maxDrain-drained, doDrain);
if(drainStack != null)
{
drained += drainStack.amount;
}
break;
}
}
if (resource.isReagentEqual(tanks[i].getReagent()))
{
ReagentStack drainStack = tanks[i].drain(maxDrain - drained, doDrain);
if (drainStack != null)
{
drained += drainStack.amount;
}
}
}
return new ReagentStack(reagent, drained);
}
@ -537,21 +526,21 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
@Override
public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
{
for(int i=0; i<tanks.length; i++)
{
ReagentStack stack = tanks[i].drain(maxDrain, doDrain);
if(stack != null)
{
if(doDrain)
{
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return stack;
}
}
return null;
for (int i = 0; i < tanks.length; i++)
{
ReagentStack stack = tanks[i].drain(maxDrain, doDrain);
if (stack != null)
{
if (doDrain)
{
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return stack;
}
}
return null;
}
@Override
@ -569,70 +558,70 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
@Override
public ReagentContainerInfo[] getContainerInfo(ForgeDirection from)
{
ReagentContainerInfo[] info = new ReagentContainerInfo[this.getNumberOfTanks()];
for(int i=0; i<this.getNumberOfTanks(); i++)
{
info[i] = tanks[i].getInfo();
}
ReagentContainerInfo[] info = new ReagentContainerInfo[this.getNumberOfTanks()];
for (int i = 0; i < this.getNumberOfTanks(); i++)
{
info[i] = tanks[i].getInfo();
}
return info;
}
@Override
public int getNumberOfTanks()
{
return tanks.length;
}
@Override
public int getNumberOfTanks()
{
return tanks.length;
}
@Override
public int getTanksTunedToReagent(Reagent reagent)
{
if(this.attunedTankMap.containsKey(reagent) && this.attunedTankMap.get(reagent) != null)
{
return this.attunedTankMap.get(reagent);
}
return 0;
}
@Override
public int getTanksTunedToReagent(Reagent reagent)
{
if (this.attunedTankMap.containsKey(reagent) && this.attunedTankMap.get(reagent) != null)
{
return this.attunedTankMap.get(reagent);
}
return 0;
}
@Override
public void setTanksTunedToReagent(Reagent reagent, int total)
{
if(total == 0 && this.attunedTankMap.containsKey(reagent))
{
this.attunedTankMap.remove(reagent);
return;
}
this.attunedTankMap.put(reagent, new Integer(total));
}
@Override
public void setTanksTunedToReagent(Reagent reagent, int total)
{
if (total == 0 && this.attunedTankMap.containsKey(reagent))
{
this.attunedTankMap.remove(reagent);
return;
}
@Override
public Map<Reagent, Integer> getAttunedTankMap()
{
return this.attunedTankMap;
}
public boolean areTanksEmpty()
{
for(int i=0; i<this.tanks.length; i++)
{
if(tanks[i] != null && tanks[i].getReagent() != null)
{
return false;
}
}
return true;
}
this.attunedTankMap.put(reagent, new Integer(total));
}
@Override
public NBTTagCompound getCustomRitualTag()
{
return this.customRitualTag;
}
@Override
public Map<Reagent, Integer> getAttunedTankMap()
{
return this.attunedTankMap;
}
@Override
public void setCustomRitualTag(NBTTagCompound tag)
{
this.customRitualTag = tag;
}
public boolean areTanksEmpty()
{
for (int i = 0; i < this.tanks.length; i++)
{
if (tanks[i] != null && tanks[i].getReagent() != null)
{
return false;
}
}
return true;
}
@Override
public NBTTagCompound getCustomRitualTag()
{
return this.customRitualTag;
}
@Override
public void setCustomRitualTag(NBTTagCompound tag)
{
this.customRitualTag = tag;
}
}

View file

@ -1,12 +1,11 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.block.IOrientable;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
public class TEOrientable extends TileEntity implements IOrientable
{
@ -85,25 +84,25 @@ public class TEOrientable extends TileEntity implements IOrientable
return 0;
}
}
@Override
public Packet getDescriptionPacket()
{
return NewPacketHandler.getPacket(this);
return NewPacketHandler.getPacket(this);
}
public boolean isSideRendered(ForgeDirection side)
{
if(side.equals(this.getInputDirection()) || side.equals(this.getOutputDirection()))
{
return true;
}
return false;
if (side.equals(this.getInputDirection()) || side.equals(this.getOutputDirection()))
{
return true;
}
return false;
}
public String getResourceLocationForMeta(int meta)
{
return "";
return "";
}
}

View file

@ -1,5 +1,7 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
@ -8,11 +10,8 @@ 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.tileentity.TileEntity;
import net.minecraftforge.common.util.Constants;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class TEPedestal extends TileEntity implements IInventory
{
@ -165,13 +164,11 @@ public class TEPedestal extends TileEntity implements IInventory
@Override
public void openInventory()
{
// TODO Auto-generated method stub
}
@Override
public void closeInventory()
{
// TODO Auto-generated method stub
}
//Logic for the actual block is under here
@ -256,7 +253,6 @@ public class TEPedestal extends TileEntity implements IInventory
public void onItemDeletion()
{
//worldObj.createExplosion(null, xCoord+0.5, yCoord+0.5, zCoord+0.5, 1, false);
worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, xCoord, yCoord, zCoord));
for (int i = 0; i < 16; i++)

View file

@ -1,8 +1,11 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import java.util.ArrayList;
import java.util.List;
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 net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
@ -12,16 +15,12 @@ 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.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 java.util.ArrayList;
import java.util.List;
public class TEPlinth extends TileEntity implements IInventory
{
@ -33,7 +32,7 @@ public class TEPlinth extends TileEntity implements IInventory
private ItemStack[] ring1Inv;
private ItemStack[] ring2Inv;
private ItemStack[] ring3Inv;
public static final int sizeInv = 1;
private int progressInterval;
@ -56,7 +55,7 @@ public class TEPlinth extends TileEntity implements IInventory
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
NBTTagList tagList = par1NBTTagCompound.getTagList("Inventory",Constants.NBT.TAG_COMPOUND);
NBTTagList tagList = par1NBTTagCompound.getTagList("Inventory", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < tagList.tagCount(); i++)
{
@ -69,7 +68,7 @@ public class TEPlinth extends TileEntity implements IInventory
}
}
NBTTagList ring1TagList = par1NBTTagCompound.getTagList("ring1Inv",Constants.NBT.TAG_COMPOUND);
NBTTagList ring1TagList = par1NBTTagCompound.getTagList("ring1Inv", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < ring1TagList.tagCount(); i++)
{
@ -82,7 +81,7 @@ public class TEPlinth extends TileEntity implements IInventory
}
}
NBTTagList ring2TagList = par1NBTTagCompound.getTagList("ring2Inv",Constants.NBT.TAG_COMPOUND);
NBTTagList ring2TagList = par1NBTTagCompound.getTagList("ring2Inv", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < ring2TagList.tagCount(); i++)
{
@ -95,7 +94,7 @@ public class TEPlinth extends TileEntity implements IInventory
}
}
NBTTagList ring3TagList = par1NBTTagCompound.getTagList("ring3Inv",Constants.NBT.TAG_COMPOUND);
NBTTagList ring3TagList = par1NBTTagCompound.getTagList("ring3Inv", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < ring3TagList.tagCount(); i++)
{
@ -273,13 +272,11 @@ public class TEPlinth extends TileEntity implements IInventory
@Override
public void openInventory()
{
// TODO Auto-generated method stub
}
@Override
public void closeInventory()
{
// TODO Auto-generated method stub
}
//Logic for the actual block is under here
@ -370,11 +367,9 @@ public class TEPlinth extends TileEntity implements IInventory
{
int bloodOrbLevel = ((EnergyBattery) getStackInSlot(0).getItem()).getOrbLevel();
EntityLivingBase entity = SummoningRegistry.getEntity(worldObj, bloodOrbLevel, ring1Inv, ring2Inv, ring3Inv);
//EntityLivingBase entity = new EntityFallenAngel(worldObj);
if (entity != null)
{
//entity.worldObj = worldObj;
entity.setPosition(xCoord + 0.5, yCoord + 1, zCoord + 0.5);
worldObj.spawnEntityInWorld(entity);
@ -481,12 +476,12 @@ public class TEPlinth extends TileEntity implements IInventory
if (test)
{
if (itemStack.getItem()== possibleItem.getItem() && (itemStack.getItemDamage() == possibleItem.getItemDamage() || itemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE))
if (itemStack.getItem() == possibleItem.getItem() && (itemStack.getItemDamage() == possibleItem.getItemDamage() || itemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE))
{
((TEPedestal) tileEntity).decrStackSize(0, 1);
if(((TEPedestal) tileEntity).getStackInSlot(0) !=null && ((TEPedestal) tileEntity).getStackInSlot(0).stackSize==0)
if (((TEPedestal) tileEntity).getStackInSlot(0) != null && ((TEPedestal) tileEntity).getStackInSlot(0).stackSize == 0)
{
((TEPedestal) tileEntity).setInventorySlotContents(0, null);
((TEPedestal) tileEntity).setInventorySlotContents(0, null);
}
((TEPedestal) tileEntity).onItemDeletion();
worldObj.markBlockForUpdate(xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset);
@ -537,7 +532,6 @@ public class TEPlinth extends TileEntity implements IInventory
{
((TEPedestal) tileEntity).decrStackSize(0, 1);
((TEPedestal) tileEntity).onItemDeletion();
//worldObj.markBlockForUpdate(xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset);
worldObj.markBlockForUpdate(xCoord + pc.zOffset, yCoord + pc.yOffset, zCoord + pc.zOffset);
return true;
}

View file

@ -1,158 +1,156 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.demonVillage.BuildingSchematic;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.demonVillage.BuildingSchematic;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class TESchematicSaver extends TileEntity
{
public Block targetBlock = ModBlocks.largeBloodStoneBrick;
public void rightClickBlock(EntityPlayer player, int side)
{
BuildingSchematic schematic = new BuildingSchematic();
public Block targetBlock = ModBlocks.largeBloodStoneBrick;
int negX = this.getNegXLimit();
int negY = this.getNegYLimit();
int negZ = this.getNegZLimit();
int posX = this.getPosXLimit();
int posY = this.getPosYLimit();
int posZ = this.getPosZLimit();
for(int i=-negX+1; i<=posX-1; i++)
{
for(int j=-negY+1; j<=posY-1; j++)
{
for(int k=-negZ+1; k<=posZ-1; k++)
{
int meta = worldObj.getBlockMetadata(xCoord + i, yCoord + j, zCoord + k);
Block block = worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k);
if(!block.isAir(worldObj, xCoord + i, yCoord + j, zCoord + k))
{
schematic.addBlockWithMeta(block, meta, i, j, k);
}
}
}
System.out.println("" + i);
}
System.out.println("I got here!");
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String json = gson.toJson(schematic);
System.out.println("Here, too!");
Writer writer;
try
{
writer = new FileWriter("config/BloodMagic/schematics/" + new Random().nextInt() + ".json");
writer.write(json);
writer.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
public int getPosYLimit()
{
int i=1;
while(i<100)
{
if(targetBlock == (worldObj.getBlock(xCoord, yCoord + i, zCoord)))
{
return i;
}
i++;
}
return 1;
}
public int getNegYLimit()
{
int i=1;
while(i<100)
{
if(targetBlock == (worldObj.getBlock(xCoord, yCoord - i, zCoord)))
{
return i;
}
i++;
}
return 1;
}
public int getPosXLimit()
{
int i=1;
while(i<100)
{
if(targetBlock == (worldObj.getBlock(xCoord + i, yCoord, zCoord)))
{
return i;
}
i++;
}
return 1;
}
public int getNegXLimit()
{
int i=1;
while(i<100)
{
if(targetBlock == (worldObj.getBlock(xCoord - i, yCoord, zCoord)))
{
return i;
}
i++;
}
return 1;
}
public int getPosZLimit()
{
int i=1;
while(i<100)
{
if(targetBlock == (worldObj.getBlock(xCoord, yCoord, zCoord + i)))
{
return i;
}
i++;
}
return 1;
}
public int getNegZLimit()
{
int i=1;
while(i<100)
{
if(targetBlock == (worldObj.getBlock(xCoord, yCoord, zCoord - i)))
{
return i;
}
i++;
}
return 1;
}
public void rightClickBlock(EntityPlayer player, int side)
{
BuildingSchematic schematic = new BuildingSchematic();
int negX = this.getNegXLimit();
int negY = this.getNegYLimit();
int negZ = this.getNegZLimit();
int posX = this.getPosXLimit();
int posY = this.getPosYLimit();
int posZ = this.getPosZLimit();
for (int i = -negX + 1; i <= posX - 1; i++)
{
for (int j = -negY + 1; j <= posY - 1; j++)
{
for (int k = -negZ + 1; k <= posZ - 1; k++)
{
int meta = worldObj.getBlockMetadata(xCoord + i, yCoord + j, zCoord + k);
Block block = worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k);
if (!block.isAir(worldObj, xCoord + i, yCoord + j, zCoord + k))
{
schematic.addBlockWithMeta(block, meta, i, j, k);
}
}
}
System.out.println("" + i);
}
System.out.println("I got here!");
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String json = gson.toJson(schematic);
System.out.println("Here, too!");
Writer writer;
try
{
writer = new FileWriter("config/BloodMagic/schematics/" + new Random().nextInt() + ".json");
writer.write(json);
writer.close();
} catch (IOException e)
{
e.printStackTrace();
}
}
public int getPosYLimit()
{
int i = 1;
while (i < 100)
{
if (targetBlock == (worldObj.getBlock(xCoord, yCoord + i, zCoord)))
{
return i;
}
i++;
}
return 1;
}
public int getNegYLimit()
{
int i = 1;
while (i < 100)
{
if (targetBlock == (worldObj.getBlock(xCoord, yCoord - i, zCoord)))
{
return i;
}
i++;
}
return 1;
}
public int getPosXLimit()
{
int i = 1;
while (i < 100)
{
if (targetBlock == (worldObj.getBlock(xCoord + i, yCoord, zCoord)))
{
return i;
}
i++;
}
return 1;
}
public int getNegXLimit()
{
int i = 1;
while (i < 100)
{
if (targetBlock == (worldObj.getBlock(xCoord - i, yCoord, zCoord)))
{
return i;
}
i++;
}
return 1;
}
public int getPosZLimit()
{
int i = 1;
while (i < 100)
{
if (targetBlock == (worldObj.getBlock(xCoord, yCoord, zCoord + i)))
{
return i;
}
i++;
}
return 1;
}
public int getNegZLimit()
{
int i = 1;
while (i < 100)
{
if (targetBlock == (worldObj.getBlock(xCoord, yCoord, zCoord - i)))
{
return i;
}
i++;
}
return 1;
}
}

View file

@ -1,5 +1,6 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
@ -7,17 +8,15 @@ 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.tileentity.TileEntity;
import net.minecraftforge.common.util.Constants;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
public class TESocket extends TileEntity implements IInventory
{
private ItemStack[] inv;
private int resultID;
private int resultDamage;
public static final int sizeInv = 1;
private boolean isActive;
@ -34,7 +33,7 @@ public class TESocket extends TileEntity implements IInventory
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
NBTTagList tagList = par1NBTTagCompound.getTagList("Inventory",Constants.NBT.TAG_COMPOUND);
NBTTagList tagList = par1NBTTagCompound.getTagList("Inventory", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < tagList.tagCount(); i++)
{
@ -164,13 +163,11 @@ public class TESocket extends TileEntity implements IInventory
@Override
public void openInventory()
{
// TODO Auto-generated method stub
}
@Override
public void closeInventory()
{
// TODO Auto-generated method stub
}
//Logic for the actual block is under here

View file

@ -1,18 +1,12 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import WayofTime.alchemicalWizardry.ModBlocks;
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 TESpectralBlock extends TileEntity
{
{
private int ticksRemaining;
public TESpectralBlock()
@ -33,58 +27,54 @@ public class TESpectralBlock extends TileEntity
{
super.writeToNBT(par1NBTTagCompound);
par1NBTTagCompound.setInteger("ticksRemaining", ticksRemaining);
par1NBTTagCompound.setInteger("ticksRemaining", ticksRemaining);
}
@Override
public void updateEntity()
{
super.updateEntity();
if(worldObj.isRemote)
if (worldObj.isRemote)
{
return;
return;
}
this.ticksRemaining--;
if(this.ticksRemaining<=0)
if (this.ticksRemaining <= 0)
{
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
}
}
public static boolean createSpectralBlockAtLocation(World world, int x, int y, int z, int duration)
{
if(!world.isAirBlock(x, y, z))
{
return false;
}
//if(world.getTileEntity(x, y, z)==null)
{
world.setBlock(x, y, z, ModBlocks.spectralBlock);
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TESpectralBlock)
{
((TESpectralBlock) tile).setDuration(duration);
return true;
}
}
return false;
if (!world.isAirBlock(x, y, z))
{
return false;
}
world.setBlock(x, y, z, ModBlocks.spectralBlock);
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TESpectralBlock)
{
((TESpectralBlock) tile).setDuration(duration);
return true;
}
return false;
}
public void setDuration(int dur)
{
this.ticksRemaining = dur;
this.ticksRemaining = dur;
}
public void resetDuration(int dur)
{
if(this.ticksRemaining<dur)
{
this.ticksRemaining = dur;
}
if (this.ticksRemaining < dur)
{
this.ticksRemaining = dur;
}
}
}

View file

@ -1,5 +1,6 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.ModBlocks;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
@ -9,12 +10,11 @@ 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()
@ -64,86 +64,86 @@ public class TESpectralContainer extends TileEntity
}
par1NBTTagCompound.setTag("Inventory", itemList);
par1NBTTagCompound.setInteger("ticksRemaining", ticksRemaining);
par1NBTTagCompound.setInteger("ticksRemaining", ticksRemaining);
}
@Override
public void updateEntity()
{
super.updateEntity();
this.ticksRemaining--;
if(this.ticksRemaining<=0)
if (this.ticksRemaining <= 0)
{
this.returnContainedBlock();
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;
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;
this.ticksRemaining = dur;
}
public void resetDuration(int dur)
{
if(this.ticksRemaining<dur)
{
this.ticksRemaining = dur;
}
if (this.ticksRemaining < dur)
{
this.ticksRemaining = dur;
}
}
public void setContainedItem(ItemStack item)
{
this.inv[0] = 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);
}
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

@ -1,48 +1,48 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
public abstract class TESpellBlock extends TEOrientable
public abstract class TESpellBlock extends TEOrientable
{
public void modifySpellParadigm(SpellParadigm parad)
{
this.applySpellChange(parad);
TileEntity tile = this.getTileAtOutput();
if(tile instanceof TESpellBlock)
{
TESpellBlock outputBlock = (TESpellBlock)tile;
outputBlock.modifySpellParadigm(parad);
}
}
protected abstract void applySpellChange(SpellParadigm parad);
public TESpellBlock getTileAtOutput()
{
ForgeDirection output = this.getOutputDirection();
int xOffset = output.offsetX;
int yOffset = output.offsetY;
int zOffset = output.offsetZ;
TileEntity tile = worldObj.getTileEntity(xCoord + xOffset, yCoord + yOffset, zCoord + zOffset);
if(tile instanceof TESpellBlock && ((TESpellBlock)tile).canInputRecieveOutput(output))
{
return (TESpellBlock)tile;
}
return null;
}
public boolean canInputRecieve()
{
return true;
}
public boolean canInputRecieveOutput(ForgeDirection output)
{
return this.canInputRecieve() && this.getInputDirection().getOpposite()==output;
}
public void modifySpellParadigm(SpellParadigm parad)
{
this.applySpellChange(parad);
TileEntity tile = this.getTileAtOutput();
if (tile instanceof TESpellBlock)
{
TESpellBlock outputBlock = (TESpellBlock) tile;
outputBlock.modifySpellParadigm(parad);
}
}
protected abstract void applySpellChange(SpellParadigm parad);
public TESpellBlock getTileAtOutput()
{
ForgeDirection output = this.getOutputDirection();
int xOffset = output.offsetX;
int yOffset = output.offsetY;
int zOffset = output.offsetZ;
TileEntity tile = worldObj.getTileEntity(xCoord + xOffset, yCoord + yOffset, zCoord + zOffset);
if (tile instanceof TESpellBlock && ((TESpellBlock) tile).canInputRecieveOutput(output))
{
return (TESpellBlock) tile;
}
return null;
}
public boolean canInputRecieve()
{
return true;
}
public boolean canInputRecieveOutput(ForgeDirection output)
{
return this.canInputRecieve() && this.getInputDirection().getOpposite() == output;
}
}

View file

@ -1,43 +1,47 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffectEarth;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffectFire;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffectIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffectWind;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.*;
public class TESpellEffectBlock extends TESpellBlock
{
@Override
protected void applySpellChange(SpellParadigm parad)
{
parad.addBufferedEffect(this.getSpellEffect());
}
public SpellEffect getSpellEffect()
{
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
switch(meta)
{
case 0: return new SpellEffectFire();
case 1: return new SpellEffectIce();
case 2: return new SpellEffectWind();
case 3: return new SpellEffectEarth();
}
return new SpellEffectFire();
}
@Override
public String getResourceLocationForMeta(int meta)
@Override
protected void applySpellChange(SpellParadigm parad)
{
switch(meta)
{
case 0: return "alchemicalwizardry:textures/models/SpellEffectFire.png";
case 1: return "alchemicalwizardry:textures/models/SpellEffectIce.png";
case 2: return "alchemicalwizardry:textures/models/SpellEffectWind.png";
case 3: return "alchemicalwizardry:textures/models/SpellEffectEarth.png";
}
return "";
parad.addBufferedEffect(this.getSpellEffect());
}
public SpellEffect getSpellEffect()
{
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
switch (meta)
{
case 0:
return new SpellEffectFire();
case 1:
return new SpellEffectIce();
case 2:
return new SpellEffectWind();
case 3:
return new SpellEffectEarth();
}
return new SpellEffectFire();
}
@Override
public String getResourceLocationForMeta(int meta)
{
switch (meta)
{
case 0:
return "alchemicalwizardry:textures/models/SpellEffectFire.png";
case 1:
return "alchemicalwizardry:textures/models/SpellEffectIce.png";
case 2:
return "alchemicalwizardry:textures/models/SpellEffectWind.png";
case 3:
return "alchemicalwizardry:textures/models/SpellEffectEarth.png";
}
return "";
}
}

View file

@ -6,150 +6,158 @@ import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhanc
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancementPotency;
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancementPower;
public class TESpellEnhancementBlock extends TESpellBlock
public class TESpellEnhancementBlock extends TESpellBlock
{
@Override
protected void applySpellChange(SpellParadigm parad)
{
int i = -1;
switch(this.enhancementType())
{
case 0:
i = parad.getBufferedEffectPower();
break;
case 1:
i = parad.getBufferedEffectCost();
break;
case 2:
i = parad.getBufferedEffectPotency();
break;
}
if(i!=-1 && i<this.getLimit())
{
parad.applyEnhancement(getSpellEnhancement());
}
else if(i<this.getLimit())
{
this.doBadStuff();
}
}
public SpellEnhancement getSpellEnhancement()
{
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
switch(meta)
{
case 0:
case 1:
case 2:
case 3:
case 4:
return new SpellEnhancementPower();
case 5:
case 6:
case 7:
case 8:
case 9:
return new SpellEnhancementCost();
case 10:
case 11:
case 12:
case 13:
case 14:
return new SpellEnhancementPotency();
}
return new SpellEnhancementCost();
}
public int getLimit()
{
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
switch(meta)
{
case 0:
return 1;
case 1:
return 2;
case 2:
return 3;
case 3:
return 4;
case 4:
return 5;
case 5:
return 1;
case 6:
return 2;
case 7:
return 3;
case 8:
return 4;
case 9:
return 5;
case 10:
return 1;
case 11:
return 2;
case 12:
return 3;
case 13:
return 4;
case 14:
return 5;
}
return 0;
}
public int enhancementType() //0 is power, 1 is cost, 2 is potency
{
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
switch(meta)
{
case 0:
case 1:
case 2:
case 3:
case 4:
return 0;
case 5:
case 6:
case 7:
case 8:
case 9:
return 1;
case 10:
case 11:
case 12:
case 13:
case 14:
return 2;
}
return 1;
}
public void doBadStuff()
{
}
@Override
public String getResourceLocationForMeta(int meta)
{
switch(meta)
{
case 0: return "alchemicalwizardry:textures/models/SpellEnhancementPower1.png";
case 1: return "alchemicalwizardry:textures/models/SpellEnhancementPower2.png";
case 2: return "alchemicalwizardry:textures/models/SpellEnhancementPower3.png";
case 5: return "alchemicalwizardry:textures/models/SpellEnhancementCost1.png";
case 6: return "alchemicalwizardry:textures/models/SpellEnhancementCost2.png";
case 7: return "alchemicalwizardry:textures/models/SpellEnhancementCost3.png";
case 10: return "alchemicalwizardry:textures/models/SpellEnhancementPotency1.png";
case 11: return "alchemicalwizardry:textures/models/SpellEnhancementPotency2.png";
case 12: return "alchemicalwizardry:textures/models/SpellEnhancementPotency3.png";
@Override
protected void applySpellChange(SpellParadigm parad)
{
int i = -1;
}
return "alchemicalwizardry:textures/models/SpellEnhancementPower1.png";
}
switch (this.enhancementType())
{
case 0:
i = parad.getBufferedEffectPower();
break;
case 1:
i = parad.getBufferedEffectCost();
break;
case 2:
i = parad.getBufferedEffectPotency();
break;
}
if (i != -1 && i < this.getLimit())
{
parad.applyEnhancement(getSpellEnhancement());
} else if (i < this.getLimit())
{
this.doBadStuff();
}
}
public SpellEnhancement getSpellEnhancement()
{
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
switch (meta)
{
case 0:
case 1:
case 2:
case 3:
case 4:
return new SpellEnhancementPower();
case 5:
case 6:
case 7:
case 8:
case 9:
return new SpellEnhancementCost();
case 10:
case 11:
case 12:
case 13:
case 14:
return new SpellEnhancementPotency();
}
return new SpellEnhancementCost();
}
public int getLimit()
{
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
switch (meta)
{
case 0:
return 1;
case 1:
return 2;
case 2:
return 3;
case 3:
return 4;
case 4:
return 5;
case 5:
return 1;
case 6:
return 2;
case 7:
return 3;
case 8:
return 4;
case 9:
return 5;
case 10:
return 1;
case 11:
return 2;
case 12:
return 3;
case 13:
return 4;
case 14:
return 5;
}
return 0;
}
public int enhancementType() //0 is power, 1 is cost, 2 is potency
{
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
switch (meta)
{
case 0:
case 1:
case 2:
case 3:
case 4:
return 0;
case 5:
case 6:
case 7:
case 8:
case 9:
return 1;
case 10:
case 11:
case 12:
case 13:
case 14:
return 2;
}
return 1;
}
public void doBadStuff()
{
}
@Override
public String getResourceLocationForMeta(int meta)
{
switch (meta)
{
case 0:
return "alchemicalwizardry:textures/models/SpellEnhancementPower1.png";
case 1:
return "alchemicalwizardry:textures/models/SpellEnhancementPower2.png";
case 2:
return "alchemicalwizardry:textures/models/SpellEnhancementPower3.png";
case 5:
return "alchemicalwizardry:textures/models/SpellEnhancementCost1.png";
case 6:
return "alchemicalwizardry:textures/models/SpellEnhancementCost2.png";
case 7:
return "alchemicalwizardry:textures/models/SpellEnhancementCost3.png";
case 10:
return "alchemicalwizardry:textures/models/SpellEnhancementPotency1.png";
case 11:
return "alchemicalwizardry:textures/models/SpellEnhancementPotency2.png";
case 12:
return "alchemicalwizardry:textures/models/SpellEnhancementPotency3.png";
}
return "alchemicalwizardry:textures/models/SpellEnhancementPower1.png";
}
}

View file

@ -1,43 +1,46 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellModifier;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellModifierDefault;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellModifierDefensive;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellModifierEnvironmental;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellModifierOffensive;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
import WayofTime.alchemicalWizardry.common.spell.complex.*;
public class TESpellModifierBlock extends TESpellBlock
{
@Override
protected void applySpellChange(SpellParadigm parad)
{
parad.modifyBufferedEffect(this.getSpellModifier());
}
public SpellModifier getSpellModifier()
{
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
switch(meta)
{
case 0: return new SpellModifierDefault();
case 1: return new SpellModifierOffensive();
case 2: return new SpellModifierDefensive();
case 3: return new SpellModifierEnvironmental();
}
return new SpellModifierDefault();
}
@Override
public String getResourceLocationForMeta(int meta)
@Override
protected void applySpellChange(SpellParadigm parad)
{
switch(meta)
{
case 0: return "alchemicalwizardry:textures/models/SpellModifierDefault.png";
case 1: return "alchemicalwizardry:textures/models/SpellModifierOffensive.png";
case 2: return "alchemicalwizardry:textures/models/SpellModifierDefensive.png";
case 3: return "alchemicalwizardry:textures/models/SpellModifierEnvironmental.png";
}
return "alchemicalwizardry:textures/models/SpellModifierDefault.png";
parad.modifyBufferedEffect(this.getSpellModifier());
}
public SpellModifier getSpellModifier()
{
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
switch (meta)
{
case 0:
return new SpellModifierDefault();
case 1:
return new SpellModifierOffensive();
case 2:
return new SpellModifierDefensive();
case 3:
return new SpellModifierEnvironmental();
}
return new SpellModifierDefault();
}
@Override
public String getResourceLocationForMeta(int meta)
{
switch (meta)
{
case 0:
return "alchemicalwizardry:textures/models/SpellModifierDefault.png";
case 1:
return "alchemicalwizardry:textures/models/SpellModifierOffensive.png";
case 2:
return "alchemicalwizardry:textures/models/SpellModifierDefensive.png";
case 3:
return "alchemicalwizardry:textures/models/SpellModifierEnvironmental.png";
}
return "alchemicalwizardry:textures/models/SpellModifierDefault.png";
}
}

View file

@ -1,98 +1,75 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.common.spell.complex.*;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmMelee;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmProjectile;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmSelf;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmTool;
public class TESpellParadigmBlock extends TESpellBlock
public class TESpellParadigmBlock extends TESpellBlock
{
public SpellParadigm getSpellParadigm()
{
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
switch(meta)
{
case 0: return new SpellParadigmProjectile();
case 1: return new SpellParadigmSelf();
case 2: return new SpellParadigmMelee();
case 3: return new SpellParadigmTool();
}
return new SpellParadigmSelf();
}
@Override
protected void applySpellChange(SpellParadigm parad)
{
return;
}
public boolean canInputRecieve()
{
return false;
}
public void castSpell(World world, EntityPlayer entity, ItemStack spellCasterStack)
{
SpellParadigm parad = this.getSpellParadigm();
this.modifySpellParadigm(parad);
// if(parad instanceof SpellParadigmSelf)
// {
// List<String> stringList = parad.effectList;
// SpellParadigmSelf spellParadSelf = SpellParadigmSelf.getParadigmForStringArray(stringList);
// for(String str : stringList)
// {
// ChatMessageComponent chat = new ChatMessageComponent();
// chat.addText(str);
// entity.sendChatToPlayer(chat);
// }
// spellParadSelf.castSpell(world, entity, spellCasterStack);
// }
// else if(parad instanceof SpellParadigmProjectile)
// {
// List<String> stringList = parad.effectList;
// SpellParadigmProjectile spellParadSelf = SpellParadigmProjectile.getParadigmForStringArray(stringList);
// for(String str : stringList)
// {
// ChatMessageComponent chat = new ChatMessageComponent();
// chat.addText(str);
// entity.sendChatToPlayer(chat);
// }
// spellParadSelf.castSpell(world, entity, spellCasterStack);
// }else
{
parad.applyAllSpellEffects();
parad.castSpell(world, entity, spellCasterStack);
}
}
@Override
public String getResourceLocationForMeta(int meta)
public SpellParadigm getSpellParadigm()
{
switch(meta)
{
case 0: return "alchemicalwizardry:textures/models/SpellParadigmProjectile.png";
case 1: return "alchemicalwizardry:textures/models/SpellParadigmSelf.png";
case 2: return "alchemicalwizardry:textures/models/SpellParadigmMelee.png";
case 3: return "alchemicalwizardry:textures/models/SpellParadigmTool.png";
}
return "alchemicalwizardry:textures/models/SpellParadigmProjectile.png";
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
switch (meta)
{
case 0:
return new SpellParadigmProjectile();
case 1:
return new SpellParadigmSelf();
case 2:
return new SpellParadigmMelee();
case 3:
return new SpellParadigmTool();
}
return new SpellParadigmSelf();
}
@Override
@Override
protected void applySpellChange(SpellParadigm parad)
{
return;
}
public boolean canInputRecieve()
{
return false;
}
public void castSpell(World world, EntityPlayer entity, ItemStack spellCasterStack)
{
SpellParadigm parad = this.getSpellParadigm();
this.modifySpellParadigm(parad);
parad.applyAllSpellEffects();
parad.castSpell(world, entity, spellCasterStack);
}
@Override
public String getResourceLocationForMeta(int meta)
{
switch (meta)
{
case 0:
return "alchemicalwizardry:textures/models/SpellParadigmProjectile.png";
case 1:
return "alchemicalwizardry:textures/models/SpellParadigmSelf.png";
case 2:
return "alchemicalwizardry:textures/models/SpellParadigmMelee.png";
case 3:
return "alchemicalwizardry:textures/models/SpellParadigmTool.png";
}
return "alchemicalwizardry:textures/models/SpellParadigmProjectile.png";
}
@Override
public void setInputDirection(ForgeDirection direction)
{
}
@Override
public ForgeDirection getInputDirection()
{
return ForgeDirection.UNKNOWN;
}
@Override
public ForgeDirection getInputDirection()
{
return ForgeDirection.UNKNOWN;
}
}

View file

@ -1,8 +1,9 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import java.util.Iterator;
import java.util.List;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.items.TelepositionFocus;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
@ -11,15 +12,13 @@ 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.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.items.TelepositionFocus;
import java.util.Iterator;
import java.util.List;
public class TETeleposer extends TileEntity implements IInventory
{
@ -27,7 +26,7 @@ public class TETeleposer extends TileEntity implements IInventory
private int resultID;
private int resultDamage;
private int previousInput;
public static final int sizeInv = 1;
private boolean isActive;
@ -177,13 +176,11 @@ public class TETeleposer extends TileEntity implements IInventory
@Override
public void openInventory()
{
// TODO Auto-generated method stub
}
@Override
public void closeInventory()
{
// TODO Auto-generated method stub
}
//Logic for the actual block is under here
@ -232,9 +229,7 @@ public class TETeleposer extends TileEntity implements IInventory
entityCount++;
}
//int d0 = focusLevel-1;
AxisAlignedBB axisalignedbb2 = AxisAlignedBB.getBoundingBox(xf, yf + d0 + 1, zf, xf + 1, yf + 2 + d0, zf).expand(d0, d0, d0);
//axisalignedbb2.maxY = Math.min((double)worldF.getHeight(),yf+1+d0+d0);
List list2 = worldF.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb2);
Iterator iterator2 = list2.iterator();
EntityLivingBase entityplayer2;
@ -248,8 +243,6 @@ public class TETeleposer extends TileEntity implements IInventory
if (EnergyItems.canSyphonInContainer(focus, damage * (focusLevel * 2 - 1) * (focusLevel * 2 - 1) * (focusLevel * 2 - 1) + damage * entityCount))
{
for (int k = 0; k <= (focusLevel * 2 - 2); k++)
//for(int k=(focusLevel*2-1);k>=0;k--)
{
for (int i = -(focusLevel - 1); i <= (focusLevel - 1); i++)
{
for (int j = -(focusLevel - 1); j <= (focusLevel - 1); j++)
@ -262,7 +255,6 @@ public class TETeleposer extends TileEntity implements IInventory
}
}
}
}
if (!worldF.equals(worldObj))
{
@ -282,7 +274,6 @@ public class TETeleposer extends TileEntity implements IInventory
entityplayer1 = (EntityLivingBase) iterator1.next();
entityplayer1.worldObj = worldF;
entityplayer1.setPositionAndUpdate(entityplayer1.posX - this.xCoord + xf, entityplayer1.posY - this.yCoord + yf, entityplayer1.posZ - this.zCoord + zf);
//entityplayer1.travelToDimension(worldF.provider.dimensionId);
}
while (iterator2.hasNext())
@ -290,7 +281,6 @@ public class TETeleposer extends TileEntity implements IInventory
entityplayer2 = (EntityLivingBase) iterator2.next();
entityplayer2.worldObj = worldF;
entityplayer2.setPositionAndUpdate(entityplayer2.posX + this.xCoord - xf, entityplayer2.posY + this.yCoord - yf, entityplayer2.posZ + this.zCoord - zf);
//entityplayer2.travelToDimension(worldObj.provider.dimensionId);
}
}
}
@ -313,8 +303,8 @@ public class TETeleposer extends TileEntity implements IInventory
@Override
public Packet getDescriptionPacket()
{
return NewPacketHandler.getPacket(this);
{
return NewPacketHandler.getPacket(this);
}
public void handlePacketData(int[] intData)

View file

@ -1,15 +1,5 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
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.minecraftforge.common.util.Constants;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemicalPotionCreationHandler;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipe;
@ -24,6 +14,16 @@ import WayofTime.alchemicalWizardry.common.alchemy.ICombinationalCatalyst;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
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.minecraftforge.common.util.Constants;
import net.minecraftforge.oredict.OreDictionary;
public class TEWritingTable extends TileEntity implements IInventory
{
@ -31,9 +31,9 @@ public class TEWritingTable extends TileEntity implements IInventory
private int progress;
private int progressNeeded = 100;
private int amountUsed;
private int accelerationTime;
public static final int sizeInv = 7;
public TEWritingTable()
@ -127,7 +127,7 @@ public class TEWritingTable extends TileEntity implements IInventory
public void readFromNBT(NBTTagCompound tagCompound)
{
super.readFromNBT(tagCompound);
NBTTagList tagList = tagCompound.getTagList("Inventory",Constants.NBT.TAG_COMPOUND);
NBTTagList tagList = tagCompound.getTagList("Inventory", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < tagList.tagCount(); i++)
{
@ -142,7 +142,7 @@ public class TEWritingTable extends TileEntity implements IInventory
progress = tagCompound.getInteger("progress");
amountUsed = tagCompound.getInteger("amountUsed");
accelerationTime = tagCompound.getInteger("accelerationTime");
}
@ -168,7 +168,7 @@ public class TEWritingTable extends TileEntity implements IInventory
tagCompound.setTag("Inventory", itemList);
tagCompound.setInteger("progress", progress);
tagCompound.setInteger("amountUsed", amountUsed);
tagCompound.setInteger("accelerationTime", accelerationTime);
}
@ -181,14 +181,12 @@ public class TEWritingTable extends TileEntity implements IInventory
@Override
public boolean hasCustomInventoryName()
{
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack)
{
// TODO Auto-generated method stub
return false;
}
@ -296,7 +294,7 @@ public class TEWritingTable extends TileEntity implements IInventory
return -1;
}
public boolean containsCombinationCatalyst()
{
if (getCombinationCatalystPosition() != -1)
@ -452,20 +450,11 @@ public class TEWritingTable extends TileEntity implements IInventory
{
return;
}
// if(worldTime%100==0)
// {
// if (worldObj != null)
// {
// worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
// }
// }
if(accelerationTime > 0)
if (accelerationTime > 0)
{
accelerationTime--;
accelerationTime--;
}
if (containsPotionFlask() && containsRegisteredPotionIngredient())
{
if (containsCatalyst())
@ -520,8 +509,6 @@ public class TEWritingTable extends TileEntity implements IInventory
{
((AlchemyFlask) flaskStack.getItem()).setDurationFactorOfPotion(flaskStack, potionID, catalystLevel);
}
//((AlchemyFlask)flaskStack.getItem()).setConcentrationOfPotion(flaskStack, Potion.regeneration.id, 2);
this.setInventorySlotContents(6, flaskStack);
this.decrStackSize(this.getPotionFlaskPosition(), 1);
this.decrStackSize(this.getCatalystPosition(), 1);
@ -567,8 +554,6 @@ public class TEWritingTable extends TileEntity implements IInventory
int potionID = AlchemicalPotionCreationHandler.getPotionIDForStack(ingredientStack);
int tickDuration = AlchemicalPotionCreationHandler.getPotionTickDurationForStack(ingredientStack);
float successChance = ((IBindingAgent) agentStack.getItem()).getSuccessRateForPotionNumber(potionEffectNumber);
//boolean isConcentration = ((ICatalyst)catalystStack.getItem()).isConcentration();
if (potionID == -1)
{
progress = 0;
@ -582,9 +567,6 @@ public class TEWritingTable extends TileEntity implements IInventory
}
((AlchemyFlask) flaskStack.getItem()).addPotionEffect(flaskStack, potionID, tickDuration);
//((AlchemyFlask)flaskStack.getItem()).addPotionEffect(flaskStack, Potion.regeneration.id, 1000);
if (successChance > worldObj.rand.nextFloat())
{
this.setInventorySlotContents(6, flaskStack);
@ -619,7 +601,6 @@ public class TEWritingTable extends TileEntity implements IInventory
if (progress >= progressNeeded)
{
ItemStack flaskStack = inv[this.getPotionFlaskPosition()];
//ItemStack ingredientStack = inv[this.getRegisteredPotionIngredientPosition()];
ItemStack blankSlate = inv[this.getBlankSlatePosition()];
if (flaskStack == null || blankSlate == null)
@ -633,15 +614,10 @@ public class TEWritingTable extends TileEntity implements IInventory
return;
}
//boolean isConcentration = ((ICatalyst)catalystStack.getItem()).isConcentration();
((AlchemyFlask) flaskStack.getItem()).setIsPotionThrowable(true, flaskStack);
//((AlchemyFlask)flaskStack.getItem()).addPotionEffect(flaskStack, Potion.regeneration.id, 1000);
//if(successChance>worldObj.rand.nextFloat())
this.setInventorySlotContents(6, flaskStack);
this.decrStackSize(this.getPotionFlaskPosition(), 1);
this.decrStackSize(this.getBlankSlatePosition(), 1);
//this.decrStackSize(this.getRegisteredPotionIngredientPosition(), 1);
progress = 0;
if (worldObj != null)
@ -664,7 +640,6 @@ public class TEWritingTable extends TileEntity implements IInventory
if (progress >= progressNeeded)
{
ItemStack flaskStack = inv[this.getPotionFlaskPosition()];
//ItemStack ingredientStack = inv[this.getRegisteredPotionIngredientPosition()];
ItemStack fillingAgent = inv[this.getFillingAgentPosition()];
if (flaskStack == null || fillingAgent == null)
@ -678,17 +653,12 @@ public class TEWritingTable extends TileEntity implements IInventory
return;
}
//boolean isConcentration = ((ICatalyst)catalystStack.getItem()).isConcentration();
int potionEffects = ((AlchemyFlask) flaskStack.getItem()).getNumberOfPotionEffects(flaskStack);
int potionFillAmount = ((IFillingAgent) fillingAgent.getItem()).getFilledAmountForPotionNumber(potionEffects);
flaskStack.setItemDamage(Math.max(0, flaskStack.getItemDamage() - potionFillAmount));
//((AlchemyFlask)flaskStack.getItem()).addPotionEffect(flaskStack, Potion.regeneration.id, 1000);
//if(successChance>worldObj.rand.nextFloat())
this.setInventorySlotContents(6, flaskStack);
this.decrStackSize(this.getPotionFlaskPosition(), 1);
this.decrStackSize(this.getFillingAgentPosition(), 1);
//this.decrStackSize(this.getRegisteredPotionIngredientPosition(), 1);
progress = 0;
if (worldObj != null)
@ -697,8 +667,7 @@ public class TEWritingTable extends TileEntity implements IInventory
}
}
}
}
else if (this.containsPotionFlask() && this.containsCombinationCatalyst())
} else if (this.containsPotionFlask() && this.containsCombinationCatalyst())
{
//TODO
if (getStackInSlot(6) == null && CombinedPotionRegistry.hasCombinablePotionEffect(inv[this.getPotionFlaskPosition()]))
@ -713,7 +682,6 @@ public class TEWritingTable extends TileEntity implements IInventory
if (progress >= progressNeeded)
{
ItemStack flaskStack = inv[this.getPotionFlaskPosition()];
//ItemStack ingredientStack = inv[this.getRegisteredPotionIngredientPosition()];
ItemStack combinationCatalyst = inv[this.getCombinationCatalystPosition()];
if (flaskStack == null || combinationCatalyst == null)
@ -727,11 +695,11 @@ public class TEWritingTable extends TileEntity implements IInventory
return;
}
ItemStack newFlask = CombinedPotionRegistry.applyPotionEffect(flaskStack);
if(newFlask != null)
if (newFlask != null)
{
this.setInventorySlotContents(6, newFlask);
this.setInventorySlotContents(6, newFlask);
this.decrStackSize(this.getPotionFlaskPosition(), 1);
this.decrStackSize(this.getCombinationCatalystPosition(), 1);
@ -744,8 +712,7 @@ public class TEWritingTable extends TileEntity implements IInventory
}
}
}
}
else
} else
{
if (!isRecipeValid())
{
@ -763,22 +730,22 @@ public class TEWritingTable extends TileEntity implements IInventory
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
int acceleration = this.getSpeedIncrease();
if (getStackInSlot(6) == null)
{
if (!EnergyItems.syphonWhileInContainer(getStackInSlot(0), amountUsed*acceleration))
if (!EnergyItems.syphonWhileInContainer(getStackInSlot(0), amountUsed * acceleration))
{
return;
}
if (worldTime % 4 == 0)
{
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
progress+=acceleration;
progress += acceleration;
if (progress >= progressNeeded)
{
@ -806,12 +773,12 @@ public class TEWritingTable extends TileEntity implements IInventory
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
if (!EnergyItems.syphonWhileInContainer(getStackInSlot(0), amountUsed*acceleration))
if (!EnergyItems.syphonWhileInContainer(getStackInSlot(0), amountUsed * acceleration))
{
return;
}
progress+=acceleration;
progress += acceleration;
if (progress >= progressNeeded)
{
@ -819,7 +786,7 @@ public class TEWritingTable extends TileEntity implements IInventory
ItemStack result = getResultingItemStack().copy();
result.stackSize += getStackInSlot(6).stackSize;
this.setInventorySlotContents(6, result);
ItemStack[] composedRecipe = new ItemStack[5];
for (int i = 0; i < 5; i++)
@ -836,47 +803,45 @@ public class TEWritingTable extends TileEntity implements IInventory
}
}
}
//worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
public void decrementSlots(ItemStack[] recipe) //TODO Fix this. This doesn't work.
{
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) || (testStack.getItem() == decStack.getItem() && decStack.getItemDamage() == OreDictionary.WILDCARD_VALUE)) && !(decrementedList[j]))
{
if(testStack.getItem().hasContainerItem(testStack))
{
this.inv[j+1] = testStack.getItem().getContainerItem(testStack);
}else
{
this.decrStackSize(j+1, 1);
}
decrementedList[j] = true;
break;
}
}
}
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) || (testStack.getItem() == decStack.getItem() && decStack.getItemDamage() == OreDictionary.WILDCARD_VALUE)) && !(decrementedList[j]))
{
if (testStack.getItem().hasContainerItem(testStack))
{
this.inv[j + 1] = testStack.getItem().getContainerItem(testStack);
} else
{
this.decrStackSize(j + 1, 1);
}
decrementedList[j] = true;
break;
}
}
}
}
public ItemStack[] getRecipeForItems(ItemStack[] recipe, ItemStack bloodOrb)
{
if (bloodOrb == null)
if (bloodOrb == null)
{
return null;
}
@ -898,19 +863,19 @@ public class TEWritingTable extends TileEntity implements IInventory
return null;
}
public int getSpeedIncrease()
{
return accelerationTime > 0 ? 5 : 1;
return accelerationTime > 0 ? 5 : 1;
}
public boolean isWorking()
{
return this.progress > 0;
return this.progress > 0;
}
public void setAccelerationTime(int accelerationTime)
{
this.accelerationTime = accelerationTime;
this.accelerationTime = accelerationTime;
}
}

View file

@ -54,14 +54,10 @@ public class ContainerAltar extends Container
{
ItemStack stack = null;
Slot slotObject = (Slot) inventorySlots.get(slot);
//null checks and checks if the item can be stacked (maxStackSize > 1)
if (slotObject != null && slotObject.getHasStack())
{
ItemStack stackInSlot = slotObject.getStack();
stack = stackInSlot.copy();
//merges the item into player inventory since its in the tileEntity
if (slot < 9)
{
if (!this.mergeItemStack(stackInSlot, 0, 35, true))
@ -69,7 +65,6 @@ public class ContainerAltar extends Container
return null;
}
}
//places it into the tileEntity is possible since its in the player inventory
else if (!this.mergeItemStack(stackInSlot, 0, 9, false))
{
return null;

View file

@ -14,16 +14,7 @@ public class ContainerTeleposer extends Container
public ContainerTeleposer(InventoryPlayer inventoryPlayer, TETeleposer te)
{
tileEntity = te;
//the Slot constructor takes the IInventory and the slot number in that it binds to
//and the x-y coordinates it resides on-screen
// addSlotToContainer(new Slot(tileEntity, 0, 152, 110));
// addSlotToContainer(new Slot(tileEntity, 1, 80, 18));
// addSlotToContainer(new Slot(tileEntity, 2, 33, 52));
// addSlotToContainer(new Slot(tileEntity, 3, 51, 110));
// addSlotToContainer(new Slot(tileEntity, 4, 109, 110));
// addSlotToContainer(new Slot(tileEntity, 5, 127, 52));
addSlotToContainer(new Slot(tileEntity, 0, 80, 67));
//commonly used vanilla code that adds the player's inventory
bindPlayerInventory(inventoryPlayer);
}
@ -54,8 +45,6 @@ public class ContainerTeleposer extends Container
{
ItemStack stack = null;
Slot slotObject = (Slot) inventorySlots.get(slot);
//null checks and checks if the item can be stacked (maxStackSize > 1)
if (slotObject != null && slotObject.getHasStack())
{
ItemStack stackInSlot = slotObject.getStack();
@ -70,8 +59,6 @@ public class ContainerTeleposer extends Container
slotObject.onSlotChange(stackInSlot, stack);
}
//merges the item into player inventory since its in the tileEntity
if (slot < 1)
{
if (!this.mergeItemStack(stackInSlot, 7, 35, true))
@ -79,7 +66,6 @@ public class ContainerTeleposer extends Container
return null;
}
}
//places it into the tileEntity is possible since its in the player inventory
else if (!this.mergeItemStack(stackInSlot, 0, 0, false))
{
return null;

View file

@ -1,12 +1,12 @@
package WayofTime.alchemicalWizardry.common.tileEntity.container;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
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
{
@ -15,8 +15,6 @@ public class ContainerWritingTable extends Container
public ContainerWritingTable(InventoryPlayer inventoryPlayer, TEWritingTable te)
{
tileEntity = te;
//the Slot constructor takes the IInventory and the slot number in that it binds to
//and the x-y coordinates it resides on-screen
addSlotToContainer(new Slot(tileEntity, 0, 152, 110));
addSlotToContainer(new Slot(tileEntity, 1, 80, 18));
addSlotToContainer(new Slot(tileEntity, 2, 33, 52));
@ -24,7 +22,6 @@ public class ContainerWritingTable extends Container
addSlotToContainer(new Slot(tileEntity, 4, 109, 110));
addSlotToContainer(new Slot(tileEntity, 5, 127, 52));
addSlotToContainer(new Slot(tileEntity, 6, 80, 67));
//commonly used vanilla code that adds the player's inventory
bindPlayerInventory(inventoryPlayer);
}
@ -55,30 +52,23 @@ public class ContainerWritingTable extends Container
{
ItemStack stack = null;
Slot slotObject = (Slot) inventorySlots.get(slot);
//null checks and checks if the item can be stacked (maxStackSize > 1)
if (slotObject != null && slotObject.getHasStack())
{
ItemStack stackInSlot = slotObject.getStack();
stack = stackInSlot.copy();
//merges the item into player inventory since its in the tileEntity
if (slot <= 6)
{
if (!this.mergeItemStack(stackInSlot, 7, 43, true))
{
return null;
}
}
else if(stack.getItem() instanceof IBloodOrb)
} else if (stack.getItem() instanceof IBloodOrb)
{
if (!this.mergeItemStack(stackInSlot, 0, 1, false))
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, 1, 6, false))
} else if (!this.mergeItemStack(stackInSlot, 1, 6, false))
{
return null;
}

View file

@ -1,21 +1,18 @@
package WayofTime.alchemicalWizardry.common.tileEntity.gui;
import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
import WayofTime.alchemicalWizardry.common.tileEntity.container.ContainerTeleposer;
import net.minecraft.client.gui.inventory.GuiBrewingStand;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
import WayofTime.alchemicalWizardry.common.tileEntity.container.ContainerTeleposer;
public class GuiTeleposer extends GuiContainer
{
public GuiTeleposer(InventoryPlayer inventoryPlayer, TETeleposer tileEntity)
{
//the container is instanciated and passed to the superclass for handling
super(new ContainerTeleposer(inventoryPlayer, tileEntity));
xSize = 176;
ySize = 222;
@ -24,7 +21,6 @@ public class GuiTeleposer extends GuiContainer
@Override
protected void drawGuiContainerForegroundLayer(int param1, int param2)
{
//draw text and stuff here
//the parameters for drawString are: string, x, y, color
fontRendererObj.drawString("Teleposer", 8, 6, 4210752);
//draws "Inventory" or your regional equivalent
@ -35,7 +31,6 @@ public class GuiTeleposer extends GuiContainer
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
//draw your Gui here, only thing you need to change is the path
//ResourceLocation texture = mc.renderEngine.getTexture("/gui/trap.png");
ResourceLocation test = new ResourceLocation("alchemicalwizardry", "gui/Teleposer.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(test);

View file

@ -13,7 +13,6 @@ public class GuiWritingTable extends GuiContainer
{
public GuiWritingTable(InventoryPlayer inventoryPlayer, TEWritingTable tileEntity)
{
//the container is instanciated and passed to the superclass for handling
super(new ContainerWritingTable(inventoryPlayer, tileEntity));
xSize = 176;
ySize = 222;
@ -33,7 +32,6 @@ public class GuiWritingTable extends GuiContainer
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
//draw your Gui here, only thing you need to change is the path
//ResourceLocation texture = mc.renderEngine.getTexture("/gui/trap.png");
ResourceLocation test = new ResourceLocation("alchemicalwizardry", "gui/WritingTable.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(test);