move more block logic to mantle

This commit is contained in:
Progwml6 committed 2013-12-06 13:33:55 -05:00
1 parent d19d4d4a0c
commit bbec72109a
19 files changed
+35 -590

No files matched your search

@@ -24,7 +24,7 @@ import net.minecraftforge.fluids.FluidTankInfo;
import tconstruct.blocks.logic.LavaTankLogic;
import tconstruct.client.block.TankRender;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.util.IServantLogic;
import mantle.blocks.iface.IServantLogic;
public class LavaTankBlock extends BlockContainer
{
@@ -14,7 +14,6 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import tconstruct.TConstruct;
import tconstruct.blocks.logic.AdaptiveSmelteryLogic;
import tconstruct.blocks.logic.MultiServantLogic;
import tconstruct.blocks.logic.AdaptiveDrainLogic;
import tconstruct.blocks.logic.SmelteryDrainLogic;
import tconstruct.blocks.logic.SmelteryLogic;
@@ -22,8 +21,9 @@ import tconstruct.client.block.SmelteryRender;
import tconstruct.library.TConstructRegistry;
import mantle.blocks.abstracts.InventoryBlock;
import mantle.blocks.iface.IFacingLogic;
import tconstruct.library.util.IMasterLogic;
import tconstruct.library.util.IServantLogic;
import mantle.blocks.iface.IMasterLogic;
import mantle.blocks.iface.IServantLogic;
import mantle.blocks.iface.MultiServantLogic;
import tconstruct.util.config.PHConstruct;
public class SmelteryBlock extends InventoryBlock
@@ -3,6 +3,7 @@ package tconstruct.blocks.component;
import java.util.ArrayList;
import java.util.Iterator;
import mantle.blocks.iface.IServantLogic;
import mantle.world.CoordTuple;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
@@ -12,7 +13,6 @@ import net.minecraft.tileentity.TileEntity;
import tconstruct.common.TContent;
import tconstruct.common.TRepo;
import tconstruct.library.component.TankLayerScan;
import tconstruct.library.util.IServantLogic;
public class SmelteryScan extends TankLayerScan
{
@@ -1,7 +1,8 @@
package tconstruct.blocks.logic;
import mantle.blocks.iface.IFacingLogic;
import tconstruct.library.util.IMasterLogic;
import mantle.blocks.iface.IMasterLogic;
import mantle.blocks.iface.MultiServantLogic;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
@@ -28,7 +29,7 @@ public class AdaptiveDrainLogic extends MultiServantLogic implements IFluidHandl
public boolean setPotentialMaster (IMasterLogic master, World world, int x, int y, int z)
{
// TConstruct.logger.info("Master: "+master);
return (master instanceof AdaptiveSmelteryLogic || master instanceof AdaptiveDrainLogic) && !hasMaster;
return (master instanceof AdaptiveSmelteryLogic || master instanceof AdaptiveDrainLogic) && !hasValidMaster();
}
@Override
@@ -36,7 +37,7 @@ public class AdaptiveDrainLogic extends MultiServantLogic implements IFluidHandl
{
if (hasValidMaster() && canDrain(from, null))
{
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
return smeltery.fill(from, resource, doFill);
}
return 0;
@@ -48,7 +49,7 @@ public class AdaptiveDrainLogic extends MultiServantLogic implements IFluidHandl
// TConstruct.logger.info("Attempting drain " + hasValidMaster());
if (hasValidMaster() && canDrain(from, null))
{
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
// TConstruct.logger.info("Found master");
return smeltery.drain(from, maxDrain, doDrain);
}
@@ -60,7 +61,7 @@ public class AdaptiveDrainLogic extends MultiServantLogic implements IFluidHandl
{
if (hasValidMaster() && canDrain(from, null))
{
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
return smeltery.drain(from, resource, doDrain);
}
return null;
@@ -71,7 +72,7 @@ public class AdaptiveDrainLogic extends MultiServantLogic implements IFluidHandl
{
if (hasValidMaster())
{
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
return smeltery.getFillState() < 2;
}
return false;
@@ -82,7 +83,7 @@ public class AdaptiveDrainLogic extends MultiServantLogic implements IFluidHandl
{
if (hasValidMaster())
{
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
return smeltery.getFillState() > 0;
}
return false;
@@ -93,7 +94,7 @@ public class AdaptiveDrainLogic extends MultiServantLogic implements IFluidHandl
{
if (hasValidMaster() && (from == getForgeDirection() || from == getForgeDirection().getOpposite() || from == ForgeDirection.UNKNOWN))
{
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
return smeltery.getTankInfo(ForgeDirection.UNKNOWN);
}
return null;
@@ -28,14 +28,14 @@ import tconstruct.blocks.component.SmelteryScan;
import tconstruct.common.TContent;
import tconstruct.common.TRepo;
import tconstruct.inventory.AdaptiveSmelteryContainer;
import tconstruct.library.blocks.AdaptiveInventoryLogic;
import mantle.blocks.abstracts.AdaptiveInventoryLogic;
import tconstruct.library.component.IComponentHolder;
import tconstruct.library.component.LogicComponent;
import tconstruct.library.component.MultiFluidTank;
import mantle.blocks.iface.IActiveLogic;
import mantle.world.CoordTuple;
import tconstruct.library.util.IMasterLogic;
import tconstruct.library.util.IServantLogic;
import mantle.blocks.iface.IMasterLogic;
import mantle.blocks.iface.IServantLogic;
public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IActiveLogic, IMasterLogic, IComponentHolder, IFluidHandler
{
@@ -1,5 +1,6 @@
package tconstruct.blocks.logic;
import mantle.blocks.iface.MultiServantLogic;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
@@ -1,177 +0,0 @@
package tconstruct.blocks.logic;
import mantle.world.CoordTuple;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet132TileEntityData;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import tconstruct.library.util.IMasterLogic;
import tconstruct.library.util.IServantLogic;
public class MultiServantLogic extends TileEntity implements IServantLogic
{
boolean hasMaster;
CoordTuple master;
short masterID;
byte masterMeat; //Typo, it stays!
public boolean canUpdate ()
{
return false;
}
public boolean hasValidMaster ()
{
if (!hasMaster)
return false;
if (worldObj.getBlockId(master.x, master.y, master.z) == masterID && worldObj.getBlockMetadata(master.x, master.y, master.z) == masterMeat)
return true;
else
{
hasMaster = false;
master = null;
return false;
}
}
public CoordTuple getMasterPosition ()
{
return master;
}
public void overrideMaster (int x, int y, int z)
{
hasMaster = true;
master = new CoordTuple(x, y, z);
masterID = (short) worldObj.getBlockId(x, y, z);
masterMeat = (byte) worldObj.getBlockMetadata(x, y, z);
}
public void removeMaster ()
{
hasMaster = false;
master = null;
masterID = 0;
masterMeat = 0;
}
@Deprecated
public boolean verifyMaster (IMasterLogic logic, int x, int y, int z)
{
if (master.equalCoords(x, y, z) && worldObj.getBlockId(x, y, z) == masterID && worldObj.getBlockMetadata(x, y, z) == masterMeat)
return true;
else
return false;
}
@Deprecated
public boolean setMaster (int x, int y, int z)
{
if (!hasMaster || worldObj.getBlockId(master.x, master.y, master.z) != masterID || (worldObj.getBlockMetadata(master.x, master.y, master.z) != masterMeat))
{
overrideMaster(x, y, z);
return true;
}
else
{
return false;
}
}
@Override
public boolean setPotentialMaster (IMasterLogic master, World world, int x, int y, int z)
{
return !hasMaster;
}
@Override
public boolean verifyMaster (IMasterLogic logic, World world, int x, int y, int z)
{
if (hasMaster)
{
return hasValidMaster();
}
else
{
overrideMaster(x, y, z);
return true;
}
}
@Override
public void invalidateMaster (IMasterLogic master, World world, int x, int y, int z)
{
hasMaster = false;
master = null;
}
public void notifyMasterOfChange ()
{
if (hasValidMaster())
{
IMasterLogic logic = (IMasterLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
logic.notifyChange(this, xCoord, yCoord, zCoord);
}
}
public void readCustomNBT (NBTTagCompound tags)
{
hasMaster = tags.getBoolean("TiedToMaster");
if (hasMaster)
{
int xCenter = tags.getInteger("xCenter");
int yCenter = tags.getInteger("yCenter");
int zCenter = tags.getInteger("zCenter");
master = new CoordTuple(xCenter, yCenter, zCenter);
masterID = tags.getShort("MasterID");
masterMeat = tags.getByte("masterMeat");
}
}
public void writeCustomNBT (NBTTagCompound tags)
{
tags.setBoolean("TiedToMaster", hasMaster);
if (hasMaster)
{
tags.setInteger("xCenter", master.x);
tags.setInteger("yCenter", master.y);
tags.setInteger("zCenter", master.z);
tags.setShort("MasterID", masterID);
tags.setByte("masterMeat", masterMeat);
}
}
@Override
public void readFromNBT (NBTTagCompound tags)
{
super.readFromNBT(tags);
readCustomNBT(tags);
}
@Override
public void writeToNBT (NBTTagCompound tags)
{
super.writeToNBT(tags);
writeCustomNBT(tags);
}
/* Packets */
@Override
public Packet getDescriptionPacket ()
{
NBTTagCompound tag = new NBTTagCompound();
writeCustomNBT(tag);
return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, tag);
}
@Override
public void onDataPacket (INetworkManager net, Packet132TileEntityData packet)
{
readCustomNBT(packet.data);
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
}
}
@@ -1,6 +1,7 @@
package tconstruct.blocks.logic;
import mantle.blocks.iface.IFacingLogic;
import mantle.blocks.iface.MultiServantLogic;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
@@ -29,7 +30,7 @@ public class SmelteryDrainLogic extends MultiServantLogic implements IFluidHandl
{
if (doFill)
{
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
return smeltery.fill(resource, doFill);
}
else
@@ -48,7 +49,7 @@ public class SmelteryDrainLogic extends MultiServantLogic implements IFluidHandl
{
if (hasValidMaster() && canDrain(from, null))
{
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
return smeltery.drain(maxDrain, doDrain);
}
else
@@ -79,7 +80,7 @@ public class SmelteryDrainLogic extends MultiServantLogic implements IFluidHandl
boolean containsFluid = fluid == null;
if (fluid != null)
{
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
for (FluidStack fstack : smeltery.moltenMetal)
{
if (fstack.fluidID == fluid.getID())
@@ -98,7 +99,7 @@ public class SmelteryDrainLogic extends MultiServantLogic implements IFluidHandl
{
if (hasValidMaster() && (from == getForgeDirection() || from == getForgeDirection().getOpposite() || from == ForgeDirection.UNKNOWN))
{
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
return smeltery.getMultiTankInfo();
//return new FluidTankInfo[] { smeltery.getInfo() };
}
@@ -37,9 +37,10 @@ import mantle.blocks.abstracts.InventoryLogic;
import tconstruct.library.crafting.Smeltery;
import mantle.blocks.iface.IActiveLogic;
import mantle.blocks.iface.IFacingLogic;
import mantle.blocks.iface.MultiServantLogic;
import mantle.world.CoordTuple;
import tconstruct.library.util.IMasterLogic;
import tconstruct.library.util.IServantLogic;
import mantle.blocks.iface.IMasterLogic;
import mantle.blocks.iface.IServantLogic;
import tconstruct.util.SmelteryDamageSource;
import tconstruct.util.config.PHConstruct;
import cpw.mods.fml.common.network.PacketDispatcher;
@@ -18,8 +18,8 @@ import tconstruct.TConstruct;
import tconstruct.blocks.component.TankAirComponent;
import mantle.blocks.abstracts.InventoryLogic;
import mantle.world.CoordTuple;
import tconstruct.library.util.IMasterLogic;
import tconstruct.library.util.IServantLogic;
import mantle.blocks.iface.IMasterLogic;
import mantle.blocks.iface.IServantLogic;
public class TankAirLogic extends InventoryLogic implements IServantLogic, ISidedInventory
{
@@ -1,9 +1,9 @@
package tconstruct.blocks.logic;
import tconstruct.library.blocks.AdaptiveInventoryLogic;
import mantle.blocks.abstracts.AdaptiveInventoryLogic;
import mantle.blocks.iface.IActiveLogic;
import mantle.blocks.iface.IFacingLogic;
import tconstruct.library.util.IMasterLogic;
import mantle.blocks.iface.IMasterLogic;
//Not actually abstract
public abstract class TowerFurnaceLogic extends AdaptiveInventoryLogic implements IActiveLogic, IFacingLogic, IMasterLogic
@@ -6,6 +6,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import mantle.blocks.iface.MultiServantLogic;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDispenser;
import net.minecraft.item.Item;
@@ -1,102 +0,0 @@
package tconstruct.library.blocks;
import java.util.Random;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import mantle.blocks.iface.IFacingLogic;
import mantle.blocks.abstracts.InventoryLogic;
public abstract class AdaptiveInventoryLogic extends InventoryLogic implements IFacingLogic
{
Random random = new Random();
protected int inventorySize;
public AdaptiveInventoryLogic()
{
super(0);
}
protected void adjustInventory (int size, boolean forceAdjust)
{
if (size != inventorySize || forceAdjust)
{
inventorySize = size;
ItemStack[] tempInv = inventory;
inventory = new ItemStack[size];
int invLength = tempInv.length > inventory.length ? inventory.length : tempInv.length;
System.arraycopy(tempInv, 0, inventory, 0, invLength);
if (tempInv.length > inventory.length)
{
for (int i = inventory.length; i < tempInv.length; i++)
{
ItemStack stack = tempInv[i];
if (stack != null)
{
float jumpX = random.nextFloat() * 0.8F + 0.1F;
float jumpY = random.nextFloat() * 0.8F + 0.1F;
float jumpZ = random.nextFloat() * 0.8F + 0.1F;
int offsetX = 0;
int offsetY = 0;
int offsetZ = 0;
switch (getTossDirection())
{
case 0: // -y
offsetY--;
break;
case 1: // +y
offsetY++;
break;
case 2: // +z
offsetZ--;
break;
case 3: // -z
offsetZ++;
break;
case 4: // +x
offsetX--;
break;
case 5: // -x
offsetX++;
break;
}
while (stack.stackSize > 0)
{
int itemSize = random.nextInt(21) + 10;
if (itemSize > stack.stackSize)
{
itemSize = stack.stackSize;
}
stack.stackSize -= itemSize;
EntityItem entityitem = new EntityItem(worldObj, (double) ((float) xCoord + jumpX + offsetX), (double) ((float) yCoord + jumpY),
(double) ((float) zCoord + jumpZ + offsetZ), new ItemStack(stack.itemID, itemSize, stack.getItemDamage()));
if (stack.hasTagCompound())
{
entityitem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
}
float offset = 0.05F;
entityitem.motionX = (double) ((float) random.nextGaussian() * offset);
entityitem.motionY = (double) ((float) random.nextGaussian() * offset + 0.2F);
entityitem.motionZ = (double) ((float) random.nextGaussian() * offset);
worldObj.spawnEntityInWorld(entityitem);
}
}
}
}
}
}
public int getTossDirection ()
{
return getRenderDirection();
}
}
@@ -1,218 +0,0 @@
package tconstruct.library.blocks;
import java.util.*;
import net.minecraft.entity.player.*;
import net.minecraft.inventory.*;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.*;
import net.minecraft.world.World;
import mantle.blocks.abstracts.InventoryLogic;
public abstract class ExpandableInventoryLogic extends InventoryLogic implements IInventory
{
public ExpandableInventoryLogic()
{
super(0);
}
protected ArrayList<ItemStack> inventory = new ArrayList<ItemStack>();
protected String invName;
@Override
public ItemStack getStackInSlot (int slot)
{
return slot < inventory.size() ? inventory.get(slot) : null;
}
public boolean isStackInSlot (int slot)
{
return slot < inventory.size() && inventory.get(slot) != null;
}
@Override
public int getSizeInventory ()
{
return inventory.size();
}
public int getMaxSize ()
{
return 64;
}
@Override
public int getInventoryStackLimit ()
{
return 64;
}
public boolean canDropInventorySlot (int slot)
{
return true;
}
@Override
public void setInventorySlotContents (int slot, ItemStack itemstack)
{
if (slot < inventory.size())
{
inventory.set(slot, itemstack);
}
else if (slot == inventory.size())
{
inventory.add(itemstack);
}
else if (slot < getMaxSize())
{
inventory.ensureCapacity(slot);
inventory.set(slot, itemstack);
}
else
{
return;
}
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
{
itemstack.stackSize = getInventoryStackLimit();
}
}
@Override
public ItemStack decrStackSize (int slot, int quantity)
{
if (slot < inventory.size() && inventory.get(slot) != null)
{
if (inventory.get(slot).stackSize <= quantity)
{
ItemStack stack = inventory.get(slot);
inventory.set(slot, null);
return stack;
}
ItemStack split = inventory.get(slot).splitStack(quantity);
if (inventory.get(slot).stackSize == 0)
{
inventory.set(slot, null);
}
return split;
}
else
{
return null;
}
}
/* Supporting methods */
@Override
public boolean isUseableByPlayer (EntityPlayer entityplayer)
{
if (worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) != this)
return false;
else
return entityplayer.getDistance((double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D) <= 64D;
}
public abstract Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z);
/* NBT */
@Override
public void readFromNBT (NBTTagCompound tags)
{
super.readFromNBT(tags);
this.invName = tags.getString("InvName");
NBTTagList nbttaglist = tags.getTagList("Items");
inventory = new ArrayList<ItemStack>();
inventory.ensureCapacity(nbttaglist.tagCount() > getMaxSize() ? getMaxSize() : nbttaglist.tagCount());
for (int iter = 0; iter < nbttaglist.tagCount(); iter++)
{
NBTTagCompound tagList = (NBTTagCompound) nbttaglist.tagAt(iter);
byte slotID = tagList.getByte("Slot");
if (slotID >= 0 && slotID < inventory.size())
{
inventory.set(slotID, ItemStack.loadItemStackFromNBT(tagList));
}
}
}
@Override
public void writeToNBT (NBTTagCompound tags)
{
super.writeToNBT(tags);
if (invName != null)
tags.setString("InvName", invName);
NBTTagList nbttaglist = new NBTTagList();
for (int iter = 0; iter < inventory.size(); iter++)
{
if (inventory.get(iter) != null)
{
NBTTagCompound tagList = new NBTTagCompound();
tagList.setByte("Slot", (byte) iter);
inventory.get(iter).writeToNBT(tagList);
nbttaglist.appendTag(tagList);
}
}
tags.setTag("Items", nbttaglist);
}
/* Default implementations of hardly used methods */
public ItemStack getStackInSlotOnClosing (int slot)
{
return null;
}
public void openChest ()
{
}
public void closeChest ()
{
}
protected abstract String getDefaultName ();
public void setInvName (String name)
{
this.invName = name;
}
public String getInvName ()
{
return this.isInvNameLocalized() ? this.invName : getDefaultName();
}
public boolean isInvNameLocalized ()
{
return this.invName != null && this.invName.length() > 0;
}
public void cleanInventory ()
{
Iterator<ItemStack> i1 = inventory.iterator();
while (i1.hasNext())
{
if (i1.next() == null)
{
i1.remove();
}
}
}
@Override
public boolean isItemValidForSlot (int slot, ItemStack itemstack)
{
if (slot < getSizeInventory())
{
if (inventory.get(slot) == null || itemstack.stackSize + inventory.get(slot).stackSize <= getInventoryStackLimit())
return true;
}
else
{
return slot < getMaxSize();
}
return false;
}
}
@@ -6,10 +6,11 @@ import net.minecraft.block.Block;
import net.minecraft.nbt.*;
import net.minecraft.tileentity.TileEntity;
import tconstruct.TConstruct;
import tconstruct.library.util.IMasterLogic;
import tconstruct.library.util.IServantLogic;
import mantle.world.*;
import mantle.blocks.iface.IFacingLogic;
import mantle.blocks.iface.IMasterLogic;
import mantle.blocks.iface.IServantLogic;
public class TankLayerScan extends LogicComponent
{
@@ -1,12 +0,0 @@
package tconstruct.library.util;
public interface IMasterLogic
{
/** Called when servants change their state
*
* @param x Servant X
* @param y Servant Y
* @param z Servant Z
*/
public void notifyChange (IServantLogic servant, int x, int y, int z);
}
@@ -1,8 +0,0 @@
package tconstruct.library.util;
public interface IMasterNode extends IMasterLogic, IServantLogic
{
public boolean isCurrentlyMaster ();
public boolean isEquivalentMaster (IMasterLogic master);
}
@@ -1,44 +0,0 @@
package tconstruct.library.util;
import mantle.world.CoordTuple;
import net.minecraft.world.World;
public interface IServantLogic
{
public CoordTuple getMasterPosition ();
/** The block should already have a valid master */
public void notifyMasterOfChange ();
/** Checks if this block can be tied to this master
*
* @param master
* @param x xCoord of master
* @param y yCoord of master
* @param z zCoord of master
* @return whether the servant can be tied to this master
*/
public boolean setPotentialMaster (IMasterLogic master, World world, int xMaster, int yMaster, int zMaster);
/** Used to set and verify that this is the block's master
*
* @param master
* @param x xCoord of master
* @param y yCoord of master
* @param z zCoord of master
* @return Is this block tied to this master?
*/
public boolean verifyMaster (IMasterLogic master, World world, int xMaster, int yMaster, int zMaster);
/** Exactly what it says on the tin
*
* @param master
* @param x xCoord of master
* @param y yCoord of master
* @param z zCoord of master
*/
public void invalidateMaster (IMasterLogic master, World world, int xMaster, int yMaster, int zMaster);
}