Search in sources :

Example 16 with TileEntityArmourer

use of riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer 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)

Example 17 with TileEntityArmourer

use of riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer in project Armourers-Workshop by RiskyKen.

the class MessageClientGuiSetArmourerSkinProps method onMessage.

@Override
public IMessage onMessage(MessageClientGuiSetArmourerSkinProps 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.setSkinProps(message.skinProps);
    }
    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 18 with TileEntityArmourer

use of riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer in project Armourers-Workshop by RiskyKen.

the class BlockBoundingBox method isRemoteOnly.

@Override
public boolean isRemoteOnly(IBlockAccess world, int x, int y, int z, int side) {
    ForgeDirection sideBlock = ForgeDirection.getOrientation(side);
    if (world.getBlock(x + sideBlock.offsetX, y + sideBlock.offsetY, z + sideBlock.offsetZ) == this) {
        return false;
    }
    TileEntity te = world.getTileEntity(x, y, z);
    if (te != null && te instanceof TileEntityBoundingBox) {
        TileEntityArmourer parent = ((TileEntityBoundingBox) te).getParent();
        if (parent != null) {
            if (((TileEntityBoundingBox) te).getSkinPart() instanceof ISkinPartTypeTextured) {
                Point texturePoint = SkinTextureHelper.getTextureLocationFromWorldBlock((TileEntityBoundingBox) te, side);
                int colour = parent.getPaintData(texturePoint.x, texturePoint.y);
                int paintType = BitwiseUtils.getUByteFromInt(colour, 0);
                return paintType == 0;
            }
        }
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer) TileEntityBoundingBox(riskyken.armourersWorkshop.common.tileentities.TileEntityBoundingBox) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) ISkinPartTypeTextured(riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured) Point(java.awt.Point) Point(java.awt.Point)

Example 19 with TileEntityArmourer

use of riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer in project Armourers-Workshop by RiskyKen.

the class BlockBoundingBox method setPaintType.

@Override
public void setPaintType(IBlockAccess world, int x, int y, int z, PaintType paintType, int side) {
    ForgeDirection sideBlock = ForgeDirection.getOrientation(side);
    if (world.getBlock(x + sideBlock.offsetX, y + sideBlock.offsetY, z + sideBlock.offsetZ) == this) {
        return;
    }
    TileEntity te = world.getTileEntity(x, y, z);
    if (te != null && te instanceof TileEntityBoundingBox) {
        TileEntityArmourer parent = ((TileEntityBoundingBox) te).getParent();
        if (((TileEntityBoundingBox) te).getSkinPart() instanceof ISkinPartTypeTextured) {
            if (parent != null) {
                ISkinType skinType = parent.getSkinType();
                Point texturePoint = SkinTextureHelper.getTextureLocationFromWorldBlock((TileEntityBoundingBox) te, side);
                int oldColour = parent.getPaintData(texturePoint.x, texturePoint.y);
                int newColour = PaintType.setPaintTypeOnColour(paintType, oldColour);
                parent.updatePaintData(texturePoint.x, texturePoint.y, newColour);
            }
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ISkinType(riskyken.armourersWorkshop.api.common.skin.type.ISkinType) TileEntityArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer) TileEntityBoundingBox(riskyken.armourersWorkshop.common.tileentities.TileEntityBoundingBox) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) ISkinPartTypeTextured(riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured) Point(java.awt.Point) Point(java.awt.Point)

Example 20 with TileEntityArmourer

use of riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer in project Armourers-Workshop by RiskyKen.

the class BlockArmourer method onBlockPlacedBy.

@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
    if (entity instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) entity;
        TileEntity te = world.getTileEntity(x, y, z);
        if (te != null && te instanceof TileEntityArmourer) {
            ForgeDirection direction = BlockUtils.determineDirectionSide(entity).getOpposite();
            ((TileEntityArmourer) te).setDirection(ForgeDirection.NORTH);
            if (!world.isRemote) {
                ((TileEntityArmourer) te).setTexture(new PlayerTexture(player.getCommandSenderName(), TextureType.USER));
                ((TileEntityArmourer) te).onPlaced();
            }
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer) PlayerTexture(riskyken.armourersWorkshop.client.texture.PlayerTexture) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Aggregations

TileEntityArmourer (riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer)20 TileEntity (net.minecraft.tileentity.TileEntity)14 Block (net.minecraft.block.Block)8 IPantableBlock (riskyken.armourersWorkshop.api.common.painting.IPantableBlock)8 BlockLocation (riskyken.armourersWorkshop.common.blocks.BlockLocation)7 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)6 Container (net.minecraft.inventory.Container)6 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)6 ContainerArmourer (riskyken.armourersWorkshop.common.inventory.ContainerArmourer)6 Point (java.awt.Point)5 ISkinPartTypeTextured (riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured)5 MessageClientToolPaintBlock (riskyken.armourersWorkshop.common.network.messages.client.MessageClientToolPaintBlock)5 TileEntityBoundingBox (riskyken.armourersWorkshop.common.tileentities.TileEntityBoundingBox)5 IPantable (riskyken.armourersWorkshop.api.common.painting.IPantable)3 PaintType (riskyken.armourersWorkshop.common.painting.PaintType)3 ISkinType (riskyken.armourersWorkshop.api.common.skin.type.ISkinType)2 PlayerTexture (riskyken.armourersWorkshop.client.texture.PlayerTexture)2 BufferedImage (java.awt.image.BufferedImage)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 BlockMannequin (riskyken.armourersWorkshop.common.blocks.BlockMannequin)1