diff --git a/src/main/java/cech12/solarcooker/block/AbstractSolarCookerBlock.java b/src/main/java/cech12/solarcooker/block/AbstractSolarCookerBlock.java index b3dfc91..4593bf7 100644 --- a/src/main/java/cech12/solarcooker/block/AbstractSolarCookerBlock.java +++ b/src/main/java/cech12/solarcooker/block/AbstractSolarCookerBlock.java @@ -53,7 +53,8 @@ public boolean isToolEffective(BlockState state, ToolType tool) { } @Override - public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + @Nonnull + public ActionResultType onBlockActivated(@Nonnull BlockState state, World worldIn, @Nonnull BlockPos pos, @Nonnull PlayerEntity player, @Nonnull Hand handIn, @Nonnull BlockRayTraceResult hit) { if (worldIn.isRemote) { return ActionResultType.SUCCESS; } else { @@ -76,7 +77,7 @@ public BlockState getStateForPlacement(BlockItemUseContext context) { * Called by ItemBlocks after a block is set in the world */ @Override - public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) { + public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull BlockState state, LivingEntity placer, ItemStack stack) { if (stack.hasDisplayName()) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof AbstractSolarCookerTileEntity) { @@ -88,7 +89,7 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, Livin @Override @Deprecated - public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) { + public void onReplaced(BlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, BlockState newState, boolean isMoving) { if (!state.isIn(newState.getBlock())) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof AbstractSolarCookerTileEntity) { @@ -101,22 +102,15 @@ public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState } } - /** - * @deprecated call via {@link IBlockState#hasComparatorInputOverride()} whenever possible. Implementing/overriding - * is fine. - */ @Override @Deprecated - public boolean hasComparatorInputOverride(BlockState state) { + public boolean hasComparatorInputOverride(@Nonnull BlockState state) { return true; } - /** - * @deprecated call via {@link IBlockState#getComparatorInputOverride(World - */ @Override @Deprecated - public int getComparatorInputOverride(BlockState blockState, World worldIn, BlockPos pos) { + public int getComparatorInputOverride(@Nonnull BlockState blockState, World worldIn, @Nonnull BlockPos pos) { return Container.calcRedstone(worldIn.getTileEntity(pos)); } @@ -124,7 +118,8 @@ public int getComparatorInputOverride(BlockState blockState, World worldIn, Bloc * The type of render function called. MODEL for mixed tesr and static model */ @Override - public BlockRenderType getRenderType(BlockState state) { + @Nonnull + public BlockRenderType getRenderType(@Nonnull BlockState state) { return BlockRenderType.ENTITYBLOCK_ANIMATED; } @@ -143,6 +138,7 @@ public VoxelShape getShape(@Nonnull BlockState state, IBlockReader worldIn, @Non */ @Override @Deprecated + @Nonnull public BlockState rotate(BlockState state, Rotation rot) { return state.with(FACING, rot.rotate(state.get(FACING))); } @@ -152,6 +148,7 @@ public BlockState rotate(BlockState state, Rotation rot) { */ @Override @Deprecated + @Nonnull public BlockState mirror(BlockState state, Mirror mirrorIn) { return state.rotate(mirrorIn.toRotation(state.get(FACING))); } diff --git a/src/main/java/cech12/solarcooker/block/ReflectorBlock.java b/src/main/java/cech12/solarcooker/block/ReflectorBlock.java index fb623e3..ad3010b 100644 --- a/src/main/java/cech12/solarcooker/block/ReflectorBlock.java +++ b/src/main/java/cech12/solarcooker/block/ReflectorBlock.java @@ -1,14 +1,10 @@ package cech12.solarcooker.block; import net.minecraft.block.Block; -import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; import net.minecraft.block.HorizontalBlock; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; import net.minecraft.item.BlockItemUseContext; import net.minecraft.state.StateContainer; -import net.minecraft.state.properties.ChestType; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; diff --git a/src/main/java/cech12/solarcooker/block/SolarCookerBlock.java b/src/main/java/cech12/solarcooker/block/SolarCookerBlock.java index e84f20f..2d7de34 100644 --- a/src/main/java/cech12/solarcooker/block/SolarCookerBlock.java +++ b/src/main/java/cech12/solarcooker/block/SolarCookerBlock.java @@ -74,7 +74,7 @@ public void setISTER(Item.Properties props) { @Override //render - public void func_239207_a_(@Nonnull ItemStack stack, ItemCameraTransforms.TransformType transformType, @Nonnull MatrixStack matrix, @Nonnull IRenderTypeBuffer buffer, int x, int y) { + public void func_239207_a_(@Nonnull ItemStack stack, @Nonnull ItemCameraTransforms.TransformType transformType, @Nonnull MatrixStack matrix, @Nonnull IRenderTypeBuffer buffer, int x, int y) { if (tile == null) { tile = new SolarCookerTileEntity(); } diff --git a/src/main/java/cech12/solarcooker/client/SolarCookerScreen.java b/src/main/java/cech12/solarcooker/client/SolarCookerScreen.java index 0d43af0..b0d9723 100644 --- a/src/main/java/cech12/solarcooker/client/SolarCookerScreen.java +++ b/src/main/java/cech12/solarcooker/client/SolarCookerScreen.java @@ -10,6 +10,8 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import javax.annotation.Nonnull; + @OnlyIn(Dist.CLIENT) public class SolarCookerScreen extends ContainerScreen { private static final ResourceLocation guiTexture = new ResourceLocation(SolarCookerMod.MOD_ID, "textures/gui/container/solar_cooker.png"); @@ -23,28 +25,30 @@ public void init() { this.field_238742_p_ = (this.xSize - this.font.func_238414_a_(this.title)) / 2; } - public void render(MatrixStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_) { + public void render(@Nonnull MatrixStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_) { this.renderBackground(p_230430_1_); super.render(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_); this.func_230459_a_(p_230430_1_, p_230430_2_, p_230430_3_); } - protected void func_230450_a_(MatrixStack p_230450_1_, float p_230450_2_, int p_230450_3_, int p_230450_4_) { - this.minecraft.getTextureManager().bindTexture(guiTexture); - //draw gui - int left = this.guiLeft; - int top = this.guiTop; - this.blit(p_230450_1_, left, top, 0, 0, this.xSize, this.ySize); - //draw flame - if (this.container.isBurning()) { - this.blit(p_230450_1_, left + 56, top + 36, 176, 0, 14, 14); - } - //draw progress - int progress = this.container.getCookProgressionScaled(); - this.blit(p_230450_1_, left + 79, top + 34, 176, 14, progress + 1, 16); - //draw sun - if (this.container.isSunlit()) { - this.blit(p_230450_1_, left + 55, top + 52, 176, 31, 18, 18); + protected void func_230450_a_(@Nonnull MatrixStack p_230450_1_, float p_230450_2_, int p_230450_3_, int p_230450_4_) { + if (this.minecraft != null) { + this.minecraft.getTextureManager().bindTexture(guiTexture); + //draw gui + int left = this.guiLeft; + int top = this.guiTop; + this.blit(p_230450_1_, left, top, 0, 0, this.xSize, this.ySize); + //draw flame + if (this.container.isBurning()) { + this.blit(p_230450_1_, left + 56, top + 36, 176, 0, 14, 14); + } + //draw progress + int progress = this.container.getCookProgressionScaled(); + this.blit(p_230450_1_, left + 79, top + 34, 176, 14, progress + 1, 16); + //draw sun + if (this.container.isSunlit()) { + this.blit(p_230450_1_, left + 55, top + 52, 176, 31, 18, 18); + } } } diff --git a/src/main/java/cech12/solarcooker/crafting/SolarCookingRecipe.java b/src/main/java/cech12/solarcooker/crafting/SolarCookingRecipe.java index 76f7694..884e700 100644 --- a/src/main/java/cech12/solarcooker/crafting/SolarCookingRecipe.java +++ b/src/main/java/cech12/solarcooker/crafting/SolarCookingRecipe.java @@ -6,9 +6,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.AbstractCookingRecipe; import net.minecraft.item.crafting.CookingRecipeSerializer; -import net.minecraft.item.crafting.FurnaceRecipe; import net.minecraft.item.crafting.IRecipeSerializer; -import net.minecraft.item.crafting.IRecipeType; import net.minecraft.item.crafting.Ingredient; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/cech12/solarcooker/inventory/SolarCookerContainer.java b/src/main/java/cech12/solarcooker/inventory/SolarCookerContainer.java index 3094f26..116afaa 100644 --- a/src/main/java/cech12/solarcooker/inventory/SolarCookerContainer.java +++ b/src/main/java/cech12/solarcooker/inventory/SolarCookerContainer.java @@ -108,7 +108,7 @@ public ItemStack transferStackInSlot(@Nonnull PlayerEntity playerIn, int index) } @Override - public void putStackInSlot(int slotID, ItemStack stack) { + public void putStackInSlot(int slotID, @Nonnull ItemStack stack) { super.putStackInSlot(slotID, stack); }