Search in sources :

Example 11 with TileEntityArmourer

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

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

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

the class ItemPaintbrush method onItemUse.

@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
    Block block = world.getBlock(x, y, z);
    if (player.isSneaking() & block == ModBlocks.colourMixer) {
        TileEntity te = world.getTileEntity(x, y, z);
        if (te != null && te instanceof IPantable) {
            if (!world.isRemote) {
                int colour = ((IPantable) te).getColour(0);
                PaintType paintType = ((IPantable) te).getPaintType(0);
                setToolColour(stack, colour);
                setToolPaintType(stack, paintType);
            }
        }
        return true;
    }
    if (block instanceof IPantableBlock) {
        int newColour = getToolColour(stack);
        if (!world.isRemote) {
            UndoManager.begin(player);
            if ((Boolean) ToolOptions.FULL_BLOCK_MODE.readFromNBT(stack.getTagCompound())) {
                for (int i = 0; i < 6; i++) {
                    usedOnBlockSide(stack, player, world, new BlockLocation(x, y, z), block, i);
                }
            } else {
                usedOnBlockSide(stack, player, world, new BlockLocation(x, y, z), block, side);
            }
            UndoManager.end(player);
            if ((Boolean) ToolOptions.FULL_BLOCK_MODE.readFromNBT(stack.getTagCompound())) {
                world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, LibSounds.PAINT, 1.0F, world.rand.nextFloat() * 0.1F + 0.9F);
            } else {
                world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, LibSounds.PAINT, 1.0F, world.rand.nextFloat() * 0.1F + 1.5F);
            }
        } else {
            spawnPaintParticles(world, x, y, z, side, newColour);
        }
        return true;
    }
    if (block == ModBlocks.armourerBrain & player.isSneaking()) {
        if (!world.isRemote) {
            TileEntity te = world.getTileEntity(x, y, z);
            if (te != null && te instanceof TileEntityArmourer) {
                ((TileEntityArmourer) te).toolUsedOnArmourer(this, world, stack, player);
            }
        }
        ModLogger.log("armourer");
        return true;
    }
    if (block == ModBlocks.mannequin) {
        if (!world.isRemote) {
            TileEntity te = ((BlockMannequin) block).getMannequinTileEntity(world, x, y, z);
            if (te != null && te instanceof TileEntityMannequin) {
                int newColour = getToolColour(stack);
                if (player.isSneaking()) {
                    ((TileEntityMannequin) te).setHairColour(newColour);
                } else {
                    ((TileEntityMannequin) te).setSkinColour(newColour);
                }
            }
        }
        return true;
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) BlockMannequin(riskyken.armourersWorkshop.common.blocks.BlockMannequin) TileEntityArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer) Block(net.minecraft.block.Block) IPantableBlock(riskyken.armourersWorkshop.api.common.painting.IPantableBlock) IPantable(riskyken.armourersWorkshop.api.common.painting.IPantable) PaintType(riskyken.armourersWorkshop.common.painting.PaintType) BlockLocation(riskyken.armourersWorkshop.common.blocks.BlockLocation) TileEntityMannequin(riskyken.armourersWorkshop.common.tileentities.TileEntityMannequin) IPantableBlock(riskyken.armourersWorkshop.api.common.painting.IPantableBlock)

Example 14 with TileEntityArmourer

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

the class ItemShadeNoiseTool method onItemUse.

@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
    Block block = world.getBlock(x, y, z);
    if (block instanceof IPantableBlock) {
        if (!world.isRemote) {
            UndoManager.begin(player);
        }
        if ((Boolean) ToolOptions.FULL_BLOCK_MODE.readFromNBT(stack.getTagCompound())) {
            for (int i = 0; i < 6; i++) {
                usedOnBlockSide(stack, player, world, new BlockLocation(x, y, z), block, i);
            }
        } else {
            usedOnBlockSide(stack, player, world, new BlockLocation(x, y, z), block, side);
        }
        if (!world.isRemote) {
            UndoManager.end(player);
            world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, LibSounds.BURN, 1.0F, 1.0F);
        }
        return true;
    }
    if (block == ModBlocks.armourerBrain & player.isSneaking()) {
        if (!world.isRemote) {
            TileEntity te = world.getTileEntity(x, y, z);
            if (te != null && te instanceof TileEntityArmourer) {
                ((TileEntityArmourer) te).toolUsedOnArmourer(this, world, stack, player);
            }
        }
        return true;
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer) MessageClientToolPaintBlock(riskyken.armourersWorkshop.common.network.messages.client.MessageClientToolPaintBlock) Block(net.minecraft.block.Block) IPantableBlock(riskyken.armourersWorkshop.api.common.painting.IPantableBlock) BlockLocation(riskyken.armourersWorkshop.common.blocks.BlockLocation) IPantableBlock(riskyken.armourersWorkshop.api.common.painting.IPantableBlock)

Example 15 with TileEntityArmourer

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

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