use of net.geforcemods.securitycraft.misc.EnumCustomModules in project SecurityCraft by Geforce132.
the class TileEntityLaserBlock method onLinkedBlockAction.
@Override
protected void onLinkedBlockAction(EnumLinkedAction action, Object[] parameters, ArrayList<CustomizableSCTE> excludedTEs) {
if (action == EnumLinkedAction.OPTION_CHANGED) {
Option<?> option = (Option<?>) parameters[0];
enabledOption.copy(option);
toggleLaser((OptionBoolean) option);
excludedTEs.add(this);
createLinkedBlockAction(EnumLinkedAction.OPTION_CHANGED, new Option[] { option }, excludedTEs);
} else if (action == EnumLinkedAction.MODULE_INSERTED) {
ItemStack module = (ItemStack) parameters[0];
insertModule(module);
excludedTEs.add(this);
createLinkedBlockAction(EnumLinkedAction.MODULE_INSERTED, parameters, excludedTEs);
} else if (action == EnumLinkedAction.MODULE_REMOVED) {
EnumCustomModules module = (EnumCustomModules) parameters[1];
removeModule(module);
excludedTEs.add(this);
createLinkedBlockAction(EnumLinkedAction.MODULE_REMOVED, parameters, excludedTEs);
}
}
use of net.geforcemods.securitycraft.misc.EnumCustomModules in project SecurityCraft by Geforce132.
the class ItemAdminTool method onItemUse.
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!worldIn.isRemote) {
if (worldIn.getTileEntity(pos) != null) {
TileEntity te = worldIn.getTileEntity(pos);
boolean hasInfo = false;
if (te instanceof IOwnable) {
PlayerUtils.sendMessageToPlayer(playerIn, I18n.translateToLocal("item.adminTool.name"), I18n.translateToLocal("messages.adminTool.owner.name").replace("#", (((IOwnable) te).getOwner().getName() == null ? "????" : ((IOwnable) te).getOwner().getName())), TextFormatting.DARK_PURPLE);
PlayerUtils.sendMessageToPlayer(playerIn, I18n.translateToLocal("item.adminTool.name"), I18n.translateToLocal("messages.adminTool.owner.uuid").replace("#", (((IOwnable) te).getOwner().getUUID() == null ? "????" : ((IOwnable) te).getOwner().getUUID())), TextFormatting.DARK_PURPLE);
hasInfo = true;
}
if (te instanceof IPasswordProtected) {
PlayerUtils.sendMessageToPlayer(playerIn, I18n.translateToLocal("item.adminTool.name"), I18n.translateToLocal("messages.adminTool.password").replace("#", (((IPasswordProtected) te).getPassword() == null ? "????" : ((IPasswordProtected) te).getPassword())), TextFormatting.DARK_PURPLE);
hasInfo = true;
}
if (te instanceof CustomizableSCTE) {
List<EnumCustomModules> modules = ((CustomizableSCTE) te).getModules();
if (!modules.isEmpty()) {
PlayerUtils.sendMessageToPlayer(playerIn, I18n.translateToLocal("item.adminTool.name"), I18n.translateToLocal("messages.adminTool.equippedModules"), TextFormatting.DARK_PURPLE);
for (EnumCustomModules module : modules) {
PlayerUtils.sendMessageToPlayer(playerIn, I18n.translateToLocal("item.adminTool.name"), "-" + module.getName(), TextFormatting.DARK_PURPLE);
}
hasInfo = true;
}
}
if (!hasInfo) {
PlayerUtils.sendMessageToPlayer(playerIn, I18n.translateToLocal("item.adminTool.name"), I18n.translateToLocal("messages.adminTool.noInfo"), TextFormatting.DARK_PURPLE);
}
return EnumActionResult.FAIL;
}
PlayerUtils.sendMessageToPlayer(playerIn, I18n.translateToLocal("item.adminTool.name"), I18n.translateToLocal("messages.adminTool.noInfo"), TextFormatting.DARK_PURPLE);
}
return EnumActionResult.FAIL;
}
use of net.geforcemods.securitycraft.misc.EnumCustomModules in project SecurityCraft by Geforce132.
the class ItemAdminTool method onItemUse.
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
if (!par3World.isRemote) {
if (par3World.getTileEntity(par4, par5, par6) != null) {
TileEntity te = par3World.getTileEntity(par4, par5, par6);
boolean hasInfo = false;
if (te instanceof IOwnable) {
PlayerUtils.sendMessageToPlayer(par2EntityPlayer, StatCollector.translateToLocal("item.adminTool.name"), StatCollector.translateToLocal("messages.adminTool.owner.name").replace("#", (((IOwnable) te).getOwner().getName() == null ? "????" : ((IOwnable) te).getOwner().getName())), EnumChatFormatting.DARK_PURPLE);
PlayerUtils.sendMessageToPlayer(par2EntityPlayer, StatCollector.translateToLocal("item.adminTool.name"), StatCollector.translateToLocal("messages.adminTool.owner.uuid").replace("#", (((IOwnable) te).getOwner().getUUID() == null ? "????" : ((IOwnable) te).getOwner().getUUID())), EnumChatFormatting.DARK_PURPLE);
hasInfo = true;
}
if (te instanceof IPasswordProtected) {
PlayerUtils.sendMessageToPlayer(par2EntityPlayer, StatCollector.translateToLocal("item.adminTool.name"), StatCollector.translateToLocal("messages.adminTool.password").replace("#", (((IPasswordProtected) te).getPassword() == null ? "????" : ((IPasswordProtected) te).getPassword())), EnumChatFormatting.DARK_PURPLE);
hasInfo = true;
}
if (te instanceof CustomizableSCTE) {
List<EnumCustomModules> modules = ((CustomizableSCTE) te).getModules();
if (!modules.isEmpty()) {
PlayerUtils.sendMessageToPlayer(par2EntityPlayer, StatCollector.translateToLocal("item.adminTool.name"), StatCollector.translateToLocal("messages.adminTool.equippedModules"), EnumChatFormatting.DARK_PURPLE);
for (EnumCustomModules module : modules) {
PlayerUtils.sendMessageToPlayer(par2EntityPlayer, StatCollector.translateToLocal("item.adminTool.name"), "-" + module.getName(), EnumChatFormatting.DARK_PURPLE);
}
hasInfo = true;
}
}
if (!hasInfo) {
PlayerUtils.sendMessageToPlayer(par2EntityPlayer, StatCollector.translateToLocal("item.adminTool.name"), StatCollector.translateToLocal("messages.adminTool.noInfo"), EnumChatFormatting.DARK_PURPLE);
}
return false;
}
PlayerUtils.sendMessageToPlayer(par2EntityPlayer, StatCollector.translateToLocal("item.adminTool.name"), StatCollector.translateToLocal("messages.adminTool.noInfo"), EnumChatFormatting.DARK_PURPLE);
}
return false;
}
use of net.geforcemods.securitycraft.misc.EnumCustomModules in project SecurityCraft by Geforce132.
the class ItemAdminTool method onItemUse.
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, BlockPos pos, EnumFacing par5EnumFacing, float hitX, float hitY, float hitZ) {
if (!par3World.isRemote) {
if (par3World.getTileEntity(pos) != null) {
TileEntity te = par3World.getTileEntity(pos);
boolean hasInfo = false;
if (te instanceof IOwnable) {
PlayerUtils.sendMessageToPlayer(par2EntityPlayer, StatCollector.translateToLocal("item.adminTool.name"), StatCollector.translateToLocal("messages.adminTool.owner.name").replace("#", (((IOwnable) te).getOwner().getName() == null ? "????" : ((IOwnable) te).getOwner().getName())), EnumChatFormatting.DARK_PURPLE);
PlayerUtils.sendMessageToPlayer(par2EntityPlayer, StatCollector.translateToLocal("item.adminTool.name"), StatCollector.translateToLocal("messages.adminTool.owner.uuid").replace("#", (((IOwnable) te).getOwner().getUUID() == null ? "????" : ((IOwnable) te).getOwner().getUUID())), EnumChatFormatting.DARK_PURPLE);
hasInfo = true;
}
if (te instanceof IPasswordProtected) {
PlayerUtils.sendMessageToPlayer(par2EntityPlayer, StatCollector.translateToLocal("item.adminTool.name"), StatCollector.translateToLocal("messages.adminTool.password").replace("#", (((IPasswordProtected) te).getPassword() == null ? "????" : ((IPasswordProtected) te).getPassword())), EnumChatFormatting.DARK_PURPLE);
hasInfo = true;
}
if (te instanceof CustomizableSCTE) {
List<EnumCustomModules> modules = ((CustomizableSCTE) te).getModules();
if (!modules.isEmpty()) {
PlayerUtils.sendMessageToPlayer(par2EntityPlayer, StatCollector.translateToLocal("item.adminTool.name"), StatCollector.translateToLocal("messages.adminTool.equippedModules"), EnumChatFormatting.DARK_PURPLE);
for (EnumCustomModules module : modules) {
PlayerUtils.sendMessageToPlayer(par2EntityPlayer, StatCollector.translateToLocal("item.adminTool.name"), "-" + module.getName(), EnumChatFormatting.DARK_PURPLE);
}
hasInfo = true;
}
}
if (!hasInfo) {
PlayerUtils.sendMessageToPlayer(par2EntityPlayer, StatCollector.translateToLocal("item.adminTool.name"), StatCollector.translateToLocal("messages.adminTool.noInfo"), EnumChatFormatting.DARK_PURPLE);
}
return false;
}
PlayerUtils.sendMessageToPlayer(par2EntityPlayer, StatCollector.translateToLocal("item.adminTool.name"), StatCollector.translateToLocal("messages.adminTool.noInfo"), EnumChatFormatting.DARK_PURPLE);
}
return false;
}
use of net.geforcemods.securitycraft.misc.EnumCustomModules 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(I18n.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(I18n.translateToLocal("waila.equipped"));
}
for (EnumCustomModules module : ((CustomizableSCTE) iDataAccessor.getTileEntity()).getModules()) {
tipList.add("- " + module.getName());
}
}
if (iConfigHandler.getConfig("securitycraft.showpasswords") && iDataAccessor.getTileEntity() instanceof IPasswordProtected && !(iDataAccessor.getTileEntity() instanceof TileEntityKeycardReader) && ((IOwnable) iDataAccessor.getTileEntity()).getOwner().isOwner(iDataAccessor.getPlayer())) {
String password = ((IPasswordProtected) iDataAccessor.getTileEntity()).getPassword();
tipList.add(I18n.translateToLocal("waila.password") + " " + (password != null && !password.isEmpty() ? password : I18n.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(I18n.translateToLocal("waila.customName") + " " + (((INameable) iDataAccessor.getTileEntity()).hasCustomName() ? name : I18n.translateToLocal("waila.customName.notSet")));
}
return tipList;
}
Aggregations