Add package info and fix nullability

Everything defaults to nonnull now, and is labeled where null is likely
This commit is contained in:
KnightMiner committed 2020-07-22 20:43:55 -05:00
1 parent c96d1f4f05
commit f1037ce21a
61 files changed
+386 -256

No files matched your search

@@ -8,8 +8,6 @@ import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import javax.annotation.Nonnull;
/** /**
* Creates a block with textures that connect to other blocks * Creates a block with textures that connect to other blocks
* <p> * <p>
@@ -69,8 +67,7 @@ public class ConnectedTextureBlock extends Block {
* @return Whether or not the side is connectable. * @return Whether or not the side is connectable.
*/ */
private boolean isSideConnectable(BlockState state, IWorld world, BlockPos pos, Direction side) { private boolean isSideConnectable(BlockState state, IWorld world, BlockPos pos, Direction side) {
final BlockState connected = world.getBlockState(pos.offset(side)); return this.canConnect(state, world.getBlockState(pos.offset(side)));
return connected != null && this.canConnect(state, connected);
} }
/** /**
@@ -79,7 +76,7 @@ public class ConnectedTextureBlock extends Block {
* @param connected BlockState to check * @param connected BlockState to check
* @return True if the block is valid to connect * @return True if the block is valid to connect
*/ */
protected boolean canConnect(@Nonnull BlockState original, @Nonnull BlockState connected) { protected boolean canConnect(BlockState original, BlockState connected) {
return original.getBlock() == connected.getBlock(); return original.getBlock() == connected.getBlock();
} }
} }
@@ -1,7 +1,6 @@
package slimeknights.mantle.block; package slimeknights.mantle.block;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@@ -18,7 +17,6 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import slimeknights.mantle.tileentity.InventoryTileEntity; import slimeknights.mantle.tileentity.InventoryTileEntity;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public abstract class InventoryBlock extends Block { public abstract class InventoryBlock extends Block {
@@ -33,7 +31,6 @@ public abstract class InventoryBlock extends Block {
return true; return true;
} }
@Nonnull
@Override @Override
public abstract TileEntity createTileEntity(BlockState state, IBlockReader world); public abstract TileEntity createTileEntity(BlockState state, IBlockReader world);
@@ -57,7 +54,7 @@ public abstract class InventoryBlock extends Block {
} }
@Override @Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) { public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) {
super.onBlockPlacedBy(worldIn, pos, state, placer, stack); super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
// set custom name from named stack // set custom name from named stack
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.block;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -5,8 +5,6 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
public class CreativeTab extends ItemGroup { public class CreativeTab extends ItemGroup {
private ItemStack icon; private ItemStack icon;
@@ -24,14 +22,12 @@ public class CreativeTab extends ItemGroup {
} }
} }
@Nonnull
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@Override @Override
public ItemStack getIcon() { public ItemStack getIcon() {
return this.icon; return this.icon;
} }
@Nonnull
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@Override @Override
public ItemStack createIcon() { public ItemStack createIcon() {
@@ -13,13 +13,25 @@ import net.minecraftforge.fml.ModLoadingContext;
import slimeknights.mantle.client.book.action.StringActionProcessor; import slimeknights.mantle.client.book.action.StringActionProcessor;
import slimeknights.mantle.client.book.action.protocol.ProtocolGoToPage; import slimeknights.mantle.client.book.action.protocol.ProtocolGoToPage;
import slimeknights.mantle.client.book.data.BookData; import slimeknights.mantle.client.book.data.BookData;
import slimeknights.mantle.client.book.data.content.*; import slimeknights.mantle.client.book.data.content.ContentBlank;
import slimeknights.mantle.client.book.data.content.ContentBlockInteraction;
import slimeknights.mantle.client.book.data.content.ContentCrafting;
import slimeknights.mantle.client.book.data.content.ContentImage;
import slimeknights.mantle.client.book.data.content.ContentImageText;
import slimeknights.mantle.client.book.data.content.ContentSmelting;
import slimeknights.mantle.client.book.data.content.ContentSmithing;
import slimeknights.mantle.client.book.data.content.ContentStructure;
import slimeknights.mantle.client.book.data.content.ContentText;
import slimeknights.mantle.client.book.data.content.ContentTextImage;
import slimeknights.mantle.client.book.data.content.ContentTextLeftImage;
import slimeknights.mantle.client.book.data.content.ContentTextRightImage;
import slimeknights.mantle.client.book.data.content.PageContent;
import slimeknights.mantle.client.book.data.deserializer.HexStringDeserializer; import slimeknights.mantle.client.book.data.deserializer.HexStringDeserializer;
import slimeknights.mantle.client.book.repository.BookRepository; import slimeknights.mantle.client.book.repository.BookRepository;
import slimeknights.mantle.network.BookNetwork; import slimeknights.mantle.network.BookNetwork;
import slimeknights.mantle.network.book.UpdateSavedPagePacket; import slimeknights.mantle.network.book.UpdateSavedPagePacket;
import javax.annotation.Nonnull; import javax.annotation.Nullable;
import java.util.HashMap; import java.util.HashMap;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@@ -117,7 +129,7 @@ public class BookLoader implements IResourceManagerReloadListener {
return info; return info;
} }
public static void updateSavedPage(PlayerEntity player, ItemStack item, String page) { public static void updateSavedPage(@Nullable PlayerEntity player, ItemStack item, String page) {
if (player == null) { if (player == null) {
return; return;
} }
@@ -133,7 +145,7 @@ public class BookLoader implements IResourceManagerReloadListener {
* Reloads all the books, called when the resource manager reloads, such as when the resource pack or the language is changed * Reloads all the books, called when the resource manager reloads, such as when the resource pack or the language is changed
*/ */
@Override @Override
public void onResourceManagerReload(@Nonnull IResourceManager resourceManager) { public void onResourceManagerReload(IResourceManager resourceManager) {
books.forEach((s, bookData) -> bookData.reset()); books.forEach((s, bookData) -> bookData.reset());
} }
} }
@@ -8,6 +8,7 @@ import slimeknights.mantle.client.book.data.content.ContentTableOfContents;
import slimeknights.mantle.client.book.data.element.TextData; import slimeknights.mantle.client.book.data.element.TextData;
import slimeknights.mantle.client.screen.book.BookScreen; import slimeknights.mantle.client.screen.book.BookScreen;
import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@@ -41,7 +42,7 @@ public abstract class BookTransformer {
public void transform(BookData book) { public void transform(BookData book) {
SectionData index = new SectionData(true) { SectionData index = new SectionData(true) {
@Override @Override
public void update(BookScreen.AdvancementCache advancementCache) { public void update(@Nullable BookScreen.AdvancementCache advancementCache) {
this.pages.clear(); this.pages.clear();
List<SectionData> visibleSections = this.parent.getVisibleSections(advancementCache); List<SectionData> visibleSections = this.parent.getVisibleSections(advancementCache);
@@ -3,8 +3,8 @@ package slimeknights.mantle.client.book;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.fluid.Fluids;
import net.minecraft.fluid.FluidState; import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
@@ -48,7 +48,7 @@ public class StructureBlockAccess implements IWorldReader {
@Override @Override
public WorldLightManager getLightManager() { public WorldLightManager getLightManager() {
return null; throw new UnsupportedOperationException();
} }
@Override @Override
@@ -82,12 +82,12 @@ public class StructureBlockAccess implements IWorldReader {
@Override @Override
public Biome getBiome(BlockPos pos) { public Biome getBiome(BlockPos pos) {
return null; throw new UnsupportedOperationException();
} }
@Override @Override
public Biome getNoiseBiomeRaw(int p_225604_1_, int p_225604_2_, int p_225604_3_) { public Biome getNoiseBiomeRaw(int p_225604_1_, int p_225604_2_, int p_225604_3_) {
return null; throw new UnsupportedOperationException();
} }
@Override @Override
@@ -133,22 +133,22 @@ public class StructureBlockAccess implements IWorldReader {
@Override @Override
public BiomeManager getBiomeManager() { public BiomeManager getBiomeManager() {
return null; throw new UnsupportedOperationException();
} }
@Override @Override
public WorldBorder getWorldBorder() { public WorldBorder getWorldBorder() {
return null; throw new UnsupportedOperationException();
} }
@Override @Override
public boolean checkNoEntityCollision(Entity entityIn, VoxelShape shape) { public boolean checkNoEntityCollision(@Nullable Entity entityIn, VoxelShape shape) {
return false; return false;
} }
@Override @Override
public Stream<VoxelShape> func_230318_c_(@Nullable Entity p_230318_1_, AxisAlignedBB p_230318_2_, Predicate<Entity> p_230318_3_) { public Stream<VoxelShape> func_230318_c_(@Nullable Entity p_230318_1_, AxisAlignedBB p_230318_2_, Predicate<Entity> p_230318_3_) {
return null; throw new UnsupportedOperationException();
} }
@Override @Override
@@ -163,7 +163,7 @@ public class StructureBlockAccess implements IWorldReader {
@Override @Override
public DimensionType func_230315_m_() { public DimensionType func_230315_m_() {
return null; throw new UnsupportedOperationException();
} }
@Override @Override
@@ -1,17 +1,18 @@
package slimeknights.mantle.client.book.action; package slimeknights.mantle.client.book.action;
import java.util.HashMap;
import slimeknights.mantle.client.book.action.protocol.ActionProtocol; import slimeknights.mantle.client.book.action.protocol.ActionProtocol;
import slimeknights.mantle.client.screen.book.BookScreen; import slimeknights.mantle.client.screen.book.BookScreen;
import javax.annotation.Nullable;
import java.util.HashMap;
public class StringActionProcessor { public class StringActionProcessor {
public static final String PROTOCOL_SEPARATOR = ":"; public static final String PROTOCOL_SEPARATOR = ":";
private static final HashMap<String, ActionProtocol> protocols = new HashMap<>(); private static final HashMap<String, ActionProtocol> protocols = new HashMap<>();
public static void registerProtocol(ActionProtocol protocol) { public static void registerProtocol(@Nullable ActionProtocol protocol) {
if (protocol == null || protocol.protocol == null || protocol.protocol.isEmpty()) { if (protocol == null || protocol.protocol == null || protocol.protocol.isEmpty()) {
throw new IllegalArgumentException("Protocol must be defined and must not have an empty protocol identifier."); throw new IllegalArgumentException("Protocol must be defined and must not have an empty protocol identifier.");
} }
@@ -23,8 +24,8 @@ public class StringActionProcessor {
} }
//Format: action://param //Format: action://param
public static void process(String action, BookScreen book) { public static void process(@Nullable String action, BookScreen book) {
if (!action.contains(PROTOCOL_SEPARATOR)) { if (action == null || !action.contains(PROTOCOL_SEPARATOR)) {
return; return;
} }
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.client.book.action;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.client.book.action.protocol;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -15,7 +15,6 @@ import slimeknights.mantle.client.book.data.element.ItemStackData;
import slimeknights.mantle.client.book.repository.BookRepository; import slimeknights.mantle.client.book.repository.BookRepository;
import slimeknights.mantle.client.screen.book.BookScreen; import slimeknights.mantle.client.screen.book.BookScreen;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.InputStreamReader; import java.io.InputStreamReader;
@@ -198,11 +197,13 @@ public class BookData implements IDataItem {
Mantle.logger.info("Finished loading book"); Mantle.logger.info("Finished loading book");
} }
@Nullable
public SectionData findSection(String name) { public SectionData findSection(String name) {
return this.findSection(name, null); return this.findSection(name, null);
} }
public SectionData findSection(String name, BookScreen.AdvancementCache advancementCache) { @Nullable
public SectionData findSection(String name, @Nullable BookScreen.AdvancementCache advancementCache) {
for (SectionData section : this.sections) { for (SectionData section : this.sections) {
section.update(advancementCache); section.update(advancementCache);
@@ -237,10 +238,12 @@ public class BookData implements IDataItem {
return -1; return -1;
} }
@Nullable
public PageData findPage(int number) { public PageData findPage(int number) {
return this.findPage(number, null); return this.findPage(number, null);
} }
@Nullable
public PageData findPage(int number, @Nullable BookScreen.AdvancementCache advancementCache) { public PageData findPage(int number, @Nullable BookScreen.AdvancementCache advancementCache) {
if (number < 0) { if (number < 0) {
return null; return null;
@@ -265,10 +268,12 @@ public class BookData implements IDataItem {
return null; return null;
} }
@Nullable
public PageData findPage(String location) { public PageData findPage(String location) {
return this.findPage(location, null); return this.findPage(location, null);
} }
@Nullable
public PageData findPage(String location, @Nullable BookScreen.AdvancementCache advancementCache) { public PageData findPage(String location, @Nullable BookScreen.AdvancementCache advancementCache) {
return this.findPage(this.findPageNumber(location, advancementCache)); return this.findPage(this.findPageNumber(location, advancementCache));
} }
@@ -363,7 +368,7 @@ public class BookData implements IDataItem {
return out != null ? out : string; return out != null ? out : string;
} }
public void openGui(@Nonnull ITextComponent title, @Nullable ItemStack item) { public void openGui(ITextComponent title, @Nullable ItemStack item) {
if (!this.initialized) { if (!this.initialized) {
this.load(); this.load();
} }
@@ -372,13 +377,13 @@ public class BookData implements IDataItem {
} }
} }
public void addRepository(BookRepository repository) { public void addRepository(@Nullable BookRepository repository) {
if (repository != null && !this.repositories.contains(repository)) { if (repository != null && !this.repositories.contains(repository)) {
this.repositories.add(repository); this.repositories.add(repository);
} }
} }
public void addTransformer(BookTransformer transformer) { public void addTransformer(@Nullable BookTransformer transformer) {
if (transformer != null && !this.transformers.contains(transformer)) { if (transformer != null && !this.transformers.contains(transformer)) {
this.transformers.add(transformer); this.transformers.add(transformer);
} }
@@ -103,7 +103,7 @@ public class SectionData implements IDataItem {
return this.pages.size(); return this.pages.size();
} }
public boolean isUnlocked(BookScreen.AdvancementCache advancementCache) { public boolean isUnlocked(@Nullable BookScreen.AdvancementCache advancementCache) {
if (advancementCache == null || this.requirements == null || this.requirements.size() == 0) { if (advancementCache == null || this.requirements == null || this.requirements.size() == 0) {
return true; return true;
} }
@@ -117,7 +117,7 @@ public class SectionData implements IDataItem {
return true; return true;
} }
public static boolean requirementSatisfied(String requirement, BookScreen.AdvancementCache advancementCache) { public static boolean requirementSatisfied(String requirement, @Nullable BookScreen.AdvancementCache advancementCache) {
if (advancementCache == null) { if (advancementCache == null) {
return true; return true;
} }
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.client.book.data.content;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.client.book.data.deserializer;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.client.book.data.element;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.client.book.data;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.client.book;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -2,26 +2,26 @@ package slimeknights.mantle.client.book.repository;
import net.minecraft.resources.IResource; import net.minecraft.resources.IResource;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import java.util.List;
import slimeknights.mantle.client.book.data.SectionData; import slimeknights.mantle.client.book.data.SectionData;
import java.util.Collections;
import java.util.List;
public class DummyRepository extends BookRepository { public class DummyRepository extends BookRepository {
@Override @Override
public List<SectionData> getSections() { public List<SectionData> getSections() {
return null; return Collections.emptyList();
} }
@Override @Override
public ResourceLocation getResourceLocation(String path, boolean safe) { public ResourceLocation getResourceLocation(String path, boolean safe) {
return null; throw new UnsupportedOperationException();
} }
@Override @Override
public IResource getResource(ResourceLocation loc) { public IResource getResource(ResourceLocation loc) {
return null; throw new UnsupportedOperationException();
} }
@Override @Override
@@ -31,6 +31,6 @@ public class DummyRepository extends BookRepository {
@Override @Override
public String resourceToString(IResource resource, boolean skipCommments) { public String resourceToString(IResource resource, boolean skipCommments) {
return null; return "";
} }
} }
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.client.book.repository;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -1,21 +1,17 @@
package slimeknights.mantle.client.model; package slimeknights.mantle.client.model;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.client.model.data.IModelData;
import java.util.List;
import java.util.Random;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List;
import java.util.Optional;
import java.util.Random;
/** /**
* Groups multiple baked models into a single one. Does not respect state etc. when getting quads. * Groups multiple baked models into a single one. Does not respect state etc. when getting quads.
@@ -31,17 +27,9 @@ public class BakedCompositeModel extends BakedWrapper {
this.parts = parts; this.parts = parts;
} }
@Nonnull
@Override @Override
@Deprecated public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand, IModelData extraData) {
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand) { return this.parts.get(Optional.ofNullable(side));
return this.getQuads(state, side, rand, EmptyModelData.INSTANCE);
}
@Nonnull
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) {
return this.parts.get(Optional.fromNullable(side));
} }
public static class Builder { public static class Builder {
@@ -63,7 +51,7 @@ public class BakedCompositeModel extends BakedWrapper {
} }
} }
public void add(IBakedModel model, BlockState state, Direction side, Random rand) { public void add(IBakedModel model, BlockState state, @Nullable Direction side, Random rand) {
int index; int index;
if (side == null) { if (side == null) {
index = 6; index = 6;
@@ -76,9 +64,9 @@ public class BakedCompositeModel extends BakedWrapper {
} }
public BakedCompositeModel build(IBakedModel parent) { public BakedCompositeModel build(IBakedModel parent) {
ImmutableMap.Builder<Optional<Direction>, ImmutableList<BakedQuad>> map = ImmutableMap.builder(); ImmutableMap.Builder<Optional<Direction>,ImmutableList<BakedQuad>> map = ImmutableMap.builder();
map.put(Optional.absent(), this.builders[6].build()); map.put(Optional.empty(), this.builders[6].build());
for (Direction side : Direction.values()) { for (Direction side : Direction.values()) {
map.put(Optional.of(side), this.builders[side.getIndex()].build()); map.put(Optional.of(side), this.builders[side.getIndex()].build());
} }
@@ -4,18 +4,17 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms; import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.model.ItemOverrideList; import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraftforge.client.model.PerspectiveMapWrapper; import net.minecraftforge.client.model.PerspectiveMapWrapper;
import net.minecraftforge.client.model.data.EmptyModelData; import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.client.model.data.IModelData;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@@ -60,16 +59,14 @@ public class BakedSimple implements IBakedModel {
this.overrides = overrides; this.overrides = overrides;
} }
@Nonnull
@Override @Override
@Deprecated @Deprecated
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand) { public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) {
return this.getQuads(state, side, rand, EmptyModelData.INSTANCE); return this.getQuads(state, side, rand, EmptyModelData.INSTANCE);
} }
@Nonnull
@Override @Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) { public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand, IModelData extraData) {
return this.quads; return this.quads;
} }
@@ -93,27 +90,23 @@ public class BakedSimple implements IBakedModel {
return false; return false;
} }
@Nonnull
@Override @Override
@Deprecated @Deprecated
public TextureAtlasSprite getParticleTexture() { public TextureAtlasSprite getParticleTexture() {
return this.particle; return this.particle;
} }
@Nonnull
@Override @Override
public TextureAtlasSprite getParticleTexture(@Nonnull IModelData data) { public TextureAtlasSprite getParticleTexture(IModelData data) {
return this.particle; return this.particle;
} }
@Nonnull
@Override @Override
@Deprecated @Deprecated
public ItemCameraTransforms getItemCameraTransforms() { public ItemCameraTransforms getItemCameraTransforms() {
return ItemCameraTransforms.DEFAULT; return ItemCameraTransforms.DEFAULT;
} }
@Nonnull
@Override @Override
public ItemOverrideList getOverrides() { public ItemOverrideList getOverrides() {
return this.overrides; return this.overrides;
@@ -128,9 +121,9 @@ public class BakedSimple implements IBakedModel {
private final IBakedModel parent; private final IBakedModel parent;
@SuppressWarnings("ConstantConditions")
public Wrapper(ImmutableList<BakedQuad> quads, IBakedModel base) { public Wrapper(ImmutableList<BakedQuad> quads, IBakedModel base) {
super(quads, null, base); super(quads, null, base);
this.parent = base; this.parent = base;
} }
@@ -3,7 +3,6 @@ package slimeknights.mantle.client.model;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms; import net.minecraft.client.renderer.model.ItemCameraTransforms;
@@ -11,12 +10,12 @@ import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.world.IBlockDisplayReader; import net.minecraft.world.IBlockDisplayReader;
import net.minecraftforge.client.model.PerspectiveMapWrapper; import net.minecraftforge.client.model.PerspectiveMapWrapper;
import net.minecraftforge.client.model.data.EmptyModelData; import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.client.model.data.IModelData;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@@ -29,16 +28,14 @@ public class BakedWrapper implements IBakedModel {
this.parent = parent; this.parent = parent;
} }
@Nonnull
@Override @Override
@Deprecated @Deprecated
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand) { public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) {
return this.getQuads(state, side, rand, EmptyModelData.INSTANCE); return this.getQuads(state, side, rand, EmptyModelData.INSTANCE);
} }
@Nonnull
@Override @Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) { public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand, IModelData extraData) {
return this.parent.getQuads(state, side, rand, extraData); return this.parent.getQuads(state, side, rand, extraData);
} }
@@ -62,35 +59,30 @@ public class BakedWrapper implements IBakedModel {
return this.parent.isBuiltInRenderer(); return this.parent.isBuiltInRenderer();
} }
@Nonnull
@Override @Override
@Deprecated @Deprecated
public TextureAtlasSprite getParticleTexture() { public TextureAtlasSprite getParticleTexture() {
return this.parent.getParticleTexture(); return this.parent.getParticleTexture();
} }
@Nonnull
@Override @Override
public TextureAtlasSprite getParticleTexture(@Nonnull IModelData data) { public TextureAtlasSprite getParticleTexture(IModelData data) {
return this.parent.getParticleTexture(data); return this.parent.getParticleTexture(data);
} }
@Nonnull
@Override @Override
@Deprecated @Deprecated
public ItemCameraTransforms getItemCameraTransforms() { public ItemCameraTransforms getItemCameraTransforms() {
return this.parent.getItemCameraTransforms(); return this.parent.getItemCameraTransforms();
} }
@Nonnull
@Override @Override
public ItemOverrideList getOverrides() { public ItemOverrideList getOverrides() {
return this.parent.getOverrides(); return this.parent.getOverrides();
} }
@Nonnull
@Override @Override
public IModelData getModelData(@Nonnull IBlockDisplayReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData) { public IModelData getModelData(IBlockDisplayReader world, BlockPos pos, BlockState state, IModelData tileData) {
return this.parent.getModelData(world, pos, state, tileData); return this.parent.getModelData(world, pos, state, tileData);
} }
@@ -3,7 +3,6 @@ package slimeknights.mantle.client.model;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms; import net.minecraft.client.renderer.model.ItemCameraTransforms;
@@ -11,12 +10,12 @@ import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.world.IBlockDisplayReader; import net.minecraft.world.IBlockDisplayReader;
import net.minecraftforge.client.model.data.EmptyModelData; import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.client.model.data.IModelData;
import slimeknights.mantle.client.ModelHelper; import slimeknights.mantle.client.ModelHelper;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@@ -49,16 +48,14 @@ public class BlockItemModelWrapper implements IBakedModel {
return this; return this;
} }
@Nonnull
@Override @Override
@Deprecated @Deprecated
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand) { public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) {
return this.getQuads(state, side, rand, EmptyModelData.INSTANCE); return this.getQuads(state, side, rand, EmptyModelData.INSTANCE);
} }
@Nonnull
@Override @Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) { public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand, IModelData extraData) {
return this.parent.getQuads(state, side, rand, extraData); return this.parent.getQuads(state, side, rand, extraData);
} }
@@ -82,33 +79,28 @@ public class BlockItemModelWrapper implements IBakedModel {
return this.parent.isBuiltInRenderer(); return this.parent.isBuiltInRenderer();
} }
@Nonnull
@Override @Override
@Deprecated @Deprecated
public TextureAtlasSprite getParticleTexture() { public TextureAtlasSprite getParticleTexture() {
return this.parent.getParticleTexture(); return this.parent.getParticleTexture();
} }
@Nonnull
@Override @Override
public TextureAtlasSprite getParticleTexture(@Nonnull IModelData data) { public TextureAtlasSprite getParticleTexture(IModelData data) {
return this.parent.getParticleTexture(data); return this.parent.getParticleTexture(data);
} }
@Nonnull
@Override @Override
public IModelData getModelData(@Nonnull IBlockDisplayReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData) { public IModelData getModelData(IBlockDisplayReader world, BlockPos pos, BlockState state, IModelData tileData) {
return this.parent.getModelData(world, pos, state, tileData); return this.parent.getModelData(world, pos, state, tileData);
} }
@Nonnull
@Override @Override
@Deprecated @Deprecated
public ItemCameraTransforms getItemCameraTransforms() { public ItemCameraTransforms getItemCameraTransforms() {
return this.parent.getItemCameraTransforms(); return this.parent.getItemCameraTransforms();
} }
@Nonnull
@Override @Override
public ItemOverrideList getOverrides() { public ItemOverrideList getOverrides() {
return ItemOverrideList.EMPTY; return ItemOverrideList.EMPTY;
@@ -2,27 +2,26 @@ package slimeknights.mantle.client.model;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.util.math.vector.Matrix3f;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms; import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.model.ItemOverrideList; import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormatElement; import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.world.World; import net.minecraft.util.math.vector.Matrix3f;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraftforge.client.model.pipeline.BakedQuadBuilder; import net.minecraftforge.client.model.pipeline.BakedQuadBuilder;
import net.minecraftforge.client.model.pipeline.VertexTransformer; import net.minecraftforge.client.model.pipeline.VertexTransformer;
import net.minecraftforge.common.model.TransformationHelper; import net.minecraftforge.common.model.TransformationHelper;
import javax.annotation.Nonnull; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@@ -67,9 +66,8 @@ public class TRSRBakedModel implements IBakedModel {
this.transformation = new TransformationMatrix(null, null, null, TransformationHelper.quatFromXYZ(new float[] { 0, (float) r, 0 }, false)).blockCenterToCorner(); this.transformation = new TransformationMatrix(null, null, null, TransformationHelper.quatFromXYZ(new float[] { 0, (float) r, 0 }, false)).blockCenterToCorner();
} }
@Nonnull
@Override @Override
public List<BakedQuad> getQuads(BlockState state, Direction side, Random rand) { public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) {
// transform quads obtained from parent // transform quads obtained from parent
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder(); ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
@@ -114,20 +112,17 @@ public class TRSRBakedModel implements IBakedModel {
return this.original.isBuiltInRenderer(); return this.original.isBuiltInRenderer();
} }
@Nonnull
@Override @Override
public TextureAtlasSprite getParticleTexture() { public TextureAtlasSprite getParticleTexture() {
return this.original.getParticleTexture(); return this.original.getParticleTexture();
} }
@Nonnull
@Override @Override
@Deprecated @Deprecated
public ItemCameraTransforms getItemCameraTransforms() { public ItemCameraTransforms getItemCameraTransforms() {
return this.original.getItemCameraTransforms(); return this.original.getItemCameraTransforms();
} }
@Nonnull
@Override @Override
public ItemOverrideList getOverrides() { public ItemOverrideList getOverrides() {
return this.override; return this.override;
@@ -141,11 +136,13 @@ public class TRSRBakedModel implements IBakedModel {
this.model = model; this.model = model;
} }
@Nonnull @Nullable
@Override @Override
public IBakedModel func_239290_a_(@Nonnull IBakedModel originalModel, ItemStack stack, @Nonnull ClientWorld world, @Nonnull LivingEntity entity) { public IBakedModel func_239290_a_(IBakedModel originalModel, ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity) {
IBakedModel baked = this.model.original.getOverrides().func_239290_a_(originalModel, stack, world, entity); IBakedModel baked = this.model.original.getOverrides().func_239290_a_(originalModel, stack, world, entity);
if (baked == null) {
return null;
}
return new TRSRBakedModel(baked, this.model.transformation); return new TRSRBakedModel(baked, this.model.transformation);
} }
} }
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.client.model;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.client;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -14,7 +14,7 @@ import net.minecraft.util.text.ITextComponent;
import slimeknights.mantle.inventory.MultiModuleContainer; import slimeknights.mantle.inventory.MultiModuleContainer;
import slimeknights.mantle.inventory.WrapperSlot; import slimeknights.mantle.inventory.WrapperSlot;
import javax.annotation.Nonnull; import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -101,6 +101,7 @@ public class MultiModuleScreen<CONTAINER extends MultiModuleContainer<?>> extend
} }
protected void drawPlayerInventoryName(MatrixStack matrixStack) { protected void drawPlayerInventoryName(MatrixStack matrixStack) {
assert Minecraft.getInstance().player != null;
ITextComponent localizedName = Minecraft.getInstance().player.inventory.getDisplayName(); ITextComponent localizedName = Minecraft.getInstance().player.inventory.getDisplayName();
this.font.func_238422_b_(matrixStack, localizedName, 8, this.ySize - 96 + 2, 0x404040); this.font.func_238422_b_(matrixStack, localizedName, 8, this.ySize - 96 + 2, 0x404040);
} }
@@ -116,7 +117,7 @@ public class MultiModuleScreen<CONTAINER extends MultiModuleContainer<?>> extend
} }
@Override @Override
public void resize(@Nonnull Minecraft mc, int width, int height) { public void resize(Minecraft mc, int width, int height) {
super.resize(mc, width, height); super.resize(mc, width, height);
for (ModuleScreen module : this.modules) { for (ModuleScreen module : this.modules) {
@@ -272,6 +273,7 @@ public class MultiModuleScreen<CONTAINER extends MultiModuleContainer<?>> extend
return super.mouseReleased(mouseX, mouseY, state); return super.mouseReleased(mouseX, mouseY, state);
} }
@Nullable
protected ModuleScreen getModuleForPoint(double x, double y) { protected ModuleScreen getModuleForPoint(double x, double y) {
for (ModuleScreen module : this.modules) { for (ModuleScreen module : this.modules) {
if (this.isPointInRegion(module.guiLeft, module.guiTop, module.guiRight(), module.guiBottom(), x + this.cornerX, y + this.cornerY)) { if (this.isPointInRegion(module.guiLeft, module.guiTop, module.guiRight(), module.guiBottom(), x + this.cornerX, y + this.cornerY)) {
@@ -282,10 +284,12 @@ public class MultiModuleScreen<CONTAINER extends MultiModuleContainer<?>> extend
return null; return null;
} }
@Nullable
protected ModuleScreen getModuleForSlot(int slotNumber) { protected ModuleScreen getModuleForSlot(int slotNumber) {
return this.getModuleForContainer(this.getContainer().getSlotContainer(slotNumber)); return this.getModuleForContainer(this.getContainer().getSlotContainer(slotNumber));
} }
@Nullable
protected ModuleScreen getModuleForContainer(Container container) { protected ModuleScreen getModuleForContainer(Container container) {
for (ModuleScreen module : this.modules) { for (ModuleScreen module : this.modules) {
if (module.getContainer() == container) { if (module.getContainer() == container) {
@@ -296,7 +300,6 @@ public class MultiModuleScreen<CONTAINER extends MultiModuleContainer<?>> extend
return null; return null;
} }
@Nonnull
@Override @Override
public CONTAINER getContainer() { public CONTAINER getContainer() {
return this.container; return this.container;
@@ -627,10 +627,12 @@ public class BookScreen extends Screen {
private HashMap<Advancement, AdvancementProgress> progress = new HashMap<>(); private HashMap<Advancement, AdvancementProgress> progress = new HashMap<>();
private HashMap<ResourceLocation, Advancement> nameCache = new HashMap<>(); private HashMap<ResourceLocation, Advancement> nameCache = new HashMap<>();
@Nullable
public AdvancementProgress getProgress(String id) { public AdvancementProgress getProgress(String id) {
return this.getProgress(this.getAdvancement(id)); return this.getProgress(this.getAdvancement(id));
} }
@Nullable
public AdvancementProgress getProgress(Advancement advancement) { public AdvancementProgress getProgress(Advancement advancement) {
return this.progress.get(advancement); return this.progress.get(advancement);
} }
@@ -18,7 +18,7 @@ import org.apache.commons.lang3.StringUtils;
import slimeknights.mantle.Mantle; import slimeknights.mantle.Mantle;
import slimeknights.mantle.client.book.data.element.TextData; import slimeknights.mantle.client.book.data.element.TextData;
import javax.annotation.Nonnull; import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@@ -29,6 +29,7 @@ public class TextDataRenderer {
/** /**
* @deprecated Call drawText with tooltip param and then call drawTooltip separately on the tooltip layer to prevent overlap * @deprecated Call drawText with tooltip param and then call drawTooltip separately on the tooltip layer to prevent overlap
*/ */
@Nullable
public static String drawText(MatrixStack matrixStack, int x, int y, int boxWidth, int boxHeight, TextData[] data, int mouseX, int mouseY, FontRenderer fr) { public static String drawText(MatrixStack matrixStack, int x, int y, int boxWidth, int boxHeight, TextData[] data, int mouseX, int mouseY, FontRenderer fr) {
List<ITextComponent> tooltip = new ArrayList<ITextComponent>(); List<ITextComponent> tooltip = new ArrayList<ITextComponent>();
String action = drawText(matrixStack, x, y, boxWidth, boxHeight, data, mouseX, mouseY, fr, tooltip); String action = drawText(matrixStack, x, y, boxWidth, boxHeight, data, mouseX, mouseY, fr, tooltip);
@@ -40,7 +41,8 @@ public class TextDataRenderer {
return action; return action;
} }
public static String drawText(MatrixStack matrixStack, int x, int y, int boxWidth, int boxHeight, TextData[] data, int mouseX, int mouseY, FontRenderer fr, @Nonnull List<ITextComponent> tooltip) { @Nullable
public static String drawText(MatrixStack matrixStack, int x, int y, int boxWidth, int boxHeight, TextData[] data, int mouseX, int mouseY, FontRenderer fr, List<ITextComponent> tooltip) {
String action = ""; String action = "";
int atX = x; int atX = x;
@@ -15,7 +15,6 @@ import net.minecraftforge.fml.client.gui.GuiUtils;
import slimeknights.mantle.client.screen.book.BookScreen; import slimeknights.mantle.client.screen.book.BookScreen;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public abstract class BookElement extends AbstractGui { public abstract class BookElement extends AbstractGui {
@@ -54,17 +53,15 @@ public abstract class BookElement extends AbstractGui {
} }
public void renderToolTip(MatrixStack matrixStack, FontRenderer fontRenderer, ItemStack stack, int x, int y) { public void renderToolTip(MatrixStack matrixStack, FontRenderer fontRenderer, ItemStack stack, int x, int y) {
if (stack != null) { List<ITextComponent> list = stack.getTooltip(this.mc.player, this.mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL);
List<ITextComponent> list = stack.getTooltip(this.mc.player, this.mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL);
FontRenderer font = stack.getItem().getFontRenderer(stack); FontRenderer font = stack.getItem().getFontRenderer(stack);
if (font == null) { if (font == null) {
font = fontRenderer; font = fontRenderer;
}
this.drawHoveringText(matrixStack, list, x, y, font);
RenderHelper.disableStandardItemLighting();
} }
this.drawHoveringText(matrixStack, list, x, y, font);
RenderHelper.disableStandardItemLighting();
} }
public void drawHoveringText(MatrixStack matrixStack, List<ITextComponent> textLines, int x, int y, FontRenderer font) { public void drawHoveringText(MatrixStack matrixStack, List<ITextComponent> textLines, int x, int y, FontRenderer font) {
@@ -14,6 +14,7 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import slimeknights.mantle.client.book.action.StringActionProcessor; import slimeknights.mantle.client.book.action.StringActionProcessor;
import javax.annotation.Nullable;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@@ -25,6 +26,7 @@ public class ItemElement extends SizedBookElement {
public NonNullList<ItemStack> itemCycle; public NonNullList<ItemStack> itemCycle;
public float scale; public float scale;
@Nullable
public String action; public String action;
public List<ITextComponent> tooltip; public List<ITextComponent> tooltip;
@@ -44,18 +46,18 @@ public class ItemElement extends SizedBookElement {
} }
public ItemElement(int x, int y, float scale, Collection<ItemStack> itemCycle) { public ItemElement(int x, int y, float scale, Collection<ItemStack> itemCycle) {
this(x, y, scale, itemCycle.toArray(new ItemStack[itemCycle.size()])); this(x, y, scale, itemCycle.toArray(new ItemStack[0]));
} }
public ItemElement(int x, int y, float scale, Collection<ItemStack> itemCycle, String action) { public ItemElement(int x, int y, float scale, Collection<ItemStack> itemCycle, String action) {
this(x, y, scale, itemCycle.toArray(new ItemStack[itemCycle.size()]), action); this(x, y, scale, itemCycle.toArray(new ItemStack[0]), action);
} }
public ItemElement(int x, int y, float scale, ItemStack... itemCycle) { public ItemElement(int x, int y, float scale, ItemStack... itemCycle) {
this(x, y, scale, itemCycle, null); this(x, y, scale, itemCycle, null);
} }
public ItemElement(int x, int y, float scale, ItemStack[] itemCycle, String action) { public ItemElement(int x, int y, float scale, ItemStack[] itemCycle, @Nullable String action) {
super(x, y, MathHelper.floor(ITEM_SIZE_HARDCODED * scale), MathHelper.floor(ITEM_SIZE_HARDCODED * scale)); super(x, y, MathHelper.floor(ITEM_SIZE_HARDCODED * scale), MathHelper.floor(ITEM_SIZE_HARDCODED * scale));
NonNullList<ItemStack> nonNullStacks = NonNullList.withSize(itemCycle.length, ItemStack.EMPTY); NonNullList<ItemStack> nonNullStacks = NonNullList.withSize(itemCycle.length, ItemStack.EMPTY);
@@ -26,7 +26,7 @@ public class TextElement extends SizedBookElement {
} }
public TextElement(int x, int y, int width, int height, Collection<TextData> text) { public TextElement(int x, int y, int width, int height, Collection<TextData> text) {
this(x, y, width, height, text.toArray(new TextData[text.size()])); this(x, y, width, height, text.toArray(new TextData[0]));
} }
public TextElement(int x, int y, int width, int height, TextData... text) { public TextElement(int x, int y, int width, int height, TextData... text) {
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.client.screen.book.element;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.client.screen.book;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.client.screen;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.common;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -19,6 +19,7 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
import ninja.leaping.configurate.objectmapping.serialize.TypeSerializer; import ninja.leaping.configurate.objectmapping.serialize.TypeSerializer;
import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers; import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers;
import javax.annotation.Nullable;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.File; import java.io.File;
@@ -125,6 +126,7 @@ public abstract class AbstractConfigFile implements Serializable {
return fields; return fields;
} }
@Nullable
public byte[] getPacketData() { public byte[] getPacketData() {
try { try {
return Files.readAllBytes(this.file.toPath()); return Files.readAllBytes(this.file.toPath());
@@ -9,6 +9,8 @@ import ninja.leaping.configurate.ConfigurationNode;
import ninja.leaping.configurate.objectmapping.ObjectMappingException; import ninja.leaping.configurate.objectmapping.ObjectMappingException;
import ninja.leaping.configurate.objectmapping.serialize.TypeSerializer; import ninja.leaping.configurate.objectmapping.serialize.TypeSerializer;
import java.util.Objects;
public class BlockState { public class BlockState {
private static final BlockState MISSING = new BlockState(Blocks.AIR, ""); private static final BlockState MISSING = new BlockState(Blocks.AIR, "");
@@ -20,7 +22,7 @@ public class BlockState {
String[] parts = val.split(":"); String[] parts = val.split(":");
Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(parts[0], parts[1])); Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(parts[0], parts[1]));
if (block == Blocks.AIR) { if (block == null || block == Blocks.AIR) {
return MISSING; return MISSING;
} }
String state = ""; String state = "";
@@ -80,7 +82,7 @@ public class BlockState {
@Override @Override
public String toString() { public String toString() {
String val = this.block.getRegistryName().toString(); String val = Objects.requireNonNull(this.block.getRegistryName()).toString();
if (!this.state.equals("")) { if (!this.state.equals("")) {
val += ":" + this.state; val += ":" + this.state;
} }
@@ -47,6 +47,7 @@ class ExampleSync {
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void playerJoinedWorld(TickEvent.ClientTickEvent event) { public void playerJoinedWorld(TickEvent.ClientTickEvent event) {
ClientPlayerEntity player = Minecraft.getInstance().player; ClientPlayerEntity player = Minecraft.getInstance().player;
assert player != null;
if (needsRestart) { if (needsRestart) {
player.sendMessage(new StringTextComponent("Configs synced with server. Configs require a restart"), Util.DUMMY_UUID); player.sendMessage(new StringTextComponent("Configs synced with server. Configs require a restart"), Util.DUMMY_UUID);
} }
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.config;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -18,7 +18,6 @@ import net.minecraftforge.fml.DistExecutor;
import slimeknights.mantle.util.SlimeknightException; import slimeknights.mantle.util.SlimeknightException;
import slimeknights.mantle.util.TileEntityUtil; import slimeknights.mantle.util.TileEntityUtil;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class BaseContainer<TILE extends TileEntity> extends Container { public class BaseContainer<TILE extends TileEntity> extends Container {
@@ -38,7 +37,8 @@ public class BaseContainer<TILE extends TileEntity> extends Container {
this.tile = tile; this.tile = tile;
} }
public TILE getTileEntity() { @Nullable
public TILE getTile() {
return this.tile; return this.tile;
} }
@@ -86,7 +86,7 @@ public class BaseContainer<TILE extends TileEntity> extends Container {
} }
@Override @Override
public boolean canInteractWith(@Nonnull PlayerEntity playerIn) { public boolean canInteractWith(PlayerEntity playerIn) {
if (this.tile == null) { if (this.tile == null) {
return true; return true;
} }
@@ -105,7 +105,6 @@ public class BaseContainer<TILE extends TileEntity> extends Container {
return false; return false;
} }
@Nonnull
@Override @Override
public NonNullList<ItemStack> getInventory() { public NonNullList<ItemStack> getInventory() {
return super.getInventory(); return super.getInventory();
@@ -136,7 +135,7 @@ public class BaseContainer<TILE extends TileEntity> extends Container {
return BASE_Y_OFFSET; return BASE_Y_OFFSET;
} }
protected void addInventorySlots(@Nonnull PlayerInventory inv) { protected void addInventorySlots(PlayerInventory inv) {
int yOffset = this.getInventoryYOffset(); int yOffset = this.getInventoryYOffset();
int xOffset = this.getInventoryXOffset(); int xOffset = this.getInventoryXOffset();
@@ -156,7 +155,6 @@ public class BaseContainer<TILE extends TileEntity> extends Container {
this.playerInventoryStart = start; this.playerInventoryStart = start;
} }
@Nonnull
@Override @Override
protected Slot addSlot(Slot slotIn) { protected Slot addSlot(Slot slotIn) {
if (this.playerInventoryStart >= 0) { if (this.playerInventoryStart >= 0) {
@@ -165,7 +163,6 @@ public class BaseContainer<TILE extends TileEntity> extends Container {
return super.addSlot(slotIn); return super.addSlot(slotIn);
} }
@Nonnull
@Override @Override
public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) { public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) {
// we can only support inventory <-> playerInventory // we can only support inventory <-> playerInventory
@@ -207,7 +204,7 @@ public class BaseContainer<TILE extends TileEntity> extends Container {
// Fix for a vanilla bug: doesn't take Slot.getMaxStackSize into account // Fix for a vanilla bug: doesn't take Slot.getMaxStackSize into account
@Override @Override
protected boolean mergeItemStack(@Nonnull ItemStack stack, int startIndex, int endIndex, boolean useEndIndex) { protected boolean mergeItemStack(ItemStack stack, int startIndex, int endIndex, boolean useEndIndex) {
boolean ret = this.mergeItemStackRefill(stack, startIndex, endIndex, useEndIndex); boolean ret = this.mergeItemStackRefill(stack, startIndex, endIndex, useEndIndex);
if (!stack.isEmpty() && stack.getCount() > 0) { if (!stack.isEmpty() && stack.getCount() > 0) {
ret |= this.mergeItemStackMove(stack, startIndex, endIndex, useEndIndex); ret |= this.mergeItemStackMove(stack, startIndex, endIndex, useEndIndex);
@@ -216,7 +213,7 @@ public class BaseContainer<TILE extends TileEntity> extends Container {
} }
// only refills items that are already present // only refills items that are already present
protected boolean mergeItemStackRefill(@Nonnull ItemStack stack, int startIndex, int endIndex, boolean useEndIndex) { protected boolean mergeItemStackRefill(ItemStack stack, int startIndex, int endIndex, boolean useEndIndex) {
if (stack.getCount() <= 0) { if (stack.getCount() <= 0) {
return false; return false;
} }
@@ -265,7 +262,7 @@ public class BaseContainer<TILE extends TileEntity> extends Container {
} }
// only moves items into empty slots // only moves items into empty slots
protected boolean mergeItemStackMove(@Nonnull ItemStack stack, int startIndex, int endIndex, boolean useEndIndex) { protected boolean mergeItemStackMove(ItemStack stack, int startIndex, int endIndex, boolean useEndIndex) {
if (stack.getCount() <= 0) { if (stack.getCount() <= 0) {
return false; return false;
} }
@@ -314,7 +311,8 @@ public class BaseContainer<TILE extends TileEntity> extends Container {
return flag1; return flag1;
} }
public static <TILE extends TileEntity> TILE getTileEntityFromBuf(PacketBuffer buf, Class<TILE> type) { @Nullable
public static <TILE extends TileEntity> TILE getTileEntityFromBuf(@Nullable PacketBuffer buf, Class<TILE> type) {
if (buf == null) { if (buf == null) {
return null; return null;
} }
@@ -5,8 +5,7 @@ import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.container.CraftingResultSlot; import net.minecraft.inventory.container.CraftingResultSlot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.hooks.BasicEventHooks;
import javax.annotation.Nonnull;
public class CraftingCustomSlot extends CraftingResultSlot { public class CraftingCustomSlot extends CraftingResultSlot {
@@ -27,9 +26,8 @@ public class CraftingCustomSlot extends CraftingResultSlot {
} }
@Override @Override
@Nonnull public ItemStack onTake(PlayerEntity playerIn, ItemStack stack) {
public ItemStack onTake(PlayerEntity playerIn, @Nonnull ItemStack stack) { BasicEventHooks.firePlayerCraftingEvent(playerIn, stack, this.craftMatrix);
net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerCraftingEvent(playerIn, stack, this.craftMatrix);
this.onCrafting(stack); this.onCrafting(stack);
this.callback.onCrafting(playerIn, stack, this.craftMatrix); this.callback.onCrafting(playerIn, stack, this.craftMatrix);
@@ -16,7 +16,6 @@ import net.minecraft.util.math.BlockPos;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@@ -61,10 +60,12 @@ public class MultiModuleContainer<TILE extends TileEntity & IInventory> extends
this.subContainerSlotRanges.put(subcontainer, Pair.of(begin, end)); this.subContainerSlotRanges.put(subcontainer, Pair.of(begin, end));
} }
@Nullable
public <CONTAINER extends Container> CONTAINER getSubContainer(Class<CONTAINER> clazz) { public <CONTAINER extends Container> CONTAINER getSubContainer(Class<CONTAINER> clazz) {
return this.getSubContainer(clazz, 0); return this.getSubContainer(clazz, 0);
} }
@Nullable
public <CONTAINER extends Container> CONTAINER getSubContainer(Class<CONTAINER> clazz, int index) { public <CONTAINER extends Container> CONTAINER getSubContainer(Class<CONTAINER> clazz, int index) {
for (Container sub : this.subContainers) { for (Container sub : this.subContainers) {
if (clazz.isAssignableFrom(sub.getClass())) { if (clazz.isAssignableFrom(sub.getClass())) {
@@ -72,7 +73,7 @@ public class MultiModuleContainer<TILE extends TileEntity & IInventory> extends
} }
if (index < 0) { if (index < 0) {
return (CONTAINER) sub; return clazz.cast(sub);
} }
} }
@@ -88,7 +89,7 @@ public class MultiModuleContainer<TILE extends TileEntity & IInventory> extends
} }
@Override @Override
public boolean canInteractWith(@Nonnull PlayerEntity playerIn) { public boolean canInteractWith(PlayerEntity playerIn) {
// check if subcontainers are valid // check if subcontainers are valid
for (Container sub : this.subContainers) { for (Container sub : this.subContainers) {
if (!sub.canInteractWith(playerIn)) { if (!sub.canInteractWith(playerIn)) {
@@ -108,7 +109,6 @@ public class MultiModuleContainer<TILE extends TileEntity & IInventory> extends
super.onContainerClosed(playerIn); super.onContainerClosed(playerIn);
} }
@Nonnull
@Override @Override
public ItemStack slotClick(int slotId, int dragType, ClickType type, PlayerEntity player) { public ItemStack slotClick(int slotId, int dragType, ClickType type, PlayerEntity player) {
if (slotId == -999 && type == ClickType.QUICK_CRAFT) { if (slotId == -999 && type == ClickType.QUICK_CRAFT) {
@@ -122,7 +122,6 @@ public class MultiModuleContainer<TILE extends TileEntity & IInventory> extends
// More sophisticated version of the one in BaseContainer // More sophisticated version of the one in BaseContainer
// Takes submodules into account when shiftclicking! // Takes submodules into account when shiftclicking!
@Nonnull
@Override @Override
public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) { public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) {
Slot slot = this.inventorySlots.get(index); Slot slot = this.inventorySlots.get(index);
@@ -176,8 +175,7 @@ public class MultiModuleContainer<TILE extends TileEntity & IInventory> extends
return this.notifySlotAfterTransfer(playerIn, itemstack, ret, slot); return this.notifySlotAfterTransfer(playerIn, itemstack, ret, slot);
} }
@Nonnull protected ItemStack notifySlotAfterTransfer(PlayerEntity player, ItemStack stack, ItemStack original, Slot slot) {
protected ItemStack notifySlotAfterTransfer(PlayerEntity player, @Nonnull ItemStack stack, @Nonnull ItemStack original, Slot slot) {
// notify slot // notify slot
slot.onSlotChange(stack, original); slot.onSlotChange(stack, original);
@@ -196,7 +194,7 @@ public class MultiModuleContainer<TILE extends TileEntity & IInventory> extends
return original; return original;
} }
protected boolean moveToTileInventory(@Nonnull ItemStack itemstack) { protected boolean moveToTileInventory(ItemStack itemstack) {
if (itemstack.isEmpty()) { if (itemstack.isEmpty()) {
return false; return false;
} }
@@ -208,7 +206,7 @@ public class MultiModuleContainer<TILE extends TileEntity & IInventory> extends
return !this.mergeItemStack(itemstack, 0, end, false); return !this.mergeItemStack(itemstack, 0, end, false);
} }
protected boolean moveToPlayerInventory(@Nonnull ItemStack itemstack) { protected boolean moveToPlayerInventory(ItemStack itemstack) {
if (itemstack.isEmpty()) { if (itemstack.isEmpty()) {
return false; return false;
} }
@@ -216,7 +214,7 @@ public class MultiModuleContainer<TILE extends TileEntity & IInventory> extends
return this.playerInventoryStart > 0 && !this.mergeItemStack(itemstack, this.playerInventoryStart, this.inventorySlots.size(), true); return this.playerInventoryStart > 0 && !this.mergeItemStack(itemstack, this.playerInventoryStart, this.inventorySlots.size(), true);
} }
protected boolean moveToAnyContainer(@Nonnull ItemStack itemstack, Collection<Container> containers) { protected boolean moveToAnyContainer(ItemStack itemstack, Collection<Container> containers) {
if (itemstack.isEmpty()) { if (itemstack.isEmpty()) {
return false; return false;
} }
@@ -230,12 +228,12 @@ public class MultiModuleContainer<TILE extends TileEntity & IInventory> extends
return false; return false;
} }
protected boolean moveToContainer(@Nonnull ItemStack itemstack, Container container) { protected boolean moveToContainer(ItemStack itemstack, Container container) {
Pair<Integer, Integer> range = this.subContainerSlotRanges.get(container); Pair<Integer, Integer> range = this.subContainerSlotRanges.get(container);
return !this.mergeItemStack(itemstack, range.getLeft(), range.getRight(), false); return !this.mergeItemStack(itemstack, range.getLeft(), range.getRight(), false);
} }
protected boolean refillAnyContainer(@Nonnull ItemStack itemstack, Collection<Container> containers) { protected boolean refillAnyContainer(ItemStack itemstack, Collection<Container> containers) {
if (itemstack.isEmpty()) { if (itemstack.isEmpty()) {
return false; return false;
} }
@@ -249,7 +247,7 @@ public class MultiModuleContainer<TILE extends TileEntity & IInventory> extends
return false; return false;
} }
protected boolean refillContainer(@Nonnull ItemStack itemstack, Container container) { protected boolean refillContainer(ItemStack itemstack, Container container) {
Pair<Integer, Integer> range = this.subContainerSlotRanges.get(container); Pair<Integer, Integer> range = this.subContainerSlotRanges.get(container);
return !this.mergeItemStackRefill(itemstack, range.getLeft(), range.getRight(), false); return !this.mergeItemStackRefill(itemstack, range.getLeft(), range.getRight(), false);
} }
@@ -257,6 +255,7 @@ public class MultiModuleContainer<TILE extends TileEntity & IInventory> extends
/** /**
* Searches for a sidechest to display in the UI * Searches for a sidechest to display in the UI
*/ */
@Nullable
public <TE extends TileEntity> TE detectTE(Class<TE> clazz) { public <TE extends TileEntity> TE detectTE(Class<TE> clazz) {
if (this.tile == null) { if (this.tile == null) {
return null; return null;
@@ -268,6 +267,7 @@ public class MultiModuleContainer<TILE extends TileEntity & IInventory> extends
} }
} }
@Nullable
private <TE extends TileEntity> TE detectChest(BlockPos pos, Class<TE> clazz) { private <TE extends TileEntity> TE detectChest(BlockPos pos, Class<TE> clazz) {
if (this.tile == null) { if (this.tile == null) {
return null; return null;
@@ -276,9 +276,8 @@ public class MultiModuleContainer<TILE extends TileEntity & IInventory> extends
return null; return null;
} else { } else {
TileEntity te = this.tile.getWorld().getTileEntity(pos); TileEntity te = this.tile.getWorld().getTileEntity(pos);
if (clazz.isInstance(te)) {
if (te != null && clazz.isAssignableFrom(te.getClass())) { return clazz.cast(te);
return (TE) te;
} }
} }
} }
@@ -4,8 +4,6 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.container.Slot; import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
/** Slot that can only be taken out of */ /** Slot that can only be taken out of */
public class OutSlot extends Slot { public class OutSlot extends Slot {
@@ -14,7 +12,7 @@ public class OutSlot extends Slot {
} }
@Override @Override
public boolean isItemValid(@Nonnull ItemStack stack) { public boolean isItemValid(ItemStack stack) {
return false; return false;
} }
} }
@@ -5,8 +5,6 @@ import net.minecraft.inventory.container.Slot;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
public class RestrictedItemSlot extends Slot { public class RestrictedItemSlot extends Slot {
private final Item allowedItem; private final Item allowedItem;
@@ -17,7 +15,7 @@ public class RestrictedItemSlot extends Slot {
} }
@Override @Override
public boolean isItemValid(@Nonnull ItemStack stack) { public boolean isItemValid(ItemStack stack) {
return !stack.isEmpty() && stack.getItem() == this.allowedItem; return !stack.isEmpty() && stack.getItem() == this.allowedItem;
} }
} }
@@ -8,8 +8,6 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
/** /**
* Used to wrap the slots inside Modules/Subcontainers * Used to wrap the slots inside Modules/Subcontainers
*/ */
@@ -43,12 +41,11 @@ public class WrapperSlot extends Slot {
} }
@Override @Override
public void putStack(@Nonnull ItemStack stack) { public void putStack(ItemStack stack) {
this.parent.putStack(stack); this.parent.putStack(stack);
} }
@Override @Override
@Nonnull
public ItemStack onTake(PlayerEntity playerIn, ItemStack stack) { public ItemStack onTake(PlayerEntity playerIn, ItemStack stack) {
this.parent.onTake(playerIn, stack); this.parent.onTake(playerIn, stack);
@@ -56,7 +53,6 @@ public class WrapperSlot extends Slot {
} }
@Override @Override
@Nonnull
public ItemStack getStack() { public ItemStack getStack() {
return this.parent.getStack(); return this.parent.getStack();
} }
@@ -87,7 +83,6 @@ public class WrapperSlot extends Slot {
return this.parent.setBackground(atlas, sprite); return this.parent.setBackground(atlas, sprite);
} }
@Nonnull
@Override @Override
public ItemStack decrStackSize(int amount) { public ItemStack decrStackSize(int amount) {
return this.parent.decrStackSize(amount); return this.parent.decrStackSize(amount);
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.inventory;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.item;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -12,7 +12,7 @@ import net.minecraft.world.World;
import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistries;
import slimeknights.mantle.tileentity.MantleTileEntity; import slimeknights.mantle.tileentity.MantleTileEntity;
import javax.annotation.Nonnull; import java.util.Objects;
public class MultiServantLogic extends MantleTileEntity implements IServantLogic { public class MultiServantLogic extends MantleTileEntity implements IServantLogic {
@@ -38,6 +38,7 @@ public class MultiServantLogic extends MantleTileEntity implements IServantLogic
return false; return false;
} }
assert this.world != null;
if (this.world.getBlockState(this.master).getBlock() == this.masterBlock && this.world.getBlockState(this.master) == this.state) { if (this.world.getBlockState(this.master).getBlock() == this.masterBlock && this.world.getBlockState(this.master) == this.state) {
return true; return true;
} }
@@ -54,6 +55,7 @@ public class MultiServantLogic extends MantleTileEntity implements IServantLogic
} }
public void overrideMaster(BlockPos pos) { public void overrideMaster(BlockPos pos) {
assert this.world != null;
this.hasMaster = true; this.hasMaster = true;
this.master = pos; this.master = pos;
this.state = this.world.getBlockState(this.master); this.state = this.world.getBlockState(this.master);
@@ -76,8 +78,9 @@ public class MultiServantLogic extends MantleTileEntity implements IServantLogic
@Deprecated @Deprecated
public boolean verifyMaster(IMasterLogic logic, BlockPos pos) { public boolean verifyMaster(IMasterLogic logic, BlockPos pos) {
assert this.world != null;
return this.master.equals(pos) && this.world.getBlockState(pos) == this.state return this.master.equals(pos) && this.world.getBlockState(pos) == this.state
&& this.world.getBlockState(pos).getBlock() == this.masterBlock; && this.world.getBlockState(pos).getBlock() == this.masterBlock;
} }
@Override @Override
@@ -99,6 +102,7 @@ public class MultiServantLogic extends MantleTileEntity implements IServantLogic
@Override @Override
public void notifyMasterOfChange() { public void notifyMasterOfChange() {
if (this.hasValidMaster()) { if (this.hasValidMaster()) {
assert this.world != null;
IMasterLogic logic = (IMasterLogic) this.world.getTileEntity(this.master); IMasterLogic logic = (IMasterLogic) this.world.getTileEntity(this.master);
logic.notifyChange(this, this.pos); logic.notifyChange(this, this.pos);
} }
@@ -122,7 +126,7 @@ public class MultiServantLogic extends MantleTileEntity implements IServantLogic
tags.putInt("xCenter", this.master.getX()); tags.putInt("xCenter", this.master.getX());
tags.putInt("yCenter", this.master.getY()); tags.putInt("yCenter", this.master.getY());
tags.putInt("zCenter", this.master.getZ()); tags.putInt("zCenter", this.master.getZ());
tags.putString("MasterBlockName", ForgeRegistries.BLOCKS.getKey(this.masterBlock).toString()); tags.putString("MasterBlockName", Objects.requireNonNull(this.masterBlock.getRegistryName()).toString());
tags.putInt("masterState", Block.getStateId(this.state)); tags.putInt("masterState", Block.getStateId(this.state));
} }
return tags; return tags;
@@ -134,7 +138,6 @@ public class MultiServantLogic extends MantleTileEntity implements IServantLogic
this.readCustomNBT(tags); this.readCustomNBT(tags);
} }
@Nonnull
@Override @Override
public CompoundNBT write(CompoundNBT tags) { public CompoundNBT write(CompoundNBT tags) {
tags = super.write(tags); tags = super.write(tags);
@@ -142,7 +145,6 @@ public class MultiServantLogic extends MantleTileEntity implements IServantLogic
} }
/* Packets */ /* Packets */
@Nonnull
@Override @Override
public CompoundNBT getUpdateTag() { public CompoundNBT getUpdateTag() {
CompoundNBT tag = new CompoundNBT(); CompoundNBT tag = new CompoundNBT();
@@ -154,18 +156,14 @@ public class MultiServantLogic extends MantleTileEntity implements IServantLogic
public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket packet) { public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket packet) {
this.readCustomNBT(packet.getNbtCompound()); this.readCustomNBT(packet.getNbtCompound());
//this.world.notifyLightSet(this.pos); //this.world.notifyLightSet(this.pos);
assert world != null;
BlockState state = world.getBlockState(this.pos); BlockState state = world.getBlockState(this.pos);
this.world.notifyBlockUpdate(this.pos, state, state, 3); this.world.notifyBlockUpdate(this.pos, state, state, 3);
} }
@Nonnull
@Override
public World getWorld() {
return this.world;
}
@Deprecated @Deprecated
public boolean setMaster(BlockPos pos) { public boolean setMaster(BlockPos pos) {
assert this.world != null;
if (!this.hasMaster || this.world.getBlockState(this.master) != this.state || (this.world.getBlockState(this.master).getBlock() != this.masterBlock)) { if (!this.hasMaster || this.world.getBlockState(this.master) != this.state || (this.world.getBlockState(this.master).getBlock() != this.masterBlock)) {
this.overrideMaster(pos); this.overrideMaster(pos);
return true; return true;
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.multiblock;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -32,11 +32,11 @@ public class UpdateSavedPagePacket extends AbstractPacket {
context.get().enqueueWork(() -> { context.get().enqueueWork(() -> {
if (context.get().getSender() != null && this.pageName != null) { if (context.get().getSender() != null && this.pageName != null) {
PlayerEntity player = context.get().getSender(); PlayerEntity player = context.get().getSender();
if (player != null) {
ItemStack is = player.getHeldItem(Hand.MAIN_HAND); ItemStack is = player.getHeldItem(Hand.MAIN_HAND);
if (!is.isEmpty()) {
if (!is.isEmpty()) { BookHelper.writeSavedPage(is, this.pageName);
BookHelper.writeSavedPage(is, this.pageName); }
} }
} }
}); });
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.network.book;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.network;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -22,7 +22,6 @@ import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.wrapper.InvWrapper; import net.minecraftforge.items.wrapper.InvWrapper;
import slimeknights.mantle.util.ItemStackList; import slimeknights.mantle.util.ItemStackList;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
// Updated version of InventoryLogic in Mantle. Also contains a few bugfixes DOES NOT OVERRIDE createMenu // Updated version of InventoryLogic in Mantle. Also contains a few bugfixes DOES NOT OVERRIDE createMenu
@@ -56,7 +55,7 @@ public abstract class InventoryTileEntity extends MantleTileEntity implements II
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(@Nonnull Capability<T> capability, Direction facing) { public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(Capability<T> capability, @Nullable Direction facing) {
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
return this.itemHandlerCap.cast(); return this.itemHandlerCap.cast();
} }
@@ -69,7 +68,6 @@ public abstract class InventoryTileEntity extends MantleTileEntity implements II
/* Inventory management */ /* Inventory management */
@Nonnull
@Override @Override
public ItemStack getStackInSlot(int slot) { public ItemStack getStackInSlot(int slot) {
if (slot < 0 || slot >= this.inventory.size()) { if (slot < 0 || slot >= this.inventory.size()) {
@@ -115,7 +113,7 @@ public abstract class InventoryTileEntity extends MantleTileEntity implements II
} }
@Override @Override
public void setInventorySlotContents(int slot, @Nonnull ItemStack itemstack) { public void setInventorySlotContents(int slot, ItemStack itemstack) {
if (slot < 0 || slot >= this.inventory.size()) { if (slot < 0 || slot >= this.inventory.size()) {
return; return;
} }
@@ -131,7 +129,6 @@ public abstract class InventoryTileEntity extends MantleTileEntity implements II
} }
} }
@Nonnull
@Override @Override
public ItemStack decrStackSize(int slot, int quantity) { public ItemStack decrStackSize(int slot, int quantity) {
if (quantity <= 0) { if (quantity <= 0) {
@@ -163,7 +160,6 @@ public abstract class InventoryTileEntity extends MantleTileEntity implements II
return itemStack; return itemStack;
} }
@Nonnull
@Override @Override
public ItemStack removeStackFromSlot(int slot) { public ItemStack removeStackFromSlot(int slot) {
ItemStack itemStack = this.getStackInSlot(slot); ItemStack itemStack = this.getStackInSlot(slot);
@@ -172,7 +168,7 @@ public abstract class InventoryTileEntity extends MantleTileEntity implements II
} }
@Override @Override
public boolean isItemValidForSlot(int slot, @Nonnull ItemStack itemstack) { public boolean isItemValidForSlot(int slot, ItemStack itemstack) {
if (slot < this.getSizeInventory()) { if (slot < this.getSizeInventory()) {
return this.inventory.get(slot).isEmpty() || itemstack.getCount() + this.inventory.get(slot).getCount() <= this.getInventoryStackLimit(); return this.inventory.get(slot).isEmpty() || itemstack.getCount() + this.inventory.get(slot).getCount() <= this.getInventoryStackLimit();
} }
@@ -186,7 +182,6 @@ public abstract class InventoryTileEntity extends MantleTileEntity implements II
} }
} }
@Nonnull
@Override @Override
public ITextComponent getName() { public ITextComponent getName() {
return this.inventoryTitle; return this.inventoryTitle;
@@ -207,7 +202,6 @@ public abstract class InventoryTileEntity extends MantleTileEntity implements II
return this.inventoryTitle; return this.inventoryTitle;
} }
@Nonnull
@Override @Override
public ITextComponent getDisplayName() { public ITextComponent getDisplayName() {
if (this.hasCustomName()) { if (this.hasCustomName()) {
@@ -219,9 +213,9 @@ public abstract class InventoryTileEntity extends MantleTileEntity implements II
/* Supporting methods */ /* Supporting methods */
@Override @Override
public boolean isUsableByPlayer(@Nonnull PlayerEntity entityplayer) { public boolean isUsableByPlayer(PlayerEntity entityplayer) {
// block changed/got broken? // block changed/got broken?
if (this.world.getTileEntity(this.pos) != this || this.world.getBlockState(this.pos).getBlock() == Blocks.AIR) { if (world == null || this.world.getTileEntity(this.pos) != this || this.getBlockState().getBlock() == Blocks.AIR) {
return false; return false;
} }
@@ -229,14 +223,10 @@ public abstract class InventoryTileEntity extends MantleTileEntity implements II
} }
@Override @Override
public void openInventory(@Nonnull PlayerEntity player) { public void openInventory(PlayerEntity player) {}
}
@Override @Override
public void closeInventory(@Nonnull PlayerEntity player) { public void closeInventory(PlayerEntity player) {}
}
/* NBT */ /* NBT */
@Override @Override
@@ -250,8 +240,7 @@ public abstract class InventoryTileEntity extends MantleTileEntity implements II
this.inventoryTitle = ITextComponent.Serializer.func_240643_a_(tags.getString("CustomName")); this.inventoryTitle = ITextComponent.Serializer.func_240643_a_(tags.getString("CustomName"));
} }
} }
@Nonnull
@Override @Override
public CompoundNBT write(CompoundNBT tags) { public CompoundNBT write(CompoundNBT tags) {
super.write(tags); super.write(tags);
@@ -296,8 +285,7 @@ public abstract class InventoryTileEntity extends MantleTileEntity implements II
for (int i = 0; i < nbttaglist.size(); ++i) { for (int i = 0; i < nbttaglist.size(); ++i) {
CompoundNBT itemTag = nbttaglist.getCompound(i); CompoundNBT itemTag = nbttaglist.getCompound(i);
int slot = itemTag.getByte("Slot") & 255; int slot = itemTag.getByte("Slot") & 255;
if (slot < this.inventory.size()) {
if (slot >= 0 && slot < this.inventory.size()) {
stack = ItemStack.read(itemTag); stack = ItemStack.read(itemTag);
if (!stack.isEmpty() && stack.getCount() > limit) { if (!stack.isEmpty() && stack.getCount() > limit) {
stack.setCount(limit); stack.setCount(limit);
@@ -308,7 +296,6 @@ public abstract class InventoryTileEntity extends MantleTileEntity implements II
} }
/* Default implementations of hardly used methods */ /* Default implementations of hardly used methods */
@Nonnull
public ItemStack getStackInSlotOnClosing(int slot) { public ItemStack getStackInSlotOnClosing(int slot) {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.tileentity;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -4,7 +4,6 @@ import com.google.common.collect.FluentIterable;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.UnmodifiableListIterator; import com.google.common.collect.UnmodifiableListIterator;
import javax.annotation.Nonnull;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@@ -40,21 +39,18 @@ public class ImmutableConcatList<E> implements List<E> {
return this.iterable.contains(o); return this.iterable.contains(o);
} }
@Nonnull
@Override @Override
public Iterator<E> iterator() { public Iterator<E> iterator() {
return this.iterable.iterator(); return this.iterable.iterator();
} }
@Nonnull
@Override @Override
public Object[] toArray() { public Object[] toArray() {
return this.iterable.toList().toArray(); return this.iterable.toList().toArray();
} }
@Nonnull
@Override @Override
public <T> T[] toArray(@Nonnull T[] a) { public <T> T[] toArray(T[] a) {
return this.iterable.toList().toArray(a); return this.iterable.toList().toArray(a);
} }
@@ -69,7 +65,7 @@ public class ImmutableConcatList<E> implements List<E> {
} }
@Override @Override
public boolean containsAll(@Nonnull Collection<?> c) { public boolean containsAll(Collection<?> c) {
for (Object e : c) { for (Object e : c) {
if (!this.contains(e)) { if (!this.contains(e)) {
return false; return false;
@@ -79,22 +75,22 @@ public class ImmutableConcatList<E> implements List<E> {
} }
@Override @Override
public boolean addAll(@Nonnull Collection<? extends E> c) { public boolean addAll(Collection<? extends E> c) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override @Override
public boolean addAll(int index, @Nonnull Collection<? extends E> c) { public boolean addAll(int index, Collection<? extends E> c) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override @Override
public boolean removeAll(@Nonnull Collection<?> c) { public boolean removeAll(Collection<?> c) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override @Override
public boolean retainAll(@Nonnull Collection<?> c) { public boolean retainAll(Collection<?> c) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@@ -148,13 +144,11 @@ public class ImmutableConcatList<E> implements List<E> {
return j; return j;
} }
@Nonnull
@Override @Override
public ListIterator<E> listIterator() { public ListIterator<E> listIterator() {
return this.listIterator(0); return this.listIterator(0);
} }
@Nonnull
@Override @Override
public ListIterator<E> listIterator(int index) { public ListIterator<E> listIterator(int index) {
return new ListItr<E>(this.size(), index) { return new ListItr<E>(this.size(), index) {
@@ -165,7 +159,6 @@ public class ImmutableConcatList<E> implements List<E> {
}; };
} }
@Nonnull
@Override @Override
public List<E> subList(int fromIndex, int toIndex) { public List<E> subList(int fromIndex, int toIndex) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
@@ -8,6 +8,7 @@ import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.fml.ForgeI18n; import net.minecraftforge.fml.ForgeI18n;
import javax.annotation.Nullable;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@@ -51,7 +52,8 @@ public abstract class LocUtils {
return list; return list;
} }
public static String convertNewlines(String line) { @Nullable
public static String convertNewlines(@Nullable String line) {
if (line == null) { if (line == null) {
return null; return null;
} }
@@ -1,19 +1,24 @@
package slimeknights.mantle.util; package slimeknights.mantle.util;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.ListNBT;
import net.minecraft.nbt.StringNBT; import net.minecraft.nbt.StringNBT;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.Constants.NBT;
import javax.annotation.Nullable;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class TagHelper { public class TagHelper {
/**
public static int TAG_TYPE_STRING = (StringNBT.valueOf("")).getId(); * Gets the tag from a stack, or an empty tag if the stack has none
public static int TAG_TYPE_COMPOUND = (new CompoundNBT()).getId(); * @param stack Stack to fetch tag
* @return Stack tag or an empty tag
private TagHelper() { */
} @SuppressWarnings("ConstantConditions")
/* Generic Tag Operations */
public static CompoundNBT getTagSafe(ItemStack stack) { public static CompoundNBT getTagSafe(ItemStack stack) {
if (stack.isEmpty() || !stack.hasTag()) { if (stack.isEmpty() || !stack.hasTag()) {
return new CompoundNBT(); return new CompoundNBT();
@@ -22,20 +27,30 @@ public class TagHelper {
return stack.getTag(); return stack.getTag();
} }
public static CompoundNBT getTagSafe(CompoundNBT tag, String key) { /**
if (tag == null || !tag.contains(key)) { * Gets the value from the given tag
* @param tag Parent tag
* @param key Key to get
* @return Compound at the key, or empty tag if no value
*/
public static CompoundNBT getTagSafe(@Nullable CompoundNBT tag, String key) {
if (tag == null || !tag.contains(key, NBT.TAG_COMPOUND)) {
return new CompoundNBT(); return new CompoundNBT();
} }
return tag.getCompound(key); return tag.getCompound(key);
} }
public static ListNBT getTagListSafe(CompoundNBT tag, String key, int type) { /**
if (tag == null || !tag.contains(key)) { * Gets a tag list from an object, or an empty list if its missing
* @param tag Parent tag
* @param key List key
* @param type List type
* @return List at key, or empty list if missing
*/
public static ListNBT getTagListSafe(@Nullable CompoundNBT tag, String key, int type) {
if (tag == null || !tag.contains(key, NBT.TAG_LIST)) {
return new ListNBT(); return new ListNBT();
} }
return tag.getList(key, type); return tag.getList(key, type);
} }
} }
@@ -6,18 +6,17 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldReader;
import slimeknights.mantle.Mantle; import slimeknights.mantle.Mantle;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class TileEntityUtil { public class TileEntityUtil {
@Nullable @Nullable
public static <T extends TileEntity> T getTileEntity(@Nonnull Class<T> clazz, @Nullable IBlockReader world, @Nonnull BlockPos pos) { public static <T extends TileEntity> T getTileEntity(Class<T> clazz, @Nullable IBlockReader world, BlockPos pos) {
return getTileEntity(clazz, world, pos, false); return getTileEntity(clazz, world, pos, false);
} }
@Nullable @Nullable
public static <T extends TileEntity> T getTileEntity(@Nonnull Class<T> clazz, @Nullable IBlockReader world, @Nonnull BlockPos pos, boolean logWrongType) { public static <T extends TileEntity> T getTileEntity(Class<T> clazz, @Nullable IBlockReader world, BlockPos pos, boolean logWrongType) {
if (!isBlockLoaded(world, pos)) { if (!isBlockLoaded(world, pos)) {
return null; return null;
} }
@@ -38,7 +37,7 @@ public class TileEntityUtil {
return null; return null;
} }
public static boolean isBlockLoaded(@Nullable IBlockReader world, @Nonnull BlockPos pos) { public static boolean isBlockLoaded(@Nullable IBlockReader world, BlockPos pos) {
if (world == null) { if (world == null) {
return false; return false;
} }
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.mantle.util;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;