mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-04-07 19:26:42 +00:00
Use tags to check if something is a dye
We half did this already, just needed to change a couple of checks. Closes #541.
This commit is contained in:
parent
275ca58a82
commit
6f868849ab
@ -13,7 +13,6 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.item.DyeItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIntArray;
|
||||
import net.minecraft.util.IntArray;
|
||||
@ -95,7 +94,7 @@ public class ContainerPrinter extends Container
|
||||
else
|
||||
{
|
||||
// Transfer from inventory to printer
|
||||
if( stack.getItem() instanceof DyeItem )
|
||||
if( TilePrinter.isInk( stack ) )
|
||||
{
|
||||
if( !mergeItemStack( stack, 0, 1, false ) ) return ItemStack.EMPTY;
|
||||
}
|
||||
|
@ -300,9 +300,9 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isInk( @Nonnull ItemStack stack )
|
||||
static boolean isInk( @Nonnull ItemStack stack )
|
||||
{
|
||||
return stack.getItem() instanceof DyeItem;
|
||||
return ColourUtils.getStackColour( stack ) != null;
|
||||
}
|
||||
|
||||
private static boolean isPaper( @Nonnull ItemStack stack )
|
||||
@ -321,7 +321,8 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent
|
||||
private boolean inputPage()
|
||||
{
|
||||
ItemStack inkStack = 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++ )
|
||||
{
|
||||
@ -329,8 +330,7 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent
|
||||
if( paperStack.isEmpty() || !isPaper( paperStack ) ) continue;
|
||||
|
||||
// Setup the new page
|
||||
DyeColor dye = ColourUtils.getStackColour( inkStack );
|
||||
m_page.setTextColour( dye != null ? dye.getId() : 15 );
|
||||
m_page.setTextColour( dye.getId() );
|
||||
|
||||
m_page.clear();
|
||||
if( paperStack.getItem() instanceof ItemPrintout )
|
||||
|
@ -40,6 +40,8 @@ public final class ColourUtils
|
||||
|
||||
public static DyeColor getStackColour( ItemStack stack )
|
||||
{
|
||||
if( stack.isEmpty() ) return null;
|
||||
|
||||
for( int i = 0; i < DYES.length; i++ )
|
||||
{
|
||||
Tag<Item> dye = DYES[i];
|
||||
|
Loading…
x
Reference in New Issue
Block a user