From f3efbb6344d51e3d9cb91e9a722a2a15e15d79a3 Mon Sep 17 00:00:00 2001 From: Craig Date: Fri, 6 Sep 2024 10:40:33 +0100 Subject: [PATCH] Fixes Diagonal Walls messing with Recipes --- .../common/util/RegistryHelper.java | 29 ++++++++++++------- .../tardis_refined/registry/TRTagKeys.java | 2 ++ .../common/data/ProviderBlockTags.java | 16 ++++++++++ .../common/data/TRBlockModelProvider.java | 1 + 4 files changed, 37 insertions(+), 11 deletions(-) diff --git a/common/src/main/java/whocraft/tardis_refined/common/util/RegistryHelper.java b/common/src/main/java/whocraft/tardis_refined/common/util/RegistryHelper.java index dd055030a..08df73343 100644 --- a/common/src/main/java/whocraft/tardis_refined/common/util/RegistryHelper.java +++ b/common/src/main/java/whocraft/tardis_refined/common/util/RegistryHelper.java @@ -6,41 +6,48 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.placement.PlacedFeature; import whocraft.tardis_refined.TardisRefined; import whocraft.tardis_refined.common.tardis.themes.ConsoleTheme; import whocraft.tardis_refined.common.tardis.themes.ShellTheme; -/** Helper for creating common objects. - * Allows for smoother transition to future versions where registries change*/ +/** + * Helper for creating common objects. + * Allows for smoother transition to future versions where registries change + */ public class RegistryHelper { - public static ResourceLocation makeKey(String id){ + public static ResourceLocation makeKey(String id) { return new ResourceLocation(TardisRefined.MODID, id); } - public static ResourceKey> makeConfiguredFeatureKey(ResourceLocation rl){ + public static ResourceKey> makeConfiguredFeatureKey(ResourceLocation rl) { return ResourceKey.create(Registries.CONFIGURED_FEATURE, rl); } - public static ResourceKey makePlacedFeatureKey(ResourceLocation rl){ + public static ResourceKey makePlacedFeatureKey(ResourceLocation rl) { return ResourceKey.create(Registries.PLACED_FEATURE, rl); } - public static TagKey makeGenericBiomeTagCollection(String name){ + public static TagKey makeGenericBiomeTagCollection(String name) { return TagKey.create(Registries.BIOME, new ResourceLocation(TardisRefined.MODID, "collections/" + name)); } - public static TagKey makeBiomeTagForFeature(String name){ + public static TagKey makeBiomeTagForFeature(String name) { return TagKey.create(Registries.BIOME, new ResourceLocation(TardisRefined.MODID, "has_structure/" + name)); } - public static ResourceLocation getKey(ConsoleTheme theme){ - return ConsoleTheme.CONSOLE_THEME_REGISTRY.getKey(theme); + public static TagKey makeBlockTag(String modid, String name) { + return TagKey.create(Registries.BLOCK, new ResourceLocation(modid, name)); } - public static ResourceLocation getKey(ShellTheme theme){ - return ShellTheme.SHELL_THEME_REGISTRY.getKey(theme); + public static ResourceLocation getKey(ConsoleTheme theme) { + return ConsoleTheme.CONSOLE_THEME_DEFERRED_REGISTRY.getKey(theme); + } + + public static ResourceLocation getKey(ShellTheme theme) { + return ShellTheme.SHELL_THEME_DEFERRED_REGISTRY.getKey(theme); } } diff --git a/common/src/main/java/whocraft/tardis_refined/registry/TRTagKeys.java b/common/src/main/java/whocraft/tardis_refined/registry/TRTagKeys.java index d7788e383..bd0564467 100644 --- a/common/src/main/java/whocraft/tardis_refined/registry/TRTagKeys.java +++ b/common/src/main/java/whocraft/tardis_refined/registry/TRTagKeys.java @@ -5,12 +5,14 @@ import net.minecraft.tags.TagKey; import net.minecraft.world.entity.EntityType; import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.block.Block; import whocraft.tardis_refined.TardisRefined; import whocraft.tardis_refined.common.util.RegistryHelper; public class TRTagKeys { public static TagKey IS_MOUNTAIN_OR_OCEAN = RegistryHelper.makeGenericBiomeTagCollection("is_mountain_or_ocean"); public static TagKey TARDIS_ROOT_CLUSTER = RegistryHelper.makeBiomeTagForFeature("tardis_root_cluster"); + public static TagKey DIAGONAL_COMPAT = RegistryHelper.makeBlockTag("diagonalwalls", "non_diagonal_walls"); /** Entity tag used to blacklist entities from being teleported into the Tardis via the doors or being landed on by the exterior shell*/ public static final TagKey> TARDIS_TELEPORT_BLACKLIST = TagKey.create(Registries.ENTITY_TYPE, new ResourceLocation(TardisRefined.MODID, "tardis_teleport_blacklist")); diff --git a/forge/src/main/java/whocraft/tardis_refined/common/data/ProviderBlockTags.java b/forge/src/main/java/whocraft/tardis_refined/common/data/ProviderBlockTags.java index 1ada5f359..f97e25405 100644 --- a/forge/src/main/java/whocraft/tardis_refined/common/data/ProviderBlockTags.java +++ b/forge/src/main/java/whocraft/tardis_refined/common/data/ProviderBlockTags.java @@ -11,8 +11,14 @@ import net.neoforged.neoforge.common.data.ExistingFileHelper; import org.jetbrains.annotations.Nullable; import whocraft.tardis_refined.TardisRefined; +import whocraft.tardis_refined.common.crafting.astral_manipulator.ManipulatorCraftingIngredient; +import whocraft.tardis_refined.common.crafting.astral_manipulator.ManipulatorRecipes; import whocraft.tardis_refined.registry.TRBlockRegistry; +import whocraft.tardis_refined.registry.TRTagKeys; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; import java.util.concurrent.CompletableFuture; public class ProviderBlockTags extends BlockTagsProvider { @@ -74,5 +80,15 @@ protected void addTags(HolderLookup.Provider provider) { .add(TRBlockRegistry.ZEITON_BLOCK.get()) .add(TRBlockRegistry.ASTRAL_MANIPULATOR_BLOCK.get()); + + // This is cursed, but we gotta do what we gotta do + Set blocks = new HashSet<>(); + ManipulatorRecipes.MANIPULATOR_CRAFTING_RECIPES.forEach((resourceLocation, manipulatorCraftingRecipe) -> { + for (ManipulatorCraftingIngredient ingredient : manipulatorCraftingRecipe.ingredients()) { + blocks.add(ingredient.inputBlockState().getBlock()); + } + }); + tag(TRTagKeys.DIAGONAL_COMPAT).add(blocks.toArray(new Block[0])); + } } diff --git a/forge/src/main/java/whocraft/tardis_refined/common/data/TRBlockModelProvider.java b/forge/src/main/java/whocraft/tardis_refined/common/data/TRBlockModelProvider.java index 5751bf970..24455eae8 100644 --- a/forge/src/main/java/whocraft/tardis_refined/common/data/TRBlockModelProvider.java +++ b/forge/src/main/java/whocraft/tardis_refined/common/data/TRBlockModelProvider.java @@ -99,6 +99,7 @@ protected void registerStatesAndModels() { emptyBlockState(TRBlockRegistry.ROOT_SHELL_BLOCK.get()); emptyBlockState(TRBlockRegistry.ARS_EGG.get()); emptyBlockState(TRBlockRegistry.ARTRON_PILLAR.get()); + emptyBlockState(TRBlockRegistry.THE_EYE.get()); threeDeeRotating(TRBlockRegistry.LANDING_PAD.get(), new ResourceLocation(TardisRefined.MODID, "block/landing_pad"));