diff --git a/common/src/main/java/com/gtnewhorizon/structurelib/alignment/IAlignmentProvider.java b/common/src/main/java/com/gtnewhorizon/structurelib/alignment/IAlignmentProvider.java index f7439c35..afbba021 100644 --- a/common/src/main/java/com/gtnewhorizon/structurelib/alignment/IAlignmentProvider.java +++ b/common/src/main/java/com/gtnewhorizon/structurelib/alignment/IAlignmentProvider.java @@ -1,9 +1,10 @@ package com.gtnewhorizon.structurelib.alignment; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; + public interface IAlignmentProvider { - @Nullable + @NotNull IAlignment getAlignment(); } diff --git a/common/src/main/java/com/gtnewhorizon/structurelib/alignment/constructable/IConstructableProvider.java b/common/src/main/java/com/gtnewhorizon/structurelib/alignment/constructable/IConstructableProvider.java index 0f263608..5df343ce 100644 --- a/common/src/main/java/com/gtnewhorizon/structurelib/alignment/constructable/IConstructableProvider.java +++ b/common/src/main/java/com/gtnewhorizon/structurelib/alignment/constructable/IConstructableProvider.java @@ -1,6 +1,6 @@ package com.gtnewhorizon.structurelib.alignment.constructable; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; /** * Implement this interface if this tile entity MIGHT be constructable diff --git a/common/src/main/java/com/gtnewhorizon/structurelib/alignment/enumerable/Flip.java b/common/src/main/java/com/gtnewhorizon/structurelib/alignment/enumerable/Flip.java index f43a7ba6..d96c5132 100644 --- a/common/src/main/java/com/gtnewhorizon/structurelib/alignment/enumerable/Flip.java +++ b/common/src/main/java/com/gtnewhorizon/structurelib/alignment/enumerable/Flip.java @@ -1,14 +1,15 @@ package com.gtnewhorizon.structurelib.alignment.enumerable; -import static java.lang.Math.abs; -import static java.util.Arrays.stream; -import static java.util.stream.Collectors.toMap; +import org.jetbrains.annotations.NotNull; import java.util.Locale; import java.util.Map; import java.util.Random; -import javax.annotation.Nonnull; +import static java.lang.Math.abs; +import static java.util.Arrays.stream; +import static java.util.stream.Collectors.toMap; + public enum Flip { @@ -48,7 +49,7 @@ public static Flip byIndex(int index) { return VALUES[abs(index % VALUES.length)]; } - public static Flip random(@Nonnull Random rand) { + public static Flip random(@NotNull Random rand) { return VALUES[rand.nextInt(VALUES.length)]; } diff --git a/common/src/main/java/com/gtnewhorizon/structurelib/alignment/enumerable/Rotation.java b/common/src/main/java/com/gtnewhorizon/structurelib/alignment/enumerable/Rotation.java index de9201bc..71410300 100644 --- a/common/src/main/java/com/gtnewhorizon/structurelib/alignment/enumerable/Rotation.java +++ b/common/src/main/java/com/gtnewhorizon/structurelib/alignment/enumerable/Rotation.java @@ -1,14 +1,14 @@ package com.gtnewhorizon.structurelib.alignment.enumerable; -import static java.lang.Math.abs; -import static java.util.Arrays.stream; -import static java.util.stream.Collectors.toMap; +import org.jetbrains.annotations.NotNull; import java.util.Locale; import java.util.Map; import java.util.Random; -import javax.annotation.Nonnull; +import static java.lang.Math.abs; +import static java.util.Arrays.stream; +import static java.util.stream.Collectors.toMap; public enum Rotation { @@ -49,7 +49,7 @@ public static Rotation byIndex(int index) { return VALUES[abs(index % VALUES.length)]; } - public static Rotation random(@Nonnull Random rand) { + public static Rotation random(@NotNull Random rand) { return VALUES[rand.nextInt(VALUES.length)]; } diff --git a/common/src/main/java/com/gtnewhorizon/structurelib/structure/AutoPlaceEnvironment.java b/common/src/main/java/com/gtnewhorizon/structurelib/structure/AutoPlaceEnvironment.java index 0aebf738..c7068ead 100644 --- a/common/src/main/java/com/gtnewhorizon/structurelib/structure/AutoPlaceEnvironment.java +++ b/common/src/main/java/com/gtnewhorizon/structurelib/structure/AutoPlaceEnvironment.java @@ -1,16 +1,15 @@ package com.gtnewhorizon.structurelib.structure; -import java.util.Map; -import java.util.function.Consumer; -import java.util.function.Predicate; - -import javax.annotation.Nonnull; - import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.NotNull; + +import java.util.Map; +import java.util.function.Consumer; +import java.util.function.Predicate; /** * Represent the environment in which autoplace of a single element took place. @@ -180,7 +179,7 @@ public WrappedIItemSource(AutoPlaceEnvironment container, IItemSource delegate) } @Override - @Nonnull + @NotNull public Map take(Predicate predicate, boolean simulate, int count) { return delegate.take(predicate, simulate, count); } diff --git a/common/src/main/java/com/gtnewhorizon/structurelib/structure/IItemSource.java b/common/src/main/java/com/gtnewhorizon/structurelib/structure/IItemSource.java index 3d19989b..f28fdf82 100644 --- a/common/src/main/java/com/gtnewhorizon/structurelib/structure/IItemSource.java +++ b/common/src/main/java/com/gtnewhorizon/structurelib/structure/IItemSource.java @@ -1,10 +1,5 @@ package com.gtnewhorizon.structurelib.structure; -import java.util.Map; -import java.util.function.Predicate; - -import javax.annotation.Nonnull; - import com.gtnewhorizon.structurelib.util.InventoryIterable; import com.gtnewhorizon.structurelib.util.InventoryUtility; import com.gtnewhorizon.structurelib.util.ItemStackPredicate; @@ -12,6 +7,10 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.Container; import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.NotNull; + +import java.util.Map; +import java.util.function.Predicate; /** * Represent an item source. Take only, cannot be placed back. @@ -29,7 +28,7 @@ public interface IItemSource { * @param count how many items to extract. * @return A nonnull map reflecting the result of extraction. Note this map is NBT and metadata aware. */ - @Nonnull + @NotNull Map take(Predicate predicate, boolean simulate, int count); /** @@ -114,7 +113,7 @@ default boolean takeAll(ItemStack stack, boolean simulate) { static IItemSource fromPlayer(ServerPlayer player) { return new IItemSource() { - @Nonnull + @NotNull @Override public Map take(Predicate p, boolean s, int c) { return InventoryUtility.takeFromInventory(player, p, s, c); diff --git a/common/src/main/java/com/gtnewhorizon/structurelib/structure/IStructureElement.java b/common/src/main/java/com/gtnewhorizon/structurelib/structure/IStructureElement.java index 6dbccaf1..f52bb0e5 100644 --- a/common/src/main/java/com/gtnewhorizon/structurelib/structure/IStructureElement.java +++ b/common/src/main/java/com/gtnewhorizon/structurelib/structure/IStructureElement.java @@ -1,21 +1,9 @@ package com.gtnewhorizon.structurelib.structure; -import static com.gtnewhorizon.structurelib.StructureLib.LOGGER; -import static com.gtnewhorizon.structurelib.StructureLib.PANIC_MODE; - -import java.util.Arrays; -import java.util.Collections; -import java.util.function.Consumer; -import java.util.function.Predicate; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraft.nbt.CompoundTag; - import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.util.ItemStackPredicate; import com.gtnewhorizon.structurelib.util.ItemStackPredicate.NBTMode; +import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; @@ -23,6 +11,16 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Arrays; +import java.util.Collections; +import java.util.function.Consumer; +import java.util.function.Predicate; + +import static com.gtnewhorizon.structurelib.StructureLib.LOGGER; +import static com.gtnewhorizon.structurelib.StructureLib.PANIC_MODE; /** * Use StructureUtility to instantiate. These are the building blocks for your {@link IStructureDefinition}. It @@ -313,7 +311,7 @@ public static BlocksToPlace create(Predicate predicate) { * * @return a predicate. never null. */ - @Nonnull + @NotNull public Predicate getPredicate() { return predicate; } diff --git a/common/src/main/java/com/gtnewhorizon/structurelib/structure/IStructureElementChain.java b/common/src/main/java/com/gtnewhorizon/structurelib/structure/IStructureElementChain.java index 52e476aa..753ddeb1 100644 --- a/common/src/main/java/com/gtnewhorizon/structurelib/structure/IStructureElementChain.java +++ b/common/src/main/java/com/gtnewhorizon/structurelib/structure/IStructureElementChain.java @@ -1,18 +1,16 @@ package com.gtnewhorizon.structurelib.structure; -import java.util.ArrayList; -import java.util.List; -import java.util.function.Consumer; -import java.util.function.Predicate; - -import javax.annotation.Nullable; - - import com.google.common.collect.Iterables; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; +import java.util.function.Predicate; /** * Use StructureUtility to instantiate diff --git a/common/src/main/java/com/gtnewhorizon/structurelib/structure/LazyStructureElement.java b/common/src/main/java/com/gtnewhorizon/structurelib/structure/LazyStructureElement.java index 034883fb..26d0c138 100644 --- a/common/src/main/java/com/gtnewhorizon/structurelib/structure/LazyStructureElement.java +++ b/common/src/main/java/com/gtnewhorizon/structurelib/structure/LazyStructureElement.java @@ -4,11 +4,11 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import org.jetbrains.annotations.Nullable; import java.util.function.Consumer; import java.util.function.Function; -import javax.annotation.Nullable; class LazyStructureElement implements IStructureElementDeferred { diff --git a/common/src/main/java/com/gtnewhorizon/structurelib/structure/StructureUtility.java b/common/src/main/java/com/gtnewhorizon/structurelib/structure/StructureUtility.java index 1823746b..d4f09f6f 100644 --- a/common/src/main/java/com/gtnewhorizon/structurelib/structure/StructureUtility.java +++ b/common/src/main/java/com/gtnewhorizon/structurelib/structure/StructureUtility.java @@ -1,12 +1,15 @@ package com.gtnewhorizon.structurelib.structure; -import java.util.*; -import java.util.function.*; - -import javax.annotation.Nullable; - - import com.gtnewhorizon.structurelib.Registry; +import com.gtnewhorizon.structurelib.StructureEvent.StructureElementVisitedEvent; +import com.gtnewhorizon.structurelib.StructureLib; +import com.gtnewhorizon.structurelib.StructureLibAPI; +import com.gtnewhorizon.structurelib.alignment.constructable.ChannelDataAccessor; +import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; +import com.gtnewhorizon.structurelib.structure.IStructureElement.PlaceResult; +import com.gtnewhorizon.structurelib.structure.adders.IBlockAdder; +import com.gtnewhorizon.structurelib.structure.adders.ITileAdder; +import com.gtnewhorizon.structurelib.util.ItemStackPredicate.NBTMode; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -30,16 +33,10 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.Nullable; -import com.gtnewhorizon.structurelib.StructureEvent.StructureElementVisitedEvent; -import com.gtnewhorizon.structurelib.StructureLib; -import com.gtnewhorizon.structurelib.StructureLibAPI; -import com.gtnewhorizon.structurelib.alignment.constructable.ChannelDataAccessor; -import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; -import com.gtnewhorizon.structurelib.structure.IStructureElement.PlaceResult; -import com.gtnewhorizon.structurelib.structure.adders.IBlockAdder; -import com.gtnewhorizon.structurelib.structure.adders.ITileAdder; -import com.gtnewhorizon.structurelib.util.ItemStackPredicate.NBTMode; +import java.util.*; +import java.util.function.*; /** * A brief index of everything contained diff --git a/common/src/main/java/com/gtnewhorizon/structurelib/util/InventoryUtility.java b/common/src/main/java/com/gtnewhorizon/structurelib/util/InventoryUtility.java index d1a932b1..7f267a48 100644 --- a/common/src/main/java/com/gtnewhorizon/structurelib/util/InventoryUtility.java +++ b/common/src/main/java/com/gtnewhorizon/structurelib/util/InventoryUtility.java @@ -14,15 +14,6 @@ */ package com.gtnewhorizon.structurelib.util; -import java.util.*; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.function.Function; -import java.util.function.Predicate; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - - import com.gtnewhorizon.structurelib.util.InventoryUtility.ItemStackExtractor.APIType; import com.gtnewhorizon.structurelib.util.ItemStackPredicate.NBTMode; import net.minecraft.server.level.ServerPlayer; @@ -30,6 +21,16 @@ import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.PlayerEnderChestContainer; import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.function.Function; +import java.util.function.Predicate; /** * This class is part of API, but is not stable. Use at your own risk. @@ -222,9 +223,9 @@ public static Map takeFromInventory(Iterable inv, return store.getStore(); } - private static int takeFromInventory(@Nonnull Iterable inv, @Nonnull Predicate predicate, - boolean simulate, int count, @Nonnull ItemStackCounter store, @Nullable ItemStack filter, - @Nullable ServerPlayer player, boolean recursive) { + private static int takeFromInventory(@NotNull Iterable inv, @NotNull Predicate predicate, + boolean simulate, int count, @NotNull ItemStackCounter store, @Nullable ItemStack filter, + @Nullable ServerPlayer player, boolean recursive) { int found = 0; ItemStack copiedFilter = null; if (filter != null) { @@ -332,7 +333,7 @@ default int getItem(ItemStack source, ItemStack toExtract, boolean simulate, Ser return -1; } - static ItemStackExtractor createOnlyOptimized(@Nonnull OptimizedExtractor optimizedExtractor) { + static ItemStackExtractor createOnlyOptimized(@NotNull OptimizedExtractor optimizedExtractor) { return new ItemStackExtractor() { @Override diff --git a/common/src/main/java/com/gtnewhorizon/structurelib/util/ItemStackMap.java b/common/src/main/java/com/gtnewhorizon/structurelib/util/ItemStackMap.java index 0af11499..21e1f60c 100644 --- a/common/src/main/java/com/gtnewhorizon/structurelib/util/ItemStackMap.java +++ b/common/src/main/java/com/gtnewhorizon/structurelib/util/ItemStackMap.java @@ -1,13 +1,12 @@ package com.gtnewhorizon.structurelib.util; -import com.google.common.base.Objects; import com.google.common.collect.Iterators; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.*; import java.util.function.BiFunction; import java.util.function.Function; @@ -419,7 +418,7 @@ public boolean remove(Object o) { return ItemStackMap.this.remove(entry.getKey(), entry.getValue()); } - @Nonnull + @NotNull @Override public Iterator> iterator() { return Iterators.concat(Iterators.transform(itemMap.entrySet().iterator(), DetailIter::new));