Search in sources :

Example 1 with TileCircuitDatabase

use of com.bluepowermod.tile.tier3.TileCircuitDatabase in project BluePower by Qmunity.

the class BlockCircuitDatabase method onBlockActivated.

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
    if (super.onBlockActivated(world, x, y, z, player, par6, par7, par8, par9)) {
        TileCircuitDatabase database = (TileCircuitDatabase) world.getTileEntity(x, y, z);
        database.clientCurrentTab = 0;
        if (!world.isRemote) {
            BPNetworkHandler.INSTANCE.sendTo(new MessageSendClientServerTemplates(new ItemStackDatabase().loadItemStacks()), (EntityPlayerMP) player);
        }
        return true;
    } else {
        return false;
    }
}
Also used : TileCircuitDatabase(com.bluepowermod.tile.tier3.TileCircuitDatabase) MessageSendClientServerTemplates(com.bluepowermod.network.message.MessageSendClientServerTemplates) ItemStackDatabase(com.bluepowermod.helper.ItemStackDatabase)

Example 2 with TileCircuitDatabase

use of com.bluepowermod.tile.tier3.TileCircuitDatabase in project BluePower by Qmunity.

the class MessageCircuitDatabaseTemplate method handleServerSide.

@Override
public void handleServerSide(EntityPlayer player) {
    if (deleting) {
        if (TileCircuitDatabase.hasPermissions(player)) {
            ItemStackDatabase stackDatabase = new ItemStackDatabase();
            stackDatabase.deleteStack(stack);
            BPNetworkHandler.INSTANCE.sendToAll(new MessageSendClientServerTemplates(stackDatabase.loadItemStacks()));
        }
    } else {
        TileEntity te = player.worldObj.getTileEntity(x, y, z);
        if (te instanceof TileCircuitDatabase) {
            ((TileCircuitDatabase) te).copyInventory.setInventorySlotContents(0, stack);
            player.openGui(BluePower.instance, GuiIDs.CIRCUITDATABASE_MAIN_ID.ordinal(), player.worldObj, x, y, z);
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileCircuitDatabase(com.bluepowermod.tile.tier3.TileCircuitDatabase) ItemStackDatabase(com.bluepowermod.helper.ItemStackDatabase)

Aggregations

ItemStackDatabase (com.bluepowermod.helper.ItemStackDatabase)2 TileCircuitDatabase (com.bluepowermod.tile.tier3.TileCircuitDatabase)2 MessageSendClientServerTemplates (com.bluepowermod.network.message.MessageSendClientServerTemplates)1 TileEntity (net.minecraft.tileentity.TileEntity)1