Search in sources :

Example 6 with INameable

use of net.geforcemods.securitycraft.api.INameable in project SecurityCraft by Geforce132.

the class WailaDataProvider method getWailaBody.

@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> tipList, IWailaDataAccessor iDataAccessor, IWailaConfigHandler iConfigHandler) {
    if (iDataAccessor.getBlock() instanceof ICustomWailaDisplay && !((ICustomWailaDisplay) iDataAccessor.getBlock()).shouldShowSCInfo(iDataAccessor.getWorld(), iDataAccessor.getBlockState(), iDataAccessor.getPosition()))
        return tipList;
    if (iConfigHandler.getConfig("securitycraft.showowner") && iDataAccessor.getTileEntity() instanceof IOwnable)
        tipList.add(StatCollector.translateToLocal("waila.owner") + " " + ((IOwnable) iDataAccessor.getTileEntity()).getOwner().getName());
    if (iConfigHandler.getConfig("securitycraft.showmodules") && iDataAccessor.getTileEntity() instanceof CustomizableSCTE && ((CustomizableSCTE) iDataAccessor.getTileEntity()).getOwner().isOwner(iDataAccessor.getPlayer())) {
        if (!((CustomizableSCTE) iDataAccessor.getTileEntity()).getModules().isEmpty())
            tipList.add(StatCollector.translateToLocal("waila.equipped"));
        for (EnumCustomModules module : ((CustomizableSCTE) iDataAccessor.getTileEntity()).getModules()) tipList.add("- " + module.getName());
    }
    if (iConfigHandler.getConfig("securitycraft.showpasswords") && iDataAccessor.getTileEntity() instanceof IPasswordProtected && ((IOwnable) iDataAccessor.getTileEntity()).getOwner().isOwner(iDataAccessor.getPlayer())) {
        String password = ((IPasswordProtected) iDataAccessor.getTileEntity()).getPassword();
        tipList.add(StatCollector.translateToLocal("waila.password") + " " + (password != null && !password.isEmpty() ? password : StatCollector.translateToLocal("waila.password.notSet")));
    }
    if (iConfigHandler.getConfig("securitycraft.showcustomname") && iDataAccessor.getTileEntity() instanceof INameable && ((INameable) iDataAccessor.getTileEntity()).canBeNamed()) {
        String name = ((INameable) iDataAccessor.getTileEntity()).getCustomName();
        tipList.add(StatCollector.translateToLocal("waila.customName") + " " + (((INameable) iDataAccessor.getTileEntity()).hasCustomName() ? name : StatCollector.translateToLocal("waila.customName.notSet")));
    }
    return tipList;
}
Also used : CustomizableSCTE(net.geforcemods.securitycraft.api.CustomizableSCTE) IPasswordProtected(net.geforcemods.securitycraft.api.IPasswordProtected) INameable(net.geforcemods.securitycraft.api.INameable) IOwnable(net.geforcemods.securitycraft.api.IOwnable) EnumCustomModules(net.geforcemods.securitycraft.misc.EnumCustomModules)

Aggregations

CustomizableSCTE (net.geforcemods.securitycraft.api.CustomizableSCTE)6 INameable (net.geforcemods.securitycraft.api.INameable)6 IOwnable (net.geforcemods.securitycraft.api.IOwnable)4 BlockLaserBlock (net.geforcemods.securitycraft.blocks.BlockLaserBlock)3 Block (net.minecraft.block.Block)3 TileEntity (net.minecraft.tileentity.TileEntity)3 World (net.minecraft.world.World)3 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)3 TileEntityPortableRadar (net.geforcemods.securitycraft.tileentity.TileEntityPortableRadar)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)2 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)2 IPasswordProtected (net.geforcemods.securitycraft.api.IPasswordProtected)1 EnumCustomModules (net.geforcemods.securitycraft.misc.EnumCustomModules)1 TextComponentString (net.minecraft.util.text.TextComponentString)1 RightClickBlock (net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock)1