diff --git a/Common/src/main/java/net/potionstudios/biomeswevegone/BiomesWeveGone.java b/Common/src/main/java/net/potionstudios/biomeswevegone/BiomesWeveGone.java index 69f7b3428..013abf94a 100644 --- a/Common/src/main/java/net/potionstudios/biomeswevegone/BiomesWeveGone.java +++ b/Common/src/main/java/net/potionstudios/biomeswevegone/BiomesWeveGone.java @@ -1,6 +1,8 @@ package net.potionstudios.biomeswevegone; import com.mojang.logging.LogUtils; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; import net.potionstudios.biomeswevegone.sounds.BWGSounds; @@ -97,4 +99,14 @@ public static void serverStart(MinecraftServer server) { public static ResourceLocation id(String name) { return new ResourceLocation(MOD_ID, name); } + + /** + * Creates a new resource key for Oh The Biomes We've Gone. + * @param registryKey the registry key for the resource + * @param name the name of the resource + * @return the new resource key with the Biomes We've Gone location + */ + public static ResourceKey key(ResourceKey> registryKey, String name) { + return ResourceKey.create(registryKey, id(name)); + } } diff --git a/Common/src/main/java/net/potionstudios/biomeswevegone/world/damagesource/BWGDamageTypes.java b/Common/src/main/java/net/potionstudios/biomeswevegone/world/damagesource/BWGDamageTypes.java index bdb271d54..0d34a595e 100644 --- a/Common/src/main/java/net/potionstudios/biomeswevegone/world/damagesource/BWGDamageTypes.java +++ b/Common/src/main/java/net/potionstudios/biomeswevegone/world/damagesource/BWGDamageTypes.java @@ -19,7 +19,7 @@ public interface BWGDamageTypes { ResourceKey CATTAIL_EXPLOSION = register("cattail_explosion", (damageTypeBootstapContext -> new DamageType(BiomesWeveGone.MOD_ID + ".cattailExplosion", DamageScaling.ALWAYS, 0.1F))); private static ResourceKey register(String id, DamageTypeFactory factory) { - ResourceKey key = ResourceKey.create(Registries.DAMAGE_TYPE, BiomesWeveGone.id(id)); + ResourceKey key = BiomesWeveGone.key(Registries.DAMAGE_TYPE, id); DAMAGE_TYPE_FACTORIES.put(key, factory); return key; } diff --git a/Common/src/main/java/net/potionstudios/biomeswevegone/world/entity/ai/village/poi/BWGPoiTypes.java b/Common/src/main/java/net/potionstudios/biomeswevegone/world/entity/ai/village/poi/BWGPoiTypes.java index e87daa89f..0e5d07415 100644 --- a/Common/src/main/java/net/potionstudios/biomeswevegone/world/entity/ai/village/poi/BWGPoiTypes.java +++ b/Common/src/main/java/net/potionstudios/biomeswevegone/world/entity/ai/village/poi/BWGPoiTypes.java @@ -16,7 +16,7 @@ public class BWGPoiTypes { private static ResourceKey register(String id, Supplier block, int maxTickets, int validRange) { PlatformHandler.PLATFORM_HANDLER.registerPOIType(id, block, maxTickets, validRange); - return ResourceKey.create(Registries.POINT_OF_INTEREST_TYPE, BiomesWeveGone.id(id)); + return BiomesWeveGone.key(Registries.POINT_OF_INTEREST_TYPE, id); } public static void poiTypes() { diff --git a/Common/src/main/java/net/potionstudios/biomeswevegone/world/item/BWGCreativeTabs.java b/Common/src/main/java/net/potionstudios/biomeswevegone/world/item/BWGCreativeTabs.java index 32dd92acc..9d9473dd0 100644 --- a/Common/src/main/java/net/potionstudios/biomeswevegone/world/item/BWGCreativeTabs.java +++ b/Common/src/main/java/net/potionstudios/biomeswevegone/world/item/BWGCreativeTabs.java @@ -25,7 +25,7 @@ public class BWGCreativeTabs { @SafeVarargs private static ResourceKey createCreativeTab(String name, Supplier icon, ArrayList>... items) { PlatformHandler.PLATFORM_HANDLER.createCreativeTab(name, icon, items); - return ResourceKey.create(Registries.CREATIVE_MODE_TAB, BiomesWeveGone.id(name)); + return BiomesWeveGone.key(Registries.CREATIVE_MODE_TAB, name); } public static void tabs() { diff --git a/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/block/custom/BWGDirtPathBlock.java b/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/block/custom/BWGDirtPathBlock.java index 9e46b3610..ddbfe3be0 100644 --- a/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/block/custom/BWGDirtPathBlock.java +++ b/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/block/custom/BWGDirtPathBlock.java @@ -24,7 +24,7 @@ public BWGDirtPathBlock(Supplier dirtBlock) { } @Override - public BlockState getStateForPlacement(BlockPlaceContext context) { + public @NotNull BlockState getStateForPlacement(BlockPlaceContext context) { return !this.defaultBlockState().canSurvive(context.getLevel(), context.getClickedPos()) ? Block.pushEntitiesUp(this.defaultBlockState(), dirtBlock.get().defaultBlockState(), context.getLevel(), context.getClickedPos()) : super.getStateForPlacement(context); diff --git a/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/block/custom/BWGFarmLandBlock.java b/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/block/custom/BWGFarmLandBlock.java index b29fad191..5f290abe6 100644 --- a/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/block/custom/BWGFarmLandBlock.java +++ b/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/block/custom/BWGFarmLandBlock.java @@ -34,7 +34,7 @@ public BWGFarmLandBlock(Supplier dirt) { } @Override - public BlockState getStateForPlacement(BlockPlaceContext context) { + public @NotNull BlockState getStateForPlacement(BlockPlaceContext context) { return !this.defaultBlockState().canSurvive(context.getLevel(), context.getClickedPos()) ? dirt.get().defaultBlockState() : super.getStateForPlacement(context); } diff --git a/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/biome/BWGBiomes.java b/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/biome/BWGBiomes.java index ba46e404c..a6494d23a 100644 --- a/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/biome/BWGBiomes.java +++ b/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/biome/BWGBiomes.java @@ -82,7 +82,7 @@ public class BWGBiomes { @SafeVarargs public static ResourceKey createBiome(String id, BiomeFactory biomeFactory, TagKey... tags) { - ResourceKey biomeResourceKey = ResourceKey.create(Registries.BIOME, BiomesWeveGone.id(id)); + ResourceKey biomeResourceKey = BiomesWeveGone.key(Registries.BIOME, id); BIOME_FACTORIES.put(biomeResourceKey, biomeFactory); for (TagKey tag : tags) diff --git a/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/feature/configured/ConfiguredFeaturesUtil.java b/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/feature/configured/ConfiguredFeaturesUtil.java index ccbcff030..cf847bc4e 100644 --- a/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/feature/configured/ConfiguredFeaturesUtil.java +++ b/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/feature/configured/ConfiguredFeaturesUtil.java @@ -106,7 +106,7 @@ public static RandomFeatureConfiguration createRandomWeightedConfiguredFeature(H } private static ResourceKey> registerKey(String name) { - return ResourceKey.create(Registries.CONFIGURED_FEATURE, BiomesWeveGone.id(name)); + return BiomesWeveGone.key(Registries.CONFIGURED_FEATURE, name); } @FunctionalInterface diff --git a/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/feature/placed/PlacedFeaturesUtil.java b/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/feature/placed/PlacedFeaturesUtil.java index 2c57ed32c..c8e909415 100644 --- a/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/feature/placed/PlacedFeaturesUtil.java +++ b/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/feature/placed/PlacedFeaturesUtil.java @@ -66,7 +66,7 @@ protected static ResourceKey cr } private static ResourceKey registerKey(String name) { - return ResourceKey.create(Registries.PLACED_FEATURE, BiomesWeveGone.id(name)); + return BiomesWeveGone.key(Registries.PLACED_FEATURE, name); } @FunctionalInterface diff --git a/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/structure/BWGStructureSets.java b/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/structure/BWGStructureSets.java index 1714ece21..544719f98 100644 --- a/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/structure/BWGStructureSets.java +++ b/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/structure/BWGStructureSets.java @@ -68,7 +68,7 @@ public class BWGStructureSets { private static ResourceKey register(String id, StructureSetFactory factory) { - ResourceKey structureSetResourceKey = ResourceKey.create(Registries.STRUCTURE_SET, BiomesWeveGone.id(id)); + ResourceKey structureSetResourceKey = BiomesWeveGone.key(Registries.STRUCTURE_SET, id); STRUCTURE_SET_FACTORIES.put(structureSetResourceKey, factory); return structureSetResourceKey; } diff --git a/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/structure/BWGStructures.java b/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/structure/BWGStructures.java index 23480f0cf..0fbabc2a9 100644 --- a/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/structure/BWGStructures.java +++ b/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/structure/BWGStructures.java @@ -277,7 +277,7 @@ public class BWGStructures { ))); private static ResourceKey register(String id, StructureFactory factory) { - ResourceKey structureSetResourceKey = ResourceKey.create(Registries.STRUCTURE, BiomesWeveGone.id(id)); + ResourceKey structureSetResourceKey = BiomesWeveGone.key(Registries.STRUCTURE, id); STRUCTURE_FACTORIES.put(structureSetResourceKey, factory); return structureSetResourceKey; } diff --git a/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/structure/BWGTemplatePools.java b/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/structure/BWGTemplatePools.java index 8e428d8bc..6b17bc18d 100644 --- a/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/structure/BWGTemplatePools.java +++ b/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/structure/BWGTemplatePools.java @@ -67,7 +67,7 @@ private static Holder.Reference getProcessor(BootstapCon } private static ResourceKey register(String id, TemplatePoolFactory factory) { - ResourceKey templatePoolResourceKey = ResourceKey.create(Registries.TEMPLATE_POOL, BiomesWeveGone.id(id)); + ResourceKey templatePoolResourceKey = BiomesWeveGone.key(Registries.TEMPLATE_POOL, id); TEMPLATE_POOL_FACTORIES.put(templatePoolResourceKey, factory); return templatePoolResourceKey; } diff --git a/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/structure/BWGVillageTemplatePools.java b/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/structure/BWGVillageTemplatePools.java index ed4621067..268f4940c 100644 --- a/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/structure/BWGVillageTemplatePools.java +++ b/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/structure/BWGVillageTemplatePools.java @@ -417,7 +417,7 @@ private static ResourceKey createTerminatorPool(String id } private static ResourceKey register(String id, BWGTemplatePools.TemplatePoolFactory factory) { - ResourceKey templatePoolResourceKey = ResourceKey.create(Registries.TEMPLATE_POOL, BiomesWeveGone.id("village/" + id)); + ResourceKey templatePoolResourceKey = BiomesWeveGone.key(Registries.TEMPLATE_POOL, "village/" + id); BWGTemplatePools.TEMPLATE_POOL_FACTORIES.put(templatePoolResourceKey, factory); return templatePoolResourceKey; } diff --git a/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/structure/processor/BWGStructureProcessorLists.java b/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/structure/processor/BWGStructureProcessorLists.java index 4c5e73793..0424cf3e9 100644 --- a/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/structure/processor/BWGStructureProcessorLists.java +++ b/Common/src/main/java/net/potionstudios/biomeswevegone/world/level/levelgen/structure/processor/BWGStructureProcessorLists.java @@ -173,7 +173,7 @@ public class BWGStructureProcessorLists { )); private static ResourceKey register(String id, StructureProcessorListFactory factory) { - ResourceKey structureProcessorListResourceKey = ResourceKey.create(Registries.PROCESSOR_LIST, BiomesWeveGone.id(id)); + ResourceKey structureProcessorListResourceKey = BiomesWeveGone.key(Registries.PROCESSOR_LIST, id); STRUCTURE_PROCESSOR_LIST_FACTORIES.put(structureProcessorListResourceKey, factory); return structureProcessorListResourceKey; }