All da commentz

This commit is contained in:
WayofTime 2014-09-14 18:21:45 -04:00
parent 2b749000b6
commit 5983ff4130
44 changed files with 1851 additions and 426 deletions

View file

@ -1,7 +1,5 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import java.util.Map.Entry;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;

View file

@ -606,30 +606,30 @@ 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);
}
}
}
}
}
//
// 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)

View file

@ -1,11 +1,14 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
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
@ -31,6 +34,69 @@ public class TEBellJar extends TEReagentConduit
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++)
{
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++)
{
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)
// {

View file

@ -588,4 +588,17 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
{
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;
}
}

View file

@ -8,8 +8,6 @@ import java.util.Map.Entry;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.NetworkManager;
@ -20,7 +18,6 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.api.ColourAndCoords;
import WayofTime.alchemicalWizardry.api.alchemy.energy.IAlchemyGoggles;
import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer;
@ -30,6 +27,8 @@ import WayofTime.alchemicalWizardry.api.alchemy.energy.TileSegmentedReagentHandl
import WayofTime.alchemicalWizardry.common.Int3;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityParticleBeam;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class TEReagentConduit extends TileSegmentedReagentHandler
{
@ -339,26 +338,33 @@ public class TEReagentConduit extends TileSegmentedReagentHandler
return;
}
Minecraft mc = Minecraft.getMinecraft();
EntityPlayer player = mc.thePlayer;
World world = mc.theWorld;
if(SpellHelper.canPlayerSeeAlchemy(player))
{
for(ColourAndCoords colourSet : this.destinationList)
{
if(!(worldObj.getTileEntity(xCoord + colourSet.xCoord, yCoord + colourSet.yCoord, zCoord + colourSet.zCoord) instanceof IReagentHandler))
{
continue;
}
EntityParticleBeam beam = new EntityParticleBeam(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
double velocity = Math.sqrt(Math.pow(colourSet.xCoord, 2) + Math.pow(colourSet.yCoord, 2) + Math.pow(colourSet.zCoord, 2));
double wantedVel = 0.3d;
beam.setVelocity(wantedVel*colourSet.xCoord/velocity, wantedVel*colourSet.yCoord/velocity, wantedVel*colourSet.zCoord/velocity);
beam.setColour(colourSet.colourRed / 255f, colourSet.colourGreen/255f, colourSet.colourBlue/255f);
beam.setDestination(xCoord + colourSet.xCoord, yCoord + colourSet.yCoord, zCoord + colourSet.zCoord);
worldObj.spawnEntityInWorld(beam);
}
}
this.sendPlayerStuffs();
}
}
@SideOnly(Side.CLIENT)
public void sendPlayerStuffs()
{
Minecraft mc = Minecraft.getMinecraft();
EntityPlayer player = mc.thePlayer;
World world = mc.theWorld;
if(SpellHelper.canPlayerSeeAlchemy(player))
{
for(ColourAndCoords colourSet : this.destinationList)
{
if(!(worldObj.getTileEntity(xCoord + colourSet.xCoord, yCoord + colourSet.yCoord, zCoord + colourSet.zCoord) instanceof IReagentHandler))
{
continue;
}
EntityParticleBeam beam = new EntityParticleBeam(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
double velocity = Math.sqrt(Math.pow(colourSet.xCoord, 2) + Math.pow(colourSet.yCoord, 2) + Math.pow(colourSet.zCoord, 2));
double wantedVel = 0.3d;
beam.setVelocity(wantedVel*colourSet.xCoord/velocity, wantedVel*colourSet.yCoord/velocity, wantedVel*colourSet.zCoord/velocity);
beam.setColour(colourSet.colourRed / 255f, colourSet.colourGreen/255f, colourSet.colourBlue/255f);
beam.setDestination(xCoord + colourSet.xCoord, yCoord + colourSet.yCoord, zCoord + colourSet.zCoord);
worldObj.spawnEntityInWorld(beam);
}
}
}
@ -387,9 +393,17 @@ public class TEReagentConduit extends TileSegmentedReagentHandler
if(entry.getValue() != null)
{
Reagent reagent = entry.getKey();
if(reagent == null)
{
continue;
}
List<Int3> coords = entry.getValue();
for(Int3 coord : coords)
{
if(coord == null)
{
continue;
}
list.add(new ColourAndCoords(reagent.getColourRed(), reagent.getColourGreen(), reagent.getColourBlue(), reagent.getColourIntensity(), coord.xCoord, coord.yCoord, coord.zCoord));
}
}