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 dan200.computercraft.shared.util.Colour;
import dan200.computercraft.shared.util.ColourTracker;
import dan200.computercraft.shared.util.ColourUtils;
@ -71,12 +70,7 @@ public final class ColourableRecipe extends SpecialCraftingRecipe {
colourable = stack;
} 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

@ -53,7 +53,9 @@ public class DiskRecipe extends SpecialCraftingRecipe {
return false;
}
redstoneFound = true;
} else if (ColourUtils.getStackColour(stack) != null) {
}
else if( ColourUtils.getStackColour( stack ) == null )
{
return false;
}
}
@ -74,14 +76,10 @@ public class DiskRecipe extends SpecialCraftingRecipe {
continue;
}
if (!this.paper.test(stack) && !this.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( !paper.test( stack ) && !redstone.test( stack ) )
{
DyeColor dye = ColourUtils.getStackColour( stack );
if( dye != null ) tracker.addColour( dye );
}
}

View File

@ -6,6 +6,8 @@
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.
*/
@ -28,8 +30,15 @@ public class ColourTracker {
this.count++;
}
public boolean hasColour() {
return this.count > 0;
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;
}
public int getColour() {