Search in sources :

Example 1 with AWContainer

use of com.codetaylor.mc.artisanworktables.modules.worktables.gui.AWContainer in project artisan-worktables by codetaylor.

the class Util method anyPlayerHasContainerOpen.

public static boolean anyPlayerHasContainerOpen(WorldServer world, BlockPos pos) {
    MinecraftServer minecraftServer = world.getMinecraftServer();
    PlayerList playerList = minecraftServer.getPlayerList();
    List<EntityPlayerMP> players = playerList.getPlayers();
    for (EntityPlayerMP entityPlayerMP : players) {
        if (entityPlayerMP.openContainer instanceof AWContainer) {
            TileEntityBase tile = ((AWContainer) entityPlayerMP.openContainer).getTile();
            if (tile.getPos().equals(pos)) {
                return true;
            }
        }
    }
    return false;
}
Also used : AWContainer(com.codetaylor.mc.artisanworktables.modules.worktables.gui.AWContainer) PlayerList(net.minecraft.server.management.PlayerList) TileEntityBase(com.codetaylor.mc.artisanworktables.modules.worktables.tile.spi.TileEntityBase) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) MinecraftServer(net.minecraft.server.MinecraftServer)

Example 2 with AWContainer

use of com.codetaylor.mc.artisanworktables.modules.worktables.gui.AWContainer in project artisan-worktables by codetaylor.

the class SCPacketWorktableContainerJoinedBlockBreak method onMessage.

@SideOnly(Side.CLIENT)
@Override
public IMessage onMessage(SCPacketWorktableContainerJoinedBlockBreak message, MessageContext ctx) {
    Minecraft minecraft = Minecraft.getMinecraft();
    EntityPlayerSP player = minecraft.player;
    WorldClient world = minecraft.world;
    if (player.openContainer instanceof AWContainer) {
        ((AWContainer) player.openContainer).onJoinedBlockBreak(world, message.blockPos);
    }
    return null;
}
Also used : AWContainer(com.codetaylor.mc.artisanworktables.modules.worktables.gui.AWContainer) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) Minecraft(net.minecraft.client.Minecraft) WorldClient(net.minecraft.client.multiplayer.WorldClient) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

AWContainer (com.codetaylor.mc.artisanworktables.modules.worktables.gui.AWContainer)2 TileEntityBase (com.codetaylor.mc.artisanworktables.modules.worktables.tile.spi.TileEntityBase)1 Minecraft (net.minecraft.client.Minecraft)1 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)1 WorldClient (net.minecraft.client.multiplayer.WorldClient)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 MinecraftServer (net.minecraft.server.MinecraftServer)1 PlayerList (net.minecraft.server.management.PlayerList)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1