Skip to content

Commit

Permalink
removed javax nullable and nonnull for jetbrains versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Sep 22, 2023
1 parent 576a8c0 commit b7ea31c
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 82 deletions.
Original file line number Diff line number Diff line change
@@ -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();
}
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down Expand Up @@ -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)];
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down Expand Up @@ -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)];
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -180,7 +179,7 @@ public WrappedIItemSource(AutoPlaceEnvironment container, IItemSource delegate)
}

@Override
@Nonnull
@NotNull
public Map<ItemStack, Integer> take(Predicate<ItemStack> predicate, boolean simulate, int count) {
return delegate.take(predicate, simulate, count);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
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;
import com.gtnewhorizon.structurelib.util.ItemStackPredicate.NBTMode;
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.
Expand All @@ -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<ItemStack, Integer> take(Predicate<ItemStack> predicate, boolean simulate, int count);

/**
Expand Down Expand Up @@ -114,7 +113,7 @@ default boolean takeAll(ItemStack stack, boolean simulate) {
static IItemSource fromPlayer(ServerPlayer player) {
return new IItemSource() {

@Nonnull
@NotNull
@Override
public Map<ItemStack, Integer> take(Predicate<ItemStack> p, boolean s, int c) {
return InventoryUtility.takeFromInventory(player, p, s, c);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
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;
import net.minecraft.world.item.Item;
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
Expand Down Expand Up @@ -313,7 +311,7 @@ public static BlocksToPlace create(Predicate<ItemStack> predicate) {
*
* @return a predicate. never null.
*/
@Nonnull
@NotNull
public Predicate<ItemStack> getPredicate() {
return predicate;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> implements IStructureElementDeferred<T> {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,23 @@
*/
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;
import net.minecraft.world.Container;
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.
Expand Down Expand Up @@ -222,9 +223,9 @@ public static Map<ItemStack, Integer> takeFromInventory(Iterable<ItemStack> inv,
return store.getStore();
}

private static int takeFromInventory(@Nonnull Iterable<ItemStack> inv, @Nonnull Predicate<ItemStack> predicate,
boolean simulate, int count, @Nonnull ItemStackCounter store, @Nullable ItemStack filter,
@Nullable ServerPlayer player, boolean recursive) {
private static int takeFromInventory(@NotNull Iterable<ItemStack> inv, @NotNull Predicate<ItemStack> 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) {
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -419,7 +418,7 @@ public boolean remove(Object o) {
return ItemStackMap.this.remove(entry.getKey(), entry.getValue());
}

@Nonnull
@NotNull
@Override
public Iterator<Map.Entry<ItemStack, T>> iterator() {
return Iterators.concat(Iterators.transform(itemMap.entrySet().iterator(), DetailIter::new));
Expand Down

0 comments on commit b7ea31c

Please sign in to comment.