Added firebox
This commit is contained in:
parent
9835bb5ead
commit
59845d1a0f
11 changed files with 291 additions and 361 deletions
|
@ -2,7 +2,9 @@ package resonantinduction.archaic;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import resonantinduction.archaic.blocks.BlockFirebox;
|
||||
import resonantinduction.archaic.blocks.BlockTurntable;
|
||||
import resonantinduction.archaic.blocks.TileFirebox;
|
||||
import resonantinduction.archaic.crate.BlockCrate;
|
||||
import resonantinduction.archaic.crate.ItemBlockCrate;
|
||||
import resonantinduction.archaic.crate.TileCrate;
|
||||
|
@ -55,6 +57,7 @@ public class Archaic
|
|||
public static Block blockCrate;
|
||||
public static Block blockImprinter;
|
||||
public static Block blockTurntable;
|
||||
public static Block blockFirebox;
|
||||
|
||||
public static Item itemImprint;
|
||||
|
||||
|
@ -66,6 +69,7 @@ public class Archaic
|
|||
blockCrate = contentRegistry.createBlock(BlockCrate.class, ItemBlockCrate.class, TileCrate.class);
|
||||
blockImprinter = contentRegistry.createTile(BlockImprinter.class, TileImprinter.class);
|
||||
blockTurntable = contentRegistry.createBlock(BlockTurntable.class);
|
||||
blockFirebox = contentRegistry.createTile(BlockFirebox.class, TileFirebox.class);
|
||||
|
||||
itemImprint = contentRegistry.createItem(ItemBlockImprint.class);
|
||||
proxy.preInit();
|
||||
|
|
175
src/main/java/resonantinduction/archaic/blocks/BlockFirebox.java
Normal file
175
src/main/java/resonantinduction/archaic/blocks/BlockFirebox.java
Normal file
|
@ -0,0 +1,175 @@
|
|||
package resonantinduction.archaic.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.prefab.block.BlockRI;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockFirebox extends BlockRI
|
||||
{
|
||||
private Icon topOn;
|
||||
private Icon topOff;
|
||||
|
||||
public BlockFirebox()
|
||||
{
|
||||
super("firebox", Material.piston);
|
||||
this.setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister iconReg)
|
||||
{
|
||||
super.registerIcons(iconReg);
|
||||
topOn = iconReg.registerIcon(Reference.PREFIX + "firebox_top_on");
|
||||
topOff = iconReg.registerIcon(Reference.PREFIX + "firebox_top_off");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity instanceof TileFirebox)
|
||||
{
|
||||
TileFirebox tile = (TileFirebox) tileEntity;
|
||||
|
||||
if (tile.getStackInSlot(0) == null && entityPlayer.inventory.getCurrentItem() != null)
|
||||
{
|
||||
tile.setInventorySlotContents(0, entityPlayer.inventory.getCurrentItem());
|
||||
entityPlayer.inventory.setInventorySlotContents(entityPlayer.inventory.currentItem, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getBlockTexture(IBlockAccess access, int x, int y, int z, int side)
|
||||
{
|
||||
TileEntity tile = access.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TileFirebox)
|
||||
{
|
||||
if (access.getBlockMetadata(x, y, z) == side)
|
||||
{
|
||||
if (((TileFirebox) tile).isBurning())
|
||||
{
|
||||
return topOn;
|
||||
}
|
||||
else
|
||||
{
|
||||
return topOff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random par5Random)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (((TileFirebox) tileEntity).isBurning())
|
||||
{
|
||||
int l = world.getBlockMetadata(x, y, z);
|
||||
float f = x + 0.5F;
|
||||
float f1 = y + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F;
|
||||
float f2 = z + 0.5F;
|
||||
float f3 = 0.52F;
|
||||
float f4 = par5Random.nextFloat() * 0.6F - 0.3F;
|
||||
|
||||
if (l == 4)
|
||||
{
|
||||
world.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 5)
|
||||
{
|
||||
world.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 2)
|
||||
{
|
||||
world.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 3)
|
||||
{
|
||||
world.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIcon(int side, int meta)
|
||||
{
|
||||
if (side == meta)
|
||||
{
|
||||
return topOff;
|
||||
}
|
||||
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack stack)
|
||||
{
|
||||
int angle = MathHelper.floor_double((entityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int change = 3;
|
||||
|
||||
switch (angle)
|
||||
{
|
||||
case 0:
|
||||
change = 2;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
change = 5;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
change = 3;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
change = 4;
|
||||
break;
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, change, 3);
|
||||
world.scheduleBlockUpdate(x, y, z, blockID, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, int side)
|
||||
{
|
||||
world.scheduleBlockUpdate(x, y, z, blockID, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
return new TileFirebox();
|
||||
}
|
||||
}
|
104
src/main/java/resonantinduction/archaic/blocks/TileFirebox.java
Normal file
104
src/main/java/resonantinduction/archaic/blocks/TileFirebox.java
Normal file
|
@ -0,0 +1,104 @@
|
|||
package resonantinduction.archaic.blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.Settings;
|
||||
import universalelectricity.api.CompatibilityModule;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.network.IPacketReceiver;
|
||||
import calclavia.lib.network.IPacketSender;
|
||||
import calclavia.lib.prefab.tile.TileAdvancedInventory;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
/**
|
||||
* Meant to replace the furnace class.
|
||||
*
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
public class TileFirebox extends TileAdvancedInventory implements IPacketSender, IPacketReceiver
|
||||
{
|
||||
/**
|
||||
* The power of the firebox in terms of thermal energy. The thermal energy can be transfered
|
||||
* into fluids to increase their internal energy.
|
||||
*/
|
||||
private final int POWER = 1000;
|
||||
private int burnTime;
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
if (burnTime > 0)
|
||||
{
|
||||
if (burnTime-- == 0)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
if (canBurn(this.getStackInSlot(0)))
|
||||
{
|
||||
if (burnTime == 0)
|
||||
{
|
||||
burnTime = TileEntityFurnace.getItemBurnTime(this.getStackInSlot(0));
|
||||
decrStackSize(1, 1);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canBurn(ItemStack stack)
|
||||
{
|
||||
return TileEntityFurnace.getItemBurnTime(stack) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
return ResonantInduction.PACKET_TILE.getPacket(this, this.getPacketData(0).toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 1 - Description Packet
|
||||
* 2 - Energy Update
|
||||
* 3 - Tesla Beam
|
||||
*/
|
||||
@Override
|
||||
public ArrayList getPacketData(int type)
|
||||
{
|
||||
ArrayList data = new ArrayList();
|
||||
data.add(this.burnTime);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.burnTime = data.readInt();
|
||||
this.worldObj.markBlockForRenderUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isBurning()
|
||||
{
|
||||
return burnTime > 0;
|
||||
}
|
||||
}
|
|
@ -3,9 +3,9 @@ package resonantinduction.archaic.crate;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import calclavia.lib.utility.inventory.TileInventory;
|
||||
import calclavia.lib.utility.inventory.ExternalInventory;
|
||||
|
||||
public class InventoryCrate extends TileInventory
|
||||
public class InventoryCrate extends ExternalInventory
|
||||
{
|
||||
public InventoryCrate(TileEntity crate)
|
||||
{
|
||||
|
|
|
@ -5,11 +5,11 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.IExtendedStorage;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.prefab.tile.TileEntityInv;
|
||||
import calclavia.lib.network.IPacketReceiver;
|
||||
import calclavia.lib.network.PacketHandler;
|
||||
import calclavia.lib.prefab.tile.TileAdvancedInventory;
|
||||
import calclavia.lib.utility.inventory.IExtendedStorage;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
|
@ -21,7 +21,7 @@ import cpw.mods.fml.relauncher.Side;
|
|||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
public class TileCrate extends TileEntityInv implements IPacketReceiver, IExtendedStorage
|
||||
public class TileCrate extends TileAdvancedInventory implements IPacketReceiver, IExtendedStorage
|
||||
{
|
||||
/*
|
||||
* TODO
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
package resonantinduction.core;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Applied to blocks that store items in stacks above 64 and as one large collective of items
|
||||
*
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
public interface IExtendedStorage
|
||||
{
|
||||
public ItemStack addStackToStorage(ItemStack stack);
|
||||
}
|
|
@ -1,341 +0,0 @@
|
|||
package resonantinduction.core.prefab.tile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.tilenetwork.prefab.NetworkTileEntities;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.access.AccessGroup;
|
||||
import calclavia.lib.access.AccessUser;
|
||||
import calclavia.lib.access.GroupRegistry;
|
||||
import calclavia.lib.access.ISpecialAccess;
|
||||
import calclavia.lib.access.Nodes;
|
||||
import calclavia.lib.prefab.tile.TileAdvanced;
|
||||
import calclavia.lib.utility.inventory.IExternalInv;
|
||||
import calclavia.lib.utility.inventory.IInvBox;
|
||||
import calclavia.lib.utility.inventory.TileInventory;
|
||||
|
||||
/**
|
||||
* Prefab for simple object who only need basic inv support and nothing more
|
||||
*
|
||||
* @author Darkguardsman
|
||||
*/
|
||||
public class TileEntityInv extends TileAdvanced implements IExternalInv, ISidedInventory, ISpecialAccess
|
||||
{
|
||||
protected IInvBox inventory;
|
||||
protected boolean lockInv;
|
||||
protected int invSlots = 1;
|
||||
private Vector3 thisPos;
|
||||
/** A list of user access data. */
|
||||
protected List<AccessGroup> groups = new ArrayList<AccessGroup>();
|
||||
|
||||
@Override
|
||||
public void initiate()
|
||||
{
|
||||
thisPos = new Vector3(this);
|
||||
}
|
||||
|
||||
public Vector3 getThisPos()
|
||||
{
|
||||
if (this.thisPos == null || this.thisPos.intX() != xCoord || this.thisPos.intY() != yCoord || this.thisPos.intZ() != zCoord)
|
||||
{
|
||||
this.thisPos = new Vector3(this);
|
||||
}
|
||||
return this.thisPos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
super.invalidate();
|
||||
NetworkTileEntities.invalidate(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInvBox getInventory()
|
||||
{
|
||||
if (inventory == null)
|
||||
{
|
||||
inventory = new TileInventory(this, this.invSlots);
|
||||
}
|
||||
return inventory;
|
||||
}
|
||||
|
||||
/** Gets the container class that goes with this tileEntity when creating a gui */
|
||||
public Class<? extends Container> getContainer()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return this.getInventory().getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i)
|
||||
{
|
||||
return this.getInventory().getStackInSlot(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j)
|
||||
{
|
||||
return this.getInventory().decrStackSize(i, j);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i)
|
||||
{
|
||||
return this.getInventory().getStackInSlotOnClosing(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack)
|
||||
{
|
||||
this.getInventory().setInventorySlotContents(i, itemstack);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInvName()
|
||||
{
|
||||
return this.getInventory().getInvName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvNameLocalized()
|
||||
{
|
||||
return this.getInventory().isInvNameLocalized();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return this.getInventory().getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer)
|
||||
{
|
||||
return this.getInventory().isUseableByPlayer(entityplayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChest()
|
||||
{
|
||||
this.getInventory().openChest();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeChest()
|
||||
{
|
||||
this.getInventory().closeChest();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack)
|
||||
{
|
||||
return this.getInventory().isItemValidForSlot(i, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int var1)
|
||||
{
|
||||
return this.getInventory().getAccessibleSlotsFromSide(var1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemstack, int j)
|
||||
{
|
||||
return this.getInventory().canInsertItem(i, itemstack, j);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j)
|
||||
{
|
||||
return this.getInventory().canExtractItem(i, itemstack, j);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canStore(ItemStack stack, int slot, ForgeDirection side)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRemove(ItemStack stack, int slot, ForgeDirection side)
|
||||
{
|
||||
if (slot >= this.getSizeInventory())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* User access
|
||||
*/
|
||||
public boolean canOpen(String username)
|
||||
{
|
||||
return this.getUserAccess(username) != null && this.getUserAccess(username).hasNode(Nodes.INV_OPEN_NODE) || this.getOwnerGroup().getMembers().size() <= 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessUser getUserAccess(String username)
|
||||
{
|
||||
for (AccessGroup group : this.groups)
|
||||
{
|
||||
AccessUser user = group.getMember(username);
|
||||
if (user != null)
|
||||
{
|
||||
return user;
|
||||
}
|
||||
}
|
||||
return new AccessUser(username);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AccessUser> getUsers()
|
||||
{
|
||||
List<AccessUser> users = new ArrayList<AccessUser>();
|
||||
for (AccessGroup group : this.groups)
|
||||
{
|
||||
users.addAll(group.getMembers());
|
||||
}
|
||||
return users;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setUserAccess(String player, AccessGroup g, boolean save)
|
||||
{
|
||||
return setUserAccess(new AccessUser(player).setTempary(save), g);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setUserAccess(AccessUser user, AccessGroup group)
|
||||
{
|
||||
boolean bool = false;
|
||||
|
||||
if (user != null && user.getName() != null)
|
||||
{
|
||||
bool = this.removeUserAccess(user.getName()) && group == null;
|
||||
if (group != null)
|
||||
{
|
||||
bool = group.addMemeber(user);
|
||||
}
|
||||
if (bool)
|
||||
{
|
||||
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
}
|
||||
return bool;
|
||||
}
|
||||
|
||||
public boolean removeUserAccess(String player)
|
||||
{
|
||||
boolean re = false;
|
||||
for (AccessGroup group : this.groups)
|
||||
{
|
||||
AccessUser user = group.getMember(player);
|
||||
if (user != null && group.removeMemeber(user))
|
||||
{
|
||||
re = true;
|
||||
}
|
||||
}
|
||||
if (re)
|
||||
{
|
||||
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
return re;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessGroup getGroup(String name)
|
||||
{
|
||||
for (AccessGroup group : this.getGroups())
|
||||
{
|
||||
if (group.getName().equalsIgnoreCase(name))
|
||||
{
|
||||
return group;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addGroup(AccessGroup group)
|
||||
{
|
||||
if (!this.groups.contains(group))
|
||||
{
|
||||
for (AccessGroup g : this.groups)
|
||||
{
|
||||
if (group.getName().equalsIgnoreCase(g.getName()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return this.groups.add(group);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessGroup getOwnerGroup()
|
||||
{
|
||||
return this.getGroup("owner");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AccessGroup> getGroups()
|
||||
{
|
||||
if (this.groups == null || this.groups.isEmpty())
|
||||
{
|
||||
GroupRegistry.loadNewGroupSet(this);
|
||||
}
|
||||
return this.groups;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readFromNBT(nbt);
|
||||
this.getInventory().loadInv(nbt);
|
||||
NBTTagList userList = nbt.getTagList("groups");
|
||||
if (userList != null && userList.tagCount() > 0)
|
||||
{
|
||||
this.groups.clear();
|
||||
for (int i = 0; i < userList.tagCount(); i++)
|
||||
{
|
||||
AccessGroup group = new AccessGroup("");
|
||||
group.load((NBTTagCompound) userList.tagAt(i));
|
||||
this.groups.add(group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.writeToNBT(nbt);
|
||||
this.getInventory().saveInv(nbt);
|
||||
|
||||
NBTTagList usersTag = new NBTTagList();
|
||||
for (AccessGroup group : this.getGroups())
|
||||
{
|
||||
usersTag.appendTag(group.save(new NBTTagCompound()));
|
||||
}
|
||||
nbt.setTag("groups", usersTag);
|
||||
}
|
||||
|
||||
}
|
|
@ -13,6 +13,7 @@ import resonantinduction.core.ResonantInduction;
|
|||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.content.IExtraInfo.IExtraTileEntityInfo;
|
||||
import calclavia.lib.network.PacketHandler;
|
||||
import calclavia.lib.prefab.tile.TileAdvancedInventory;
|
||||
import calclavia.lib.utility.inventory.IExternalInv;
|
||||
import calclavia.lib.utility.inventory.IInvBox;
|
||||
|
||||
|
@ -21,7 +22,7 @@ import com.google.common.io.ByteArrayDataInput;
|
|||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
public abstract class TileMachine extends TileEntityInv implements ISidedInventory, IExternalInv, IExtraTileEntityInfo
|
||||
public abstract class TileMachine extends TileAdvancedInventory implements ISidedInventory, IExternalInv, IExtraTileEntityInfo
|
||||
{
|
||||
/** Number of players with the machine's gui container open */
|
||||
protected int playersUsingMachine = 0;
|
||||
|
|
|
@ -7,7 +7,6 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraftforge.fluids.FluidStack;
|
||||
import resonantinduction.api.fluid.IFluidPart;
|
||||
import resonantinduction.mechanical.fluid.network.FluidNetwork;
|
||||
import universalelectricity.core.net.NetworkTickHandler;
|
||||
|
||||
/** Network that handles connected tanks
|
||||
*
|
||||
|
|
|
@ -18,6 +18,7 @@ item.resonantinduction\:imprint.name=Imprint
|
|||
## Machines
|
||||
tile.resonantinduction\:imprinter.name=Imprinter
|
||||
tile.resonantinduction\:engineeringTable.name=Engineering Table
|
||||
tile.resonantinduction\:firebox.name=Firebox
|
||||
|
||||
## Transport
|
||||
tile.resonantinduction\:turntable.name=Turntable
|
||||
|
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Loading…
Reference in a new issue