@Override public @Nonnull String getName() { return NullHelper.notnullJ(name().toLowerCase(Locale.ENGLISH), "String.toLowerCase()"); } }
@Override @Nonnull public IConduitBundle getBundle() { return NullHelper.notnull(bundle, "Logic error in conduit---no bundle set"); }
private ITreeRoot getRoot() { if (root == null && NullHelper.untrust(AlleleManager.alleleRegistry) != null) { root = (ITreeRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootTrees"); } return root; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + conduitType.hashCode(); result = prime * result + NullHelper.first(overrideName, "").hashCode(); return result; }
@Override public boolean apply(@Nullable Item item) { return NullHelper.notnullM(item, "EnumEnchantmentType.canEnchantItem(null)").isDamageable() && !(item instanceof ItemArmor) && !(item instanceof ItemSword) && !(item instanceof ItemBow) && !(item instanceof ItemFishingRod); }
@SubscribeEvent(priority = EventPriority.LOWEST) public static void onPlaySoundEvent(PlaySoundEvent event) { final EntityPlayerSP player = Minecraft.getMinecraft().player; if (NullHelper.untrust(player) != null && PaddingUpgrade.INSTANCE.hasUpgrade(player.getItemStackFromSlot(EntityEquipmentSlot.HEAD))) { event.setResultSound(make(NullHelper.first(event.getResultSound(), event.getSound()))); } }
private static boolean isSoulBound(@Nonnull ItemStack item) { return EnchantmentHelper.getEnchantmentLevel(NullHelper.notnullF(SOULBOUND, "Soulbound went unbound"), item) > 0; }
public Channel(@Nonnull String name, @Nonnull UserIdent user, @Nonnull ChannelType type) { this.name = NullHelper.first(name.trim(), ""); this.user = user; this.type = type; }
@Override public boolean apply(@Nullable Item item) { return NullHelper.notnullM(item, "EnumEnchantmentType.canEnchantItem(null)").isDamageable() && !(item instanceof ItemArmor) && !(item instanceof ItemFishingRod); }
@Override public void fromBytes(ByteBuf buf) { super.fromBytes(buf); cmd = buf.readByte() & 255; value = buf.readInt(); stack = NullHelper.notnullF(ByteBufUtils.readItemStack(buf), "readItemStack returned null"); }
private ModObject(@Nonnull Class<?> clazz, @Nullable String blockMethodName, @Nullable String itemMethodName, @Nullable IModTileEntity modTileEntity) { this.unlocalisedName = ModObjectRegistry.sanitizeName(NullHelper.notnullJ(name(), "Enum.name()")); this.clazz = clazz; this.blockMethodName = blockMethodName == null || blockMethodName.isEmpty() ? null : blockMethodName; this.itemMethodName = itemMethodName == null || itemMethodName.isEmpty() ? null : itemMethodName; if (blockMethodName == null && itemMethodName == null) { throw new RuntimeException("Clazz " + clazz + " unexpectedly is neither a Block nor an Item."); } this.modTileEntity = modTileEntity; }
@Override @Nonnull public IConduitBundle getBundle() { return NullHelper.notnull(bundle, "Logic error in conduit---no bundle set"); }
@Override public @Nonnull CreativeTabs[] getCreativeTabs() { // Hack for JEI if (NullHelper.untrust(getCreativeTab()) != null) { return super.getCreativeTabs(); } else { return new CreativeTabs[] {}; } }
public static final @Nonnull String format(@Nonnull String format, Object... args) { try (Formatter f = new Formatter()) { return NullHelper.first(f.format(format, args).toString(), ""); } }
public @Nonnull Entity getRidingEntityNN() { return NullHelper.notnullM(getRidingEntity(), "getRidingEntity()"); }
private static @Nonnull AspectList getAspects(@Nonnull String ore) { List<ItemStack> ores = OreDictionary.getOres(ore); return ores.isEmpty() ? new AspectList() : getAspects(NullHelper.notnullF(ores.get(0), "oreDict " + ore + " has null stack")); }
private ConduitRefinedStorageObject(@Nonnull Class<?> clazz, @Nullable String blockMethodName, @Nullable String itemMethodName, @Nullable IModTileEntity modTileEntity) { this.unlocalisedName = ModObjectRegistry.sanitizeName(NullHelper.notnullJ(name(), "Enum.name()")); this.clazz = clazz; this.blockMethodName = blockMethodName == null || blockMethodName.isEmpty() ? null : blockMethodName; this.itemMethodName = itemMethodName == null || itemMethodName.isEmpty() ? null : itemMethodName; this.modTileEntity = modTileEntity; }
@SafeVarargs private ItemHidingHelper(Predicate<IModRegistry> predicate, @Nonnull Supplier<ItemStack>... suppliers) { this.suppliers.addAll(suppliers); this.predicate = NullHelper.notnull(predicate, "predicate fail"); }
@Override public @Nonnull CreativeTabs[] getCreativeTabs() { // Hack for JEI if (NullHelper.untrust(getCreativeTab()) != null) { return super.getCreativeTabs(); } else { return new CreativeTabs[] {}; } }
@Override @Nullable public TileEntity getParent(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull IBlockState state) { return getTileEntity(world, NullHelper.first(state.getValue(BLOCK_TYPE).getLocationOfMaster(pos), pos)); }