Added Linking tool coloring
This commit is contained in:
parent
3be6c491ac
commit
3ad6219d76
|
@ -22,8 +22,10 @@ import com.hrznstudio.titanium.event.handler.EventManager;
|
|||
import com.hrznstudio.titanium.module.ModuleController;
|
||||
import com.hrznstudio.titanium.recipe.generator.TitaniumRecipeProvider;
|
||||
import com.hrznstudio.titanium.tab.AdvancedTitaniumTab;
|
||||
import net.minecraft.client.color.item.ItemColors;
|
||||
import net.minecraft.data.recipes.FinishedRecipe;
|
||||
import net.minecraft.data.tags.BlockTagsProvider;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
@ -31,6 +33,7 @@ import net.minecraft.world.level.block.Block;
|
|||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.ColorHandlerEvent;
|
||||
import net.minecraftforge.client.event.EntityRenderersEvent;
|
||||
import net.minecraftforge.client.model.generators.ItemModelProvider;
|
||||
import net.minecraftforge.common.util.NonNullLazy;
|
||||
|
@ -41,8 +44,11 @@ import net.minecraftforge.registries.ForgeRegistries;
|
|||
import net.minecraftforge.registries.RegistryObject;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jline.utils.Colors;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -131,6 +137,23 @@ public class FunctionalStorage extends ModuleController {
|
|||
registerRenderers.registerBlockEntityRenderer(((BasicTileBlock)COMPACTING_DRAWER.get()).getTileEntityType(), p_173571_ -> new CompactingDrawerRenderer());
|
||||
|
||||
}).subscribe();
|
||||
EventManager.mod(ColorHandlerEvent.Item.class).process(item -> {
|
||||
item.getItemColors().register((stack, tint) -> {
|
||||
CompoundTag tag = stack.getOrCreateTag();
|
||||
LinkingToolItem.LinkingMode linkingMode = LinkingToolItem.LinkingMode.valueOf(tag.getString(LinkingToolItem.NBT_MODE));
|
||||
LinkingToolItem.ActionMode linkingAction = LinkingToolItem.ActionMode.valueOf(tag.getString(LinkingToolItem.NBT_ACTION));
|
||||
if (tint == 3 && tag.contains(LinkingToolItem.NBT_CONTROLLER)){
|
||||
return Color.RED.getRGB();
|
||||
}
|
||||
if (tint == 1){
|
||||
return linkingMode.getColor().getValue();
|
||||
}
|
||||
if (tint == 2){
|
||||
return linkingAction.getColor().getValue();
|
||||
}
|
||||
return 0xffffff;
|
||||
}, LINKING_TOOL.get());
|
||||
}).subscribe();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,6 +18,8 @@ import javax.annotation.Nullable;
|
|||
|
||||
public class ArmoryCabinetTile extends ControllableDrawerTile<ArmoryCabinetTile>{
|
||||
|
||||
//TODO Not sync nbt
|
||||
|
||||
@Save
|
||||
public ArmoryCabinetInventoryHandler handler;
|
||||
private final LazyOptional<IItemHandler> lazyStorage;
|
||||
|
|
|
@ -26,6 +26,8 @@ import java.util.List;
|
|||
|
||||
public class DrawerControllerTile extends ControllableDrawerTile<DrawerControllerTile>{
|
||||
|
||||
//TODO Not sync nbt
|
||||
|
||||
@Save
|
||||
private ConnectedDrawers connectedDrawers;
|
||||
public ControllerInventoryHandler handler;
|
||||
|
|
|
@ -32,9 +32,9 @@ import java.util.Locale;
|
|||
|
||||
public class LinkingToolItem extends BasicItem {
|
||||
|
||||
private final String NBT_MODE = "Mode";
|
||||
private final String NBT_CONTROLLER = "Controller";
|
||||
private final String NBT_ACTION = "Action";
|
||||
public static final String NBT_MODE = "Mode";
|
||||
public static final String NBT_CONTROLLER = "Controller";
|
||||
public static final String NBT_ACTION = "Action";
|
||||
|
||||
public LinkingToolItem() {
|
||||
super(new Properties().tab(FunctionalStorage.TAB).stacksTo(1));
|
||||
|
|
Loading…
Reference in New Issue
Block a user