Fix facade recipes. Hopefully the last null check fix.

This commit is contained in:
Gunther De Wachter
2017-06-27 20:39:06 +02:00
parent b819fe4adb
commit 61b81fc802
52 changed files with 101 additions and 83 deletions
@@ -25,6 +25,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.config.Configuration;
@@ -20,6 +20,7 @@ package appeng.core.api.imc;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
@@ -39,7 +40,7 @@ public class IMCBlackListSpatial implements IIMCProcessor
if( !is.isEmpty() )
{
final Block blk = Block.getBlockFromItem( is.getItem() );
if( blk != null )
if( blk != Blocks.AIR )
{
AEApi.instance().registries().movable().blacklistBlock( blk );
return;
@@ -75,12 +75,12 @@ public class IMCGrinder implements IIMCProcessor
final int turns = msg.getInteger( "turns" );
if( in == null )
if( in.isEmpty() )
{
throw new IllegalStateException( "invalid input" );
}
if( out == null )
if( out.isEmpty() )
{
throw new IllegalStateException( "invalid output" );
}
@@ -90,7 +90,7 @@ public class IMCGrinder implements IIMCProcessor
final NBTTagCompound optionalTag = (NBTTagCompound) msg.getTag( "optional" );
final ItemStack optional = new ItemStack( optionalTag );
if( optional == null )
if( optional.isEmpty() )
{
throw new IllegalStateException( "invalid optional" );
}
@@ -52,7 +52,7 @@ public class IMCMatterCannon implements IIMCProcessor
final ItemStack ammo = new ItemStack( item );
final double weight = msg.getDouble( "weight" );
if( ammo == null )
if( ammo.isEmpty() )
{
throw new IllegalStateException( "invalid item in message " + m );
}
@@ -44,7 +44,7 @@ public class AchievementCraftingHandler
@SubscribeEvent
public void onPlayerCraftingEvent( final PlayerEvent.ItemCraftedEvent event )
{
if( this.differentiator.isNoPlayer( event.player ) || event.crafting == null )
if( this.differentiator.isNoPlayer( event.player ) || event.crafting.isEmpty() )
{
return;
}
@@ -45,7 +45,7 @@ public class AchievementPickupHandler
@SubscribeEvent
public void onItemPickUp( final PlayerEvent.ItemPickupEvent event )
{
if( this.differentiator.isNoPlayer( event.player ) || event.pickedUp == null || event.pickedUp.getEntityItem() == null )
if( this.differentiator.isNoPlayer( event.player ) || event.pickedUp == null || event.pickedUp.getEntityItem().isEmpty() )
{
return;
}
@@ -116,7 +116,7 @@ public enum Achievements
Achievements( final int x, final int y, final AEColoredItemDefinition which, final AchievementType type )
{
this.stack = ( which != null ) ? which.stack( AEColor.TRANSPARENT, 1 ) : null;
this.stack = ( which != null ) ? which.stack( AEColor.TRANSPARENT, 1 ) : ItemStack.EMPTY;
this.type = type;
this.x = x;
this.y = y;
@@ -145,7 +145,7 @@ public enum Achievements
public Achievement getAchievement()
{
if( this.stat == null && this.getStack() != null )
if( this.stat == null && !this.getStack().isEmpty() )
{
this.stat = new Achievement( "achievement.ae2." + this.name(), "ae2." + this.name(), this.x, this.y, this.getStack(), this.parent );
this.stat.registerStat();
@@ -98,14 +98,14 @@ public class PacketValueConfig extends AppEngPacket
{
final Container c = player.openContainer;
if( this.Name.equals( "Item" ) && ( ( player.getHeldItem( EnumHand.MAIN_HAND ) != null && player.getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof IMouseWheelItem ) || ( player.getHeldItem( EnumHand.OFF_HAND ) != null && player.getHeldItem(EnumHand.OFF_HAND).getItem() instanceof IMouseWheelItem ) ) )
if( this.Name.equals( "Item" ) && ( ( !player.getHeldItem( EnumHand.MAIN_HAND ).isEmpty() && player.getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof IMouseWheelItem ) || ( !player.getHeldItem( EnumHand.OFF_HAND ).isEmpty() && player.getHeldItem(EnumHand.OFF_HAND).getItem() instanceof IMouseWheelItem ) ) )
{
final EnumHand hand;
if( player.getHeldItem( EnumHand.MAIN_HAND ) != null && player.getHeldItem( EnumHand.MAIN_HAND ).getItem() instanceof IMouseWheelItem )
if( !player.getHeldItem( EnumHand.MAIN_HAND ).isEmpty() && player.getHeldItem( EnumHand.MAIN_HAND ).getItem() instanceof IMouseWheelItem )
{
hand = EnumHand.MAIN_HAND;
}
else if( player.getHeldItem( EnumHand.OFF_HAND ) != null && player.getHeldItem( EnumHand.OFF_HAND ).getItem() instanceof IMouseWheelItem )
else if( !player.getHeldItem( EnumHand.OFF_HAND ).isEmpty() && player.getHeldItem( EnumHand.OFF_HAND ).getItem() instanceof IMouseWheelItem )
{
hand = EnumHand.OFF_HAND;
}