Skip to content

Commit

Permalink
fix some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
cech12 committed Jan 20, 2021
1 parent ec34f75 commit 2335bd5
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -101,30 +102,24 @@ 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));
}

/**
* 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;
}

Expand All @@ -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)));
}
Expand All @@ -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)));
}
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/cech12/solarcooker/block/ReflectorBlock.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
38 changes: 21 additions & 17 deletions src/main/java/cech12/solarcooker/client/SolarCookerScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<SolarCookerContainer> {
private static final ResourceLocation guiTexture = new ResourceLocation(SolarCookerMod.MOD_ID, "textures/gui/container/solar_cooker.png");
Expand All @@ -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);
}
}
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 2335bd5

Please sign in to comment.