1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-12 19:20:29 +00:00

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; package dan200.computercraft.shared.common;
import dan200.computercraft.shared.util.Colour;
import dan200.computercraft.shared.util.ColourTracker; import dan200.computercraft.shared.util.ColourTracker;
import dan200.computercraft.shared.util.ColourUtils; import dan200.computercraft.shared.util.ColourUtils;
import net.minecraft.inventory.CraftingInventory; import net.minecraft.inventory.CraftingInventory;
@ -75,10 +74,7 @@ public final class ColourableRecipe extends SpecialRecipe
else else
{ {
DyeColor dye = ColourUtils.getStackColour( stack ); DyeColor dye = ColourUtils.getStackColour( stack );
if( dye == null ) continue; if( dye != null ) tracker.addColour( dye );
Colour colour = Colour.fromInt( 15 - dye.getId() );
tracker.addColour( colour.getR(), colour.getG(), colour.getB() );
} }
} }

View File

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

View File

@ -5,6 +5,7 @@
*/ */
package dan200.computercraft.shared.util; package dan200.computercraft.shared.util;
import net.minecraft.item.DyeColor;
import net.minecraft.item.crafting.ArmorDyeRecipe; import net.minecraft.item.crafting.ArmorDyeRecipe;
/** /**
@ -33,6 +34,12 @@ public class ColourTracker
addColour( (int) (r * 255), (int) (g * 255), (int) (b * 255) ); 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() public boolean hasColour()
{ {
return count > 0; return count > 0;