Search in sources :

Example 81 with Coordinate

use of mcjty.lib.varia.Coordinate in project RFTools by McJty.

the class PacketGetScreenDataHelper method setScreenData.

public static void setScreenData(PacketReturnScreenData message) {
    Coordinate c = new Coordinate(message.x, message.y, message.z);
    ScreenTileEntity.screenData.put(c, message.screenData);
}
Also used : Coordinate(mcjty.lib.varia.Coordinate)

Example 82 with Coordinate

use of mcjty.lib.varia.Coordinate in project RFTools by McJty.

the class ShieldTEBase method composeShield.

public void composeShield(boolean ctrl) {
    shieldBlocks.clear();
    Collection<Coordinate> coordinates;
    if (isShapedShield()) {
        // Special shaped mode.
        ShapeCardItem.Shape shape = ShapeCardItem.getShape(stacks[ShieldContainer.SLOT_SHAPE]);
        Coordinate dimension = ShapeCardItem.getClampedDimension(stacks[ShieldContainer.SLOT_SHAPE], ShieldConfiguration.maxShieldDimension);
        Coordinate offset = ShapeCardItem.getClampedOffset(stacks[ShieldContainer.SLOT_SHAPE], ShieldConfiguration.maxShieldOffset);
        coordinates = new ArrayList<Coordinate>();
        ShapeCardItem.composeShape(shape, worldObj, getCoordinate(), dimension, offset, coordinates, supportedBlocks, false, null);
    } else {
        templateMeta = findTemplateMeta();
        coordinates = new HashSet<Coordinate>();
        findTemplateBlocks((Set<Coordinate>) coordinates, templateMeta, ctrl, getCoordinate());
    }
    for (Coordinate c : coordinates) {
        shieldBlocks.add(new RelCoordinate(c.getX() - xCoord, c.getY() - yCoord, c.getZ() - zCoord));
    }
    shieldComposed = true;
    updateShield();
}
Also used : ShapeCardItem(mcjty.rftools.items.shapecard.ShapeCardItem) Coordinate(mcjty.lib.varia.Coordinate)

Example 83 with Coordinate

use of mcjty.lib.varia.Coordinate in project RFTools by McJty.

the class AbstractShieldBlock method checkPlayerCD.

private boolean checkPlayerCD(World world, int x, int y, int z, EntityPlayer entity) {
    ShieldBlockTileEntity shieldBlockTileEntity = (ShieldBlockTileEntity) world.getTileEntity(x, y, z);
    Coordinate shieldBlock = shieldBlockTileEntity.getShieldBlock();
    if (shieldBlock != null) {
        ShieldTEBase shieldTileEntity = (ShieldTEBase) world.getTileEntity(shieldBlock.getX(), shieldBlock.getY(), shieldBlock.getZ());
        if (shieldTileEntity != null) {
            List<ShieldFilter> filters = shieldTileEntity.getFilters();
            for (ShieldFilter filter : filters) {
                if (DefaultFilter.DEFAULT.equals(filter.getFilterName())) {
                    return (filter.getAction() & ShieldFilter.ACTION_SOLID) != 0;
                } else if (PlayerFilter.PLAYER.equals(filter.getFilterName())) {
                    PlayerFilter playerFilter = (PlayerFilter) filter;
                    String name = playerFilter.getName();
                    if ((name == null || name.isEmpty())) {
                        return (filter.getAction() & ShieldFilter.ACTION_SOLID) != 0;
                    } else if (name.equals(entity.getDisplayName())) {
                        return (filter.getAction() & ShieldFilter.ACTION_SOLID) != 0;
                    }
                }
            }
        }
    }
    return false;
}
Also used : Coordinate(mcjty.lib.varia.Coordinate)

Example 84 with Coordinate

use of mcjty.lib.varia.Coordinate in project RFTools by McJty.

the class ShieldBlock method wrenchSneakSelect.

@Override
protected boolean wrenchSneakSelect(World world, int x, int y, int z, EntityPlayer player) {
    if (!world.isRemote) {
        GlobalCoordinate currentBlock = SmartWrenchItem.getCurrentBlock(player.getHeldItem());
        if (currentBlock == null) {
            SmartWrenchItem.setCurrentBlock(player.getHeldItem(), new GlobalCoordinate(new Coordinate(x, y, z), world.provider.dimensionId));
            Logging.message(player, EnumChatFormatting.YELLOW + "Selected block");
        } else {
            SmartWrenchItem.setCurrentBlock(player.getHeldItem(), null);
            Logging.message(player, EnumChatFormatting.YELLOW + "Cleared selected block");
        }
    }
    return true;
}
Also used : GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate) Coordinate(mcjty.lib.varia.Coordinate) GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate)

Example 85 with Coordinate

use of mcjty.lib.varia.Coordinate in project RFTools by McJty.

the class CounterClientScreenModule method setupCoordinateFromNBT.

protected void setupCoordinateFromNBT(NBTTagCompound tagCompound, int dim, int x, int y, int z) {
    coordinate = Coordinate.INVALID;
    if (tagCompound.hasKey("monitorx")) {
        this.dim = tagCompound.getInteger("dim");
        if (dim == this.dim) {
            Coordinate c = new Coordinate(tagCompound.getInteger("monitorx"), tagCompound.getInteger("monitory"), tagCompound.getInteger("monitorz"));
            int dx = Math.abs(c.getX() - x);
            int dy = Math.abs(c.getY() - y);
            int dz = Math.abs(c.getZ() - z);
            if (dx <= 64 && dy <= 64 && dz <= 64) {
                coordinate = c;
            }
        }
    }
}
Also used : Coordinate(mcjty.lib.varia.Coordinate)

Aggregations

Coordinate (mcjty.lib.varia.Coordinate)181 GlobalCoordinate (mcjty.lib.varia.GlobalCoordinate)63 TileEntity (net.minecraft.tileentity.TileEntity)30 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)19 Block (net.minecraft.block.Block)14 HashMap (java.util.HashMap)13 Map (java.util.Map)13 GenericEnergyReceiverTileEntity (mcjty.lib.entity.GenericEnergyReceiverTileEntity)13 World (net.minecraft.world.World)12 NBTTagList (net.minecraft.nbt.NBTTagList)11 Callback (li.cil.oc.api.machine.Callback)10 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)10 Panel (mcjty.lib.gui.widgets.Panel)10 ItemStack (net.minecraft.item.ItemStack)10 ArrayList (java.util.ArrayList)9 Label (mcjty.lib.gui.widgets.Label)8 BlockInfo (mcjty.rftools.BlockInfo)7 SyncedCoordinate (mcjty.lib.entity.SyncedCoordinate)5 ChoiceEvent (mcjty.lib.gui.events.ChoiceEvent)4 TeleportDestinationClientInfo (mcjty.rftools.blocks.teleporter.TeleportDestinationClientInfo)4