Initial commit of BM 1.8
This commit is contained in:
parent
d99eadbea7
commit
c5681dc831
713 changed files with 6502 additions and 27334 deletions
|
@ -1,12 +1,5 @@
|
|||
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;
|
||||
|
@ -15,16 +8,28 @@ 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 net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory
|
||||
public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory, IUpdatePlayerListBox
|
||||
{
|
||||
protected ItemStack[] inv;
|
||||
protected ReagentContainer bufferTank = new ReagentContainer(Reagent.REAGENT_SIZE * 2);
|
||||
|
||||
protected int bufferTransferRate = 20;
|
||||
|
||||
private int lpPerTick = 10;
|
||||
private int ticksPerReagent = 200;
|
||||
|
||||
public int progress;
|
||||
|
||||
public TEAlchemicCalcinator()
|
||||
|
@ -51,7 +56,7 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory
|
|||
|
||||
for (int i = 0; i < tagList.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
|
||||
NBTTagCompound savedTag = (NBTTagCompound) tagList.getCompoundTagAt(i);
|
||||
|
||||
if (savedTag.getBoolean("Empty"))
|
||||
{
|
||||
|
@ -80,6 +85,7 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory
|
|||
|
||||
for (int i = 0; i < inv.length; i++)
|
||||
{
|
||||
ItemStack stack = inv[i];
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
|
||||
if (inv[i] != null)
|
||||
|
@ -97,9 +103,9 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
public void update()
|
||||
{
|
||||
super.updateEntity();
|
||||
super.update();
|
||||
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
|
@ -111,19 +117,17 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory
|
|||
public void moveBufferToMain()
|
||||
{
|
||||
ReagentStack amountStack = this.bufferTank.drain(bufferTransferRate, false);
|
||||
int drainAmount = this.fill(ForgeDirection.UNKNOWN, amountStack, false);
|
||||
int drainAmount = this.fill(EnumFacing.UP, amountStack, false);
|
||||
|
||||
if (drainAmount > 0)
|
||||
{
|
||||
ReagentStack drainedStack = this.bufferTank.drain(drainAmount, true);
|
||||
this.fill(ForgeDirection.UNKNOWN, drainedStack, true);
|
||||
this.fill(EnumFacing.UP, drainedStack, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void tickProgress()
|
||||
{
|
||||
int lpPerTick = 10;
|
||||
int ticksPerReagent = 200;
|
||||
ItemStack reagentItemStack = this.getStackInSlot(1);
|
||||
if (reagentItemStack == null)
|
||||
{
|
||||
|
@ -158,10 +162,10 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory
|
|||
|
||||
if (worldObj.getWorldTime() % 4 == 0)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
|
||||
}
|
||||
|
||||
if (progress >= ticksPerReagent)
|
||||
if (progress >= this.ticksPerReagent)
|
||||
{
|
||||
progress = 0;
|
||||
this.bufferTank.fill(possibleReagent, true);
|
||||
|
@ -196,7 +200,7 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory
|
|||
|
||||
for (int i = 0; i < invTagList.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound savedTag = invTagList.getCompoundTagAt(i);
|
||||
NBTTagCompound savedTag = (NBTTagCompound) invTagList.getCompoundTagAt(i);
|
||||
|
||||
if (savedTag.getBoolean("Empty"))
|
||||
{
|
||||
|
@ -231,6 +235,7 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory
|
|||
|
||||
for (int i = 0; i < inv.length; i++)
|
||||
{
|
||||
ItemStack stack = inv[i];
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
|
||||
if (inv[i] != null)
|
||||
|
@ -252,14 +257,14 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory
|
|||
{
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeClientNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(pos, -999, nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
super.onDataPacket(net, packet);
|
||||
readClientNBT(packet.func_148857_g());
|
||||
readClientNBT(packet.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -284,7 +289,7 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory
|
|||
stack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -333,27 +338,27 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory
|
|||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player)
|
||||
{
|
||||
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64;
|
||||
return worldObj.getTileEntity(pos) == this && pos.distanceSqToCenter(player.posX, player.posY, player.posZ) < 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory()
|
||||
public void openInventory(EntityPlayer player)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory()
|
||||
public void closeInventory(EntityPlayer player)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
public String getName()
|
||||
{
|
||||
return "AlchemicCalcinator";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName()
|
||||
public boolean hasCustomName()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -365,13 +370,43 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory
|
|||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill)
|
||||
public int fill(EnumFacing from, ReagentStack resource, boolean doFill)
|
||||
{
|
||||
if (doFill && !worldObj.isRemote)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
return super.fill(from, resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChatComponent getDisplayName() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@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 void clear() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ 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;
|
||||
|
@ -10,11 +11,13 @@ 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;
|
||||
|
@ -34,7 +37,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
|
||||
public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, IBloodAltar, IUpdatePlayerListBox
|
||||
{
|
||||
public static final int sizeInv = 1;
|
||||
|
||||
|
@ -246,7 +249,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
public String getName()
|
||||
{
|
||||
return "TEAltar";
|
||||
}
|
||||
|
@ -339,7 +342,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (resource.getFluidID() != (new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 1)).getFluidID())
|
||||
if (resource.getFluid() != (new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 1)).getFluid())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -364,7 +367,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.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this));
|
||||
FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorld(), tile.getPos(), this, fluidInput.amount));
|
||||
}
|
||||
|
||||
return fluidInput.amount;
|
||||
|
@ -388,7 +391,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
|
||||
if (tile != null)
|
||||
{
|
||||
FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this));
|
||||
FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorld(), tile.getPos(), this, fluidInput.amount));
|
||||
}
|
||||
|
||||
return filled;
|
||||
|
@ -422,7 +425,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
|
||||
if (this != null)
|
||||
{
|
||||
FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluidOutput, this.worldObj, this.xCoord, this.yCoord, this.zCoord, this));
|
||||
FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluidOutput, this.worldObj, this.pos, this, fluidOutput.amount));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -433,7 +436,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
|
||||
if (worldObj != null)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
return stack;
|
||||
|
@ -441,13 +444,13 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
|
||||
//Logic for the actual block is under here
|
||||
@Override
|
||||
public void updateEntity()
|
||||
public void update()
|
||||
{
|
||||
this.decrementDemonBlood();
|
||||
|
||||
if(this.hasDemonBlood() && !worldObj.isRemote)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
|
||||
}
|
||||
|
||||
if (this.lockdownDuration > 0)
|
||||
|
@ -463,23 +466,18 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
if (!worldObj.isRemote && worldObj.getWorldTime() % 20 == 0)
|
||||
{
|
||||
{
|
||||
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);
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
if (AlchemicalWizardry.lockdownAltar)
|
||||
{
|
||||
List<EntityPlayer> list = SpellHelper.getPlayersInRange(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 15, 15);
|
||||
List<EntityPlayer> list = SpellHelper.getPlayersInRange(worldObj, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 15, 15);
|
||||
for (EntityPlayer player : list)
|
||||
{
|
||||
PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration);
|
||||
|
@ -566,7 +564,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
|
||||
if (worldTime % 4 == 0)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
|
||||
}
|
||||
|
||||
if (progress >= liquidRequired * stackSize)
|
||||
|
@ -583,7 +581,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 4, xCoord + 0.5f, yCoord + 1.0f, zCoord + 0.5f);
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos.getX(), pos.getY(), pos.getZ(), 20, worldObj.provider.getDimensionId(), 4, pos.getX() + 0.5f, pos.getY() + 1.0f, pos.getZ() + 0.5f);
|
||||
}
|
||||
this.isActive = false;
|
||||
}
|
||||
|
@ -593,7 +591,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
|
||||
if (worldTime % 2 == 0)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 2, xCoord, yCoord, zCoord);
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 2, pos);
|
||||
}
|
||||
}
|
||||
} else
|
||||
|
@ -630,13 +628,13 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
|
||||
if (worldTime % 4 == 0)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 3, xCoord, yCoord, zCoord);
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 3, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (worldObj != null)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -728,7 +726,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
{
|
||||
if (worldObj != null)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
this.checkAndSetAltar();
|
||||
|
@ -760,7 +758,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
public void checkAndSetAltar()
|
||||
{
|
||||
boolean checkUpgrade = true;
|
||||
int upgradeState = UpgradedAltars.isAltarValid(worldObj, xCoord, yCoord, zCoord);
|
||||
int upgradeState = UpgradedAltars.isAltarValid(worldObj, pos);
|
||||
|
||||
if (upgradeState <= 1)
|
||||
{
|
||||
|
@ -777,7 +775,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
return;
|
||||
}
|
||||
|
||||
AltarUpgradeComponent upgrades = UpgradedAltars.getUpgrades(worldObj, xCoord, yCoord, zCoord, upgradeState);
|
||||
AltarUpgradeComponent upgrades = UpgradedAltars.getUpgrades(worldObj, pos, upgradeState);
|
||||
|
||||
if (upgrades == null)
|
||||
{
|
||||
|
@ -823,7 +821,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
this.fluidInput.amount = this.bufferCapacity;
|
||||
}
|
||||
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -833,7 +831,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
//TODO
|
||||
if (resource == null)
|
||||
|
@ -851,7 +849,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
if (resource == null)
|
||||
{
|
||||
|
@ -867,26 +865,26 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxEmpty, boolean doDrain)
|
||||
public FluidStack drain(EnumFacing from, int maxEmpty, boolean doDrain)
|
||||
{
|
||||
return this.drain(maxEmpty, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid)
|
||||
public boolean canFill(EnumFacing 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(ForgeDirection from, Fluid fluid)
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from)
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from)
|
||||
{
|
||||
FluidTank compositeTank = new FluidTank(capacity);
|
||||
compositeTank.setFluid(fluid);
|
||||
|
@ -903,7 +901,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
sortList[1] = 0;
|
||||
} else
|
||||
{
|
||||
sortList[0] = this.fluid.getFluidID();
|
||||
sortList[0] = this.fluid.fluidID;
|
||||
sortList[1] = this.fluid.amount;
|
||||
}
|
||||
|
||||
|
@ -913,7 +911,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
sortList[3] = 0;
|
||||
} else
|
||||
{
|
||||
sortList[2] = this.fluidInput.getFluidID();
|
||||
sortList[2] = this.fluidInput.fluidID;
|
||||
sortList[3] = this.fluidInput.amount;
|
||||
}
|
||||
|
||||
|
@ -923,7 +921,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
|||
sortList[5] = 0;
|
||||
} else
|
||||
{
|
||||
sortList[4] = this.fluidOutput.getFluidID();
|
||||
sortList[4] = this.fluidOutput.fluidID;
|
||||
sortList[5] = this.fluidOutput.amount;
|
||||
}
|
||||
|
||||
|
@ -933,7 +931,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, xCoord, yCoord, zCoord)));
|
||||
player.addChatMessage(new ChatComponentTranslation(String.format("message.altar.currenttier"), UpgradedAltars.isAltarValid(worldObj, pos)));
|
||||
player.addChatMessage(new ChatComponentTranslation(String.format("message.altar.capacity"), this.getCapacity()));
|
||||
}
|
||||
|
||||
|
|
|
@ -5,10 +5,13 @@ 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.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;
|
||||
|
||||
public class TEBellJar extends TEReagentConduit
|
||||
|
@ -36,7 +39,7 @@ public class TEBellJar extends TEReagentConduit
|
|||
|
||||
public static ReagentContainerInfo[] getContainerInfoFromItem(ItemStack stack)
|
||||
{
|
||||
if (stack != null && stack.getItem() instanceof ItemBlock && ModBlocks.blockCrystalBelljar == ((ItemBlock) stack.getItem()).field_150939_a)
|
||||
if (stack != null && stack.getItem() instanceof ItemBlock && ModBlocks.blockCrystalBelljar == ((ItemBlock) stack.getItem()).getBlock())
|
||||
{
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if (tag != null)
|
||||
|
@ -98,24 +101,19 @@ public class TEBellJar extends TEReagentConduit
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
public void update()
|
||||
{
|
||||
super.updateEntity();
|
||||
|
||||
super.update();
|
||||
|
||||
if (hasChanged == 1)
|
||||
{
|
||||
Block block = worldObj.getBlock(xCoord + 1, yCoord, zCoord);
|
||||
block.onNeighborBlockChange(worldObj, xCoord + 1, yCoord, zCoord, block);
|
||||
block = worldObj.getBlock(xCoord - 1, yCoord, zCoord);
|
||||
block.onNeighborBlockChange(worldObj, xCoord - 1, yCoord, zCoord, block);
|
||||
block = worldObj.getBlock(xCoord, yCoord + 1, zCoord);
|
||||
block.onNeighborBlockChange(worldObj, xCoord, yCoord + 1, zCoord, block);
|
||||
block = worldObj.getBlock(xCoord, yCoord - 1, zCoord);
|
||||
block.onNeighborBlockChange(worldObj, xCoord, yCoord - 1, zCoord, block);
|
||||
block = worldObj.getBlock(xCoord, yCoord, zCoord + 1);
|
||||
block.onNeighborBlockChange(worldObj, xCoord, yCoord, zCoord + 1, block);
|
||||
block = worldObj.getBlock(xCoord, yCoord, zCoord - 1);
|
||||
block.onNeighborBlockChange(worldObj, xCoord, yCoord, zCoord - 1, block);
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,13 +17,6 @@ public class TEConduit extends TESpellBlock
|
|||
super.writeToNBT(par1NBTTagCompound);
|
||||
}
|
||||
|
||||
//Logic for the actual block is under here
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applySpellChange(SpellParadigm parad)
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@ 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;
|
||||
|
@ -11,13 +12,17 @@ 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
|
||||
public class TECrucible extends TEInventory implements IUpdatePlayerListBox
|
||||
{
|
||||
private int radius = 5;
|
||||
|
||||
|
@ -45,7 +50,7 @@ public class TECrucible extends TEInventory
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
public void update()
|
||||
{
|
||||
if(worldObj.isRemote)
|
||||
return;
|
||||
|
@ -81,7 +86,7 @@ public class TECrucible extends TEInventory
|
|||
|
||||
if(ticksRemaining > 0)
|
||||
{
|
||||
List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, radius, radius);
|
||||
List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(worldObj, pos.getX(), pos.getY(), pos.getZ(), radius, radius);
|
||||
|
||||
if(playerList != null && !playerList.isEmpty())
|
||||
{
|
||||
|
@ -114,7 +119,7 @@ public class TECrucible extends TEInventory
|
|||
if(state != 0)
|
||||
{
|
||||
state = 0;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
updateNeighbors();
|
||||
}
|
||||
}
|
||||
|
@ -123,14 +128,14 @@ public class TECrucible extends TEInventory
|
|||
if(state != 0)
|
||||
{
|
||||
state = 0;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
updateNeighbors();
|
||||
}
|
||||
}
|
||||
|
||||
if(stateChanged)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
|
||||
updateNeighbors();
|
||||
}
|
||||
|
@ -138,18 +143,13 @@ public class TECrucible extends TEInventory
|
|||
|
||||
private void updateNeighbors()
|
||||
{
|
||||
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);
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
public void spawnClientParticle(World world, int x, int y, int z, Random rand)
|
||||
|
@ -157,16 +157,16 @@ public class TECrucible extends TEInventory
|
|||
switch(state)
|
||||
{
|
||||
case 0:
|
||||
world.spawnParticle("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 0.7D, z + 0.5D + rand.nextGaussian() / 8, 0.15, 0.15, 0.15);
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, 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("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 0.7D, z + 0.5D + rand.nextGaussian() / 8, 1.0, 1.0, 1.0);
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, 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("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);
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, x + 0.5D + rand.nextGaussian() / 8, y + 0.7D, z + 0.5D + rand.nextGaussian() / 8, rColour, gColour, bColour);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, x + 0.5D + rand.nextGaussian() / 32, y + 0.7D, z + 0.5D + rand.nextGaussian() / 32, 0, 0.02, 0);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
@ -248,18 +248,18 @@ public class TECrucible extends TEInventory
|
|||
{
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeClientNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 90210, nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(pos, 90210, nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
super.onDataPacket(net, packet);
|
||||
readClientNBT(packet.func_148857_g());
|
||||
readClientNBT(packet.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
public String getName()
|
||||
{
|
||||
return "TECrucible";
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ 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;
|
||||
|
@ -71,73 +72,25 @@ public class TEHomHeart extends TileEntity
|
|||
|
||||
public HomSpell getSpell()
|
||||
{
|
||||
TileEntity tileEntity = worldObj.getTileEntity(xCoord - 1, yCoord, zCoord);
|
||||
for(EnumFacing face : EnumFacing.HORIZONTALS)
|
||||
{
|
||||
TileEntity tileEntity = worldObj.getTileEntity(pos.offset(face));
|
||||
|
||||
if (tileEntity instanceof TEAltar)
|
||||
{
|
||||
ItemStack itemStack = ((TEAltar) tileEntity).getStackInSlot(0);
|
||||
|
||||
if (itemStack != null)
|
||||
if (tileEntity instanceof TEAltar)
|
||||
{
|
||||
HomSpell spell = HomSpellRegistry.getSpellForItemStack(itemStack);
|
||||
ItemStack itemStack = ((TEAltar) tileEntity).getStackInSlot(0);
|
||||
|
||||
if (spell != null)
|
||||
if (itemStack != null)
|
||||
{
|
||||
return spell;
|
||||
HomSpell spell = HomSpellRegistry.getSpellForItemStack(itemStack);
|
||||
|
||||
if (spell != null)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
@ -146,11 +99,11 @@ public class TEHomHeart extends TileEntity
|
|||
{
|
||||
//TODO change so that it works with a Tile Entity for a custom head or whatnot
|
||||
|
||||
TileEntity tileEntity = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord);
|
||||
TileEntity tileEntity = worldObj.getTileEntity(pos.offsetUp());
|
||||
|
||||
if (tileEntity instanceof TileEntitySkull)
|
||||
{
|
||||
int skullType = ((TileEntitySkull) tileEntity).func_145904_a();
|
||||
int skullType = ((TileEntitySkull) tileEntity).getSkullType();
|
||||
|
||||
switch (skullType)
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@ 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;
|
||||
|
||||
/**
|
||||
|
@ -65,16 +66,16 @@ public abstract class TEInventory extends TileEntity implements IInventory
|
|||
public void setInventorySlotContents(int slot, ItemStack stack)
|
||||
{
|
||||
inv[slot] = stack;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
if (stack != null && stack.stackSize > getInventoryStackLimit())
|
||||
stack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract String getInventoryName();
|
||||
public abstract String getName();
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName()
|
||||
public boolean hasCustomName()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -88,17 +89,17 @@ public abstract class TEInventory extends TileEntity implements IInventory
|
|||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player)
|
||||
{
|
||||
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this
|
||||
&& player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64;
|
||||
return worldObj.getTileEntity(this.pos) == this
|
||||
&& player.getDistanceSqToCenter(pos) < 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory()
|
||||
public void openInventory(EntityPlayer player)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory()
|
||||
public void closeInventory(EntityPlayer player)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -147,4 +148,28 @@ 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,14 +11,16 @@ 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.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
|
||||
|
@ -31,9 +33,8 @@ 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
|
||||
public class TEMasterStone extends TileEntity implements IMasterRitualStone, IUpdatePlayerListBox
|
||||
{
|
||||
private String currentRitualString;
|
||||
private boolean isActive;
|
||||
|
@ -151,9 +152,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
{
|
||||
newStorage.readFromNBT(localStorageTag);
|
||||
storage = newStorage;
|
||||
storage.xCoord = xCoord;
|
||||
storage.yCoord = yCoord;
|
||||
storage.zCoord = zCoord;
|
||||
storage.setLocation(pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -215,7 +214,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
return;
|
||||
}
|
||||
|
||||
String testRitual = Rituals.checkValidRitual(world, xCoord, yCoord, zCoord);
|
||||
String testRitual = Rituals.checkValidRitual(world, pos);
|
||||
|
||||
if (testRitual.equals(""))
|
||||
{
|
||||
|
@ -271,7 +270,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(world, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
SpellHelper.sendIndexedParticleToAllAround(world, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
|
||||
}
|
||||
}else
|
||||
{
|
||||
|
@ -291,11 +290,11 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
var1 = 0;
|
||||
currentRitualString = testRitual;
|
||||
storage = Rituals.getLocalStorage(currentRitualString);
|
||||
storage.setLocation(new Int3(xCoord, yCoord, zCoord));
|
||||
storage.setLocation(pos);
|
||||
isActive = true;
|
||||
isRunning = true;
|
||||
direction = Rituals.getDirectionOfRitual(world, xCoord, yCoord, zCoord, testRitual);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
direction = Rituals.getDirectionOfRitual(world, pos, testRitual);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
public void setOwner(String owner)
|
||||
|
@ -314,7 +313,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
public void update()
|
||||
{
|
||||
if (isRunning && runningTime < 100)
|
||||
{
|
||||
|
@ -338,26 +337,26 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
|
||||
if (worldTime % 100 == 0)
|
||||
{
|
||||
boolean testRunes = Rituals.checkDirectionOfRitualValid(worldObj, xCoord, yCoord, zCoord, currentRitualString, direction);
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
boolean testRunes = Rituals.checkDirectionOfRitualValid(worldObj, pos, currentRitualString, direction);
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
|
||||
|
||||
if (!testRunes)
|
||||
{
|
||||
Rituals.onRitualBroken(this, currentRitualString, RitualBreakMethod.BREAK_STONE);
|
||||
isActive = false;
|
||||
currentRitualString = "";
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0)
|
||||
if (worldObj.getStrongPower(pos) > 0)
|
||||
{
|
||||
if (isRunning)
|
||||
{
|
||||
Rituals.onRitualBroken(this, this.currentRitualString, RitualBreakMethod.REDSTONE);
|
||||
isRunning = false;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -366,14 +365,14 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
if (!isRunning)
|
||||
{
|
||||
isRunning = true;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
}
|
||||
|
||||
performRitual(worldObj, xCoord, yCoord, zCoord, currentRitualString);
|
||||
performRitual(worldObj, pos, currentRitualString);
|
||||
}
|
||||
|
||||
public void performRitual(World world, int x, int y, int z, String currentRitualString)
|
||||
public void performRitual(World world, BlockPos pos, String currentRitualString)
|
||||
{
|
||||
Rituals.performEffect(this, currentRitualString);
|
||||
}
|
||||
|
@ -408,7 +407,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
Rituals.onRitualBroken(this, this.currentRitualString, RitualBreakMethod.DEACTIVATE);
|
||||
this.isActive = active;
|
||||
this.isRunning = active;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
public int getDirection()
|
||||
|
@ -417,27 +416,15 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
}
|
||||
|
||||
@Override
|
||||
public World getWorld()
|
||||
public World getWorldObj()
|
||||
{
|
||||
return this.getWorldObj();
|
||||
return this.getWorld();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getXCoord()
|
||||
public BlockPos getPosition()
|
||||
{
|
||||
return xCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getYCoord()
|
||||
{
|
||||
return yCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZCoord()
|
||||
{
|
||||
return zCoord;
|
||||
return this.getPos();
|
||||
}
|
||||
|
||||
public String getCurrentRitual()
|
||||
|
@ -455,30 +442,30 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
{
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeClientNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(pos, -999, nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
super.onDataPacket(net, packet);
|
||||
readClientNBT(packet.func_148857_g());
|
||||
readClientNBT(packet.getNbtCompound());
|
||||
}
|
||||
|
||||
public AxisAlignedBB getRenderBoundingBox()
|
||||
{
|
||||
double renderExtention = 1.0d;
|
||||
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(xCoord - renderExtention, yCoord - renderExtention, zCoord - renderExtention, xCoord + 1 + renderExtention, yCoord + 1 + renderExtention, zCoord + 1 + renderExtention);
|
||||
AxisAlignedBB bb = new AxisAlignedBB(pos.add(-renderExtention, -renderExtention, -renderExtention), pos.add(1 + renderExtention, 1 + renderExtention, 1 + renderExtention));
|
||||
return bb;
|
||||
}
|
||||
|
||||
/* ISegmentedReagentHandler */
|
||||
@Override
|
||||
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill)
|
||||
public int fill(EnumFacing from, ReagentStack resource, boolean doFill)
|
||||
{
|
||||
if (doFill)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
int totalFill = 0;
|
||||
|
@ -497,7 +484,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
ReagentStack remainingStack = resource.copy();
|
||||
remainingStack.amount = maxFill - totalFill;
|
||||
|
||||
boolean doesReagentMatch = tanks[i].getReagent() != null && tanks[i].getReagent().isReagentEqual(remainingStack);
|
||||
boolean doesReagentMatch = tanks[i].getReagent() == null ? false : tanks[i].getReagent().isReagentEqual(remainingStack);
|
||||
|
||||
if (doesReagentMatch)
|
||||
{
|
||||
|
@ -545,7 +532,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
}
|
||||
|
||||
@Override
|
||||
public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain)
|
||||
public ReagentStack drain(EnumFacing from, ReagentStack resource, boolean doDrain)
|
||||
{
|
||||
if (resource == null)
|
||||
{
|
||||
|
@ -554,7 +541,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
|
||||
if (doDrain)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
int maxDrain = resource.amount;
|
||||
|
@ -583,7 +570,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
|
||||
/* Only returns the amount from the first available tank */
|
||||
@Override
|
||||
public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
public ReagentStack drain(EnumFacing from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
for (int i = 0; i < tanks.length; i++)
|
||||
{
|
||||
|
@ -592,7 +579,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
{
|
||||
if (doDrain)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
return stack;
|
||||
|
@ -603,19 +590,19 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Reagent reagent)
|
||||
public boolean canFill(EnumFacing from, Reagent reagent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Reagent reagent)
|
||||
public boolean canDrain(EnumFacing from, Reagent reagent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentContainerInfo[] getContainerInfo(ForgeDirection from)
|
||||
public ReagentContainerInfo[] getContainerInfo(EnumFacing from)
|
||||
{
|
||||
ReagentContainerInfo[] info = new ReagentContainerInfo[this.getNumberOfTanks()];
|
||||
for (int i = 0; i < this.getNumberOfTanks(); i++)
|
||||
|
@ -650,7 +637,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
return;
|
||||
}
|
||||
|
||||
this.attunedTankMap.put(reagent, total);
|
||||
this.attunedTankMap.put(reagent, new Integer(total));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
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;
|
||||
|
@ -9,7 +10,9 @@ 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;
|
||||
|
@ -18,7 +21,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
|
||||
public class TEMimicBlock extends TileEntity implements IUpdatePlayerListBox
|
||||
{
|
||||
private ItemStack[] inv;
|
||||
public Reagent reagent;
|
||||
|
@ -37,14 +40,14 @@ public class TEMimicBlock extends TileEntity
|
|||
{
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeToNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(pos, -999, nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
super.onDataPacket(net, packet);
|
||||
readFromNBT(packet.func_148857_g());
|
||||
readFromNBT(packet.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,7 +58,7 @@ public class TEMimicBlock extends TileEntity
|
|||
|
||||
for (int i = 0; i < tagList.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound tag = tagList.getCompoundTagAt(i);
|
||||
NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i);
|
||||
int slot = tag.getByte("Slot");
|
||||
|
||||
if (slot >= 0 && slot < inv.length)
|
||||
|
@ -76,6 +79,8 @@ public class TEMimicBlock extends TileEntity
|
|||
|
||||
for (int i = 0; i < inv.length; i++)
|
||||
{
|
||||
ItemStack stack = inv[i];
|
||||
|
||||
if (inv[i] != null)
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
|
@ -91,10 +96,8 @@ public class TEMimicBlock extends TileEntity
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
public void update()
|
||||
{
|
||||
super.updateEntity();
|
||||
|
||||
this.ticksRemaining--;
|
||||
|
||||
if (this.ticksRemaining <= 0)
|
||||
|
@ -103,34 +106,35 @@ public class TEMimicBlock extends TileEntity
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean createMimicBlockAtLocation(World world, int x, int y, int z, int duration, Block block, int meta, Reagent reagent)
|
||||
public static boolean createMimicBlockAtLocation(World world, BlockPos pos, int duration, IBlockState state, Reagent reagent)
|
||||
{
|
||||
Block block = state.getBlock();
|
||||
if (block == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if (tileEntity == null && world.isAirBlock(x, y, z))
|
||||
if (tileEntity == null && world.isAirBlock(pos))
|
||||
{
|
||||
ItemStack item = new ItemStack(block, 1, meta);
|
||||
ItemStack item = new ItemStack(block, 1, block.getMetaFromState(state));
|
||||
|
||||
world.setBlock(x, y, z, ModBlocks.blockMimic);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
world.setBlockState(pos, ModBlocks.blockMimic.getDefaultState());
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TEMimicBlock)
|
||||
{
|
||||
((TEMimicBlock) tile).setContainedItem(item);
|
||||
((TEMimicBlock) tile).setDuration(duration);
|
||||
((TEMimicBlock) tile).reagent = reagent;
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
world.markBlockForUpdate(pos);
|
||||
return true;
|
||||
}
|
||||
}else
|
||||
{
|
||||
if(tileEntity instanceof TEMimicBlock)
|
||||
{
|
||||
if(((TEMimicBlock) tileEntity).getBlock() == block && ((TEMimicBlock) tileEntity).getMetaOfMimic() == meta)
|
||||
if(((TEMimicBlock) tileEntity).getBlock() == block)
|
||||
{
|
||||
((TEMimicBlock) tileEntity).ticksRemaining = Math.max(duration, ((TEMimicBlock) tileEntity).ticksRemaining);
|
||||
}
|
||||
|
@ -181,7 +185,7 @@ public class TEMimicBlock extends TileEntity
|
|||
//
|
||||
// } else
|
||||
{
|
||||
this.worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
this.worldObj.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,7 +196,8 @@ public class TEMimicBlock extends TileEntity
|
|||
{
|
||||
if (item.getItem() instanceof ItemBlock)
|
||||
{
|
||||
return ((ItemBlock) item.getItem()).field_150939_a;
|
||||
Block block = ((ItemBlock) item.getItem()).getBlock();
|
||||
return block;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -209,6 +214,17 @@ public class TEMimicBlock extends TileEntity
|
|||
return 0;
|
||||
}
|
||||
|
||||
public IBlockState getStateOfMimic()
|
||||
{
|
||||
Block block = this.getBlock();
|
||||
if(block == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return block.getStateFromMeta(getMetaOfMimic());
|
||||
}
|
||||
|
||||
public boolean getBlockEffectWhileInside(Entity entity, int x, int y, int z)
|
||||
{
|
||||
if(reagent != null)
|
||||
|
|
|
@ -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.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
|
||||
import WayofTime.alchemicalWizardry.common.block.IOrientable;
|
||||
|
||||
public class TEOrientable extends TileEntity implements IOrientable
|
||||
{
|
||||
protected ForgeDirection inputFace;
|
||||
protected ForgeDirection outputFace;
|
||||
protected EnumFacing inputFace;
|
||||
protected EnumFacing outputFace;
|
||||
|
||||
public TEOrientable()
|
||||
{
|
||||
this.inputFace = ForgeDirection.DOWN;
|
||||
this.outputFace = ForgeDirection.UP;
|
||||
this.inputFace = EnumFacing.DOWN;
|
||||
this.outputFace = EnumFacing.UP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
this.setInputDirection(ForgeDirection.getOrientation(par1NBTTagCompound.getInteger("inputFace")));
|
||||
this.setOutputDirection(ForgeDirection.getOrientation(par1NBTTagCompound.getInteger("outputFace")));
|
||||
this.setInputDirection(EnumFacing.getFront(par1NBTTagCompound.getInteger("inputFace")));
|
||||
this.setOutputDirection(EnumFacing.getFront(par1NBTTagCompound.getInteger("outputFace")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setInteger("inputFace", TEOrientable.getIntForForgeDirection(this.getInputDirection()));
|
||||
par1NBTTagCompound.setInteger("outputFace", TEOrientable.getIntForForgeDirection(this.getOutputDirection()));
|
||||
par1NBTTagCompound.setInteger("inputFace", TEOrientable.getIntForEnumFacing(this.getInputDirection()));
|
||||
par1NBTTagCompound.setInteger("outputFace", TEOrientable.getIntForEnumFacing(this.getOutputDirection()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getInputDirection()
|
||||
public EnumFacing getInputDirection()
|
||||
{
|
||||
return this.inputFace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getOutputDirection()
|
||||
public EnumFacing getOutputDirection()
|
||||
{
|
||||
return this.outputFace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInputDirection(ForgeDirection direction)
|
||||
public void setInputDirection(EnumFacing direction)
|
||||
{
|
||||
this.inputFace = direction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOutputDirection(ForgeDirection direction)
|
||||
public void setOutputDirection(EnumFacing direction)
|
||||
{
|
||||
this.outputFace = direction;
|
||||
}
|
||||
|
||||
public static int getIntForForgeDirection(ForgeDirection direction)
|
||||
public static int getIntForEnumFacing(EnumFacing direction)
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
|
@ -92,7 +92,7 @@ public class TEOrientable extends TileEntity implements IOrientable
|
|||
}
|
||||
|
||||
|
||||
public boolean isSideRendered(ForgeDirection side)
|
||||
public boolean isSideRendered(EnumFacing side)
|
||||
{
|
||||
if (side.equals(this.getInputDirection()) || side.equals(this.getOutputDirection()))
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@ public class TEPedestal extends TEInventory
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
public String getName()
|
||||
{
|
||||
return "TEPedestal";
|
||||
}
|
||||
|
@ -57,13 +57,6 @@ 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;
|
||||
|
@ -134,12 +127,12 @@ public class TEPedestal extends TEInventory
|
|||
|
||||
public void onItemDeletion()
|
||||
{
|
||||
worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, xCoord, yCoord, zCoord));
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, pos.getX(), pos.getY(), pos.getZ()));
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 2, xCoord, yCoord, zCoord);
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 2, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,9 @@ 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,7 +22,7 @@ import WayofTime.alchemicalWizardry.common.NewPacketHandler;
|
|||
import WayofTime.alchemicalWizardry.common.PlinthComponent;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
|
||||
|
||||
public class TEPlinth extends TEInventory
|
||||
public class TEPlinth extends TEInventory implements IUpdatePlayerListBox
|
||||
{
|
||||
public static final int sizeInv = 1;
|
||||
|
||||
|
@ -149,7 +151,7 @@ public class TEPlinth extends TEInventory
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
public String getName()
|
||||
{
|
||||
return "TEPlinth";
|
||||
}
|
||||
|
@ -162,10 +164,8 @@ public class TEPlinth extends TEInventory
|
|||
|
||||
//Logic for the actual block is under here
|
||||
@Override
|
||||
public void updateEntity()
|
||||
public void update()
|
||||
{
|
||||
super.updateEntity();
|
||||
|
||||
if (worldObj.isRemote)
|
||||
{
|
||||
return;
|
||||
|
@ -251,7 +251,7 @@ public class TEPlinth extends TEInventory
|
|||
|
||||
if (entity != null)
|
||||
{
|
||||
entity.setPosition(xCoord + 0.5, yCoord + 1, zCoord + 0.5);
|
||||
entity.setPosition(pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5);
|
||||
worldObj.spawnEntityInWorld(entity);
|
||||
|
||||
if (entity instanceof IDemon)
|
||||
|
@ -266,7 +266,7 @@ public class TEPlinth extends TEInventory
|
|||
|
||||
if (worldObj != null)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -284,12 +284,13 @@ public class TEPlinth extends TEInventory
|
|||
{
|
||||
if (i < 6 && pc.getRing() == ring)
|
||||
{
|
||||
TileEntity tileEntity = worldObj.getTileEntity(xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset);
|
||||
BlockPos newPos = pos.add(pc.xOffset, pc.yOffset, pc.zOffset);
|
||||
TileEntity tileEntity = worldObj.getTileEntity(newPos);
|
||||
|
||||
if (tileEntity instanceof TEPedestal)
|
||||
{
|
||||
((TEPedestal) tileEntity).setInventorySlotContents(0, null);
|
||||
worldObj.markBlockForUpdate(xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset);
|
||||
worldObj.markBlockForUpdate(newPos);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
@ -302,12 +303,13 @@ public class TEPlinth extends TEInventory
|
|||
{
|
||||
if (i < 6 && pc.getRing() == ring)
|
||||
{
|
||||
TileEntity tileEntity = worldObj.getTileEntity(xCoord + pc.zOffset, yCoord + pc.yOffset, zCoord + pc.xOffset);
|
||||
BlockPos newPos = pos.add(pc.zOffset, pc.yOffset, pc.xOffset);
|
||||
TileEntity tileEntity = worldObj.getTileEntity(newPos);
|
||||
|
||||
if (tileEntity instanceof TEPedestal)
|
||||
{
|
||||
((TEPedestal) tileEntity).setInventorySlotContents(0, null);
|
||||
worldObj.markBlockForUpdate(xCoord + pc.zOffset, yCoord + pc.yOffset, zCoord + pc.xOffset);
|
||||
worldObj.markBlockForUpdate(newPos);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
@ -330,7 +332,8 @@ public class TEPlinth extends TEInventory
|
|||
{
|
||||
if (i < 6 && pc.getRing() == ring)
|
||||
{
|
||||
TileEntity tileEntity = worldObj.getTileEntity(xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset);
|
||||
BlockPos newPos = pos.add(pc.xOffset, pc.yOffset, pc.zOffset);
|
||||
TileEntity tileEntity = worldObj.getTileEntity(newPos);
|
||||
|
||||
if (tileEntity instanceof TEPedestal)
|
||||
{
|
||||
|
@ -365,7 +368,7 @@ public class TEPlinth extends TEInventory
|
|||
((TEPedestal) tileEntity).setInventorySlotContents(0, null);
|
||||
}
|
||||
((TEPedestal) tileEntity).onItemDeletion();
|
||||
worldObj.markBlockForUpdate(xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset);
|
||||
worldObj.markBlockForUpdate(newPos);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -382,7 +385,8 @@ public class TEPlinth extends TEInventory
|
|||
{
|
||||
if (i < 6 && pc.getRing() == ring)
|
||||
{
|
||||
TileEntity tileEntity = worldObj.getTileEntity(xCoord + pc.zOffset, yCoord + pc.yOffset, zCoord + pc.xOffset);
|
||||
BlockPos newPos = pos.add(pc.zOffset, pc.yOffset, pc.xOffset);
|
||||
TileEntity tileEntity = worldObj.getTileEntity(newPos);
|
||||
|
||||
if (tileEntity instanceof TEPedestal)
|
||||
{
|
||||
|
@ -413,7 +417,7 @@ public class TEPlinth extends TEInventory
|
|||
{
|
||||
((TEPedestal) tileEntity).decrStackSize(0, 1);
|
||||
((TEPedestal) tileEntity).onItemDeletion();
|
||||
worldObj.markBlockForUpdate(xCoord + pc.zOffset, yCoord + pc.yOffset, zCoord + pc.zOffset);
|
||||
worldObj.markBlockForUpdate(newPos);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -439,7 +443,8 @@ public class TEPlinth extends TEInventory
|
|||
{
|
||||
if (i < 6 && pc.getRing() == ring)
|
||||
{
|
||||
TileEntity tileEntity = worldObj.getTileEntity(xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset);
|
||||
BlockPos newPos = pos.add(pc.xOffset, pc.yOffset, pc.zOffset);
|
||||
TileEntity tileEntity = worldObj.getTileEntity(newPos);
|
||||
|
||||
if (tileEntity instanceof TEPedestal)
|
||||
{
|
||||
|
@ -456,7 +461,8 @@ public class TEPlinth extends TEInventory
|
|||
{
|
||||
if (i < 6 && pc.getRing() == ring)
|
||||
{
|
||||
TileEntity tileEntity = worldObj.getTileEntity(xCoord + pc.zOffset, yCoord + pc.yOffset, zCoord + pc.xOffset);
|
||||
BlockPos newPos = pos.add(pc.zOffset, pc.yOffset, pc.xOffset);
|
||||
TileEntity tileEntity = worldObj.getTileEntity(newPos);
|
||||
|
||||
if (tileEntity instanceof TEPedestal)
|
||||
{
|
||||
|
|
|
@ -1,31 +1,38 @@
|
|||
package WayofTime.alchemicalWizardry.common.tileEntity;
|
||||
|
||||
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;
|
||||
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.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
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
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
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 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 cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TEReagentConduit extends TileSegmentedReagentHandler implements IUpdatePlayerListBox
|
||||
{
|
||||
public List<ColourAndCoords> destinationList; //These are offsets
|
||||
public Map<Reagent, List<Int3>> reagentTargetList;
|
||||
|
@ -253,7 +260,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
public void update()
|
||||
{
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
|
@ -270,7 +277,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler
|
|||
this.updateColourList();
|
||||
}
|
||||
|
||||
if (affectedByRedstone && worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord))
|
||||
if (affectedByRedstone && worldObj.isBlockPowered(pos)) //isBlockBeingIndirectlyPowered()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -286,7 +293,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler
|
|||
break;
|
||||
}
|
||||
|
||||
ReagentStack maxDrainAmount = this.drain(ForgeDirection.UNKNOWN, new ReagentStack(entry.getKey(), this.tickRate - totalTransfered), false);
|
||||
ReagentStack maxDrainAmount = this.drain(EnumFacing.UP, new ReagentStack(entry.getKey(), this.tickRate - totalTransfered), false);
|
||||
|
||||
if (maxDrainAmount == null)
|
||||
{
|
||||
|
@ -300,28 +307,26 @@ public class TEReagentConduit extends TileSegmentedReagentHandler
|
|||
continue;
|
||||
}
|
||||
|
||||
int x = xCoord + coord.xCoord;
|
||||
int y = yCoord + coord.yCoord;
|
||||
int z = zCoord + coord.zCoord;
|
||||
BlockPos newPos = pos.add(coord.xCoord, coord.yCoord, coord.zCoord);
|
||||
|
||||
TileEntity tile = worldObj.getTileEntity(x, y, z);
|
||||
TileEntity tile = worldObj.getTileEntity(newPos);
|
||||
if (tile instanceof IReagentHandler)
|
||||
{
|
||||
int amount = Math.min(((IReagentHandler) tile).fill(ForgeDirection.UNKNOWN, maxDrainAmount, false), amountLeft);
|
||||
int amount = Math.min(((IReagentHandler) tile).fill(EnumFacing.UP, maxDrainAmount, false), amountLeft);
|
||||
if (amount > 0)
|
||||
{
|
||||
amountLeft -= amount;
|
||||
totalTransfered += amount;
|
||||
|
||||
ReagentStack stack = this.drain(ForgeDirection.UNKNOWN, new ReagentStack(entry.getKey(), amount), true);
|
||||
((IReagentHandler) tile).fill(ForgeDirection.UNKNOWN, stack, true);
|
||||
ReagentStack stack = this.drain(EnumFacing.UP, new ReagentStack(entry.getKey(), amount), true);
|
||||
((IReagentHandler) tile).fill(EnumFacing.UP, stack, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (affectedByRedstone && worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord))
|
||||
if (affectedByRedstone && worldObj.isBlockPowered(pos))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -348,16 +353,17 @@ public class TEReagentConduit extends TileSegmentedReagentHandler
|
|||
{
|
||||
for (ColourAndCoords colourSet : this.destinationList)
|
||||
{
|
||||
if (!(worldObj.getTileEntity(xCoord + colourSet.xCoord, yCoord + colourSet.yCoord, zCoord + colourSet.zCoord) instanceof IReagentHandler))
|
||||
BlockPos newPos = pos.add(colourSet.xCoord, colourSet.yCoord, colourSet.zCoord);
|
||||
if (!(worldObj.getTileEntity(newPos) instanceof IReagentHandler))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
EntityParticleBeam beam = new EntityParticleBeam(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
|
||||
EntityParticleBeam beam = new EntityParticleBeam(worldObj, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
|
||||
double velocity = Math.sqrt(Math.pow(colourSet.xCoord, 2) + Math.pow(colourSet.yCoord, 2) + Math.pow(colourSet.zCoord, 2));
|
||||
double wantedVel = 0.3d;
|
||||
beam.setVelocity(wantedVel * colourSet.xCoord / velocity, wantedVel * colourSet.yCoord / velocity, wantedVel * colourSet.zCoord / velocity);
|
||||
beam.setColour(colourSet.colourRed / 255f, colourSet.colourGreen / 255f, colourSet.colourBlue / 255f);
|
||||
beam.setDestination(xCoord + colourSet.xCoord, yCoord + colourSet.yCoord, zCoord + colourSet.zCoord);
|
||||
beam.setDestination(pos.getX() + colourSet.xCoord, pos.getY() + colourSet.yCoord, pos.getZ() + colourSet.zCoord);
|
||||
worldObj.spawnEntityInWorld(beam);
|
||||
}
|
||||
}
|
||||
|
@ -375,7 +381,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler
|
|||
if (newList != null && !newList.equals(destinationList))
|
||||
{
|
||||
this.destinationList = newList;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -421,7 +427,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler
|
|||
|
||||
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 - this.xCoord, y - this.yCoord, z - this.zCoord);
|
||||
return this.addDestinationViaOffset(red, green, blue, intensity, x - pos.getX(), y - pos.getY(), z - pos.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -429,14 +435,14 @@ public class TEReagentConduit extends TileSegmentedReagentHandler
|
|||
{
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeClientNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 90210, nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(pos, 90210, nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
super.onDataPacket(net, packet);
|
||||
readClientNBT(packet.func_148857_g());
|
||||
readClientNBT(packet.getNbtCompound());
|
||||
}
|
||||
|
||||
public boolean addReagentDestinationViaOffset(Reagent reagent, int xOffset, int yOffset, int zOffset)
|
||||
|
@ -490,7 +496,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler
|
|||
|
||||
public boolean addReagentDestinationViaActual(Reagent reagent, int x, int y, int z)
|
||||
{
|
||||
return (this.addReagentDestinationViaOffset(reagent, x - xCoord, y - yCoord, z - zCoord));
|
||||
return (this.addReagentDestinationViaOffset(reagent, x - pos.getX(), y - pos.getY(), z - pos.getZ()));
|
||||
}
|
||||
|
||||
public boolean removeReagentDestinationViaOffset(Reagent reagent, int xOffset, int yOffset, int zOffset)
|
||||
|
@ -510,15 +516,15 @@ public class TEReagentConduit extends TileSegmentedReagentHandler
|
|||
|
||||
public boolean removeReagentDestinationViaActual(Reagent reagent, int x, int y, int z)
|
||||
{
|
||||
return this.removeReagentDestinationViaOffset(reagent, x - xCoord, y - yCoord, z - zCoord);
|
||||
return this.removeReagentDestinationViaOffset(reagent, x - pos.getX(), y - pos.getY(), z - pos.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill)
|
||||
public int fill(EnumFacing from, ReagentStack resource, boolean doFill)
|
||||
{
|
||||
if (doFill && !worldObj.isRemote)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
hasChanged = 2;
|
||||
}
|
||||
|
||||
|
@ -526,11 +532,11 @@ public class TEReagentConduit extends TileSegmentedReagentHandler
|
|||
}
|
||||
|
||||
@Override
|
||||
public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain)
|
||||
public ReagentStack drain(EnumFacing from, ReagentStack resource, boolean doDrain)
|
||||
{
|
||||
if (doDrain && !worldObj.isRemote)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
hasChanged = 2;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,19 +1,22 @@
|
|||
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.entity.player.EntityPlayer;
|
||||
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;
|
||||
|
@ -35,14 +38,15 @@ public class TESchematicSaver extends TileEntity
|
|||
{
|
||||
for (int k = -negZ + 1; k <= posZ - 1; k++)
|
||||
{
|
||||
int meta = worldObj.getBlockMetadata(xCoord + i, yCoord + j, zCoord + k);
|
||||
Block block = worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k);
|
||||
BlockPos newPos = pos.add(i, j, k);
|
||||
IBlockState state = worldObj.getBlockState(newPos);
|
||||
Block block = state.getBlock();
|
||||
int meta = block.getMetaFromState(state);
|
||||
|
||||
if (!block.isAir(worldObj, xCoord + i, yCoord + j, zCoord + k))
|
||||
if (!block.isAir(worldObj, newPos))
|
||||
{
|
||||
schematic.addBlockWithMeta(block, meta, i, j, k);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,7 +74,7 @@ public class TESchematicSaver extends TileEntity
|
|||
int i = 1;
|
||||
while (i < 100)
|
||||
{
|
||||
if (targetBlock == (worldObj.getBlock(xCoord, yCoord + i, zCoord)))
|
||||
if (targetBlock == (worldObj.getBlockState(pos.add(0, i, 0)).getBlock()))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
@ -85,7 +89,7 @@ public class TESchematicSaver extends TileEntity
|
|||
int i = 1;
|
||||
while (i < 100)
|
||||
{
|
||||
if (targetBlock == (worldObj.getBlock(xCoord, yCoord - i, zCoord)))
|
||||
if (targetBlock == (worldObj.getBlockState(pos.add(0, -i, 0)).getBlock()))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
@ -100,7 +104,7 @@ public class TESchematicSaver extends TileEntity
|
|||
int i = 1;
|
||||
while (i < 100)
|
||||
{
|
||||
if (targetBlock == (worldObj.getBlock(xCoord + i, yCoord, zCoord)))
|
||||
if (targetBlock == (worldObj.getBlockState(pos.add(i, 0, 0)).getBlock()))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
@ -115,7 +119,7 @@ public class TESchematicSaver extends TileEntity
|
|||
int i = 1;
|
||||
while (i < 100)
|
||||
{
|
||||
if (targetBlock == (worldObj.getBlock(xCoord - i, yCoord, zCoord)))
|
||||
if (targetBlock == (worldObj.getBlockState(pos.add(-i, 0, 0)).getBlock()))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
@ -130,7 +134,7 @@ public class TESchematicSaver extends TileEntity
|
|||
int i = 1;
|
||||
while (i < 100)
|
||||
{
|
||||
if (targetBlock == (worldObj.getBlock(xCoord, yCoord, zCoord + i)))
|
||||
if (targetBlock == (worldObj.getBlockState(pos.add(0, 0, i)).getBlock()))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
@ -145,7 +149,7 @@ public class TESchematicSaver extends TileEntity
|
|||
int i = 1;
|
||||
while (i < 100)
|
||||
{
|
||||
if (targetBlock == (worldObj.getBlock(xCoord, yCoord, zCoord - i)))
|
||||
if (targetBlock == (worldObj.getBlockState(pos.add(0, 0, -i)).getBlock()))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class TESocket extends TEInventory
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
public String getName()
|
||||
{
|
||||
return "TESocket";
|
||||
}
|
||||
|
@ -56,13 +56,6 @@ 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;
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package WayofTime.alchemicalWizardry.common.tileEntity;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
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;
|
||||
|
||||
public class TESpectralBlock extends TileEntity
|
||||
public class TESpectralBlock extends TileEntity implements IUpdatePlayerListBox
|
||||
{
|
||||
private int ticksRemaining;
|
||||
|
||||
|
@ -31,31 +33,30 @@ public class TESpectralBlock extends TileEntity
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
public void update()
|
||||
{
|
||||
super.updateEntity();
|
||||
|
||||
// if (worldObj.isRemote)
|
||||
if (worldObj.isRemote)
|
||||
{
|
||||
// return;
|
||||
return;
|
||||
}
|
||||
|
||||
this.ticksRemaining--;
|
||||
|
||||
if (this.ticksRemaining <= 0)
|
||||
{
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
worldObj.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean createSpectralBlockAtLocation(World world, int x, int y, int z, int duration)
|
||||
public static boolean createSpectralBlockAtLocation(World world, BlockPos pos, int duration)
|
||||
{
|
||||
if (!world.isAirBlock(x, y, z))
|
||||
if (!world.isAirBlock(pos))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
world.setBlock(x, y, z, ModBlocks.spectralBlock);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
world.setBlockState(pos, ModBlocks.spectralBlock.getDefaultState());
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TESpectralBlock)
|
||||
{
|
||||
((TESpectralBlock) tile).setDuration(duration);
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
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
|
||||
public class TESpectralContainer extends TileEntity implements IUpdatePlayerListBox
|
||||
{
|
||||
private ItemStack[] inv;
|
||||
|
||||
|
@ -66,10 +69,8 @@ public class TESpectralContainer extends TileEntity
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
public void update()
|
||||
{
|
||||
super.updateEntity();
|
||||
|
||||
this.ticksRemaining--;
|
||||
|
||||
if (this.ticksRemaining <= 0)
|
||||
|
@ -78,22 +79,23 @@ public class TESpectralContainer extends TileEntity
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean createSpectralBlockAtLocation(World world, int x, int y, int z, int duration)
|
||||
public static boolean createSpectralBlockAtLocation(World world, BlockPos pos, int duration)
|
||||
{
|
||||
Block block = world.getBlock(x, y, z);
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
|
||||
if (block == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (world.getTileEntity(x, y, z) == null || block instanceof IFluidBlock)
|
||||
if (world.getTileEntity(pos) == null || block instanceof IFluidBlock)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
int meta = block.getMetaFromState(state);
|
||||
ItemStack item = new ItemStack(block, 1, meta);
|
||||
|
||||
world.setBlock(x, y, z, ModBlocks.blockSpectralContainer);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
world.setBlockState(pos, ModBlocks.blockSpectralContainer.getDefaultState());
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TESpectralContainer)
|
||||
{
|
||||
((TESpectralContainer) tile).setContainedItem(item);
|
||||
|
@ -130,18 +132,18 @@ public class TESpectralContainer extends TileEntity
|
|||
{
|
||||
if (item.getItem() instanceof ItemBlock)
|
||||
{
|
||||
Block block = ((ItemBlock) item.getItem()).field_150939_a;
|
||||
Block block = ((ItemBlock) item.getItem()).getBlock();
|
||||
int meta = item.getItemDamage();
|
||||
|
||||
if (block != null)
|
||||
{
|
||||
this.worldObj.setBlock(xCoord, yCoord, zCoord, block, meta, 6);
|
||||
this.worldObj.setBlockState(pos, block.getStateFromMeta(meta), 6);
|
||||
}
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
this.worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
this.worldObj.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,12 +23,12 @@ public abstract class TESpellBlock extends TEOrientable implements ISpellTile
|
|||
|
||||
public TESpellBlock getTileAtOutput()
|
||||
{
|
||||
ForgeDirection output = this.getOutputDirection();
|
||||
int xOffset = output.offsetX;
|
||||
int yOffset = output.offsetY;
|
||||
int zOffset = output.offsetZ;
|
||||
EnumFacing output = this.getOutputDirection();
|
||||
int xOffset = output.getFrontOffsetX();
|
||||
int yOffset = output.getFrontOffsetY();
|
||||
int zOffset = output.getFrontOffsetZ();
|
||||
|
||||
TileEntity tile = worldObj.getTileEntity(xCoord + xOffset, yCoord + yOffset, zCoord + zOffset);
|
||||
TileEntity tile = worldObj.getTileEntity(pos.add(output.getDirectionVec()));
|
||||
|
||||
if (tile instanceof TESpellBlock && ((TESpellBlock) tile).canInputRecieveOutput(output))
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ public abstract class TESpellBlock extends TEOrientable implements ISpellTile
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canInputRecieveOutput(ForgeDirection output)
|
||||
public boolean canInputRecieveOutput(EnumFacing output)
|
||||
{
|
||||
return this.canInputRecieve() && this.getInputDirection().getOpposite() == output;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public class TESpellEffectBlock extends TESpellBlock
|
|||
|
||||
public SpellEffect getSpellEffect()
|
||||
{
|
||||
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
int meta = this.getBlockMetadata();
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
|
|
|
@ -37,7 +37,7 @@ public class TESpellEnhancementBlock extends TESpellBlock
|
|||
|
||||
public SpellEnhancement getSpellEnhancement()
|
||||
{
|
||||
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
int meta = this.getBlockMetadata();
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
|
@ -64,7 +64,7 @@ public class TESpellEnhancementBlock extends TESpellBlock
|
|||
|
||||
public int getLimit()
|
||||
{
|
||||
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
int meta = this.getBlockMetadata();
|
||||
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 = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
int meta = this.getBlockMetadata();
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
|
|
|
@ -13,7 +13,7 @@ public class TESpellModifierBlock extends TESpellBlock
|
|||
|
||||
public ComplexSpellModifier getSpellModifier()
|
||||
{
|
||||
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
int meta = this.getBlockMetadata();
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
|
|
|
@ -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 = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
int meta = this.getBlockMetadata();
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
|
@ -68,14 +68,14 @@ public class TESpellParadigmBlock extends TESpellBlock implements ISpellParadigm
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setInputDirection(ForgeDirection direction)
|
||||
public void setInputDirection(EnumFacing direction)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getInputDirection()
|
||||
public EnumFacing getInputDirection()
|
||||
{
|
||||
return ForgeDirection.UNKNOWN;
|
||||
return EnumFacing.WEST;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,13 +3,14 @@ package WayofTime.alchemicalWizardry.common.tileEntity;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
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;
|
||||
|
@ -17,7 +18,7 @@ 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
|
||||
public class TETeleposer extends TEInventory implements IUpdatePlayerListBox
|
||||
{
|
||||
public static final int sizeInv = 1;
|
||||
|
||||
|
@ -59,7 +60,7 @@ public class TETeleposer extends TEInventory
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
public String getName()
|
||||
{
|
||||
return "TETeleposer";
|
||||
}
|
||||
|
@ -72,16 +73,14 @@ public class TETeleposer extends TEInventory
|
|||
|
||||
//Logic for the actual block is under here
|
||||
@Override
|
||||
public void updateEntity()
|
||||
public void update()
|
||||
{
|
||||
super.updateEntity();
|
||||
|
||||
if (worldObj.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int currentInput = worldObj.getBlockPowerInput(xCoord, yCoord, zCoord);
|
||||
int currentInput = worldObj.getStrongPower(pos);
|
||||
|
||||
if (previousInput == 0 && currentInput != 0)
|
||||
{
|
||||
|
@ -93,18 +92,20 @@ public class TETeleposer extends TEInventory
|
|||
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((xCoord - xf) * (xCoord - xf) + (yCoord - yf + 1) * (yCoord - yf + 1) + (zCoord - zf) * (zCoord - zf)));
|
||||
int damage = (int) (0.5f * Math.sqrt(pos.distanceSq(posF)));
|
||||
int focusLevel = focusItem.getFocusLevel();
|
||||
int transportCount = 0;
|
||||
int entityCount = 0;
|
||||
|
||||
if (worldF != null && worldF.getTileEntity(xf, yf, zf) instanceof TETeleposer && !worldF.getTileEntity(xf, yf, zf).equals(this))
|
||||
if (worldF != null && worldF.getTileEntity(posF) instanceof TETeleposer && !worldF.getTileEntity(posF).equals(this))
|
||||
{
|
||||
//Prime the teleportation
|
||||
int d0 = focusLevel - 1;
|
||||
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);
|
||||
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);
|
||||
List list1 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb1);
|
||||
Iterator iterator1 = list1.iterator();
|
||||
EntityLivingBase entityplayer1;
|
||||
|
@ -115,7 +116,7 @@ public class TETeleposer extends TEInventory
|
|||
entityCount++;
|
||||
}
|
||||
|
||||
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);
|
||||
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);
|
||||
List list2 = worldF.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb2);
|
||||
Iterator iterator2 = list2.iterator();
|
||||
EntityLivingBase entityplayer2;
|
||||
|
@ -134,7 +135,7 @@ public class TETeleposer extends TEInventory
|
|||
for (int j = -(focusLevel - 1); j <= (focusLevel - 1); j++)
|
||||
{
|
||||
{
|
||||
if (BlockTeleposer.swapBlocks(this, worldObj, worldF, xCoord + i, yCoord + 1 + k, zCoord + j, xf + i, yf + 1 + k, zf + j))
|
||||
if (BlockTeleposer.swapBlocks(this, worldObj, worldF, pos.add(i, 1 + k, j), posF.add(i, 1 + k, j)))
|
||||
{
|
||||
transportCount++;
|
||||
}
|
||||
|
@ -147,7 +148,7 @@ public class TETeleposer extends TEInventory
|
|||
entityCount = 0;
|
||||
}
|
||||
|
||||
SoulNetworkHandler.syphonFromNetwork(focus, damage * transportCount + damage * entityCount);
|
||||
EnergyItems.syphonWhileInContainer(focus, damage * transportCount + damage * entityCount);
|
||||
//Teleport
|
||||
|
||||
if (worldF.equals(worldObj))
|
||||
|
@ -159,14 +160,14 @@ public class TETeleposer extends TEInventory
|
|||
{
|
||||
entityplayer1 = (EntityLivingBase) iterator1.next();
|
||||
entityplayer1.worldObj = worldF;
|
||||
entityplayer1.setPositionAndUpdate(entityplayer1.posX - this.xCoord + xf, entityplayer1.posY - this.yCoord + yf, entityplayer1.posZ - this.zCoord + zf);
|
||||
entityplayer1.setPositionAndUpdate(entityplayer1.posX - pos.getX() + xf, entityplayer1.posY - pos.getY() + yf, entityplayer1.posZ - pos.getZ() + zf);
|
||||
}
|
||||
|
||||
while (iterator2.hasNext())
|
||||
{
|
||||
entityplayer2 = (EntityLivingBase) iterator2.next();
|
||||
entityplayer2.worldObj = worldF;
|
||||
entityplayer2.setPositionAndUpdate(entityplayer2.posX + this.xCoord - xf, entityplayer2.posY + this.yCoord - yf, entityplayer2.posZ + this.zCoord - zf);
|
||||
entityplayer2.setPositionAndUpdate(entityplayer2.posX + pos.getX() - xf, entityplayer2.posY + pos.getY() - yf, entityplayer2.posZ + pos.getZ() - zf);
|
||||
}
|
||||
}else
|
||||
{
|
||||
|
@ -176,17 +177,17 @@ public class TETeleposer extends TEInventory
|
|||
while (iterator1.hasNext())
|
||||
{
|
||||
entityplayer1 = (EntityLivingBase) iterator1.next();
|
||||
SpellHelper.teleportEntityToDim(worldObj, worldF.provider.dimensionId, entityplayer1.posX - this.xCoord + xf, entityplayer1.posY - this.yCoord + yf, entityplayer1.posZ - this.zCoord + zf, entityplayer1);
|
||||
SpellHelper.teleportEntityToDim(worldObj, worldF.provider.getDimensionId(), entityplayer1.posX - pos.getX() + xf, entityplayer1.posY - pos.getY() + yf, entityplayer1.posZ - pos.getZ() + zf, entityplayer1);
|
||||
// entityplayer1.worldObj = worldF;
|
||||
// entityplayer1.setPositionAndUpdate(entityplayer1.posX - this.xCoord + xf, entityplayer1.posY - this.yCoord + yf, entityplayer1.posZ - this.zCoord + zf);
|
||||
// entityplayer1.setPositionAndUpdate(entityplayer1.posX - pos.getX() + xf, entityplayer1.posY - pos.getY() + yf, entityplayer1.posZ - pos.getZ() + zf);
|
||||
}
|
||||
|
||||
while (iterator2.hasNext())
|
||||
{
|
||||
entityplayer2 = (EntityLivingBase) iterator2.next();
|
||||
SpellHelper.teleportEntityToDim(worldF, worldObj.provider.dimensionId, entityplayer2.posX + this.xCoord - xf, entityplayer2.posY + this.yCoord - yf, entityplayer2.posZ + this.zCoord - zf, entityplayer2);
|
||||
SpellHelper.teleportEntityToDim(worldF, worldObj.provider.getDimensionId(), entityplayer2.posX + pos.getX() - xf, entityplayer2.posY + pos.getY() - yf, entityplayer2.posZ + pos.getZ() - zf, entityplayer2);
|
||||
// entityplayer2.worldObj = worldF;
|
||||
// entityplayer2.setPositionAndUpdate(entityplayer2.posX + this.xCoord - xf, entityplayer2.posY + this.yCoord - yf, entityplayer2.posZ + this.zCoord - zf);
|
||||
// entityplayer2.setPositionAndUpdate(entityplayer2.posX + pos.getX() - xf, entityplayer2.posY + pos.getY() - yf, entityplayer2.posZ + pos.getZ() - zf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.server.gui.IUpdatePlayerListBox;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.AlchemicalPotionCreationHandler;
|
||||
|
@ -22,7 +23,7 @@ import WayofTime.alchemicalWizardry.common.alchemy.ICombinationalCatalyst;
|
|||
import WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class TEWritingTable extends TEInventory implements ISidedInventory
|
||||
public class TEWritingTable extends TEInventory implements ISidedInventory, IUpdatePlayerListBox
|
||||
{
|
||||
public static final int sizeInv = 7;
|
||||
|
||||
|
@ -59,7 +60,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
public String getName()
|
||||
{
|
||||
return "aw.TEWritingTable";
|
||||
}
|
||||
|
@ -298,7 +299,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
public void update()
|
||||
{
|
||||
int progressNeeded = 100;
|
||||
long worldTime = worldObj.getWorldTime();
|
||||
|
@ -322,7 +323,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldTime % 4 == 0)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
|
||||
}
|
||||
|
||||
if (progress >= progressNeeded)
|
||||
|
@ -337,7 +338,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldObj != null)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -353,7 +354,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldObj != null)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -374,7 +375,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldObj != null)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -386,7 +387,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldTime % 4 == 0)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
|
||||
}
|
||||
|
||||
if (progress >= progressNeeded)
|
||||
|
@ -401,7 +402,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldObj != null)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -417,7 +418,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldObj != null)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -429,7 +430,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
this.setInventorySlotContents(6, flaskStack);
|
||||
} else
|
||||
{
|
||||
worldObj.createExplosion(null, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 2, false);
|
||||
worldObj.createExplosion(null, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 2, false);
|
||||
}
|
||||
|
||||
this.decrStackSize(this.getPotionFlaskPosition(), 1);
|
||||
|
@ -439,7 +440,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldObj != null)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -452,7 +453,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldTime % 4 == 0)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
|
||||
}
|
||||
|
||||
if (progress >= progressNeeded)
|
||||
|
@ -466,7 +467,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldObj != null)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -479,7 +480,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldObj != null)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -491,7 +492,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldTime % 4 == 0)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
|
||||
}
|
||||
|
||||
if (progress >= progressNeeded)
|
||||
|
@ -505,7 +506,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldObj != null)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -520,7 +521,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldObj != null)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -533,7 +534,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldTime % 4 == 0)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
|
||||
}
|
||||
|
||||
if (progress >= progressNeeded)
|
||||
|
@ -547,7 +548,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldObj != null)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -564,7 +565,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldObj != null)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -584,7 +585,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldObj != null)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -599,7 +600,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldTime % 4 == 0)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
|
||||
}
|
||||
|
||||
progress += acceleration;
|
||||
|
@ -620,14 +621,14 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldObj != null)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
}
|
||||
} else if (getStackInSlot(6).getItem() == getResultingItemStack().getItem() && getResultingItemStack().stackSize <= (getStackInSlot(6).getMaxStackSize() - getStackInSlot(6).stackSize))
|
||||
{
|
||||
if (worldTime % 4 == 0)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, pos, 20, worldObj.provider.getDimensionId(), 1, pos);
|
||||
}
|
||||
|
||||
if (!SoulNetworkHandler.syphonFromNetworkWhileInContainer(getStackInSlot(0), amountUsed * acceleration))
|
||||
|
@ -655,7 +656,7 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
|
||||
if (worldObj != null)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -737,10 +738,9 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side)
|
||||
public int[] getSlotsForFace(EnumFacing facing)
|
||||
{
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(side);
|
||||
switch(dir)
|
||||
switch(facing)
|
||||
{
|
||||
case DOWN:
|
||||
return new int[]{6};
|
||||
|
@ -750,13 +750,13 @@ public class TEWritingTable extends TEInventory implements ISidedInventory
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side)
|
||||
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing facing)
|
||||
{
|
||||
return slot != 6;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side)
|
||||
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing facing)
|
||||
{
|
||||
return slot == 6;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package WayofTime.alchemicalWizardry.common.tileEntity.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
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;
|
||||
|
@ -10,7 +13,6 @@ import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
|
|||
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
|
||||
{
|
||||
|
@ -19,11 +21,12 @@ 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(x, y, z);
|
||||
tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if (tileEntity instanceof TEWritingTable)
|
||||
{
|
||||
|
@ -31,7 +34,7 @@ public class GuiHandler implements IGuiHandler
|
|||
}
|
||||
|
||||
case 1:
|
||||
tileEntity = world.getTileEntity(x, y, z);
|
||||
tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if (tileEntity instanceof TETeleposer)
|
||||
{
|
||||
|
@ -50,11 +53,14 @@ 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);
|
||||
|
||||
ItemStack held = player.getHeldItem();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case 0:
|
||||
tileEntity = world.getTileEntity(x, y, z);
|
||||
tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if (tileEntity instanceof TEWritingTable)
|
||||
{
|
||||
|
@ -64,7 +70,7 @@ public class GuiHandler implements IGuiHandler
|
|||
break;
|
||||
|
||||
case 1:
|
||||
tileEntity = world.getTileEntity(x, y, z);
|
||||
tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if (tileEntity instanceof TETeleposer)
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.tileEntity.gui;
|
|||
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.container.ContainerTeleposer;
|
||||
import net.minecraft.client.gui.inventory.GuiBrewingStand;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue