Fix disk recipes

Closes #652. This has been broken since the 1.13 update. Not filling
myself with confidence here.
This commit is contained in:
Jonathan Coates 2021-01-06 21:17:26 +00:00
parent dd6f97622e
commit 92be0126df
3 changed files with 10 additions and 10 deletions

View File

@ -5,7 +5,6 @@
*/
package dan200.computercraft.shared.common;
import dan200.computercraft.shared.util.Colour;
import dan200.computercraft.shared.util.ColourTracker;
import dan200.computercraft.shared.util.ColourUtils;
import net.minecraft.inventory.CraftingInventory;
@ -75,10 +74,7 @@ public ItemStack getCraftingResult( @Nonnull CraftingInventory inv )
else
{
DyeColor dye = ColourUtils.getStackColour( stack );
if( dye == null ) continue;
Colour colour = Colour.fromInt( 15 - dye.getId() );
tracker.addColour( colour.getR(), colour.getG(), colour.getB() );
if( dye != null ) tracker.addColour( dye );
}
}

View File

@ -55,7 +55,7 @@ else if( redstone.test( stack ) )
if( redstoneFound ) return false;
redstoneFound = true;
}
else if( ColourUtils.getStackColour( stack ) != null )
else if( ColourUtils.getStackColour( stack ) == null )
{
return false;
}
@ -80,10 +80,7 @@ public ItemStack getCraftingResult( @Nonnull CraftingInventory inv )
if( !paper.test( stack ) && !redstone.test( stack ) )
{
DyeColor dye = ColourUtils.getStackColour( stack );
if( dye == null ) continue;
Colour colour = Colour.VALUES[dye.getId()];
tracker.addColour( colour.getR(), colour.getG(), colour.getB() );
if( dye != null ) tracker.addColour( dye );
}
}

View File

@ -5,6 +5,7 @@
*/
package dan200.computercraft.shared.util;
import net.minecraft.item.DyeColor;
import net.minecraft.item.crafting.ArmorDyeRecipe;
/**
@ -33,6 +34,12 @@ public void addColour( float r, float g, float b )
addColour( (int) (r * 255), (int) (g * 255), (int) (b * 255) );
}
public void addColour( DyeColor dye )
{
Colour colour = Colour.VALUES[15 - dye.getId()];
addColour( colour.getR(), colour.getG(), colour.getB() );
}
public boolean hasColour()
{
return count > 0;