Skip to content

Commit

Permalink
ItemShard fix
Browse files Browse the repository at this point in the history
Fixes #267: Wildcard damage values will no longer cause GUI crashes.
Added Thaumcraft's itemShard to the ore dictionary, allowing
autocrafting substitutions where allowed.
  • Loading branch information
Nividica committed Jan 24, 2016
1 parent 963dda7 commit 2cfd702
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 6 deletions.
6 changes: 5 additions & 1 deletion ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
01/23/2016 1.0.0.0 - Beta
01/24/2016 1.0.0.1 - Beta
Fixes #267: Wildcard damage values will no longer cause GUI crashes.
Added Thaumcraft's itemShard to the ore dictionary, allowing autocrafting substitutions where allowed.

01/23/2016 1.0.0.0 - Beta
Fixed SMP packet crash.
Fixed potential golem hook crash.
Added levels of interaction.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ buildscript {

apply plugin: 'forge'

version = "1.0.0.0"
version = "1.0.0.1"
group= "thaumicenergistics" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "thaumicenergistics"

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/thaumicenergistics/common/CommonProxy.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package thaumicenergistics.common;

import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import thaumcraft.common.config.ConfigItems;
import thaumicenergistics.common.fluids.GaseousEssentia;
import thaumicenergistics.common.items.ItemEnum;
import thaumicenergistics.common.items.ItemMaterial;
Expand Down Expand Up @@ -52,6 +54,9 @@ public void registerItems()

// Add iron gear to the oredic
OreDictionary.registerOre( "gearIron", ItemMaterial.MaterialTypes.IRON_GEAR.getStack() );

// Add the shard from thaumcraft so that AE will suggest replacements.
OreDictionary.registerOre( "materialAspectShard", new ItemStack( ConfigItems.itemShard, 1, OreDictionary.WILDCARD_VALUE ) );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class ThaumicEnergistics
/**
* Current version of the mod.
*/
public static final String VERSION = "1.0.0.0"; // NOTE: don't forget to change the build.gradle file as well
public static final String VERSION = "1.0.0.1"; // NOTE: don't forget to change the build.gradle file as well

/**
* Singleton instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.crafting.IArcaneRecipe;
import thaumcraft.api.crafting.ShapedArcaneRecipe;
Expand Down Expand Up @@ -298,6 +299,15 @@ private Object preparePatternInput( final Object input, final int slotNumber )

return ingList;
}
// Is this a wildcard item?
else if( ( input instanceof ItemStack ) && ( ( (ItemStack)input ).getItemDamage() == OreDictionary.WILDCARD_VALUE ) )
{
// Create a list to hold the users preferred item, and the wildcard item
ArrayList<ItemStack> ingList = new ArrayList<ItemStack>();
ingList.add( this.craftingSlots[slotNumber].getStack() );
ingList.add( (ItemStack)input );
return ingList;
}

return input;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import thaumcraft.api.ThaumcraftApiHelper;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
Expand Down Expand Up @@ -146,8 +147,8 @@ private boolean canSubstitueItem( final ItemStack target, final ItemStack input
}
}

// Finally check item damage (32767 is some magic number from thaumcraft)
return( ( target.getItemDamage() == 32767 ) || ( target.getItemDamage() == input.getItemDamage() ) );
// Finally check item damage
return( ( target.getItemDamage() == OreDictionary.WILDCARD_VALUE ) || ( target.getItemDamage() == input.getItemDamage() ) );
}

/**
Expand Down Expand Up @@ -209,7 +210,6 @@ protected void setPatternValidity( final boolean valid )
@Override
public boolean canSubstitute()
{
//return false;
return true;
}

Expand Down

0 comments on commit 2cfd702

Please sign in to comment.