Port to 1.18.2
This commit is contained in:
parent
fcb3924191
commit
9205549aff
14
build.gradle
14
build.gradle
|
@ -21,7 +21,7 @@ java {
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
|
|
||||||
mappings channel: 'official', version: '1.18.1'
|
mappings channel: 'official', version: '1.18.2'
|
||||||
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||||
|
|
||||||
runs {
|
runs {
|
||||||
|
@ -91,14 +91,14 @@ repositories {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
minecraft 'net.minecraftforge:forge:1.18.1-39.0.5'
|
minecraft 'net.minecraftforge:forge:1.18.2-40.0.19'
|
||||||
implementation fg.deobf (project.dependencies.create('com.hrznstudio:titanium:1.18-3.4.0-27'))
|
implementation fg.deobf (project.dependencies.create('com.hrznstudio:titanium:1.18-3.4.0-27'))
|
||||||
compileOnly fg.deobf("mezz.jei:jei-1.18.1:9.1.0.46:api")
|
compileOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.3.143:api")
|
||||||
runtimeOnly fg.deobf("mezz.jei:jei-1.18.1:9.1.0.46")
|
runtimeOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.3.143")
|
||||||
runtimeOnly fg.deobf("curse.maven:refined-storage-243076:3569563")
|
//runtimeOnly fg.deobf("curse.maven:refined-storage-243076:3569563")
|
||||||
implementation fg.deobf("curse.maven:the-one-probe-245211:3586969")
|
implementation fg.deobf("curse.maven:the-one-probe-245211:3586969")
|
||||||
runtimeOnly fg.deobf("curse.maven:create-328085:3600402")
|
//runtimeOnly fg.deobf("curse.maven:create-328085:3600402")
|
||||||
runtimeOnly fg.deobf("curse.maven:flywheel-486392:3600401")
|
//runtimeOnly fg.deobf("curse.maven:flywheel-486392:3600401")
|
||||||
annotationProcessor "org.spongepowered:mixin:0.8.5:processor"
|
annotationProcessor "org.spongepowered:mixin:0.8.5:processor"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package com.buuz135.functionalstorage;
|
package com.buuz135.functionalstorage;
|
||||||
|
|
||||||
import com.buuz135.functionalstorage.block.*;
|
import com.buuz135.functionalstorage.block.*;
|
||||||
|
import com.buuz135.functionalstorage.block.tile.CompactingDrawerTile;
|
||||||
|
import com.buuz135.functionalstorage.block.tile.DrawerControllerTile;
|
||||||
|
import com.buuz135.functionalstorage.block.tile.DrawerTile;
|
||||||
|
import com.buuz135.functionalstorage.block.tile.EnderDrawerTile;
|
||||||
import com.buuz135.functionalstorage.client.CompactingDrawerRenderer;
|
import com.buuz135.functionalstorage.client.CompactingDrawerRenderer;
|
||||||
import com.buuz135.functionalstorage.client.ControllerRenderer;
|
import com.buuz135.functionalstorage.client.ControllerRenderer;
|
||||||
import com.buuz135.functionalstorage.client.DrawerRenderer;
|
import com.buuz135.functionalstorage.client.DrawerRenderer;
|
||||||
|
@ -40,6 +44,7 @@ import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.client.event.ColorHandlerEvent;
|
import net.minecraftforge.client.event.ColorHandlerEvent;
|
||||||
|
@ -57,6 +62,7 @@ import net.minecraftforge.forge.event.lifecycle.GatherDataEvent;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import net.minecraftforge.registries.RegistryObject;
|
import net.minecraftforge.registries.RegistryObject;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@ -82,11 +88,11 @@ public class FunctionalStorage extends ModuleController {
|
||||||
|
|
||||||
public static List<IWoodType> WOOD_TYPES = new ArrayList<>();
|
public static List<IWoodType> WOOD_TYPES = new ArrayList<>();
|
||||||
|
|
||||||
public static HashMap<DrawerType, List<RegistryObject<Block>>> DRAWER_TYPES = new HashMap<>();
|
public static HashMap<DrawerType, List<Pair<RegistryObject<Block>, RegistryObject<BlockEntityType<?>>>>> DRAWER_TYPES = new HashMap<>();
|
||||||
public static RegistryObject<Block> COMPACTING_DRAWER;
|
public static Pair<RegistryObject<Block>, RegistryObject<BlockEntityType<?>>> COMPACTING_DRAWER;
|
||||||
public static RegistryObject<Block> DRAWER_CONTROLLER;
|
public static Pair<RegistryObject<Block>, RegistryObject<BlockEntityType<?>>> DRAWER_CONTROLLER;
|
||||||
public static RegistryObject<Block> ARMORY_CABINET;
|
public static Pair<RegistryObject<Block>, RegistryObject<BlockEntityType<?>>> ARMORY_CABINET;
|
||||||
public static RegistryObject<Block> ENDER_DRAWER;
|
public static Pair<RegistryObject<Block>, RegistryObject<BlockEntityType<?>>> ENDER_DRAWER;
|
||||||
|
|
||||||
public static RegistryObject<Item> LINKING_TOOL;
|
public static RegistryObject<Item> LINKING_TOOL;
|
||||||
public static HashMap<StorageUpgradeItem.StorageTier, RegistryObject<Item>> STORAGE_UPGRADES = new HashMap<>();
|
public static HashMap<StorageUpgradeItem.StorageTier, RegistryObject<Item>> STORAGE_UPGRADES = new HashMap<>();
|
||||||
|
@ -134,23 +140,23 @@ public class FunctionalStorage extends ModuleController {
|
||||||
for (DrawerType value : DrawerType.values()) {
|
for (DrawerType value : DrawerType.values()) {
|
||||||
for (IWoodType woodType : WOOD_TYPES) {
|
for (IWoodType woodType : WOOD_TYPES) {
|
||||||
String name = woodType.getName() + "_" + value.getSlots();
|
String name = woodType.getName() + "_" + value.getSlots();
|
||||||
DRAWER_TYPES.computeIfAbsent(value, drawerType -> new ArrayList<>()).add(getRegistries().register(Block.class, name, () -> new DrawerBlock(woodType, value)));
|
DRAWER_TYPES.computeIfAbsent(value, drawerType -> new ArrayList<>()).add(getRegistries().registerBlockWithTile(name, () -> new DrawerBlock(woodType, value)));
|
||||||
}
|
}
|
||||||
DRAWER_TYPES.get(value).forEach(blockRegistryObject -> TAB.addIconStacks(() -> new ItemStack(blockRegistryObject.get())));
|
DRAWER_TYPES.get(value).forEach(blockRegistryObject -> TAB.addIconStacks(() -> new ItemStack(blockRegistryObject.getLeft().get())));
|
||||||
}
|
}
|
||||||
COMPACTING_DRAWER = getRegistries().register(Block.class, "compacting_drawer", () -> new CompactingDrawerBlock("compacting_drawer"));
|
COMPACTING_DRAWER = getRegistries().registerBlockWithTile("compacting_drawer", () -> new CompactingDrawerBlock("compacting_drawer"));
|
||||||
DRAWER_CONTROLLER = getRegistries().register(Block.class, "storage_controller", DrawerControllerBlock::new);
|
DRAWER_CONTROLLER = getRegistries().registerBlockWithTile("storage_controller", DrawerControllerBlock::new);
|
||||||
LINKING_TOOL = getRegistries().register(Item.class, "linking_tool", LinkingToolItem::new);
|
LINKING_TOOL = getRegistries().registerGeneric(Item.class, "linking_tool", LinkingToolItem::new);
|
||||||
for (StorageUpgradeItem.StorageTier value : StorageUpgradeItem.StorageTier.values()) {
|
for (StorageUpgradeItem.StorageTier value : StorageUpgradeItem.StorageTier.values()) {
|
||||||
STORAGE_UPGRADES.put(value, getRegistries().register(Item.class, value.name().toLowerCase(Locale.ROOT) + (value == StorageUpgradeItem.StorageTier.IRON ? "_downgrade" : "_upgrade"), () -> new StorageUpgradeItem(value)));
|
STORAGE_UPGRADES.put(value, getRegistries().registerGeneric(Item.class, value.name().toLowerCase(Locale.ROOT) + (value == StorageUpgradeItem.StorageTier.IRON ? "_downgrade" : "_upgrade"), () -> new StorageUpgradeItem(value)));
|
||||||
}
|
}
|
||||||
COLLECTOR_UPGRADE = getRegistries().register(Item.class, "collector_upgrade", () -> new UpgradeItem(new Item.Properties(), UpgradeItem.Type.UTILITY));
|
COLLECTOR_UPGRADE = getRegistries().registerGeneric(Item.class, "collector_upgrade", () -> new UpgradeItem(new Item.Properties(), UpgradeItem.Type.UTILITY));
|
||||||
PULLING_UPGRADE = getRegistries().register(Item.class, "puller_upgrade", () -> new UpgradeItem(new Item.Properties(), UpgradeItem.Type.UTILITY));
|
PULLING_UPGRADE = getRegistries().registerGeneric(Item.class, "puller_upgrade", () -> new UpgradeItem(new Item.Properties(), UpgradeItem.Type.UTILITY));
|
||||||
PUSHING_UPGRADE = getRegistries().register(Item.class, "pusher_upgrade", () -> new UpgradeItem(new Item.Properties(), UpgradeItem.Type.UTILITY));
|
PUSHING_UPGRADE = getRegistries().registerGeneric(Item.class, "pusher_upgrade", () -> new UpgradeItem(new Item.Properties(), UpgradeItem.Type.UTILITY));
|
||||||
VOID_UPGRADE = getRegistries().register(Item.class, "void_upgrade", () -> new UpgradeItem(new Item.Properties(), UpgradeItem.Type.UTILITY));
|
VOID_UPGRADE = getRegistries().registerGeneric(Item.class, "void_upgrade", () -> new UpgradeItem(new Item.Properties(), UpgradeItem.Type.UTILITY));
|
||||||
ARMORY_CABINET = getRegistries().register(Block.class, "armory_cabinet", ArmoryCabinetBlock::new);
|
ARMORY_CABINET = getRegistries().registerBlockWithTile("armory_cabinet", ArmoryCabinetBlock::new);
|
||||||
CONFIGURATION_TOOL = getRegistries().register(Item.class, "configuration_tool", ConfigurationToolItem::new);
|
CONFIGURATION_TOOL = getRegistries().registerGeneric(Item.class, "configuration_tool", ConfigurationToolItem::new);
|
||||||
ENDER_DRAWER = getRegistries().register(Block.class, "ender_drawer", EnderDrawerBlock::new);
|
ENDER_DRAWER = getRegistries().registerBlockWithTile("ender_drawer", EnderDrawerBlock::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DrawerType {
|
public enum DrawerType {
|
||||||
|
@ -186,12 +192,12 @@ public class FunctionalStorage extends ModuleController {
|
||||||
EventManager.mod(EntityRenderersEvent.RegisterRenderers.class).process(registerRenderers -> {
|
EventManager.mod(EntityRenderersEvent.RegisterRenderers.class).process(registerRenderers -> {
|
||||||
for (DrawerType value : DrawerType.values()) {
|
for (DrawerType value : DrawerType.values()) {
|
||||||
DRAWER_TYPES.get(value).forEach(blockRegistryObject -> {
|
DRAWER_TYPES.get(value).forEach(blockRegistryObject -> {
|
||||||
registerRenderers.registerBlockEntityRenderer(((BasicTileBlock) blockRegistryObject.get()).getTileEntityType(), p_173571_ -> new DrawerRenderer());
|
registerRenderers.registerBlockEntityRenderer((BlockEntityType<? extends DrawerTile>) blockRegistryObject.getRight().get(), p_173571_ -> new DrawerRenderer());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
registerRenderers.registerBlockEntityRenderer(((BasicTileBlock) COMPACTING_DRAWER.get()).getTileEntityType(), p_173571_ -> new CompactingDrawerRenderer());
|
registerRenderers.registerBlockEntityRenderer((BlockEntityType<? extends CompactingDrawerTile>) COMPACTING_DRAWER.getRight().get(), p_173571_ -> new CompactingDrawerRenderer());
|
||||||
registerRenderers.registerBlockEntityRenderer(((BasicTileBlock) DRAWER_CONTROLLER.get()).getTileEntityType(), p -> new ControllerRenderer());
|
registerRenderers.registerBlockEntityRenderer((BlockEntityType<? extends DrawerControllerTile>) DRAWER_CONTROLLER.getRight().get(), p -> new ControllerRenderer());
|
||||||
registerRenderers.registerBlockEntityRenderer(((BasicTileBlock) ENDER_DRAWER.get()).getTileEntityType(), p_173571_ -> new EnderDrawerRenderer());
|
registerRenderers.registerBlockEntityRenderer((BlockEntityType<? extends EnderDrawerTile>) ENDER_DRAWER.getRight().get(), p_173571_ -> new EnderDrawerRenderer());
|
||||||
}).subscribe();
|
}).subscribe();
|
||||||
EventManager.mod(ColorHandlerEvent.Item.class).process(item -> {
|
EventManager.mod(ColorHandlerEvent.Item.class).process(item -> {
|
||||||
item.getItemColors().register((stack, tint) -> {
|
item.getItemColors().register((stack, tint) -> {
|
||||||
|
@ -222,15 +228,15 @@ public class FunctionalStorage extends ModuleController {
|
||||||
}).subscribe();
|
}).subscribe();
|
||||||
EventManager.mod(FMLClientSetupEvent.class).process(event -> {
|
EventManager.mod(FMLClientSetupEvent.class).process(event -> {
|
||||||
for (DrawerType value : DrawerType.values()) {
|
for (DrawerType value : DrawerType.values()) {
|
||||||
for (RegistryObject<Block> blockRegistryObject : DRAWER_TYPES.get(value)) {
|
for (RegistryObject<Block> blockRegistryObject : DRAWER_TYPES.get(value).stream().map(Pair::getLeft).collect(Collectors.toList())) {
|
||||||
ItemBlockRenderTypes.setRenderLayer(blockRegistryObject.get(), RenderType.cutout());
|
ItemBlockRenderTypes.setRenderLayer(blockRegistryObject.get(), RenderType.cutout());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ItemBlockRenderTypes.setRenderLayer(COMPACTING_DRAWER.get(), RenderType.cutout());
|
ItemBlockRenderTypes.setRenderLayer(COMPACTING_DRAWER.getLeft().get(), RenderType.cutout());
|
||||||
ItemBlockRenderTypes.setRenderLayer(ENDER_DRAWER.get(), RenderType.cutout());
|
ItemBlockRenderTypes.setRenderLayer(ENDER_DRAWER.getLeft().get(), RenderType.cutout());
|
||||||
}).subscribe();
|
}).subscribe();
|
||||||
EventManager.forge(RenderTooltipEvent.Pre.class).process(itemTooltipEvent -> {
|
EventManager.forge(RenderTooltipEvent.Pre.class).process(itemTooltipEvent -> {
|
||||||
if (itemTooltipEvent.getItemStack().getItem().equals(FunctionalStorage.ENDER_DRAWER.get().asItem()) && itemTooltipEvent.getItemStack().hasTag()) {
|
if (itemTooltipEvent.getItemStack().getItem().equals(FunctionalStorage.ENDER_DRAWER.getLeft().get().asItem()) && itemTooltipEvent.getItemStack().hasTag()) {
|
||||||
TooltipUtil.renderItems(itemTooltipEvent.getPoseStack(), EnderDrawerBlock.getFrequencyDisplay(itemTooltipEvent.getItemStack().getTag().getCompound("BlockEntityTag").getString("frequency")), itemTooltipEvent.getX() + 14, itemTooltipEvent.getY() + 11);
|
TooltipUtil.renderItems(itemTooltipEvent.getPoseStack(), EnderDrawerBlock.getFrequencyDisplay(itemTooltipEvent.getItemStack().getTag().getCompound("BlockEntityTag").getString("frequency")), itemTooltipEvent.getX() + 14, itemTooltipEvent.getY() + 11);
|
||||||
}
|
}
|
||||||
if (itemTooltipEvent.getItemStack().is(FunctionalStorage.LINKING_TOOL.get()) && itemTooltipEvent.getItemStack().getOrCreateTag().contains(LinkingToolItem.NBT_ENDER)) {
|
if (itemTooltipEvent.getItemStack().is(FunctionalStorage.LINKING_TOOL.get()) && itemTooltipEvent.getItemStack().getOrCreateTag().contains(LinkingToolItem.NBT_ENDER)) {
|
||||||
|
@ -314,14 +320,14 @@ public class FunctionalStorage extends ModuleController {
|
||||||
UpgradeRecipeBuilder.smithing(Ingredient.of(STORAGE_UPGRADES.get(StorageUpgradeItem.StorageTier.DIAMOND).get()), Ingredient.of(Items.NETHERITE_INGOT), STORAGE_UPGRADES.get(StorageUpgradeItem.StorageTier.NETHERITE).get())
|
UpgradeRecipeBuilder.smithing(Ingredient.of(STORAGE_UPGRADES.get(StorageUpgradeItem.StorageTier.DIAMOND).get()), Ingredient.of(Items.NETHERITE_INGOT), STORAGE_UPGRADES.get(StorageUpgradeItem.StorageTier.NETHERITE).get())
|
||||||
.unlocks("has_netherite_ingot", has(Items.NETHERITE_INGOT))
|
.unlocks("has_netherite_ingot", has(Items.NETHERITE_INGOT))
|
||||||
.save(consumer, STORAGE_UPGRADES.get(StorageUpgradeItem.StorageTier.NETHERITE).get().getRegistryName());
|
.save(consumer, STORAGE_UPGRADES.get(StorageUpgradeItem.StorageTier.NETHERITE).get().getRegistryName());
|
||||||
TitaniumShapedRecipeBuilder.shapedRecipe(DRAWER_CONTROLLER.get())
|
TitaniumShapedRecipeBuilder.shapedRecipe(DRAWER_CONTROLLER.getLeft().get())
|
||||||
.pattern("IBI").pattern("CDC").pattern("IBI")
|
.pattern("IBI").pattern("CDC").pattern("IBI")
|
||||||
.define('I', Tags.Items.STONE)
|
.define('I', Tags.Items.STONE)
|
||||||
.define('B', Tags.Items.STORAGE_BLOCKS_QUARTZ)
|
.define('B', Tags.Items.STORAGE_BLOCKS_QUARTZ)
|
||||||
.define('C', StorageTags.DRAWER)
|
.define('C', StorageTags.DRAWER)
|
||||||
.define('D', Items.COMPARATOR)
|
.define('D', Items.COMPARATOR)
|
||||||
.save(consumer);
|
.save(consumer);
|
||||||
TitaniumShapedRecipeBuilder.shapedRecipe(ARMORY_CABINET.get())
|
TitaniumShapedRecipeBuilder.shapedRecipe(ARMORY_CABINET.getLeft().get())
|
||||||
.pattern("ICI").pattern("CDC").pattern("IBI")
|
.pattern("ICI").pattern("CDC").pattern("IBI")
|
||||||
.define('I', Tags.Items.STONE)
|
.define('I', Tags.Items.STONE)
|
||||||
.define('B', Tags.Items.INGOTS_NETHERITE)
|
.define('B', Tags.Items.INGOTS_NETHERITE)
|
||||||
|
@ -349,7 +355,7 @@ public class FunctionalStorage extends ModuleController {
|
||||||
.define('R', Tags.Items.DUSTS_REDSTONE)
|
.define('R', Tags.Items.DUSTS_REDSTONE)
|
||||||
.define('D', StorageTags.DRAWER)
|
.define('D', StorageTags.DRAWER)
|
||||||
.save(consumer);
|
.save(consumer);
|
||||||
TitaniumShapedRecipeBuilder.shapedRecipe(ENDER_DRAWER.get())
|
TitaniumShapedRecipeBuilder.shapedRecipe(ENDER_DRAWER.getLeft().get())
|
||||||
.pattern("PPP").pattern("LCL").pattern("PPP")
|
.pattern("PPP").pattern("LCL").pattern("PPP")
|
||||||
.define('P', ItemTags.PLANKS)
|
.define('P', ItemTags.PLANKS)
|
||||||
.define('C', Tags.Items.CHESTS_ENDER)
|
.define('C', Tags.Items.CHESTS_ENDER)
|
||||||
|
@ -380,14 +386,14 @@ public class FunctionalStorage extends ModuleController {
|
||||||
@Override
|
@Override
|
||||||
protected void registerModels() {
|
protected void registerModels() {
|
||||||
for (DrawerType value : DrawerType.values()) {
|
for (DrawerType value : DrawerType.values()) {
|
||||||
for (RegistryObject<Block> blockRegistryObject : DRAWER_TYPES.get(value)) {
|
for (RegistryObject<Block> blockRegistryObject : DRAWER_TYPES.get(value).stream().map(Pair::getLeft).collect(Collectors.toList())) {
|
||||||
withExistingParent(blockRegistryObject.get().getRegistryName().getPath() + "_locked", modLoc(blockRegistryObject.get().getRegistryName().getPath()))
|
withExistingParent(blockRegistryObject.get().getRegistryName().getPath() + "_locked", modLoc(blockRegistryObject.get().getRegistryName().getPath()))
|
||||||
.texture("lock_icon", modLoc("blocks/lock"));
|
.texture("lock_icon", modLoc("blocks/lock"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
withExistingParent(COMPACTING_DRAWER.get().getRegistryName().getPath() + "_locked", modLoc(COMPACTING_DRAWER.get().getRegistryName().getPath()))
|
withExistingParent(COMPACTING_DRAWER.getLeft().get().getRegistryName().getPath() + "_locked", modLoc(COMPACTING_DRAWER.getLeft().get().getRegistryName().getPath()))
|
||||||
.texture("lock_icon", modLoc("blocks/lock"));
|
.texture("lock_icon", modLoc("blocks/lock"));
|
||||||
withExistingParent(ENDER_DRAWER.get().getRegistryName().getPath() + "_locked", modLoc(ENDER_DRAWER.get().getRegistryName().getPath()))
|
withExistingParent(ENDER_DRAWER.getLeft().get().getRegistryName().getPath() + "_locked", modLoc(ENDER_DRAWER.getLeft().get().getRegistryName().getPath()))
|
||||||
.texture("lock_icon", modLoc("blocks/lock"));
|
.texture("lock_icon", modLoc("blocks/lock"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class ArmoryCabinetBlock extends RotatableBlock<ArmoryCabinetTile> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockEntityType.BlockEntitySupplier<?> getTileEntityFactory() {
|
public BlockEntityType.BlockEntitySupplier<?> getTileEntityFactory() {
|
||||||
return (p_155268_, p_155269_) -> new ArmoryCabinetTile(this, p_155268_, p_155269_);
|
return (p_155268_, p_155269_) -> new ArmoryCabinetTile(this, FunctionalStorage.ARMORY_CABINET.getRight().get(), p_155268_, p_155269_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|
|
@ -76,11 +76,6 @@ public class CompactingDrawerBlock extends RotatableBlock<CompactingDrawerTile>
|
||||||
registerDefaultState(defaultBlockState().setValue(RotatableBlock.FACING_HORIZONTAL, Direction.NORTH).setValue(DrawerBlock.LOCKED, false));
|
registerDefaultState(defaultBlockState().setValue(RotatableBlock.FACING_HORIZONTAL, Direction.NORTH).setValue(DrawerBlock.LOCKED, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addAlternatives(DeferredRegistryHelper registry) {
|
|
||||||
super.addAlternatives(registry);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public RotationType getRotationType() {
|
public RotationType getRotationType() {
|
||||||
|
@ -89,7 +84,7 @@ public class CompactingDrawerBlock extends RotatableBlock<CompactingDrawerTile>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockEntityType.BlockEntitySupplier<CompactingDrawerTile> getTileEntityFactory() {
|
public BlockEntityType.BlockEntitySupplier<CompactingDrawerTile> getTileEntityFactory() {
|
||||||
return (blockPos, state) -> new CompactingDrawerTile(this, blockPos, state);
|
return (blockPos, state) -> new CompactingDrawerTile(this, (BlockEntityType<CompactingDrawerTile>) FunctionalStorage.COMPACTING_DRAWER.getRight().get(), blockPos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -50,6 +50,7 @@ import net.minecraft.world.phys.shapes.Shapes;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import net.minecraftforge.common.Tags;
|
import net.minecraftforge.common.Tags;
|
||||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
@ -59,6 +60,7 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class DrawerBlock extends RotatableBlock<DrawerTile> {
|
public class DrawerBlock extends RotatableBlock<DrawerTile> {
|
||||||
|
|
||||||
|
@ -140,11 +142,6 @@ public class DrawerBlock extends RotatableBlock<DrawerTile> {
|
||||||
p_206840_1_.add(LOCKED);
|
p_206840_1_.add(LOCKED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addAlternatives(DeferredRegistryHelper registry) {
|
|
||||||
super.addAlternatives(registry);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public RotationType getRotationType() {
|
public RotationType getRotationType() {
|
||||||
|
@ -153,7 +150,7 @@ public class DrawerBlock extends RotatableBlock<DrawerTile> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockEntityType.BlockEntitySupplier<DrawerTile> getTileEntityFactory() {
|
public BlockEntityType.BlockEntitySupplier<DrawerTile> getTileEntityFactory() {
|
||||||
return (blockPos, state) -> new DrawerTile(this, blockPos, state, type);
|
return (blockPos, state) -> new DrawerTile(this, (BlockEntityType<DrawerTile>) FunctionalStorage.DRAWER_TYPES.get(type).stream().filter(registryObjectRegistryObjectPair -> registryObjectRegistryObjectPair.getLeft().get().equals(this)).map(Pair::getRight).findFirst().get().get(), blockPos, state, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class DrawerControllerBlock extends RotatableBlock<DrawerControllerTile>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockEntityType.BlockEntitySupplier<?> getTileEntityFactory() {
|
public BlockEntityType.BlockEntitySupplier<?> getTileEntityFactory() {
|
||||||
return (p_155268_, p_155269_) -> new DrawerControllerTile(this, p_155268_, p_155269_);
|
return (p_155268_, p_155269_) -> new DrawerControllerTile(this, (BlockEntityType<DrawerControllerTile>) FunctionalStorage.DRAWER_CONTROLLER.getRight().get(), p_155268_, p_155269_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|
|
@ -74,11 +74,6 @@ public class EnderDrawerBlock extends RotatableBlock<EnderDrawerTile> {
|
||||||
p_206840_1_.add(LOCKED);
|
p_206840_1_.add(LOCKED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addAlternatives(DeferredRegistryHelper registry) {
|
|
||||||
super.addAlternatives(registry);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public RotationType getRotationType() {
|
public RotationType getRotationType() {
|
||||||
|
@ -87,7 +82,7 @@ public class EnderDrawerBlock extends RotatableBlock<EnderDrawerTile> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockEntityType.BlockEntitySupplier<EnderDrawerTile> getTileEntityFactory() {
|
public BlockEntityType.BlockEntitySupplier<EnderDrawerTile> getTileEntityFactory() {
|
||||||
return (blockPos, state) -> new EnderDrawerTile(this, blockPos, state);
|
return (blockPos, state) -> new EnderDrawerTile(this, (BlockEntityType<EnderDrawerTile>) FunctionalStorage.ENDER_DRAWER.getRight().get(),blockPos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.Connection;
|
import net.minecraft.network.Connection;
|
||||||
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.common.util.LazyOptional;
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
|
@ -25,8 +26,8 @@ public class ArmoryCabinetTile extends ActiveTile<ArmoryCabinetTile> {
|
||||||
public ArmoryCabinetInventoryHandler handler;
|
public ArmoryCabinetInventoryHandler handler;
|
||||||
private final LazyOptional<IItemHandler> lazyStorage;
|
private final LazyOptional<IItemHandler> lazyStorage;
|
||||||
|
|
||||||
public ArmoryCabinetTile(BasicTileBlock<ArmoryCabinetTile> base, BlockPos pos, BlockState state) {
|
public ArmoryCabinetTile(BasicTileBlock<ArmoryCabinetTile> base, BlockEntityType<?> entityType, BlockPos pos, BlockState state) {
|
||||||
super(base, pos, state);
|
super(base, entityType, pos, state);
|
||||||
this.handler = new ArmoryCabinetInventoryHandler() {
|
this.handler = new ArmoryCabinetInventoryHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void onChange() {
|
public void onChange() {
|
||||||
|
|
|
@ -1,36 +1,27 @@
|
||||||
package com.buuz135.functionalstorage.block.tile;
|
package com.buuz135.functionalstorage.block.tile;
|
||||||
|
|
||||||
import com.buuz135.functionalstorage.FunctionalStorage;
|
import com.buuz135.functionalstorage.FunctionalStorage;
|
||||||
import com.buuz135.functionalstorage.inventory.BigInventoryHandler;
|
|
||||||
import com.buuz135.functionalstorage.inventory.CompactingInventoryHandler;
|
import com.buuz135.functionalstorage.inventory.CompactingInventoryHandler;
|
||||||
import com.buuz135.functionalstorage.util.CompactingUtil;
|
import com.buuz135.functionalstorage.util.CompactingUtil;
|
||||||
import com.hrznstudio.titanium.annotation.Save;
|
import com.hrznstudio.titanium.annotation.Save;
|
||||||
import com.hrznstudio.titanium.block.BasicTileBlock;
|
import com.hrznstudio.titanium.block.BasicTileBlock;
|
||||||
import com.hrznstudio.titanium.block.tile.ActiveTile;
|
|
||||||
import com.hrznstudio.titanium.util.RayTraceUtils;
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.util.datafix.fixes.ItemStackTheFlatteningFix;
|
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
|
||||||
import net.minecraft.world.phys.HitResult;
|
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.common.util.LazyOptional;
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
|
||||||
import net.minecraftforge.items.ItemStackHandler;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class CompactingDrawerTile extends ControllableDrawerTile<CompactingDrawerTile> {
|
public class CompactingDrawerTile extends ControllableDrawerTile<CompactingDrawerTile> {
|
||||||
|
|
||||||
|
@ -39,8 +30,8 @@ public class CompactingDrawerTile extends ControllableDrawerTile<CompactingDrawe
|
||||||
private final LazyOptional<IItemHandler> lazyStorage;
|
private final LazyOptional<IItemHandler> lazyStorage;
|
||||||
private boolean hasCheckedRecipes;
|
private boolean hasCheckedRecipes;
|
||||||
|
|
||||||
public CompactingDrawerTile(BasicTileBlock<CompactingDrawerTile> base, BlockPos pos, BlockState state) {
|
public CompactingDrawerTile(BasicTileBlock<CompactingDrawerTile> base, BlockEntityType<CompactingDrawerTile> blockEntityType, BlockPos pos, BlockState state) {
|
||||||
super(base, pos, state);
|
super(base, blockEntityType, pos, state);
|
||||||
this.handler = new CompactingInventoryHandler() {
|
this.handler = new CompactingInventoryHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void onChange() {
|
public void onChange() {
|
||||||
|
|
|
@ -25,6 +25,7 @@ import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
|
@ -54,8 +55,8 @@ public abstract class ControllableDrawerTile<T extends ControllableDrawerTile<T>
|
||||||
@Save
|
@Save
|
||||||
private DrawerOptions drawerOptions;
|
private DrawerOptions drawerOptions;
|
||||||
|
|
||||||
public ControllableDrawerTile(BasicTileBlock<T> base, BlockPos pos, BlockState state) {
|
public ControllableDrawerTile(BasicTileBlock<T> base, BlockEntityType<T> entityType, BlockPos pos, BlockState state) {
|
||||||
super(base, pos, state);
|
super(base, entityType, pos, state);
|
||||||
this.drawerOptions = new DrawerOptions();
|
this.drawerOptions = new DrawerOptions();
|
||||||
this.storageUpgrades = new InventoryComponent<ControllableDrawerTile<T>>("storage_upgrades", 10, 70, getStorageSlotAmount()) {
|
this.storageUpgrades = new InventoryComponent<ControllableDrawerTile<T>>("storage_upgrades", 10, 70, getStorageSlotAmount()) {
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
|
@ -41,8 +42,8 @@ public class DrawerControllerTile extends ControllableDrawerTile<DrawerControlle
|
||||||
public ControllerInventoryHandler handler;
|
public ControllerInventoryHandler handler;
|
||||||
private LazyOptional<IItemHandler> lazyStorage;
|
private LazyOptional<IItemHandler> lazyStorage;
|
||||||
|
|
||||||
public DrawerControllerTile(BasicTileBlock<DrawerControllerTile> base, BlockPos pos, BlockState state) {
|
public DrawerControllerTile(BasicTileBlock<DrawerControllerTile> base, BlockEntityType<DrawerControllerTile> blockEntityType, BlockPos pos, BlockState state) {
|
||||||
super(base, pos, state);
|
super(base, blockEntityType, pos, state);
|
||||||
this.connectedDrawers = new ConnectedDrawers(null);
|
this.connectedDrawers = new ConnectedDrawers(null);
|
||||||
this.handler = new ControllerInventoryHandler() {
|
this.handler = new ControllerInventoryHandler() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -147,7 +148,7 @@ public class DrawerControllerTile extends ControllableDrawerTile<DrawerControlle
|
||||||
|
|
||||||
public void addConnectedDrawers(LinkingToolItem.ActionMode action, BlockPos... positions) {
|
public void addConnectedDrawers(LinkingToolItem.ActionMode action, BlockPos... positions) {
|
||||||
for (BlockPos position : positions) {
|
for (BlockPos position : positions) {
|
||||||
if (level.getBlockState(position).is(FunctionalStorage.DRAWER_CONTROLLER.get())) continue;
|
if (level.getBlockState(position).is(FunctionalStorage.DRAWER_CONTROLLER.getLeft().get())) continue;
|
||||||
if (this.getBlockPos().closerThan(position, FunctionalStorageConfig.DRAWER_CONTROLLER_LINKING_RANGE)) {
|
if (this.getBlockPos().closerThan(position, FunctionalStorageConfig.DRAWER_CONTROLLER_LINKING_RANGE)) {
|
||||||
if (action == LinkingToolItem.ActionMode.ADD) {
|
if (action == LinkingToolItem.ActionMode.ADD) {
|
||||||
if (!connectedDrawers.getConnectedDrawers().contains(position.asLong()))
|
if (!connectedDrawers.getConnectedDrawers().contains(position.asLong()))
|
||||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.HitResult;
|
import net.minecraft.world.phys.HitResult;
|
||||||
|
@ -37,8 +38,8 @@ public class DrawerTile extends ControllableDrawerTile<DrawerTile> {
|
||||||
private final LazyOptional<IItemHandler> lazyStorage;
|
private final LazyOptional<IItemHandler> lazyStorage;
|
||||||
private FunctionalStorage.DrawerType type;
|
private FunctionalStorage.DrawerType type;
|
||||||
|
|
||||||
public DrawerTile(BasicTileBlock<DrawerTile> base, BlockPos pos, BlockState state, FunctionalStorage.DrawerType type) {
|
public DrawerTile(BasicTileBlock<DrawerTile> base, BlockEntityType<DrawerTile> blockEntityType, BlockPos pos, BlockState state, FunctionalStorage.DrawerType type) {
|
||||||
super(base, pos, state);
|
super(base, blockEntityType, pos, state);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.handler = new BigInventoryHandler(type) {
|
this.handler = new BigInventoryHandler(type) {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -18,6 +18,7 @@ import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.common.util.LazyOptional;
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
|
@ -36,8 +37,8 @@ public class EnderDrawerTile extends ControllableDrawerTile<EnderDrawerTile> {
|
||||||
private String frequency;
|
private String frequency;
|
||||||
private LazyOptional<IItemHandler> lazyStorage;
|
private LazyOptional<IItemHandler> lazyStorage;
|
||||||
|
|
||||||
public EnderDrawerTile(BasicTileBlock<EnderDrawerTile> base, BlockPos pos, BlockState state) {
|
public EnderDrawerTile(BasicTileBlock<EnderDrawerTile> base, BlockEntityType<EnderDrawerTile> blockEntityType, BlockPos pos, BlockState state) {
|
||||||
super(base, pos, state);
|
super(base, blockEntityType, pos, state);
|
||||||
this.frequency = UUID.randomUUID().toString();
|
this.frequency = UUID.randomUUID().toString();
|
||||||
this.lazyStorage = LazyOptional.empty();
|
this.lazyStorage = LazyOptional.empty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,11 @@ import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||||
import net.minecraftforge.registries.RegistryObject;
|
import net.minecraftforge.registries.RegistryObject;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class FunctionalStorageBlockTagsProvider extends BlockTagsProvider {
|
public class FunctionalStorageBlockTagsProvider extends BlockTagsProvider {
|
||||||
|
|
||||||
public FunctionalStorageBlockTagsProvider(DataGenerator p_126530_, String modId, @Nullable ExistingFileHelper existingFileHelper) {
|
public FunctionalStorageBlockTagsProvider(DataGenerator p_126530_, String modId, @Nullable ExistingFileHelper existingFileHelper) {
|
||||||
|
@ -23,10 +26,10 @@ public class FunctionalStorageBlockTagsProvider extends BlockTagsProvider {
|
||||||
protected void addTags() {
|
protected void addTags() {
|
||||||
TagAppender<Block> tTagAppender = this.tag(BlockTags.MINEABLE_WITH_AXE);
|
TagAppender<Block> tTagAppender = this.tag(BlockTags.MINEABLE_WITH_AXE);
|
||||||
for (FunctionalStorage.DrawerType drawerType : FunctionalStorage.DRAWER_TYPES.keySet()) {
|
for (FunctionalStorage.DrawerType drawerType : FunctionalStorage.DRAWER_TYPES.keySet()) {
|
||||||
for (RegistryObject<Block> blockRegistryObject : FunctionalStorage.DRAWER_TYPES.get(drawerType)) {
|
for (RegistryObject<Block> blockRegistryObject : FunctionalStorage.DRAWER_TYPES.get(drawerType).stream().map(Pair::getLeft).collect(Collectors.toList())) {
|
||||||
tTagAppender.add(blockRegistryObject.get());
|
tTagAppender.add(blockRegistryObject.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.tag(BlockTags.MINEABLE_WITH_PICKAXE).add(FunctionalStorage.COMPACTING_DRAWER.get()).add(FunctionalStorage.DRAWER_CONTROLLER.get()).add(FunctionalStorage.ARMORY_CABINET.get()).add(FunctionalStorage.ENDER_DRAWER.get());
|
this.tag(BlockTags.MINEABLE_WITH_PICKAXE).add(FunctionalStorage.COMPACTING_DRAWER.getLeft().get()).add(FunctionalStorage.DRAWER_CONTROLLER.getLeft().get()).add(FunctionalStorage.ARMORY_CABINET.getLeft().get()).add(FunctionalStorage.ENDER_DRAWER.getLeft().get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,11 @@ import net.minecraftforge.common.ForgeTier;
|
||||||
import net.minecraftforge.common.Tags;
|
import net.minecraftforge.common.Tags;
|
||||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||||
import net.minecraftforge.registries.RegistryObject;
|
import net.minecraftforge.registries.RegistryObject;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class FunctionalStorageItemTagsProvider extends ItemTagsProvider {
|
public class FunctionalStorageItemTagsProvider extends ItemTagsProvider {
|
||||||
|
|
||||||
|
@ -29,7 +31,7 @@ public class FunctionalStorageItemTagsProvider extends ItemTagsProvider {
|
||||||
protected void addTags() {
|
protected void addTags() {
|
||||||
TagsProvider.TagAppender<Item> tTagAppender = this.tag(StorageTags.DRAWER);
|
TagsProvider.TagAppender<Item> tTagAppender = this.tag(StorageTags.DRAWER);
|
||||||
for (FunctionalStorage.DrawerType drawerType : FunctionalStorage.DRAWER_TYPES.keySet()) {
|
for (FunctionalStorage.DrawerType drawerType : FunctionalStorage.DRAWER_TYPES.keySet()) {
|
||||||
for (RegistryObject<Block> blockRegistryObject : FunctionalStorage.DRAWER_TYPES.get(drawerType)) {
|
for (RegistryObject<Block> blockRegistryObject : FunctionalStorage.DRAWER_TYPES.get(drawerType).stream().map(Pair::getLeft).collect(Collectors.toList())) {
|
||||||
tTagAppender.add(blockRegistryObject.get().asItem());
|
tTagAppender.add(blockRegistryObject.get().asItem());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,9 @@ import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraftforge.common.data.LanguageProvider;
|
import net.minecraftforge.common.data.LanguageProvider;
|
||||||
import net.minecraftforge.registries.RegistryObject;
|
import net.minecraftforge.registries.RegistryObject;
|
||||||
import org.apache.commons.lang3.text.WordUtils;
|
import org.apache.commons.lang3.text.WordUtils;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class FunctionalStorageLangProvider extends LanguageProvider {
|
public class FunctionalStorageLangProvider extends LanguageProvider {
|
||||||
|
|
||||||
|
@ -19,13 +22,13 @@ public class FunctionalStorageLangProvider extends LanguageProvider {
|
||||||
protected void addTranslations() {
|
protected void addTranslations() {
|
||||||
this.add("itemGroup.functionalstorage", "Functional Storage");
|
this.add("itemGroup.functionalstorage", "Functional Storage");
|
||||||
for (FunctionalStorage.DrawerType drawerType : FunctionalStorage.DRAWER_TYPES.keySet()) {
|
for (FunctionalStorage.DrawerType drawerType : FunctionalStorage.DRAWER_TYPES.keySet()) {
|
||||||
for (RegistryObject<Block> blockRegistryObject : FunctionalStorage.DRAWER_TYPES.get(drawerType)) {
|
for (RegistryObject<Block> blockRegistryObject : FunctionalStorage.DRAWER_TYPES.get(drawerType).stream().map(Pair::getLeft).collect(Collectors.toList())) {
|
||||||
DrawerBlock drawerBlock = (DrawerBlock) blockRegistryObject.get();
|
DrawerBlock drawerBlock = (DrawerBlock) blockRegistryObject.get();
|
||||||
this.add(drawerBlock, WordUtils.capitalize(drawerBlock.getWoodType().getName().replace('_', ' ').toLowerCase()) + " Drawer (" +drawerBlock.getType().getDisplayName() +")");
|
this.add(drawerBlock, WordUtils.capitalize(drawerBlock.getWoodType().getName().replace('_', ' ').toLowerCase()) + " Drawer (" +drawerBlock.getType().getDisplayName() +")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.add(FunctionalStorage.COMPACTING_DRAWER.get(), "Compacting Drawer");
|
this.add(FunctionalStorage.COMPACTING_DRAWER.getLeft().get(), "Compacting Drawer");
|
||||||
this.add(FunctionalStorage.ENDER_DRAWER.get(), "Ender Drawer" );
|
this.add(FunctionalStorage.ENDER_DRAWER.getLeft().get(), "Ender Drawer" );
|
||||||
this.add("linkingtool.linkingmode", "Linking Mode: ");
|
this.add("linkingtool.linkingmode", "Linking Mode: ");
|
||||||
this.add("linkingtool.linkingmode.single", "Single");
|
this.add("linkingtool.linkingmode.single", "Single");
|
||||||
this.add("linkingtool.linkingmode.single.desc", "Links a drawer to a controller");
|
this.add("linkingtool.linkingmode.single.desc", "Links a drawer to a controller");
|
||||||
|
@ -39,7 +42,7 @@ public class FunctionalStorageLangProvider extends LanguageProvider {
|
||||||
this.add("key.categories.utility", "Utility");
|
this.add("key.categories.utility", "Utility");
|
||||||
this.add("key.categories.storage", "Storage");
|
this.add("key.categories.storage", "Storage");
|
||||||
this.add(FunctionalStorage.LINKING_TOOL.get(), "Linking Tool");
|
this.add(FunctionalStorage.LINKING_TOOL.get(), "Linking Tool");
|
||||||
this.add(FunctionalStorage.DRAWER_CONTROLLER.get(), "Storage Controller");
|
this.add(FunctionalStorage.DRAWER_CONTROLLER.getLeft().get(), "Storage Controller");
|
||||||
this.add("storageupgrade.desc", "Multiplies the block storage by ");
|
this.add("storageupgrade.desc", "Multiplies the block storage by ");
|
||||||
for (StorageUpgradeItem.StorageTier storageTier : FunctionalStorage.STORAGE_UPGRADES.keySet()) {
|
for (StorageUpgradeItem.StorageTier storageTier : FunctionalStorage.STORAGE_UPGRADES.keySet()) {
|
||||||
this.add(FunctionalStorage.STORAGE_UPGRADES.get(storageTier).get(), WordUtils.capitalize(storageTier.name().toLowerCase()) + (storageTier == StorageUpgradeItem.StorageTier.IRON ? " Downgrade" : " Upgrade"));
|
this.add(FunctionalStorage.STORAGE_UPGRADES.get(storageTier).get(), WordUtils.capitalize(storageTier.name().toLowerCase()) + (storageTier == StorageUpgradeItem.StorageTier.IRON ? " Downgrade" : " Upgrade"));
|
||||||
|
@ -48,7 +51,7 @@ public class FunctionalStorageLangProvider extends LanguageProvider {
|
||||||
this.add(FunctionalStorage.PULLING_UPGRADE.get(), WordUtils.capitalize(FunctionalStorage.PULLING_UPGRADE.get().getRegistryName().getPath().replace('_', ' ').toLowerCase()) );
|
this.add(FunctionalStorage.PULLING_UPGRADE.get(), WordUtils.capitalize(FunctionalStorage.PULLING_UPGRADE.get().getRegistryName().getPath().replace('_', ' ').toLowerCase()) );
|
||||||
this.add(FunctionalStorage.PUSHING_UPGRADE.get(), WordUtils.capitalize(FunctionalStorage.PUSHING_UPGRADE.get().getRegistryName().getPath().replace('_', ' ').toLowerCase()) );
|
this.add(FunctionalStorage.PUSHING_UPGRADE.get(), WordUtils.capitalize(FunctionalStorage.PUSHING_UPGRADE.get().getRegistryName().getPath().replace('_', ' ').toLowerCase()) );
|
||||||
this.add(FunctionalStorage.VOID_UPGRADE.get(), WordUtils.capitalize(FunctionalStorage.VOID_UPGRADE.get().getRegistryName().getPath().replace('_', ' ').toLowerCase()) );
|
this.add(FunctionalStorage.VOID_UPGRADE.get(), WordUtils.capitalize(FunctionalStorage.VOID_UPGRADE.get().getRegistryName().getPath().replace('_', ' ').toLowerCase()) );
|
||||||
this.add(FunctionalStorage.ARMORY_CABINET.get(), "Armory Cabinet");
|
this.add(FunctionalStorage.ARMORY_CABINET.getLeft().get(), "Armory Cabinet");
|
||||||
this.add(FunctionalStorage.CONFIGURATION_TOOL.get(), "Configuration Tool");
|
this.add(FunctionalStorage.CONFIGURATION_TOOL.get(), "Configuration Tool");
|
||||||
this.add("item.utility.downgrade", "Downgrades the slots to a max of 64 items");
|
this.add("item.utility.downgrade", "Downgrades the slots to a max of 64 items");
|
||||||
this.add("item.utility.direction", "Direction: ");
|
this.add("item.utility.direction", "Direction: ");
|
||||||
|
|
|
@ -3,12 +3,13 @@ package com.buuz135.functionalstorage.util;
|
||||||
import com.buuz135.functionalstorage.FunctionalStorage;
|
import com.buuz135.functionalstorage.FunctionalStorage;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.tags.ItemTags;
|
import net.minecraft.tags.ItemTags;
|
||||||
|
import net.minecraft.tags.TagKey;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraftforge.common.Tags;
|
import net.minecraftforge.common.Tags;
|
||||||
|
|
||||||
public class StorageTags {
|
public class StorageTags {
|
||||||
|
|
||||||
public static Tags.IOptionalNamedTag<Item> DRAWER = ItemTags.createOptional(new ResourceLocation(FunctionalStorage.MOD_ID, "drawer"));
|
public static TagKey<Item> DRAWER = ItemTags.create(new ResourceLocation(FunctionalStorage.MOD_ID, "drawer"));
|
||||||
public static Tags.IOptionalNamedTag<Item> IGNORE_CRAFTING_CHECK = ItemTags.createOptional(new ResourceLocation(FunctionalStorage.MOD_ID, "ignore_crafting_check"));
|
public static TagKey<Item> IGNORE_CRAFTING_CHECK = ItemTags.create(new ResourceLocation(FunctionalStorage.MOD_ID, "ignore_crafting_check"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user