Skip to content

Commit

Permalink
Fixes Diagonal Walls messing with Recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeryn99 committed Sep 6, 2024
1 parent 4336145 commit f3efbb6
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<ConfiguredFeature<?,?>> makeConfiguredFeatureKey(ResourceLocation rl){
public static ResourceKey<ConfiguredFeature<?, ?>> makeConfiguredFeatureKey(ResourceLocation rl) {
return ResourceKey.create(Registries.CONFIGURED_FEATURE, rl);
}

public static ResourceKey<PlacedFeature> makePlacedFeatureKey(ResourceLocation rl){
public static ResourceKey<PlacedFeature> makePlacedFeatureKey(ResourceLocation rl) {
return ResourceKey.create(Registries.PLACED_FEATURE, rl);
}

public static TagKey<Biome> makeGenericBiomeTagCollection(String name){
public static TagKey<Biome> makeGenericBiomeTagCollection(String name) {
return TagKey.create(Registries.BIOME, new ResourceLocation(TardisRefined.MODID, "collections/" + name));
}

public static TagKey<Biome> makeBiomeTagForFeature(String name){
public static TagKey<Biome> 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<Block> 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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<Biome> IS_MOUNTAIN_OR_OCEAN = RegistryHelper.makeGenericBiomeTagCollection("is_mountain_or_ocean");
public static TagKey<Biome> TARDIS_ROOT_CLUSTER = RegistryHelper.makeBiomeTagForFeature("tardis_root_cluster");
public static TagKey<Block> 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<EntityType<?>> TARDIS_TELEPORT_BLACKLIST = TagKey.create(Registries.ENTITY_TYPE, new ResourceLocation(TardisRefined.MODID, "tardis_teleport_blacklist"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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<Block> 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]));

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down

0 comments on commit f3efbb6

Please sign in to comment.