diff --git a/src/main/java/vazkii/quark/addons/oddities/block/be/MatrixEnchantingTableBlockEntity.java b/src/main/java/vazkii/quark/addons/oddities/block/be/MatrixEnchantingTableBlockEntity.java index 18b356afc7..c9c63691e1 100644 --- a/src/main/java/vazkii/quark/addons/oddities/block/be/MatrixEnchantingTableBlockEntity.java +++ b/src/main/java/vazkii/quark/addons/oddities/block/be/MatrixEnchantingTableBlockEntity.java @@ -13,6 +13,7 @@ import com.google.common.collect.Lists; import net.minecraft.core.BlockPos; +import net.minecraft.core.Registry; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; @@ -39,7 +40,6 @@ import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.zeta.util.ItemNBTHelper; import vazkii.quark.addons.oddities.inventory.EnchantmentMatrix; import vazkii.quark.addons.oddities.inventory.EnchantmentMatrix.Piece; @@ -294,9 +294,9 @@ private float getEnchantPowerAt(Level world, BlockPos pos) { if(influencer != null) { int count = influencer.getInfluenceStack(world, pos, state); - List influencedEnchants = ForgeRegistries.ENCHANTMENTS.getValues().stream() + List influencedEnchants = Registry.ENCHANTMENT.stream() .filter((it) -> influencer.influencesEnchantment(world, pos, state, it)).toList(); - List dampenedEnchants = ForgeRegistries.ENCHANTMENTS.getValues().stream() + List dampenedEnchants = Registry.ENCHANTMENT.stream() .filter((it) -> influencer.dampensEnchantment(world, pos, state, it)).toList(); if(!influencedEnchants.isEmpty() || !dampenedEnchants.isEmpty()) { for(Enchantment e : influencedEnchants) { diff --git a/src/main/java/vazkii/quark/addons/oddities/inventory/EnchantmentMatrix.java b/src/main/java/vazkii/quark/addons/oddities/inventory/EnchantmentMatrix.java index c368ba33f6..c0700f0c38 100644 --- a/src/main/java/vazkii/quark/addons/oddities/inventory/EnchantmentMatrix.java +++ b/src/main/java/vazkii/quark/addons/oddities/inventory/EnchantmentMatrix.java @@ -13,7 +13,6 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentInstance; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.addons.oddities.module.MatrixEnchantingModule; import vazkii.quark.content.experimental.module.EnchantmentsBegoneModule; @@ -144,8 +143,8 @@ private EnchantmentDataWrapper generateRandomEnchantment(Map marked = pieces.values().stream().filter(p -> p.marked).collect(Collectors.toList()); List validEnchants = new ArrayList<>(); - ForgeRegistries.ENCHANTMENTS.forEach(enchantment -> { - String id = ForgeRegistries.ENCHANTMENTS.getKey(enchantment).toString(); + Registry.ENCHANTMENT.forEach(enchantment -> { + String id = Registry.ENCHANTMENT.getKey(enchantment).toString(); boolean isValid = true; if(enchantment.isTreasureOnly()){ isValid = MatrixEnchantingModule.allowTreasures || @@ -472,7 +471,7 @@ public void writeToNBT(CompoundTag cmp) { public void readFromNBT(CompoundTag cmp) { color = cmp.getInt(TAG_COLOR); type = cmp.getInt(TAG_TYPE); - enchant = ForgeRegistries.ENCHANTMENTS.getValue(new ResourceLocation(cmp.getString(TAG_ENCHANTMENT))); + enchant = Registry.ENCHANTMENT.get(new ResourceLocation(cmp.getString(TAG_ENCHANTMENT))); level = cmp.getInt(TAG_LEVEL); x = cmp.getInt(TAG_X); y = cmp.getInt(TAG_Y); diff --git a/src/main/java/vazkii/quark/addons/oddities/module/MatrixEnchantingModule.java b/src/main/java/vazkii/quark/addons/oddities/module/MatrixEnchantingModule.java index 9f45c029bf..13cc7b1751 100644 --- a/src/main/java/vazkii/quark/addons/oddities/module/MatrixEnchantingModule.java +++ b/src/main/java/vazkii/quark/addons/oddities/module/MatrixEnchantingModule.java @@ -25,7 +25,6 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.level.BlockEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.zeta.event.ZConfigChanged; import vazkii.zeta.event.ZGatherHints; import vazkii.zeta.event.ZRegister; @@ -232,7 +231,7 @@ private Influence parseEnchantmentList(String enchantmentList) { if (damp) enchStr = enchStr.substring(1); - Enchantment ench = ForgeRegistries.ENCHANTMENTS.getValue(new ResourceLocation(enchStr)); + Enchantment ench = Registry.ENCHANTMENT.get(new ResourceLocation(enchStr)); if (ench != null) { if (damp) dampen.add(ench); diff --git a/src/main/java/vazkii/quark/base/handler/FuelHandler.java b/src/main/java/vazkii/quark/base/handler/FuelHandler.java index 77b94f05db..d490b18082 100644 --- a/src/main/java/vazkii/quark/base/handler/FuelHandler.java +++ b/src/main/java/vazkii/quark/base/handler/FuelHandler.java @@ -12,7 +12,6 @@ import net.minecraft.world.level.material.Material; import net.minecraftforge.event.furnace.FurnaceFuelBurnTimeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.base.Quark; import vazkii.quark.content.building.block.VerticalSlabBlock; import vazkii.zeta.event.ZLoadComplete; @@ -42,7 +41,7 @@ public static void addWood(Block block) { @LoadEvent public static void addAllWoods(ZLoadComplete event) { - for(Block block : ForgeRegistries.BLOCKS) { + for(Block block : Registry.BLOCK) { ResourceLocation regname = Quark.ZETA.registry.getRegistryName(block, Registry.BLOCK); if(block != null && regname.getNamespace().equals(Quark.MOD_ID) && block.defaultBlockState().getMaterial() == Material.WOOD) addWood(block); diff --git a/src/main/java/vazkii/quark/base/handler/MiscUtil.java b/src/main/java/vazkii/quark/base/handler/MiscUtil.java index dca3c22738..23e566c5ca 100644 --- a/src/main/java/vazkii/quark/base/handler/MiscUtil.java +++ b/src/main/java/vazkii/quark/base/handler/MiscUtil.java @@ -55,7 +55,6 @@ import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.wrapper.InvWrapper; import net.minecraftforge.items.wrapper.SidedInvWrapper; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.base.Quark; import vazkii.zeta.client.config.screen.ZetaScreen; import vazkii.quark.content.experimental.module.EnchantmentsBegoneModule; @@ -155,7 +154,7 @@ public static void damageStack(Player player, InteractionHand hand, ItemStack st public static void initializeEnchantmentList(Iterable enchantNames, List enchants) { enchants.clear(); for(String s : enchantNames) { - Enchantment enchant = ForgeRegistries.ENCHANTMENTS.getValue(new ResourceLocation(s)); + Enchantment enchant = Registry.ENCHANTMENT.get(new ResourceLocation(s)); if (enchant != null && !EnchantmentsBegoneModule.shouldBegone(enchant)) enchants.add(enchant); } diff --git a/src/main/java/vazkii/quark/base/handler/RecipeCrawlHandler.java b/src/main/java/vazkii/quark/base/handler/RecipeCrawlHandler.java index 922821ebd1..b3a7a587b5 100644 --- a/src/main/java/vazkii/quark/base/handler/RecipeCrawlHandler.java +++ b/src/main/java/vazkii/quark/base/handler/RecipeCrawlHandler.java @@ -11,7 +11,6 @@ import net.minecraftforge.event.TagsUpdatedEvent; import net.minecraftforge.event.TickEvent.ServerTickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.api.event.RecipeCrawlEvent; import vazkii.quark.api.event.RecipeCrawlEvent.Visit; import vazkii.quark.base.Quark; diff --git a/src/main/java/vazkii/quark/base/handler/SortingHandler.java b/src/main/java/vazkii/quark/base/handler/SortingHandler.java index 58012e0d0e..76dc27b5f4 100644 --- a/src/main/java/vazkii/quark/base/handler/SortingHandler.java +++ b/src/main/java/vazkii/quark/base/handler/SortingHandler.java @@ -20,7 +20,6 @@ import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.SlotItemHandler; import net.minecraftforge.items.wrapper.InvWrapper; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.addons.oddities.inventory.BackpackMenu; import vazkii.quark.addons.oddities.inventory.slot.CachedItemHandlerSlot; import vazkii.quark.api.ICustomSorting; @@ -342,8 +341,8 @@ else if (o instanceof Block block) else if (o instanceof ItemStack stack) itemList.add(stack.getItem()); else if (o instanceof String s) { - Item item = ForgeRegistries.ITEMS.getValue(new ResourceLocation(s)); - if (item != null) + Item item = Registry.ITEM.get(new ResourceLocation(s)); + if (item != Items.AIR) itemList.add(item); } } diff --git a/src/main/java/vazkii/quark/base/handler/advancement/mod/ASeedyPlaceModifier.java b/src/main/java/vazkii/quark/base/handler/advancement/mod/ASeedyPlaceModifier.java index 0db8133b7f..f99db6e30d 100644 --- a/src/main/java/vazkii/quark/base/handler/advancement/mod/ASeedyPlaceModifier.java +++ b/src/main/java/vazkii/quark/base/handler/advancement/mod/ASeedyPlaceModifier.java @@ -3,9 +3,9 @@ import com.google.common.collect.ImmutableSet; import net.minecraft.advancements.Criterion; import net.minecraft.advancements.critereon.PlacedBlockTrigger; +import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.api.IMutableAdvancement; import vazkii.quark.base.handler.advancement.AdvancementModifier; import vazkii.zeta.module.ZetaModule; @@ -34,7 +34,7 @@ public boolean apply(ResourceLocation res, IMutableAdvancement adv) { for(var block : seeds) { Criterion criterion = new Criterion(PlacedBlockTrigger.TriggerInstance.placedBlock(block)); - String name = ForgeRegistries.BLOCKS.getKey(block).toString(); + String name = Registry.BLOCK.getKey(block).toString(); adv.addOrCriterion(name, criterion); } diff --git a/src/main/java/vazkii/quark/base/handler/advancement/mod/BalancedDietModifier.java b/src/main/java/vazkii/quark/base/handler/advancement/mod/BalancedDietModifier.java index cc13556bd7..b83f542d8e 100644 --- a/src/main/java/vazkii/quark/base/handler/advancement/mod/BalancedDietModifier.java +++ b/src/main/java/vazkii/quark/base/handler/advancement/mod/BalancedDietModifier.java @@ -5,9 +5,9 @@ import net.minecraft.advancements.Criterion; import net.minecraft.advancements.critereon.ConsumeItemTrigger; import net.minecraft.advancements.critereon.ItemPredicate; +import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.ItemLike; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.api.IMutableAdvancement; import vazkii.quark.base.handler.advancement.AdvancementModifier; import vazkii.zeta.module.ZetaModule; @@ -39,7 +39,7 @@ public boolean apply(ResourceLocation res, IMutableAdvancement adv) { Criterion criterion = new Criterion(ConsumeItemTrigger.TriggerInstance.usedItem( ItemPredicate.Builder.item().of(array).build())); - String name = ForgeRegistries.ITEMS.getKey(array[0].asItem()).toString(); + String name = Registry.ITEM.getKey(array[0].asItem()).toString(); adv.addRequiredCriterion(name, criterion); diff --git a/src/main/java/vazkii/quark/base/handler/advancement/mod/FishyBusinessModifier.java b/src/main/java/vazkii/quark/base/handler/advancement/mod/FishyBusinessModifier.java index 6ad350a7ee..e6e62487c3 100644 --- a/src/main/java/vazkii/quark/base/handler/advancement/mod/FishyBusinessModifier.java +++ b/src/main/java/vazkii/quark/base/handler/advancement/mod/FishyBusinessModifier.java @@ -6,9 +6,9 @@ import net.minecraft.advancements.critereon.EntityPredicate; import net.minecraft.advancements.critereon.FishingRodHookedTrigger; import net.minecraft.advancements.critereon.ItemPredicate; +import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.ItemLike; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.api.IMutableAdvancement; import vazkii.quark.base.handler.advancement.AdvancementModifier; import vazkii.zeta.module.ZetaModule; @@ -42,7 +42,7 @@ public boolean apply(ResourceLocation res, IMutableAdvancement adv) { EntityPredicate.ANY, ItemPredicate.Builder.item().of(array).build())); - String name = ForgeRegistries.ITEMS.getKey(array[0].asItem()).toString(); + String name = Registry.ITEM.getKey(array[0].asItem()).toString(); adv.addOrCriterion(name, criterion); return true; diff --git a/src/main/java/vazkii/quark/base/handler/advancement/mod/GlowAndBeholdModifier.java b/src/main/java/vazkii/quark/base/handler/advancement/mod/GlowAndBeholdModifier.java index e167657ffc..6db4570db2 100644 --- a/src/main/java/vazkii/quark/base/handler/advancement/mod/GlowAndBeholdModifier.java +++ b/src/main/java/vazkii/quark/base/handler/advancement/mod/GlowAndBeholdModifier.java @@ -7,10 +7,10 @@ import net.minecraft.advancements.critereon.ItemInteractWithBlockTrigger; import net.minecraft.advancements.critereon.ItemPredicate; import net.minecraft.advancements.critereon.LocationPredicate; +import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Block; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.api.IMutableAdvancement; import vazkii.quark.base.handler.advancement.AdvancementModifier; import vazkii.zeta.module.ZetaModule; @@ -45,7 +45,7 @@ public boolean apply(ResourceLocation res, IMutableAdvancement adv) { .of(array).build()), ItemPredicate.Builder.item().of(Items.GLOW_INK_SAC))); - String name = ForgeRegistries.BLOCKS.getKey(array[0]).toString(); + String name = Registry.BLOCK.getKey(array[0]).toString(); adv.addOrCriterion(name, criterion); return true; diff --git a/src/main/java/vazkii/quark/base/handler/advancement/mod/MonsterHunterModifier.java b/src/main/java/vazkii/quark/base/handler/advancement/mod/MonsterHunterModifier.java index 42e057734c..8a63410e2d 100644 --- a/src/main/java/vazkii/quark/base/handler/advancement/mod/MonsterHunterModifier.java +++ b/src/main/java/vazkii/quark/base/handler/advancement/mod/MonsterHunterModifier.java @@ -8,9 +8,9 @@ import net.minecraft.advancements.critereon.EntityPredicate; import net.minecraft.advancements.critereon.EntityTypePredicate; import net.minecraft.advancements.critereon.KilledTrigger; +import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.api.IMutableAdvancement; import vazkii.quark.base.handler.advancement.AdvancementModifier; import vazkii.zeta.module.ZetaModule; @@ -40,7 +40,7 @@ public boolean apply(ResourceLocation res, IMutableAdvancement adv) { for(EntityType type : entityTypes) { Criterion criterion = new Criterion(KilledTrigger.TriggerInstance.playerKilledEntity(EntityPredicate.Builder.entity().entityType(EntityTypePredicate.of(type)))); - String name = ForgeRegistries.ENTITY_TYPES.getKey(type).toString(); + String name = Registry.ENTITY_TYPE.getKey(type).toString(); if(all) adv.addRequiredCriterion(name, criterion); else adv.addOrCriterion(name, criterion); diff --git a/src/main/java/vazkii/quark/base/handler/advancement/mod/TacticalFishingModifier.java b/src/main/java/vazkii/quark/base/handler/advancement/mod/TacticalFishingModifier.java index ec8f4685f5..0f469196c3 100644 --- a/src/main/java/vazkii/quark/base/handler/advancement/mod/TacticalFishingModifier.java +++ b/src/main/java/vazkii/quark/base/handler/advancement/mod/TacticalFishingModifier.java @@ -5,10 +5,10 @@ import net.minecraft.advancements.Criterion; import net.minecraft.advancements.critereon.FilledBucketTrigger; import net.minecraft.advancements.critereon.ItemPredicate; +import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.BucketItem; import net.minecraft.world.level.ItemLike; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.api.IMutableAdvancement; import vazkii.quark.base.handler.advancement.AdvancementModifier; import vazkii.zeta.module.ZetaModule; @@ -40,7 +40,7 @@ public boolean apply(ResourceLocation res, IMutableAdvancement adv) { TriggerInstance.filledBucket(ItemPredicate.Builder.item() .of(array).build())); - String name = ForgeRegistries.ITEMS.getKey(array[0].asItem()).toString(); + String name = Registry.ITEM.getKey(array[0].asItem()).toString(); adv.addOrCriterion(name, criterion); return true; diff --git a/src/main/java/vazkii/quark/base/handler/advancement/mod/TwoByTwoModifier.java b/src/main/java/vazkii/quark/base/handler/advancement/mod/TwoByTwoModifier.java index 87c8306846..6a98125712 100644 --- a/src/main/java/vazkii/quark/base/handler/advancement/mod/TwoByTwoModifier.java +++ b/src/main/java/vazkii/quark/base/handler/advancement/mod/TwoByTwoModifier.java @@ -9,9 +9,9 @@ import net.minecraft.advancements.critereon.BredAnimalsTrigger; import net.minecraft.advancements.critereon.EntityPredicate; import net.minecraft.advancements.critereon.EntityTypePredicate; +import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.api.IMutableAdvancement; import vazkii.quark.base.handler.advancement.AdvancementModifier; import vazkii.zeta.module.ZetaModule; @@ -41,7 +41,7 @@ public boolean apply(ResourceLocation res, IMutableAdvancement adv) { Criterion criterion = new Criterion(BredAnimalsTrigger.TriggerInstance .bredAnimals(EntityPredicate.Builder.entity().entityType(EntityTypePredicate.of(type)))); - String name = ForgeRegistries.ENTITY_TYPES.getKey(type).toString(); + String name = Registry.ENTITY_TYPE.getKey(type).toString(); adv.addRequiredCriterion(name, criterion); } diff --git a/src/main/java/vazkii/quark/base/proxy/CommonProxy.java b/src/main/java/vazkii/quark/base/proxy/CommonProxy.java index bc347b2274..1b2731b217 100644 --- a/src/main/java/vazkii/quark/base/proxy/CommonProxy.java +++ b/src/main/java/vazkii/quark/base/proxy/CommonProxy.java @@ -1,5 +1,6 @@ package vazkii.quark.base.proxy; +import net.minecraft.core.Registry; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; @@ -11,7 +12,6 @@ import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.event.config.ModConfigEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.base.Quark; import vazkii.quark.base.capability.CapabilityHandler; import vazkii.quark.base.handler.*; @@ -24,6 +24,7 @@ import vazkii.quark.base.module.LegacyQuarkModuleFinder; import vazkii.zeta.event.ZCommonSetup; import vazkii.zeta.event.ZConfigChanged; +import vazkii.zeta.event.ZRegister; import vazkii.zeta.event.bus.LoadEvent; import vazkii.zeta.module.ZetaCategory; import vazkii.zetaimplforge.module.ModFileScanDataModuleFinder; @@ -39,8 +40,6 @@ public class CommonProxy { private boolean configGuiSaving = false; public void start() { - ForgeRegistries.RECIPE_SERIALIZERS.register(Quark.MOD_ID + ":exclusion", ExclusionRecipe.SERIALIZER); - Quark.ZETA.loadBus .subscribe(ContributorRewardHandler.class) .subscribe(CreativeTabHandler.class) @@ -95,6 +94,12 @@ public void setup(ZCommonSetup event) { handleQuarkConfigChange(); } + //TODO find a better place for this little one-off thing, lol + @LoadEvent + public void recipe(ZRegister event) { + event.getRegistry().register(ExclusionRecipe.SERIALIZER, "exclusion", Registry.RECIPE_SERIALIZER_REGISTRY); + } + //forge event public void configChanged(ModConfigEvent event) { if(event.getConfig().getModId().equals(Quark.MOD_ID) diff --git a/src/main/java/vazkii/quark/base/recipe/ExclusionRecipe.java b/src/main/java/vazkii/quark/base/recipe/ExclusionRecipe.java index 2eb7d34630..d5a8256806 100644 --- a/src/main/java/vazkii/quark/base/recipe/ExclusionRecipe.java +++ b/src/main/java/vazkii/quark/base/recipe/ExclusionRecipe.java @@ -26,7 +26,6 @@ import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.Level; import net.minecraftforge.common.crafting.IShapedRecipe; -import net.minecraftforge.registries.ForgeRegistries; /** * @author WireSegal @@ -160,7 +159,7 @@ public ExclusionRecipe fromJson(@Nonnull ResourceLocation recipeId, @Nonnull Jso excludedRecipes.add(loc); } - RecipeSerializer serializer = ForgeRegistries.RECIPE_SERIALIZERS.getValue(new ResourceLocation(trueType)); + RecipeSerializer serializer = Registry.RECIPE_SERIALIZER.get(new ResourceLocation(trueType)); if (serializer == null) throw new JsonSyntaxException("Invalid or unsupported recipe type '" + trueType + "'"); Recipe parent = serializer.fromJson(recipeId, json); @@ -184,7 +183,7 @@ public ExclusionRecipe fromNetwork(@Nonnull ResourceLocation recipeId, @Nonnull } String trueType = buffer.readUtf(32767); - RecipeSerializer serializer = ForgeRegistries.RECIPE_SERIALIZERS.getValue(new ResourceLocation(trueType)); + RecipeSerializer serializer = Registry.RECIPE_SERIALIZER.get(new ResourceLocation(trueType)); if (serializer == null) throw new IllegalArgumentException("Invalid or unsupported recipe type '" + trueType + "'"); Recipe parent = serializer.fromNetwork(recipeId, buffer); diff --git a/src/main/java/vazkii/quark/base/world/WorldGenHandler.java b/src/main/java/vazkii/quark/base/world/WorldGenHandler.java index ddf37b7ec1..b375fb7789 100644 --- a/src/main/java/vazkii/quark/base/world/WorldGenHandler.java +++ b/src/main/java/vazkii/quark/base/world/WorldGenHandler.java @@ -154,7 +154,7 @@ public void modify(Holder biome, Phase phase, Builder builder) { @Override public Codec codec() { - return (Codec) SERIALIZER.get(); + return SERIALIZER.get(); } public static Codec makeCodec() { diff --git a/src/main/java/vazkii/quark/content/automation/client/render/QuarkPistonBlockEntityRenderer.java b/src/main/java/vazkii/quark/content/automation/client/render/QuarkPistonBlockEntityRenderer.java index eef6b80204..57f1934cd0 100644 --- a/src/main/java/vazkii/quark/content/automation/client/render/QuarkPistonBlockEntityRenderer.java +++ b/src/main/java/vazkii/quark/content/automation/client/render/QuarkPistonBlockEntityRenderer.java @@ -17,11 +17,9 @@ import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.piston.PistonMovingBlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.base.Quark; import vazkii.quark.content.automation.module.PistonsMoveTileEntitiesModule; @@ -37,7 +35,7 @@ public static boolean renderPistonBlock(PistonMovingBlockEntity piston, float pa BlockEntity tile = eb.newBlockEntity(truePos, state); if (tile == null) return false; CompoundTag tileTag = PistonsMoveTileEntitiesModule.getMovingBlockEntityData(piston.getLevel(), truePos); - if (tileTag != null && tile.getType() == ForgeRegistries.BLOCK_ENTITY_TYPES.getValue(new ResourceLocation(tileTag.getString("id")))) + if (tileTag != null && tile.getType() == Registry.BLOCK_ENTITY_TYPE.get(new ResourceLocation(tileTag.getString("id")))) tile.load(tileTag); Vec3 offset = new Vec3(piston.getXOff(partialTicks), piston.getYOff(partialTicks), piston.getZOff(partialTicks)); return renderTESafely(piston.getLevel(), truePos, state, tile, piston, partialTicks, offset, matrix, bufferIn, combinedLightIn, combinedOverlayIn); diff --git a/src/main/java/vazkii/quark/content/automation/module/DispensersPlaceBlocksModule.java b/src/main/java/vazkii/quark/content/automation/module/DispensersPlaceBlocksModule.java index 1997473ae3..0f200e9d4a 100644 --- a/src/main/java/vazkii/quark/content/automation/module/DispensersPlaceBlocksModule.java +++ b/src/main/java/vazkii/quark/content/automation/module/DispensersPlaceBlocksModule.java @@ -19,7 +19,6 @@ import net.minecraft.world.level.block.DispenserBlock; import net.minecraft.world.level.block.SlabBlock; import net.minecraft.world.level.block.StairBlock; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.base.module.LoadModule; import vazkii.zeta.module.ZetaModule; import vazkii.quark.base.module.config.Config; @@ -53,7 +52,7 @@ public void setup(ZCommonSetup e) { e.enqueueWork(() -> { Map registry = DispenserBlock.DISPENSER_REGISTRY; - for(Block b : ForgeRegistries.BLOCKS) { + for(Block b : Registry.BLOCK) { ResourceLocation res = Registry.BLOCK.getKey(b); if(!blacklist.contains(Objects.toString(res))) { Item item = b.asItem(); diff --git a/src/main/java/vazkii/quark/content/automation/module/JukeboxAutomationModule.java b/src/main/java/vazkii/quark/content/automation/module/JukeboxAutomationModule.java index d8a6650163..77e7b4bc0b 100644 --- a/src/main/java/vazkii/quark/content/automation/module/JukeboxAutomationModule.java +++ b/src/main/java/vazkii/quark/content/automation/module/JukeboxAutomationModule.java @@ -3,6 +3,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.BlockSource; import net.minecraft.core.Direction; +import net.minecraft.core.Registry; import net.minecraft.core.dispenser.OptionalDispenseItemBehavior; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; @@ -24,7 +25,6 @@ import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.items.IItemHandler; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.base.Quark; import vazkii.quark.base.module.LoadModule; import vazkii.zeta.module.ZetaModule; @@ -44,7 +44,7 @@ public class JukeboxAutomationModule extends ZetaModule { @LoadEvent public void setup(ZCommonSetup e) { MusicDiscBehaviour behaviour = new MusicDiscBehaviour(); - e.enqueueWork(() -> ForgeRegistries.ITEMS.forEach(i -> { + e.enqueueWork(() -> Registry.ITEM.forEach(i -> { if (i instanceof RecordItem) DispenserBlock.DISPENSER_REGISTRY.put(i, behaviour); })); diff --git a/src/main/java/vazkii/quark/content/automation/module/PistonsMoveTileEntitiesModule.java b/src/main/java/vazkii/quark/content/automation/module/PistonsMoveTileEntitiesModule.java index ba3f6156c4..1876e1f7d7 100644 --- a/src/main/java/vazkii/quark/content/automation/module/PistonsMoveTileEntitiesModule.java +++ b/src/main/java/vazkii/quark/content/automation/module/PistonsMoveTileEntitiesModule.java @@ -20,7 +20,6 @@ import net.minecraftforge.event.TickEvent.LevelTickEvent; import net.minecraftforge.event.TickEvent.Phase; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.registries.ForgeRegistries; import org.apache.commons.lang3.tuple.Pair; import vazkii.quark.api.IIndirectConnector; import vazkii.quark.api.IPistonCallback; @@ -293,7 +292,7 @@ private static BlockEntity loadBlockEntitySafe(Level level, BlockPos pos, Compou if (inWorldEntity == null) { Quark.LOG.warn("No block entity found at {} (expected {})", pos.toShortString(), expectedTypeStr); return null; - } else if (inWorldEntity.getType() != ForgeRegistries.BLOCK_ENTITY_TYPES.getValue(new ResourceLocation(expectedTypeStr))) { + } else if (inWorldEntity.getType() != Registry.BLOCK_ENTITY_TYPE.get(new ResourceLocation(expectedTypeStr))) { Quark.LOG.warn("Wrong block entity found at {} (expected {}, got {})", pos.toShortString(), expectedTypeStr, BlockEntityType.getKey(inWorldEntity.getType())); return null; } else { diff --git a/src/main/java/vazkii/quark/content/building/module/VariantChestsModule.java b/src/main/java/vazkii/quark/content/building/module/VariantChestsModule.java index 9bea3890f6..c8d4f54c90 100644 --- a/src/main/java/vazkii/quark/content/building/module/VariantChestsModule.java +++ b/src/main/java/vazkii/quark/content/building/module/VariantChestsModule.java @@ -29,7 +29,6 @@ import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.base.Quark; import vazkii.quark.base.block.IQuarkBlock; import vazkii.quark.base.handler.StructureBlockReplacementHandler; @@ -96,7 +95,7 @@ public class VariantChestsModule extends ZetaModule { @LoadEvent public final void register(ZRegister event) { - ForgeRegistries.RECIPE_SERIALIZERS.register(Quark.MOD_ID + ":mixed_exclusion", MixedExclusionRecipe.SERIALIZER); + event.getRegistry().register(MixedExclusionRecipe.SERIALIZER, "mixed_exclusion", Registry.RECIPE_SERIALIZER_REGISTRY); VANILLA_WOODS.forEach(s -> addChest(s.name(), Blocks.CHEST)); MOD_WOODS.forEach(s -> addModChest(s, Blocks.CHEST)); @@ -150,8 +149,8 @@ public final void configChanged(ZConfigChanged event) { String left = toks[0]; String right = toks[1]; - Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(right)); - if (block != null && block != Blocks.AIR) { + Block block = Registry.BLOCK.get(new ResourceLocation(right)); + if (block != Blocks.AIR) { manualChestMappings.put(new ResourceLocation(left), block); if (chests.contains(block)) { var trapped = trappedChests.get(chests.indexOf(block)); diff --git a/src/main/java/vazkii/quark/content/experimental/module/EnchantmentsBegoneModule.java b/src/main/java/vazkii/quark/content/experimental/module/EnchantmentsBegoneModule.java index b85ec98f8b..d163907a13 100644 --- a/src/main/java/vazkii/quark/content/experimental/module/EnchantmentsBegoneModule.java +++ b/src/main/java/vazkii/quark/content/experimental/module/EnchantmentsBegoneModule.java @@ -2,6 +2,7 @@ import com.google.common.collect.Lists; import net.minecraft.core.NonNullList; +import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -11,7 +12,6 @@ import net.minecraftforge.event.AnvilUpdateEvent; import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.base.module.LoadModule; import vazkii.zeta.module.ZetaModule; import vazkii.quark.base.module.config.Config; @@ -40,7 +40,7 @@ public final void configChanged(ZConfigChanged event) { enchantments.clear(); for (String enchantKey : enchantmentsToBegone) { - Enchantment enchantment = ForgeRegistries.ENCHANTMENTS.getValue(new ResourceLocation(enchantKey)); + Enchantment enchantment = Registry.ENCHANTMENT.get(new ResourceLocation(enchantKey)); if (enchantment != null) enchantments.add(enchantment); } diff --git a/src/main/java/vazkii/quark/content/management/module/AutomaticToolRestockModule.java b/src/main/java/vazkii/quark/content/management/module/AutomaticToolRestockModule.java index fd14827c22..267d180772 100644 --- a/src/main/java/vazkii/quark/content/management/module/AutomaticToolRestockModule.java +++ b/src/main/java/vazkii/quark/content/management/module/AutomaticToolRestockModule.java @@ -19,11 +19,9 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.wrapper.PlayerInvWrapper; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.base.util.InventoryIIH; import vazkii.quark.addons.oddities.module.BackpackModule; import vazkii.quark.api.event.GatherToolClassesEvent; -import vazkii.quark.base.handler.MiscUtil; import vazkii.quark.base.module.LoadModule; import vazkii.quark.base.module.ModuleLoader; import vazkii.zeta.module.ZetaModule; diff --git a/src/main/java/vazkii/quark/content/management/module/ExpandedItemInteractionsModule.java b/src/main/java/vazkii/quark/content/management/module/ExpandedItemInteractionsModule.java index 0edda4c70d..04860d20b9 100644 --- a/src/main/java/vazkii/quark/content/management/module/ExpandedItemInteractionsModule.java +++ b/src/main/java/vazkii/quark/content/management/module/ExpandedItemInteractionsModule.java @@ -42,7 +42,6 @@ import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.wrapper.EmptyHandler; import net.minecraftforge.network.NetworkHooks; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.zeta.event.ZConfigChanged; import vazkii.zeta.event.ZRegister; import vazkii.zeta.event.bus.LoadEvent; @@ -50,7 +49,6 @@ import vazkii.zeta.util.ItemNBTHelper; import vazkii.quark.base.Quark; import vazkii.quark.base.handler.GeneralConfig; -import vazkii.quark.base.handler.MiscUtil; import vazkii.quark.base.handler.SimilarBlockTypeHandler; import vazkii.quark.base.module.LoadModule; import vazkii.zeta.module.ZetaModule; diff --git a/src/main/java/vazkii/quark/content/mobs/entity/Toretoise.java b/src/main/java/vazkii/quark/content/mobs/entity/Toretoise.java index 619e94bb0f..85e1ae230f 100644 --- a/src/main/java/vazkii/quark/content/mobs/entity/Toretoise.java +++ b/src/main/java/vazkii/quark/content/mobs/entity/Toretoise.java @@ -1,6 +1,7 @@ package vazkii.quark.content.mobs.entity; import net.minecraft.core.BlockPos; +import net.minecraft.core.Registry; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; @@ -42,7 +43,6 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.AABB; import net.minecraftforge.common.ToolActions; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.base.Quark; import vazkii.quark.base.handler.MiscUtil; import vazkii.quark.base.handler.QuarkSounds; @@ -106,8 +106,8 @@ private Ingredient getGoodFood() { private void computeGoodFood() { goodFood = Ingredient.of(ToretoiseModule.foods.stream() - .map(loc -> ForgeRegistries.ITEMS.getValue(new ResourceLocation(loc))) - .filter(Objects::nonNull) + .map(loc -> Registry.ITEM.get(new ResourceLocation(loc))) + .filter(i -> i != Items.AIR) .map(ItemStack::new)); } diff --git a/src/main/java/vazkii/quark/content/mobs/entity/Wraith.java b/src/main/java/vazkii/quark/content/mobs/entity/Wraith.java index 98f71e3483..c2b68153cd 100644 --- a/src/main/java/vazkii/quark/content/mobs/entity/Wraith.java +++ b/src/main/java/vazkii/quark/content/mobs/entity/Wraith.java @@ -3,6 +3,7 @@ import javax.annotation.Nonnull; import net.minecraft.core.BlockPos; +import net.minecraft.core.Registry; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; @@ -32,7 +33,6 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.content.mobs.module.WraithModule; public class Wraith extends Zombie { @@ -99,7 +99,7 @@ public float getVoicePitch() { public SoundEvent getSound(EntityDataAccessor param) { ResourceLocation loc = new ResourceLocation(entityData.get(param)); - return ForgeRegistries.SOUND_EVENTS.getValue(loc); + return Registry.SOUND_EVENT.get(loc); } @Override diff --git a/src/main/java/vazkii/quark/content/tools/item/AncientTomeItem.java b/src/main/java/vazkii/quark/content/tools/item/AncientTomeItem.java index 8bd3fbbd98..3a39b0e972 100644 --- a/src/main/java/vazkii/quark/content/tools/item/AncientTomeItem.java +++ b/src/main/java/vazkii/quark/content/tools/item/AncientTomeItem.java @@ -2,6 +2,7 @@ import net.minecraft.ChatFormatting; import net.minecraft.core.NonNullList; +import net.minecraft.core.Registry; import net.minecraft.network.chat.Component; import net.minecraft.world.item.*; import net.minecraft.world.item.enchantment.Enchantment; @@ -9,7 +10,6 @@ import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.base.item.QuarkItem; import vazkii.zeta.module.ZetaModule; import vazkii.quark.content.experimental.module.EnchantmentsBegoneModule; @@ -50,7 +50,7 @@ public static ItemStack getEnchantedItemStack(Enchantment ench) { public void fillItemCategory(@Nonnull CreativeModeTab group, @Nonnull NonNullList items) { if (isEnabled() || group == CreativeModeTab.TAB_SEARCH) { if (group == CreativeModeTab.TAB_SEARCH || group.getEnchantmentCategories().length != 0) { - ForgeRegistries.ENCHANTMENTS.forEach(ench -> { + Registry.ENCHANTMENT.forEach(ench -> { if (!EnchantmentsBegoneModule.shouldBegone(ench) && (!AncientTomesModule.sanityCheck || ench.getMaxLevel() != 1)) { if (!AncientTomesModule.isInitialized() || AncientTomesModule.validEnchants.contains(ench)) { if (group == CreativeModeTab.TAB_SEARCH || group.hasEnchantmentCategory(ench.category)) { diff --git a/src/main/java/vazkii/quark/content/tools/module/AncientTomesModule.java b/src/main/java/vazkii/quark/content/tools/module/AncientTomesModule.java index 3375b0c504..05127320e0 100644 --- a/src/main/java/vazkii/quark/content/tools/module/AncientTomesModule.java +++ b/src/main/java/vazkii/quark/content/tools/module/AncientTomesModule.java @@ -43,7 +43,6 @@ import net.minecraftforge.event.village.VillagerTradesEvent; import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.api.IRuneColorProvider; import vazkii.quark.api.QuarkCapabilities; import vazkii.quark.base.Quark; @@ -446,7 +445,7 @@ public static Enchantment getTomeEnchantment(ItemStack stack) { for(int i = 0; i < list.size(); ++i) { CompoundTag nbt = list.getCompound(i); - Enchantment enchant = ForgeRegistries.ENCHANTMENTS.getValue(ResourceLocation.tryParse(nbt.getString("id"))); + Enchantment enchant = Registry.ENCHANTMENT.get(ResourceLocation.tryParse(nbt.getString("id"))); if (enchant != null) return enchant; } diff --git a/src/main/java/vazkii/quark/content/tweaks/module/DiamondRepairModule.java b/src/main/java/vazkii/quark/content/tweaks/module/DiamondRepairModule.java index c107184846..591b484005 100644 --- a/src/main/java/vazkii/quark/content/tweaks/module/DiamondRepairModule.java +++ b/src/main/java/vazkii/quark/content/tweaks/module/DiamondRepairModule.java @@ -8,8 +8,6 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.registries.ForgeRegistries; -import vazkii.quark.base.handler.MiscUtil; import vazkii.quark.base.module.LoadModule; import vazkii.zeta.module.ZetaModule; import vazkii.quark.base.module.config.Config; @@ -62,15 +60,15 @@ public final void configChanged(ZConfigChanged event) { if(toks.length == 2) { ResourceLocation itemRes = new ResourceLocation(toks[0]); - if(ForgeRegistries.ITEMS.containsKey(itemRes)) { + if(Registry.ITEM.containsKey(itemRes)) { String repairItems = toks[1]; String[] repairToks = repairItems.split(","); for(String repairTok : repairToks) { ResourceLocation repairItemRes = new ResourceLocation(repairTok); - if(ForgeRegistries.ITEMS.containsKey(repairItemRes)) { - Item item = ForgeRegistries.ITEMS.getValue(itemRes); - Item repairItem = ForgeRegistries.ITEMS.getValue(repairItemRes); + if(Registry.ITEM.containsKey(repairItemRes)) { + Item item = Registry.ITEM.get(itemRes); + Item repairItem = Registry.ITEM.get(repairItemRes); repairChanges.put(item, repairItem); } } diff --git a/src/main/java/vazkii/quark/content/tweaks/module/DragonScalesModule.java b/src/main/java/vazkii/quark/content/tweaks/module/DragonScalesModule.java index 4d1c9fc0a3..8d758b9d9a 100644 --- a/src/main/java/vazkii/quark/content/tweaks/module/DragonScalesModule.java +++ b/src/main/java/vazkii/quark/content/tweaks/module/DragonScalesModule.java @@ -1,5 +1,6 @@ package vazkii.quark.content.tweaks.module; +import net.minecraft.core.Registry; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.item.CreativeModeTab; @@ -25,7 +26,7 @@ public class DragonScalesModule extends ZetaModule { @LoadEvent public final void register(ZRegister event) { - ForgeRegistries.RECIPE_SERIALIZERS.register(Quark.MOD_ID + ":elytra_duplication", ElytraDuplicationRecipe.SERIALIZER); + event.getRegistry().register(ElytraDuplicationRecipe.SERIALIZER, "elytra_duplication", Registry.RECIPE_SERIALIZER_REGISTRY); dragon_scale = new QuarkItem("dragon_scale", this, new Item.Properties().tab(CreativeModeTab.TAB_MATERIALS)); } diff --git a/src/main/java/vazkii/quark/content/tweaks/module/GoldToolsHaveFortuneModule.java b/src/main/java/vazkii/quark/content/tweaks/module/GoldToolsHaveFortuneModule.java index 96905d913e..ddf54e8cf1 100644 --- a/src/main/java/vazkii/quark/content/tweaks/module/GoldToolsHaveFortuneModule.java +++ b/src/main/java/vazkii/quark/content/tweaks/module/GoldToolsHaveFortuneModule.java @@ -4,6 +4,7 @@ import it.unimi.dsi.fastutil.objects.Object2IntArrayMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import net.minecraft.ChatFormatting; +import net.minecraft.core.Registry; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.network.chat.Component; @@ -12,7 +13,6 @@ import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.Enchantments; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.base.module.LoadModule; import vazkii.zeta.module.ZetaModule; import vazkii.quark.base.module.config.Config; @@ -65,14 +65,14 @@ public final void configChanged(ZConfigChanged event) { if (split1.length == 2) { ResourceLocation itemLoc = ResourceLocation.tryParse(split1[0]); if (itemLoc != null) { - Item item = ForgeRegistries.ITEMS.getValue(itemLoc); - if (item != null) { + Item item = Registry.ITEM.get(itemLoc); + if (item != Items.AIR) { String[] split2 = split1[1].split("@"); if (split2.length == 0 || split2.length > 2) continue; ResourceLocation enchantLoc = ResourceLocation.tryParse(split2[0]); if (enchantLoc != null) { - Enchantment enchant = ForgeRegistries.ENCHANTMENTS.getValue(enchantLoc); + Enchantment enchant = Registry.ENCHANTMENT.get(enchantLoc); if (enchant != null) { try { int strength = split2.length == 1 ? 1 : Integer.parseInt(split2[1]); @@ -89,7 +89,7 @@ public final void configChanged(ZConfigChanged event) { } if (fortuneLevel > 0) { - for (Item item : ForgeRegistries.ITEMS) { + for (Item item : Registry.ITEM) { if (item instanceof TieredItem tiered && tiered.getTier() == Tiers.GOLD) { Enchantment enchant = item instanceof SwordItem ? Enchantments.MOB_LOOTING : Enchantments.BLOCK_FORTUNE; var pastry = wellBakedEnchantments.computeIfAbsent(item, it -> new Object2IntArrayMap<>()); diff --git a/src/main/java/vazkii/quark/content/tweaks/module/SimpleHarvestModule.java b/src/main/java/vazkii/quark/content/tweaks/module/SimpleHarvestModule.java index 2e59cfed23..c672985755 100644 --- a/src/main/java/vazkii/quark/content/tweaks/module/SimpleHarvestModule.java +++ b/src/main/java/vazkii/quark/content/tweaks/module/SimpleHarvestModule.java @@ -43,7 +43,6 @@ import net.minecraftforge.common.ToolActions; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.registries.ForgeRegistries; import org.apache.commons.lang3.mutable.MutableBoolean; import vazkii.quark.api.event.SimpleHarvestEvent; import vazkii.quark.api.event.SimpleHarvestEvent.ActionType; @@ -116,14 +115,14 @@ public void configChanged(ZConfigChanged event) { staticEnabled = enabled; if (doHarvestingSearch) { - ForgeRegistries.BLOCKS.getValues().stream() + Registry.BLOCK.stream() .filter(b -> !isVanilla(b) && b instanceof CropBlock) .map(b -> (CropBlock) b) //only grabbing blocks whose max age is acceptable .filter(b -> b.isMaxAge(b.defaultBlockState().setValue(b.getAgeProperty(), last(b.getAgeProperty().getPossibleValues())))) .forEach(b -> crops.put(b.defaultBlockState().setValue(b.getAgeProperty(), last(b.getAgeProperty().getPossibleValues())), b.defaultBlockState())); - ForgeRegistries.BLOCKS.getValues().stream() + Registry.BLOCK.stream() .filter(b -> !isVanilla(b) && (b instanceof BushBlock || b instanceof GrowingPlantBlock) && b instanceof BonemealableBlock && !(b instanceof CropBlock)) .forEach(rightClickCrops::add); } @@ -142,8 +141,8 @@ public void configChanged(ZConfigChanged event) { } for (String blockName : rightClickableBlocks) { - Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(blockName)); - if (block != null) + Block block = Registry.BLOCK.get(new ResourceLocation(blockName)); + if (block != Blocks.AIR) rightClickCrops.add(block); } diff --git a/src/main/java/vazkii/quark/content/tweaks/module/SlabsToBlocksModule.java b/src/main/java/vazkii/quark/content/tweaks/module/SlabsToBlocksModule.java index 24514ca96f..5dd9e36914 100644 --- a/src/main/java/vazkii/quark/content/tweaks/module/SlabsToBlocksModule.java +++ b/src/main/java/vazkii/quark/content/tweaks/module/SlabsToBlocksModule.java @@ -1,14 +1,13 @@ package vazkii.quark.content.tweaks.module; +import net.minecraft.core.Registry; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.SlabBlock; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.api.event.RecipeCrawlEvent; -import vazkii.quark.base.Quark; import vazkii.quark.base.module.LoadModule; import vazkii.zeta.module.ZetaModule; import vazkii.quark.content.tweaks.recipe.SlabToBlockRecipe; @@ -25,7 +24,7 @@ public class SlabsToBlocksModule extends ZetaModule { @LoadEvent public final void register(ZRegister event) { - ForgeRegistries.RECIPE_SERIALIZERS.register(Quark.MOD_ID + ":slab_to_block", SlabToBlockRecipe.SERIALIZER); + event.getRegistry().register(SlabToBlockRecipe.SERIALIZER, "slab_to_block", Registry.RECIPE_SERIALIZER_REGISTRY); } @SubscribeEvent diff --git a/src/main/java/vazkii/quark/content/world/module/FairyRingsModule.java b/src/main/java/vazkii/quark/content/world/module/FairyRingsModule.java index 1e0245ade8..0132520bed 100644 --- a/src/main/java/vazkii/quark/content/world/module/FairyRingsModule.java +++ b/src/main/java/vazkii/quark/content/world/module/FairyRingsModule.java @@ -1,11 +1,12 @@ package vazkii.quark.content.world.module; import com.google.common.collect.Lists; +import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.GenerationStep.Decoration; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.quark.base.module.LoadModule; import vazkii.zeta.module.ZetaModule; import vazkii.quark.base.module.config.Config; @@ -41,8 +42,8 @@ public final void setup(ZCommonSetup event) { public final void configChanged(ZConfigChanged event) { ores = new ArrayList<>(); for(String s : oresRaw) { - Block b = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(s)); - if (b != null) { + Block b = Registry.BLOCK.get(new ResourceLocation(s)); + if (b != Blocks.AIR) { ores.add(b.defaultBlockState()); } else { diff --git a/src/main/java/vazkii/quark/integration/jei/QuarkJeiPlugin.java b/src/main/java/vazkii/quark/integration/jei/QuarkJeiPlugin.java index 29580e70f8..0e5dd1c177 100644 --- a/src/main/java/vazkii/quark/integration/jei/QuarkJeiPlugin.java +++ b/src/main/java/vazkii/quark/integration/jei/QuarkJeiPlugin.java @@ -30,7 +30,6 @@ import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; -import net.minecraftforge.registries.ForgeRegistries; import vazkii.zeta.event.ZGatherHints; import vazkii.zeta.util.ItemNBTHelper; import vazkii.quark.addons.oddities.block.be.MatrixEnchantingTableBlockEntity; @@ -95,8 +94,8 @@ public void onRuntimeAvailable(@Nonnull final IJeiRuntime jeiRuntime) { return; Set hidePotions = Sets.newHashSet(); - for (Potion potion : ForgeRegistries.POTIONS.getValues()) { - ResourceLocation loc = ForgeRegistries.POTIONS.getKey(potion); + for (Potion potion : Registry.POTION) { + ResourceLocation loc = Registry.POTION.getKey(potion); if (loc != null && loc.getNamespace().equals("quark")) { if (!Quark.ZETA.brewingRegistry.isEnabled(potion)) { hidePotions.add(potion); @@ -105,8 +104,8 @@ public void onRuntimeAvailable(@Nonnull final IJeiRuntime jeiRuntime) { } NonNullList stacks = NonNullList.create(); - for (Item item : ForgeRegistries.ITEMS.getValues()) { - ResourceLocation loc = ForgeRegistries.ITEMS.getKey(item); + for (Item item : Registry.ITEM) { + ResourceLocation loc = Registry.ITEM.getKey(item); if (loc != null && loc.getNamespace().equals("quark")) { if ((item instanceof IQuarkItem quarkItem && !quarkItem.isEnabled()) || (item instanceof BlockItem blockItem && blockItem.getBlock() instanceof IQuarkBlock quarkBlock && !quarkBlock.isEnabled())) { @@ -174,7 +173,7 @@ public void registerRecipes(@Nonnull IRecipeRegistration registration) { return; MutableComponent compound = Component.literal(""); - if(!ForgeRegistries.ITEMS.getKey(item).getNamespace().equals(Quark.MOD_ID)) + if(!Registry.ITEM.getKey(item).getNamespace().equals(Quark.MOD_ID)) compound = compound.append(externalPreamble); compound = compound.append(component); diff --git a/src/main/java/vazkii/quark/integration/mixin/lootr/ConfigManagerMixin.java b/src/main/java/vazkii/quark/integration/mixin/lootr/ConfigManagerMixin.java index 9abc9fc390..c9e290234f 100644 --- a/src/main/java/vazkii/quark/integration/mixin/lootr/ConfigManagerMixin.java +++ b/src/main/java/vazkii/quark/integration/mixin/lootr/ConfigManagerMixin.java @@ -1,8 +1,9 @@ package vazkii.quark.integration.mixin.lootr; +import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.world.level.block.Blocks; import noobanidus.mods.lootr.config.ConfigManager; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; @@ -15,8 +16,8 @@ public class ConfigManagerMixin { @ModifyVariable(method = "addSafeReplacement", at = @At("HEAD"), argsOnly = true, remap = false) private static Block replacement(Block original, ResourceLocation location) { - Block block = ForgeRegistries.BLOCKS.getValue(location); - if (block != null) { + Block block = Registry.BLOCK.get(location); + if (block != Blocks.AIR) { Block lootrVariant = ILootrIntegration.INSTANCE.lootrVariant(block); if (lootrVariant != null) return lootrVariant;