Fixed NEI showing Air and Forcefield blocks

This commit is contained in:
Unknown 2017-12-09 16:39:53 +01:00 committed by LemADEC
parent fb3e05c790
commit 83358340f7
4 changed files with 33 additions and 4 deletions

View file

@ -1,5 +1,6 @@
package cr0s.warpdrive;
import cr0s.warpdrive.config.WarpDriveConfig;
import cr0s.warpdrive.data.VectorI;
import net.minecraft.block.Block;
@ -35,6 +36,8 @@ import java.util.List;
import java.util.Random;
import java.util.Set;
import cpw.mods.fml.common.Optional;
/**
* Common static methods
*/
@ -526,4 +529,15 @@ public class Commons {
+ (clamp(0, 255, green) << 8)
+ clamp(0, 255, blue );
}
@Optional.Method(modid = "NotEnoughItems")
public static void NEI_hideItemStack(final ItemStack itemStack) {
codechicken.nei.api.API.hideItem(itemStack);
}
public static void hideItemStack(final ItemStack itemStack) {
if (WarpDriveConfig.isNotEnoughItemsLoaded) {
NEI_hideItemStack(itemStack);
}
}
}

View file

@ -1,16 +1,20 @@
package cr0s.warpdrive.block.breathing;
import cr0s.warpdrive.Commons;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.block.BlockAbstractBase;
import cr0s.warpdrive.config.WarpDriveConfig;
import cr0s.warpdrive.render.RenderBlockStandard;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@ -61,6 +65,15 @@ public abstract class BlockAbstractAir extends BlockAbstractBase {
return false;
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs creativeTab, List list) {
// hide in NEI
for (int i = 0; i < 16; i++) {
Commons.hideItemStack(new ItemStack(item, 1, i));
}
}
@Override
public int getRenderBlockPass() {
// 1 is required to apply alpha transparency

View file

@ -1,5 +1,6 @@
package cr0s.warpdrive.block.forcefield;
import cr0s.warpdrive.Commons;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.api.IDamageReceiver;
import cr0s.warpdrive.block.hull.BlockHullGlass;
@ -83,15 +84,14 @@ public class BlockForceField extends BlockAbstractForceField implements IDamageR
public boolean renderAsNormalBlock() {
return false;
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs creativeTab, List list) {
/* Hide in NEI
// hide in NEI
for (int i = 0; i < 16; i++) {
list.add(new ItemStack(item, 1, i));
Commons.hideItemStack(new ItemStack(item, 1, i));
}
/**/
}
@SideOnly(Side.CLIENT)

View file

@ -114,6 +114,7 @@ public class WarpDriveConfig {
public static boolean isGregTech5Loaded = false;
public static boolean isEnderIOLoaded = false;
public static boolean isAdvancedRepulsionSystemLoaded = false;
public static boolean isNotEnoughItemsLoaded = false;
public static ItemStack IC2_compressedAir;
public static ItemStack IC2_emptyCell;
@ -967,6 +968,7 @@ public class WarpDriveConfig {
if (isAdvancedRepulsionSystemLoaded) {
CompatAdvancedRepulsionSystems.register();
}
isNotEnoughItemsLoaded = Loader.isModLoaded("NotEnoughItems");
boolean isBotaniaLoaded = Loader.isModLoaded("Botania");
if (isBotaniaLoaded) {