mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-08-26 23:42:18 +00:00
Use tags to check if something is a dye
This commit is contained in:
parent
71d764f122
commit
d483a91459
11
patchwork.md
11
patchwork.md
@ -72,4 +72,13 @@ port :8080.
|
||||
# Other rules as before.
|
||||
|
||||
Closes #540
|
||||
```
|
||||
```
|
||||
|
||||
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.
|
||||
```
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user