More nulls, of a different kind

This commit is contained in:
Vincent Lee committed 2017-01-09 14:28:33 -06:00
1 parent f892297bf3
commit 88d2534d19
8 files changed
+17 -9

No files matched your search

@@ -20,6 +20,7 @@ import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@@ -45,7 +46,7 @@ public class ManaPoolRecipeWrapper implements IRecipeWrapper {
if(recipe.getCatalyst() != null) {
Block block = recipe.getCatalyst().getBlock();
if (Item.getItemFromBlock(block) != null) {
if (Item.getItemFromBlock(block) != Items.AIR) {
builder.add(ImmutableList.of(new ItemStack(block, 1, block.getMetaFromState(recipe.getCatalyst()))));
}
}
@@ -13,6 +13,7 @@ package vazkii.botania.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
@@ -54,7 +55,7 @@ public abstract class BlockMod extends Block implements IModelRegister {
@SideOnly(Side.CLIENT)
@Override
public void registerModels() {
if(Item.getItemFromBlock(this) != null)
if(Item.getItemFromBlock(this) != Items.AIR)
ModelHandler.registerBlockToState(this, 0, getDefaultState());
}
}
@@ -18,6 +18,7 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -248,7 +249,7 @@ public class ItemAstrolabe extends ItemMod {
}
private boolean setBlock(ItemStack stack, Block block, int meta) {
if(Item.getItemFromBlock(block) != null) {
if(Item.getItemFromBlock(block) != Items.AIR) {
ItemNBTHelper.setString(stack, TAG_BLOCK_NAME, Block.REGISTRY.getNameForObject(block).toString());
ItemNBTHelper.setInt(stack, TAG_BLOCK_META, meta);
return true;
@@ -20,6 +20,7 @@ import net.minecraft.client.resources.I18n;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -81,7 +82,7 @@ public class ItemBlackHoleTalisman extends ItemMod implements IBlockProvider {
IBlockState state = world.getBlockState(pos);
ItemStack stack = player.getHeldItem(hand);
if (Item.getItemFromBlock(state.getBlock()) != null
if (Item.getItemFromBlock(state.getBlock()) != Items.AIR
&& setBlock(stack, state.getBlock(), state.getBlock().getMetaFromState(state))) {
return EnumActionResult.SUCCESS;
} else {
@@ -214,7 +215,7 @@ public class ItemBlackHoleTalisman extends ItemMod implements IBlockProvider {
}
private boolean setBlock(ItemStack stack, Block block, int meta) {
if(Item.getItemFromBlock(block) != null && (getBlock(stack) == Blocks.AIR || getBlockCount(stack) == 0)) {
if(Item.getItemFromBlock(block) != Items.AIR && (getBlock(stack) == Blocks.AIR || getBlockCount(stack) == 0)) {
ItemNBTHelper.setString(stack, TAG_BLOCK_NAME, Block.REGISTRY.getNameForObject(block).toString());
ItemNBTHelper.setInt(stack, TAG_BLOCK_META, meta);
return true;
@@ -15,6 +15,7 @@ import javax.annotation.Nonnull;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
@@ -36,7 +37,7 @@ public class ItemOvergrowthSeed extends ItemMod {
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float xs, float ys, float zs) {
IBlockState state = world.getBlockState(pos);
if(Item.getItemFromBlock(state.getBlock()) == null)
if(Item.getItemFromBlock(state.getBlock()) == Items.AIR)
return EnumActionResult.PASS;
ItemStack blockStack = new ItemStack(state.getBlock());
int[] ids = OreDictionary.getOreIDs(blockStack);
@@ -16,6 +16,7 @@ import javax.annotation.Nonnull;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -70,7 +71,7 @@ public class ItemDiviningRod extends ItemMod implements IManaUsingItem, IAvatarW
Botania.proxy.setWispFXDepthTest(false);
for(BlockPos pos_ : BlockPos.getAllInBox(pos.add(-range, -range, -range), pos.add(range, range, range))) {
IBlockState state = world.getBlockState(pos_);
if(Item.getItemFromBlock(state.getBlock()) == null)
if(Item.getItemFromBlock(state.getBlock()) == Items.AIR)
continue;
ItemStack orestack = new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state));
for(int id : OreDictionary.getOreIDs(orestack)) {
@@ -23,6 +23,7 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.EnumAction;
@@ -120,7 +121,7 @@ public class ItemTerraformRod extends ItemMod implements IManaUsingItem, IBlockP
IBlockState state = world.getBlockState(pos);
if(state.getBlock() == Blocks.AIR)
continue;
else if(Item.getItemFromBlock(state.getBlock()) == null)
else if(Item.getItemFromBlock(state.getBlock()) == Items.AIR)
continue;
int[] ids = OreDictionary.getOreIDs(new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state)));
for(int id : ids)
@@ -15,6 +15,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.minecraft.init.Items;
import org.lwjgl.opengl.GL11;
import net.minecraft.block.Block;
@@ -88,7 +89,7 @@ public class PageManaInfusionRecipe extends PageRecipe {
if(recipe.getCatalyst() != null) {
Block block = recipe.getCatalyst().getBlock();
if (Item.getItemFromBlock(block) != null) {
if (Item.getItemFromBlock(block) != Items.AIR) {
renderItemAtGridPos(gui, 1, 2, new ItemStack(block, 1, block.getMetaFromState(recipe.getCatalyst())), false);
}
}