Fixing Sanguine armour, adding some fancy rendering, doing other random bug fixes

This commit is contained in:
WayofTime 2014-08-10 14:38:51 -04:00
parent 4f9fad22c5
commit 14f9e3c61b
66 changed files with 2425 additions and 911 deletions

View file

@ -1,5 +1,8 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
@ -7,6 +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.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
@ -60,6 +65,8 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
protected FluidStack fluidOutput;
protected FluidStack fluidInput;
private int progress;
private int lockdownDuration;
public TEAltar()
{
@ -81,6 +88,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
upgradeLevel = 0;
isResultBlock = false;
progress = 0;
this.lockdownDuration = 0;
}
@Override
@ -145,6 +153,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
bufferCapacity = par1NBTTagCompound.getInteger("bufferCapacity");
progress = par1NBTTagCompound.getInteger("progress");
isResultBlock = par1NBTTagCompound.getBoolean("isResultBlock");
lockdownDuration = par1NBTTagCompound.getInteger("lockdownDuration");
}
public void setMainFluid(FluidStack fluid)
@ -221,6 +230,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
par1NBTTagCompound.setInteger("capacity", capacity);
par1NBTTagCompound.setInteger("progress", progress);
par1NBTTagCompound.setInteger("bufferCapacity", bufferCapacity);
par1NBTTagCompound.setInteger("lockdownDuration", lockdownDuration);
}
@Override
@ -527,6 +537,11 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
public void updateEntity()
{
//this.capacity=(int) (10000*this.capacityMultiplier);
if(this.lockdownDuration > 0)
{
this.lockdownDuration --;
}
if (!worldObj.isRemote && worldObj.getWorldTime() % 20 == 0)
{
//TODO
@ -541,9 +556,23 @@ 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)
{
List<EntityPlayer> list = SpellHelper.getPlayersInRange(worldObj, xCoord+0.5, yCoord+0.5, zCoord+0.5, 15, 15);
boolean hasHighRegen = false;
for(EntityPlayer player : list)
{
PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration);
if(regenEffect != null && regenEffect.getAmplifier() >= 2)
{
this.lockdownDuration += 20;
}
}
}
}
if (worldObj.getWorldTime() % 150 == 0)
if (worldObj.getWorldTime() % 100 == 0)
{
startCycle();
}
@ -564,6 +593,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);
}
}
}
}
}
//o,o this is always true
if (worldTime % 1 == 0)
@ -726,7 +779,14 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
public void sacrificialDaggerCall(int amount, boolean isSacrifice)
{
fluid.amount += Math.min(capacity - fluid.amount, (isSacrifice ? 1 + sacrificeEfficiencyMultiplier : 1 + selfSacrificeEfficiencyMultiplier) * amount);
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

View file

@ -2,18 +2,20 @@ package WayofTime.alchemicalWizardry.common.tileEntity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
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;
public class TEMasterStone extends TileEntity implements IMasterRitualStone
{
//private int currentRitual;
private String currentRitualString;
private boolean isActive;
private String owner;
@ -21,10 +23,11 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
private int cooldown;
private int var1;
private int direction;
public boolean isRunning;
public int runningTime;
public TEMasterStone()
{
//currentRitual = 0;
isActive = false;
owner = "";
cooldown = 0;
@ -32,34 +35,36 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
direction = 0;
varString1 = "";
currentRitualString = "";
isRunning = false;
runningTime = 0;
}
@Override
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
//currentRitual = par1NBTTagCompound.getInteger("currentRitual");
isActive = par1NBTTagCompound.getBoolean("isActive");
owner = par1NBTTagCompound.getString("owner");
cooldown = par1NBTTagCompound.getInteger("cooldown");
var1 = par1NBTTagCompound.getInteger("var1");
direction = par1NBTTagCompound.getInteger("direction");
currentRitualString = par1NBTTagCompound.getString("currentRitualString");
// varString1 = par1NBTTagCompound.getString("varString1");
isRunning = par1NBTTagCompound.getBoolean("isRunning");
runningTime = par1NBTTagCompound.getInteger("runningTime");
}
@Override
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
//par1NBTTagCompound.setInteger("currentRitual", currentRitual);
par1NBTTagCompound.setBoolean("isActive", isActive);
par1NBTTagCompound.setString("owner", owner);
par1NBTTagCompound.setInteger("cooldown", cooldown);
par1NBTTagCompound.setInteger("var1", var1);
par1NBTTagCompound.setInteger("direction", direction);
par1NBTTagCompound.setString("currentRitualString", currentRitualString);
// par1NBTTagCompound.setString("varString1", varString1);
par1NBTTagCompound.setBoolean("isRunning", isRunning);
par1NBTTagCompound.setInteger("runningTime",runningTime);
}
public void activateRitual(World world, int crystalLevel, EntityPlayer player)
@ -101,7 +106,6 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
{
player.addChatMessage(new ChatComponentText("You feel a pull, but you are too weak to push any further."));
//TODO Bad stuff
return;
}
@ -122,6 +126,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
var1 = 0;
currentRitualString = testRitual;
isActive = true;
isRunning = true;
direction = Rituals.getDirectionOfRitual(world, xCoord, yCoord, zCoord, testRitual);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
@ -134,6 +139,14 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
@Override
public void updateEntity()
{
if(isRunning && runningTime < 100)
{
runningTime++;
}else if(!isRunning && runningTime > 0)
{
runningTime--;
}
if (!isActive)
{
return;
@ -156,14 +169,25 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
isActive = false;
currentRitualString = "";
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
//PacketDispatcher.sendPacketToAllPlayers(TEAltar.getParticlePacket(xCoord, yCoord, zCoord, (short)3));
return;
}
}
if (worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0)
{
if(isRunning)
{
isRunning = false;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return;
}else
{
if(!isRunning)
{
isRunning = true;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
performRitual(worldObj, xCoord, yCoord, zCoord, currentRitualString);
@ -202,6 +226,8 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
public void setActive(boolean active)
{
this.isActive = active;
this.isRunning = active;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
public int getDirection()
@ -232,4 +258,27 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
{
return zCoord;
}
public String getCurrentRitual()
{
return this.currentRitualString;
}
public void setCurrentRitual(String str)
{
this.currentRitualString = str;
}
@Override
public Packet getDescriptionPacket()
{
return NewPacketHandler.getPacket(this);
}
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;
}
}

View file

@ -0,0 +1,8 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import net.minecraft.tileentity.TileEntity;
public class TEReagentConduit extends TileEntity
{
}

View file

@ -19,6 +19,8 @@ import WayofTime.alchemicalWizardry.common.IBindingAgent;
import WayofTime.alchemicalWizardry.common.ICatalyst;
import WayofTime.alchemicalWizardry.common.IFillingAgent;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.alchemy.CombinedPotionRegistry;
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;
@ -288,6 +290,30 @@ public class TEWritingTable extends TileEntity implements IInventory
return -1;
}
public boolean containsCombinationCatalyst()
{
if (getCombinationCatalystPosition() != -1)
{
return true;
} else
{
return false;
}
}
public int getCombinationCatalystPosition()
{
for (int i = 1; i <= 5; i++)
{
if (inv[i] != null && inv[i].getItem() instanceof ICombinationalCatalyst)
{
return i;
}
}
return -1;
}
public boolean containsRegisteredPotionIngredient()
{
@ -615,7 +641,6 @@ public class TEWritingTable extends TileEntity implements IInventory
}
} else if (this.containsFillingAgent() && this.containsPotionFlask())
{
//TODO
if (getStackInSlot(6) == null)
{
progress++;
@ -661,7 +686,55 @@ public class TEWritingTable extends TileEntity implements IInventory
}
}
}
} else
}
else if (this.containsPotionFlask() && this.containsCombinationCatalyst())
{
//TODO
if (getStackInSlot(6) == null && CombinedPotionRegistry.hasCombinablePotionEffect(inv[this.getPotionFlaskPosition()]))
{
progress++;
if (worldTime % 4 == 0)
{
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
if (progress >= progressNeeded)
{
ItemStack flaskStack = inv[this.getPotionFlaskPosition()];
//ItemStack ingredientStack = inv[this.getRegisteredPotionIngredientPosition()];
ItemStack combinationCatalyst = inv[this.getCombinationCatalystPosition()];
if (flaskStack == null || combinationCatalyst == null)
{
progress = 0;
if (worldObj != null)
{
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return;
}
ItemStack newFlask = CombinedPotionRegistry.applyPotionEffect(flaskStack);
if(newFlask != null)
{
this.setInventorySlotContents(6, newFlask);
this.decrStackSize(this.getPotionFlaskPosition(), 1);
this.decrStackSize(this.getCombinationCatalystPosition(), 1);
progress = 0;
if (worldObj != null)
{
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
}
}
}
else
{
if (!isRecipeValid())
{