diff --git a/patchwork.md b/patchwork.md index 4763fe0a9..465fe5822 100644 --- a/patchwork.md +++ b/patchwork.md @@ -72,4 +72,13 @@ port :8080. # Other rules as before. Closes #540 -``` \ No newline at end of file +``` + +The alterations in ColourUtils.java were not needed so they were not ported over +``` +6f868849ab2f264508e12c184cc56f2632aaf5bc +Use tags to check if something is a dye + +We half did this already, just needed to change a couple of checks. +Closes #541. +``` diff --git a/src/main/java/dan200/computercraft/shared/peripheral/printer/ContainerPrinter.java b/src/main/java/dan200/computercraft/shared/peripheral/printer/ContainerPrinter.java index 52d3757c2..dd9e9d761 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/printer/ContainerPrinter.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/printer/ContainerPrinter.java @@ -15,7 +15,6 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.Inventory; import net.minecraft.inventory.SimpleInventory; -import net.minecraft.item.DyeItem; import net.minecraft.item.ItemStack; import net.minecraft.screen.ArrayPropertyDelegate; import net.minecraft.screen.PropertyDelegate; @@ -87,7 +86,7 @@ public class ContainerPrinter extends ScreenHandler { } } else { // Transfer from inventory to printer - if (stack.getItem() instanceof DyeItem) { + if( TilePrinter.isInk( stack ) ) { if (!this.insertItem(stack, 0, 1, false)) { return ItemStack.EMPTY; } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/printer/TilePrinter.java b/src/main/java/dan200/computercraft/shared/peripheral/printer/TilePrinter.java index a6dbfbbab..03fa0a1e9 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/printer/TilePrinter.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/printer/TilePrinter.java @@ -278,8 +278,8 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent } } - private static boolean isInk(@Nonnull ItemStack stack) { - return stack.getItem() instanceof DyeItem; + static boolean isInk(@Nonnull ItemStack stack) { + return ColourUtils.getStackColour( stack ) != null; } @Nonnull @@ -380,9 +380,8 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent private boolean inputPage() { ItemStack inkStack = this.m_inventory.get(0); - if (!isInk(inkStack)) { - return false; - } + DyeColor dye = ColourUtils.getStackColour( inkStack ); + if( dye == null ) return false; for (int i = 1; i < 7; i++) { ItemStack paperStack = this.m_inventory.get(i); @@ -391,8 +390,7 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent } // Setup the new page - DyeColor dye = ColourUtils.getStackColour(inkStack); - this.m_page.setTextColour(dye != null ? dye.getId() : 15); + m_page.setTextColour( dye.getId() ); this.m_page.clear(); if (paperStack.getItem() instanceof ItemPrintout) {