Search in sources :

Example 1 with ContainerArmourer

use of riskyken.armourersWorkshop.common.inventory.ContainerArmourer in project Armourers-Workshop by RiskyKen.

the class MessageClientGuiSetSkin method onMessage.

@Override
public IMessage onMessage(MessageClientGuiSetSkin message, MessageContext ctx) {
    EntityPlayerMP player = ctx.getServerHandler().playerEntity;
    if (player == null) {
        return null;
    }
    Container container = player.openContainer;
    if (container == null) {
        return null;
    }
    if (container != null && container instanceof ContainerArmourer) {
        TileEntityArmourer armourerBrain = ((ContainerArmourer) container).getTileEntity();
        armourerBrain.setTexture(message.playerTexture);
    }
    return null;
}
Also used : Container(net.minecraft.inventory.Container) TileEntityArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer) ContainerArmourer(riskyken.armourersWorkshop.common.inventory.ContainerArmourer) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP)

Example 2 with ContainerArmourer

use of riskyken.armourersWorkshop.common.inventory.ContainerArmourer in project Armourers-Workshop by RiskyKen.

the class MessageClientGuiSetArmourerSkinType method onMessage.

@Override
public IMessage onMessage(MessageClientGuiSetArmourerSkinType message, MessageContext ctx) {
    EntityPlayerMP player = ctx.getServerHandler().playerEntity;
    if (player == null) {
        return null;
    }
    Container container = player.openContainer;
    if (container != null && container instanceof ContainerArmourer) {
        TileEntityArmourer te = ((ContainerArmourer) container).getTileEntity();
        te.setSkinType(message.skinType);
    }
    if (container != null && container instanceof ContainerMiniArmourerBuilding) {
        TileEntityMiniArmourer te = ((ContainerMiniArmourerBuilding) container).getTileEntity();
        te.setSkinType(message.skinType);
    }
    return null;
}
Also used : Container(net.minecraft.inventory.Container) TileEntityArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer) ContainerArmourer(riskyken.armourersWorkshop.common.inventory.ContainerArmourer) TileEntityMiniArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityMiniArmourer) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) ContainerMiniArmourerBuilding(riskyken.armourersWorkshop.common.inventory.ContainerMiniArmourerBuilding)

Example 3 with ContainerArmourer

use of riskyken.armourersWorkshop.common.inventory.ContainerArmourer in project Armourers-Workshop by RiskyKen.

the class MessageClientLoadArmour method onMessage.

@Override
public IMessage onMessage(MessageClientLoadArmour message, MessageContext ctx) {
    EntityPlayerMP player = ctx.getServerHandler().playerEntity;
    if (player == null) {
        return null;
    }
    Container container = player.openContainer;
    if (container != null && container instanceof ContainerArmourer) {
        TileEntityArmourer armourerBrain = ((ContainerArmourer) container).getTileEntity();
        armourerBrain.saveArmourItem(player, message.name, message.tags);
    }
    return null;
}
Also used : Container(net.minecraft.inventory.Container) TileEntityArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer) ContainerArmourer(riskyken.armourersWorkshop.common.inventory.ContainerArmourer) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP)

Example 4 with ContainerArmourer

use of riskyken.armourersWorkshop.common.inventory.ContainerArmourer in project Armourers-Workshop by RiskyKen.

the class MessageClientGuiArmourerBlockUtil method onMessage.

@Override
public IMessage onMessage(MessageClientGuiArmourerBlockUtil message, MessageContext ctx) {
    EntityPlayerMP player = ctx.getServerHandler().playerEntity;
    if (player == null) {
        return null;
    }
    Container container = player.openContainer;
    if (container != null && container instanceof ContainerArmourer) {
        TileEntityArmourer armourerBrain = ((ContainerArmourer) container).getTileEntity();
        boolean clearBlocks = message.option1;
        boolean clearPaint = message.option2;
        boolean clearMarkers = message.option3;
        if (message.utilType.equals("clear")) {
            if (clearBlocks) {
                armourerBrain.clearArmourCubes(message.partType1);
            }
            if (clearPaint) {
                armourerBrain.clearPaintData(true);
            }
            if (clearMarkers) {
                if (!clearBlocks) {
                    armourerBrain.clearMarkers(message.partType1);
                }
            }
        }
        if (message.utilType.equals("copy")) {
            armourerBrain.copySkinCubes(player, message.partType1, message.partType2, message.option1);
        }
    }
    return null;
}
Also used : Container(net.minecraft.inventory.Container) TileEntityArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer) ContainerArmourer(riskyken.armourersWorkshop.common.inventory.ContainerArmourer) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP)

Example 5 with ContainerArmourer

use of riskyken.armourersWorkshop.common.inventory.ContainerArmourer in project Armourers-Workshop by RiskyKen.

the class MessageClientGuiButton method onMessage.

@Override
public IMessage onMessage(MessageClientGuiButton message, MessageContext ctx) {
    EntityPlayerMP player = ctx.getServerHandler().playerEntity;
    if (player == null) {
        return null;
    }
    Container container = player.openContainer;
    if (container != null && container instanceof ContainerArmourer) {
        TileEntityArmourer armourerBrain = ((ContainerArmourer) container).getTileEntity();
        if (message.buttonId == 14) {
            armourerBrain.loadArmourItem(player);
        }
        if (message.buttonId == 7) {
            armourerBrain.toggleGuides();
        }
        if (message.buttonId == 9) {
            armourerBrain.toggleOverlay();
        }
        if (message.buttonId == 6) {
            armourerBrain.toggleHelper();
        }
        if (message.buttonId == 11) {
        // armourerBrain.cloneToSide(ForgeDirection.WEST);
        }
        if (message.buttonId == 12) {
        // armourerBrain.cloneToSide(ForgeDirection.EAST);
        }
    }
    if (container != null && container instanceof ContainerColourMixer) {
        TileEntityColourMixer colourMixer = ((ContainerColourMixer) container).getTileEntity();
        colourMixer.setColourFamily(ColourFamily.values()[message.buttonId]);
    }
    if (container instanceof IButtonPress) {
        ((IButtonPress) container).buttonPressed(message.buttonId);
    }
    return null;
}
Also used : Container(net.minecraft.inventory.Container) TileEntityArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer) ContainerArmourer(riskyken.armourersWorkshop.common.inventory.ContainerArmourer) ContainerColourMixer(riskyken.armourersWorkshop.common.inventory.ContainerColourMixer) TileEntityColourMixer(riskyken.armourersWorkshop.common.tileentities.TileEntityColourMixer) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP)

Aggregations

EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)6 Container (net.minecraft.inventory.Container)6 ContainerArmourer (riskyken.armourersWorkshop.common.inventory.ContainerArmourer)6 TileEntityArmourer (riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer)6 ContainerColourMixer (riskyken.armourersWorkshop.common.inventory.ContainerColourMixer)1 ContainerMiniArmourerBuilding (riskyken.armourersWorkshop.common.inventory.ContainerMiniArmourerBuilding)1 TileEntityColourMixer (riskyken.armourersWorkshop.common.tileentities.TileEntityColourMixer)1 TileEntityMiniArmourer (riskyken.armourersWorkshop.common.tileentities.TileEntityMiniArmourer)1