1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-08-28 16:22:18 +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 committed by Jummit
parent eb2d9482a2
commit a72a5e6deb
3 changed files with 19 additions and 18 deletions

View File

@ -8,7 +8,6 @@ package dan200.computercraft.shared.common;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
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;
@ -71,12 +70,7 @@ public final class ColourableRecipe extends SpecialCraftingRecipe {
colourable = stack; colourable = stack;
} else { } else {
DyeColor dye = ColourUtils.getStackColour(stack); DyeColor dye = ColourUtils.getStackColour(stack);
if (dye == null) { if( dye != null ) tracker.addColour( dye );
continue;
}
Colour colour = Colour.fromInt(15 - dye.getId());
tracker.addColour(colour.getR(), colour.getG(), colour.getB());
} }
} }

View File

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

View File

@ -6,6 +6,8 @@
package dan200.computercraft.shared.util; package dan200.computercraft.shared.util;
import net.minecraft.util.DyeColor;
/** /**
* A reimplementation of the colour system in {@link ArmorDyeRecipe}, but bundled together as an object. * A reimplementation of the colour system in {@link ArmorDyeRecipe}, but bundled together as an object.
*/ */
@ -28,8 +30,15 @@ public class ColourTracker {
this.count++; this.count++;
} }
public boolean hasColour() { public void addColour( DyeColor dye )
return this.count > 0; {
Colour colour = Colour.VALUES[15 - dye.getId()];
addColour( colour.getR(), colour.getG(), colour.getB() );
}
public boolean hasColour()
{
return count > 0;
} }
public int getColour() { public int getColour() {