@Override public @Nonnull String getName() { return NullHelper.notnullJ(name().toLowerCase(Locale.ENGLISH), "String.toLowerCase()"); } }
/** * @return AIR if no paint source is found. */ default @Nonnull IBlockState getPaintSourceNN() { return NullHelper.notnullJ(Optional.ofNullable(getPaintSource()).orElseGet(Blocks.AIR::getDefaultState), "Optional orElseGet returned null!"); } }
private ConduitAppliedEnergisticsObject(@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; }
private PowerToolObject(@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; }
private ConduitOpenComputersObject(@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; }
private EndergyObject(@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; }
private ForestryIntegrationObject(@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; }
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; }
private ConduitObject(@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; }
private Lang(@Nonnull String key) { if (key.startsWith(".")) { this.key = getLang().addPrefix(NullHelper.notnullJ(key.substring(1), "String.substring()")); } else { this.key = key; } }
public static @Nonnull BlockType getType(int meta) { if (meta < 0 || meta >= values().length) { return BlockType.SINGLE; } return NullHelper.notnullJ(values()[meta], "BlockType value is null!"); } }
public @Nullable String getFluidName() { if (entityNbt != null && entityNbt.hasKey("FluidName")) { return NullHelper.notnullJ(entityNbt, "private final field changed its value").getString("FluidName"); } return null; }
private void doClearAllIoModes() { for (EnumFacing dir : EnumFacing.values()) { setDefaultIoMode(NullHelper.notnullJ(dir, "Enum.values()")); } }
public @Nonnull EnumRenderPart rotate(@Nonnull EnumFacing facing) { if (rotates && facing.getIndex() >= 2) { return NullHelper.notnullJ(values()[parentid + facing.getIndex() - 2], "Enum.values()"); } else { return this; } }
@Override @Nullable public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) { if (capability == CapabilityCapacitorData.getCapNN()) { return CapabilityCapacitorData.getCapNN().cast(NullHelper.notnullJ(getDataFromStack(stack), "Enum.values() has a null")); } return null; } };
@Override @Nullable public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) { if (capability == CapabilityCapacitorData.getCapNN()) { return CapabilityCapacitorData.getCapNN().cast(NullHelper.notnullJ(getDataFromStack(stack), "Enum.values() has a null")); } return null; } };
@Override public IMessage onMessage(PacketTravelEvent message, MessageContext ctx) { Entity toTp = ctx.getServerHandler().player; TravelSource source = NullHelper.notnullJ(TravelSource.values()[message.source], "Enum.values()"); EnumHand hand = NullHelper.notnullJ(EnumHand.values()[message.hand], "Enum.values()"); doServerTeleport(toTp, BlockPos.fromLong(message.pos), message.powerUse, message.conserveMotion, source, hand); return null; }
@Override @Nonnull public Collection<CollidableComponent> createCollidables(@Nonnull CacheKey key) { return NullHelper.notnullJ(Collections.singletonList( new CollidableComponent(getCollidableType(), ConduitGeometryUtil.getInstance().getBoundingBox(getBaseConduitType(), key.dir, key.offset), key.dir, null)), "Collections#singletonList"); }
@Override @Nonnull public Collection<CollidableComponent> createCollidables(@Nonnull CacheKey key) { return NullHelper.notnullJ(Collections.singletonList( new CollidableComponent(getCollidableType(), ConduitGeometryUtil.getInstance().getBoundingBox(getBaseConduitType(), key.dir, key.offset), key.dir, null)), "Collections#singletonList"); }
public static void getNeigbours(TileCapBank cap, Collection<TileCapBank> res) { for (EnumFacing dir : EnumFacing.values()) { TileEntity te = cap.getWorld().getTileEntity(cap.getPos().offset(NullHelper.notnullJ(dir, "Enum.values()"))); if(te instanceof TileCapBank) { TileCapBank neighbour = (TileCapBank) te; if(neighbour.canConnectTo(cap)) { res.add(neighbour); } } } }