use of mcjty.lib.varia.GlobalCoordinate in project RFTools by McJty.
the class PeacefulEModule method tick.
@Override
public void tick(World world, BlockPos pos, int radius, int miny, int maxy, EnvironmentalControllerTileEntity controllerTileEntity) {
if (!isActive()) {
return;
}
super.tick(world, pos, radius, miny, maxy, controllerTileEntity);
PeacefulAreaManager.markArea(new GlobalCoordinate(pos, world.provider.getDimension()), radius, miny, maxy);
}
use of mcjty.lib.varia.GlobalCoordinate in project RFTools by McJty.
the class ShieldBlock method wrenchSneakSelect.
@Override
protected boolean wrenchSneakSelect(World world, BlockPos pos, EntityPlayer 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;
}
use of mcjty.lib.varia.GlobalCoordinate in project RFTools by McJty.
the class PowerCellTileEntity method dumpNetwork.
public static void dumpNetwork(EntityPlayer player, PowerCellTileEntity powerCellTileEntity) {
PowerCellNetwork.Network network = powerCellTileEntity.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!";
}
TileEntity te = w.getTileEntity(b.getCoordinate());
if (te instanceof PowerCellTileEntity) {
PowerCellTileEntity power = (PowerCellTileEntity) te;
msg += " (+:" + power.getTotalInserted() + ", -:" + power.getTotalExtracted() + ")";
}
}
Logging.message(player, "Block: " + BlockPosTools.toString(b.getCoordinate()) + " (" + b.getDimension() + "): " + msg);
});
}
use of mcjty.lib.varia.GlobalCoordinate in project RFTools by McJty.
the class SmartWrenchItem method onItemUse.
@Override
public EnumActionResult onItemUse(EntityPlayer 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;
}
TileEntity te = world.getTileEntity(b.getCoordinate());
if (te instanceof SmartWrenchSelector) {
SmartWrenchSelector smartWrenchSelector = (SmartWrenchSelector) te;
smartWrenchSelector.selectBlock(player, pos);
}
}
}
}
return EnumActionResult.SUCCESS;
}
use of mcjty.lib.varia.GlobalCoordinate in project RFTools by McJty.
the class SmartWrenchItem method addInformation.
// @Override
// public boolean doesSneakBypassUse(ItemStack stack, IBlockAccess world, BlockPos pos, EntityPlayer player) {
// return true;
// }
//
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, World player, List<String> list, ITooltipFlag whatIsThis) {
super.addInformation(itemStack, player, list, whatIsThis);
GlobalCoordinate b = getCurrentBlock(itemStack);
if (b != null) {
list.add(TextFormatting.GREEN + "Block: " + BlockPosTools.toString(b.getCoordinate()) + " at dimension " + b.getDimension());
}
SmartWrenchMode mode = getCurrentMode(itemStack);
list.add(TextFormatting.WHITE + "Right-click on air to change mode.");
list.add(TextFormatting.GREEN + "Mode: " + mode.getName());
if (mode == SmartWrenchMode.MODE_WRENCH) {
list.add(TextFormatting.WHITE + "Use as a normal wrench:");
list.add(TextFormatting.WHITE + " Sneak-right-click to pick up machines.");
list.add(TextFormatting.WHITE + " Right-click to rotate machines.");
} else if (mode == SmartWrenchMode.MODE_SELECT) {
list.add(TextFormatting.WHITE + "Use as a block selector:");
list.add(TextFormatting.WHITE + " Sneak-right-click select master block.");
list.add(TextFormatting.WHITE + " Right-click to associate blocks with master.");
}
}
Aggregations