Search in sources :

Example 51 with GlobalCoordinate

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

the class PorterTools method checkTarget.

private static int checkTarget(EntityPlayer playerEntity, NBTTagCompound tagCompound, TeleportDestinations destinations, int curtarget, int donext, int tgt) {
    if (tagCompound.hasKey("target" + tgt)) {
        int target = tagCompound.getInteger("target" + tgt);
        GlobalCoordinate gc = destinations.getCoordinateForId(target);
        if (gc != null) {
            TeleportDestination destination = destinations.getDestination(gc);
            if (destination != null) {
                if (donext == 1) {
                    String name = destination.getName() + " (dimension " + destination.getDimension() + ")";
                    tagCompound.setInteger("target", target);
                    ITextComponent component = new TextComponentString(TextFormatting.GREEN + "Target: " + TextFormatting.WHITE + name);
                    if (playerEntity != null) {
                        playerEntity.sendStatusMessage(component, false);
                    }
                    donext = 2;
                } else if (target == curtarget) {
                    donext = 1;
                }
            }
        }
    }
    return donext;
}
Also used : ITextComponent(net.minecraft.util.text.ITextComponent) GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate) TextComponentString(net.minecraft.util.text.TextComponentString) TeleportDestination(mcjty.rftools.blocks.teleporter.TeleportDestination) TextComponentString(net.minecraft.util.text.TextComponentString)

Example 52 with GlobalCoordinate

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

the class PacketGetScreenData method fromBytes.

@Override
public void fromBytes(ByteBuf buf) {
    modid = NetworkTools.readString(buf);
    pos = new GlobalCoordinate(NetworkTools.readPos(buf), buf.readInt());
    millis = buf.readLong();
}
Also used : GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate)

Example 53 with GlobalCoordinate

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

the class PacketReturnScreenData method fromBytes.

@Override
public void fromBytes(ByteBuf buf) {
    pos = new GlobalCoordinate(NetworkTools.readPos(buf), buf.readInt());
    int size = buf.readInt();
    screenData = new HashMap<>(size);
    for (int i = 0; i < size; i++) {
        int key = buf.readInt();
        int shortId = buf.readInt();
        String id = RFTools.screenModuleRegistry.getNormalId(shortId);
        IModuleDataFactory<?> dataFactory = RFTools.screenModuleRegistry.getModuleDataFactory(id);
        IModuleData data = dataFactory.createData(buf);
        screenData.put(key, data);
    }
}
Also used : GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate) IModuleData(mcjty.rftools.api.screens.data.IModuleData)

Aggregations

GlobalCoordinate (mcjty.lib.varia.GlobalCoordinate)53 BlockPos (net.minecraft.util.math.BlockPos)17 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)9 TileEntity (net.minecraft.tileentity.TileEntity)9 World (net.minecraft.world.World)8 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)6 ItemStack (net.minecraft.item.ItemStack)5 IBlockState (net.minecraft.block.state.IBlockState)4 MovingSound (net.minecraft.client.audio.MovingSound)4 NBTTagList (net.minecraft.nbt.NBTTagList)4 ArrayList (java.util.ArrayList)3 Block (net.minecraft.block.Block)3 WorldServer (net.minecraft.world.WorldServer)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 SmartWrenchMode (mcjty.lib.api.smartwrench.SmartWrenchMode)2 IModuleData (mcjty.rftools.api.screens.data.IModuleData)2 EndergenicTileEntity (mcjty.rftools.blocks.endergen.EndergenicTileEntity)2 EnvironmentModule (mcjty.rftools.blocks.environmental.modules.EnvironmentModule)2 TeleportDestination (mcjty.rftools.blocks.teleporter.TeleportDestination)2