mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-12 11:10:29 +00:00
Fix a couple of JEI issues
- Don't treat turtles/pocket computers with no upgrades as an "any" turtle. Otherwise getting the recipe of a crafty turtle shows the recipe of a normal turtle too. - Fix "get usage" of upgrade items not returning their recipes. - Fix NPEs inside JEI (closes #719)
This commit is contained in:
parent
e8f5531a8c
commit
b17ff6daf0
@ -114,10 +114,10 @@ public class JEIComputerCraft implements IModPlugin
|
|||||||
*/
|
*/
|
||||||
private static final ISubtypeInterpreter turtleSubtype = stack -> {
|
private static final ISubtypeInterpreter turtleSubtype = stack -> {
|
||||||
Item item = stack.getItem();
|
Item item = stack.getItem();
|
||||||
if( !(item instanceof ITurtleItem) ) return "";
|
if( !(item instanceof ITurtleItem) ) return ISubtypeInterpreter.NONE;
|
||||||
|
|
||||||
ITurtleItem turtle = (ITurtleItem) item;
|
ITurtleItem turtle = (ITurtleItem) item;
|
||||||
StringBuilder name = new StringBuilder();
|
StringBuilder name = new StringBuilder("turtle:");
|
||||||
|
|
||||||
// Add left and right upgrades to the identifier
|
// Add left and right upgrades to the identifier
|
||||||
ITurtleUpgrade left = turtle.getUpgrade( stack, TurtleSide.LEFT );
|
ITurtleUpgrade left = turtle.getUpgrade( stack, TurtleSide.LEFT );
|
||||||
@ -134,9 +134,9 @@ public class JEIComputerCraft implements IModPlugin
|
|||||||
*/
|
*/
|
||||||
private static final ISubtypeInterpreter pocketSubtype = stack -> {
|
private static final ISubtypeInterpreter pocketSubtype = stack -> {
|
||||||
Item item = stack.getItem();
|
Item item = stack.getItem();
|
||||||
if( !(item instanceof ItemPocketComputer) ) return "";
|
if( !(item instanceof ItemPocketComputer) ) return ISubtypeInterpreter.NONE;
|
||||||
|
|
||||||
StringBuilder name = new StringBuilder();
|
StringBuilder name = new StringBuilder("pocket:");
|
||||||
|
|
||||||
// Add the upgrade to the identifier
|
// Add the upgrade to the identifier
|
||||||
IPocketUpgrade upgrade = ItemPocketComputer.getUpgrade( stack );
|
IPocketUpgrade upgrade = ItemPocketComputer.getUpgrade( stack );
|
||||||
@ -150,11 +150,11 @@ public class JEIComputerCraft implements IModPlugin
|
|||||||
*/
|
*/
|
||||||
private static final ISubtypeInterpreter diskSubtype = stack -> {
|
private static final ISubtypeInterpreter diskSubtype = stack -> {
|
||||||
Item item = stack.getItem();
|
Item item = stack.getItem();
|
||||||
if( !(item instanceof ItemDisk) ) return "";
|
if( !(item instanceof ItemDisk) ) return ISubtypeInterpreter.NONE;
|
||||||
|
|
||||||
ItemDisk disk = (ItemDisk) item;
|
ItemDisk disk = (ItemDisk) item;
|
||||||
|
|
||||||
int colour = disk.getColour( stack );
|
int colour = disk.getColour( stack );
|
||||||
return colour == -1 ? "" : String.format( "%06x", colour );
|
return colour == -1 ? ISubtypeInterpreter.NONE : String.format( "%06x", colour );
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ class RecipeResolver implements IRecipeManagerPlugin
|
|||||||
for( UpgradeInfo upgrade : upgrades )
|
for( UpgradeInfo upgrade : upgrades )
|
||||||
{
|
{
|
||||||
ItemStack craftingStack = upgrade.stack;
|
ItemStack craftingStack = upgrade.stack;
|
||||||
if( !craftingStack.isEmpty() && craftingStack.getItem() == stack.getItem() && upgrade.upgrade.isItemSuitable( stack ) )
|
if( craftingStack.isEmpty() || craftingStack.getItem() != stack.getItem() || !upgrade.upgrade.isItemSuitable( stack ) )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -319,13 +319,6 @@ class RecipeResolver implements IRecipeManagerPlugin
|
|||||||
super( ID, null, width, height, input, output );
|
super( ID, null, width, height, input, output );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getId()
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public IRecipeSerializer<?> getSerializer()
|
public IRecipeSerializer<?> getSerializer()
|
||||||
|
Loading…
Reference in New Issue
Block a user