From 8b93dd442552b4ad2c6c7c6737a9100ac93cde78 Mon Sep 17 00:00:00 2001 From: SD Date: Thu, 16 Jul 2020 20:09:48 +0530 Subject: [PATCH] Fixed bug where items would not appear in the search bar On branch dev1 Changes to be committed: modified: src/main/java/org/dimdev/dimdoors/item/ModItemGroups.java modified: src/main/java/org/dimdev/dimdoors/item/ModItems.java --- .../dimdev/dimdoors/item/ModItemGroups.java | 59 ---------- .../org/dimdev/dimdoors/item/ModItems.java | 109 ++++++++---------- 2 files changed, 51 insertions(+), 117 deletions(-) diff --git a/src/main/java/org/dimdev/dimdoors/item/ModItemGroups.java b/src/main/java/org/dimdev/dimdoors/item/ModItemGroups.java index 519c78b8..25a5a8d5 100644 --- a/src/main/java/org/dimdev/dimdoors/item/ModItemGroups.java +++ b/src/main/java/org/dimdev/dimdoors/item/ModItemGroups.java @@ -1,6 +1,5 @@ package org.dimdev.dimdoors.item; -import com.google.common.collect.Lists; import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; @@ -10,63 +9,5 @@ public final class ModItemGroups { public static final ItemGroup DIMENSIONAL_DOORS = FabricItemGroupBuilder .create(new Identifier("dimdoors", "dimensional_doors")) .icon(() -> new ItemStack(ModItems.IRON_DIMENSIONAL_DOOR)) - .appendItems(items -> items.addAll(Lists.newArrayList( - new ItemStack(ModItems.QUARTZ_DOOR), - new ItemStack(ModItems.QUARTZ_DIMENSIONAL_DOOR), - new ItemStack(ModItems.GOLD_DOOR), - new ItemStack(ModItems.GOLD_DIMENSIONAL_DOOR), - new ItemStack(ModItems.IRON_DIMENSIONAL_DOOR), - new ItemStack(ModItems.OAK_DIMENSIONAL_DOOR), -// new ItemStack(ModItems.UNSTABLE_DIMENSIONAL_DOOR), - new ItemStack(ModItems.OAK_DIMENSIONAL_TRAPDOOR), - new ItemStack(ModItems.WORLD_THREAD), - new ItemStack(ModItems.RIFT_CONFIGURATION_TOOL), - new ItemStack(ModItems.RIFT_BLADE), - new ItemStack(ModItems.RIFT_REMOVER), - new ItemStack(ModItems.RIFT_SIGNATURE), - new ItemStack(ModItems.STABILIZED_RIFT_SIGNATURE), - new ItemStack(ModItems.RIFT_STABILIZER), - new ItemStack(ModItems.WORLD_THREAD_HELMET), - new ItemStack(ModItems.WORLD_THREAD_CHESTPLATE), - new ItemStack(ModItems.WORLD_THREAD_LEGGINGS), - new ItemStack(ModItems.WORLD_THREAD_BOOTS), - new ItemStack(ModItems.STABLE_FABRIC), - new ItemStack(ModItems.WHITE_FABRIC), - new ItemStack(ModItems.ORANGE_FABRIC), - new ItemStack(ModItems.MAGENTA_FABRIC), - new ItemStack(ModItems.LIGHT_BLUE_FABRIC), - new ItemStack(ModItems.YELLOW_FABRIC), - new ItemStack(ModItems.LIME_FABRIC), - new ItemStack(ModItems.PINK_FABRIC), - new ItemStack(ModItems.GRAY_FABRIC), - new ItemStack(ModItems.LIGHT_GRAY_FABRIC), - new ItemStack(ModItems.CYAN_FABRIC), - new ItemStack(ModItems.PURPLE_FABRIC), - new ItemStack(ModItems.BLUE_FABRIC), - new ItemStack(ModItems.BROWN_FABRIC), - new ItemStack(ModItems.GREEN_FABRIC), - new ItemStack(ModItems.RED_FABRIC), - new ItemStack(ModItems.BLACK_FABRIC), - - new ItemStack(ModItems.WHITE_ANCIENT_FABRIC), - new ItemStack(ModItems.ORANGE_ANCIENT_FABRIC), - new ItemStack(ModItems.MAGENTA_ANCIENT_FABRIC), - new ItemStack(ModItems.LIGHT_BLUE_ANCIENT_FABRIC), - new ItemStack(ModItems.YELLOW_ANCIENT_FABRIC), - new ItemStack(ModItems.LIME_ANCIENT_FABRIC), - new ItemStack(ModItems.PINK_ANCIENT_FABRIC), - new ItemStack(ModItems.GRAY_ANCIENT_FABRIC), - new ItemStack(ModItems.LIGHT_GRAY_ANCIENT_FABRIC), - new ItemStack(ModItems.CYAN_ANCIENT_FABRIC), - new ItemStack(ModItems.PURPLE_ANCIENT_FABRIC), - new ItemStack(ModItems.BLUE_ANCIENT_FABRIC), - new ItemStack(ModItems.BROWN_ANCIENT_FABRIC), - new ItemStack(ModItems.GREEN_ANCIENT_FABRIC), - new ItemStack(ModItems.RED_ANCIENT_FABRIC), - new ItemStack(ModItems.BLACK_ANCIENT_FABRIC), - new ItemStack(ModItems.UNRAVELLED_FABRIC), - new ItemStack(ModItems.CREEPY_RECORD), - new ItemStack(ModItems.MARKING_PLATE) - ))) .build(); } diff --git a/src/main/java/org/dimdev/dimdoors/item/ModItems.java b/src/main/java/org/dimdev/dimdoors/item/ModItems.java index 8b03b11b..c6e4664c 100644 --- a/src/main/java/org/dimdev/dimdoors/item/ModItems.java +++ b/src/main/java/org/dimdev/dimdoors/item/ModItems.java @@ -20,38 +20,7 @@ import java.util.HashSet; import static org.dimdev.dimdoors.item.ModItemGroups.DIMENSIONAL_DOORS; public final class ModItems { - public static final Item GOLD_DOOR = register(ModBlocks.GOLD_DOOR); public static final Item QUARTZ_DOOR = register(ModBlocks.QUARTZ_DOOR); - - public static final Item IRON_DIMENSIONAL_DOOR = register(new DimensionalDoorItem( - ModBlocks.IRON_DIMENSIONAL_DOOR, - new Item.Settings().group(DIMENSIONAL_DOORS).maxCount(1), - rift -> { - PublicPocketTarget destination = new PublicPocketTarget(); - rift.setDestination(destination); - } - )); - - public static final Item GOLD_DIMENSIONAL_DOOR = register(new DimensionalDoorItem( - ModBlocks.GOLD_DIMENSIONAL_DOOR, - new Item.Settings().group(DIMENSIONAL_DOORS).maxCount(1), - rift -> { - rift.setProperties(LinkProperties.builder() - .groups(new HashSet<>(Arrays.asList(0, 1))) - .linksRemaining(1).build()); - - rift.setDestination(RandomTarget.builder() - .acceptedGroups(Collections.singleton(0)) - .coordFactor(1) - .negativeDepthFactor(10000) - .positiveDepthFactor(80) - .weightMaximum(100) - .noLink(false) - .noLinkBack(false) - .newRiftWeight(1).build()); - } - )); - public static final Item QUARTZ_DIMENSIONAL_DOOR = register(new DimensionalDoorItem( ModBlocks.QUARTZ_DIMENSIONAL_DOOR, new Item.Settings().group(DIMENSIONAL_DOORS).maxCount(1), @@ -64,6 +33,36 @@ public final class ModItems { } )); + public static final Item GOLD_DOOR = register(ModBlocks.GOLD_DOOR); + public static final Item GOLD_DIMENSIONAL_DOOR = register(new DimensionalDoorItem( + ModBlocks.GOLD_DIMENSIONAL_DOOR, + new Item.Settings().group(DIMENSIONAL_DOORS).maxCount(1), + rift -> { + rift.setProperties(LinkProperties.builder() + .groups(new HashSet<>(Arrays.asList(0, 1))) + .linksRemaining(1).build()); + + rift.setDestination(RandomTarget.builder() + .acceptedGroups(Collections.singleton(0)) + .coordFactor(1) + .negativeDepthFactor(10000) + .positiveDepthFactor(80) + .weightMaximum(100) + .noLink(false) + .noLinkBack(false) + .newRiftWeight(1).build()); + } + )); + + public static final Item IRON_DIMENSIONAL_DOOR = register(new DimensionalDoorItem( + ModBlocks.IRON_DIMENSIONAL_DOOR, + new Item.Settings().group(DIMENSIONAL_DOORS).maxCount(1), + rift -> { + PublicPocketTarget destination = new PublicPocketTarget(); + rift.setDestination(destination); + } + )); + // public static final Item UNSTABLE_DIMENSIONAL_DOOR = register( new DimensionalDoorItem( // ModBlocks.IRON_DIMENSIONAL_DOOR, // new Item.Settings().group(ModItemGroups.DIMENSIONAL_DOORS).maxCount(1), @@ -93,6 +92,21 @@ public final class ModItems { rift -> rift.setDestination(new EscapeTarget(false)) )); + public static final Item WORLD_THREAD = register(new Identifier("dimdoors:world_thread"), new Item(new Item.Settings().group(DIMENSIONAL_DOORS))); + public static final Item RIFT_CONFIGURATION_TOOL = register(new Identifier("dimdoors:rift_configuration_tool"), new RiftConfigurationToolItem()); + public static final Item RIFT_BLADE = register(new Identifier("dimdoors:rift_blade"), new RiftBladeItem(new Item.Settings().maxDamage(100).group(DIMENSIONAL_DOORS))); + public static final Item RIFT_REMOVER = register(new Identifier("dimdoors:rift_remover"), new RiftRemoverItem(new Item.Settings().maxCount(1).maxDamage(100).group(DIMENSIONAL_DOORS))); + public static final Item RIFT_SIGNATURE = register(new Identifier("dimdoors:rift_signature"), new RiftSignatureItem(new Item.Settings().maxCount(1).maxDamage(1).group(DIMENSIONAL_DOORS))); + public static final Item STABILIZED_RIFT_SIGNATURE = register(new Identifier("dimdoors:stabilized_rift_signature"), new StabilizedRiftSignatureItem(new Item.Settings().maxCount(1).maxDamage(20).group(DIMENSIONAL_DOORS))); + public static final Item RIFT_STABILIZER = register(new Identifier("dimdoors:rift_stabilizer"), new RiftStabilizerItem(new Item.Settings().maxCount(1).maxDamage(6).group(DIMENSIONAL_DOORS))); + + public static final Item WORLD_THREAD_HELMET = register(new Identifier("dimdoors:world_thread_helmet"), new WorldThreadArmorItem(EquipmentSlot.HEAD, new Item.Settings())); + public static final Item WORLD_THREAD_CHESTPLATE = register(new Identifier("dimdoors:world_thread_chestplate"), new WorldThreadArmorItem(EquipmentSlot.CHEST, new Item.Settings())); + public static final Item WORLD_THREAD_LEGGINGS = register(new Identifier("dimdoors:world_thread_leggings"), new WorldThreadArmorItem(EquipmentSlot.LEGS, new Item.Settings())); + public static final Item WORLD_THREAD_BOOTS = register(new Identifier("dimdoors:world_thread_boots"), new WorldThreadArmorItem(EquipmentSlot.FEET, new Item.Settings())); + + public static final Item STABLE_FABRIC = register(new Identifier("dimdoors:stable_fabric"), new Item(new Item.Settings().group(DIMENSIONAL_DOORS))); + public static final Item WHITE_FABRIC = register(ModBlocks.WHITE_FABRIC); public static final Item ORANGE_FABRIC = register(ModBlocks.ORANGE_FABRIC); public static final Item MAGENTA_FABRIC = register(ModBlocks.MAGENTA_FABRIC); @@ -127,38 +141,17 @@ public final class ModItems { public static final Item RED_ANCIENT_FABRIC = register(ModBlocks.RED_ANCIENT_FABRIC); public static final Item BLACK_ANCIENT_FABRIC = register(ModBlocks.BLACK_ANCIENT_FABRIC); + public static final Item UNRAVELLED_FABRIC = register(ModBlocks.UNRAVELLED_FABRIC); + public static final Item CREEPY_RECORD = register(new Identifier("dimdoors:creepy_record"), new MusicDiscItem(10, ModSoundEvents.CREEPY, new Item.Settings().group(DIMENSIONAL_DOORS))); + public static final Item WHITE_VOID_RECORD = register(new Identifier("dimdoors:white_void_record"), new MusicDiscItem(10, ModSoundEvents.CREEPY, new Item.Settings().group(DIMENSIONAL_DOORS))); + public static final Item MARKING_PLATE = register(ModBlocks.MARKING_PLATE); public static final Item ETERNAL_FLUID = register(ModBlocks.ETERNAL_FLUID); - public static final Item UNRAVELLED_FABRIC = register(ModBlocks.UNRAVELLED_FABRIC, DIMENSIONAL_DOORS); - - public static final Item MARKING_PLATE = register(ModBlocks.MARKING_PLATE, DIMENSIONAL_DOORS); + public static final Item ETERNAL_FLUID_BUCKET = register(new Identifier("dimdoors:eternal_fluid_bucket"), new BucketItem(ModFluids.ETERNAL_FLUID, new Item.Settings().group(DIMENSIONAL_DOORS).recipeRemainder(Items.BUCKET).maxCount(1))); // Dimensional doors - public static final Item WORLD_THREAD = register(new Identifier("dimdoors:world_thread"), new Item(new Item.Settings().group(DIMENSIONAL_DOORS))); - public static final Item STABLE_FABRIC = register(new Identifier("dimdoors:stable_fabric"), new Item(new Item.Settings().group(DIMENSIONAL_DOORS))); - public static final Item RIFT_CONFIGURATION_TOOL = register(new Identifier("dimdoors:rift_configuration_tool"), new RiftConfigurationToolItem()); - public static final Item RIFT_BLADE = register(new Identifier("dimdoors:rift_blade"), new RiftBladeItem(new Item.Settings().maxDamage(100).group(DIMENSIONAL_DOORS))); - public static final Item RIFT_REMOVER = register(new Identifier("dimdoors:rift_remover"), new RiftRemoverItem(new Item.Settings().maxCount(1).maxDamage(100).group(DIMENSIONAL_DOORS))); - public static final Item RIFT_SIGNATURE = register(new Identifier("dimdoors:rift_signature"), new RiftSignatureItem(new Item.Settings().maxCount(1).maxDamage(1).group(DIMENSIONAL_DOORS))); - public static final Item STABILIZED_RIFT_SIGNATURE = register(new Identifier("dimdoors:stabilized_rift_signature"), new StabilizedRiftSignatureItem(new Item.Settings().maxCount(1).maxDamage(20).group(DIMENSIONAL_DOORS))); - public static final Item RIFT_STABILIZER = register(new Identifier("dimdoors:rift_stabilizer"), new RiftStabilizerItem(new Item.Settings().maxCount(1).maxDamage(6).group(DIMENSIONAL_DOORS))); - - public static final Item WORLD_THREAD_HELMET = register(new Identifier("dimdoors:world_thread_helmet"), new WorldThreadArmorItem(EquipmentSlot.HEAD, new Item.Settings())); - public static final Item WORLD_THREAD_CHESTPLATE = register(new Identifier("dimdoors:world_thread_chestplate"), new WorldThreadArmorItem(EquipmentSlot.CHEST, new Item.Settings())); - public static final Item WORLD_THREAD_LEGGINGS = register(new Identifier("dimdoors:world_thread_leggings"), new WorldThreadArmorItem(EquipmentSlot.LEGS, new Item.Settings())); - public static final Item WORLD_THREAD_BOOTS = register(new Identifier("dimdoors:world_thread_boots"), new WorldThreadArmorItem(EquipmentSlot.FEET, new Item.Settings())); - - public static final Item CREEPY_RECORD = register(new Identifier("dimdoors:creepy_record"), new MusicDiscItem(10, ModSoundEvents.CREEPY, new Item.Settings().group(DIMENSIONAL_DOORS))); - public static final Item WHITE_VOID_RECORD = register(new Identifier("dimdoors:white_void_record"), new MusicDiscItem(10, ModSoundEvents.CREEPY, new Item.Settings().group(DIMENSIONAL_DOORS))); - - public static final Item ETERNAL_FLUID_BUCKET = register(new Identifier("dimdoors:eternal_fluid_bucket"), new BucketItem(ModFluids.ETERNAL_FLUID, new Item.Settings().group(DIMENSIONAL_DOORS).recipeRemainder(Items.BUCKET).maxCount(1))); - private static Item register(Block block) { - return register(new BlockItem(block, new Item.Settings())); - } - - private static Item register(Block block, ItemGroup itemGroup) { - return register(new BlockItem(block, (new Item.Settings()).group(itemGroup))); + return register(new BlockItem(block, (new Item.Settings()).group(ModItemGroups.DIMENSIONAL_DOORS))); } private static Item register(BlockItem blockItem) {