Clean up null issues, add more annotations (#3590)

This commit is contained in:
James Mitchell authored and LexManos committed 2017-01-11 15:17:56 -08:00
1 parent 43efa3cfc4
commit c545b8ecd4
130 files changed
+629 -262

No files matched your search

@@ -25,6 +25,8 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.player.PlayerEvent;
import javax.annotation.Nonnull;
public abstract class RenderPlayerEvent extends PlayerEvent
{
private final RenderPlayer renderer;
@@ -99,8 +101,9 @@ public abstract class RenderPlayerEvent extends PlayerEvent
{
private int result = -1;
private final int slot;
@Nonnull
private final ItemStack stack;
public SetArmorModel(EntityPlayer player, RenderPlayer renderer, int slot, float partialTick, ItemStack stack)
public SetArmorModel(EntityPlayer player, RenderPlayer renderer, int slot, float partialTick, @Nonnull ItemStack stack)
{
super(player, renderer, partialTick, 0D, 0D, 0D);
this.slot = slot;
@@ -126,6 +129,7 @@ public abstract class RenderPlayerEvent extends PlayerEvent
return slot;
}
@Nonnull
public ItemStack getStack()
{
return stack;
@@ -6,7 +6,6 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* This event is fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}
@@ -22,6 +21,7 @@ public class RenderSpecificHandEvent extends Event
private final float interpolatedPitch;
private final float swingProgress;
private final float equipProgress;
@Nonnull
private final ItemStack stack;
public RenderSpecificHandEvent(EnumHand hand, float partialTicks, float interpolatedPitch, float swingProgress, float equipProgress, @Nonnull ItemStack stack)
@@ -4,7 +4,6 @@ import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.item.ItemStack;
@@ -26,6 +25,7 @@ import net.minecraftforge.fml.common.eventhandler.Event;
*/
public abstract class RenderTooltipEvent extends Event
{
@Nonnull
protected final ItemStack stack;
protected final List<String> lines;
protected int x;
@@ -42,7 +42,7 @@ public abstract class RenderTooltipEvent extends Event
}
/**
* @return The stack which the tooltip is being rendered for. As tooltips can be drawn without itemstacks, this return is {@link Nullable}.
* @return The stack which the tooltip is being rendered for. As tooltips can be drawn without itemstacks, this stack may be empty.
*/
@Nonnull
public ItemStack getStack()
@@ -98,7 +98,7 @@ public abstract class RenderTooltipEvent extends Event
private int screenHeight;
private int maxWidth;
public Pre(@Nullable ItemStack stack, @Nonnull List<String> lines, int x, int y, int screenWidth, int screenHeight, int maxWidth, @Nonnull FontRenderer fr)
public Pre(@Nonnull ItemStack stack, @Nonnull List<String> lines, int x, int y, int screenWidth, int screenHeight, int maxWidth, @Nonnull FontRenderer fr)
{
super(stack, lines, x, y, fr);
this.screenWidth = screenWidth;
@@ -181,7 +181,7 @@ public abstract class RenderTooltipEvent extends Event
private final int width;
private final int height;
public Post(@Nullable ItemStack stack, @Nonnull List<String> textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height)
public Post(@Nonnull ItemStack stack, @Nonnull List<String> textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height)
{
super(stack, textLines, x, y, fr);
this.width = width;
@@ -210,7 +210,7 @@ public abstract class RenderTooltipEvent extends Event
*/
public static class PostBackground extends Post
{
public PostBackground(@Nullable ItemStack stack, @Nonnull List<String> textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height)
public PostBackground(@Nonnull ItemStack stack, @Nonnull List<String> textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height)
{ super(stack, textLines, x, y, fr, width, height); }
}
@@ -219,7 +219,7 @@ public abstract class RenderTooltipEvent extends Event
*/
public static class PostText extends Post
{
public PostText(@Nullable ItemStack stack, @Nonnull List<String> textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height)
public PostText(@Nonnull ItemStack stack, @Nonnull List<String> textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height)
{ super(stack, textLines, x, y, fr, width, height); }
}
}