mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-19 11:49:08 +00:00
Mappings bump, nullable/nonnull annotations
This commit is contained in:
1 parent
744f2ab0ab
commit
141ce60e53
29 files changed
+152
-48
No files matched your search
@@ -15,6 +15,8 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import slimeknights.mantle.tileentity.TileInventory;
|
||||
|
||||
// Updated Version of InventoryBlock in Mantle
|
||||
@@ -30,8 +32,9 @@ public abstract class BlockInventory extends BlockContainer {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public abstract TileEntity createNewTileEntity(World worldIn, int meta);
|
||||
public abstract TileEntity createNewTileEntity(@Nonnull World worldIn, int meta);
|
||||
|
||||
/**
|
||||
* Called when the block is activated. Return true if a GUI is opened, false if the block has no GUI.
|
||||
@@ -68,7 +71,7 @@ public abstract class BlockInventory extends BlockContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
|
||||
public void breakBlock(World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
|
||||
if(tileentity instanceof TileInventory) {
|
||||
@@ -86,6 +89,7 @@ public abstract class BlockInventory extends BlockContainer {
|
||||
|
||||
// BlockContainer sets this to invisible
|
||||
// we need model for standard forge rendering
|
||||
@Nonnull
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
|
||||
@@ -14,6 +14,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class EnumBlock<E extends Enum<E> & EnumBlock.IEnumMeta & IStringSerializable> extends Block {
|
||||
|
||||
public final PropertyEnum<E> prop;
|
||||
@@ -35,12 +37,13 @@ public class EnumBlock<E extends Enum<E> & EnumBlock.IEnumMeta & IStringSerializ
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) {
|
||||
public void getSubBlocks(@Nonnull Item itemIn, CreativeTabs tab, List<ItemStack> list) {
|
||||
for(E type : values) {
|
||||
list.add(new ItemStack(this, 1, type.getMeta()));
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
if(prop == null) {
|
||||
@@ -49,6 +52,7 @@ public class EnumBlock<E extends Enum<E> & EnumBlock.IEnumMeta & IStringSerializ
|
||||
return new BlockStateContainer(this, prop);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(prop, fromMeta(meta));
|
||||
|
||||
@@ -15,6 +15,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public abstract class EnumBlockSlab<E extends Enum<E> & EnumBlock.IEnumMeta & IStringSerializable> extends BlockSlab {
|
||||
|
||||
public final PropertyEnum<E> prop;
|
||||
@@ -37,12 +39,13 @@ public abstract class EnumBlockSlab<E extends Enum<E> & EnumBlock.IEnumMeta & IS
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) {
|
||||
public void getSubBlocks(@Nonnull Item itemIn, CreativeTabs tab, List<ItemStack> list) {
|
||||
for(E type : values) {
|
||||
list.add(new ItemStack(this, 1, type.getMeta()));
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
if(prop == null) {
|
||||
@@ -55,6 +58,7 @@ public abstract class EnumBlockSlab<E extends Enum<E> & EnumBlock.IEnumMeta & IS
|
||||
/**
|
||||
* Convert the given metadata into a BlockState for this Block
|
||||
*/
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState()
|
||||
@@ -90,16 +94,19 @@ public abstract class EnumBlockSlab<E extends Enum<E> & EnumBlock.IEnumMeta & IS
|
||||
return values[meta];
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IProperty<?> getVariantProperty() {
|
||||
return prop;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Comparable<?> getTypeForItem(ItemStack stack) {
|
||||
public Comparable<?> getTypeForItem(@Nonnull ItemStack stack) {
|
||||
return fromMeta(stack.getItemDamage() & 7);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUnlocalizedName(int meta) {
|
||||
return super.getUnlocalizedName() + "." + fromMeta(meta & 7).getName();
|
||||
|
||||
@@ -6,6 +6,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class CreativeTab extends CreativeTabs {
|
||||
|
||||
private ItemStack icon;
|
||||
@@ -23,6 +25,7 @@ public class CreativeTab extends CreativeTabs {
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
@@ -35,6 +38,7 @@ public class CreativeTab extends CreativeTabs {
|
||||
return icon.getItemDamage();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Item getTabIconItem() {
|
||||
|
||||
@@ -16,6 +16,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import slimeknights.mantle.Mantle;
|
||||
import slimeknights.mantle.client.book.action.StringActionProcessor;
|
||||
import slimeknights.mantle.client.book.action.protocol.ProtocolGoToPage;
|
||||
@@ -165,7 +167,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
|
||||
*/
|
||||
@Override
|
||||
public void onResourceManagerReload(IResourceManager resourceManager) {
|
||||
public void onResourceManagerReload(@Nonnull IResourceManager resourceManager) {
|
||||
Mantle.logger.info("Started loading books...");
|
||||
long time = System.nanoTime();
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import slimeknights.mantle.Mantle;
|
||||
import slimeknights.mantle.inventory.ContainerMultiModule;
|
||||
import slimeknights.mantle.inventory.SlotWrapper;
|
||||
@@ -148,7 +150,7 @@ public class GuiMultiModule extends GuiContainer { //implements INEIGuiHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResize(Minecraft mc, int width, int height) {
|
||||
public void onResize(@Nonnull Minecraft mc, int width, int height) {
|
||||
super.onResize(mc, width, height);
|
||||
|
||||
for(GuiModule module : modules) {
|
||||
|
||||
@@ -7,6 +7,8 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import static slimeknights.mantle.client.gui.book.Textures.TEX_BOOK;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -31,7 +33,7 @@ public class GuiArrow extends GuiButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
public void drawButton(@Nonnull Minecraft mc, int mouseX, int mouseY) {
|
||||
if(this.visible) {
|
||||
mc.getTextureManager().bindTexture(TEX_BOOK);
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import slimeknights.mantle.client.book.data.BookmarkData;
|
||||
|
||||
public class GuiBookmark extends GuiButton {
|
||||
@@ -30,7 +32,7 @@ public class GuiBookmark extends GuiButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
public void drawButton(@Nonnull Minecraft mc, int mouseX, int mouseY) {
|
||||
if(visible) {
|
||||
int tex_y = TEX_Y + HEIGHT * type;
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@ import org.lwjgl.opengl.GL11;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import slimeknights.mantle.client.book.data.element.BlockData;
|
||||
import slimeknights.mantle.client.book.data.element.ItemStackData;
|
||||
|
||||
@@ -261,7 +263,7 @@ public class ElementStructure extends SizedBookElement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity(BlockPos pos) {
|
||||
public TileEntity getTileEntity(@Nonnull BlockPos pos) {
|
||||
if(!isValid(pos)) {
|
||||
return null;
|
||||
}
|
||||
@@ -269,12 +271,13 @@ public class ElementStructure extends SizedBookElement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCombinedLight(BlockPos pos, int lightValue) {
|
||||
public int getCombinedLight(@Nonnull BlockPos pos, int lightValue) {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBlockState getBlockState(BlockPos pos) {
|
||||
public IBlockState getBlockState(@Nonnull BlockPos pos) {
|
||||
if(!isValid(pos)) {
|
||||
return Blocks.AIR.getDefaultState();
|
||||
}
|
||||
@@ -287,12 +290,13 @@ public class ElementStructure extends SizedBookElement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAirBlock(BlockPos pos) {
|
||||
public boolean isAirBlock(@Nonnull BlockPos pos) {
|
||||
return !isValid(pos) || Block.getBlockById(blocks[pos.getX()][pos.getY()][pos.getZ()]) == Blocks.AIR;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Biome getBiome(BlockPos blockPos) {
|
||||
public Biome getBiome(@Nonnull BlockPos blockPos) {
|
||||
return Biomes.JUNGLE;
|
||||
}
|
||||
|
||||
@@ -302,7 +306,7 @@ public class ElementStructure extends SizedBookElement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStrongPower(BlockPos pos, EnumFacing direction) {
|
||||
public int getStrongPower(@Nonnull BlockPos pos, @Nonnull EnumFacing direction) {
|
||||
if(!isValid(pos)) {
|
||||
return 0;
|
||||
}
|
||||
@@ -311,13 +315,14 @@ public class ElementStructure extends SizedBookElement {
|
||||
return iblockstate.getBlock().getStrongPower(iblockstate, this, pos, direction);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public WorldType getWorldType() {
|
||||
return WorldType.DEFAULT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) {
|
||||
public boolean isSideSolid(@Nonnull BlockPos pos, @Nonnull EnumFacing side, boolean _default) {
|
||||
if(!this.isValid(pos)) {
|
||||
return _default;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ import net.minecraft.util.EnumFacing;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Groups multiple baked models into a single one. Does not respect state etc. when getting quads.
|
||||
* Best use the Builder to create a BakedCompositeModel.
|
||||
@@ -25,6 +27,7 @@ public class BakedCompositeModel extends BakedWrapper {
|
||||
this.parts = parts;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
|
||||
return parts.get(Optional.fromNullable(side));
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.vecmath.Matrix4f;
|
||||
|
||||
public class BakedSimple implements IPerspectiveAwareModel {
|
||||
@@ -59,6 +60,7 @@ public class BakedSimple implements IPerspectiveAwareModel {
|
||||
this.overrides = overrides;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
|
||||
return quads;
|
||||
@@ -79,16 +81,19 @@ public class BakedSimple implements IPerspectiveAwareModel {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture() {
|
||||
return particle;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemCameraTransforms getItemCameraTransforms() {
|
||||
return ItemCameraTransforms.DEFAULT;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemOverrideList getOverrides() {
|
||||
return overrides;
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.vecmath.Matrix4f;
|
||||
|
||||
public class BakedWrapper implements IBakedModel {
|
||||
@@ -26,6 +27,7 @@ public class BakedWrapper implements IBakedModel {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
|
||||
return parent.getQuads(state, side, rand);
|
||||
@@ -46,16 +48,19 @@ public class BakedWrapper implements IBakedModel {
|
||||
return parent.isBuiltInRenderer();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture() {
|
||||
return parent.getParticleTexture();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemCameraTransforms getItemCameraTransforms() {
|
||||
return parent.getItemCameraTransforms();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemOverrideList getOverrides() {
|
||||
return parent.getOverrides();
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.vecmath.Matrix4f;
|
||||
|
||||
import slimeknights.mantle.client.ModelHelper;
|
||||
@@ -42,6 +43,7 @@ public class BlockItemModelWrapper implements IPerspectiveAwareModel, IBakedMode
|
||||
return Pair.of(this, matrix);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
|
||||
return parent.getQuads(state, side, rand);
|
||||
@@ -62,16 +64,19 @@ public class BlockItemModelWrapper implements IPerspectiveAwareModel, IBakedMode
|
||||
return parent.isBuiltInRenderer();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture() {
|
||||
return parent.getParticleTexture();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemCameraTransforms getItemCameraTransforms() {
|
||||
return parent.getItemCameraTransforms();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemOverrideList getOverrides() {
|
||||
return null;
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.minecraftforge.client.model.pipeline.VertexTransformer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.vecmath.Matrix3f;
|
||||
import javax.vecmath.Matrix4f;
|
||||
import javax.vecmath.Vector3f;
|
||||
@@ -68,6 +69,7 @@ public class TRSRBakedModel implements IBakedModel {
|
||||
this.transformation = TRSRTransformation.blockCenterToCorner(t);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
|
||||
// transform quads obtained from parent
|
||||
@@ -106,16 +108,19 @@ public class TRSRBakedModel implements IBakedModel {
|
||||
return original.isBuiltInRenderer();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture() {
|
||||
return original.getParticleTexture();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemCameraTransforms getItemCameraTransforms() {
|
||||
return original.getItemCameraTransforms();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemOverrideList getOverrides() {
|
||||
return override;
|
||||
@@ -131,8 +136,9 @@ public class TRSRBakedModel implements IBakedModel {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) {
|
||||
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, ItemStack stack, @Nonnull World world, @Nonnull EntityLivingBase entity) {
|
||||
IBakedModel baked = model.original.getOverrides().handleItemState(originalModel, stack, world, entity);
|
||||
|
||||
return new TRSRBakedModel(baked, model.transformation);
|
||||
|
||||
@@ -23,6 +23,8 @@ import net.minecraftforge.items.wrapper.EmptyHandler;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import slimeknights.mantle.util.SlimeknightException;
|
||||
|
||||
/** Same as Container but provides some extra functionality to simplify things */
|
||||
@@ -102,7 +104,7 @@ public abstract class BaseContainer<T extends TileEntity> extends Container {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer playerIn) {
|
||||
public boolean canInteractWith(@Nonnull EntityPlayer playerIn) {
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
// does the block we interacted with still exist?
|
||||
if(block == Blocks.AIR || block != originalBlock) {
|
||||
@@ -115,6 +117,7 @@ public abstract class BaseContainer<T extends TileEntity> extends Container {
|
||||
(double) pos.getZ() + 0.5d) <= maxDist;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<ItemStack> getInventory() {
|
||||
@@ -163,6 +166,7 @@ public abstract class BaseContainer<T extends TileEntity> extends Container {
|
||||
playerInventoryStart = start;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
protected Slot addSlotToContainer(Slot slotIn) {
|
||||
if(playerInventoryStart >= 0) {
|
||||
|
||||
@@ -21,6 +21,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class ContainerMultiModule<T extends TileEntity & IInventory> extends BaseContainer<T> {
|
||||
|
||||
public List<Container> subContainers = Lists.newArrayList();
|
||||
@@ -86,7 +88,7 @@ public class ContainerMultiModule<T extends TileEntity & IInventory> extends Bas
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer playerIn) {
|
||||
public boolean canInteractWith(@Nonnull EntityPlayer playerIn) {
|
||||
// check if subcontainers are valid
|
||||
for(Container sub : subContainers) {
|
||||
if(!sub.canInteractWith(playerIn)) {
|
||||
|
||||
@@ -6,6 +6,8 @@ import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.inventory.SlotCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class SlotCraftingCustom extends SlotCrafting {
|
||||
|
||||
private final InventoryCrafting craftMatrix;
|
||||
@@ -25,7 +27,7 @@ public class SlotCraftingCustom extends SlotCrafting {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) {
|
||||
public void onPickupFromSlot(EntityPlayer playerIn, @Nonnull ItemStack stack) {
|
||||
net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, craftMatrix);
|
||||
this.onCrafting(stack);
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Used to wrap the slots inside Modules/Subcontainers
|
||||
*/
|
||||
@@ -78,6 +80,7 @@ public class SlotWrapper extends Slot {
|
||||
return parent.getSlotTexture();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack decrStackSize(int amount) {
|
||||
return parent.decrStackSize(amount);
|
||||
@@ -88,23 +91,25 @@ public class SlotWrapper extends Slot {
|
||||
return parent.isHere(inv, slotIn);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ResourceLocation getBackgroundLocation() {
|
||||
return parent.getBackgroundLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBackgroundName(String name) {
|
||||
public void setBackgroundName(@Nonnull String name) {
|
||||
parent.setBackgroundName(name);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public TextureAtlasSprite getBackgroundSprite() {
|
||||
return parent.getBackgroundSprite();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBackgroundLocation(ResourceLocation texture) {
|
||||
public void setBackgroundLocation(@Nonnull ResourceLocation texture) {
|
||||
parent.setBackgroundLocation(texture);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import slimeknights.mantle.util.LocUtils;
|
||||
|
||||
public class ItemBlockMeta extends ItemColored {
|
||||
@@ -30,8 +32,9 @@ public class ItemBlockMeta extends ItemColored {
|
||||
super(block, true);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
public String getUnlocalizedName(@Nonnull ItemStack stack) {
|
||||
if(mappingProperty == null) {
|
||||
return super.getUnlocalizedName(stack);
|
||||
}
|
||||
@@ -46,7 +49,7 @@ public class ItemBlockMeta extends ItemColored {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||
public void addInformation(@Nonnull ItemStack stack, @Nonnull EntityPlayer playerIn, @Nonnull List<String> tooltip, boolean advanced) {
|
||||
if(I18n.canTranslate(this.getUnlocalizedName(stack) + ".tooltip")) {
|
||||
tooltip.addAll(LocUtils.getTooltips(TextFormatting.GRAY.toString() +
|
||||
LocUtils.translateRecursive(this.getUnlocalizedName(stack) + ".tooltip")));
|
||||
|
||||
@@ -23,6 +23,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import slimeknights.mantle.block.EnumBlockSlab;
|
||||
|
||||
public class ItemBlockSlab extends ItemBlockMeta {
|
||||
@@ -37,8 +39,9 @@ public class ItemBlockSlab extends ItemBlockMeta {
|
||||
/**
|
||||
* Called when a Block is right-clicked with this Item
|
||||
*/
|
||||
@Nonnull
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
public EnumActionResult onItemUse(ItemStack stack, @Nonnull EntityPlayer player, World world, @Nonnull BlockPos pos, EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
// don't place the slab if unable to edit
|
||||
if(stack.stackSize != 0 && player.canPlayerEdit(pos.offset(facing), facing, stack)) {
|
||||
|
||||
@@ -61,7 +64,7 @@ public class ItemBlockSlab extends ItemBlockMeta {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean canPlaceBlockOnSide(World world, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) {
|
||||
public boolean canPlaceBlockOnSide(World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, EntityPlayer player, @Nonnull ItemStack stack) {
|
||||
BlockPos oldPos = pos;
|
||||
Comparable<?> type = this.slab.getTypeForItem(stack);
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
|
||||
@@ -16,6 +16,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class ItemEdible extends ItemFood {
|
||||
|
||||
// we use this so we don't have to copy all the logic
|
||||
@@ -67,7 +69,7 @@ public class ItemEdible extends ItemFood {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) {
|
||||
protected void onFoodEaten(ItemStack stack, World worldIn, @Nonnull EntityPlayer player) {
|
||||
if(!worldIn.isRemote) {
|
||||
for(PotionEffect potion : potionEffects.get(stack.getMetadata())) {
|
||||
player.addPotionEffect(new PotionEffect(potion.getPotion(), potion.getDuration(), potion.getAmplifier(), potion
|
||||
@@ -77,12 +79,14 @@ public class ItemEdible extends ItemFood {
|
||||
}
|
||||
|
||||
/* ItemMetaDynamic Functionality */
|
||||
@Nonnull
|
||||
@Override
|
||||
public Item setUnlocalizedName(String unlocalizedName) {
|
||||
public Item setUnlocalizedName(@Nonnull String unlocalizedName) {
|
||||
dynamic.setUnlocalizedName(unlocalizedName);
|
||||
return super.setUnlocalizedName(unlocalizedName);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return dynamic.getUnlocalizedName(stack);
|
||||
@@ -100,7 +104,7 @@ public class ItemEdible extends ItemFood {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
|
||||
public void getSubItems(@Nonnull Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
|
||||
dynamic.getSubItems(itemIn, tab, subItems);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import slimeknights.mantle.util.LocUtils;
|
||||
|
||||
/**
|
||||
@@ -65,6 +67,7 @@ public class ItemMetaDynamic extends Item {
|
||||
return new ItemStack(this, 1, meta);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
int meta = stack.getMetadata(); // should call getMetadata below
|
||||
@@ -77,7 +80,7 @@ public class ItemMetaDynamic extends Item {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
|
||||
public void getSubItems(@Nonnull Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
|
||||
for(int i = 0; i <= availabilityMask.length; i++) {
|
||||
if(isValid(i)) {
|
||||
subItems.add(new ItemStack(itemIn, 1, i));
|
||||
|
||||
@@ -12,6 +12,8 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameData;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class MultiServantLogic extends TileEntity implements IServantLogic {
|
||||
|
||||
boolean hasMaster;
|
||||
@@ -131,6 +133,7 @@ public class MultiServantLogic extends TileEntity implements IServantLogic {
|
||||
this.readCustomNBT(tags);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tags) {
|
||||
tags = super.writeToNBT(tags);
|
||||
@@ -138,6 +141,7 @@ public class MultiServantLogic extends TileEntity implements IServantLogic {
|
||||
}
|
||||
|
||||
/* Packets */
|
||||
@Nonnull
|
||||
@Override
|
||||
public NBTTagCompound getUpdateTag() {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
@@ -153,6 +157,7 @@ public class MultiServantLogic extends TileEntity implements IServantLogic {
|
||||
this.worldObj.notifyBlockUpdate(this.pos, state, state, 3);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return this.worldObj;
|
||||
|
||||
@@ -10,6 +10,8 @@ import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Mantle specific pulsar addon class to support using the forge CFG format for configurations
|
||||
* @author progwml6
|
||||
@@ -45,7 +47,7 @@ public class ForgeCFG implements IConfiguration
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModuleEnabled(PulseMeta meta)
|
||||
public boolean isModuleEnabled(@Nonnull PulseMeta meta)
|
||||
{
|
||||
Property prop = config.get(this.description, meta.getId(), meta.isEnabled(), meta.getDescription());
|
||||
prop.setRequiresMcRestart(true);
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.apache.logging.log4j.Logger;
|
||||
import slimeknights.mantle.pulsar.config.IConfiguration;
|
||||
import slimeknights.mantle.pulsar.pulse.PulseMeta;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
/**
|
||||
@@ -52,7 +53,7 @@ public class Configuration implements IConfiguration {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModuleEnabled(PulseMeta meta) {
|
||||
public boolean isModuleEnabled(@Nonnull PulseMeta meta) {
|
||||
ConfigEntry entry = modules.get(meta.getId());
|
||||
if (entry == null) {
|
||||
modules.put(meta.getId(), new ConfigEntry(meta.isDefaultEnabled(), meta.getDescription()));
|
||||
|
||||
@@ -19,6 +19,8 @@ import net.minecraftforge.items.wrapper.InvWrapper;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
// Updated version of InventoryLogic in Mantle. Also contains a few bugfixes
|
||||
public class TileInventory extends TileEntity implements IInventory {
|
||||
|
||||
@@ -46,12 +48,13 @@ public class TileInventory extends TileEntity implements IInventory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nonnull EnumFacing facing) {
|
||||
return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nonnull EnumFacing facing) {
|
||||
if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||
return (T) itemHandler;
|
||||
}
|
||||
@@ -138,7 +141,7 @@ public class TileInventory extends TileEntity implements IInventory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack itemstack) {
|
||||
public boolean isItemValidForSlot(int slot, @Nonnull ItemStack itemstack) {
|
||||
if(slot < getSizeInventory()) {
|
||||
if(inventory[slot] == null || itemstack.stackSize + inventory[slot].stackSize <= getInventoryStackLimit()) {
|
||||
return true;
|
||||
@@ -154,6 +157,7 @@ public class TileInventory extends TileEntity implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.inventoryTitle;
|
||||
@@ -169,6 +173,7 @@ public class TileInventory extends TileEntity implements IInventory {
|
||||
this.inventoryTitle = customName;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ITextComponent getDisplayName() {
|
||||
if(hasCustomName()) {
|
||||
@@ -181,7 +186,7 @@ public class TileInventory extends TileEntity implements IInventory {
|
||||
|
||||
/* Supporting methods */
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
public boolean isUseableByPlayer(@Nonnull EntityPlayer entityplayer) {
|
||||
// block changed/got broken?
|
||||
if(worldObj.getTileEntity(pos) != this || worldObj.getBlockState(pos).getBlock() == Blocks.AIR) {
|
||||
return false;
|
||||
@@ -193,12 +198,12 @@ public class TileInventory extends TileEntity implements IInventory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory(EntityPlayer player) {
|
||||
public void openInventory(@Nonnull EntityPlayer player) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory(EntityPlayer player) {
|
||||
public void closeInventory(@Nonnull EntityPlayer player) {
|
||||
|
||||
}
|
||||
|
||||
@@ -215,6 +220,7 @@ public class TileInventory extends TileEntity implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tags) {
|
||||
super.writeToNBT(tags);
|
||||
|
||||
@@ -10,6 +10,8 @@ import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkPositionIndex;
|
||||
|
||||
public class ImmutableConcatList<E> implements List<E> {
|
||||
@@ -39,18 +41,21 @@ public class ImmutableConcatList<E> implements List<E> {
|
||||
return iterable.contains(o);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Iterator<E> iterator() {
|
||||
return iterable.iterator();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return iterable.toList().toArray();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public <T> T[] toArray(T[] a) {
|
||||
public <T> T[] toArray(@Nonnull T[] a) {
|
||||
return iterable.toList().toArray(a);
|
||||
}
|
||||
|
||||
@@ -65,7 +70,7 @@ public class ImmutableConcatList<E> implements List<E> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(Collection<?> c) {
|
||||
public boolean containsAll(@Nonnull Collection<?> c) {
|
||||
for (Object e : c)
|
||||
if (!contains(e))
|
||||
return false;
|
||||
@@ -73,22 +78,22 @@ public class ImmutableConcatList<E> implements List<E> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(Collection<? extends E> c) {
|
||||
public boolean addAll(@Nonnull Collection<? extends E> c) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(int index, Collection<? extends E> c) {
|
||||
public boolean addAll(int index, @Nonnull Collection<? extends E> c) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(Collection<?> c) {
|
||||
public boolean removeAll(@Nonnull Collection<?> c) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(Collection<?> c) {
|
||||
public boolean retainAll(@Nonnull Collection<?> c) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@@ -142,11 +147,13 @@ public class ImmutableConcatList<E> implements List<E> {
|
||||
return j;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ListIterator<E> listIterator() {
|
||||
return listIterator(0);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ListIterator<E> listIterator(int index) {
|
||||
return new ListItr<E>(this.size(), index) {
|
||||
@@ -157,6 +164,7 @@ public class ImmutableConcatList<E> implements List<E> {
|
||||
};
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<E> subList(int fromIndex, int toIndex) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
@@ -17,7 +17,7 @@ import slimeknights.mantle.client.gui.GuiMultiModule;
|
||||
public class JeiPlugin implements IModPlugin {
|
||||
|
||||
@Override
|
||||
public void register(IModRegistry registry) {
|
||||
public void register(@Nonnull IModRegistry registry) {
|
||||
registry.addAdvancedGuiHandlers(new IAdvancedGuiHandler<GuiMultiModule>() {
|
||||
@Nonnull
|
||||
@Override
|
||||
@@ -34,6 +34,6 @@ public class JeiPlugin implements IModPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRuntimeAvailable(IJeiRuntime jeiRuntime) {
|
||||
public void onRuntimeAvailable(@Nonnull IJeiRuntime jeiRuntime) {
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user