2016-05-16 22:52:27 +02:00
|
|
|
/*
|
|
|
|
* This file ("ColorLensChangerByDyeMeta.java") is part of the Actually Additions mod for Minecraft.
|
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
|
|
|
* http://ellpeck.de/actaddlicense
|
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2017-01-01 16:23:26 +01:00
|
|
|
* © 2015-2017 Ellpeck
|
2016-05-16 22:52:27 +02:00
|
|
|
*/
|
|
|
|
|
2016-05-05 19:50:59 +02:00
|
|
|
package de.ellpeck.actuallyadditions.api.recipe;
|
|
|
|
|
2016-05-06 12:26:41 +02:00
|
|
|
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
2021-02-26 22:15:48 +01:00
|
|
|
import net.minecraft.block.state.BlockState;
|
2016-05-05 19:50:59 +02:00
|
|
|
import net.minecraft.item.ItemStack;
|
2016-05-06 12:26:41 +02:00
|
|
|
import net.minecraft.util.math.BlockPos;
|
2016-05-05 19:50:59 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Changes an item's color by changing its metadata.
|
|
|
|
* Much like dye and wool, 0 is white and 15 is black and it will cycle around.
|
|
|
|
*/
|
2018-07-28 03:40:36 +02:00
|
|
|
public class ColorLensChangerByDyeMeta implements IColorLensChanger {
|
2016-05-05 19:50:59 +02:00
|
|
|
|
|
|
|
@Override
|
2021-02-26 22:15:48 +01:00
|
|
|
public ItemStack modifyItem(ItemStack stack, BlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile) {
|
2016-05-05 19:50:59 +02:00
|
|
|
ItemStack newStack = stack.copy();
|
|
|
|
int meta = newStack.getItemDamage();
|
2018-07-28 03:40:36 +02:00
|
|
|
newStack.setItemDamage((meta + 1) % 16);
|
2016-05-05 19:50:59 +02:00
|
|
|
return newStack;
|
|
|
|
}
|
|
|
|
}
|