mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-23 21:49:49 +00:00
More null annotations
This commit is contained in:
1 parent
16b955b443
commit
da8a833485
96 files changed
+573
-360
No files matched your search
@@ -84,7 +84,7 @@ public enum Cocktail {
|
||||
}
|
||||
|
||||
public static boolean isIngredient(final String name) {
|
||||
return name != null && Cocktail.cocktailIngredients.containsKey(name.toLowerCase());
|
||||
return Cocktail.cocktailIngredients.containsKey(name.toLowerCase());
|
||||
}
|
||||
|
||||
static {
|
||||
|
||||
@@ -22,7 +22,7 @@ public class DrinkManager {
|
||||
}
|
||||
|
||||
public static IDrinkLiquid getLiquid(final FluidStack fluid) {
|
||||
return (fluid != null) ? getLiquid(fluid.getFluid()) : null;
|
||||
return getLiquid(fluid.getFluid());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,13 +2,14 @@ package binnie.extratrees.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public interface ICarpentryInterface {
|
||||
boolean registerCarpentryWood(final int p0, final IDesignMaterial p1);
|
||||
boolean registerCarpentryWood(final int index, final IDesignMaterial material);
|
||||
|
||||
int getCarpentryWoodIndex(final IDesignMaterial p0);
|
||||
int getCarpentryWoodIndex(final IDesignMaterial material);
|
||||
|
||||
IDesignMaterial getWoodMaterial(final int p0);
|
||||
|
||||
@@ -20,7 +21,8 @@ public interface ICarpentryInterface {
|
||||
|
||||
ILayout getLayout(final IPattern p0, final boolean p1);
|
||||
|
||||
IDesignMaterial getWoodMaterial(final ItemStack p0);
|
||||
@Nullable
|
||||
IDesignMaterial getWoodMaterial(final ItemStack stack);
|
||||
|
||||
boolean registerDesignCategory(final IDesignCategory p0);
|
||||
|
||||
|
||||
@@ -3,15 +3,20 @@ package binnie.extratrees.api;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public interface IDesignSystem {
|
||||
@Nullable
|
||||
TextureAtlasSprite getPrimarySprite(final IPattern pattern);
|
||||
|
||||
@Nullable
|
||||
TextureAtlasSprite getSecondarySprite(final IPattern pattern);
|
||||
|
||||
void registerSprites();
|
||||
|
||||
IDesignMaterial getDefaultMaterial();
|
||||
|
||||
@Nullable
|
||||
IDesignMaterial getMaterial(final int p0);
|
||||
|
||||
int getMaterialIndex(final IDesignMaterial p0);
|
||||
|
||||
@@ -241,9 +241,6 @@ public abstract class BlockETDecorativeLeaves extends Block implements IItemMode
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
|
||||
ETTreeDefinition treeDefinition = state.getValue(getVariant());
|
||||
if (treeDefinition == null) {
|
||||
return PluginArboriculture.proxy.getFoliageColorBasic();
|
||||
}
|
||||
|
||||
ITreeGenome genome = treeDefinition.getGenome();
|
||||
|
||||
|
||||
@@ -39,9 +39,7 @@ public class BlockETFenceGate extends BlockFenceGate implements IBlockMetadata {
|
||||
public void getSubBlocks(final Item itemIn, final CreativeTabs par2CreativeTabs, final List<ItemStack> itemList) {
|
||||
for (final IPlankType type : WoodManager.getAllPlankTypes()) {
|
||||
final ItemStack gate = WoodManager.getGate(type);
|
||||
if (gate != null) {
|
||||
itemList.add(gate);
|
||||
}
|
||||
itemList.add(gate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import binnie.Binnie;
|
||||
import binnie.core.block.BlockMetadata;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -15,6 +14,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCarpentryPanel extends BlockCarpentry {
|
||||
@@ -80,13 +80,13 @@ public class BlockCarpentryPanel extends BlockCarpentry {
|
||||
return ModuleCarpentry.getCarpentryPanel(this.getDesignSystem(), TileEntityMetadata.getTileMetadata(world, pos));
|
||||
}
|
||||
|
||||
public static boolean isValidPanelPlacement(IBlockAccess world, BlockPos pos, EnumFacing facing) {
|
||||
public static boolean isValidPanelPlacement(IBlockAccess world, BlockPos pos, @Nullable EnumFacing facing) {
|
||||
if (facing == null) {
|
||||
return false;
|
||||
}
|
||||
pos = pos.offset(facing);
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
return state != null && state.isSideSolid(world, pos, facing.getOpposite());
|
||||
return state.isSideSolid(world, pos, facing.getOpposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -75,7 +75,7 @@ public abstract class BlockDesign extends BlockMetadata implements IMultipassBlo
|
||||
}
|
||||
final DesignBlock block = blockC.getCarpentryBlock(world, pos);
|
||||
final TileEntityMetadata tile = TileUtil.getTile(world, pos, TileEntityMetadata.class);
|
||||
if (tile != null) {
|
||||
if (tile != null && event.getFace() != null) {
|
||||
block.rotate(event.getFace(), item, player, world, pos);
|
||||
final int meta = block.getBlockMetadata(blockC.getDesignSystem());
|
||||
tile.setTileMetadata(meta, true);
|
||||
|
||||
@@ -8,6 +8,7 @@ import binnie.extratrees.api.ILayout;
|
||||
import binnie.extratrees.api.IPattern;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@@ -22,7 +23,7 @@ public class CarpentryInterface implements ICarpentryInterface {
|
||||
|
||||
@Override
|
||||
public boolean registerCarpentryWood(final int index, final IDesignMaterial wood) {
|
||||
return wood != null && CarpentryInterface.woodMap.put(index, wood) == null;
|
||||
return CarpentryInterface.woodMap.put(index, wood) == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,7 +43,7 @@ public class CarpentryInterface implements ICarpentryInterface {
|
||||
|
||||
@Override
|
||||
public boolean registerDesign(final int index, final IDesign wood) {
|
||||
return wood != null && CarpentryInterface.designMap.put(index, wood) == null;
|
||||
return CarpentryInterface.designMap.put(index, wood) == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,7 +68,7 @@ public class CarpentryInterface implements ICarpentryInterface {
|
||||
|
||||
@Override
|
||||
public boolean registerDesignCategory(final IDesignCategory category) {
|
||||
return category != null && category.getId() != null && CarpentryInterface.designCategories.put(category.getId(), category) == null;
|
||||
return CarpentryInterface.designCategories.put(category.getId(), category) == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,16 +97,11 @@ public class CarpentryInterface implements ICarpentryInterface {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IDesignMaterial getWoodMaterial(final ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return null;
|
||||
}
|
||||
for (final Map.Entry<Integer, IDesignMaterial> entry : CarpentryInterface.woodMap.entrySet()) {
|
||||
for(boolean fireproof : new boolean[]{true, false}){
|
||||
final ItemStack key = entry.getValue().getStack(fireproof);
|
||||
if (key == null) {
|
||||
continue;
|
||||
}
|
||||
if (key.isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class DesignBlock {
|
||||
IDesign design;
|
||||
IDesignMaterial primaryMaterial;
|
||||
@@ -39,27 +41,32 @@ public class DesignBlock {
|
||||
return this.secondaryMaterial;
|
||||
}
|
||||
|
||||
DesignBlock(final IDesignSystem system, final IDesignMaterial primaryWood, final IDesignMaterial secondaryWood, final IDesign design, final int rotation, final EnumFacing dir) {
|
||||
DesignBlock(final IDesignSystem system, @Nullable final IDesignMaterial primaryWood, @Nullable final IDesignMaterial secondaryWood, @Nullable final IDesign design, final int rotation, @Nullable final EnumFacing dir) {
|
||||
this.panel = false;
|
||||
this.design = design;
|
||||
this.primaryMaterial = primaryWood;
|
||||
this.secondaryMaterial = secondaryWood;
|
||||
this.rotation = rotation;
|
||||
this.facing = dir;
|
||||
|
||||
if (design == null) {
|
||||
this.design = EnumDesign.Blank;
|
||||
} else {
|
||||
this.design = design;
|
||||
}
|
||||
if (primaryWood == null) {
|
||||
this.primaryMaterial = system.getDefaultMaterial();
|
||||
} else {
|
||||
this.primaryMaterial = primaryWood;
|
||||
}
|
||||
if (secondaryWood == null) {
|
||||
this.secondaryMaterial = system.getDefaultMaterial();
|
||||
} else {
|
||||
this.secondaryMaterial = secondaryWood;
|
||||
}
|
||||
if (this.rotation > 3 || this.rotation < 0) {
|
||||
this.rotation = 0;
|
||||
}
|
||||
if (this.facing == null) {
|
||||
if (dir == null) {
|
||||
this.facing = EnumFacing.UP;
|
||||
} else {
|
||||
this.facing = dir;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,13 +386,13 @@ public class DesignBlock {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getPrimarySprite(IDesignSystem system, EnumFacing facing) {
|
||||
ILayout layout = this.getLayout(facing);
|
||||
return (layout == null) ? null : layout.getPrimarySprite(system);
|
||||
return layout.getPrimarySprite(system);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getSecondarySprite(IDesignSystem system, EnumFacing facing) {
|
||||
ILayout layout = this.getLayout(facing);
|
||||
return (layout == null) ? null : layout.getSecondarySprite(system);
|
||||
return layout.getSecondarySprite(system);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -13,6 +13,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -60,6 +61,7 @@ public enum DesignSystem implements IDesignSystem {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IDesignMaterial getMaterial(final int id) {
|
||||
switch (this) {
|
||||
case Glass: {
|
||||
@@ -134,6 +136,7 @@ public enum DesignSystem implements IDesignSystem {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public TextureAtlasSprite getPrimarySprite(final IPattern pattern) {
|
||||
if (pattern instanceof EnumPattern) {
|
||||
return this.primary.get(((EnumPattern) pattern).ordinal());
|
||||
@@ -142,6 +145,7 @@ public enum DesignSystem implements IDesignSystem {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public TextureAtlasSprite getSecondarySprite(final IPattern pattern) {
|
||||
if (pattern instanceof EnumPattern) {
|
||||
return this.secondary.get(((EnumPattern) pattern).ordinal());
|
||||
|
||||
@@ -138,10 +138,12 @@ public class AlleleETFruit extends AlleleCategorized implements IAlleleFruit, IF
|
||||
private IFruitFamily family;
|
||||
private boolean isRipening;
|
||||
private int diffR, diffG, diffB;
|
||||
@Nullable
|
||||
private FruitPod pod;
|
||||
private int ripeningPeriod;
|
||||
private int colourUnripe;
|
||||
private int colour;
|
||||
@Nullable
|
||||
private FruitSprite sprite;
|
||||
private Map<ItemStack, Float> products;
|
||||
|
||||
|
||||
@@ -15,9 +15,12 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ControlFluidDisplay extends Control implements ITooltip {
|
||||
FluidStack itemStack;
|
||||
public boolean hastooltip;
|
||||
@Nullable
|
||||
private FluidStack fluidStack;
|
||||
private boolean hastooltip;
|
||||
|
||||
public void setTooltip() {
|
||||
this.hastooltip = true;
|
||||
@@ -30,7 +33,7 @@ public class ControlFluidDisplay extends Control implements ITooltip {
|
||||
|
||||
public ControlFluidDisplay(final IWidget parent, final int x, final int y, final FluidStack stack, final boolean tooltip) {
|
||||
this(parent, x, y, 16);
|
||||
this.setItemStack(stack);
|
||||
this.setFluidStack(stack);
|
||||
if (tooltip) {
|
||||
this.setTooltip();
|
||||
}
|
||||
@@ -38,26 +41,26 @@ public class ControlFluidDisplay extends Control implements ITooltip {
|
||||
|
||||
public ControlFluidDisplay(final IWidget parent, final int x, final int y, final int size) {
|
||||
super(parent, x, y, size, size);
|
||||
this.itemStack = null;
|
||||
this.fluidStack = null;
|
||||
this.hastooltip = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
if (this.itemStack == null) {
|
||||
if (this.fluidStack == null) {
|
||||
return;
|
||||
}
|
||||
final IPoint relativeToWindow = this.getAbsolutePosition().sub(this.getSuperParent().getPosition());
|
||||
if (relativeToWindow.x() > Window.get(this).getSize().x() + 100 || relativeToWindow.y() > Window.get(this).getSize().y() + 100) {
|
||||
return;
|
||||
}
|
||||
if (this.itemStack != null) {
|
||||
final Fluid fluid = this.itemStack.getFluid();
|
||||
final int hex = fluid.getColor(this.itemStack);
|
||||
if (this.fluidStack != null) {
|
||||
final Fluid fluid = this.fluidStack.getFluid();
|
||||
final int hex = fluid.getColor(this.fluidStack);
|
||||
final int r = (hex & 0xFF0000) >> 16;
|
||||
final int g = (hex & 0xFF00) >> 8;
|
||||
final int b = hex & 0xFF;
|
||||
final ResourceLocation iconRL = this.itemStack.getFluid().getStill();
|
||||
final ResourceLocation iconRL = this.fluidStack.getFluid().getStill();
|
||||
TextureAtlasSprite icon = FMLClientHandler.instance().getClient().getTextureMapBlocks().getAtlasSprite(iconRL.toString());
|
||||
GlStateManager.color(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f);
|
||||
GlStateManager.enableBlend();
|
||||
@@ -75,14 +78,14 @@ public class ControlFluidDisplay extends Control implements ITooltip {
|
||||
}
|
||||
}
|
||||
|
||||
public void setItemStack(final FluidStack itemStack) {
|
||||
this.itemStack = itemStack;
|
||||
public void setFluidStack(final FluidStack fluidStack) {
|
||||
this.fluidStack = fluidStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(final Tooltip tooltip) {
|
||||
if (this.hastooltip && this.itemStack != null) {
|
||||
tooltip.add(this.itemStack.getLocalizedName());
|
||||
if (this.hastooltip && this.fluidStack != null) {
|
||||
tooltip.add(this.fluidStack.getLocalizedName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class ControlSlotFluid extends Control implements ITooltip {
|
||||
@Override
|
||||
public void onUpdateClient() {
|
||||
super.onUpdateClient();
|
||||
this.itemDisplay.setItemStack(this.getFluidStack());
|
||||
this.itemDisplay.setFluidStack(this.getFluidStack());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class Designer {
|
||||
@@ -63,12 +64,9 @@ public abstract class Designer {
|
||||
public void createMachine(final Machine machine) {
|
||||
new ExtraTreeMachine.ComponentExtraTreeGUI(machine, ExtraTreesGUID.Woodworker);
|
||||
final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
inventory.addSlot(Designer.beeswaxSlot, "polish");
|
||||
inventory.addSlot(Designer.design1Slot, "wood");
|
||||
inventory.addSlot(Designer.design2Slot, "wood");
|
||||
inventory.getSlot(Designer.beeswaxSlot).setValidator(new Validators.SlotValidatorBeeswax(this.type));
|
||||
inventory.getSlot(Designer.design1Slot).setValidator(new Validators.SlotValidatorPlanks(this.type));
|
||||
inventory.getSlot(Designer.design2Slot).setValidator(new Validators.SlotValidatorPlanks(this.type));
|
||||
inventory.addSlot(Designer.beeswaxSlot, "polish").setValidator(new Validators.SlotValidatorBeeswax(this.type));
|
||||
inventory.addSlot(Designer.design1Slot, "wood").setValidator(new Validators.SlotValidatorPlanks(this.type));
|
||||
inventory.addSlot(Designer.design2Slot, "wood").setValidator(new Validators.SlotValidatorPlanks(this.type));
|
||||
new ComponentWoodworkerRecipe(machine, this.type);
|
||||
}
|
||||
}
|
||||
@@ -102,6 +100,7 @@ public abstract class Designer {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack getProduct() {
|
||||
final ItemStack plank1 = this.getUtil().getStack(Designer.design1Slot);
|
||||
final ItemStack plank2 = this.getUtil().getStack(Designer.design2Slot);
|
||||
@@ -111,11 +110,11 @@ public abstract class Designer {
|
||||
final IDesignMaterial type1 = this.type.getSystem().getMaterial(plank1);
|
||||
final IDesignMaterial type2 = this.type.getSystem().getMaterial(plank2);
|
||||
final IDesign design = this.getDesign();
|
||||
final ItemStack stack = this.type.getBlock(type1, type2, design);
|
||||
return stack;
|
||||
return this.type.getBlock(type1, type2, design);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack doRecipe(final boolean takeItem) {
|
||||
if (!this.isRecipe()) {
|
||||
return null;
|
||||
@@ -145,23 +144,21 @@ public abstract class Designer {
|
||||
if (name.equals("recipe")) {
|
||||
final InventoryPlayer playerInv = player.inventory;
|
||||
final ItemStack recipe = this.doRecipe(false);
|
||||
if (recipe == null) {
|
||||
return;
|
||||
}
|
||||
if (playerInv.getItemStack() == null) {
|
||||
playerInv.setItemStack(this.doRecipe(true));
|
||||
} else if (playerInv.getItemStack().isItemEqual(recipe) && ItemStack.areItemStackTagsEqual(playerInv.getItemStack(), recipe)) {
|
||||
final int fit = recipe.getMaxStackSize() - (recipe.stackSize + playerInv.getItemStack().stackSize);
|
||||
if (fit >= 0) {
|
||||
final ItemStack doRecipe;
|
||||
final ItemStack rec = doRecipe = this.doRecipe(true);
|
||||
doRecipe.stackSize += playerInv.getItemStack().stackSize;
|
||||
playerInv.setItemStack(rec);
|
||||
if (recipe != null) {
|
||||
if (playerInv.getItemStack() == null) {
|
||||
playerInv.setItemStack(this.doRecipe(true));
|
||||
} else if (playerInv.getItemStack().isItemEqual(recipe) && ItemStack.areItemStackTagsEqual(playerInv.getItemStack(), recipe)) {
|
||||
final int fit = recipe.getMaxStackSize() - (recipe.stackSize + playerInv.getItemStack().stackSize);
|
||||
if (fit >= 0) {
|
||||
this.doRecipe(true);
|
||||
recipe.stackSize += playerInv.getItemStack().stackSize;
|
||||
playerInv.setItemStack(recipe);
|
||||
}
|
||||
}
|
||||
player.openContainer.detectAndSendChanges();
|
||||
if (player instanceof EntityPlayerMP) {
|
||||
((EntityPlayerMP) player).updateHeldItem();
|
||||
}
|
||||
}
|
||||
player.openContainer.detectAndSendChanges();
|
||||
if (player instanceof EntityPlayerMP) {
|
||||
((EntityPlayerMP) player).updateHeldItem();
|
||||
}
|
||||
} else if (name.equals("design")) {
|
||||
this.setDesign(CarpentryManager.carpentryInterface.getDesign(nbt.getShort("d")));
|
||||
|
||||
@@ -8,7 +8,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -42,34 +41,24 @@ public class BrewedGrainRecipe implements IBreweryRecipe {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public FluidStack getOutput(final BreweryCrafting crafting) {
|
||||
if (!WATER.isFluidEqual(crafting.inputFluid)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!isIngredient(crafting.ingredient)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!yeast.isItemEqual(crafting.yeast)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int grainCount = 0;
|
||||
for (final ItemStack stack : crafting.inputGrains) {
|
||||
if (stack == null) {
|
||||
return null;
|
||||
if (WATER.isFluidEqual(crafting.inputFluid) && isIngredient(crafting.ingredient) && yeast.isItemEqual(crafting.yeast)) {
|
||||
int grainCount = 0;
|
||||
for (final ItemStack stack : crafting.inputGrains) {
|
||||
if (stack == null) {
|
||||
return null;
|
||||
}
|
||||
if (isGrain(stack)) {
|
||||
grainCount++;
|
||||
}
|
||||
}
|
||||
if (isGrain(stack)) {
|
||||
grainCount++;
|
||||
|
||||
if (grainCount >= 2) {
|
||||
return output.copy();
|
||||
}
|
||||
}
|
||||
|
||||
if (grainCount >= 2) {
|
||||
return output.copy();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -51,7 +51,7 @@ public class BreweryCrafting implements INbtWritable {
|
||||
return nbt;
|
||||
}
|
||||
|
||||
private NBTTagCompound getNBT(final ItemStack ingr) {
|
||||
private NBTTagCompound getNBT(@Nullable final ItemStack ingr) {
|
||||
if (ingr == null) {
|
||||
return new NBTTagCompound();
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ public class BreweryRecipe implements IBreweryRecipe {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public FluidStack getOutput(final BreweryCrafting crafting) {
|
||||
if (!this.yeast.isItemEqual(crafting.yeast)) {
|
||||
return null;
|
||||
|
||||
@@ -38,6 +38,7 @@ public class BreweryRecipes {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static FluidStack getOutput(final FluidStack stack) {
|
||||
final BreweryCrafting crafting = new BreweryCrafting(stack, null, null, null);
|
||||
for (final IBreweryRecipe recipe : recipes) {
|
||||
|
||||
@@ -3,10 +3,11 @@ package binnie.extratrees.machines.brewery;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public interface IBreweryRecipe {
|
||||
@Nullable
|
||||
FluidStack getOutput(final BreweryCrafting crafting);
|
||||
|
||||
FluidStack getInput();
|
||||
|
||||
@@ -61,6 +61,7 @@ public class DistilleryLogic extends ComponentProcessSetCost implements IProcess
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ErrorState canWork() {
|
||||
if (this.getUtil().isTankEmpty(DistilleryMachine.TANK_INPUT) && this.currentFluid == null) {
|
||||
return new ErrorState.InsufficientLiquid("No Input Liquid", DistilleryMachine.TANK_INPUT);
|
||||
@@ -89,7 +90,9 @@ public class DistilleryLogic extends ComponentProcessSetCost implements IProcess
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
final FluidStack output = DistilleryRecipes.getOutput(this.currentFluid, this.level);
|
||||
this.getUtil().fillTank(DistilleryMachine.TANK_OUTPUT, output);
|
||||
if (output != null) {
|
||||
this.getUtil().fillTank(DistilleryMachine.TANK_OUTPUT, output);
|
||||
}
|
||||
this.currentFluid = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user