Register the Capabilities to the blockentities and items that have them

Also change the DeferredItem's to return the class of the item
This commit is contained in:
Mrbysco 2024-03-04 23:44:24 +01:00
parent 717199ea88
commit 99f670656c
9 changed files with 215 additions and 124 deletions

View file

@ -92,7 +92,7 @@ public class ItemModelGenerator extends ItemModelProvider {
getBuilder(path).parent(new ModelFile.UncheckedModelFile(modLoc("block/" + path)));
}
private void simpleItem(Supplier<Item> item) {
private void simpleItem(Supplier<? extends Item> item) {
String path = BuiltInRegistries.ITEM.getKey(item.get()).getPath();
singleTexture(path, mcLoc("item/handheld"), "layer0", modLoc("item/" + path));
}

View file

@ -507,7 +507,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
addPaxel(consumer, ActuallyItems.NETHERITE_AIOT, Items.NETHERITE_AXE, Items.NETHERITE_PICKAXE, Items.NETHERITE_SWORD, Items.NETHERITE_SHOVEL, Items.NETHERITE_HOE);
}
public static void addPaxel(RecipeOutput consumer, DeferredItem<Item> output, Item axe, Item pickaxe, Item sword, Item shovel, Item hoe) {
public static void addPaxel(RecipeOutput consumer, DeferredItem<? extends Item> output, Item axe, Item pickaxe, Item sword, Item shovel, Item hoe) {
Recipe.shapeless(output.get())
.requires(axe)
.requires(pickaxe)
@ -517,7 +517,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
.save(consumer);
}
public static void addPaxel(RecipeOutput consumer, DeferredItem<Item> output, DeferredItem<Item> axe, DeferredItem<Item> pickaxe, DeferredItem<Item> sword, DeferredItem<Item> shovel, DeferredItem<Item> hoe) {
public static void addPaxel(RecipeOutput consumer, DeferredItem<? extends Item> output, DeferredItem<? extends Item> axe, DeferredItem<? extends Item> pickaxe, DeferredItem<? extends Item> sword, DeferredItem<? extends Item> shovel, DeferredItem<? extends Item> hoe) {
Recipe.shapeless(output.get())
.requires(axe.get())
.requires(pickaxe.get())
@ -527,20 +527,20 @@ public class ItemRecipeGenerator extends RecipeProvider {
.save(consumer);
}
public static void decompress(RecipeOutput consumer, DeferredItem<Item> output, DeferredItem<Item> input) {
public static void decompress(RecipeOutput consumer, DeferredItem<? extends Item> output, DeferredItem<? extends Item> input) {
ResourceLocation key = BuiltInRegistries.ITEM.getKey(output.get());
Recipe.shapeless(output.get(), 9).requires(input.get()).save(consumer, new ResourceLocation(key.getNamespace(), "decompress/" + key.getPath()));
}
public static void compress(RecipeOutput consumer, DeferredItem<Item> output, DeferredItem<Item> input) {
public static void compress(RecipeOutput consumer, DeferredItem<? extends Item> output, DeferredItem<? extends Item> input) {
ResourceLocation key = BuiltInRegistries.ITEM.getKey(output.get());
Recipe.shaped(output.get()).pattern("xxx","xxx", "xxx").define('x', input.get()).save(consumer, new ResourceLocation(key.getNamespace(), "compress/" + key.getPath()));
}
public static void addShard(RecipeOutput consumer, DeferredItem<Item> shard, DeferredItem<Item> crystal) {
public static void addShard(RecipeOutput consumer, DeferredItem<? extends Item> shard, DeferredItem<? extends Item> crystal) {
compress(consumer, crystal, shard);
decompress(consumer, shard, crystal);
}
public static void addToolAndArmorRecipes(RecipeOutput consumer, DeferredItem<Item> base, DeferredItem<Item> pickaxe, DeferredItem<Item> sword, DeferredItem<Item> axe, DeferredItem<Item> shovel, DeferredItem<Item> hoe, DeferredItem<Item> helm, DeferredItem<Item> chest, DeferredItem<Item> pants, DeferredItem<Item> boots) {
public static void addToolAndArmorRecipes(RecipeOutput consumer, DeferredItem<? extends Item> base, DeferredItem<? extends Item> pickaxe, DeferredItem<? extends Item> sword, DeferredItem<? extends Item> axe, DeferredItem<? extends Item> shovel, DeferredItem<? extends Item> hoe, DeferredItem<? extends Item> helm, DeferredItem<? extends Item> chest, DeferredItem<? extends Item> pants, DeferredItem<? extends Item> boots) {
//Pickaxe
Recipe.shaped(pickaxe.get())
.pattern("EEE", " S ", " S ")

View file

@ -198,20 +198,20 @@ public class LootTableGenerator extends LootTableProvider {
addCrop(ActuallyBlocks.COFFEE, ActuallyItems.COFFEE_BEANS, ActuallyItems.COFFEE_BEANS);
}
private void addCrop(Supplier<Block> block, Supplier<Item> item, Supplier<Item> seed) {
private void addCrop(Supplier<? extends Block> block, Supplier<? extends Item> item, Supplier<? extends Item> seed) {
add(block.get(), createCropDrops(block.get(), item.get(), seed.get(),
LootItemBlockStatePropertyCondition.hasBlockStateProperties(block.get()).setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(CropBlock.AGE, 7))));
}
private void dropNBT(Supplier<Block> blockSupplier, Consumer<LootPool.Builder> lootFunctionProvider) {
private void dropNBT(Supplier<? extends Block> blockSupplier, Consumer<LootPool.Builder> lootFunctionProvider) {
LootPool.Builder lootpool = LootPool.lootPool().setRolls(ConstantValue.exactly(1)).add(LootItem.lootTableItem(blockSupplier.get()));
lootFunctionProvider.accept(lootpool);
add(blockSupplier.get(), LootTable.lootTable().withPool(applyExplosionCondition(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get(), lootpool)));
}
private void dropKeepEnergy(Supplier<Block> blockSupplier) {
private void dropKeepEnergy(Supplier<? extends Block> blockSupplier) {
dropNBT(blockSupplier, $ -> $.apply(CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY).copy("Energy", "BlockEntityTag.Energy")));
}

View file

@ -14,6 +14,7 @@ import com.mojang.serialization.Codec;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.ActuallyTags;
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
import de.ellpeck.actuallyadditions.mod.attachments.ActuallyAttachments;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.config.conditions.BoolConfigCondition;
@ -96,6 +97,7 @@ public class ActuallyAdditions {
ActuallyTabs.init(eventBus);
ActuallyRecipes.init(eventBus);
AASounds.init(eventBus);
ActuallyAttachments.init(eventBus);
ActuallyContainers.CONTAINERS.register(eventBus);
ENTITIES.register(eventBus);
CONDITION_CODECS.register(eventBus);

View file

@ -0,0 +1,21 @@
package de.ellpeck.actuallyadditions.mod.attachments;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.attachment.AttachmentType;
import net.neoforged.neoforge.registries.DeferredRegister;
import net.neoforged.neoforge.registries.NeoForgeRegistries;
import java.util.function.Supplier;
public class ActuallyAttachments {
private static final DeferredRegister<AttachmentType<?>> ATTACHMENT_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.ATTACHMENT_TYPES, ActuallyAdditions.MODID);
public static final Supplier<AttachmentType<CustomEnergyStorage>> ENERGY_STORAGE = ATTACHMENT_TYPES.register(
"energy", () -> AttachmentType.serializable((holder) -> new CustomEnergyStorage(250000, 1000, 1000)).build());
public static void init(IEventBus evt) {
ATTACHMENT_TYPES.register(evt);
}
}

View file

@ -15,6 +15,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.AACrops;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.Crystals;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBreaker;
@ -64,6 +65,7 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
import de.ellpeck.actuallyadditions.registration.AABlockReg;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.BaseEntityBlock;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.SlabBlock;
@ -75,9 +77,13 @@ import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.material.PushReaction;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.capabilities.Capabilities;
import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent;
import net.neoforged.neoforge.registries.DeferredHolder;
import net.neoforged.neoforge.registries.DeferredRegister;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;
public final class ActuallyBlocks {
@ -337,6 +343,60 @@ public final class ActuallyBlocks {
}
public static void registerCapabilities(RegisterCapabilitiesEvent event) {
//TODO: Register caps to the BlockEntities that have them
List<BlockEntityType<? extends TileEntityBase>> types = List.of(
FEEDER.getTileEntityType(),
CRUSHER.getTileEntityType(),
CRUSHER_DOUBLE.getTileEntityType(),
ENERGIZER.getTileEntityType(),
ENERVATOR.getTileEntityType(),
LAVA_FACTORY_CONTROLLER.getTileEntityType(),
CANOLA_PRESS.getTileEntityType(),
FERMENTING_BARREL.getTileEntityType(),
OIL_GENERATOR.getTileEntityType(),
COAL_GENERATOR.getTileEntityType(),
LEAF_GENERATOR.getTileEntityType(),
XP_SOLIDIFIER.getTileEntityType(),
BREAKER.getTileEntityType(),
PLACER.getTileEntityType(),
DROPPER.getTileEntityType(),
FLUID_PLACER.getTileEntityType(),
FLUID_COLLECTOR.getTileEntityType(),
FARMER.getTileEntityType(),
BIOREACTOR.getTileEntityType(),
VERTICAL_DIGGER.getTileEntityType(),
ATOMIC_RECONSTRUCTOR.getTileEntityType(),
RANGED_COLLECTOR.getTileEntityType(),
LONG_RANGE_BREAKER.getTileEntityType(),
COFFEE_MACHINE.getTileEntityType(),
POWERED_FURNACE.getTileEntityType(),
EMPOWERER.getTileEntityType(),
DISPLAY_STAND.getTileEntityType(),
PLAYER_INTERFACE.getTileEntityType(),
ITEM_INTERFACE.getTileEntityType(),
ITEM_INTERFACE_HOPPING.getTileEntityType(),
PHANTOM_ITEMFACE.getTileEntityType(),
PHANTOM_PLACER.getTileEntityType(),
PHANTOM_LIQUIFACE.getTileEntityType(),
PHANTOM_ENERGYFACE.getTileEntityType(),
PHANTOM_REDSTONEFACE.getTileEntityType(),
PHANTOM_BREAKER.getTileEntityType(),
PHANTOM_BOOSTER.getTileEntityType(),
BATTERY_BOX.getTileEntityType(),
FIREWORK_BOX.getTileEntityType(),
SHOCK_SUPPRESSOR.getTileEntityType(),
HEAT_COLLECTOR.getTileEntityType(),
LASER_RELAY.getTileEntityType(),
LASER_RELAY_ADVANCED.getTileEntityType(),
LASER_RELAY_EXTREME.getTileEntityType(),
LASER_RELAY_FLUIDS.getTileEntityType(),
LASER_RELAY_ITEM.getTileEntityType(),
LASER_RELAY_ITEM_ADVANCED.getTileEntityType()
);
types.forEach(type -> {
event.registerBlockEntity(Capabilities.ItemHandler.BLOCK, type, TileEntityBase::getItemHandler);
event.registerBlockEntity(Capabilities.EnergyStorage.BLOCK, type, TileEntityBase::getEnergyStorage);
event.registerBlockEntity(Capabilities.FluidHandler.BLOCK, type, TileEntityBase::getFluidHandler);
});
}
}

View file

@ -7,8 +7,8 @@ import net.minecraft.world.level.block.CropBlock;
import java.util.function.Supplier;
public class AACrops extends CropBlock {
Supplier<Item> itemSupplier;
public AACrops(Properties properties, Supplier<Item> seedSupplier) {
Supplier<? extends Item> itemSupplier;
public AACrops(Properties properties, Supplier<? extends Item> seedSupplier) {
super(properties);
this.itemSupplier = seedSupplier;
}

View file

@ -23,6 +23,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Tiers;
import net.minecraft.world.item.crafting.RecipeType;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.capabilities.Capabilities;
import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent;
import net.neoforged.neoforge.registries.DeferredHolder;
import net.neoforged.neoforge.registries.DeferredItem;
@ -37,150 +38,150 @@ public final class ActuallyItems {
public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(ActuallyAdditions.MODID);
// MISC ITEMS
public static final DeferredItem<Item> CANOLA = ITEMS.register("canola", () -> new ItemBase());
public static final DeferredItem<Item> COFFEE_CUP = ITEMS.register("coffee_cup", () -> new ItemBase());
public static final DeferredItem<Item> PAPER_CONE = ITEMS.register("paper_cone", () -> new ItemBase());
public static final DeferredItem<Item> DOUGH = ITEMS.register("dough", () -> new ItemBase());
public static final DeferredItem<Item> RING = ITEMS.register("ring", () -> new ItemBase());
public static final DeferredItem<Item> BASIC_COIL = ITEMS.register("basic_coil", () -> new ItemBase());
public static final DeferredItem<Item> ADVANCED_COIL = ITEMS.register("advanced_coil", () -> new ItemBase());
public static final DeferredItem<Item> RICE = ITEMS.register("rice", () -> new ItemBase());
public static final DeferredItem<Item> RICE_DOUGH = ITEMS.register("rice_dough", () -> new ItemBase());
public static final DeferredItem<Item> TINY_COAL = ITEMS.register("tiny_coal", () -> new ItemBase() {
public static final DeferredItem<ItemBase> CANOLA = ITEMS.register("canola", () -> new ItemBase());
public static final DeferredItem<ItemBase> COFFEE_CUP = ITEMS.register("coffee_cup", () -> new ItemBase());
public static final DeferredItem<ItemBase> PAPER_CONE = ITEMS.register("paper_cone", () -> new ItemBase());
public static final DeferredItem<ItemBase> DOUGH = ITEMS.register("dough", () -> new ItemBase());
public static final DeferredItem<ItemBase> RING = ITEMS.register("ring", () -> new ItemBase());
public static final DeferredItem<ItemBase> BASIC_COIL = ITEMS.register("basic_coil", () -> new ItemBase());
public static final DeferredItem<ItemBase> ADVANCED_COIL = ITEMS.register("advanced_coil", () -> new ItemBase());
public static final DeferredItem<ItemBase> RICE = ITEMS.register("rice", () -> new ItemBase());
public static final DeferredItem<ItemBase> RICE_DOUGH = ITEMS.register("rice_dough", () -> new ItemBase());
public static final DeferredItem<ItemBase> TINY_COAL = ITEMS.register("tiny_coal", () -> new ItemBase() {
@Override
public int getBurnTime(ItemStack itemStack, @Nullable RecipeType<?> recipeType) {
return 200;
}
});
public static final DeferredItem<Item> TINY_CHARCOAL = ITEMS.register("tiny_charcoal", () -> new ItemBase() {
public static final DeferredItem<ItemBase> TINY_CHARCOAL = ITEMS.register("tiny_charcoal", () -> new ItemBase() {
@Override
public int getBurnTime(ItemStack itemStack, @Nullable RecipeType<?> recipeType) {
return 200;
}
});
public static final DeferredItem<Item> RICE_SLIMEBALL = ITEMS.register("rice_slimeball", () -> new ItemBase());
public static final DeferredItem<Item> EMPTY_CUP = ITEMS.register("empty_cup", () -> new ItemBase());
public static final DeferredItem<Item> BATS_WING = ITEMS.register("bats_wing", () -> new ItemBase());
public static final DeferredItem<Item> DRILL_CORE = ITEMS.register("drill_core", () -> new ItemBase());
public static final DeferredItem<Item> LENS = ITEMS.register("lens", () -> new ItemBase());
public static final DeferredItem<Item> ENDER_STAR = ITEMS.register("ender_star", () -> new ItemBase() {
public static final DeferredItem<ItemBase> RICE_SLIMEBALL = ITEMS.register("rice_slimeball", () -> new ItemBase());
public static final DeferredItem<ItemBase> EMPTY_CUP = ITEMS.register("empty_cup", () -> new ItemBase());
public static final DeferredItem<ItemBase> BATS_WING = ITEMS.register("bats_wing", () -> new ItemBase());
public static final DeferredItem<ItemBase> DRILL_CORE = ITEMS.register("drill_core", () -> new ItemBase());
public static final DeferredItem<ItemBase> LENS = ITEMS.register("lens", () -> new ItemBase());
public static final DeferredItem<ItemBase> ENDER_STAR = ITEMS.register("ender_star", () -> new ItemBase() {
@Override
public boolean isFoil(@Nonnull ItemStack pStack) {
return true;
}
});
public static final DeferredItem<Item> CRYSTALLIZED_CANOLA_SEED = ITEMS.register("crystallized_canola_seed", () -> new CanolaSeed(false));
public static final DeferredItem<Item> EMPOWERED_CANOLA_SEED = ITEMS.register("empowered_canola_seed", () -> new CanolaSeed(true));
public static final DeferredItem<CanolaSeed> CRYSTALLIZED_CANOLA_SEED = ITEMS.register("crystallized_canola_seed", () -> new CanolaSeed(false));
public static final DeferredItem<CanolaSeed> EMPOWERED_CANOLA_SEED = ITEMS.register("empowered_canola_seed", () -> new CanolaSeed(true));
// SHARDS
public static final DeferredItem<Item> RESTONIA_CRYSTAL_SHARD = ITEMS.register("restonia_crystal_shard", () -> new ItemBase());
public static final DeferredItem<Item> PALIS_CRYSTAL_SHARD = ITEMS.register("palis_crystal_shard", () -> new ItemBase());
public static final DeferredItem<Item> DIAMATINE_CRYSTAL_SHARD = ITEMS.register("diamatine_crystal_shard", () -> new ItemBase());
public static final DeferredItem<Item> VOID_CRYSTAL_SHARD = ITEMS.register("void_crystal_shard", () -> new ItemBase());
public static final DeferredItem<Item> EMERADIC_CRYSTAL_SHARD = ITEMS.register("emeradic_crystal_shard", () -> new ItemBase());
public static final DeferredItem<Item> ENORI_CRYSTAL_SHARD = ITEMS.register("enori_crystal_shard", () -> new ItemBase());
public static final DeferredItem<ItemBase> RESTONIA_CRYSTAL_SHARD = ITEMS.register("restonia_crystal_shard", () -> new ItemBase());
public static final DeferredItem<ItemBase> PALIS_CRYSTAL_SHARD = ITEMS.register("palis_crystal_shard", () -> new ItemBase());
public static final DeferredItem<ItemBase> DIAMATINE_CRYSTAL_SHARD = ITEMS.register("diamatine_crystal_shard", () -> new ItemBase());
public static final DeferredItem<ItemBase> VOID_CRYSTAL_SHARD = ITEMS.register("void_crystal_shard", () -> new ItemBase());
public static final DeferredItem<ItemBase> EMERADIC_CRYSTAL_SHARD = ITEMS.register("emeradic_crystal_shard", () -> new ItemBase());
public static final DeferredItem<ItemBase> ENORI_CRYSTAL_SHARD = ITEMS.register("enori_crystal_shard", () -> new ItemBase());
// CRYSTALS
public static final DeferredItem<Item> RESTONIA_CRYSTAL = ITEMS.register("restonia_crystal", () -> new ItemCrystal());
public static final DeferredItem<Item> PALIS_CRYSTAL = ITEMS.register("palis_crystal", () -> new ItemCrystal());
public static final DeferredItem<Item> DIAMATINE_CRYSTAL = ITEMS.register("diamatine_crystal", () -> new ItemCrystal());
public static final DeferredItem<Item> VOID_CRYSTAL = ITEMS.register("void_crystal", () -> new ItemCrystal());
public static final DeferredItem<Item> EMERADIC_CRYSTAL = ITEMS.register("emeradic_crystal", () -> new ItemCrystal());
public static final DeferredItem<Item> ENORI_CRYSTAL = ITEMS.register("enori_crystal", () -> new ItemCrystal());
public static final DeferredItem<ItemCrystal> RESTONIA_CRYSTAL = ITEMS.register("restonia_crystal", () -> new ItemCrystal());
public static final DeferredItem<ItemCrystal> PALIS_CRYSTAL = ITEMS.register("palis_crystal", () -> new ItemCrystal());
public static final DeferredItem<ItemCrystal> DIAMATINE_CRYSTAL = ITEMS.register("diamatine_crystal", () -> new ItemCrystal());
public static final DeferredItem<ItemCrystal> VOID_CRYSTAL = ITEMS.register("void_crystal", () -> new ItemCrystal());
public static final DeferredItem<ItemCrystal> EMERADIC_CRYSTAL = ITEMS.register("emeradic_crystal", () -> new ItemCrystal());
public static final DeferredItem<ItemCrystal> ENORI_CRYSTAL = ITEMS.register("enori_crystal", () -> new ItemCrystal());
public static final DeferredItem<Item> EMPOWERED_RESTONIA_CRYSTAL = ITEMS.register("empowered_restonia_crystal", () -> new ItemCrystal(true));
public static final DeferredItem<Item> EMPOWERED_PALIS_CRYSTAL = ITEMS.register("empowered_palis_crystal", () -> new ItemCrystal(true));
public static final DeferredItem<Item> EMPOWERED_DIAMATINE_CRYSTAL = ITEMS.register("empowered_diamatine_crystal", () -> new ItemCrystal(true));
public static final DeferredItem<Item> EMPOWERED_VOID_CRYSTAL = ITEMS.register("empowered_void_crystal", () -> new ItemCrystal(true));
public static final DeferredItem<Item> EMPOWERED_EMERADIC_CRYSTAL = ITEMS.register("empowered_emeradic_crystal", () -> new ItemCrystal(true));
public static final DeferredItem<Item> EMPOWERED_ENORI_CRYSTAL = ITEMS.register("empowered_enori_crystal", () -> new ItemCrystal(true));
public static final DeferredItem<ItemCrystal> EMPOWERED_RESTONIA_CRYSTAL = ITEMS.register("empowered_restonia_crystal", () -> new ItemCrystal(true));
public static final DeferredItem<ItemCrystal> EMPOWERED_PALIS_CRYSTAL = ITEMS.register("empowered_palis_crystal", () -> new ItemCrystal(true));
public static final DeferredItem<ItemCrystal> EMPOWERED_DIAMATINE_CRYSTAL = ITEMS.register("empowered_diamatine_crystal", () -> new ItemCrystal(true));
public static final DeferredItem<ItemCrystal> EMPOWERED_VOID_CRYSTAL = ITEMS.register("empowered_void_crystal", () -> new ItemCrystal(true));
public static final DeferredItem<ItemCrystal> EMPOWERED_EMERADIC_CRYSTAL = ITEMS.register("empowered_emeradic_crystal", () -> new ItemCrystal(true));
public static final DeferredItem<ItemCrystal> EMPOWERED_ENORI_CRYSTAL = ITEMS.register("empowered_enori_crystal", () -> new ItemCrystal(true));
// BLACK QUARTZ
public static final DeferredItem<Item> BLACK_QUARTZ = ITEMS.register("black_quartz", () -> new ItemBase());
public static final DeferredItem<ItemBase> BLACK_QUARTZ = ITEMS.register("black_quartz", () -> new ItemBase());
public static final DeferredItem<Item> ENGINEERS_GOGGLES_ADVANCED = ITEMS.register("engineers_goggles_advanced", () -> new ItemEngineerGoggles(true));
public static final DeferredItem<Item> ENGINEERS_GOGGLES = ITEMS.register("engineers_goggles", () -> new ItemEngineerGoggles(false));
public static final DeferredItem<Item> LASER_UPGRADE_RANGE = ITEMS.register("laser_upgrade_range", ItemLaserRelayUpgrade::new);
public static final DeferredItem<Item> LASER_UPGRADE_INVISIBILITY = ITEMS.register("laser_upgrade_invisibility", ItemLaserRelayUpgrade::new);
public static final Supplier<Item> HANDHELD_FILLER = ITEMS.register("handheld_filler", ItemFillingWand::new);
public static final DeferredItem<Item> TRAVELERS_SACK = ITEMS.register("travelers_sack", () -> new Sack(false));
public static final DeferredItem<Item> VOID_SACK = ITEMS.register("void_sack", () -> new Sack(true));
public static final DeferredItem<Item> WORM = ITEMS.register("worm", Worm::new);
public static final DeferredItem<Item> PLAYER_PROBE = ITEMS.register("player_probe", ItemPlayerProbe::new);
public static final DeferredItem<Item> FILTER = ITEMS.register("filter", ItemFilter::new);
public static final DeferredItem<Item> WATER_BOWL = ITEMS.register("water_bowl", ItemWaterBowl::new);
public static final DeferredItem<Item> CRATE_KEEPER = ITEMS.register("crate_keeper", () -> new ItemGeneric(defaultProps().stacksTo(1)));
public static final DeferredItem<Item> LENS_OF_COLOR = ITEMS.register("lens_of_color", () -> new ItemLens(ActuallyAdditionsAPI.lensColor));
public static final DeferredItem<Item> LENS_OF_DETONATION = ITEMS.register("lens_of_detonation", () -> new ItemLens(ActuallyAdditionsAPI.lensDetonation));
public static final DeferredItem<Item> LENS_OF_CERTAIN_DEATH = ITEMS.register("lens_of_certain_death", () -> new ItemLens(ActuallyAdditionsAPI.lensDeath));
public static final DeferredItem<Item> LENS_OF_THE_KILLER = ITEMS.register("lens_of_the_killer", () -> new ItemLens(ActuallyAdditionsAPI.lensEvenMoarDeath));
public static final DeferredItem<Item> LENS_OF_DISENCHANTING = ITEMS.register("lens_of_disenchanting", () -> new ItemLens(ActuallyAdditionsAPI.lensDisenchanting));
public static final DeferredItem<Item> LENS_OF_THE_MINER = ITEMS.register("lens_of_the_miner", () -> new ItemLens(ActuallyAdditionsAPI.lensMining));
public static final DeferredItem<Item> LASER_WRENCH = ITEMS.register("laser_wrench", ItemLaserWrench::new);
public static final DeferredItem<ItemEngineerGoggles> ENGINEERS_GOGGLES_ADVANCED = ITEMS.register("engineers_goggles_advanced", () -> new ItemEngineerGoggles(true));
public static final DeferredItem<ItemEngineerGoggles> ENGINEERS_GOGGLES = ITEMS.register("engineers_goggles", () -> new ItemEngineerGoggles(false));
public static final DeferredItem<ItemLaserRelayUpgrade> LASER_UPGRADE_RANGE = ITEMS.register("laser_upgrade_range", ItemLaserRelayUpgrade::new);
public static final DeferredItem<ItemLaserRelayUpgrade> LASER_UPGRADE_INVISIBILITY = ITEMS.register("laser_upgrade_invisibility", ItemLaserRelayUpgrade::new);
public static final DeferredItem<ItemFillingWand> HANDHELD_FILLER = ITEMS.register("handheld_filler", ItemFillingWand::new);
public static final DeferredItem<Sack> TRAVELERS_SACK = ITEMS.register("travelers_sack", () -> new Sack(false));
public static final DeferredItem<Sack> VOID_SACK = ITEMS.register("void_sack", () -> new Sack(true));
public static final DeferredItem<Worm> WORM = ITEMS.register("worm", Worm::new);
public static final DeferredItem<ItemPlayerProbe> PLAYER_PROBE = ITEMS.register("player_probe", ItemPlayerProbe::new);
public static final DeferredItem<ItemFilter> FILTER = ITEMS.register("filter", ItemFilter::new);
public static final DeferredItem<ItemWaterBowl> WATER_BOWL = ITEMS.register("water_bowl", ItemWaterBowl::new);
public static final DeferredItem<ItemGeneric> CRATE_KEEPER = ITEMS.register("crate_keeper", () -> new ItemGeneric(defaultProps().stacksTo(1)));
public static final DeferredItem<ItemLens> LENS_OF_COLOR = ITEMS.register("lens_of_color", () -> new ItemLens(ActuallyAdditionsAPI.lensColor));
public static final DeferredItem<ItemLens> LENS_OF_DETONATION = ITEMS.register("lens_of_detonation", () -> new ItemLens(ActuallyAdditionsAPI.lensDetonation));
public static final DeferredItem<ItemLens> LENS_OF_CERTAIN_DEATH = ITEMS.register("lens_of_certain_death", () -> new ItemLens(ActuallyAdditionsAPI.lensDeath));
public static final DeferredItem<ItemLens> LENS_OF_THE_KILLER = ITEMS.register("lens_of_the_killer", () -> new ItemLens(ActuallyAdditionsAPI.lensEvenMoarDeath));
public static final DeferredItem<ItemLens> LENS_OF_DISENCHANTING = ITEMS.register("lens_of_disenchanting", () -> new ItemLens(ActuallyAdditionsAPI.lensDisenchanting));
public static final DeferredItem<ItemLens> LENS_OF_THE_MINER = ITEMS.register("lens_of_the_miner", () -> new ItemLens(ActuallyAdditionsAPI.lensMining));
public static final DeferredItem<ItemLaserWrench> LASER_WRENCH = ITEMS.register("laser_wrench", ItemLaserWrench::new);
// public static final DeferredItem<Item> itemChestToCrateUpgrade = ITEMS.register("", new ItemChestToCrateUpgrade("chest_to_crate_upgrade", TileEntityChest.class, InitBlocks.blockGiantChest.getDefaultState()));
// public static final DeferredItem<Item> itemSmallToMediumCrateUpgrade = ITEMS.register("", new ItemChestToCrateUpgrade("small_to_medium_crate_upgrade", TileEntityGiantChest.class, InitBlocks.blockGiantChestMedium.getDefaultState()));
// public static final DeferredItem<Item> itemMediumToLargeCrateUpgrade = ITEMS.register("", new ItemChestToCrateUpgrade("medium_to_large_crate_upgrade", TileEntityGiantChestMedium.class, InitBlocks.blockGiantChestLarge.getDefaultState()));
public static final DeferredItem<Item> ITEM_BOOKLET = ITEMS.register("booklet", ItemBooklet::new);
public static final DeferredItem<Item> RING_OF_GROWTH = ITEMS.register("ring_of_growth", ItemGrowthRing::new);
public static final DeferredItem<Item> RING_OF_MAGNETIZING = ITEMS.register("ring_of_magnetizing", ItemMagnetRing::new);
public static final DeferredItem<Item> TELEPORT_STAFF = ITEMS.register("teleport_staff", ItemTeleportStaff::new);
public static final DeferredItem<Item> WINGS_OF_THE_BATS = ITEMS.register("wings_of_the_bats", ItemWingsOfTheBats::new);
public static final DeferredItem<ItemBooklet> ITEM_BOOKLET = ITEMS.register("booklet", ItemBooklet::new);
public static final DeferredItem<ItemGrowthRing> RING_OF_GROWTH = ITEMS.register("ring_of_growth", ItemGrowthRing::new);
public static final DeferredItem<ItemMagnetRing> RING_OF_MAGNETIZING = ITEMS.register("ring_of_magnetizing", ItemMagnetRing::new);
public static final DeferredItem<ItemTeleportStaff> TELEPORT_STAFF = ITEMS.register("teleport_staff", ItemTeleportStaff::new);
public static final DeferredItem<ItemWingsOfTheBats> WINGS_OF_THE_BATS = ITEMS.register("wings_of_the_bats", ItemWingsOfTheBats::new);
public static final DeferredItem<Item> DRILL_MAIN = ITEMS.register("drill_light_blue", DrillItem::new);
public static final DeferredItem<Item> DRILL_BLACK = ITEMS.register("drill_black", DrillItem::new);
public static final DeferredItem<Item> DRILL_BLUE = ITEMS.register("drill_blue", DrillItem::new);
public static final DeferredItem<Item> DRILL_BROWN = ITEMS.register("drill_brown", DrillItem::new);
public static final DeferredItem<Item> DRILL_CYAN = ITEMS.register("drill_cyan", DrillItem::new);
public static final DeferredItem<Item> DRILL_GRAY = ITEMS.register("drill_gray", DrillItem::new);
public static final DeferredItem<Item> DRILL_GREEN = ITEMS.register("drill_green", DrillItem::new);
public static final DeferredItem<Item> DRILL_LIGHT_GRAY = ITEMS.register("drill_light_gray", DrillItem::new);
public static final DeferredItem<Item> DRILL_LIME = ITEMS.register("drill_lime", DrillItem::new);
public static final DeferredItem<Item> DRILL_MAGENTA = ITEMS.register("drill_magenta", DrillItem::new);
public static final DeferredItem<Item> DRILL_ORANGE = ITEMS.register("drill_orange", DrillItem::new);
public static final DeferredItem<Item> DRILL_PINK = ITEMS.register("drill_pink", DrillItem::new);
public static final DeferredItem<Item> DRILL_PURPLE = ITEMS.register("drill_purple", DrillItem::new);
public static final DeferredItem<Item> DRILL_RED = ITEMS.register("drill_red", DrillItem::new);
public static final DeferredItem<Item> DRILL_WHITE = ITEMS.register("drill_white", DrillItem::new);
public static final DeferredItem<Item> DRILL_YELLOW = ITEMS.register("drill_yellow", DrillItem::new);
public static final DeferredItem<DrillItem> DRILL_MAIN = ITEMS.register("drill_light_blue", DrillItem::new);
public static final DeferredItem<DrillItem> DRILL_BLACK = ITEMS.register("drill_black", DrillItem::new);
public static final DeferredItem<DrillItem> DRILL_BLUE = ITEMS.register("drill_blue", DrillItem::new);
public static final DeferredItem<DrillItem> DRILL_BROWN = ITEMS.register("drill_brown", DrillItem::new);
public static final DeferredItem<DrillItem> DRILL_CYAN = ITEMS.register("drill_cyan", DrillItem::new);
public static final DeferredItem<DrillItem> DRILL_GRAY = ITEMS.register("drill_gray", DrillItem::new);
public static final DeferredItem<DrillItem> DRILL_GREEN = ITEMS.register("drill_green", DrillItem::new);
public static final DeferredItem<DrillItem> DRILL_LIGHT_GRAY = ITEMS.register("drill_light_gray", DrillItem::new);
public static final DeferredItem<DrillItem> DRILL_LIME = ITEMS.register("drill_lime", DrillItem::new);
public static final DeferredItem<DrillItem> DRILL_MAGENTA = ITEMS.register("drill_magenta", DrillItem::new);
public static final DeferredItem<DrillItem> DRILL_ORANGE = ITEMS.register("drill_orange", DrillItem::new);
public static final DeferredItem<DrillItem> DRILL_PINK = ITEMS.register("drill_pink", DrillItem::new);
public static final DeferredItem<DrillItem> DRILL_PURPLE = ITEMS.register("drill_purple", DrillItem::new);
public static final DeferredItem<DrillItem> DRILL_RED = ITEMS.register("drill_red", DrillItem::new);
public static final DeferredItem<DrillItem> DRILL_WHITE = ITEMS.register("drill_white", DrillItem::new);
public static final DeferredItem<DrillItem> DRILL_YELLOW = ITEMS.register("drill_yellow", DrillItem::new);
public static final DeferredItem<Item> SINGLE_BATTERY = ITEMS.register("single_battery", () -> new ItemBattery(200000, 1000));
public static final DeferredItem<Item> DOUBLE_BATTERY = ITEMS.register("double_battery", () -> new ItemBattery(350000, 5000));
public static final DeferredItem<Item> TRIPLE_BATTERY = ITEMS.register("triple_battery", () -> new ItemBattery(600000, 10000));
public static final DeferredItem<Item> QUADRUPLE_BATTERY = ITEMS.register("quadruple_battery", () -> new ItemBattery(1000000, 30000));
public static final DeferredItem<Item> QUINTUPLE_BATTERY = ITEMS.register("quintuple_battery", () -> new ItemBattery(2000000, 100000));
public static final DeferredItem<Item> DRILL_UPGRADE_SPEED = ITEMS.register("drill_upgrade_speed", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SPEED));
public static final DeferredItem<Item> DRILL_UPGRADE_SPEED_II = ITEMS.register("drill_upgrade_speed_ii", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SPEED_II));
public static final DeferredItem<Item> DRILL_UPGRADE_SPEED_III = ITEMS.register("drill_upgrade_speed_iii", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SPEED_III));
public static final DeferredItem<Item> DRILL_UPGRADE_SILK_TOUCH = ITEMS.register("drill_upgrade_silk_touch", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SILK_TOUCH));
public static final DeferredItem<Item> DRILL_UPGRADE_FORTUNE = ITEMS.register("drill_upgrade_fortune", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.FORTUNE));
public static final DeferredItem<Item> DRILL_UPGRADE_FORTUNE_II = ITEMS.register("drill_upgrade_fortune_ii", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.FORTUNE_II));
public static final DeferredItem<Item> DRILL_UPGRADE_THREE_BY_THREE = ITEMS.register("drill_upgrade_three_by_three", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.THREE_BY_THREE));
public static final DeferredItem<Item> DRILL_UPGRADE_FIVE_BY_FIVE = ITEMS.register("drill_upgrade_five_by_five", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE));
public static final DeferredItem<Item> DRILL_UPGRADE_BLOCK_PLACING = ITEMS.register("drill_upgrade_block_placing", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.PLACER));
public static final DeferredItem<Item> PHANTOM_CONNECTOR = ITEMS.register("phantom_connector", ItemPhantomConnector::new);
public static final DeferredItem<ItemBattery> SINGLE_BATTERY = ITEMS.register("single_battery", () -> new ItemBattery(200000, 1000));
public static final DeferredItem<ItemBattery> DOUBLE_BATTERY = ITEMS.register("double_battery", () -> new ItemBattery(350000, 5000));
public static final DeferredItem<ItemBattery> TRIPLE_BATTERY = ITEMS.register("triple_battery", () -> new ItemBattery(600000, 10000));
public static final DeferredItem<ItemBattery> QUADRUPLE_BATTERY = ITEMS.register("quadruple_battery", () -> new ItemBattery(1000000, 30000));
public static final DeferredItem<ItemBattery> QUINTUPLE_BATTERY = ITEMS.register("quintuple_battery", () -> new ItemBattery(2000000, 100000));
public static final DeferredItem<ItemDrillUpgrade> DRILL_UPGRADE_SPEED = ITEMS.register("drill_upgrade_speed", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SPEED));
public static final DeferredItem<ItemDrillUpgrade> DRILL_UPGRADE_SPEED_II = ITEMS.register("drill_upgrade_speed_ii", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SPEED_II));
public static final DeferredItem<ItemDrillUpgrade> DRILL_UPGRADE_SPEED_III = ITEMS.register("drill_upgrade_speed_iii", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SPEED_III));
public static final DeferredItem<ItemDrillUpgrade> DRILL_UPGRADE_SILK_TOUCH = ITEMS.register("drill_upgrade_silk_touch", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SILK_TOUCH));
public static final DeferredItem<ItemDrillUpgrade> DRILL_UPGRADE_FORTUNE = ITEMS.register("drill_upgrade_fortune", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.FORTUNE));
public static final DeferredItem<ItemDrillUpgrade> DRILL_UPGRADE_FORTUNE_II = ITEMS.register("drill_upgrade_fortune_ii", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.FORTUNE_II));
public static final DeferredItem<ItemDrillUpgrade> DRILL_UPGRADE_THREE_BY_THREE = ITEMS.register("drill_upgrade_three_by_three", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.THREE_BY_THREE));
public static final DeferredItem<ItemDrillUpgrade> DRILL_UPGRADE_FIVE_BY_FIVE = ITEMS.register("drill_upgrade_five_by_five", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE));
public static final DeferredItem<ItemDrillUpgrade> DRILL_UPGRADE_BLOCK_PLACING = ITEMS.register("drill_upgrade_block_placing", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.PLACER));
public static final DeferredItem<ItemPhantomConnector> PHANTOM_CONNECTOR = ITEMS.register("phantom_connector", ItemPhantomConnector::new);
//public static final DeferredItem<Item> FOOD = ITEMS.register("food", () -> new ItemBase()); //just... food? //TODO
public static final DeferredItem<Item> CRAFTER_ON_A_STICK = ITEMS.register("crafter_on_a_stick", ItemCrafterOnAStick::new);
public static final DeferredItem<ItemCrafterOnAStick> CRAFTER_ON_A_STICK = ITEMS.register("crafter_on_a_stick", ItemCrafterOnAStick::new);
//public static final DeferredItem<Item> DUST = ITEMS.register("dust", ItemDust::new); //TODO flatten
public static final DeferredItem<Item> SOLIDIFIED_EXPERIENCE = ITEMS.register("solidified_experience", ItemSolidifiedExperience::new);
public static final DeferredItem<Item> LEAF_BLOWER = ITEMS.register("leaf_blower", () -> new ItemLeafBlower(false));
public static final DeferredItem<Item> ADVANCED_LEAF_BLOWER = ITEMS.register("advanced_leaf_blower", () -> new ItemLeafBlower(true));
public static final DeferredItem<ItemSolidifiedExperience> SOLIDIFIED_EXPERIENCE = ITEMS.register("solidified_experience", ItemSolidifiedExperience::new);
public static final DeferredItem<ItemLeafBlower> LEAF_BLOWER = ITEMS.register("leaf_blower", () -> new ItemLeafBlower(false));
public static final DeferredItem<ItemLeafBlower> ADVANCED_LEAF_BLOWER = ITEMS.register("advanced_leaf_blower", () -> new ItemLeafBlower(true));
public static final DeferredItem<Item> COFFEE_BEANS = ITEMS.register("coffee_beans", () -> new AABlockItem.AASeedItem(ActuallyBlocks.COFFEE.get(), ActuallyItems.defaultProps()));
public static final DeferredItem<AABlockItem.AASeedItem> COFFEE_BEANS = ITEMS.register("coffee_beans", () -> new AABlockItem.AASeedItem(ActuallyBlocks.COFFEE.get(), ActuallyItems.defaultProps()));
public static final DeferredItem<Item> RICE_SEEDS = ITEMS.register("rice_seeds", () -> new AABlockItem.AASeedItem(ActuallyBlocks.RICE.get(), ActuallyItems.defaultProps())); //() -> new ItemSeed("seedRice", ActuallyBlocks.RICE.get(), FOOD.get(), TheFoods.RICE.ordinal()));
public static final DeferredItem<Item> CANOLA_SEEDS = ITEMS.register("canola_seeds", () -> new AABlockItem.AASeedItem(ActuallyBlocks.CANOLA.get(), ActuallyItems.defaultProps())); //() -> new ItemFoodSeed("seedCanola", ActuallyBlocks.CANOLA, itemMisc, 0, 1, 0.01F, 10).setPotionEffect(new PotionEffect(MobEffects.NAUSEA, 1000, 0), 0.2F));
public static final DeferredItem<Item> FLAX_SEEDS = ITEMS.register("flax_seeds", () -> new AABlockItem.AASeedItem(ActuallyBlocks.FLAX.get(), ActuallyItems.defaultProps())); //() -> new ItemSeed("seedFlax", ActuallyBlocks.FLAX, Items.STRING, 0));
public static final DeferredItem<AABlockItem.AASeedItem> RICE_SEEDS = ITEMS.register("rice_seeds", () -> new AABlockItem.AASeedItem(ActuallyBlocks.RICE.get(), ActuallyItems.defaultProps())); //() -> new ItemSeed("seedRice", ActuallyBlocks.RICE.get(), FOOD.get(), TheFoods.RICE.ordinal()));
public static final DeferredItem<AABlockItem.AASeedItem> CANOLA_SEEDS = ITEMS.register("canola_seeds", () -> new AABlockItem.AASeedItem(ActuallyBlocks.CANOLA.get(), ActuallyItems.defaultProps())); //() -> new ItemFoodSeed("seedCanola", ActuallyBlocks.CANOLA, itemMisc, 0, 1, 0.01F, 10).setPotionEffect(new PotionEffect(MobEffects.NAUSEA, 1000, 0), 0.2F));
public static final DeferredItem<AABlockItem.AASeedItem> FLAX_SEEDS = ITEMS.register("flax_seeds", () -> new AABlockItem.AASeedItem(ActuallyBlocks.FLAX.get(), ActuallyItems.defaultProps())); //() -> new ItemSeed("seedFlax", ActuallyBlocks.FLAX, Items.STRING, 0));
// TOOLS & ARMOR
public static final DeferredItem<Item> WOODEN_AIOT = ITEMS.register("wooden_aiot", () -> new AllInOneTool(Tiers.WOOD));
public static final DeferredItem<Item> STONE_AIOT = ITEMS.register("stone_aiot", () -> new AllInOneTool(Tiers.STONE));
public static final DeferredItem<Item> IRON_AIOT = ITEMS.register("iron_aiot", () -> new AllInOneTool(Tiers.IRON));
public static final DeferredItem<Item> GOLD_AIOT = ITEMS.register("gold_aiot", () -> new AllInOneTool(Tiers.GOLD));
public static final DeferredItem<Item> DIAMOND_AIOT = ITEMS.register("diamond_aiot", () -> new AllInOneTool(Tiers.DIAMOND));
public static final DeferredItem<Item> NETHERITE_AIOT = ITEMS.register("netherite_aiot", () -> new AllInOneTool(Tiers.NETHERITE));
public static final DeferredItem<AllInOneTool> WOODEN_AIOT = ITEMS.register("wooden_aiot", () -> new AllInOneTool(Tiers.WOOD));
public static final DeferredItem<AllInOneTool> STONE_AIOT = ITEMS.register("stone_aiot", () -> new AllInOneTool(Tiers.STONE));
public static final DeferredItem<AllInOneTool> IRON_AIOT = ITEMS.register("iron_aiot", () -> new AllInOneTool(Tiers.IRON));
public static final DeferredItem<AllInOneTool> GOLD_AIOT = ITEMS.register("gold_aiot", () -> new AllInOneTool(Tiers.GOLD));
public static final DeferredItem<AllInOneTool> DIAMOND_AIOT = ITEMS.register("diamond_aiot", () -> new AllInOneTool(Tiers.DIAMOND));
public static final DeferredItem<AllInOneTool> NETHERITE_AIOT = ITEMS.register("netherite_aiot", () -> new AllInOneTool(Tiers.NETHERITE));
public static final Set<Supplier<Item>> SIMPLE_ITEMS = ImmutableSet.of(
public static final Set<DeferredItem<? extends Item>> SIMPLE_ITEMS = ImmutableSet.of(
// Crystals
BLACK_QUARTZ, RESTONIA_CRYSTAL, PALIS_CRYSTAL, DIAMATINE_CRYSTAL,
VOID_CRYSTAL, EMERADIC_CRYSTAL, ENORI_CRYSTAL, EMPOWERED_RESTONIA_CRYSTAL,
@ -226,9 +227,9 @@ public final class ActuallyItems {
}
public static void registerCapabilities(RegisterCapabilitiesEvent event) {
for(DeferredHolder<Item, ? extends Item> holder : ITEMS.getEntries()) {
if(holder.get() instanceof ItemEnergy energyItem) {
//TODO: Register the CustomEnergyStorage capability to the ItemEnergy extending items
for (DeferredHolder<Item, ? extends Item> holder : ITEMS.getEntries()) {
if (holder.get() instanceof ItemEnergy energyItem) {
event.registerItem(Capabilities.EnergyStorage.ITEM, (stack, context) -> energyItem.getEnergyStorage(stack), holder.get());
}
}
}

View file

@ -10,6 +10,7 @@
package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.mod.attachments.ActuallyAttachments;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage;
import net.minecraft.network.chat.Component;
@ -139,6 +140,12 @@ public abstract class ItemEnergy extends ItemBase {
.orElse(0);
}
public IEnergyStorage getEnergyStorage(ItemStack stack) {
if (!stack.hasData(ActuallyAttachments.ENERGY_STORAGE))
stack.setData(ActuallyAttachments.ENERGY_STORAGE, new CustomEnergyStorage(this.maxPower, this.transfer, this.transfer));
return stack.getData(ActuallyAttachments.ENERGY_STORAGE);
}
// @Override TODO: Register Energy cap/attachment
// public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag nbt) {
// return new EnergyCapabilityProvider(stack, this);