mcjty.lib.varia.Logging.message() - java examples

Here are the examples of the java api mcjty.lib.varia.Logging.message() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

62 Examples 7

18 View Complete Implementation : SpaceChamberControllerTileEntity.java
Copyright MIT License
Author : McJtyMods
public void createChamber(EnreplacedyPlayer player) {
    int x1 = getPos().getX();
    int y1 = getPos().getY();
    int z1 = getPos().getZ();
    int x2 = x1;
    int y2 = y1;
    int z2 = z1;
    for (int i = 1; i < BuilderConfiguration.maxSpaceChamberDimension.get(); i++) {
        if (x2 == x1) {
            if (getWorld().getBlockState(new BlockPos(x1 - i, y1, z1)).getBlock() == BuilderSetup.spaceChamberBlock) {
                x2 = x1 - i;
            } else if (getWorld().getBlockState(new BlockPos(x1 + i, y1, z1)).getBlock() == BuilderSetup.spaceChamberBlock) {
                x2 = x1 + i;
            }
        }
        if (z2 == z1) {
            if (getWorld().getBlockState(new BlockPos(x1, y1, z1 - i)).getBlock() == BuilderSetup.spaceChamberBlock) {
                z2 = z1 - i;
            } else if (getWorld().getBlockState(new BlockPos(x1, y1, z1 + i)).getBlock() == BuilderSetup.spaceChamberBlock) {
                z2 = z1 + i;
            }
        }
    }
    if (x1 == x2 || z2 == z1) {
        Logging.message(player, TextFormatting.RED + "Not a valid chamber shape!");
        return;
    }
    if (getWorld().getBlockState(new BlockPos(x2, y1, z2)).getBlock() != BuilderSetup.spaceChamberBlock) {
        Logging.message(player, TextFormatting.RED + "Not a valid chamber shape!");
        return;
    }
    for (int i = 1; i < BuilderConfiguration.maxSpaceChamberDimension.get(); i++) {
        if (getWorld().getBlockState(new BlockPos(x1, y1 - i, z1)).getBlock() == BuilderSetup.spaceChamberBlock) {
            y2 = y1 - i;
            break;
        }
        if (getWorld().getBlockState(new BlockPos(x1, y1 + i, z1)).getBlock() == BuilderSetup.spaceChamberBlock) {
            y2 = y1 + i;
            break;
        }
    }
    if (y1 == y2) {
        Logging.message(player, TextFormatting.RED + "Not a valid chamber shape!");
        return;
    }
    if (getWorld().getBlockState(new BlockPos(x2, y2, z2)).getBlock() != BuilderSetup.spaceChamberBlock) {
        Logging.message(player, TextFormatting.RED + "Not a valid chamber shape!");
        return;
    }
    if (getWorld().getBlockState(new BlockPos(x1, y2, z2)).getBlock() != BuilderSetup.spaceChamberBlock) {
        Logging.message(player, TextFormatting.RED + "Not a valid chamber shape!");
        return;
    }
    if (getWorld().getBlockState(new BlockPos(x2, y2, z1)).getBlock() != BuilderSetup.spaceChamberBlock) {
        Logging.message(player, TextFormatting.RED + "Not a valid chamber shape!");
        return;
    }
    // We have a valid shape.
    minCorner = new BlockPos(Math.min(x1, x2) + 1, Math.min(y1, y2) + 1, Math.min(z1, z2) + 1);
    maxCorner = new BlockPos(Math.max(x1, x2) - 1, Math.max(y1, y2) - 1, Math.max(z1, z2) - 1);
    if (minCorner.getX() > maxCorner.getX() || minCorner.getY() > maxCorner.getY() || minCorner.getZ() > maxCorner.getZ()) {
        Logging.message(player, TextFormatting.RED + "Chamber is too small!");
        minCorner = null;
        maxCorner = null;
        return;
    }
    Logging.message(player, TextFormatting.WHITE + "Chamber succesfully created!");
    SpaceChamberRepository chamberRepository = SpaceChamberRepository.getChannels(getWorld());
    SpaceChamberRepository.SpaceChamberChannel chamberChannel = chamberRepository.getOrCreateChannel(channel);
    chamberChannel.setDimension(getWorld().provider.getDimension());
    chamberChannel.setMinCorner(minCorner);
    chamberChannel.setMaxCorner(maxCorner);
    chamberRepository.save();
    markDirtyClient();
}

18 View Complete Implementation : GuiNetworkMonitor.java
Copyright MIT License
Author : McJtyMods
private void hilightBlock(int index) {
    if (index == -1) {
        return;
    }
    BlockPos c = indexToCoordinate.get(index);
    RFTools.instance.clientInfo.hilightBlock(c, System.currentTimeMillis() + 1000 * NetworkMonitorConfiguration.hilightTime.get());
    Logging.message(mc.player, "The block is now highlighted");
    Minecraft.getMinecraft().player.closeScreen();
}

18 View Complete Implementation : GuiStorageScanner.java
Copyright MIT License
Author : McJtyMods
private void hilightSelectedContainer(int index) {
    if (index == -1) {
        return;
    }
    if (index == 0) {
        // Starred
        return;
    }
    PacketReturnInventoryInfo.InventoryInfo c = fromServer_inventories.get(index - 1);
    if (c != null) {
        RFTools.instance.clientInfo.hilightBlock(c.getPos(), System.currentTimeMillis() + 1000 * StorageScannerConfiguration.hilightTime.get());
        Logging.message(mc.player, "The inventory is now highlighted");
        mc.player.closeScreen();
    }
}

18 View Complete Implementation : SpaceChamberCardItem.java
Copyright MIT License
Author : McJtyMods
private void showDetails(World world, EnreplacedyPlayer player, ItemStack stack) {
    if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("channel")) {
        int channel = stack.getTagCompound().getInteger("channel");
        if (channel != -1) {
            showDetailsGui(world, player);
        } else {
            Logging.message(player, TextFormatting.YELLOW + "Card is not linked!");
        }
    }
}

17 View Complete Implementation : SpawnerTileEntity.java
Copyright MIT License
Author : McJtyMods
// private int countEnreplacediesWithinAABB(AxisAlignedBB aabb) {
// int i = MathHelper.floor_double((aabb.minX - World.MAX_ENreplacedY_RADIUS) / 16.0D);
// int j = MathHelper.floor_double((aabb.maxX + World.MAX_ENreplacedY_RADIUS) / 16.0D);
// int k = MathHelper.floor_double((aabb.minZ - World.MAX_ENreplacedY_RADIUS) / 16.0D);
// int l = MathHelper.floor_double((aabb.maxZ + World.MAX_ENreplacedY_RADIUS) / 16.0D);
// 
// int cnt = 0;
// for (int i1 = i; i1 <= j; ++i1) {
// for (int j1 = k; j1 <= l; ++j1) {
// if (getWorld().getChunkProvider().chunkExists(i1, j1)) {
// cnt += countEnreplacediesWithinChunkAABB(getWorld().getChunkFromChunkCoords(i1, j1), aabb);
// }
// }
// }
// return cnt;
// }
// 
// private int countEnreplacediesWithinChunkAABB(Chunk chunk, AxisAlignedBB aabb) {
// int cnt = 0;
// int i = MathHelper.floor_double((aabb.minY - World.MAX_ENreplacedY_RADIUS) / 16.0D);
// int j = MathHelper.floor_double((aabb.maxY + World.MAX_ENreplacedY_RADIUS) / 16.0D);
// i = MathHelper.clamp_int(i, 0, chunk.enreplacedyLists.length - 1);
// j = MathHelper.clamp_int(j, 0, chunk.enreplacedyLists.length - 1);
// 
// for (int k = i; k <= j; ++k) {
// List enreplacedyList = chunk.enreplacedyLists[k];
// cnt += enreplacedyList.size();
// }
// return cnt;
// }
// 
// 
// Called from client side when a wrench is used.
public void useWrench(EnreplacedyPlayer player) {
    BlockPos coord = RFTools.instance.clientInfo.getSelectedTE();
    if (coord == null) {
        // Nothing to do.
        return;
    }
    TileEnreplacedy tileEnreplacedy = getWorld().getTileEnreplacedy(coord);
    double d = new Vec3d(coord).distanceTo(new Vec3d(getPos()));
    if (d > SpawnerConfiguration.maxBeamDistance) {
        Logging.message(player, "Destination distance is too far!");
    } else if (tileEnreplacedy instanceof MatterBeamerTileEnreplacedy) {
        MatterBeamerTileEnreplacedy matterBeamerTileEnreplacedy = (MatterBeamerTileEnreplacedy) tileEnreplacedy;
        matterBeamerTileEnreplacedy.setDestination(getPos());
        Logging.message(player, "Destination set!");
    }
    RFTools.instance.clientInfo.setSelectedTE(null);
    RFTools.instance.clientInfo.setDestinationTE(null);
}

17 View Complete Implementation : MatterTransmitterTileEntity.java
Copyright MIT License
Author : McJtyMods
public void startTeleportation(Enreplacedy enreplacedy) {
    if (cooldownTimer > 0) {
        // In cooldown. We can't do teleport right now.
        return;
    }
    if (teleportingPlayer != null) {
        // Already teleporting
        return;
    }
    if (!(enreplacedy instanceof EnreplacedyPlayer)) {
        return;
    }
    EnreplacedyPlayer player = (EnreplacedyPlayer) enreplacedy;
    if (player.isRiding() || player.isBeingRidden()) {
        cooldownTimer = 80;
        return;
    }
    TeleportDestination dest = teleportDestination;
    if (teleportId != null) {
        dest = getTeleportDestination();
    }
    if (dest != null && dest.isValid()) {
        int cost = TeleportationTools.calculateRFCost(getWorld(), getPos(), dest);
        cost = (int) (cost * (4.0f - getInfusedFactor()) / 4.0f);
        if (getStoredPower() < cost) {
            Logging.warn(player, "Not enough power to start the teleport!");
            cooldownTimer = 80;
            return;
        }
        int srcId = getWorld().provider.getDimension();
        int dstId = dest.getDimension();
        if (!TeleportationTools.checkValidTeleport(player, srcId, dstId)) {
            cooldownTimer = 80;
            return;
        }
        Logging.message(player, "Start teleportation...");
        teleportingPlayer = player.getName();
        teleportTimer = TeleportationTools.calculateTime(getWorld(), getPos(), dest);
        teleportTimer = (int) (teleportTimer * (1.2f - getInfusedFactor()) / 1.2f);
        int rf = TeleportConfiguration.rfTeleportPerTick.get();
        rf = (int) (rf * (4.0f - getInfusedFactor()) / 4.0f);
        int totalRfUsed = cost + rf * (teleportTimer + 1);
        rfPerTick = totalRfUsed / (teleportTimer + 1);
        totalTicks = teleportTimer;
        goodTicks = 0;
        badTicks = 0;
    } else {
        Logging.warn(player, "Something is wrong with the destination!");
    }
}

17 View Complete Implementation : MatterTransmitterTileEntity.java
Copyright MIT License
Author : McJtyMods
private boolean isPlayerOutsideBeam() {
    EnreplacedyPlayer player = getWorld().getPlayerEnreplacedyByName(teleportingPlayer);
    if (player == null) {
        return true;
    }
    AxisAlignedBB playerBB = player.getEnreplacedyBoundingBox();
    // Shouldn't be possible but there are mods...
    if (playerBB == null) {
        return true;
    }
    prepareBeamBox();
    if (!playerBB.intersects(beamBox)) {
        Logging.message(player, "Teleportation was interrupted!");
        return true;
    }
    return false;
}

17 View Complete Implementation : ResonatingCrystalTileEntity.java
Copyright MIT License
Author : McJtyMods
public static void spawnCrystal(EnreplacedyPlayer player, World world, BlockPos pos, int purity, int strength, int efficiency, int power) {
    world.setBlockState(pos, ModBlocks.resonatingCrystalBlock.getStateFromMeta(0), 3);
    TileEnreplacedy te = world.getTileEnreplacedy(pos);
    if (te instanceof ResonatingCrystalTileEnreplacedy) {
        ResonatingCrystalTileEnreplacedy resonatingCrystalTileEnreplacedy = (ResonatingCrystalTileEnreplacedy) te;
        resonatingCrystalTileEnreplacedy.setPurity(purity);
        resonatingCrystalTileEnreplacedy.setStrength(strength);
        resonatingCrystalTileEnreplacedy.setEfficiency(efficiency);
        resonatingCrystalTileEnreplacedy.setPower(power);
        float radPurity = resonatingCrystalTileEnreplacedy.getPurity();
        float radRadius = DRRadiationManager.calculateRadiationRadius(resonatingCrystalTileEnreplacedy.getStrength(), resonatingCrystalTileEnreplacedy.getEfficiency(), radPurity);
        float radStrength = DRRadiationManager.calculateRadiationStrength(resonatingCrystalTileEnreplacedy.getStrength(), radPurity);
        Logging.message(player, "Crystal would produce " + radStrength + " radiation with a radius of " + radRadius);
    }
}

17 View Complete Implementation : StorageModuleItem.java
Copyright MIT License
Author : McJtyMods
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EnreplacedyPlayer player, EnumHand hand) {
    ItemStack stack = player.getHeldItem(hand);
    if (!world.isRemote) {
        Logging.message(player, TextFormatting.YELLOW + "Place this module in a storage module tablet to access contents");
        return new ActionResult<>(EnumActionResult.SUCCESS, stack);
    }
    return new ActionResult<>(EnumActionResult.SUCCESS, stack);
}

17 View Complete Implementation : SecurityCardItem.java
Copyright MIT License
Author : McJtyMods
// @SideOnly(Side.CLIENT)
// @Override
// public IIcon getIconIndex(ItemStack stack) {
// NBTTagCompound tagCompound = stack.getTagCompound();
// if (tagCompound != null && tagCompound.hasKey("channel")) {
// return activeIcon;
// } else {
// return itemIcon;
// }
// }
private void toggleSecuritySettings(EnreplacedyPlayer player, GenericTileEnreplacedy genericTileEnreplacedy, int channel) {
    int sec = genericTileEnreplacedy.getSecurityChannel();
    if (sec == channel) {
        genericTileEnreplacedy.setSecurityChannel(-1);
        Logging.message(player, "Security settings cleared from block!");
    } else {
        genericTileEnreplacedy.setSecurityChannel(channel);
        Logging.message(player, "Security settings applied on block!");
    }
}

17 View Complete Implementation : MatterBeamerTileEntity.java
Copyright MIT License
Author : McJtyMods
// Called from client side when a wrench is used.
public void useWrench(EnreplacedyPlayer player) {
    BlockPos coord = RFTools.instance.clientInfo.getSelectedTE();
    TileEnreplacedy tileEnreplacedy = null;
    if (coord != null) {
        tileEnreplacedy = getWorld().getTileEnreplacedy(coord);
    }
    if (!(tileEnreplacedy instanceof MatterBeamerTileEnreplacedy)) {
        // None selected. Just select this one.
        RFTools.instance.clientInfo.setSelectedTE(getPos());
        SpawnerTileEnreplacedy destinationTE = getDestinationTE();
        if (destinationTE == null) {
            RFTools.instance.clientInfo.setDestinationTE(null);
        } else {
            RFTools.instance.clientInfo.setDestinationTE(destinationTE.getPos());
        }
        Logging.message(player, "Select a spawner as destination");
    } else if (coord.equals(getPos())) {
        // Unselect this one.
        RFTools.instance.clientInfo.setSelectedTE(null);
        RFTools.instance.clientInfo.setDestinationTE(null);
        setDestination(null);
        Logging.message(player, "Destination cleared!");
    }
}

16 View Complete Implementation : AdvancedChargedPorterItem.java
Copyright MIT License
Author : McJtyMods
@Override
protected void selectOnReceiver(EnreplacedyPlayer player, World world, NBTTagCompound tagCompound, int id) {
    for (int i = 0; i < MAXTARGETS; i++) {
        if (tagCompound.hasKey("target" + i) && tagCompound.getInteger("target" + i) == id) {
            // Id is already there.
            Logging.message(player, TextFormatting.YELLOW + "Receiver " + id + " was already added to the charged porter.");
            return;
        }
    }
    for (int i = 0; i < MAXTARGETS; i++) {
        if (!tagCompound.hasKey("target" + i)) {
            tagCompound.setInteger("target" + i, id);
            if (world.isRemote) {
                Logging.message(player, "Receiver " + id + " is added to the charged porter.");
            }
            if (!tagCompound.hasKey("target")) {
                tagCompound.setInteger("target", id);
            }
            return;
        }
    }
    if (world.isRemote) {
        Logging.message(player, TextFormatting.YELLOW + "Charged porter has no free targets!");
    }
}

16 View Complete Implementation : RadiationMonitorItem.java
Copyright MIT License
Author : McJtyMods
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EnreplacedyPlayer player, EnumHand hand) {
    ItemStack stack = player.getHeldItem(hand);
    if (!world.isRemote) {
        GlobalCoordinate c = new GlobalCoordinate(player.getPosition(), world.provider.getDimension());
        float maxStrength = calculateRadiationStrength(world, c);
        if (maxStrength <= 0.0f) {
            Logging.message(player, TextFormatting.GREEN + "No radiation detected");
        } else {
            Logging.message(player, TextFormatting.RED + "Strength of Radiation " + new Float(maxStrength).intValue() + "!");
        }
    }
    return new ActionResult<>(EnumActionResult.SUCCESS, stack);
}

16 View Complete Implementation : BlockProtectorTileEntity.java
Copyright MIT License
Author : McJtyMods
@Override
public void selectBlock(EnreplacedyPlayer player, BlockPos pos) {
    // This is always called server side.
    int xCoord = getPos().getX();
    int yCoord = getPos().getY();
    int zCoord = getPos().getZ();
    if (Math.abs(pos.getX() - xCoord) > BlockProtectorConfiguration.maxProtectDistance.get() || Math.abs(pos.getY() - yCoord) > BlockProtectorConfiguration.maxProtectDistance.get() || Math.abs(pos.getZ() - zCoord) > BlockProtectorConfiguration.maxProtectDistance.get()) {
        Logging.message(player, TextFormatting.RED + "Block out of range of the block protector!");
        return;
    }
    GlobalCoordinate gc = new GlobalCoordinate(pos, getWorld().provider.getDimension());
    toggleCoordinate(gc);
}

16 View Complete Implementation : EndergenicTileEntity.java
Copyright MIT License
Author : McJtyMods
// Called from client side when a wrench is used.
public void useWrench(EnreplacedyPlayer player) {
    BlockPos thisCoord = getPos();
    BlockPos coord = RFTools.instance.clientInfo.getSelectedTE();
    TileEnreplacedy tileEnreplacedy = null;
    if (coord != null) {
        tileEnreplacedy = getWorld().getTileEnreplacedy(coord);
    }
    if (!(tileEnreplacedy instanceof EndergenicTileEnreplacedy)) {
        // None selected. Just select this one.
        RFTools.instance.clientInfo.setSelectedTE(thisCoord);
        EndergenicTileEnreplacedy destinationTE = getDestinationTE();
        if (destinationTE == null) {
            RFTools.instance.clientInfo.setDestinationTE(null);
            Logging.message(player, "Select another endergenic generator as destination");
        } else {
            RFTools.instance.clientInfo.setDestinationTE(destinationTE.getPos());
            int distance = getDistanceInTicks();
            Logging.message(player, "Select another endergenic generator as destination (current distance " + distance + ")");
        }
    } else if (coord.equals(thisCoord)) {
        // Unselect this one.
        RFTools.instance.clientInfo.setSelectedTE(null);
        RFTools.instance.clientInfo.setDestinationTE(null);
    } else {
        // Make a link.
        EndergenicTileEnreplacedy otherTE = (EndergenicTileEnreplacedy) tileEnreplacedy;
        int distance = otherTE.calculateDistance(thisCoord);
        if (distance >= 5) {
            Logging.warn(player, "Distance is too far (maximum 4)");
            return;
        }
        otherTE.setDestination(thisCoord);
        RFTools.instance.clientInfo.setSelectedTE(null);
        RFTools.instance.clientInfo.setDestinationTE(null);
        Logging.message(player, "Destination is set (distance " + otherTE.getDistanceInTicks() + " ticks)");
    }
}

16 View Complete Implementation : GuiDialingDevice.java
Copyright MIT License
Author : McJtyMods
private void hilightSelectedReceiver(int index) {
    TeleportDestination destination = getSelectedReceiver(index);
    if (destination == null) {
        return;
    }
    BlockPos c = destination.getCoordinate();
    double distance = new Vec3d(c.getX(), c.getY(), c.getZ()).distanceTo(mc.player.getPositionVector());
    if (destination.getDimension() != mc.world.provider.getDimension() || distance > 150) {
        Logging.warn(mc.player, "Receiver is too far to hilight!");
        mc.player.closeScreen();
        return;
    }
    // @todo StorageScannerConfiguration.hilightTime);
    RFTools.instance.clientInfo.hilightBlock(c, System.currentTimeMillis() + 1000 * 5);
    Logging.message(mc.player, "The receiver is now highlighted");
    mc.player.closeScreen();
}

15 View Complete Implementation : ShieldBlock.java
Copyright MIT License
Author : McJtyMods
@Override
protected boolean wrenchSneakSelect(World world, BlockPos pos, EnreplacedyPlayer player) {
    if (!world.isRemote) {
        GlobalCoordinate currentBlock = SmartWrenchItem.getCurrentBlock(player.getHeldItem(EnumHand.MAIN_HAND));
        if (currentBlock == null) {
            SmartWrenchItem.setCurrentBlock(player.getHeldItem(EnumHand.MAIN_HAND), new GlobalCoordinate(pos, world.provider.getDimension()));
            Logging.message(player, TextFormatting.YELLOW + "Selected block");
        } else {
            SmartWrenchItem.setCurrentBlock(player.getHeldItem(EnumHand.MAIN_HAND), null);
            Logging.message(player, TextFormatting.YELLOW + "Cleared selected block");
        }
    }
    return true;
}

15 View Complete Implementation : ShieldTEBase.java
Copyright MIT License
Author : McJtyMods
@Override
public void selectBlock(EnreplacedyPlayer player, BlockPos pos) {
    if (!shieldComposed) {
        Logging.message(player, TextFormatting.YELLOW + "Shield is not composed. Nothing happens!");
        return;
    }
    float squaredDistance = (float) getPos().distanceSq(pos.getX(), pos.getY(), pos.getZ());
    if (squaredDistance > ShieldConfiguration.maxDisjointShieldDistance.get() * ShieldConfiguration.maxDisjointShieldDistance.get()) {
        Logging.message(player, TextFormatting.YELLOW + "This template is too far to connect to the shield!");
        return;
    }
    int xCoord = getPos().getX();
    int yCoord = getPos().getY();
    int zCoord = getPos().getZ();
    Block origBlock = getWorld().getBlockState(pos).getBlock();
    if (origBlock == ShieldSetup.shieldTemplateBlock) {
        if (isShapedShield()) {
            Logging.message(player, TextFormatting.YELLOW + "You cannot add template blocks to a shaped shield (using a shape card)!");
            return;
        }
        Map<BlockPos, IBlockState> templateBlocks = new HashMap<>();
        IBlockState state = getWorld().getBlockState(pos);
        templateBlocks.put(pos, null);
        findTemplateBlocks(templateBlocks, state, false, pos);
        int[] camoId = calculateCamoId();
        int cddata = calculateShieldCollisionData();
        int damageBits = calculateDamageBits();
        Block block = calculateShieldBlock(damageBits, camoId, blockLight);
        for (Map.Entry<BlockPos, IBlockState> entry : templateBlocks.entrySet()) {
            BlockPos templateBlock = entry.getKey();
            RelCoordinateShield relc = new RelCoordinateShield(templateBlock.getX() - xCoord, templateBlock.getY() - yCoord, templateBlock.getZ() - zCoord, -1);
            shieldBlocks.add(relc);
            updateShieldBlock(camoId, cddata, damageBits, block, relc);
        }
    } else if (origBlock instanceof AbstractShieldBlock) {
        // @todo
        shieldBlocks.remove(new RelCoordinate(pos.getX() - xCoord, pos.getY() - yCoord, pos.getZ() - zCoord));
        getWorld().setBlockState(pos, templateState, 2);
    } else {
        Logging.message(player, TextFormatting.YELLOW + "The selected shield can't do anything with this block!");
        return;
    }
    markDirtyClient();
}

15 View Complete Implementation : SimpleDialerBlock.java
Copyright MIT License
Author : McJtyMods
@Override
protected boolean wrenchUse(World world, BlockPos pos, EnumFacing side, EnreplacedyPlayer player) {
    if (!world.isRemote) {
        SimpleDialerTileEnreplacedy simpleDialerTileEnreplacedy = (SimpleDialerTileEnreplacedy) world.getTileEnreplacedy(pos);
        boolean onceMode = !simpleDialerTileEnreplacedy.isOnceMode();
        simpleDialerTileEnreplacedy.setOnceMode(onceMode);
        if (onceMode) {
            Logging.message(player, "Enabled 'dial once' mode");
        } else {
            Logging.message(player, "Disabled 'dial once' mode");
        }
    }
    return true;
}

15 View Complete Implementation : ChargedPorterItem.java
Copyright MIT License
Author : McJtyMods
protected void selectOnReceiver(EnreplacedyPlayer player, World world, NBTTagCompound tagCompound, int id) {
    if (world.isRemote) {
        Logging.message(player, "Charged porter target is set to " + id + ".");
    }
    tagCompound.setInteger("target", id);
}

15 View Complete Implementation : ChargedPorterItem.java
Copyright MIT License
Author : McJtyMods
private void setTarget(ItemStack stack, EnreplacedyPlayer player, World world, TileEnreplacedy te) {
    NBTTagCompound tagCompound = stack.getTagCompound();
    if (tagCompound == null) {
        tagCompound = new NBTTagCompound();
    }
    int id = -1;
    if (te instanceof MatterReceiverTileEnreplacedy) {
        MatterReceiverTileEnreplacedy matterReceiverTileEnreplacedy = (MatterReceiverTileEnreplacedy) te;
        if (!matterReceiverTileEnreplacedy.checkAccess(player.getName())) {
            Logging.message(player, TextFormatting.RED + "You have no access to target this receiver!");
            return;
        }
        id = matterReceiverTileEnreplacedy.getId();
    }
    if (id != -1) {
        selectOnReceiver(player, world, tagCompound, id);
    } else {
        selectOnThinAir(player, world, tagCompound, stack);
    }
    stack.setTagCompound(tagCompound);
}

15 View Complete Implementation : GuiController.java
Copyright MIT License
Author : McJtyMods
private void hilightSelectedContainer(int index) {
    if (index < 0) {
        return;
    }
    ConnectedBlockClientInfo c = fromServer_connectedBlocks.get(index);
    if (c != null) {
        XNet.instance.clientInfo.hilightBlock(c.getPos().getPos(), System.currentTimeMillis() + 1000 * 5);
        Logging.message(mc.player, "The block is now highlighted");
        mc.player.closeScreen();
    }
}

14 View Complete Implementation : PowerCellTileEntity.java
Copyright MIT License
Author : McJtyMods
public static void dumpNetwork(EnreplacedyPlayer player, PowerCellTileEnreplacedy powerCellTileEnreplacedy) {
    PowerCellNetwork.Network network = powerCellTileEnreplacedy.getNetwork();
    Set<GlobalCoordinate> blocks = network.getBlocks();
    // System.out.println("blocks.size() = " + blocks.size());
    blocks.forEach(b -> {
        String msg;
        World w = mcjty.lib.varia.TeleportationTools.getWorldForDimension(b.getDimension());
        if (w == null) {
            msg = "dimension missing!";
        } else {
            Block block = w.getBlockState(b.getCoordinate()).getBlock();
            if (block == PowerCellSetup.powerCellBlock) {
                msg = "normal";
            } else if (block == PowerCellSetup.advancedPowerCellBlock) {
                msg = "advanced";
            } else if (block == PowerCellSetup.creativePowerCellBlock) {
                msg = "creative";
            } else {
                msg = "not a powercell!";
            }
            TileEnreplacedy te = w.getTileEnreplacedy(b.getCoordinate());
            if (te instanceof PowerCellTileEnreplacedy) {
                PowerCellTileEnreplacedy power = (PowerCellTileEnreplacedy) te;
                msg += " (+:" + power.getTotalInserted() + ", -:" + power.getTotalExtracted() + ")";
            }
        }
        Logging.message(player, "Block: " + BlockPosTools.toString(b.getCoordinate()) + " (" + b.getDimension() + "): " + msg);
    });
}

14 View Complete Implementation : ChargedPorterItem.java
Copyright MIT License
Author : McJtyMods
protected void selectOnThinAir(EnreplacedyPlayer player, World world, NBTTagCompound tagCompound, ItemStack stack) {
    if (world.isRemote) {
        Logging.message(player, "Charged porter is cleared.");
    }
    tagCompound.removeTag("target");
}

14 View Complete Implementation : GenericWorldProvider.java
Copyright MIT License
Author : McJtyMods
@Override
public WorldSleepResult canSleepAt(EnreplacedyPlayer player, BlockPos pos) {
    switch(GeneralConfiguration.bedBehaviour) {
        case 0:
            Logging.message(player, "You cannot sleep in this dimension!");
            return WorldSleepResult.DENY;
        // In case 1, just do the usual thing (this typically mean explosion).
        case 2:
            player.setSpawnChunk(pos, true, getDimension());
            Logging.message(player, "Spawn point set!");
            return WorldSleepResult.DENY;
    }
    return super.canSleepAt(player, pos);
}

13 View Complete Implementation : ShardWandItem.java
Copyright MIT License
Author : McJtyMods
@Override
public EnumActionResult onItemUse(EnreplacedyPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if (!world.isRemote) {
        Block block = world.getBlockState(pos).getBlock();
        if (block instanceof Infusable) {
            TileEnreplacedy te = world.getTileEnreplacedy(pos);
            if (te instanceof GenericTileEnreplacedy) {
                GenericTileEnreplacedy genericTileEnreplacedy = (GenericTileEnreplacedy) te;
                int infused = genericTileEnreplacedy.getInfused();
                if (infused < GeneralConfig.maxInfuse) {
                    infused = GeneralConfig.maxInfuse;
                    Logging.message(player, "Maximized infusion level!");
                } else {
                    infused = 0;
                    Logging.message(player, "Cleared infusion level!");
                }
                genericTileEnreplacedy.setInfused(infused);
            } else {
                Logging.message(player, "This block doesn't have the right tile enreplacedy!");
            }
        } else {
            Logging.message(player, "This block is not infusable!");
        }
        return EnumActionResult.SUCCESS;
    }
    return EnumActionResult.SUCCESS;
}

12 View Complete Implementation : SyringeItem.java
Copyright MIT License
Author : McJtyMods
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EnreplacedyPlayer player, EnumHand hand) {
    ItemStack stack = player.getHeldItem(hand);
    if (!world.isRemote) {
        NBTTagCompound tagCompound = stack.getTagCompound();
        if (tagCompound != null) {
            String mobName = getMobName(stack);
            if (mobName != null) {
                Logging.message(player, TextFormatting.BLUE + "Mob: " + mobName);
            }
            int level = tagCompound.getInteger("level");
            level = level * 100 / GeneralConfiguration.maxMobInjections.get();
            Logging.message(player, TextFormatting.BLUE + "Essence level: " + level + "%");
        }
        return new ActionResult<>(EnumActionResult.SUCCESS, stack);
    }
    return new ActionResult<>(EnumActionResult.SUCCESS, stack);
}

12 View Complete Implementation : DimensionMonitorItem.java
Copyright MIT License
Author : McJtyMods
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EnreplacedyPlayer player, EnumHand hand) {
    ItemStack stack = player.getHeldItem(hand);
    if (!world.isRemote) {
        int id = player.getEnreplacedyWorld().provider.getDimension();
        RfToolsDimensionManager dimensionManager = RfToolsDimensionManager.getDimensionManager(player.getEnreplacedyWorld());
        DimensionInformation dimensionInformation = dimensionManager.getDimensionInformation(id);
        if (dimensionInformation == null) {
            Logging.message(player, "Not an RFTools dimension!");
        } else {
            String name = dimensionInformation.getName();
            DimensionStorage storage = DimensionStorage.getDimensionStorage(player.getEnreplacedyWorld());
            long power = storage != null ? storage.getEnergyLevel(id) : 0;
            Logging.message(player, TextFormatting.BLUE + "Name: " + name + " (Id " + id + ")" + TextFormatting.YELLOW + "    Power: " + power + " RF");
            if (player.isSneaking()) {
                Logging.message(player, TextFormatting.RED + "Description: " + dimensionInformation.getDescriptor().getDescriptionString());
                System.out.println("Description:  = " + dimensionInformation.getDescriptor().getDescriptionString());
            }
        }
        return new ActionResult<>(EnumActionResult.SUCCESS, stack);
    }
    return new ActionResult<>(EnumActionResult.SUCCESS, stack);
}

11 View Complete Implementation : GenericRFToolsBlock.java
Copyright MIT License
Author : McJtyMods
@Override
public boolean checkAccess(World world, EnreplacedyPlayer player, TileEnreplacedy te) {
    if (SecurityConfiguration.enabled.get() && te instanceof GenericTileEnreplacedy) {
        GenericTileEnreplacedy genericTileEnreplacedy = (GenericTileEnreplacedy) te;
        if ((!OrphaningCardItem.isPrivileged(player, world)) && (!player.getPersistentID().equals(genericTileEnreplacedy.getOwnerUUID()))) {
            int securityChannel = genericTileEnreplacedy.getSecurityChannel();
            if (securityChannel != -1) {
                SecurityChannels securityChannels = SecurityChannels.getChannels(world);
                SecurityChannels.SecurityChannel channel = securityChannels.getChannel(securityChannel);
                boolean playerListed = channel.getPlayers().contains(player.getDisplayNameString());
                if (channel.isWhitelist() != playerListed) {
                    Logging.message(player, TextFormatting.RED + "You have no permission to use this block!");
                    return true;
                }
            }
        }
    }
    return false;
}

11 View Complete Implementation : OrphaningCardItem.java
Copyright MIT License
Author : McJtyMods
@Override
public EnumActionResult onItemUse(EnreplacedyPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if (!world.isRemote) {
        TileEnreplacedy te = world.getTileEnreplacedy(pos);
        if (te instanceof GenericTileEnreplacedy) {
            // Generalize with a security API interface @todo
            GenericTileEnreplacedy genericTileEnreplacedy = (GenericTileEnreplacedy) te;
            if (genericTileEnreplacedy.getOwnerUUID() == null) {
                Logging.message(player, TextFormatting.RED + "This block has no owner!");
            } else {
                if (isPrivileged(player, world)) {
                    genericTileEnreplacedy.clearOwner();
                    Logging.message(player, "Cleared owner!");
                } else if (genericTileEnreplacedy.getOwnerUUID().equals(player.getPersistentID())) {
                    genericTileEnreplacedy.clearOwner();
                    Logging.message(player, "Cleared owner!");
                } else {
                    Logging.message(player, TextFormatting.RED + "You cannot clear ownership of a block you don't own!");
                }
            }
        } else {
            Logging.message(player, TextFormatting.RED + "Onwership is not supported on this block!");
        }
        return EnumActionResult.SUCCESS;
    }
    return EnumActionResult.SUCCESS;
}

11 View Complete Implementation : StorageTools.java
Copyright MIT License
Author : McJtyMods
public static void cycleStorage(EnreplacedyPlayer player) {
    ItemStack heldItem = player.getHeldItem(EnumHand.MAIN_HAND);
    if (heldItem.isEmpty()) {
        return;
    }
    NBTTagCompound tagCompound = heldItem.getTagCompound();
    if (tagCompound == null) {
        return;
    }
    int id = tagCompound.getInteger("id");
    RemoteStorageTileEnreplacedy remoteStorage = RemoteStorageIdRegistry.getRemoteStorage(player.getEnreplacedyWorld(), id);
    if (remoteStorage != null) {
        id = remoteStorage.cycle(id);
        tagCompound.setInteger("id", id);
        int si = remoteStorage.findRemoteIndex(id);
        if (si != -1) {
            int maxStacks = remoteStorage.getMaxStacks(si);
            tagCompound.setInteger("maxSize", maxStacks);
        }
        remoteStorage.markDirty();
    } else {
        Logging.message(player, TextFormatting.YELLOW + "Remote storage it not available (out of power or out of reach)!");
    }
}

10 View Complete Implementation : RedstoneChannelBlock.java
Copyright MIT License
Author : McJtyMods
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EnreplacedyPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
    ItemStack stack = player.getHeldItem(hand);
    if (isRedstoneChannelItem(stack.gereplacedem())) {
        TileEnreplacedy te = world.getTileEnreplacedy(pos);
        if (te instanceof RedstoneChannelTileEnreplacedy) {
            if (!world.isRemote) {
                RedstoneChannelTileEnreplacedy rcte = (RedstoneChannelTileEnreplacedy) te;
                NBTTagCompound tagCompound = stack.getTagCompound();
                if (tagCompound == null) {
                    tagCompound = new NBTTagCompound();
                    stack.setTagCompound(tagCompound);
                }
                int channel;
                if (!player.isSneaking()) {
                    channel = rcte.getChannel(true);
                    tagCompound.setInteger("channel", channel);
                } else {
                    if (tagCompound.hasKey("channel")) {
                        channel = tagCompound.getInteger("channel");
                    } else {
                        channel = -1;
                    }
                    if (channel == -1) {
                        RedstoneChannels redstoneChannels = RedstoneChannels.getChannels(world);
                        channel = redstoneChannels.newChannel();
                        redstoneChannels.save();
                        tagCompound.setInteger("channel", channel);
                    }
                    rcte.setChannel(channel);
                }
                Logging.message(player, TextFormatting.YELLOW + "Channel set to " + channel + "!");
            }
            return true;
        }
    }
    return super.onBlockActivated(world, pos, state, player, hand, side, hitX, hitY, hitZ);
}

10 View Complete Implementation : SpaceChamberCardItem.java
Copyright MIT License
Author : McJtyMods
@Override
public EnumActionResult onItemUse(EnreplacedyPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    ItemStack stack = player.getHeldItem(hand);
    TileEnreplacedy te = world.getTileEnreplacedy(pos);
    NBTTagCompound tagCompound = stack.getTagCompound();
    if (tagCompound == null) {
        tagCompound = new NBTTagCompound();
        stack.setTagCompound(tagCompound);
    }
    int channel = -1;
    if (te instanceof SpaceChamberControllerTileEnreplacedy) {
        channel = ((SpaceChamberControllerTileEnreplacedy) te).getChannel();
    }
    if (channel == -1) {
        showDetails(world, player, stack);
    } else {
        tagCompound.setInteger("channel", channel);
        if (world.isRemote) {
            Logging.message(player, "Card is set to channel '" + channel + "'");
        }
    }
    return EnumActionResult.SUCCESS;
}

10 View Complete Implementation : ChargedPorterItem.java
Copyright MIT License
Author : McJtyMods
private void startTeleport(ItemStack stack, EnreplacedyPlayer player, World world) {
    NBTTagCompound tagCompound = stack.getTagCompound();
    if (tagCompound == null || (!tagCompound.hasKey("target")) || tagCompound.getInteger("target") == -1) {
        if (world.isRemote) {
            Logging.message(player, TextFormatting.RED + "The charged porter has no target.");
        }
        return;
    }
    if (!world.isRemote) {
        if (tagCompound.hasKey("tpTimer")) {
            Logging.message(player, TextFormatting.RED + "Already teleporting!");
            return;
        }
        // PorterProperties porterProperties = PlayerExtendedProperties.getPorterProperties(player);
        // if (porterProperties != null) {
        // if (porterProperties.isTeleporting()) {
        // Logging.message(player, TextFormatting.RED + "Already teleporting!");
        // return;
        // }
        // 
        // }
        int target = tagCompound.getInteger("target");
        TeleportDestinations destinations = TeleportDestinations.getDestinations(world);
        GlobalCoordinate coordinate = destinations.getCoordinateForId(target);
        if (coordinate == null) {
            Logging.message(player, TextFormatting.RED + "Something went wrong! The target has disappeared!");
            TeleportationTools.applyEffectForSeverity(player, 3, false);
            return;
        }
        TeleportDestination destination = destinations.getDestination(coordinate);
        if (!TeleportationTools.checkValidTeleport(player, world.provider.getDimension(), destination.getDimension())) {
            return;
        }
        BlockPos playerCoordinate = new BlockPos((int) player.posX, (int) player.posY, (int) player.posZ);
        int cost = TeleportationTools.calculateRFCost(world, playerCoordinate, destination);
        cost *= 1.5f;
        long energy = getEnergyStoredL(stack);
        if (cost > energy) {
            Logging.message(player, TextFormatting.RED + "Not enough energy to start the teleportation!");
            return;
        }
        extractEnergyNoMax(stack, cost, false);
        int ticks = TeleportationTools.calculateTime(world, playerCoordinate, destination);
        ticks /= getSpeedBonus();
        // if (porterProperties != null) {
        // porterProperties.startTeleport(target, ticks);
        // }
        tagCompound.setInteger("tpTimer", ticks);
        Logging.message(player, TextFormatting.YELLOW + "Start teleportation!");
    }
}

9 View Complete Implementation : CmdCleanRadiation.java
Copyright MIT License
Author : McJtyMods
@Override
public void execute(ICommandSender sender, String[] args) {
    if (args.length > 1) {
        ITextComponent component = new TextComponentString(TextFormatting.RED + "Too many parameters!");
        if (sender instanceof EnreplacedyPlayer) {
            ((EnreplacedyPlayer) sender).sendStatusMessage(component, false);
        } else {
            sender.sendMessage(component);
        }
        return;
    }
    EnreplacedyPlayer player = null;
    if (sender instanceof EnreplacedyPlayer) {
        player = (EnreplacedyPlayer) sender;
    }
    DRRadiationManager manager = DRRadiationManager.getManager(sender.getEnreplacedyWorld());
    int cnt = manager.getRadiationSources().size();
    manager.removeAllRadiation();
    if (player != null) {
        Logging.message(player, "Removed " + cnt + " radiation sources!");
    } else {
        Logging.log("Removed " + cnt + " radiation sources!");
    }
    manager.save();
}

9 View Complete Implementation : CmdListRadiation.java
Copyright MIT License
Author : McJtyMods
@Override
public void execute(ICommandSender sender, String[] args) {
    if (args.length > 1) {
        ITextComponent component = new TextComponentString(TextFormatting.RED + "Too many parameters!");
        if (sender instanceof EnreplacedyPlayer) {
            ((EnreplacedyPlayer) sender).sendStatusMessage(component, false);
        } else {
            sender.sendMessage(component);
        }
        return;
    }
    EnreplacedyPlayer player = null;
    if (sender instanceof EnreplacedyPlayer) {
        player = (EnreplacedyPlayer) sender;
    }
    DRRadiationManager manager = DRRadiationManager.getManager(sender.getEnreplacedyWorld());
    for (Map.Entry<GlobalCoordinate, DRRadiationManager.RadiationSource> source : manager.getRadiationSources().entrySet()) {
        GlobalCoordinate c = source.getKey();
        DRRadiationManager.RadiationSource radiationSource = source.getValue();
        String msg = "Radiation at " + c.getCoordinate() + " (dim " + c.getDimension() + "):";
        String msg2 = "Radius=" + radiationSource.getRadius() + ", Strength=" + radiationSource.getStrength() + ", Max=" + radiationSource.getMaxStrength();
        if (player != null) {
            Logging.message(player, msg);
            Logging.message(player, msg2);
        } else {
            Logging.log(msg);
            Logging.log(msg2);
        }
    }
}

9 View Complete Implementation : TeleportationTools.java
Copyright MIT License
Author : McJtyMods
// Return true if we needed a boost.
public static boolean performTeleport(EnreplacedyPlayer player, TeleportDestination dest, int bad, int good, boolean boosted) {
    BlockPos c = dest.getCoordinate();
    BlockPos old = new BlockPos((int) player.posX, (int) player.posY, (int) player.posZ);
    int oldId = player.getEnreplacedyWorld().provider.getDimension();
    if (!TeleportationTools.allowTeleport(player, oldId, old, dest.getDimension(), dest.getCoordinate())) {
        return false;
    }
    if (oldId != dest.getDimension()) {
        mcjty.lib.varia.TeleportationTools.teleportToDimension(player, dest.getDimension(), c.getX() + 0.5, c.getY() + 1.5, c.getZ() + 0.5);
    } else {
        player.setPositionAndUpdate(c.getX() + 0.5, c.getY() + 1, c.getZ() + 0.5);
    }
    if (TeleportConfiguration.whooshMessage.get()) {
        Logging.message(player, "Whoosh!");
    }
    // @todo achievements
    // Achievements.trigger(player, Achievements.firstTeleport);
    boolean boostNeeded = false;
    int severity = consumeReceiverEnergy(player, dest.getCoordinate(), dest.getDimension());
    if (severity > 0 && boosted) {
        boostNeeded = true;
        severity = 1;
    }
    severity = applyBadEffectIfNeeded(player, severity, bad, good, boostNeeded);
    if (severity <= 0) {
        if (TeleportConfiguration.teleportVolume.get() >= 0.01) {
            SoundTools.playSound(player.getEnreplacedyWorld(), ModSounds.whoosh, player.posX, player.posY, player.posZ, TeleportConfiguration.teleportVolume.get(), 1.0f);
        }
    }
    if (TeleportConfiguration.logTeleportUsages.get()) {
        Logging.log("Teleport: Player " + player.getName() + " from " + old + " (dim " + oldId + ") to " + dest.getCoordinate() + " (dim " + dest.getDimension() + ") with severity " + severity);
    }
    return boostNeeded;
}

9 View Complete Implementation : ChargedPorterItem.java
Copyright MIT License
Author : McJtyMods
@Override
public void onUpdate(ItemStack stack, World worldIn, Enreplacedy enreplacedyIn, int itemSlot, boolean isSelected) {
    if (!worldIn.isRemote) {
        NBTTagCompound tagCompound = stack.getTagCompound();
        if (tagCompound == null) {
            return;
        }
        if (!tagCompound.hasKey("tpTimer")) {
            return;
        }
        if (!(enreplacedyIn instanceof EnreplacedyPlayer)) {
            return;
        }
        EnreplacedyPlayer player = (EnreplacedyPlayer) enreplacedyIn;
        int timer = tagCompound.getInteger("tpTimer");
        timer--;
        if (timer <= 0) {
            tagCompound.removeTag("tpTimer");
            TeleportDestinations destinations = TeleportDestinations.getDestinations(worldIn);
            int target = tagCompound.getInteger("target");
            GlobalCoordinate coordinate = destinations.getCoordinateForId(target);
            if (coordinate == null) {
                Logging.message(player, TextFormatting.RED + "Something went wrong! The target has disappeared!");
                TeleportationTools.applyEffectForSeverity(player, 3, false);
                return;
            }
            TeleportDestination destination = destinations.getDestination(coordinate);
            ForgeEventHandlers.addPlayerToTeleportHere(destination, player);
        // TeleportationTools.performTeleport(player, destination, 0, 10, false);
        } else {
            tagCompound.setInteger("tpTimer", timer);
        }
    }
}

8 View Complete Implementation : SmartWrenchItem.java
Copyright MIT License
Author : McJtyMods
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EnreplacedyPlayer player, EnumHand hand) {
    ItemStack stack = player.getHeldItem(hand);
    if (!world.isRemote) {
        SmartWrenchMode mode = getCurrentMode(stack);
        if (mode == SmartWrenchMode.MODE_WRENCH) {
            mode = SmartWrenchMode.MODE_SELECT;
        } else {
            mode = SmartWrenchMode.MODE_WRENCH;
        }
        NBTTagCompound tagCompound = stack.getTagCompound();
        if (tagCompound == null) {
            tagCompound = new NBTTagCompound();
            stack.setTagCompound(tagCompound);
        }
        tagCompound.setString("mode", mode.getCode());
        Logging.message(player, TextFormatting.YELLOW + "Smart wrench is now in " + mode.getName() + " mode.");
    }
    return super.onItemRightClick(world, player, hand);
}

8 View Complete Implementation : StorageTools.java
Copyright MIT License
Author : McJtyMods
public static void compact(EnreplacedyPlayer player) {
    ItemStack heldItem = player.getHeldItem(EnumHand.MAIN_HAND);
    if (heldItem.isEmpty()) {
        return;
    }
    NBTTagCompound tagCompound = heldItem.getTagCompound();
    if (tagCompound == null) {
        return;
    }
    if (!tagCompound.hasKey("childDamage")) {
        // Should not be possible. Just for safety.
        return;
    }
    int moduleDamage = tagCompound.getInteger("childDamage");
    if (moduleDamage == StorageModuleItem.STORAGE_REMOTE) {
        int id = tagCompound.getInteger("id");
        RemoteStorageTileEnreplacedy remoteStorage = RemoteStorageIdRegistry.getRemoteStorage(player.getEnreplacedyWorld(), id);
        if (remoteStorage != null) {
            remoteStorage.compact(id);
            remoteStorage.markDirty();
        } else {
            Logging.message(player, TextFormatting.YELLOW + "Remote storage it not available (out of power or out of reach)!");
        }
    } else {
        GenericContainer genericContainer = (GenericContainer) player.openContainer;
        IInventory inventory = genericContainer.getInventory(ModularStorageItemContainer.CONTAINER_INVENTORY);
        ModularStorageItemInventory modularStorageItemInventory = (ModularStorageItemInventory) inventory;
        InventoryHelper.compactStacks(modularStorageItemInventory.getStacks(), 0, inventory.getSizeInventory());
        modularStorageItemInventory.markDirty();
    }
}

8 View Complete Implementation : RealizedDimensionTab.java
Copyright MIT License
Author : McJtyMods
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EnreplacedyPlayer player, EnumHand hand) {
    ItemStack stack = player.getHeldItem(hand);
    if ((!world.isRemote) && player.isSneaking()) {
        NBTTagCompound tagCompound = stack.getTagCompound();
        Logging.message(player, tagCompound.getString("descriptionString"));
        int id = tagCompound.getInteger("id");
        if (id != 0) {
            RfToolsDimensionManager dimensionManager = RfToolsDimensionManager.getDimensionManager(world);
            DimensionInformation information = dimensionManager.getDimensionInformation(id);
            if (information != null) {
                information.dump(player);
            }
        }
    }
    return new ActionResult<>(EnumActionResult.SUCCESS, stack);
}

7 View Complete Implementation : SecurityCardItem.java
Copyright MIT License
Author : McJtyMods
@Override
public EnumActionResult onItemUse(EnreplacedyPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    ItemStack stack = player.getHeldItem(hand);
    if (!world.isRemote) {
        TileEnreplacedy te = world.getTileEnreplacedy(pos);
        if (te instanceof GenericTileEnreplacedy) {
            // @tod security api
            GenericTileEnreplacedy genericTileEnreplacedy = (GenericTileEnreplacedy) te;
            if (genericTileEnreplacedy.getOwnerUUID() == null) {
                Logging.message(player, TextFormatting.RED + "This block has no owner!");
            } else {
                if (OrphaningCardItem.isPrivileged(player, world) || isOwner(player, genericTileEnreplacedy)) {
                    NBTTagCompound tagCompound = stack.getTagCompound();
                    if (tagCompound == null || !tagCompound.hasKey("channel")) {
                        int blockSecurity = genericTileEnreplacedy.getSecurityChannel();
                        if (blockSecurity == -1) {
                            Logging.message(player, TextFormatting.RED + "This security card is not setup correctly!");
                        } else {
                            if (tagCompound == null) {
                                tagCompound = new NBTTagCompound();
                                stack.setTagCompound(tagCompound);
                            }
                            tagCompound.setInteger("channel", blockSecurity);
                            Logging.message(player, TextFormatting.RED + "Copied security channel from block to card!");
                        }
                    } else {
                        int channel = tagCompound.getInteger("channel");
                        toggleSecuritySettings(player, genericTileEnreplacedy, channel);
                    }
                } else {
                    Logging.message(player, TextFormatting.RED + "You cannot change security settings of a block you don't own!");
                }
            }
        } else {
            Logging.message(player, TextFormatting.RED + "Security is not supported on this block!");
        }
        return EnumActionResult.SUCCESS;
    }
    return EnumActionResult.SUCCESS;
}

7 View Complete Implementation : KnownDimlet.java
Copyright MIT License
Author : McJtyMods
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EnreplacedyPlayer player, EnumHand hand) {
    ItemStack stack = player.getHeldItem(hand);
    if (world.isRemote) {
        return new ActionResult<>(EnumActionResult.Preplaced, stack);
    }
    DimletKey key = KnownDimletConfiguration.getDimletKey(stack);
    if (KnownDimletConfiguration.isSeedDimlet(key)) {
        NBTTagCompound tagCompound = stack.getTagCompound();
        if (tagCompound == null) {
            tagCompound = new NBTTagCompound();
        }
        boolean locked = tagCompound.getBoolean("locked");
        if (locked) {
            Logging.message(player, TextFormatting.YELLOW + "This seed dimlet is locked. You cannot modify it!");
            return new ActionResult<>(EnumActionResult.SUCCESS, stack);
        }
        long forcedSeed = tagCompound.getLong("forcedSeed");
        if (player.isSneaking()) {
            if (forcedSeed == 0) {
                Logging.message(player, TextFormatting.YELLOW + "This dimlet has no seed. You cannot lock it!");
                return new ActionResult<>(EnumActionResult.SUCCESS, stack);
            }
            tagCompound.setBoolean("locked", true);
            Logging.message(player, "Dimlet locked!");
        } else {
            long seed = world.getSeed();
            tagCompound.setLong("forcedSeed", seed);
            Logging.message(player, "Seed set to: " + seed);
        }
        stack.setTagCompound(tagCompound);
    }
    return new ActionResult<>(EnumActionResult.SUCCESS, stack);
}

4 View Complete Implementation : DumpModuleItem.java
Copyright MIT License
Author : McJtyMods
@Override
public EnumActionResult onItemUse(EnreplacedyPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    ItemStack stack = player.getHeldItem(hand);
    TileEnreplacedy te = world.getTileEnreplacedy(pos);
    if (te instanceof StorageScannerTileEnreplacedy) {
        IBlockState state = world.getBlockState(pos);
        Block block = state.getBlock();
        String name = "<invalid>";
        if (block != null && !block.isAir(state, world, pos)) {
            name = BlockTools.getReadableName(world, pos);
        }
        RFToolsTools.setPositionInModule(stack, world.provider.getDimension(), pos, name);
        if (world.isRemote) {
            Logging.message(player, "Storage module is set to block '" + name + "'");
        }
    } else {
        RFToolsTools.clearPositionInModule(stack);
        if (world.isRemote) {
            Logging.message(player, "Storage module is cleared");
        }
    }
    return EnumActionResult.SUCCESS;
}

3 View Complete Implementation : StorageModuleTabletItem.java
Copyright MIT License
Author : McJtyMods
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EnreplacedyPlayer player, EnumHand hand) {
    ItemStack stack = player.getHeldItem(hand);
    // Make sure the tablet only works in main hand to avoid problems later
    if (hand != EnumHand.MAIN_HAND) {
        return new ActionResult<>(EnumActionResult.Preplaced, stack);
    }
    if (!world.isRemote) {
        NBTTagCompound tagCompound = stack.getTagCompound();
        if (tagCompound == null || !tagCompound.hasKey("childDamage")) {
            Logging.message(player, TextFormatting.YELLOW + "This tablet contains no storage module!");
            return new ActionResult<>(EnumActionResult.FAIL, stack);
        }
        int moduleDamage = tagCompound.getInteger("childDamage");
        int rfNeeded;
        if (moduleDamage == META_FOR_SCANNER) {
            rfNeeded = ModularStorageConfiguration.TABLET_CONSUMEPERUSE_SCANNER.get();
        } else {
            rfNeeded = ModularStorageConfiguration.TABLET_CONSUMEPERUSE.get();
            if (moduleDamage != StorageModuleItem.STORAGE_REMOTE) {
                rfNeeded += ModularStorageConfiguration.TABLET_EXTRACONSUME.get() * (moduleDamage + 1);
            }
        }
        int energy = tagCompound.getInteger("Energy");
        if (energy < rfNeeded) {
            Logging.message(player, TextFormatting.YELLOW + "Not enough energy to open the contents!");
            return new ActionResult<>(EnumActionResult.FAIL, stack);
        }
        energy -= rfNeeded;
        tagCompound.setInteger("Energy", energy);
        if (moduleDamage == META_FOR_SCANNER) {
            if (tagCompound.hasKey("monitorx")) {
                int monitordim = tagCompound.getInteger("monitordim");
                int monitorx = tagCompound.getInteger("monitorx");
                int monitory = tagCompound.getInteger("monitory");
                int monitorz = tagCompound.getInteger("monitorz");
                BlockPos pos = new BlockPos(monitorx, monitory, monitorz);
                WorldServer w = DimensionManager.getWorld(monitordim);
                if (w == null || !WorldTools.chunkLoaded(w, pos)) {
                    player.sendStatusMessage(new TextComponentString(TextFormatting.RED + "Storage scanner is out of range!"), false);
                } else {
                    player.openGui(RFTools.instance, GuiProxy.GUI_REMOTE_STORAGESCANNER_ITEM, player.getEnreplacedyWorld(), (int) player.posX, (int) player.posY, (int) player.posZ);
                }
            } else {
                player.sendStatusMessage(new TextComponentString(TextFormatting.RED + "Storage module is not linked to a storage scanner!"), false);
            }
        } else if (moduleDamage == StorageModuleItem.STORAGE_REMOTE) {
            if (!tagCompound.hasKey("id")) {
                Logging.message(player, TextFormatting.YELLOW + "This remote storage module is not linked!");
                return new ActionResult<>(EnumActionResult.FAIL, stack);
            }
            player.openGui(RFTools.instance, GuiProxy.GUI_REMOTE_STORAGE_ITEM, player.getEnreplacedyWorld(), (int) player.posX, (int) player.posY, (int) player.posZ);
        } else {
            player.openGui(RFTools.instance, GuiProxy.GUI_MODULAR_STORAGE_ITEM, player.getEnreplacedyWorld(), (int) player.posX, (int) player.posY, (int) player.posZ);
        }
        return new ActionResult<>(EnumActionResult.SUCCESS, stack);
    }
    return new ActionResult<>(EnumActionResult.SUCCESS, stack);
}

2 View Complete Implementation : SmartWrenchItem.java
Copyright MIT License
Author : McJtyMods
@Override
public EnumActionResult onItemUse(EnreplacedyPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    ItemStack stack = player.getHeldItem(hand);
    if (!world.isRemote) {
        if (player.isSneaking()) {
            // Make sure the block get activated if it is a GenericBlock
            IBlockState state = world.getBlockState(pos);
            Block block = state.getBlock();
            if (block instanceof GenericBlock) {
                if (DimensionalShardBlock.activateBlock(block, world, pos, state, player, hand, facing, hitX, hitY, hitZ)) {
                    return EnumActionResult.SUCCESS;
                }
            }
        }
        SmartWrenchMode mode = getCurrentMode(stack);
        if (mode == SmartWrenchMode.MODE_SELECT) {
            GlobalCoordinate b = getCurrentBlock(stack);
            if (b != null) {
                if (b.getDimension() != world.provider.getDimension()) {
                    Logging.message(player, TextFormatting.RED + "The selected block is in another dimension!");
                    return EnumActionResult.FAIL;
                }
                TileEnreplacedy te = world.getTileEnreplacedy(b.getCoordinate());
                if (te instanceof SmartWrenchSelector) {
                    SmartWrenchSelector smartWrenchSelector = (SmartWrenchSelector) te;
                    smartWrenchSelector.selectBlock(player, pos);
                }
            }
        }
    }
    return EnumActionResult.SUCCESS;
}

0 View Complete Implementation : RedstoneModuleItem.java
Copyright MIT License
Author : McJtyMods
@Override
public EnumActionResult onItemUse(EnreplacedyPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if (world.isRemote) {
        return EnumActionResult.SUCCESS;
    }
    ItemStack stack = player.getHeldItem(hand);
    TileEnreplacedy te = world.getTileEnreplacedy(pos);
    NBTTagCompound tagCompound = stack.getTagCompound();
    if (tagCompound == null) {
        tagCompound = new NBTTagCompound();
        stack.setTagCompound(tagCompound);
    }
    int channel = -1;
    if (te instanceof RedstoneChannelTileEnreplacedy) {
        channel = ((RedstoneChannelTileEnreplacedy) te).getChannel(true);
    } else {
        // We selected a random block.
        tagCompound.setInteger("channel", -1);
        tagCompound.setInteger("monitordim", world.provider.getDimension());
        tagCompound.setInteger("monitorx", pos.getX());
        tagCompound.setInteger("monitory", pos.getY());
        tagCompound.setInteger("monitorz", pos.getZ());
        tagCompound.setInteger("monitorside", facing.ordinal());
        Logging.message(player, "Redstone module is set to " + pos);
        return EnumActionResult.SUCCESS;
    }
    tagCompound.removeTag("monitordim");
    tagCompound.removeTag("monitorx");
    tagCompound.removeTag("monitory");
    tagCompound.removeTag("monitorz");
    tagCompound.removeTag("monitorside");
    if (channel != -1) {
        tagCompound.setInteger("channel", channel);
        Logging.message(player, "Redstone module is set to channel '" + channel + "'");
    } else {
        tagCompound.removeTag("channel");
        Logging.message(player, "Redstone module is cleared");
    }
    return EnumActionResult.SUCCESS;
}

0 View Complete Implementation : ConsoleModuleItem.java
Copyright MIT License
Author : McJtyMods
@Override
public EnumActionResult onItemUse(EnreplacedyPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    ItemStack stack = player.getHeldItem(hand);
    IBlockState state = world.getBlockState(pos);
    Block block = state.getBlock();
    NBTTagCompound tagCompound = stack.getTagCompound();
    if (tagCompound == null) {
        tagCompound = new NBTTagCompound();
    }
    if (block == ModBlocks.processorBlock) {
        tagCompound.setInteger("monitordim", world.provider.getDimension());
        tagCompound.setInteger("monitorx", pos.getX());
        tagCompound.setInteger("monitory", pos.getY());
        tagCompound.setInteger("monitorz", pos.getZ());
        if (world.isRemote) {
            Logging.message(player, "Console module is set to block");
        }
    } else {
        tagCompound.removeTag("monitordim");
        tagCompound.removeTag("monitorx");
        tagCompound.removeTag("monitory");
        tagCompound.removeTag("monitorz");
        if (world.isRemote) {
            Logging.message(player, "Console module is cleared");
        }
    }
    stack.setTagCompound(tagCompound);
    return EnumActionResult.SUCCESS;
}

0 View Complete Implementation : InteractionModuleItem.java
Copyright MIT License
Author : McJtyMods
@Override
public EnumActionResult onItemUse(EnreplacedyPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    ItemStack stack = player.getHeldItem(hand);
    IBlockState state = world.getBlockState(pos);
    Block block = state.getBlock();
    NBTTagCompound tagCompound = stack.getTagCompound();
    if (tagCompound == null) {
        tagCompound = new NBTTagCompound();
    }
    if (block == ModBlocks.processorBlock) {
        tagCompound.setInteger("monitordim", world.provider.getDimension());
        tagCompound.setInteger("monitorx", pos.getX());
        tagCompound.setInteger("monitory", pos.getY());
        tagCompound.setInteger("monitorz", pos.getZ());
        if (world.isRemote) {
            Logging.message(player, "Interaction module is set to block");
        }
    } else {
        tagCompound.removeTag("monitordim");
        tagCompound.removeTag("monitorx");
        tagCompound.removeTag("monitory");
        tagCompound.removeTag("monitorz");
        if (world.isRemote) {
            Logging.message(player, "Interaction module is cleared");
        }
    }
    stack.setTagCompound(tagCompound);
    return EnumActionResult.SUCCESS;
}

0 View Complete Implementation : NetworkIdentifierItem.java
Copyright MIT License
Author : McJtyMods
@Override
public EnumActionResult onItemUse(EnreplacedyPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    ItemStack stack = player.getHeldItem(hand);
    IBlockState state = world.getBlockState(pos);
    Block block = state.getBlock();
    NBTTagCompound tagCompound = stack.getTagCompound();
    if (tagCompound == null) {
        tagCompound = new NBTTagCompound();
    }
    if (block == ModBlocks.processorBlock) {
        tagCompound.setInteger("monitordim", world.provider.getDimension());
        tagCompound.setInteger("monitorx", pos.getX());
        tagCompound.setInteger("monitory", pos.getY());
        tagCompound.setInteger("monitorz", pos.getZ());
        if (world.isRemote) {
            Logging.message(player, "Network identifier is set to block");
        }
    } else {
        tagCompound.removeTag("monitordim");
        tagCompound.removeTag("monitorx");
        tagCompound.removeTag("monitory");
        tagCompound.removeTag("monitorz");
        if (world.isRemote) {
            Logging.message(player, "Network identifier is cleared");
        }
    }
    stack.setTagCompound(tagCompound);
    return EnumActionResult.SUCCESS;
}