Search in sources :

Example 46 with Nonnull

use of javax.annotation.Nonnull in project Overloaded by CJ-MC-Mods.

the class IntEnergyWrapper method serializeNBT.

@Override
@Nonnull
public NBTTagCompound serializeNBT() {
    NBTTagCompound tagCompound = new NBTTagCompound();
    tagCompound.setInteger("IntEnergyStorage", storage == null ? 0 : storage.getEnergyStored());
    return tagCompound;
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Nonnull(javax.annotation.Nonnull)

Example 47 with Nonnull

use of javax.annotation.Nonnull in project AgriCraft by AgriCraft.

the class JsonHelper method wrap.

@Nonnull
public static Optional<IAgriMutation> wrap(@Nullable AgriMutation mutation) {
    // Step I. Abort If Null Mutation.
    if (mutation == null) {
        return Optional.empty();
    }
    // Step II. Determine Chance.
    final double chance = mutation.getChance();
    // Step III. Determine ID.
    final String mutationId = mutation.getChild().getId().replace("_plant", "_mutation");
    // Step IV. Determine Child.
    final Optional<IAgriPlant> child = AgriApi.getPlantRegistry().get(mutation.getChild().getId());
    // Step V. Abort If Child Missing.
    if (!child.isPresent()) {
        return Optional.empty();
    }
    // Step VI. Determine Parents.
    final Optional<IAgriPlant> parentOne = AgriApi.getPlantRegistry().get(mutation.getParent1().getId());
    final Optional<IAgriPlant> parentTwo = AgriApi.getPlantRegistry().get(mutation.getParent2().getId());
    // Step VII. Abort If Missing Parent.
    if ((!parentOne.isPresent()) && (!parentTwo.isPresent())) {
        return Optional.empty();
    }
    // Step VIII. Create New Mutation
    return Optional.of(new Mutation(mutationId, chance, child.get(), parentOne.get(), parentTwo.get()));
}
Also used : IAgriPlant(com.infinityraider.agricraft.api.v1.plant.IAgriPlant) AgriMutation(com.agricraft.agricore.plant.AgriMutation) IAgriMutation(com.infinityraider.agricraft.api.v1.mutation.IAgriMutation) Mutation(com.infinityraider.agricraft.farming.mutation.Mutation) Nonnull(javax.annotation.Nonnull)

Example 48 with Nonnull

use of javax.annotation.Nonnull in project AgriCraft by AgriCraft.

the class CustomWoodType method getIcon.

@SideOnly(Side.CLIENT)
@Nonnull
public TextureAtlasSprite getIcon() {
    if (texture == null) {
        try {
            IBlockState state = block.getStateFromMeta(meta);
            texture = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(state);
        } catch (Exception e) {
            AgriCore.getLogger("agricraft").debug("Unable to load texture for custom wood block {0}!", block.getLocalizedName());
            AgriCore.getLogger("agricraft").trace(e);
            texture = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
        }
    }
    return texture;
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) Nonnull(javax.annotation.Nonnull) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 49 with Nonnull

use of javax.annotation.Nonnull in project Overloaded by CJ-MC-Mods.

the class LongEnergyWrapper method getStorage.

@Nonnull
private LongEnergyStorage getStorage() {
    NBTTagCompound compound = stack.getTagCompound().getCompoundTag("EnergyStorage");
    LongEnergyStorage storage = new LongEnergyStorage();
    storage.readFromNBT(compound);
    return storage;
}
Also used : LongEnergyStorage(com.cjm721.overloaded.storage.energy.LongEnergyStorage) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Nonnull(javax.annotation.Nonnull)

Example 50 with Nonnull

use of javax.annotation.Nonnull in project AgriCraft by AgriCraft.

the class FuzzyStack method toStack.

@Nonnull
public ItemStack toStack() {
    final ItemStack copy = this.stack.copy();
    copy.setTagCompound(tags.getKeySet().isEmpty() ? null : tags.copy());
    return copy;
}
Also used : ItemStack(net.minecraft.item.ItemStack) Nonnull(javax.annotation.Nonnull)

Aggregations

Nonnull (javax.annotation.Nonnull)2624 Nullable (javax.annotation.Nullable)338 ArrayList (java.util.ArrayList)336 ItemStack (net.minecraft.item.ItemStack)327 List (java.util.List)305 Map (java.util.Map)229 Layer (com.simiacryptus.mindseye.lang.Layer)188 Tensor (com.simiacryptus.mindseye.lang.Tensor)185 Arrays (java.util.Arrays)182 Collectors (java.util.stream.Collectors)169 IOException (java.io.IOException)165 JsonObject (com.google.gson.JsonObject)156 HashMap (java.util.HashMap)145 IntStream (java.util.stream.IntStream)145 Test (org.junit.Test)143 LoggerFactory (org.slf4j.LoggerFactory)138 Logger (org.slf4j.Logger)137 Result (com.simiacryptus.mindseye.lang.Result)130 TensorList (com.simiacryptus.mindseye.lang.TensorList)123 DeltaSet (com.simiacryptus.mindseye.lang.DeltaSet)111