Attempt to fix repository

This commit is contained in:
WayofTime 2015-07-31 12:09:09 -04:00
parent e242207d50
commit 1aac4686db
932 changed files with 39272 additions and 11544 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;
@ -8,28 +15,19 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IChatComponent;
import net.minecraftforge.common.util.Constants;
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.minecraftforge.common.util.ForgeDirection;
public class TEAlchemicalCalcinator extends TEReagentConduit implements IInventory, IUpdatePlayerListBox
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 progress;
public int progress;
public TEAlchemicalCalcinator()
public TEAlchemicCalcinator()
{
super(1, Reagent.REAGENT_SIZE * 4);
this.inv = new ItemStack[2];
@ -99,9 +97,9 @@ public class TEAlchemicalCalcinator extends TEReagentConduit implements IInvento
}
@Override
public void update()
public void updateEntity()
{
super.update();
super.updateEntity();
if (!worldObj.isRemote)
{
@ -113,12 +111,12 @@ public class TEAlchemicalCalcinator extends TEReagentConduit implements IInvento
public void moveBufferToMain()
{
ReagentStack amountStack = this.bufferTank.drain(bufferTransferRate, false);
int drainAmount = this.fill(EnumFacing.UP, amountStack, false);
int drainAmount = this.fill(ForgeDirection.UNKNOWN, amountStack, false);
if (drainAmount > 0)
{
ReagentStack drainedStack = this.bufferTank.drain(drainAmount, true);
this.fill(EnumFacing.UP, drainedStack, true);
this.fill(ForgeDirection.UNKNOWN, drainedStack, true);
}
}
@ -127,7 +125,6 @@ public class TEAlchemicalCalcinator extends TEReagentConduit implements IInvento
int lpPerTick = 10;
int ticksPerReagent = 200;
ItemStack reagentItemStack = this.getStackInSlot(1);
if (reagentItemStack == null)
{
progress = 0;
@ -161,7 +158,7 @@ public class TEAlchemicalCalcinator extends TEReagentConduit implements IInvento
if (worldObj.getWorldTime() % 4 == 0)
{
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
if (progress >= ticksPerReagent)
@ -255,14 +252,14 @@ public class TEAlchemicalCalcinator extends TEReagentConduit implements IInvento
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeClientNBT(nbttagcompound);
return new S35PacketUpdateTileEntity(pos, -999, nbttagcompound);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{
super.onDataPacket(net, packet);
readClientNBT(packet.getNbtCompound());
readClientNBT(packet.func_148857_g());
}
@Override
@ -287,7 +284,7 @@ public class TEAlchemicalCalcinator extends TEReagentConduit implements IInvento
stack.stackSize = getInventoryStackLimit();
}
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
@Override
@ -336,23 +333,27 @@ public class TEAlchemicalCalcinator extends TEReagentConduit implements IInvento
@Override
public boolean isUseableByPlayer(EntityPlayer player)
{
return worldObj.getTileEntity(pos) == this && pos.distanceSqToCenter(player.posX, player.posY, player.posZ) < 64;
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64;
}
@Override
public void openInventory(EntityPlayer player) {}
public void openInventory()
{
}
@Override
public void closeInventory(EntityPlayer player) {}
public void closeInventory()
{
}
@Override
public String getName()
public String getInventoryName()
{
return "AlchemicCalcinator";
}
@Override
public boolean hasCustomName()
public boolean hasCustomInventoryName()
{
return false;
}
@ -364,37 +365,13 @@ public class TEAlchemicalCalcinator extends TEReagentConduit implements IInvento
}
@Override
public int fill(EnumFacing from, ReagentStack resource, boolean doFill)
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill)
{
if (doFill && !worldObj.isRemote)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return super.fill(from, resource, doFill);
}
@Override
public IChatComponent getDisplayName()
{
return null;
}
@Override
public int getField(int id)
{
return 0;
}
@Override
public void setField(int id, int value) {}
@Override
public int getFieldCount()
{
return 0;
}
@Override
public void clear() {}
}

View file

@ -3,7 +3,6 @@ package WayofTime.alchemicalWizardry.common.tileEntity;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -11,13 +10,11 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidEvent;
@ -37,7 +34,7 @@ import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.AltarUpgradeCompone
import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.UpgradedAltars;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, IBloodAltar, IUpdatePlayerListBox
public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, IBloodAltar
{
public static final int sizeInv = 1;
@ -106,6 +103,11 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
return filledAmount;
}
public int getRSPowerOutput()
{
return 5;
}
public void addToDemonBloodDuration(int dur)
{
@ -244,7 +246,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
}
@Override
public String getName()
public String getInventoryName()
{
return "TEAltar";
}
@ -337,7 +339,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
return 0;
}
if (resource.getFluid() != (new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 1)).getFluid())
if (resource.getFluidID() != (new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 1)).getFluidID())
{
return 0;
}
@ -362,7 +364,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
fluidInput = new FluidStack(resource, Math.min(bufferCapacity, resource.amount));
if (tile != null)
{
FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorld(), tile.getPos(), this, fluidInput.amount));
FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this));
}
return fluidInput.amount;
@ -386,7 +388,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
if (tile != null)
{
FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorld(), tile.getPos(), this, fluidInput.amount));
FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this));
}
return filled;
@ -420,7 +422,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
if (this != null)
{
FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluidOutput, this.worldObj, this.pos, this, fluidOutput.amount));
FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluidOutput, this.worldObj, this.xCoord, this.yCoord, this.zCoord, this));
}
}
@ -431,7 +433,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
if (worldObj != null)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return stack;
@ -439,13 +441,13 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
//Logic for the actual block is under here
@Override
public void update()
public void updateEntity()
{
this.decrementDemonBlood();
if(this.hasDemonBlood() && !worldObj.isRemote)
{
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
if (this.lockdownDuration > 0)
@ -461,18 +463,23 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
if (!worldObj.isRemote && worldObj.getWorldTime() % 20 == 0)
{
{
for(EnumFacing facing : EnumFacing.VALUES)
{
BlockPos newPos = pos.offset(facing);
IBlockState state = worldObj.getBlockState(newPos);
Block block = state.getBlock();
block.onNeighborBlockChange(worldObj, newPos, state, this.getBlockType());
}
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);
}
if (AlchemicalWizardry.lockdownAltar)
{
List<EntityPlayer> list = SpellHelper.getPlayersInRange(worldObj, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 15, 15);
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);
@ -504,8 +511,8 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
if(worldObj.getWorldTime() % Math.max(20 - this.accelerationUpgrades, 1) == 0)
{
int syphonMax = (int) (20 * this.dislocationMultiplier);
int fluidInputted;
int fluidOutputted;
int fluidInputted = 0;
int fluidOutputted = 0;
fluidInputted = Math.min(syphonMax, -this.fluid.amount + capacity);
fluidInputted = Math.min(this.fluidInput.amount, fluidInputted);
this.fluid.amount += fluidInputted;
@ -559,7 +566,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
if (worldTime % 4 == 0)
{
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
if (progress >= liquidRequired * stackSize)
@ -576,7 +583,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
for (int i = 0; i < 8; i++)
{
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos.getX(), pos.getY(), pos.getZ(), 20, worldObj.provider.getDimensionId(), 4, pos.getX() + 0.5f, pos.getY() + 1.0f, pos.getZ() + 0.5f);
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 4, xCoord + 0.5f, yCoord + 1.0f, zCoord + 0.5f);
}
this.isActive = false;
}
@ -586,7 +593,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
if (worldTime % 2 == 0)
{
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 2, pos);
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 2, xCoord, yCoord, zCoord);
}
}
} else
@ -623,13 +630,13 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
if (worldTime % 4 == 0)
{
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 3, pos);
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 3, xCoord, yCoord, zCoord);
}
}
}
if (worldObj != null)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
@ -683,9 +690,9 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
}
}
FluidStack flMain = new FluidStack(AlchemicalWizardry.lifeEssenceFluid, fluidData[1]); //First parameter was fluidData[0] --Checking to see if this will cause issues or not
FluidStack flIn = new FluidStack(AlchemicalWizardry.lifeEssenceFluid, fluidData[3]); //" "
FluidStack flOut = new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 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);
@ -721,7 +728,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
{
if (worldObj != null)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
this.checkAndSetAltar();
@ -753,7 +760,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
public void checkAndSetAltar()
{
boolean checkUpgrade = true;
int upgradeState = UpgradedAltars.isAltarValid(worldObj, pos);
int upgradeState = UpgradedAltars.isAltarValid(worldObj, xCoord, yCoord, zCoord);
if (upgradeState <= 1)
{
@ -770,7 +777,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
return;
}
AltarUpgradeComponent upgrades = UpgradedAltars.getUpgrades(worldObj, pos, upgradeState);
AltarUpgradeComponent upgrades = UpgradedAltars.getUpgrades(worldObj, xCoord, yCoord, zCoord, upgradeState);
if (upgrades == null)
{
@ -816,7 +823,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
this.fluidInput.amount = this.bufferCapacity;
}
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
@Override
@ -826,7 +833,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
}
@Override
public int fill(EnumFacing from, FluidStack resource, boolean doFill)
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
{
//TODO
if (resource == null)
@ -844,7 +851,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
}
@Override
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain)
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
{
if (resource == null)
{
@ -860,26 +867,26 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
}
@Override
public FluidStack drain(EnumFacing from, int maxEmpty, boolean doDrain)
public FluidStack drain(ForgeDirection from, int maxEmpty, boolean doDrain)
{
return this.drain(maxEmpty, doDrain);
}
@Override
public boolean canFill(EnumFacing from, Fluid fluid)
public boolean canFill(ForgeDirection from, Fluid fluid)
{
//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());
}
@Override
public boolean canDrain(EnumFacing from, Fluid fluid)
public boolean canDrain(ForgeDirection from, Fluid fluid)
{
return true;
}
@Override
public FluidTankInfo[] getTankInfo(EnumFacing from)
public FluidTankInfo[] getTankInfo(ForgeDirection from)
{
FluidTank compositeTank = new FluidTank(capacity);
compositeTank.setFluid(fluid);
@ -926,7 +933,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
public void sendChatInfoToPlayer(EntityPlayer player)
{
player.addChatMessage(new ChatComponentTranslation(String.format("message.altar.currentessence"), this.fluid.amount));
player.addChatMessage(new ChatComponentTranslation(String.format("message.altar.currenttier"), UpgradedAltars.isAltarValid(worldObj, pos)));
player.addChatMessage(new ChatComponentTranslation(String.format("message.altar.currenttier"), UpgradedAltars.isAltarValid(worldObj, xCoord, yCoord, zCoord)));
player.addChatMessage(new ChatComponentTranslation(String.format("message.altar.capacity"), this.getCapacity()));
}

View file

@ -1,22 +1,19 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
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;
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;
public class TEBelljar extends TEReagentConduit
public class TEBellJar extends TEReagentConduit
{
public TEBelljar()
public TEBellJar()
{
super(1, 16000);
this.maxConnextions = 1;
@ -39,7 +36,7 @@ public class TEBelljar extends TEReagentConduit
public static ReagentContainerInfo[] getContainerInfoFromItem(ItemStack stack)
{
if (stack != null && stack.getItem() instanceof ItemBlock && ModBlocks.blockCrystalBelljar == ((ItemBlock) stack.getItem()).getBlock())
if (stack != null && stack.getItem() instanceof ItemBlock && ModBlocks.blockCrystalBelljar == ((ItemBlock) stack.getItem()).field_150939_a)
{
NBTTagCompound tag = stack.getTagCompound();
if (tag != null)
@ -101,19 +98,24 @@ public class TEBelljar extends TEReagentConduit
}
@Override
public void update()
public void updateEntity()
{
super.update();
super.updateEntity();
if (hasChanged == 1)
{
for(EnumFacing facing : EnumFacing.VALUES)
{
BlockPos newPos = pos.offset(facing);
IBlockState state = worldObj.getBlockState(newPos);
Block block = state.getBlock();
block.onNeighborBlockChange(worldObj, newPos, state, this.getBlockType());
}
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

@ -17,9 +17,16 @@ public class TEConduit extends TESpellBlock
super.writeToNBT(par1NBTTagCompound);
}
//Logic for the actual block is under here
@Override
protected void applySpellChange(SpellParadigm parad)
public void updateEntity()
{
}
@Override
protected void applySpellChange(SpellParadigm parad)
{
return;
}
}

View file

@ -4,7 +4,6 @@ import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -12,33 +11,31 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import WayofTime.alchemicalWizardry.api.sacrifice.IIncense;
import WayofTime.alchemicalWizardry.api.sacrifice.PlayerSacrificeHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class TECrucible extends TEInventory implements IUpdatePlayerListBox
public class TECrucible extends TEInventory
{
private float rColour;
private float gColour;
private float bColour;
private int ticksRemaining = 0;
private int minValue = 0;
private int maxValue = 0;
private float incrementValue = 0;
private int radius = 5;
private int state = 0; //0 is when it gives off gray particles, 1 is when it gives off white particles (player can't use this incense anymore), 2 is the normal colour of the incense, 3 means no particles (it is out)
public float rColour;
public float gColour;
public float bColour;
public int ticksRemaining = 0;
public int minValue = 0;
public int maxValue = 0;
public float incrementValue = 0;
public int state = 0; //0 is when it gives off gray particles, 1 is when it gives off white particles (player can't use this incense anymore), 2 is the normal colour of the incense, 3 means no particles (it is out)
public TECrucible()
{
super(1);
float f = 1.0F;
float f = (float) 1.0F;
float f1 = f * 0.6F + 0.4F;
float f2 = f * f * 0.7F - 0.5F;
float f3 = f * f * 0.6F - 0.7F;
@ -48,18 +45,17 @@ public class TECrucible extends TEInventory implements IUpdatePlayerListBox
}
@Override
public void update()
public void updateEntity()
{
int radius = 5;
if (worldObj.isRemote) return;
if(worldObj.isRemote)
return;
boolean stateChanged = false;
if (ticksRemaining <= 0)
if(ticksRemaining <= 0)
{
ItemStack stack = this.getStackInSlot(0);
if (stack != null && stack.getItem() instanceof IIncense)
if(stack != null && stack.getItem() instanceof IIncense)
{
IIncense incense = (IIncense)stack.getItem();
@ -85,7 +81,7 @@ public class TECrucible extends TEInventory implements IUpdatePlayerListBox
if(ticksRemaining > 0)
{
List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(worldObj, pos.getX(), pos.getY(), pos.getZ(), radius, radius);
List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, radius, radius);
if(playerList != null && !playerList.isEmpty())
{
@ -118,7 +114,7 @@ public class TECrucible extends TEInventory implements IUpdatePlayerListBox
if(state != 0)
{
state = 0;
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
updateNeighbors();
}
}
@ -127,14 +123,14 @@ public class TECrucible extends TEInventory implements IUpdatePlayerListBox
if(state != 0)
{
state = 0;
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
updateNeighbors();
}
}
if(stateChanged)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
updateNeighbors();
}
@ -142,30 +138,35 @@ public class TECrucible extends TEInventory implements IUpdatePlayerListBox
private void updateNeighbors()
{
for(EnumFacing facing : EnumFacing.VALUES)
{
BlockPos newPos = pos.offset(facing);
IBlockState state = worldObj.getBlockState(newPos);
Block block = state.getBlock();
block.onNeighborBlockChange(worldObj, newPos, state, this.getBlockType());
}
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);
}
public void spawnClientParticle(World world, BlockPos blockPos, Random rand)
public void spawnClientParticle(World world, int x, int y, int z, Random rand)
{
switch(state)
{
case 0:
world.spawnParticle(EnumParticleTypes.REDSTONE, blockPos.getX() + 0.5D + rand.nextGaussian() / 8, blockPos.getY() + 0.7D, blockPos.getZ() + 0.5D + rand.nextGaussian() / 8, 0.15, 0.15, 0.15);
world.spawnParticle("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 0.7D, z + 0.5D + rand.nextGaussian() / 8, 0.15, 0.15, 0.15);
break;
case 1:
world.spawnParticle(EnumParticleTypes.REDSTONE, blockPos.getX() + 0.5D + rand.nextGaussian() / 8, blockPos.getY() + 0.7D, blockPos.getZ() + 0.5D + rand.nextGaussian() / 8, 1.0, 1.0, 1.0);
world.spawnParticle("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 0.7D, z + 0.5D + rand.nextGaussian() / 8, 1.0, 1.0, 1.0);
break;
case 2:
world.spawnParticle(EnumParticleTypes.REDSTONE, blockPos.getX() + 0.5D + rand.nextGaussian() / 8, blockPos.getY() + 0.7D, blockPos.getZ() + 0.5D + rand.nextGaussian() / 8, rColour, gColour, bColour);
world.spawnParticle(EnumParticleTypes.FLAME, blockPos.getX() + 0.5D + rand.nextGaussian() / 32, blockPos.getY() + 0.7D, blockPos.getZ() + 0.5D + rand.nextGaussian() / 32, 0, 0.02, 0);
world.spawnParticle("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 0.7D, z + 0.5D + rand.nextGaussian() / 8, rColour, gColour, bColour);
world.spawnParticle("flame", x + 0.5D + rand.nextGaussian() / 32, y + 0.7D, z + 0.5D + rand.nextGaussian() / 32, 0, 0.02, 0);
break;
case 3:
@ -247,18 +248,18 @@ public class TECrucible extends TEInventory implements IUpdatePlayerListBox
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeClientNBT(nbttagcompound);
return new S35PacketUpdateTileEntity(pos, 90210, nbttagcompound);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 90210, nbttagcompound);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{
super.onDataPacket(net, packet);
readClientNBT(packet.getNbtCompound());
readClientNBT(packet.func_148857_g());
}
@Override
public String getName()
public String getInventoryName()
{
return "TECrucible";
}
@ -266,7 +267,7 @@ public class TECrucible extends TEInventory implements IUpdatePlayerListBox
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack)
{
return stack != null && stack.getItem() instanceof IIncense;
return stack != null ? stack.getItem() instanceof IIncense : false;
}
public int getRSPowerOutput()

View file

@ -4,14 +4,13 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntitySkull;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.simple.HomSpell;
import WayofTime.alchemicalWizardry.common.spell.simple.HomSpellRegistry;
public class TESpellTable extends TileEntity
public class TEHomHeart extends TileEntity
{
public boolean canCastSpell()
public boolean canCastSpell(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
return true;
}
@ -72,25 +71,73 @@ public class TESpellTable extends TileEntity
public HomSpell getSpell()
{
for(EnumFacing face : EnumFacing.HORIZONTALS)
{
TileEntity tileEntity = worldObj.getTileEntity(pos.offset(face));
TileEntity tileEntity = worldObj.getTileEntity(xCoord - 1, yCoord, zCoord);
if (tileEntity instanceof TEAltar)
if (tileEntity instanceof TEAltar)
{
ItemStack itemStack = ((TEAltar) tileEntity).getStackInSlot(0);
if (itemStack != null)
{
ItemStack itemStack = ((TEAltar) tileEntity).getStackInSlot(0);
HomSpell spell = HomSpellRegistry.getSpellForItemStack(itemStack);
if (itemStack != null)
if (spell != null)
{
HomSpell spell = HomSpellRegistry.getSpellForItemStack(itemStack);
if (spell != null)
{
return spell;
}
return spell;
}
}
}
}
tileEntity = worldObj.getTileEntity(xCoord + 1, yCoord, zCoord);
if (tileEntity instanceof TEAltar)
{
ItemStack itemStack = ((TEAltar) tileEntity).getStackInSlot(0);
if (itemStack != null)
{
HomSpell spell = HomSpellRegistry.getSpellForItemStack(itemStack);
if (spell != null)
{
return spell;
}
}
}
tileEntity = worldObj.getTileEntity(xCoord, yCoord, zCoord - 1);
if (tileEntity instanceof TEAltar)
{
ItemStack itemStack = ((TEAltar) tileEntity).getStackInSlot(0);
if (itemStack != null)
{
HomSpell spell = HomSpellRegistry.getSpellForItemStack(itemStack);
if (spell != null)
{
return spell;
}
}
}
tileEntity = worldObj.getTileEntity(xCoord, yCoord, zCoord + 1);
if (tileEntity instanceof TEAltar)
{
ItemStack itemStack = ((TEAltar) tileEntity).getStackInSlot(0);
if (itemStack != null)
{
HomSpell spell = HomSpellRegistry.getSpellForItemStack(itemStack);
if (spell != null)
{
return spell;
}
}
}
return null;
}
@ -99,11 +146,11 @@ public class TESpellTable extends TileEntity
{
//TODO change so that it works with a Tile Entity for a custom head or whatnot
TileEntity tileEntity = worldObj.getTileEntity(pos.offsetUp());
TileEntity tileEntity = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord);
if (tileEntity instanceof TileEntitySkull)
{
int skullType = ((TileEntitySkull) tileEntity).getSkullType();
int skullType = ((TileEntitySkull) tileEntity).func_145904_a();
switch (skullType)
{

View file

@ -6,7 +6,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IChatComponent;
import net.minecraftforge.common.util.Constants;
/**
@ -66,16 +65,16 @@ public abstract class TEInventory extends TileEntity implements IInventory
public void setInventorySlotContents(int slot, ItemStack stack)
{
inv[slot] = stack;
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
if (stack != null && stack.stackSize > getInventoryStackLimit())
stack.stackSize = getInventoryStackLimit();
}
@Override
public abstract String getName();
public abstract String getInventoryName();
@Override
public boolean hasCustomName()
public boolean hasCustomInventoryName()
{
return false;
}
@ -89,17 +88,17 @@ public abstract class TEInventory extends TileEntity implements IInventory
@Override
public boolean isUseableByPlayer(EntityPlayer player)
{
return worldObj.getTileEntity(this.pos) == this
&& player.getDistanceSqToCenter(pos) < 64;
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this
&& player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64;
}
@Override
public void openInventory(EntityPlayer player)
public void openInventory()
{
}
@Override
public void closeInventory(EntityPlayer player)
public void closeInventory()
{
}
@ -148,28 +147,4 @@ public abstract class TEInventory extends TileEntity implements IInventory
{
inv = new ItemStack[inv.length];
}
@Override
public int getField(int id) {
// TODO Auto-generated method stub
return 0;
}
@Override
public void setField(int id, int value) {
// TODO Auto-generated method stub
}
@Override
public int getFieldCount() {
// TODO Auto-generated method stub
return 0;
}
@Override
public IChatComponent getDisplayName() {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -11,16 +11,14 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
@ -33,8 +31,9 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualBreakMethod;
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.common.eventhandler.Event;
public class TEMasterStone extends TileEntity implements IMasterRitualStone, IUpdatePlayerListBox
public class TEMasterStone extends TileEntity implements IMasterRitualStone
{
private String currentRitualString;
private boolean isActive;
@ -56,7 +55,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone, IUp
public TEMasterStone()
{
tanks = new ReagentContainer[]{new ReagentContainer(1000), new ReagentContainer(1000), new ReagentContainer(1000)};
this.attunedTankMap = new HashMap<Reagent, Integer>();
this.attunedTankMap = new HashMap();
isActive = false;
owner = "";
@ -152,7 +151,9 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone, IUp
{
newStorage.readFromNBT(localStorageTag);
storage = newStorage;
storage.setLocation(pos);
storage.xCoord = xCoord;
storage.yCoord = yCoord;
storage.zCoord = zCoord;
}
}
@ -214,7 +215,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone, IUp
return;
}
String testRitual = Rituals.checkValidRitual(world, pos);
String testRitual = Rituals.checkValidRitual(world, xCoord, yCoord, zCoord);
if (testRitual.equals(""))
{
@ -270,7 +271,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone, IUp
for (int i = 0; i < 12; i++)
{
SpellHelper.sendIndexedParticleToAllAround(world, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
SpellHelper.sendIndexedParticleToAllAround(world, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
}else
{
@ -290,11 +291,11 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone, IUp
var1 = 0;
currentRitualString = testRitual;
storage = Rituals.getLocalStorage(currentRitualString);
storage.setLocation(pos);
storage.setLocation(new Int3(xCoord, yCoord, zCoord));
isActive = true;
isRunning = true;
direction = Rituals.getDirectionOfRitual(world, pos, testRitual);
worldObj.markBlockForUpdate(pos);
direction = Rituals.getDirectionOfRitual(world, xCoord, yCoord, zCoord, testRitual);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
public void setOwner(String owner)
@ -313,7 +314,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone, IUp
}
@Override
public void update()
public void updateEntity()
{
if (isRunning && runningTime < 100)
{
@ -337,26 +338,26 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone, IUp
if (worldTime % 100 == 0)
{
boolean testRunes = Rituals.checkDirectionOfRitualValid(worldObj, pos, currentRitualString, direction);
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
boolean testRunes = Rituals.checkDirectionOfRitualValid(worldObj, xCoord, yCoord, zCoord, currentRitualString, direction);
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
if (!testRunes)
{
Rituals.onRitualBroken(this, currentRitualString, RitualBreakMethod.BREAK_STONE);
isActive = false;
currentRitualString = "";
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
return;
}
}
if (worldObj.getStrongPower(pos) > 0)
if (worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0)
{
if (isRunning)
{
Rituals.onRitualBroken(this, this.currentRitualString, RitualBreakMethod.REDSTONE);
isRunning = false;
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return;
@ -365,14 +366,14 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone, IUp
if (!isRunning)
{
isRunning = true;
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
performRitual(worldObj, pos, currentRitualString);
performRitual(worldObj, xCoord, yCoord, zCoord, currentRitualString);
}
public void performRitual(World world, BlockPos pos, String currentRitualString)
public void performRitual(World world, int x, int y, int z, String currentRitualString)
{
Rituals.performEffect(this, currentRitualString);
}
@ -407,7 +408,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone, IUp
Rituals.onRitualBroken(this, this.currentRitualString, RitualBreakMethod.DEACTIVATE);
this.isActive = active;
this.isRunning = active;
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
public int getDirection()
@ -416,15 +417,27 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone, IUp
}
@Override
public World getWorldObj()
public World getWorld()
{
return this.getWorld();
return this.getWorldObj();
}
@Override
public BlockPos getPosition()
public int getXCoord()
{
return this.getPos();
return xCoord;
}
@Override
public int getYCoord()
{
return yCoord;
}
@Override
public int getZCoord()
{
return zCoord;
}
public String getCurrentRitual()
@ -442,29 +455,30 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone, IUp
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeClientNBT(nbttagcompound);
return new S35PacketUpdateTileEntity(pos, -999, nbttagcompound);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{
super.onDataPacket(net, packet);
readClientNBT(packet.getNbtCompound());
readClientNBT(packet.func_148857_g());
}
public AxisAlignedBB getRenderBoundingBox()
{
double renderExtension = 1.0d;
return new AxisAlignedBB(pos.add(-renderExtension, -renderExtension, -renderExtension), pos.add(1 + renderExtension, 1 + renderExtension, 1 + renderExtension));
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(EnumFacing from, ReagentStack resource, boolean doFill)
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill)
{
if (doFill)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
int totalFill = 0;
@ -531,7 +545,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone, IUp
}
@Override
public ReagentStack drain(EnumFacing from, ReagentStack resource, boolean doDrain)
public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain)
{
if (resource == null)
{
@ -540,7 +554,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone, IUp
if (doDrain)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
int maxDrain = resource.amount;
@ -569,7 +583,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone, IUp
/* Only returns the amount from the first available tank */
@Override
public ReagentStack drain(EnumFacing from, int maxDrain, boolean doDrain)
public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
{
for (int i = 0; i < tanks.length; i++)
{
@ -578,7 +592,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone, IUp
{
if (doDrain)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return stack;
@ -589,19 +603,19 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone, IUp
}
@Override
public boolean canFill(EnumFacing from, Reagent reagent)
public boolean canFill(ForgeDirection from, Reagent reagent)
{
return true;
}
@Override
public boolean canDrain(EnumFacing from, Reagent reagent)
public boolean canDrain(ForgeDirection from, Reagent reagent)
{
return true;
}
@Override
public ReagentContainerInfo[] getContainerInfo(EnumFacing from)
public ReagentContainerInfo[] getContainerInfo(ForgeDirection from)
{
ReagentContainerInfo[] info = new ReagentContainerInfo[this.getNumberOfTanks()];
for (int i = 0; i < this.getNumberOfTanks(); i++)

View file

@ -1,7 +1,6 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
@ -10,9 +9,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import WayofTime.alchemicalWizardry.ModBlocks;
@ -21,7 +18,7 @@ import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm;
import WayofTime.alchemicalWizardry.common.omega.OmegaRegistry;
public class TEMimicBlock extends TileEntity implements IUpdatePlayerListBox
public class TEMimicBlock extends TileEntity
{
private ItemStack[] inv;
public Reagent reagent;
@ -40,14 +37,14 @@ public class TEMimicBlock extends TileEntity implements IUpdatePlayerListBox
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeToNBT(nbttagcompound);
return new S35PacketUpdateTileEntity(pos, -999, nbttagcompound);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{
super.onDataPacket(net, packet);
readFromNBT(packet.getNbtCompound());
readFromNBT(packet.func_148857_g());
}
@Override
@ -94,8 +91,10 @@ public class TEMimicBlock extends TileEntity implements IUpdatePlayerListBox
}
@Override
public void update()
public void updateEntity()
{
super.updateEntity();
this.ticksRemaining--;
if (this.ticksRemaining <= 0)
@ -104,35 +103,34 @@ public class TEMimicBlock extends TileEntity implements IUpdatePlayerListBox
}
}
public static boolean createMimicBlockAtLocation(World world, BlockPos pos, int duration, IBlockState state, Reagent reagent)
public static boolean createMimicBlockAtLocation(World world, int x, int y, int z, int duration, Block block, int meta, Reagent reagent)
{
Block block = state.getBlock();
if (block == null)
{
return false;
}
TileEntity tileEntity = world.getTileEntity(pos);
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity == null && world.isAirBlock(pos))
if (tileEntity == null && world.isAirBlock(x, y, z))
{
ItemStack item = new ItemStack(block, 1, block.getMetaFromState(state));
ItemStack item = new ItemStack(block, 1, meta);
world.setBlockState(pos, ModBlocks.blockMimic.getDefaultState());
TileEntity tile = world.getTileEntity(pos);
world.setBlock(x, y, z, ModBlocks.blockMimic);
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TEMimicBlock)
{
((TEMimicBlock) tile).setContainedItem(item);
((TEMimicBlock) tile).setDuration(duration);
((TEMimicBlock) tile).reagent = reagent;
world.markBlockForUpdate(pos);
world.markBlockForUpdate(x, y, z);
return true;
}
}else
{
if(tileEntity instanceof TEMimicBlock)
{
if(((TEMimicBlock) tileEntity).getBlock() == block)
if(((TEMimicBlock) tileEntity).getBlock() == block && ((TEMimicBlock) tileEntity).getMetaOfMimic() == meta)
{
((TEMimicBlock) tileEntity).ticksRemaining = Math.max(duration, ((TEMimicBlock) tileEntity).ticksRemaining);
}
@ -183,7 +181,7 @@ public class TEMimicBlock extends TileEntity implements IUpdatePlayerListBox
//
// } else
{
this.worldObj.setBlockToAir(pos);
this.worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
}
@ -194,8 +192,7 @@ public class TEMimicBlock extends TileEntity implements IUpdatePlayerListBox
{
if (item.getItem() instanceof ItemBlock)
{
Block block = ((ItemBlock) item.getItem()).getBlock();
return block;
return ((ItemBlock) item.getItem()).field_150939_a;
}
}
return null;
@ -212,25 +209,14 @@ public class TEMimicBlock extends TileEntity implements IUpdatePlayerListBox
return 0;
}
public IBlockState getStateOfMimic()
{
Block block = this.getBlock();
if(block == null)
{
return null;
}
return block.getStateFromMeta(getMetaOfMimic());
}
public boolean getBlockEffectWhileInside(Entity entity, BlockPos blockPos)
public boolean getBlockEffectWhileInside(Entity entity, int x, int y, int z)
{
if(reagent != null)
{
OmegaParadigm paradigm = OmegaRegistry.getParadigmForReagent(reagent);
if(paradigm != null)
{
return paradigm.getBlockEffectWhileInside(entity, blockPos);
return paradigm.getBlockEffectWhileInside(entity, x, y, z);
}
}

View file

@ -1,64 +1,64 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
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.minecraft.util.EnumFacing;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.block.IOrientable;
import net.minecraftforge.common.util.ForgeDirection;
public class TEOrientable extends TileEntity implements IOrientable
{
protected EnumFacing inputFace;
protected EnumFacing outputFace;
protected ForgeDirection inputFace;
protected ForgeDirection outputFace;
public TEOrientable()
{
this.inputFace = EnumFacing.DOWN;
this.outputFace = EnumFacing.UP;
this.inputFace = ForgeDirection.DOWN;
this.outputFace = ForgeDirection.UP;
}
@Override
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
this.setInputDirection(EnumFacing.getFront(par1NBTTagCompound.getInteger("inputFace")));
this.setOutputDirection(EnumFacing.getFront(par1NBTTagCompound.getInteger("outputFace")));
this.setInputDirection(ForgeDirection.getOrientation(par1NBTTagCompound.getInteger("inputFace")));
this.setOutputDirection(ForgeDirection.getOrientation(par1NBTTagCompound.getInteger("outputFace")));
}
@Override
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
par1NBTTagCompound.setInteger("inputFace", TEOrientable.getIntForEnumFacing(this.getInputDirection()));
par1NBTTagCompound.setInteger("outputFace", TEOrientable.getIntForEnumFacing(this.getOutputDirection()));
par1NBTTagCompound.setInteger("inputFace", TEOrientable.getIntForForgeDirection(this.getInputDirection()));
par1NBTTagCompound.setInteger("outputFace", TEOrientable.getIntForForgeDirection(this.getOutputDirection()));
}
@Override
public EnumFacing getInputDirection()
public ForgeDirection getInputDirection()
{
return this.inputFace;
}
@Override
public EnumFacing getOutputDirection()
public ForgeDirection getOutputDirection()
{
return this.outputFace;
}
@Override
public void setInputDirection(EnumFacing direction)
public void setInputDirection(ForgeDirection direction)
{
this.inputFace = direction;
}
@Override
public void setOutputDirection(EnumFacing direction)
public void setOutputDirection(ForgeDirection direction)
{
this.outputFace = direction;
}
public static int getIntForEnumFacing(EnumFacing direction)
public static int getIntForForgeDirection(ForgeDirection direction)
{
switch (direction)
{
@ -92,7 +92,7 @@ public class TEOrientable extends TileEntity implements IOrientable
}
public boolean isSideRendered(EnumFacing side)
public boolean isSideRendered(ForgeDirection side)
{
if (side.equals(this.getInputDirection()) || side.equals(this.getOutputDirection()))
{

View file

@ -46,7 +46,7 @@ public class TEPedestal extends TEInventory
}
@Override
public String getName()
public String getInventoryName()
{
return "TEPedestal";
}
@ -57,6 +57,13 @@ public class TEPedestal extends TEInventory
return 1;
}
//Logic for the actual block is under here
@Override
public void updateEntity()
{
super.updateEntity();
}
public void setActive()
{
isActive = false;
@ -127,12 +134,13 @@ public class TEPedestal extends TEInventory
public void onItemDeletion()
{
worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, pos.getX(), pos.getY(), pos.getZ()));
worldObj.markBlockForUpdate(pos);
worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, xCoord, yCoord, zCoord));
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
for (int i = 0; i < 16; i++)
{
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 2, pos);
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 2, xCoord, yCoord, zCoord);
}
}
}

View file

@ -10,9 +10,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.Packet;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistry;
@ -20,9 +18,9 @@ import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistryCompo
import WayofTime.alchemicalWizardry.common.IDemon;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.PlinthComponent;
import WayofTime.alchemicalWizardry.common.items.Orb;
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
public class TEPlinth extends TEInventory implements IUpdatePlayerListBox
public class TEPlinth extends TEInventory
{
public static final int sizeInv = 1;
@ -36,7 +34,7 @@ public class TEPlinth extends TEInventory implements IUpdatePlayerListBox
private int progressInterval;
private int progress;
public static List<PlinthComponent> pedestalPositions = new ArrayList<PlinthComponent>();
public static List<PlinthComponent> pedestalPositions = new ArrayList();
public TEPlinth()
{
@ -151,7 +149,7 @@ public class TEPlinth extends TEInventory implements IUpdatePlayerListBox
}
@Override
public String getName()
public String getInventoryName()
{
return "TEPlinth";
}
@ -164,8 +162,10 @@ public class TEPlinth extends TEInventory implements IUpdatePlayerListBox
//Logic for the actual block is under here
@Override
public void update()
public void updateEntity()
{
super.updateEntity();
if (worldObj.isRemote)
{
return;
@ -173,9 +173,9 @@ public class TEPlinth extends TEInventory implements IUpdatePlayerListBox
if (!isActive())
{
if (getStackInSlot(0) != null && getStackInSlot(0).getItem() instanceof Orb)
if (getStackInSlot(0) != null && getStackInSlot(0).getItem() instanceof EnergyBattery)
{
int bloodOrbLevel = ((Orb) getStackInSlot(0).getItem()).getOrbLevel();
int bloodOrbLevel = ((EnergyBattery) getStackInSlot(0).getItem()).getOrbLevel();
if (SummoningRegistry.isRecipeValid(bloodOrbLevel, composeItemsForRingAndParadigm(1, true), composeItemsForRingAndParadigm(2, true), composeItemsForRingAndParadigm(3, true)))
{
@ -203,7 +203,7 @@ public class TEPlinth extends TEInventory implements IUpdatePlayerListBox
}
} else
{
if (getStackInSlot(0) != null && getStackInSlot(0).getItem() instanceof Orb)
if (getStackInSlot(0) != null && getStackInSlot(0).getItem() instanceof EnergyBattery)
{
if (progress % progressInterval == 0)
{
@ -246,12 +246,12 @@ public class TEPlinth extends TEInventory implements IUpdatePlayerListBox
if (progress >= progressInterval * 18)
{
int bloodOrbLevel = ((Orb) getStackInSlot(0).getItem()).getOrbLevel();
int bloodOrbLevel = ((EnergyBattery) getStackInSlot(0).getItem()).getOrbLevel();
EntityLivingBase entity = SummoningRegistry.getEntity(worldObj, bloodOrbLevel, ring1Inv, ring2Inv, ring3Inv);
if (entity != null)
{
entity.setPosition(pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5);
entity.setPosition(xCoord + 0.5, yCoord + 1, zCoord + 0.5);
worldObj.spawnEntityInWorld(entity);
if (entity instanceof IDemon)
@ -266,7 +266,7 @@ public class TEPlinth extends TEInventory implements IUpdatePlayerListBox
if (worldObj != null)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
}
@ -284,13 +284,12 @@ public class TEPlinth extends TEInventory implements IUpdatePlayerListBox
{
if (i < 6 && pc.getRing() == ring)
{
BlockPos newPos = pos.add(pc.xOffset, pc.yOffset, pc.zOffset);
TileEntity tileEntity = worldObj.getTileEntity(newPos);
TileEntity tileEntity = worldObj.getTileEntity(xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset);
if (tileEntity instanceof TEPedestal)
{
((TEPedestal) tileEntity).setInventorySlotContents(0, null);
worldObj.markBlockForUpdate(newPos);
worldObj.markBlockForUpdate(xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset);
i++;
}
}
@ -303,13 +302,12 @@ public class TEPlinth extends TEInventory implements IUpdatePlayerListBox
{
if (i < 6 && pc.getRing() == ring)
{
BlockPos newPos = pos.add(pc.zOffset, pc.yOffset, pc.xOffset);
TileEntity tileEntity = worldObj.getTileEntity(newPos);
TileEntity tileEntity = worldObj.getTileEntity(xCoord + pc.zOffset, yCoord + pc.yOffset, zCoord + pc.xOffset);
if (tileEntity instanceof TEPedestal)
{
((TEPedestal) tileEntity).setInventorySlotContents(0, null);
worldObj.markBlockForUpdate(newPos);
worldObj.markBlockForUpdate(xCoord + pc.zOffset, yCoord + pc.yOffset, zCoord + pc.xOffset);
i++;
}
}
@ -332,8 +330,7 @@ public class TEPlinth extends TEInventory implements IUpdatePlayerListBox
{
if (i < 6 && pc.getRing() == ring)
{
BlockPos newPos = pos.add(pc.xOffset, pc.yOffset, pc.zOffset);
TileEntity tileEntity = worldObj.getTileEntity(newPos);
TileEntity tileEntity = worldObj.getTileEntity(xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset);
if (tileEntity instanceof TEPedestal)
{
@ -368,7 +365,7 @@ public class TEPlinth extends TEInventory implements IUpdatePlayerListBox
((TEPedestal) tileEntity).setInventorySlotContents(0, null);
}
((TEPedestal) tileEntity).onItemDeletion();
worldObj.markBlockForUpdate(newPos);
worldObj.markBlockForUpdate(xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset);
return true;
}
}
@ -385,8 +382,7 @@ public class TEPlinth extends TEInventory implements IUpdatePlayerListBox
{
if (i < 6 && pc.getRing() == ring)
{
BlockPos newPos = pos.add(pc.zOffset, pc.yOffset, pc.xOffset);
TileEntity tileEntity = worldObj.getTileEntity(newPos);
TileEntity tileEntity = worldObj.getTileEntity(xCoord + pc.zOffset, yCoord + pc.yOffset, zCoord + pc.xOffset);
if (tileEntity instanceof TEPedestal)
{
@ -417,7 +413,7 @@ public class TEPlinth extends TEInventory implements IUpdatePlayerListBox
{
((TEPedestal) tileEntity).decrStackSize(0, 1);
((TEPedestal) tileEntity).onItemDeletion();
worldObj.markBlockForUpdate(newPos);
worldObj.markBlockForUpdate(xCoord + pc.zOffset, yCoord + pc.yOffset, zCoord + pc.zOffset);
return true;
}
}
@ -443,8 +439,7 @@ public class TEPlinth extends TEInventory implements IUpdatePlayerListBox
{
if (i < 6 && pc.getRing() == ring)
{
BlockPos newPos = pos.add(pc.xOffset, pc.yOffset, pc.zOffset);
TileEntity tileEntity = worldObj.getTileEntity(newPos);
TileEntity tileEntity = worldObj.getTileEntity(xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset);
if (tileEntity instanceof TEPedestal)
{
@ -461,8 +456,7 @@ public class TEPlinth extends TEInventory implements IUpdatePlayerListBox
{
if (i < 6 && pc.getRing() == ring)
{
BlockPos newPos = pos.add(pc.zOffset, pc.yOffset, pc.xOffset);
TileEntity tileEntity = worldObj.getTileEntity(newPos);
TileEntity tileEntity = worldObj.getTileEntity(xCoord + pc.zOffset, yCoord + pc.yOffset, zCoord + pc.xOffset);
if (tileEntity instanceof TEPedestal)
{

View file

@ -1,11 +1,12 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import WayofTime.alchemicalWizardry.api.ColourAndCoords;
import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.api.alchemy.energy.*;
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;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
@ -13,25 +14,18 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.alchemicalWizardry.api.ColourAndCoords;
import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler;
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.alchemy.energy.TileSegmentedReagentHandler;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityParticleBeam;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraftforge.common.util.ForgeDirection;
public class TEReagentConduit extends TileSegmentedReagentHandler implements IUpdatePlayerListBox
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
public class TEReagentConduit extends TileSegmentedReagentHandler
{
public List<ColourAndCoords> destinationList; //These are offsets
public Map<Reagent, List<Int3>> reagentTargetList;
@ -54,9 +48,9 @@ public class TEReagentConduit extends TileSegmentedReagentHandler implements IUp
{
super(numberOfTanks, size);
destinationList = new LinkedList<ColourAndCoords>();
reagentTargetList = new HashMap<Reagent, List<Int3>>();
reagentTankDesignationList = new HashMap<Reagent, Integer>();
destinationList = new LinkedList();
reagentTargetList = new HashMap();
reagentTankDesignationList = new HashMap();
}
public Int3 getColour()
@ -163,7 +157,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler implements IUp
NBTTagList tagList = tag.getTagList("destinationList", Constants.NBT.TAG_COMPOUND);
destinationList = new LinkedList<ColourAndCoords>();
destinationList = new LinkedList();
for (int i = 0; i < tagList.tagCount(); i++)
{
@ -172,7 +166,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler implements IUp
destinationList.add(ColourAndCoords.readFromNBT(savedTag));
}
reagentTargetList = new HashMap<Reagent, List<Int3>>();
reagentTargetList = new HashMap();
NBTTagList reagentTagList = tag.getTagList("reagentTargetList", Constants.NBT.TAG_COMPOUND);
@ -182,7 +176,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler implements IUp
Reagent reagent = ReagentRegistry.getReagentForKey(savedTag.getString("reagent"));
List<Int3> coordList = new LinkedList<Int3>();
List<Int3> coordList = new LinkedList();
NBTTagList coordinateList = savedTag.getTagList("coordinateList", Constants.NBT.TAG_COMPOUND);
@ -194,7 +188,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler implements IUp
reagentTargetList.put(reagent, coordList);
}
reagentTankDesignationList = new HashMap<Reagent, Integer>();
reagentTankDesignationList = new HashMap();
NBTTagList tankDesignationList = tag.getTagList("tankDesignationList", Constants.NBT.TAG_COMPOUND);
@ -202,7 +196,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler implements IUp
{
NBTTagCompound savedTag = tankDesignationList.getCompoundTagAt(i);
this.reagentTankDesignationList.put(ReagentRegistry.getReagentForKey(savedTag.getString("reagent")), savedTag.getInteger("integer"));
this.reagentTankDesignationList.put(ReagentRegistry.getReagentForKey(savedTag.getString("reagent")), new Integer(savedTag.getInteger("integer")));
}
}
@ -210,7 +204,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler implements IUp
{
NBTTagList tagList = tag.getTagList("destinationList", Constants.NBT.TAG_COMPOUND);
destinationList = new LinkedList<ColourAndCoords>();
destinationList = new LinkedList();
for (int i = 0; i < tagList.tagCount(); i++)
{
@ -259,7 +253,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler implements IUp
}
@Override
public void update()
public void updateEntity()
{
if (!worldObj.isRemote)
{
@ -276,7 +270,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler implements IUp
this.updateColourList();
}
if (affectedByRedstone && worldObj.isBlockPowered(pos)) //isBlockBeingIndirectlyPowered()
if (affectedByRedstone && worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord))
{
return;
}
@ -292,7 +286,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler implements IUp
break;
}
ReagentStack maxDrainAmount = this.drain(EnumFacing.UP, new ReagentStack(entry.getKey(), this.tickRate - totalTransfered), false);
ReagentStack maxDrainAmount = this.drain(ForgeDirection.UNKNOWN, new ReagentStack(entry.getKey(), this.tickRate - totalTransfered), false);
if (maxDrainAmount == null)
{
@ -306,25 +300,28 @@ public class TEReagentConduit extends TileSegmentedReagentHandler implements IUp
continue;
}
BlockPos newPos = pos.add(coord.xCoord, coord.yCoord, coord.zCoord);
int x = xCoord + coord.xCoord;
int y = yCoord + coord.yCoord;
int z = zCoord + coord.zCoord;
TileEntity tile = worldObj.getTileEntity(newPos);
TileEntity tile = worldObj.getTileEntity(x, y, z);
if (tile instanceof IReagentHandler)
{
int amount = Math.min(((IReagentHandler) tile).fill(EnumFacing.UP, maxDrainAmount, false), amountLeft);
int amount = Math.min(((IReagentHandler) tile).fill(ForgeDirection.UNKNOWN, maxDrainAmount, false), amountLeft);
if (amount > 0)
{
amountLeft -= amount;
totalTransfered += amount;
ReagentStack stack = this.drain(EnumFacing.UP, new ReagentStack(entry.getKey(), amount), true);
((IReagentHandler) tile).fill(EnumFacing.UP, stack, true);
ReagentStack stack = this.drain(ForgeDirection.UNKNOWN, new ReagentStack(entry.getKey(), amount), true);
((IReagentHandler) tile).fill(ForgeDirection.UNKNOWN, stack, true);
}
}
}
}
} else
{
if (affectedByRedstone && worldObj.isBlockPowered(pos))
if (affectedByRedstone && worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord))
{
return;
}
@ -340,26 +337,27 @@ public class TEReagentConduit extends TileSegmentedReagentHandler implements IUp
}
}
@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)
{
BlockPos newPos = pos.add(colourSet.xCoord, colourSet.yCoord, colourSet.zCoord);
if (!(worldObj.getTileEntity(newPos) instanceof IReagentHandler))
if (!(worldObj.getTileEntity(xCoord + colourSet.xCoord, yCoord + colourSet.yCoord, zCoord + colourSet.zCoord) instanceof IReagentHandler))
{
continue;
}
EntityParticleBeam beam = new EntityParticleBeam(worldObj, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
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(pos.getX() + colourSet.xCoord, pos.getY() + colourSet.yCoord, pos.getZ() + colourSet.zCoord);
beam.setDestination(xCoord + colourSet.xCoord, yCoord + colourSet.yCoord, zCoord + colourSet.zCoord);
worldObj.spawnEntityInWorld(beam);
}
}
@ -377,13 +375,13 @@ public class TEReagentConduit extends TileSegmentedReagentHandler implements IUp
if (newList != null && !newList.equals(destinationList))
{
this.destinationList = newList;
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
public List<ColourAndCoords> compileListForReagentTargets(Map<Reagent, List<Int3>> map)
{
List<ColourAndCoords> list = new LinkedList<ColourAndCoords>();
List<ColourAndCoords> list = new LinkedList();
for (Entry<Reagent, List<Int3>> entry : map.entrySet())
{
@ -423,7 +421,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler implements IUp
public boolean addDestinationViaActual(int red, int green, int blue, int intensity, int x, int y, int z)
{
return this.addDestinationViaOffset(red, green, blue, intensity, x - pos.getX(), y - pos.getY(), z - pos.getZ());
return this.addDestinationViaOffset(red, green, blue, intensity, x - this.xCoord, y - this.yCoord, z - this.zCoord);
}
@Override
@ -431,14 +429,14 @@ public class TEReagentConduit extends TileSegmentedReagentHandler implements IUp
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeClientNBT(nbttagcompound);
return new S35PacketUpdateTileEntity(pos, 90210, nbttagcompound);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 90210, nbttagcompound);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{
super.onDataPacket(net, packet);
readClientNBT(packet.getNbtCompound());
readClientNBT(packet.func_148857_g());
}
public boolean addReagentDestinationViaOffset(Reagent reagent, int xOffset, int yOffset, int zOffset)
@ -471,7 +469,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler implements IUp
List<Int3> coordList = this.reagentTargetList.get(reagent);
if (coordList == null)
{
List<Int3> newCoordList = new LinkedList<Int3>();
List<Int3> newCoordList = new LinkedList();
newCoordList.add(newCoord);
this.reagentTargetList.put(reagent, newCoordList);
} else
@ -482,7 +480,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler implements IUp
return true;
} else
{
List<Int3> newCoordList = new LinkedList<Int3>();
List<Int3> newCoordList = new LinkedList();
newCoordList.add(newCoord);
this.reagentTargetList.put(reagent, newCoordList);
@ -492,7 +490,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler implements IUp
public boolean addReagentDestinationViaActual(Reagent reagent, int x, int y, int z)
{
return (this.addReagentDestinationViaOffset(reagent, x - pos.getX(), y - pos.getY(), z - pos.getZ()));
return (this.addReagentDestinationViaOffset(reagent, x - xCoord, y - yCoord, z - zCoord));
}
public boolean removeReagentDestinationViaOffset(Reagent reagent, int xOffset, int yOffset, int zOffset)
@ -512,15 +510,15 @@ public class TEReagentConduit extends TileSegmentedReagentHandler implements IUp
public boolean removeReagentDestinationViaActual(Reagent reagent, int x, int y, int z)
{
return this.removeReagentDestinationViaOffset(reagent, x - pos.getX(), y - pos.getY(), z - pos.getZ());
return this.removeReagentDestinationViaOffset(reagent, x - xCoord, y - yCoord, z - zCoord);
}
@Override
public int fill(EnumFacing from, ReagentStack resource, boolean doFill)
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill)
{
if (doFill && !worldObj.isRemote)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
hasChanged = 2;
}
@ -528,24 +526,14 @@ public class TEReagentConduit extends TileSegmentedReagentHandler implements IUp
}
@Override
public ReagentStack drain(EnumFacing from, ReagentStack resource, boolean doDrain)
public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain)
{
if (doDrain && !worldObj.isRemote)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
hasChanged = 2;
}
return super.drain(from, resource, doDrain);
}
public void removeReagentDestinationViaActual(Reagent reagent, BlockPos pos)
{
this.removeReagentDestinationViaActual(reagent, pos.getX(), pos.getY(), pos.getZ());
}
public boolean addReagentDestinationViaActual(Reagent reagent, BlockPos pos)
{
return addReagentDestinationViaActual(reagent, pos.getX(), pos.getY(), pos.getZ());
}
}

View file

@ -1,26 +1,24 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
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.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
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()
public void rightClickBlock(EntityPlayer player, int side)
{
BuildingSchematic schematic = new BuildingSchematic();
@ -37,15 +35,14 @@ public class TESchematicSaver extends TileEntity
{
for (int k = -negZ + 1; k <= posZ - 1; k++)
{
BlockPos newPos = pos.add(i, j, k);
IBlockState state = worldObj.getBlockState(newPos);
Block block = state.getBlock();
int meta = block.getMetaFromState(state);
int meta = worldObj.getBlockMetadata(xCoord + i, yCoord + j, zCoord + k);
Block block = worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k);
if (!block.isAir(worldObj, newPos))
if (!block.isAir(worldObj, xCoord + i, yCoord + j, zCoord + k))
{
schematic.addBlockWithMeta(block, meta, i, j, k);
}
}
}
@ -73,7 +70,7 @@ public class TESchematicSaver extends TileEntity
int i = 1;
while (i < 100)
{
if (targetBlock == (worldObj.getBlockState(pos.add(0, i, 0)).getBlock()))
if (targetBlock == (worldObj.getBlock(xCoord, yCoord + i, zCoord)))
{
return i;
}
@ -88,7 +85,7 @@ public class TESchematicSaver extends TileEntity
int i = 1;
while (i < 100)
{
if (targetBlock == (worldObj.getBlockState(pos.add(0, -i, 0)).getBlock()))
if (targetBlock == (worldObj.getBlock(xCoord, yCoord - i, zCoord)))
{
return i;
}
@ -103,7 +100,7 @@ public class TESchematicSaver extends TileEntity
int i = 1;
while (i < 100)
{
if (targetBlock == (worldObj.getBlockState(pos.add(i, 0, 0)).getBlock()))
if (targetBlock == (worldObj.getBlock(xCoord + i, yCoord, zCoord)))
{
return i;
}
@ -118,7 +115,7 @@ public class TESchematicSaver extends TileEntity
int i = 1;
while (i < 100)
{
if (targetBlock == (worldObj.getBlockState(pos.add(-i, 0, 0)).getBlock()))
if (targetBlock == (worldObj.getBlock(xCoord - i, yCoord, zCoord)))
{
return i;
}
@ -133,7 +130,7 @@ public class TESchematicSaver extends TileEntity
int i = 1;
while (i < 100)
{
if (targetBlock == (worldObj.getBlockState(pos.add(0, 0, i)).getBlock()))
if (targetBlock == (worldObj.getBlock(xCoord, yCoord, zCoord + i)))
{
return i;
}
@ -148,7 +145,7 @@ public class TESchematicSaver extends TileEntity
int i = 1;
while (i < 100)
{
if (targetBlock == (worldObj.getBlockState(pos.add(0, 0, -i)).getBlock()))
if (targetBlock == (worldObj.getBlock(xCoord, yCoord, zCoord - i)))
{
return i;
}

View file

@ -45,7 +45,7 @@ public class TESocket extends TEInventory
}
@Override
public String getName()
public String getInventoryName()
{
return "TESocket";
}
@ -56,6 +56,13 @@ public class TESocket extends TEInventory
return 1;
}
//Logic for the actual block is under here
@Override
public void updateEntity()
{
super.updateEntity();
}
public void setActive()
{
isActive = false;

View file

@ -1,13 +1,11 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.ModBlocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class TESpectralBlock extends TileEntity implements IUpdatePlayerListBox
public class TESpectralBlock extends TileEntity
{
private int ticksRemaining;
@ -33,30 +31,31 @@ public class TESpectralBlock extends TileEntity implements IUpdatePlayerListBox
}
@Override
public void update()
public void updateEntity()
{
if (worldObj.isRemote)
super.updateEntity();
// if (worldObj.isRemote)
{
return;
// return;
}
this.ticksRemaining--;
if (this.ticksRemaining <= 0)
{
worldObj.setBlockToAir(pos);
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
}
public static boolean createSpectralBlockAtLocation(World world, BlockPos pos, int duration)
public static boolean createSpectralBlockAtLocation(World world, int x, int y, int z, int duration)
{
if (!world.isAirBlock(pos))
if (!world.isAirBlock(x, y, z))
{
return false;
}
world.setBlockState(pos, ModBlocks.spectralBlock.getDefaultState());
TileEntity tile = world.getTileEntity(pos);
world.setBlock(x, y, z, ModBlocks.spectralBlock);
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TESpectralBlock)
{
((TESpectralBlock) tile).setDuration(duration);

View file

@ -1,20 +1,17 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.ModBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
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 implements IUpdatePlayerListBox
public class TESpectralContainer extends TileEntity
{
private ItemStack[] inv;
@ -69,8 +66,10 @@ public class TESpectralContainer extends TileEntity implements IUpdatePlayerList
}
@Override
public void update()
public void updateEntity()
{
super.updateEntity();
this.ticksRemaining--;
if (this.ticksRemaining <= 0)
@ -79,23 +78,22 @@ public class TESpectralContainer extends TileEntity implements IUpdatePlayerList
}
}
public static boolean createSpectralBlockAtLocation(World world, BlockPos pos, int duration)
public static boolean createSpectralBlockAtLocation(World world, int x, int y, int z, int duration)
{
IBlockState state = world.getBlockState(pos);
Block block = state.getBlock();
Block block = world.getBlock(x, y, z);
if (block == null)
{
return false;
}
if (world.getTileEntity(pos) == null || block instanceof IFluidBlock)
if (world.getTileEntity(x, y, z) == null || block instanceof IFluidBlock)
{
int meta = block.getMetaFromState(state);
int meta = world.getBlockMetadata(x, y, z);
ItemStack item = new ItemStack(block, 1, meta);
world.setBlockState(pos, ModBlocks.blockSpectralContainer.getDefaultState());
TileEntity tile = world.getTileEntity(pos);
world.setBlock(x, y, z, ModBlocks.blockSpectralContainer);
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TESpectralContainer)
{
((TESpectralContainer) tile).setContainedItem(item);
@ -132,18 +130,18 @@ public class TESpectralContainer extends TileEntity implements IUpdatePlayerList
{
if (item.getItem() instanceof ItemBlock)
{
Block block = ((ItemBlock) item.getItem()).getBlock();
Block block = ((ItemBlock) item.getItem()).field_150939_a;
int meta = item.getItemDamage();
if (block != null)
{
this.worldObj.setBlockState(pos, block.getStateFromMeta(meta), 6);
this.worldObj.setBlock(xCoord, yCoord, zCoord, block, meta, 6);
}
}
} else
{
this.worldObj.setBlockToAir(pos);
this.worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
}
}

View file

@ -1,9 +1,9 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import WayofTime.alchemicalWizardry.api.spell.SpellParadigm;
import WayofTime.alchemicalWizardry.api.tile.ISpellTile;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
public abstract class TESpellBlock extends TEOrientable implements ISpellTile
{
@ -23,9 +23,12 @@ public abstract class TESpellBlock extends TEOrientable implements ISpellTile
public TESpellBlock getTileAtOutput()
{
EnumFacing output = this.getOutputDirection();
ForgeDirection output = this.getOutputDirection();
int xOffset = output.offsetX;
int yOffset = output.offsetY;
int zOffset = output.offsetZ;
TileEntity tile = worldObj.getTileEntity(pos.add(output.getDirectionVec()));
TileEntity tile = worldObj.getTileEntity(xCoord + xOffset, yCoord + yOffset, zCoord + zOffset);
if (tile instanceof TESpellBlock && ((TESpellBlock) tile).canInputRecieveOutput(output))
{
@ -41,7 +44,7 @@ public abstract class TESpellBlock extends TEOrientable implements ISpellTile
}
@Override
public boolean canInputRecieveOutput(EnumFacing output)
public boolean canInputRecieveOutput(ForgeDirection output)
{
return this.canInputRecieve() && this.getInputDirection().getOpposite() == output;
}

View file

@ -14,7 +14,7 @@ public class TESpellEffectBlock extends TESpellBlock
public SpellEffect getSpellEffect()
{
int meta = this.getBlockMetadata();
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
switch (meta)
{
case 0:

View file

@ -37,7 +37,7 @@ public class TESpellEnhancementBlock extends TESpellBlock
public SpellEnhancement getSpellEnhancement()
{
int meta = this.getBlockMetadata();
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
switch (meta)
{
case 0:
@ -64,7 +64,7 @@ public class TESpellEnhancementBlock extends TESpellBlock
public int getLimit()
{
int meta = this.getBlockMetadata();
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
switch (meta)
{
case 0:
@ -103,7 +103,7 @@ public class TESpellEnhancementBlock extends TESpellBlock
public int enhancementType() //0 is power, 1 is cost, 2 is potency
{
int meta = this.getBlockMetadata();
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
switch (meta)
{
case 0:

View file

@ -13,7 +13,7 @@ public class TESpellModifierBlock extends TESpellBlock
public ComplexSpellModifier getSpellModifier()
{
int meta = this.getBlockMetadata();
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
switch (meta)
{
case 0:

View file

@ -2,8 +2,8 @@ package WayofTime.alchemicalWizardry.common.tileEntity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.api.spell.SpellParadigm;
import WayofTime.alchemicalWizardry.api.spell.SpellParadigmMelee;
import WayofTime.alchemicalWizardry.api.spell.SpellParadigmProjectile;
@ -15,7 +15,7 @@ public class TESpellParadigmBlock extends TESpellBlock implements ISpellParadigm
{
public SpellParadigm getSpellParadigm()
{
int meta = this.getBlockMetadata();
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
switch (meta)
{
case 0:
@ -31,7 +31,10 @@ public class TESpellParadigmBlock extends TESpellBlock implements ISpellParadigm
}
@Override
protected void applySpellChange(SpellParadigm parad) {}
protected void applySpellChange(SpellParadigm parad)
{
}
public boolean canInputRecieve()
{
@ -65,11 +68,14 @@ public class TESpellParadigmBlock extends TESpellBlock implements ISpellParadigm
}
@Override
public void setInputDirection(EnumFacing direction) {}
public void setInputDirection(ForgeDirection direction)
{
}
@Override
public EnumFacing getInputDirection()
public ForgeDirection getInputDirection()
{
return EnumFacing.WEST;
return ForgeDirection.UNKNOWN;
}
}

View file

@ -9,16 +9,15 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.items.TelepositionFocus;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class TETeleposer extends TEInventory implements IUpdatePlayerListBox
public class TETeleposer extends TEInventory
{
public static final int sizeInv = 1;
@ -60,7 +59,7 @@ public class TETeleposer extends TEInventory implements IUpdatePlayerListBox
}
@Override
public String getName()
public String getInventoryName()
{
return "TETeleposer";
}
@ -73,14 +72,16 @@ public class TETeleposer extends TEInventory implements IUpdatePlayerListBox
//Logic for the actual block is under here
@Override
public void update()
public void updateEntity()
{
super.updateEntity();
if (worldObj.isRemote)
{
return;
}
int currentInput = worldObj.getStrongPower(pos);
int currentInput = worldObj.getBlockPowerInput(xCoord, yCoord, zCoord);
if (previousInput == 0 && currentInput != 0)
{
@ -92,20 +93,18 @@ public class TETeleposer extends TEInventory implements IUpdatePlayerListBox
int xf = focusItem.xCoord(focus);
int yf = focusItem.yCoord(focus);
int zf = focusItem.zCoord(focus);
BlockPos posF = focusItem.getBlockPos(focus);
World worldF = focusItem.getWorld(focus);
int damage = (int) (0.5f * Math.sqrt(pos.distanceSq(posF)));
int damage = (int) (0.5f * Math.sqrt((xCoord - xf) * (xCoord - xf) + (yCoord - yf + 1) * (yCoord - yf + 1) + (zCoord - zf) * (zCoord - zf)));
int focusLevel = focusItem.getFocusLevel();
int transportCount = 0;
int entityCount = 0;
if (worldF != null && worldF.getTileEntity(posF) instanceof TETeleposer && !worldF.getTileEntity(posF).equals(this))
if (worldF != null && worldF.getTileEntity(xf, yf, zf) instanceof TETeleposer && !worldF.getTileEntity(xf, yf, zf).equals(this))
{
//Prime the teleportation
int d0 = focusLevel - 1;
AxisAlignedBB axisalignedbb1 = new AxisAlignedBB(pos.add(0, 1, 0), pos.add(1, 2, 1)).expand(d0, d0, d0);
// axisalignedbb1.maxY = Math.min((double) this.worldObj.getHeight(), pos.getY() + 2 + d0 + d0);
AxisAlignedBB axisalignedbb1 = AxisAlignedBB.getBoundingBox((double) this.xCoord-0.5, (double) this.yCoord + d0 + 0.5, (double) this.zCoord-0.5, (double) (this.xCoord + 0.5), (double) (this.yCoord + 1.5 + d0), (double) (this.zCoord + 0.5)).expand(d0, d0, d0);
axisalignedbb1.maxY = Math.min((double) this.worldObj.getHeight(), this.yCoord + 2 + d0 + d0);
List list1 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb1);
Iterator iterator1 = list1.iterator();
EntityLivingBase entityplayer1;
@ -116,7 +115,7 @@ public class TETeleposer extends TEInventory implements IUpdatePlayerListBox
entityCount++;
}
AxisAlignedBB axisalignedbb2 = new AxisAlignedBB(xf-0.5, yf + d0 + 0.5, zf-0.5, xf + 0.5, yf + 1.5 + d0, zf+0.5).expand(d0, d0, d0);
AxisAlignedBB axisalignedbb2 = AxisAlignedBB.getBoundingBox(xf-0.5, yf + d0 + 0.5, zf-0.5, xf + 0.5, yf + 1.5 + d0, zf+0.5).expand(d0, d0, d0);
List list2 = worldF.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb2);
Iterator iterator2 = list2.iterator();
EntityLivingBase entityplayer2;
@ -127,7 +126,7 @@ public class TETeleposer extends TEInventory implements IUpdatePlayerListBox
entityCount++;
}
if (SoulNetworkHandler.canSyphonInContainer(focus, damage * (focusLevel * 2 - 1) * (focusLevel * 2 - 1) * (focusLevel * 2 - 1) + damage * entityCount))
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 i = -(focusLevel - 1); i <= (focusLevel - 1); i++)
@ -135,7 +134,7 @@ public class TETeleposer extends TEInventory implements IUpdatePlayerListBox
for (int j = -(focusLevel - 1); j <= (focusLevel - 1); j++)
{
{
if (BlockTeleposer.swapBlocks(this, worldObj, worldF, pos.add(i, 1 + k, j), posF.add(i, 1 + k, j)))
if (BlockTeleposer.swapBlocks(this, worldObj, worldF, xCoord + i, yCoord + 1 + k, zCoord + j, xf + i, yf + 1 + k, zf + j))
{
transportCount++;
}
@ -148,7 +147,7 @@ public class TETeleposer extends TEInventory implements IUpdatePlayerListBox
entityCount = 0;
}
SoulNetworkHandler.syphonFromNetworkWhileInContainer(focus, damage * transportCount + damage * entityCount);
SoulNetworkHandler.syphonFromNetwork(focus, damage * transportCount + damage * entityCount);
//Teleport
if (worldF.equals(worldObj))
@ -160,14 +159,14 @@ public class TETeleposer extends TEInventory implements IUpdatePlayerListBox
{
entityplayer1 = (EntityLivingBase) iterator1.next();
entityplayer1.worldObj = worldF;
entityplayer1.setPositionAndUpdate(entityplayer1.posX - pos.getX() + xf, entityplayer1.posY - pos.getY() + yf, entityplayer1.posZ - pos.getZ() + zf);
entityplayer1.setPositionAndUpdate(entityplayer1.posX - this.xCoord + xf, entityplayer1.posY - this.yCoord + yf, entityplayer1.posZ - this.zCoord + zf);
}
while (iterator2.hasNext())
{
entityplayer2 = (EntityLivingBase) iterator2.next();
entityplayer2.worldObj = worldF;
entityplayer2.setPositionAndUpdate(entityplayer2.posX + pos.getX() - xf, entityplayer2.posY + pos.getY() - yf, entityplayer2.posZ + pos.getZ() - zf);
entityplayer2.setPositionAndUpdate(entityplayer2.posX + this.xCoord - xf, entityplayer2.posY + this.yCoord - yf, entityplayer2.posZ + this.zCoord - zf);
}
}else
{
@ -177,17 +176,17 @@ public class TETeleposer extends TEInventory implements IUpdatePlayerListBox
while (iterator1.hasNext())
{
entityplayer1 = (EntityLivingBase) iterator1.next();
SpellHelper.teleportEntityToDim(worldObj, worldF.provider.getDimensionId(), entityplayer1.posX - pos.getX() + xf, entityplayer1.posY - pos.getY() + yf, entityplayer1.posZ - pos.getZ() + zf, entityplayer1);
SpellHelper.teleportEntityToDim(worldObj, worldF.provider.dimensionId, entityplayer1.posX - this.xCoord + xf, entityplayer1.posY - this.yCoord + yf, entityplayer1.posZ - this.zCoord + zf, entityplayer1);
// entityplayer1.worldObj = worldF;
// entityplayer1.setPositionAndUpdate(entityplayer1.posX - pos.getX() + xf, entityplayer1.posY - pos.getY() + yf, entityplayer1.posZ - pos.getZ() + zf);
// entityplayer1.setPositionAndUpdate(entityplayer1.posX - this.xCoord + xf, entityplayer1.posY - this.yCoord + yf, entityplayer1.posZ - this.zCoord + zf);
}
while (iterator2.hasNext())
{
entityplayer2 = (EntityLivingBase) iterator2.next();
SpellHelper.teleportEntityToDim(worldF, worldObj.provider.getDimensionId(), entityplayer2.posX + pos.getX() - xf, entityplayer2.posY + pos.getY() - yf, entityplayer2.posZ + pos.getZ() - zf, entityplayer2);
SpellHelper.teleportEntityToDim(worldF, worldObj.provider.dimensionId, entityplayer2.posX + this.xCoord - xf, entityplayer2.posY + this.yCoord - yf, entityplayer2.posZ + this.zCoord - zf, entityplayer2);
// entityplayer2.worldObj = worldF;
// entityplayer2.setPositionAndUpdate(entityplayer2.posX + pos.getX() - xf, entityplayer2.posY + pos.getY() - yf, entityplayer2.posZ + pos.getZ() - zf);
// entityplayer2.setPositionAndUpdate(entityplayer2.posX + this.xCoord - xf, entityplayer2.posY + this.yCoord - yf, entityplayer2.posZ + this.zCoord - zf);
}
}
}

View file

@ -5,8 +5,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemicalPotionCreationHandler;
@ -23,7 +22,7 @@ import WayofTime.alchemicalWizardry.common.alchemy.ICombinationalCatalyst;
import WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpdatePlayerListBox
public class TEWritingTable extends TEInventory implements ISidedInventory
{
public static final int sizeInv = 7;
@ -32,7 +31,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
private int accelerationTime;
public TEChemistrySet()
public TEWritingTable()
{
super(sizeInv);
}
@ -60,7 +59,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
}
@Override
public String getName()
public String getInventoryName()
{
return "aw.TEWritingTable";
}
@ -180,7 +179,13 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
public boolean containsCombinationCatalyst()
{
return getCombinationCatalystPosition() != -1;
if (getCombinationCatalystPosition() != -1)
{
return true;
} else
{
return false;
}
}
public int getCombinationCatalystPosition()
@ -293,7 +298,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
}
@Override
public void update()
public void updateEntity()
{
int progressNeeded = 100;
long worldTime = worldObj.getWorldTime();
@ -317,7 +322,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldTime % 4 == 0)
{
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
if (progress >= progressNeeded)
@ -332,7 +337,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldObj != null)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return;
@ -348,7 +353,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldObj != null)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return;
@ -369,7 +374,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldObj != null)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
}
@ -381,7 +386,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldTime % 4 == 0)
{
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
if (progress >= progressNeeded)
@ -396,7 +401,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldObj != null)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return;
@ -412,7 +417,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldObj != null)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return;
@ -424,7 +429,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
this.setInventorySlotContents(6, flaskStack);
} else
{
worldObj.createExplosion(null, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 2, false);
worldObj.createExplosion(null, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 2, false);
}
this.decrStackSize(this.getPotionFlaskPosition(), 1);
@ -434,7 +439,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldObj != null)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
}
@ -447,7 +452,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldTime % 4 == 0)
{
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
if (progress >= progressNeeded)
@ -461,7 +466,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldObj != null)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return;
@ -474,7 +479,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldObj != null)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
}
@ -486,7 +491,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldTime % 4 == 0)
{
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
if (progress >= progressNeeded)
@ -500,7 +505,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldObj != null)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return;
@ -515,7 +520,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldObj != null)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
}
@ -528,7 +533,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldTime % 4 == 0)
{
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
if (progress >= progressNeeded)
@ -542,7 +547,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldObj != null)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return;
@ -559,7 +564,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldObj != null)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
}
@ -579,7 +584,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldObj != null)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
@ -594,7 +599,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldTime % 4 == 0)
{
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
progress += acceleration;
@ -615,14 +620,14 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldObj != null)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
} else if (getStackInSlot(6).getItem() == getResultingItemStack().getItem() && getResultingItemStack().stackSize <= (getStackInSlot(6).getMaxStackSize() - getStackInSlot(6).stackSize))
{
if (worldTime % 4 == 0)
{
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
if (!SoulNetworkHandler.syphonFromNetworkWhileInContainer(getStackInSlot(0), amountUsed * acceleration))
@ -650,7 +655,7 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
if (worldObj != null)
{
worldObj.markBlockForUpdate(pos);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
}
@ -732,25 +737,26 @@ public class TEChemistrySet extends TEInventory implements ISidedInventory, IUpd
}
@Override
public int[] getSlotsForFace(EnumFacing facing)
public int[] getAccessibleSlotsFromSide(int side)
{
switch(facing)
ForgeDirection dir = ForgeDirection.getOrientation(side);
switch(dir)
{
case DOWN:
return new int[]{6};
default:
return new int[]{0, 1, 2, 3, 4, 5};
case DOWN:
return new int[]{6};
default:
return new int[]{0, 1, 2, 3, 4, 5};
}
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing facing)
public boolean canInsertItem(int slot, ItemStack stack, int side)
{
return slot != 6;
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing facing)
public boolean canExtractItem(int slot, ItemStack stack, int side)
{
return slot == 6;
}

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.tileEntity.container;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import WayofTime.alchemicalWizardry.common.tileEntity.TEChemistrySet;
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
@ -10,9 +10,9 @@ import net.minecraft.item.ItemStack;
public class ContainerWritingTable extends Container
{
protected TEChemistrySet tileEntity;
protected TEWritingTable tileEntity;
public ContainerWritingTable(InventoryPlayer inventoryPlayer, TEChemistrySet te)
public ContainerWritingTable(InventoryPlayer inventoryPlayer, TEWritingTable te)
{
tileEntity = te;
addSlotToContainer(new Slot(tileEntity, 0, 152, 110));

View file

@ -2,16 +2,15 @@ package WayofTime.alchemicalWizardry.common.tileEntity.gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
import WayofTime.alchemicalWizardry.common.items.sigil.holding.ContainerHolding;
import WayofTime.alchemicalWizardry.common.items.sigil.holding.GuiHolding;
import WayofTime.alchemicalWizardry.common.items.sigil.holding.InventoryHolding;
import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
import WayofTime.alchemicalWizardry.common.tileEntity.TEChemistrySet;
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
import WayofTime.alchemicalWizardry.common.tileEntity.container.ContainerTeleposer;
import WayofTime.alchemicalWizardry.common.tileEntity.container.ContainerWritingTable;
import cpw.mods.fml.common.network.IGuiHandler;
public class GuiHandler implements IGuiHandler
{
@ -20,20 +19,19 @@ public class GuiHandler implements IGuiHandler
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
{
TileEntity tileEntity;
BlockPos pos = new BlockPos(x, y, z);
switch (id)
{
case 0:
tileEntity = world.getTileEntity(pos);
tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof TEChemistrySet)
if (tileEntity instanceof TEWritingTable)
{
return new ContainerWritingTable(player.inventory, (TEChemistrySet) tileEntity);
return new ContainerWritingTable(player.inventory, (TEWritingTable) tileEntity);
}
case 1:
tileEntity = world.getTileEntity(pos);
tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof TETeleposer)
{
@ -52,22 +50,21 @@ public class GuiHandler implements IGuiHandler
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
{
TileEntity tileEntity;
BlockPos pos = new BlockPos(x, y, z);
switch (id)
{
case 0:
tileEntity = world.getTileEntity(pos);
tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof TEChemistrySet)
if (tileEntity instanceof TEWritingTable)
{
return new GuiChemistrySet(player.inventory, (TEChemistrySet) tileEntity);
return new GuiWritingTable(player.inventory, (TEWritingTable) tileEntity);
}
break;
case 1:
tileEntity = world.getTileEntity(pos);
tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof TETeleposer)
{

View file

@ -7,12 +7,12 @@ import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import WayofTime.alchemicalWizardry.common.tileEntity.TEChemistrySet;
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
import WayofTime.alchemicalWizardry.common.tileEntity.container.ContainerWritingTable;
public class GuiChemistrySet extends GuiContainer
public class GuiWritingTable extends GuiContainer
{
public GuiChemistrySet(InventoryPlayer inventoryPlayer, TEChemistrySet tileEntity)
public GuiWritingTable(InventoryPlayer inventoryPlayer, TEWritingTable tileEntity)
{
super(new ContainerWritingTable(inventoryPlayer, tileEntity));
xSize = 176;