From 49fd323ad2533318b796b09222db48ab63778128 Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Mon, 15 Jun 2020 09:10:06 -0500 Subject: [PATCH] Change some stuff to be closer to vanilla, for future potential portability reasons --- .../subtile/TileEntityFunctionalFlower.java | 6 +- .../subtile/TileEntityGeneratingFlower.java | 6 +- .../api/subtile/TileEntitySpecialFlower.java | 8 +- .../botania/common/block/ModSubtiles.java | 13 ++-- .../subtile/generating/SubTileRafflowsia.java | 3 +- .../botania/common/block/tile/TileAltar.java | 3 +- .../common/block/tile/TileEnchanter.java | 8 +- .../vazkii/botania/common/brew/ModBrews.java | 75 ++++++------------- .../common/crafting/RecipeManaInfusion.java | 5 +- .../common/item/ItemBlackHoleTalisman.java | 3 +- .../botania/common/item/ItemCacophonium.java | 3 +- .../botania/common/item/ItemSpawnerMover.java | 6 +- .../botania/common/world/ModFeatures.java | 3 +- .../botania/data/BlockLootProvider.java | 10 +-- .../botania/data/recipes/BrewProvider.java | 7 +- .../botania/data/recipes/RecipeProvider.java | 74 +++++++++--------- .../data/recipes/StonecuttingProvider.java | 44 ++++++----- 17 files changed, 127 insertions(+), 150 deletions(-) diff --git a/src/main/java/vazkii/botania/api/subtile/TileEntityFunctionalFlower.java b/src/main/java/vazkii/botania/api/subtile/TileEntityFunctionalFlower.java index bc81ec953..d486293ee 100644 --- a/src/main/java/vazkii/botania/api/subtile/TileEntityFunctionalFlower.java +++ b/src/main/java/vazkii/botania/api/subtile/TileEntityFunctionalFlower.java @@ -19,6 +19,7 @@ import net.minecraft.util.Direction; import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; +import net.minecraft.util.registry.Registry; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.registries.ForgeRegistries; @@ -151,10 +152,7 @@ public class TileEntityFunctionalFlower extends TileEntitySpecialFlower { return false; } - SoundEvent evt = ForgeRegistries.SOUND_EVENTS.getValue(DING_SOUND_EVENT); - if (evt != null) { - player.playSound(evt, 0.1F, 1F); - } + Registry.SOUND_EVENT.getValue(DING_SOUND_EVENT).ifPresent(evt -> player.playSound(evt, 0.1F, 1F)); return super.onWanded(player, wand); } diff --git a/src/main/java/vazkii/botania/api/subtile/TileEntityGeneratingFlower.java b/src/main/java/vazkii/botania/api/subtile/TileEntityGeneratingFlower.java index 9bb7ae85a..a8247fe86 100644 --- a/src/main/java/vazkii/botania/api/subtile/TileEntityGeneratingFlower.java +++ b/src/main/java/vazkii/botania/api/subtile/TileEntityGeneratingFlower.java @@ -20,6 +20,7 @@ import net.minecraft.util.Direction; import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; +import net.minecraft.util.registry.Registry; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.registries.ForgeRegistries; @@ -205,10 +206,7 @@ public class TileEntityGeneratingFlower extends TileEntitySpecialFlower { sync(); } - SoundEvent evt = ForgeRegistries.SOUND_EVENTS.getValue(DING_SOUND_EVENT); - if (evt != null) { - player.playSound(evt, 0.1F, 1F); - } + Registry.SOUND_EVENT.getValue(DING_SOUND_EVENT).ifPresent(evt -> player.playSound(evt, 0.1F, 1F)); return super.onWanded(player, wand); } diff --git a/src/main/java/vazkii/botania/api/subtile/TileEntitySpecialFlower.java b/src/main/java/vazkii/botania/api/subtile/TileEntitySpecialFlower.java index 574f02a78..9568f5563 100644 --- a/src/main/java/vazkii/botania/api/subtile/TileEntitySpecialFlower.java +++ b/src/main/java/vazkii/botania/api/subtile/TileEntitySpecialFlower.java @@ -28,6 +28,7 @@ import net.minecraft.util.Hand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.util.registry.Registry; import net.minecraft.world.World; import net.minecraft.world.storage.loot.LootContext; import net.minecraftforge.api.distmarker.Dist; @@ -69,12 +70,7 @@ public class TileEntitySpecialFlower extends TileEntity implements ITickableTile @Override public ItemStack getDisplayStack() { ResourceLocation id = getType().getRegistryName(); - Item item = ForgeRegistries.ITEMS.getValue(id); - if (item != null) { - return new ItemStack(item); - } else { - return super.getDisplayStack(); - } + return Registry.ITEM.getValue(id).map(ItemStack::new).orElse(super.getDisplayStack()); } }; private final LazyOptional floatingDataCap = LazyOptional.of(() -> floatingData); diff --git a/src/main/java/vazkii/botania/common/block/ModSubtiles.java b/src/main/java/vazkii/botania/common/block/ModSubtiles.java index 8d9a8ac66..dccb6c681 100644 --- a/src/main/java/vazkii/botania/common/block/ModSubtiles.java +++ b/src/main/java/vazkii/botania/common/block/ModSubtiles.java @@ -18,6 +18,7 @@ import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.Registry; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -231,13 +232,13 @@ public class ModSubtiles { @SubscribeEvent public static void registerItemBlocks(RegistryEvent.Register evt) { - IForgeRegistry b = ForgeRegistries.BLOCKS; + Registry b = Registry.BLOCK; IForgeRegistry r = evt.getRegistry(); Item.Properties props = ModItems.defaultBuilder(); for (Pair, ResourceLocation> type : getTypes()) { - Block block = b.getValue(type.getSecond()); - Block floating = b.getValue(floating(type.getSecond())); + Block block = b.getValue(type.getSecond()).get(); + Block floating = b.getValue(floating(type.getSecond())).get(); register(r, new ItemBlockSpecialFlower(block, props), type.getSecond()); register(r, new ItemBlockSpecialFlower(floating, props), floating(type.getSecond())); @@ -246,12 +247,12 @@ public class ModSubtiles { @SubscribeEvent public static void registerTEs(RegistryEvent.Register> evt) { - IForgeRegistry b = ForgeRegistries.BLOCKS; + Registry b = Registry.BLOCK; IForgeRegistry> r = evt.getRegistry(); for (Pair, ResourceLocation> type : getTypes()) { - Block block = b.getValue(type.getSecond()); - Block floating = b.getValue(floating(type.getSecond())); + Block block = b.getValue(type.getSecond()).get(); + Block floating = b.getValue(floating(type.getSecond())).get(); register(r, TileEntityType.Builder.create(type.getFirst(), block, floating).build(null), type.getSecond()); } } diff --git a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileRafflowsia.java b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileRafflowsia.java index cdcb4a03c..50546e4e8 100644 --- a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileRafflowsia.java +++ b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileRafflowsia.java @@ -14,6 +14,7 @@ import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.registry.Registry; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ObjectHolder; @@ -90,7 +91,7 @@ public class SubTileRafflowsia extends TileEntityGeneratingFlower { ResourceLocation id = ResourceLocation.tryCreate(cmp.getString(TAG_LAST_FLOWER)); if (id != null) { - lastFlower = ForgeRegistries.BLOCKS.getValue(id); + lastFlower = Registry.BLOCK.getValue(id).orElse(null); } lastFlowerTimes = cmp.getInt(TAG_LAST_FLOWER_TIMES); } diff --git a/src/main/java/vazkii/botania/common/block/tile/TileAltar.java b/src/main/java/vazkii/botania/common/block/tile/TileAltar.java index 105c2a9e1..4c9b0de25 100644 --- a/src/main/java/vazkii/botania/common/block/tile/TileAltar.java +++ b/src/main/java/vazkii/botania/common/block/tile/TileAltar.java @@ -31,6 +31,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.registry.Registry; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fluids.FluidAttributes; @@ -313,7 +314,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary, super.readPacketNBT(cmp); ResourceLocation id = new ResourceLocation(cmp.getString(TAG_FLUID)); - fluid = ForgeRegistries.FLUIDS.getValue(id); + fluid = Registry.FLUID.getOrDefault(id); } @Override diff --git a/src/main/java/vazkii/botania/common/block/tile/TileEnchanter.java b/src/main/java/vazkii/botania/common/block/tile/TileEnchanter.java index 40926d21e..6aff0bf8a 100644 --- a/src/main/java/vazkii/botania/common/block/tile/TileEnchanter.java +++ b/src/main/java/vazkii/botania/common/block/tile/TileEnchanter.java @@ -33,6 +33,7 @@ import net.minecraft.util.Rotation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.registry.Registry; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -398,7 +399,7 @@ public class TileEnchanter extends TileMod implements ISparkAttachable, ITickabl } String enchStr = enchants.stream() - .map(e -> ForgeRegistries.ENCHANTMENTS.getKey(e.enchantment) + "=" + e.enchantmentLevel) + .map(e -> Registry.ENCHANTMENT.getKey(e.enchantment) + "=" + e.enchantmentLevel) .collect(Collectors.joining(",")); cmp.putString(TAG_ENCHANTS, enchStr); } @@ -421,11 +422,10 @@ public class TileEnchanter extends TileMod implements ISparkAttachable, ITickabl for (String token : enchTokens) { try { String[] entryTokens = token.split("="); - Enchantment ench = ForgeRegistries.ENCHANTMENTS.getValue(new ResourceLocation(entryTokens[0])); int lvl = Integer.parseInt(entryTokens[1]); - if (ench != null) { + Registry.ENCHANTMENT.getValue(new ResourceLocation(entryTokens[0])).ifPresent(ench -> { enchants.add(new EnchantmentData(ench, lvl)); - } + }); } catch (ResourceLocationException ignored) {} } } diff --git a/src/main/java/vazkii/botania/common/brew/ModBrews.java b/src/main/java/vazkii/botania/common/brew/ModBrews.java index d78fc10c5..317c3e13b 100644 --- a/src/main/java/vazkii/botania/common/brew/ModBrews.java +++ b/src/main/java/vazkii/botania/common/brew/ModBrews.java @@ -8,20 +8,17 @@ */ package vazkii.botania.common.brew; -import net.minecraft.potion.Effect; import net.minecraft.potion.EffectInstance; import net.minecraft.potion.Effects; import net.minecraft.potion.PotionUtils; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.Registry; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.IForgeRegistry; -import net.minecraftforge.registries.ObjectHolder; import net.minecraftforge.registries.RegistryBuilder; -import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.brew.Brew; import vazkii.botania.common.lib.LibBrewNames; import vazkii.botania.common.lib.LibMisc; @@ -34,28 +31,28 @@ import static vazkii.botania.common.lib.ResourceLocationHelper.prefix; public class ModBrews { public static IForgeRegistry registry; - public static Brew fallbackBrew; - public static Brew speed; - public static Brew strength; - public static Brew haste; - public static Brew healing; - public static Brew jumpBoost; - public static Brew regen; - public static Brew regenWeak; - public static Brew resistance; - public static Brew fireResistance; - public static Brew waterBreathing; - public static Brew invisibility; - public static Brew nightVision; - public static Brew absorption; + public static final Brew fallbackBrew = make("fallback", 0, 0); + public static final Brew speed = make(LibBrewNames.SPEED, 0x59B7FF, 4000, new EffectInstance(Effects.SPEED, 1800, 1)); + public static final Brew strength = make(LibBrewNames.STRENGTH, 0xEE3F3F, 4000, new EffectInstance(Effects.STRENGTH, 1800, 1)); + public static final Brew haste = make(LibBrewNames.HASTE, 0xF4A432, 4000, new EffectInstance(Effects.HASTE, 1800, 1)); + public static final Brew healing = make(LibBrewNames.HEALING, 0xFF5ECC, 6000, new EffectInstance(Effects.INSTANT_HEALTH, 1, 1)); + public static final Brew jumpBoost = make(LibBrewNames.JUMP_BOOST, 0x32F46D, 4000, new EffectInstance(Effects.JUMP_BOOST, 1800, 1)); + public static final Brew regen = make(LibBrewNames.REGEN, 0xFD6488, 7000, new EffectInstance(Effects.REGENERATION, 500, 1)); + public static final Brew regenWeak = make(LibBrewNames.REGEN_WEAK, 0xFD6488, 9000, new EffectInstance(Effects.REGENERATION, 2400, 0)); + public static final Brew resistance = make(LibBrewNames.RESISTANCE, 0xB44E17, 4000, new EffectInstance(Effects.RESISTANCE, 1800, 1)); + public static final Brew fireResistance = make(LibBrewNames.FIRE_RESISTANCE, 0xF86900, 4000, new EffectInstance(Effects.FIRE_RESISTANCE, 9600, 0)); + public static final Brew waterBreathing = make(LibBrewNames.WATER_BREATHING, 0x84A7CF, 4000, new EffectInstance(Effects.WATER_BREATHING, 9600, 0)); + public static final Brew invisibility = make(LibBrewNames.INVISIBILITY, 0xAEAEAE, 8000, new EffectInstance(Effects.INVISIBILITY, 9600, 0)).setNotBloodPendantInfusable(); + public static final Brew nightVision = make(LibBrewNames.NIGHT_VISION, 0x7C4BEB, 4000, new EffectInstance(Effects.NIGHT_VISION, 9600, 0)); + public static final Brew absorption = make(LibBrewNames.ABSORPTION, 0xF2EB23, 7000, new EffectInstance(Effects.ABSORPTION, 1800, 3)).setNotBloodPendantInfusable().setNotIncenseInfusable(); - public static Brew allure; - public static Brew soulCross; - public static Brew featherfeet; - public static Brew emptiness; - public static Brew bloodthirst; - public static Brew overload; - public static Brew clear; + public static final Brew allure = make(LibBrewNames.ALLURE, 2000, new EffectInstance(ModPotions.allure, 4800, 0)); + public static final Brew soulCross = make(LibBrewNames.SOUL_CROSS, 10000, new EffectInstance(ModPotions.soulCross, 1800, 0)); + public static final Brew featherfeet = make(LibBrewNames.FEATHER_FEET, 7000, new EffectInstance(ModPotions.featherfeet, 1800, 0)); + public static final Brew emptiness = make(LibBrewNames.EMPTINESS, 30000, new EffectInstance(ModPotions.emptiness, 7200, 0)); + public static final Brew bloodthirst = make(LibBrewNames.BLOODTHIRST, 20000, new EffectInstance(ModPotions.bloodthrst, 7200, 0)); + public static final Brew overload = make(LibBrewNames.OVERLOAD, 0x232323, 12000, new EffectInstance(Effects.STRENGTH, 1800, 3), new EffectInstance(Effects.SPEED, 1800, 2), new EffectInstance(Effects.WEAKNESS, 3600, 1), new EffectInstance(Effects.HUNGER, 200, 2)); + public static final Brew clear = make(LibBrewNames.CLEAR, 4000, new EffectInstance(ModPotions.clear, 0, 0)); public static Brew warpWard; @@ -71,38 +68,14 @@ public class ModBrews { @SubscribeEvent public static void register(RegistryEvent.Register evt) { - fallbackBrew = make("fallback", 0, 0); - speed = make(LibBrewNames.SPEED, 0x59B7FF, 4000, new EffectInstance(Effects.SPEED, 1800, 1)); - strength = make(LibBrewNames.STRENGTH, 0xEE3F3F, 4000, new EffectInstance(Effects.STRENGTH, 1800, 1)); - haste = make(LibBrewNames.HASTE, 0xF4A432, 4000, new EffectInstance(Effects.HASTE, 1800, 1)); - healing = make(LibBrewNames.HEALING, 0xFF5ECC, 6000, new EffectInstance(Effects.INSTANT_HEALTH, 1, 1)); - jumpBoost = make(LibBrewNames.JUMP_BOOST, 0x32F46D, 4000, new EffectInstance(Effects.JUMP_BOOST, 1800, 1)); - regen = make(LibBrewNames.REGEN, 0xFD6488, 7000, new EffectInstance(Effects.REGENERATION, 500, 1)); - regenWeak = make(LibBrewNames.REGEN_WEAK, 0xFD6488, 9000, new EffectInstance(Effects.REGENERATION, 2400, 0)); - resistance = make(LibBrewNames.RESISTANCE, 0xB44E17, 4000, new EffectInstance(Effects.RESISTANCE, 1800, 1)); - fireResistance = make(LibBrewNames.FIRE_RESISTANCE, 0xF86900, 4000, new EffectInstance(Effects.FIRE_RESISTANCE, 9600, 0)); - waterBreathing = make(LibBrewNames.WATER_BREATHING, 0x84A7CF, 4000, new EffectInstance(Effects.WATER_BREATHING, 9600, 0)); - invisibility = make(LibBrewNames.INVISIBILITY, 0xAEAEAE, 8000, new EffectInstance(Effects.INVISIBILITY, 9600, 0)).setNotBloodPendantInfusable(); - nightVision = make(LibBrewNames.NIGHT_VISION, 0x7C4BEB, 4000, new EffectInstance(Effects.NIGHT_VISION, 9600, 0)); - absorption = make(LibBrewNames.ABSORPTION, 0xF2EB23, 7000, new EffectInstance(Effects.ABSORPTION, 1800, 3)).setNotBloodPendantInfusable().setNotIncenseInfusable(); - - overload = make(LibBrewNames.OVERLOAD, 0x232323, 12000, new EffectInstance(Effects.STRENGTH, 1800, 3), new EffectInstance(Effects.SPEED, 1800, 2), new EffectInstance(Effects.WEAKNESS, 3600, 1), new EffectInstance(Effects.HUNGER, 200, 2)); - soulCross = make(LibBrewNames.SOUL_CROSS, 10000, new EffectInstance(ModPotions.soulCross, 1800, 0)); - featherfeet = make(LibBrewNames.FEATHER_FEET, 7000, new EffectInstance(ModPotions.featherfeet, 1800, 0)); - emptiness = make(LibBrewNames.EMPTINESS, 30000, new EffectInstance(ModPotions.emptiness, 7200, 0)); - bloodthirst = make(LibBrewNames.BLOODTHIRST, 20000, new EffectInstance(ModPotions.bloodthrst, 7200, 0)); - allure = make(LibBrewNames.ALLURE, 2000, new EffectInstance(ModPotions.allure, 4800, 0)); - clear = make(LibBrewNames.CLEAR, 4000, new EffectInstance(ModPotions.clear, 0, 0)); evt.getRegistry().registerAll(fallbackBrew, speed, strength, haste, healing, jumpBoost, regen, regenWeak, resistance, fireResistance, waterBreathing, invisibility, nightVision, absorption, overload, soulCross, featherfeet, emptiness, bloodthirst, allure, clear); - Effect warpWardPotion = ForgeRegistries.POTIONS.getValue(new ResourceLocation("thaumcraft:warpward")); - - if (warpWardPotion != null) { + Registry.EFFECTS.getValue(new ResourceLocation("thaumcraft:warpward")).ifPresent(warpWardPotion -> { warpWard = make(LibBrewNames.WARP_WARD, 0xFBBDFF, 25000, new EffectInstance(warpWardPotion, 12000, 0)).setNotBloodPendantInfusable(); evt.getRegistry().register(warpWard); - } + }); } private static Brew make(String name, int cost, EffectInstance... effects) { diff --git a/src/main/java/vazkii/botania/common/crafting/RecipeManaInfusion.java b/src/main/java/vazkii/botania/common/crafting/RecipeManaInfusion.java index e99955d60..0619353e3 100644 --- a/src/main/java/vazkii/botania/common/crafting/RecipeManaInfusion.java +++ b/src/main/java/vazkii/botania/common/crafting/RecipeManaInfusion.java @@ -21,6 +21,7 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.util.JSONUtils; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.Registry; import net.minecraftforge.common.crafting.CraftingHelper; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistryEntry; @@ -122,10 +123,10 @@ public class RecipeManaInfusion implements IManaInfusionRecipe { if (catalystId == null) { throw new IllegalArgumentException("Invalid catalyst ID: " + s); } - if (!ForgeRegistries.BLOCKS.containsKey(catalystId)) { + if (!Registry.BLOCK.containsKey(catalystId)) { throw new IllegalArgumentException("Unknown catalyst: " + s); } - catalystState = ForgeRegistries.BLOCKS.getValue(catalystId).getDefaultState(); + catalystState = Registry.BLOCK.getValue(catalystId).get().getDefaultState(); } else { catalystState = StateIngredientHelper.readBlockState(JSONUtils.getJsonObject(json, "catalyst")); } diff --git a/src/main/java/vazkii/botania/common/item/ItemBlackHoleTalisman.java b/src/main/java/vazkii/botania/common/item/ItemBlackHoleTalisman.java index 86073fde3..5d67c1723 100644 --- a/src/main/java/vazkii/botania/common/item/ItemBlackHoleTalisman.java +++ b/src/main/java/vazkii/botania/common/item/ItemBlackHoleTalisman.java @@ -25,6 +25,7 @@ import net.minecraft.util.Hand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.registry.Registry; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; @@ -266,7 +267,7 @@ public class ItemBlackHoleTalisman extends Item implements IBlockProvider { public static Block getBlock(ItemStack stack) { ResourceLocation id = ResourceLocation.tryCreate(getBlockName(stack)); if (id != null) { - return ForgeRegistries.BLOCKS.getValue(id); + return Registry.BLOCK.getValue(id).orElse(null); } return null; } diff --git a/src/main/java/vazkii/botania/common/item/ItemCacophonium.java b/src/main/java/vazkii/botania/common/item/ItemCacophonium.java index 3d181c04c..aa38eec2c 100644 --- a/src/main/java/vazkii/botania/common/item/ItemCacophonium.java +++ b/src/main/java/vazkii/botania/common/item/ItemCacophonium.java @@ -28,6 +28,7 @@ import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvent; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.registry.Registry; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TranslationTextComponent; @@ -163,7 +164,7 @@ public class ItemCacophonium extends Item { return ModSounds.doit; } else { try { - return ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(ItemNBTHelper.getString(stack, TAG_SOUND, ""))); + return Registry.SOUND_EVENT.getValue(new ResourceLocation(ItemNBTHelper.getString(stack, TAG_SOUND, ""))).orElse(null); } catch (ResourceLocationException ex) { return null; } diff --git a/src/main/java/vazkii/botania/common/item/ItemSpawnerMover.java b/src/main/java/vazkii/botania/common/item/ItemSpawnerMover.java index 22afe0294..641a3caeb 100644 --- a/src/main/java/vazkii/botania/common/item/ItemSpawnerMover.java +++ b/src/main/java/vazkii/botania/common/item/ItemSpawnerMover.java @@ -24,6 +24,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ActionResultType; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.registry.Registry; import net.minecraft.util.text.ITextComponent; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; @@ -74,10 +75,7 @@ public class ItemSpawnerMover extends Item { public void addInformation(ItemStack stack, World world, List infoList, ITooltipFlag flags) { ResourceLocation id = getEntityId(stack); if (id != null) { - EntityType type = ForgeRegistries.ENTITIES.getValue(id); - if (type != null) { - infoList.add(type.getName()); - } + Registry.ENTITY_TYPE.getValue(id).ifPresent(type -> infoList.add(type.getName())); } } diff --git a/src/main/java/vazkii/botania/common/world/ModFeatures.java b/src/main/java/vazkii/botania/common/world/ModFeatures.java index afdaaa95f..2542ebd10 100644 --- a/src/main/java/vazkii/botania/common/world/ModFeatures.java +++ b/src/main/java/vazkii/botania/common/world/ModFeatures.java @@ -10,6 +10,7 @@ package vazkii.botania.common.world; import com.google.common.collect.ImmutableSet; +import net.minecraft.util.registry.Registry; import net.minecraft.world.biome.Biome; import net.minecraft.world.gen.ChunkGeneratorType; import net.minecraft.world.gen.GenerationStage; @@ -57,7 +58,7 @@ public class ModFeatures { } public static void addWorldgen() { - for (Biome biome : ForgeRegistries.BIOMES) { + for (Biome biome : Registry.BIOME) { if (BiomeDictionary.getTypes(biome).stream().noneMatch(TYPE_BLACKLIST::contains)) { biome.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, MYSTICAL_FLOWERS.withConfiguration(new MysticalFlowerConfig()).withPlacement(Placement.NOPE.configure(IPlacementConfig.NO_PLACEMENT_CONFIG))); } diff --git a/src/main/java/vazkii/botania/data/BlockLootProvider.java b/src/main/java/vazkii/botania/data/BlockLootProvider.java index b4a66b6df..1e593795d 100644 --- a/src/main/java/vazkii/botania/data/BlockLootProvider.java +++ b/src/main/java/vazkii/botania/data/BlockLootProvider.java @@ -26,6 +26,7 @@ import net.minecraft.enchantment.Enchantments; import net.minecraft.state.properties.DoubleBlockHalf; import net.minecraft.state.properties.SlabType; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.Registry; import net.minecraft.world.storage.loot.AlternativesLootEntry; import net.minecraft.world.storage.loot.ConstantRange; import net.minecraft.world.storage.loot.ItemLootEntry; @@ -78,7 +79,7 @@ public class BlockLootProvider implements IDataProvider { public BlockLootProvider(DataGenerator generator) { this.generator = generator; - for (Block b : ForgeRegistries.BLOCKS) { + for (Block b : Registry.BLOCK) { if (!LibMisc.MOD_ID.equals(b.getRegistryName().getNamespace())) { continue; } @@ -131,7 +132,7 @@ public class BlockLootProvider implements IDataProvider { public void act(DirectoryCache cache) throws IOException { Map tables = new HashMap<>(); - for (Block b : ForgeRegistries.BLOCKS) { + for (Block b : Registry.BLOCK) { if (!LibMisc.MOD_ID.equals(b.getRegistryName().getNamespace())) { continue; } @@ -183,10 +184,7 @@ public class BlockLootProvider implements IDataProvider { private static LootTable.Builder genMetamorphicStone(Block b) { String cobbleName = b.getRegistryName().getPath().replaceAll("_stone", "_cobblestone"); - Block cobble = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(LibMisc.MOD_ID, cobbleName)); - if (cobble == Blocks.AIR) { - throw new RuntimeException("Couldn't find metamorphic cobble!"); - } + Block cobble = Registry.BLOCK.getValue(new ResourceLocation(LibMisc.MOD_ID, cobbleName)).get(); return genRegular(cobble); } diff --git a/src/main/java/vazkii/botania/data/recipes/BrewProvider.java b/src/main/java/vazkii/botania/data/recipes/BrewProvider.java index 1765d43ff..dbb4b3a45 100644 --- a/src/main/java/vazkii/botania/data/recipes/BrewProvider.java +++ b/src/main/java/vazkii/botania/data/recipes/BrewProvider.java @@ -21,6 +21,7 @@ import net.minecraft.item.crafting.IRecipeSerializer; import net.minecraft.item.crafting.Ingredient; import net.minecraft.tags.ItemTags; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.Registry; import net.minecraftforge.registries.ForgeRegistries; import vazkii.botania.api.brew.Brew; @@ -71,9 +72,9 @@ public class BrewProvider extends RecipeProvider { // todo 1.15 conditional recipe or remove if (Botania.thaumcraftLoaded) { - Item salisMundus = ForgeRegistries.ITEMS.getValue(new ResourceLocation("thaumcraft", "salis_mundus")); - Item bathSalts = ForgeRegistries.ITEMS.getValue(new ResourceLocation("thaumcraft", "bath_salts")); - Item amber = ForgeRegistries.ITEMS.getValue(new ResourceLocation("thaumcraft", "amber")); + Item salisMundus = Registry.ITEM.getValue(new ResourceLocation("thaumcraft", "salis_mundus")).get(); + Item bathSalts = Registry.ITEM.getValue(new ResourceLocation("thaumcraft", "bath_salts")).get(); + Item amber = Registry.ITEM.getValue(new ResourceLocation("thaumcraft", "amber")).get(); consumer.accept(new FinishedRecipe(idFor("warp_ward"), ModBrews.warpWard, Ingredient.fromItems(Items.NETHER_WART), Ingredient.fromItems(salisMundus), Ingredient.fromItems(bathSalts), Ingredient.fromItems(amber))); } diff --git a/src/main/java/vazkii/botania/data/recipes/RecipeProvider.java b/src/main/java/vazkii/botania/data/recipes/RecipeProvider.java index 57073a5e7..764c4c8b9 100644 --- a/src/main/java/vazkii/botania/data/recipes/RecipeProvider.java +++ b/src/main/java/vazkii/botania/data/recipes/RecipeProvider.java @@ -34,6 +34,7 @@ import net.minecraft.tags.ItemTags; import net.minecraft.tags.Tag; import net.minecraft.util.IItemProvider; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.Registry; import net.minecraftforge.common.Tags; import net.minecraftforge.common.crafting.ConditionalAdvancement; import net.minecraftforge.common.crafting.ConditionalRecipe; @@ -60,6 +61,7 @@ import javax.annotation.Nullable; import java.util.Arrays; import java.util.EnumMap; import java.util.List; +import java.util.Optional; import java.util.function.Consumer; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -842,8 +844,8 @@ public class RecipeProvider extends net.minecraft.data.RecipeProvider { .addCriterion("has_item", hasItem(ModTags.Items.PETALS)) .build(consumer); for (String metamorphicVariant : LibBlockNames.METAMORPHIC_VARIANTS) { - Block altar = ForgeRegistries.BLOCKS.getValue(prefix("apothecary_" + metamorphicVariant.replaceAll("_", ""))); - Block cobble = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + metamorphicVariant + "_cobblestone")); + Block altar = Registry.BLOCK.getValue(prefix("apothecary_" + metamorphicVariant.replaceAll("_", ""))).get(); + Block cobble = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + metamorphicVariant + "_cobblestone")).get(); ShapedRecipeBuilder.shapedRecipe(altar) .key('A', ModBlocks.defaultAltar) .key('S', cobble) @@ -1200,7 +1202,7 @@ public class RecipeProvider extends net.minecraft.data.RecipeProvider { if (pattern == CratePattern.NONE) { continue; } - Item item = ForgeRegistries.ITEMS.getValue(prefix(LibItemNames.CRAFT_PATTERN_PREFIX + pattern.getName().split("_", 2)[1])); + Item item = Registry.ITEM.getValue(prefix(LibItemNames.CRAFT_PATTERN_PREFIX + pattern.getName().split("_", 2)[1])).get(); String s = pattern.openSlots.stream().map(bool -> bool ? "R" : "P").collect(Collectors.joining()); ShapedRecipeBuilder.shapedRecipe(item) .key('P', ModItems.placeholder) @@ -2271,7 +2273,9 @@ public class RecipeProvider extends net.minecraft.data.RecipeProvider { List allAzulejos = IntStream.range(0, 16).mapToObj(i -> "azulejo_" + i) .map(ResourceLocationHelper::prefix) - .map(ForgeRegistries.ITEMS::getValue).collect(Collectors.toList()); + .map(Registry.ITEM::getValue) + .map(Optional::get) + .collect(Collectors.toList()); for (int i = 0; i < allAzulejos.size(); i++) { int resultIndex = i + 1 == allAzulejos.size() ? 0 : i + 1; String recipeName = "azulejo_" + resultIndex; @@ -2322,10 +2326,10 @@ public class RecipeProvider extends net.minecraft.data.RecipeProvider { private void registerSimpleArmorSet(Consumer consumer, Ingredient item, String variant, ICriterionInstance criterion) { - Item helmet = ForgeRegistries.ITEMS.getValue(prefix(variant + "_helmet")); - Item chestplate = ForgeRegistries.ITEMS.getValue(prefix(variant + "_chestplate")); - Item leggings = ForgeRegistries.ITEMS.getValue(prefix(variant + "_leggings")); - Item boots = ForgeRegistries.ITEMS.getValue(prefix(variant + "_boots")); + Item helmet = Registry.ITEM.getValue(prefix(variant + "_helmet")).get(); + Item chestplate = Registry.ITEM.getValue(prefix(variant + "_chestplate")).get(); + Item leggings = Registry.ITEM.getValue(prefix(variant + "_leggings")).get(); + Item boots = Registry.ITEM.getValue(prefix(variant + "_boots")).get(); ShapedRecipeBuilder.shapedRecipe(helmet) .key('S', item) .patternLine("SSS") @@ -2428,7 +2432,7 @@ public class RecipeProvider extends net.minecraft.data.RecipeProvider { private void createFloatingFlowerRecipe(Consumer consumer, IItemProvider input) { ResourceLocation inputName = input.asItem().getRegistryName(); - Item output = ForgeRegistries.ITEMS.getValue(new ResourceLocation(inputName.getNamespace(), "floating_" + inputName.getPath())); + Item output = Registry.ITEM.getValue(new ResourceLocation(inputName.getNamespace(), "floating_" + inputName.getPath())).get(); ShapelessRecipeBuilder.shapelessRecipe(output) .addIngredient(ModTags.Items.FLOATING_FLOWERS) .addIngredient(input) @@ -2467,11 +2471,11 @@ public class RecipeProvider extends net.minecraft.data.RecipeProvider { } private void registerForQuartz(Consumer consumer, String variant, IItemProvider baseItem) { - Block base = ForgeRegistries.BLOCKS.getValue(prefix(variant)); - Block slab = ForgeRegistries.BLOCKS.getValue(prefix(variant + LibBlockNames.SLAB_SUFFIX)); - Block stairs = ForgeRegistries.BLOCKS.getValue(prefix(variant + LibBlockNames.STAIR_SUFFIX)); - Block chiseled = ForgeRegistries.BLOCKS.getValue(prefix("chiseled_" + variant)); - Block pillar = ForgeRegistries.BLOCKS.getValue(prefix(variant + "_pillar")); + Block base = Registry.BLOCK.getValue(prefix(variant)).get(); + Block slab = Registry.BLOCK.getValue(prefix(variant + LibBlockNames.SLAB_SUFFIX)).get(); + Block stairs = Registry.BLOCK.getValue(prefix(variant + LibBlockNames.STAIR_SUFFIX)).get(); + Block chiseled = Registry.BLOCK.getValue(prefix("chiseled_" + variant)).get(); + Block pillar = Registry.BLOCK.getValue(prefix(variant + "_pillar")).get(); ShapedRecipeBuilder.shapedRecipe(base) .key('Q', baseItem) @@ -2486,13 +2490,13 @@ public class RecipeProvider extends net.minecraft.data.RecipeProvider { } private void registerForWood(Consumer consumer, String variant) { - Block base = ForgeRegistries.BLOCKS.getValue(prefix(variant)); - Block planks = ForgeRegistries.BLOCKS.getValue(prefix(variant + "_planks")); - Block slab = ForgeRegistries.BLOCKS.getValue(prefix(variant + LibBlockNames.SLAB_SUFFIX)); - Block stairs = ForgeRegistries.BLOCKS.getValue(prefix(variant + LibBlockNames.STAIR_SUFFIX)); - Block wall = ForgeRegistries.BLOCKS.getValue(prefix(variant + LibBlockNames.WALL_SUFFIX)); - Block fence = ForgeRegistries.BLOCKS.getValue(prefix(variant + LibBlockNames.FENCE_SUFFIX)); - Block fenceGate = ForgeRegistries.BLOCKS.getValue(prefix(variant + LibBlockNames.FENCE_GATE_SUFFIX)); + Block base = Registry.BLOCK.getValue(prefix(variant)).get(); + Block planks = Registry.BLOCK.getValue(prefix(variant + "_planks")).get(); + Block slab = Registry.BLOCK.getValue(prefix(variant + LibBlockNames.SLAB_SUFFIX)).get(); + Block stairs = Registry.BLOCK.getValue(prefix(variant + LibBlockNames.STAIR_SUFFIX)).get(); + Block wall = Registry.BLOCK.getValue(prefix(variant + LibBlockNames.WALL_SUFFIX)).get(); + Block fence = Registry.BLOCK.getValue(prefix(variant + LibBlockNames.FENCE_SUFFIX)).get(); + Block fenceGate = Registry.BLOCK.getValue(prefix(variant + LibBlockNames.FENCE_GATE_SUFFIX)).get(); ShapelessRecipeBuilder.shapelessRecipe(planks, 4).addIngredient(base) .addCriterion("has_item", hasItem(base)).build(consumer); @@ -2505,9 +2509,9 @@ public class RecipeProvider extends net.minecraft.data.RecipeProvider { private void registerForPavement(Consumer consumer, String color, @Nullable Item mainInput) { String baseName = color + LibBlockNames.PAVEMENT_SUFFIX; - Block base = ForgeRegistries.BLOCKS.getValue(prefix(baseName)); - Block stair = ForgeRegistries.BLOCKS.getValue(prefix(baseName + LibBlockNames.STAIR_SUFFIX)); - Block slab = ForgeRegistries.BLOCKS.getValue(prefix(baseName + LibBlockNames.SLAB_SUFFIX)); + Block base = Registry.BLOCK.getValue(prefix(baseName)).get(); + Block stair = Registry.BLOCK.getValue(prefix(baseName + LibBlockNames.STAIR_SUFFIX)).get(); + Block slab = Registry.BLOCK.getValue(prefix(baseName + LibBlockNames.SLAB_SUFFIX)).get(); ShapelessRecipeBuilder builder = ShapelessRecipeBuilder.shapelessRecipe(base, 3) .addIngredient(ModTags.Items.LIVINGROCK) @@ -2525,17 +2529,17 @@ public class RecipeProvider extends net.minecraft.data.RecipeProvider { } private void registerForMetamorphic(Consumer consumer, String variant) { - Block base = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_stone")); - Block slab = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_stone" + LibBlockNames.SLAB_SUFFIX)); - Block stair = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_stone" + LibBlockNames.STAIR_SUFFIX)); - Block brick = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_bricks")); - Block brickSlab = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_bricks" + LibBlockNames.SLAB_SUFFIX)); - Block brickStair = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_bricks" + LibBlockNames.STAIR_SUFFIX)); - Block chiseledBrick = ForgeRegistries.BLOCKS.getValue(prefix("chiseled_" + LibBlockNames.METAMORPHIC_PREFIX + variant + "_bricks")); - Block cobble = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_cobblestone")); - Block cobbleSlab = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_cobblestone" + LibBlockNames.SLAB_SUFFIX)); - Block cobbleStair = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_cobblestone" + LibBlockNames.STAIR_SUFFIX)); - Block cobbleWall = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_cobblestone" + LibBlockNames.WALL_SUFFIX)); + Block base = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_stone")).get(); + Block slab = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_stone" + LibBlockNames.SLAB_SUFFIX)).get(); + Block stair = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_stone" + LibBlockNames.STAIR_SUFFIX)).get(); + Block brick = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_bricks")).get(); + Block brickSlab = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_bricks" + LibBlockNames.SLAB_SUFFIX)).get(); + Block brickStair = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_bricks" + LibBlockNames.STAIR_SUFFIX)).get(); + Block chiseledBrick = Registry.BLOCK.getValue(prefix("chiseled_" + LibBlockNames.METAMORPHIC_PREFIX + variant + "_bricks")).get(); + Block cobble = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_cobblestone")).get(); + Block cobbleSlab = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_cobblestone" + LibBlockNames.SLAB_SUFFIX)).get(); + Block cobbleStair = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_cobblestone" + LibBlockNames.STAIR_SUFFIX)).get(); + Block cobbleWall = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_cobblestone" + LibBlockNames.WALL_SUFFIX)).get(); InventoryChangeTrigger.Instance marimorphosis = hasItem(ModSubtiles.marimorphosis); slabShape(slab, base).setGroup("botania:metamorphic_stone_slab") diff --git a/src/main/java/vazkii/botania/data/recipes/StonecuttingProvider.java b/src/main/java/vazkii/botania/data/recipes/StonecuttingProvider.java index 071172789..9905671f8 100644 --- a/src/main/java/vazkii/botania/data/recipes/StonecuttingProvider.java +++ b/src/main/java/vazkii/botania/data/recipes/StonecuttingProvider.java @@ -20,6 +20,7 @@ import net.minecraft.item.crafting.IRecipeSerializer; import net.minecraft.item.crafting.Ingredient; import net.minecraft.util.IItemProvider; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.Registry; import net.minecraftforge.registries.ForgeRegistries; import vazkii.botania.common.block.ModBlocks; @@ -31,6 +32,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.List; +import java.util.Optional; import java.util.function.Consumer; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -71,18 +73,20 @@ public class StonecuttingProvider extends RecipeProvider { List allAzulejos = IntStream.range(0, 16).mapToObj(i -> "azulejo_" + i) .map(ResourceLocationHelper::prefix) - .map(ForgeRegistries.ITEMS::getValue).collect(Collectors.toList()); + .map(Registry.ITEM::getValue) + .map(Optional::get) + .collect(Collectors.toList()); for (Item azulejo : allAzulejos) { consumer.accept(azulejoStonecutting(allAzulejos, azulejo)); } } private static void registerForQuartz(String variant, Consumer consumer) { - Block base = ForgeRegistries.BLOCKS.getValue(prefix(variant)); - Block slab = ForgeRegistries.BLOCKS.getValue(prefix(variant + LibBlockNames.SLAB_SUFFIX)); - Block stairs = ForgeRegistries.BLOCKS.getValue(prefix(variant + LibBlockNames.STAIR_SUFFIX)); - Block chiseled = ForgeRegistries.BLOCKS.getValue(prefix("chiseled_" + variant)); - Block pillar = ForgeRegistries.BLOCKS.getValue(prefix(variant + "_pillar")); + Block base = Registry.BLOCK.getValue(prefix(variant)).get(); + Block slab = Registry.BLOCK.getValue(prefix(variant + LibBlockNames.SLAB_SUFFIX)).get(); + Block stairs = Registry.BLOCK.getValue(prefix(variant + LibBlockNames.STAIR_SUFFIX)).get(); + Block chiseled = Registry.BLOCK.getValue(prefix("chiseled_" + variant)).get(); + Block pillar = Registry.BLOCK.getValue(prefix(variant + "_pillar")).get(); consumer.accept(stonecutting(base, slab, 2)); consumer.accept(stonecutting(base, stairs)); consumer.accept(stonecutting(base, chiseled)); @@ -90,25 +94,25 @@ public class StonecuttingProvider extends RecipeProvider { } private static void registerForPavement(String color, Consumer consumer) { - Block base = ForgeRegistries.BLOCKS.getValue(prefix(color + LibBlockNames.PAVEMENT_SUFFIX)); - Block slab = ForgeRegistries.BLOCKS.getValue(prefix(color + LibBlockNames.PAVEMENT_SUFFIX + LibBlockNames.SLAB_SUFFIX)); - Block stair = ForgeRegistries.BLOCKS.getValue(prefix(color + LibBlockNames.PAVEMENT_SUFFIX + LibBlockNames.STAIR_SUFFIX)); + Block base = Registry.BLOCK.getValue(prefix(color + LibBlockNames.PAVEMENT_SUFFIX)).get(); + Block slab = Registry.BLOCK.getValue(prefix(color + LibBlockNames.PAVEMENT_SUFFIX + LibBlockNames.SLAB_SUFFIX)).get(); + Block stair = Registry.BLOCK.getValue(prefix(color + LibBlockNames.PAVEMENT_SUFFIX + LibBlockNames.STAIR_SUFFIX)).get(); consumer.accept(stonecutting(base, slab, 2)); consumer.accept(stonecutting(base, stair)); } private static void registerForMetamorphic(String variant, Consumer consumer) { - Block base = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_stone")); - Block slab = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_stone" + LibBlockNames.SLAB_SUFFIX)); - Block stair = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_stone" + LibBlockNames.STAIR_SUFFIX)); - Block brick = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_bricks")); - Block brickSlab = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_bricks" + LibBlockNames.SLAB_SUFFIX)); - Block brickStair = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_bricks" + LibBlockNames.STAIR_SUFFIX)); - Block chiseledBrick = ForgeRegistries.BLOCKS.getValue(prefix("chiseled_" + LibBlockNames.METAMORPHIC_PREFIX + variant + "_bricks")); - Block cobble = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_cobblestone")); - Block cobbleSlab = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_cobblestone" + LibBlockNames.SLAB_SUFFIX)); - Block cobbleStair = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_cobblestone" + LibBlockNames.STAIR_SUFFIX)); - Block cobbleWall = ForgeRegistries.BLOCKS.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_cobblestone" + LibBlockNames.WALL_SUFFIX)); + Block base = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_stone")).get(); + Block slab = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_stone" + LibBlockNames.SLAB_SUFFIX)).get(); + Block stair = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_stone" + LibBlockNames.STAIR_SUFFIX)).get(); + Block brick = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_bricks")).get(); + Block brickSlab = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_bricks" + LibBlockNames.SLAB_SUFFIX)).get(); + Block brickStair = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_bricks" + LibBlockNames.STAIR_SUFFIX)).get(); + Block chiseledBrick = Registry.BLOCK.getValue(prefix("chiseled_" + LibBlockNames.METAMORPHIC_PREFIX + variant + "_bricks")).get(); + Block cobble = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_cobblestone")).get(); + Block cobbleSlab = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_cobblestone" + LibBlockNames.SLAB_SUFFIX)).get(); + Block cobbleStair = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_cobblestone" + LibBlockNames.STAIR_SUFFIX)).get(); + Block cobbleWall = Registry.BLOCK.getValue(prefix(LibBlockNames.METAMORPHIC_PREFIX + variant + "_cobblestone" + LibBlockNames.WALL_SUFFIX)).get(); consumer.accept(stonecutting(base, slab, 2)); consumer.accept(stonecutting(base, stair));