More null annotations

This commit is contained in:
mezz committed 2017-02-07 00:05:24 -08:00
1 parent da8a833485
commit a5daa93bf1
163 files changed
+952 -849

No files matched your search

@@ -25,6 +25,7 @@ public class AnalystPageAppearance extends ControlAnalystPage {
y += 26;
final int sections = ind.getGenome().getType().getSections();
final int w = (sections > 1) ? 50 : 100;
// TODO fix this control icon display
new ControlIconDisplay(this, (this.w() - w) / 2, y - ((sections == 1) ? 0 : 0), null) {
@Override
public void onRenderForeground(int guiWidth, int guiHeight) {
@@ -27,13 +27,11 @@ import java.util.Collection;
import java.util.Objects;
public class AnalystPageDatabase extends ControlAnalystPage {
@Nullable
ControlScrollableContent scroll;
private final ControlScrollableContent scroll;
boolean isMaster;
public AnalystPageDatabase(final IWidget parent, final IArea area, final BreedingSystem system, final boolean isMaster) {
super(parent, area);
this.scroll = null;
this.isMaster = isMaster;
final int cOfSystem = system.getColour();
final int cr = (0xFF0000 & cOfSystem) >> 16;
@@ -109,7 +107,8 @@ public class AnalystPageDatabase extends ControlAnalystPage {
}
};
} else {
(this.scroll = new ControlScrollableContent(this, 4, y, this.w() - 8, this.h() - y - 8, 0)).setScrollableContent(this.getItemScrollList(system, options));
this.scroll = new ControlScrollableContent(this, 4, y, this.w() - 8, this.h() - y - 8, 0);
this.scroll.setScrollableContent(this.getItemScrollList(system, options));
}
new ControlScrollBar(this, this.scroll.x() + this.scroll.w() - 6, this.scroll.y() + 3, 3, this.scroll.h() - 6, this.scroll) {
@Override
@@ -139,7 +138,7 @@ public class AnalystPageDatabase extends ControlAnalystPage {
this.addSelfEventHandler(new EventMouse.Down.Handler() {
@Override
public void onEvent(final EventMouse.Down event) {
final WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getSuperParent();
final WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getTopParent();
window.setIndividual(ind);
}
});
@@ -147,7 +146,7 @@ public class AnalystPageDatabase extends ControlAnalystPage {
@Override
public void onRenderBackground(int guiWidth, int guiHeight) {
final WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getSuperParent();
final WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getTopParent();
if (window.getIndividual() != null && window.getIndividual().getGenome().getPrimary() == species) {
RenderUtil.setColour(15658734);
CraftGUI.render.texture(CraftGUITexture.TabSolid, this.getArea().outset(1));
@@ -10,6 +10,7 @@ import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.geometry.IPoint;
import binnie.craftgui.resource.Texture;
import binnie.craftgui.resource.minecraft.StandardTexture;
import com.google.common.base.Preconditions;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.arboriculture.EnumTreeChromosome;
import forestry.api.genetics.IChromosomeType;
@@ -38,8 +39,8 @@ public class ControlChromosome extends Control implements IControlValue<IChromos
this.species = null;
}
@Nullable
public ISpeciesRoot getRoot() {
Preconditions.checkState(this.species != null, "root has not been set");
return this.species;
}
@@ -45,6 +45,7 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
@@ -164,9 +165,9 @@ public class WindowAnalyst extends Window {
x += 22;
}
} else {
new ControlSlot(this, x, y + 1).assign(InventoryType.Window, 0);
new ControlSlot.Builder(this, x, y + 1).assign(InventoryType.Window, 0);
x += 22;
new ControlSlot(this, x, y + 1).assign(InventoryType.Window, 1);
new ControlSlot.Builder(this, x, y + 1).assign(InventoryType.Window, 1);
x += 26;
this.setupValidators();
}
@@ -461,13 +462,14 @@ public class WindowAnalyst extends Window {
if (ind != null) {
ind.getGenome().getSpeciesRoot().getBreedingTracker(this.getWorld(), this.getUsername()).registerBirth(ind);
}
// TODO why is this specific client/server code needed?
if (this.isClient()) {
this.setStack(this.getWindowInventory().getStackInSlot(0));
} else if (this.isServer()) {
}
}
public void setStack(final ItemStack stack) {
public void setStack(@Nullable final ItemStack stack) {
final IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
this.setIndividual(ind);
}