use of com.infinityraider.agricraft.api.v1.misc.IAgriDisplayable in project AgriCraft by AgriCraft.
the class ItemMagnifyingGlass method onItemUseFirst.
//this is called when you right click with this item in hand
@Override
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
if (world.isRemote) {
List<String> list = new ArrayList<>();
IBlockState state = world.getBlockState(pos);
Block block = state.getBlock();
TileEntity te = world.getTileEntity(pos);
// Add a separator.
list.add("========== " + AgriCore.getTranslator().translate("item.agricraft:magnifying_glass.name") + " ==========");
// Add lighting information.
list.add("Brightness: (" + world.getLightFromNeighbors(pos.up()) + "/15)");
// Add block information.
if (block instanceof IAgriDisplayable) {
((IAgriDisplayable) block).addDisplayInfo(list::add);
}
// Add tile information.
if (te instanceof IAgriDisplayable) {
((IAgriDisplayable) te).addDisplayInfo(list::add);
}
// Display information.
for (String msg : list) {
player.addChatComponentMessage(new TextComponentString(msg));
}
}
return EnumActionResult.SUCCESS;
}
use of com.infinityraider.agricraft.api.v1.misc.IAgriDisplayable in project AgriCraft by AgriCraft.
the class ItemMagnifyingGlass method onItemUse.
// this is called when you right click with this item in hand
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
List<String> list = new ArrayList<>();
IBlockState state = world.getBlockState(pos);
Block block = state.getBlock();
TileEntity te = world.getTileEntity(pos);
// Add a separator.
list.add("========== " + AgriCore.getTranslator().translate("item.agricraft:magnifying_glass.name") + " ==========");
// Add lighting information.
list.add("Brightness: (" + world.getLightFromNeighbors(pos.up()) + "/15)");
// Add block information.
if (block instanceof IAgriDisplayable) {
((IAgriDisplayable) block).addDisplayInfo(list::add);
}
// Add tile information.
if (te instanceof IAgriDisplayable) {
((IAgriDisplayable) te).addDisplayInfo(list::add);
}
// Display information.
for (String msg : list) {
player.sendMessage(new TextComponentString(msg));
}
}
return EnumActionResult.SUCCESS;
}
use of com.infinityraider.agricraft.api.v1.misc.IAgriDisplayable in project AgriCraft by AgriCraft.
the class AgriWailaAdapter method getWailaBody.
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> list, IWailaDataAccessor dataAccessor, IWailaConfigHandler configHandler) {
Block b = dataAccessor.getBlock();
if (b instanceof IAgriDisplayable) {
((IAgriDisplayable) b).addDisplayInfo(list::add);
}
TileEntity te = dataAccessor.getTileEntity();
if (te instanceof IAgriDisplayable) {
((IAgriDisplayable) te).addDisplayInfo(list::add);
}
return list;
}
Aggregations