From 82119f20c678de19363e9ce75586d0586e244de3 Mon Sep 17 00:00:00 2001 From: Relentless Date: Thu, 7 Sep 2023 22:23:16 +0200 Subject: [PATCH] 1.20 port --- .github/workflows/build.yml | 4 ++-- .github/workflows/release.yml | 2 +- .../java/com/almostreliable/morejs/MoreJSBinding.java | 9 +++++---- .../features/enchantment/EnchantmentTableChangedJS.java | 4 ++-- .../enchantment/EnchantmentTableServerEventJS.java | 6 +++--- .../enchantment/EnchantmentTableTooltipEventJS.java | 4 ++-- .../enchantment/FilterAvailableEnchantmentsEventJS.java | 8 ++++---- .../features/potion/PotionBrewingRegisterEvent.java | 6 +++--- .../morejs/features/structure/EntityInfoWrapper.java | 2 +- .../morejs/features/villager/VillagerUtils.java | 5 ++--- .../villager/events/FilterEnchantedTradeEventJS.java | 4 ++-- .../features/villager/trades/EnchantedItemTrade.java | 4 ++-- .../morejs/features/villager/trades/PotionTrade.java | 4 ++-- .../features/villager/trades/TreasureMapTrade.java | 8 ++++---- .../morejs/mixin/enchanting/EnchantmentMixin.java | 4 ++-- .../morejs/mixin/structure/StructureBlockInfoMixin.java | 6 +++--- .../morejs/mixin/villager/MerchantScreenMixin.java | 7 ++++--- .../java/com/almostreliable/morejs/util/LevelUtils.java | 4 ++-- Common/src/main/resources/morejs.accesswidener | 2 ++ 19 files changed, 48 insertions(+), 45 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 77bf8bd..3ddacf2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,12 +4,12 @@ on: workflow_dispatch: push: branches: - - '1.19' + - '1.20.1' tags-ignore: - '**' pull_request: branches: - - '1.19' + - '1.20.1' env: JAVA_DIST: 'zulu' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0bdc445..edc0820 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: push: tags: - - 'v1.19-*.*.*' + - 'v1.20.1-*.*.*' env: JAVA_DIST: 'zulu' diff --git a/Common/src/main/java/com/almostreliable/morejs/MoreJSBinding.java b/Common/src/main/java/com/almostreliable/morejs/MoreJSBinding.java index bd74c6e..4c8e223 100644 --- a/Common/src/main/java/com/almostreliable/morejs/MoreJSBinding.java +++ b/Common/src/main/java/com/almostreliable/morejs/MoreJSBinding.java @@ -13,7 +13,8 @@ import dev.latvian.mods.kubejs.util.ConsoleJS; import dev.latvian.mods.kubejs.util.UtilsJS; import net.minecraft.core.BlockPos; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.npc.VillagerProfession; @@ -30,13 +31,13 @@ public class MoreJSBinding { @Nullable public static BlockPos findStructure(BlockPos position, ServerLevel level, String structure, int chunkRadius) { ResourceOrTag rot = ResourceOrTag.get(structure, - Registry.STRUCTURE_REGISTRY); + Registries.STRUCTURE); return LevelUtils.findStructure(position, level, rot, chunkRadius); } @Nullable public static BlockPos findBiome(BlockPos position, ServerLevel level, String biome, int chunkRadius) { - ResourceOrTag rot = ResourceOrTag.get(biome, Registry.BIOME_REGISTRY); + ResourceOrTag rot = ResourceOrTag.get(biome, Registries.BIOME); return LevelUtils.findBiome(position, level, rot, chunkRadius); } @@ -124,7 +125,7 @@ public static TradeFilter ofTradeFilter(@Nullable Object o) { .map(Object::toString) .map(ResourceLocation::tryParse) .filter(Objects::nonNull) - .map(Registry.VILLAGER_PROFESSION::getOptional) + .map(BuiltInRegistries.VILLAGER_PROFESSION::getOptional) .flatMap(Optional::stream) .collect(Collectors.toSet()); filter.setProfessions(professions); diff --git a/Common/src/main/java/com/almostreliable/morejs/features/enchantment/EnchantmentTableChangedJS.java b/Common/src/main/java/com/almostreliable/morejs/features/enchantment/EnchantmentTableChangedJS.java index f262b34..6cabe6f 100644 --- a/Common/src/main/java/com/almostreliable/morejs/features/enchantment/EnchantmentTableChangedJS.java +++ b/Common/src/main/java/com/almostreliable/morejs/features/enchantment/EnchantmentTableChangedJS.java @@ -3,7 +3,7 @@ import com.google.common.base.Preconditions; import dev.latvian.mods.kubejs.event.EventResult; import net.minecraft.core.BlockPos; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.util.RandomSource; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.enchantment.Enchantment; @@ -57,7 +57,7 @@ public void setRequiredLevel(int level) { public void updateClue() { var enchantments = getEnchantments(); var instance = enchantments.get(EnchantmentTableChangedJS.this.random.nextInt(enchantments.size())); - EnchantmentTableChangedJS.this.menu.enchantClue[index] = Registry.ENCHANTMENT.getId( + EnchantmentTableChangedJS.this.menu.enchantClue[index] = BuiltInRegistries.ENCHANTMENT.getId( instance.enchantment); EnchantmentTableChangedJS.this.menu.levelClue[index] = instance.level; } diff --git a/Common/src/main/java/com/almostreliable/morejs/features/enchantment/EnchantmentTableServerEventJS.java b/Common/src/main/java/com/almostreliable/morejs/features/enchantment/EnchantmentTableServerEventJS.java index 82f167c..54921cd 100644 --- a/Common/src/main/java/com/almostreliable/morejs/features/enchantment/EnchantmentTableServerEventJS.java +++ b/Common/src/main/java/com/almostreliable/morejs/features/enchantment/EnchantmentTableServerEventJS.java @@ -3,7 +3,7 @@ import com.almostreliable.morejs.features.villager.IntRange; import com.google.common.base.Preconditions; import net.minecraft.core.BlockPos; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -75,7 +75,7 @@ public void clearEnchantments() { public List getEnchantmentIds() { return getEnchantments() .stream() - .map(e -> Registry.ENCHANTMENT.getKey(e.enchantment)) + .map(e -> BuiltInRegistries.ENCHANTMENT.getKey(e.enchantment)) .filter(Objects::nonNull) .toList(); } @@ -85,7 +85,7 @@ public boolean hasEnchantment(ResourceLocation id) { } public boolean hasEnchantment(ResourceLocation id, IntRange range) { - Enchantment enchantment = Registry.ENCHANTMENT.getOptional(id).orElse(null); + Enchantment enchantment = BuiltInRegistries.ENCHANTMENT.getOptional(id).orElse(null); if (enchantment == null) return false; for (EnchantmentInstance enchantmentInstance : getEnchantments()) { if (enchantmentInstance.enchantment == enchantment && range.test(enchantmentInstance.level)) { diff --git a/Common/src/main/java/com/almostreliable/morejs/features/enchantment/EnchantmentTableTooltipEventJS.java b/Common/src/main/java/com/almostreliable/morejs/features/enchantment/EnchantmentTableTooltipEventJS.java index d2950ee..6457bcc 100644 --- a/Common/src/main/java/com/almostreliable/morejs/features/enchantment/EnchantmentTableTooltipEventJS.java +++ b/Common/src/main/java/com/almostreliable/morejs/features/enchantment/EnchantmentTableTooltipEventJS.java @@ -1,6 +1,6 @@ package com.almostreliable.morejs.features.enchantment; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.EnchantmentMenu; @@ -47,6 +47,6 @@ public EnchantmentInstance getClue() { } public ResourceLocation getClueId() { - return Registry.ENCHANTMENT.getKey(getClue().enchantment); + return BuiltInRegistries.ENCHANTMENT.getKey(getClue().enchantment); } } diff --git a/Common/src/main/java/com/almostreliable/morejs/features/enchantment/FilterAvailableEnchantmentsEventJS.java b/Common/src/main/java/com/almostreliable/morejs/features/enchantment/FilterAvailableEnchantmentsEventJS.java index dbb63f5..c77c533 100644 --- a/Common/src/main/java/com/almostreliable/morejs/features/enchantment/FilterAvailableEnchantmentsEventJS.java +++ b/Common/src/main/java/com/almostreliable/morejs/features/enchantment/FilterAvailableEnchantmentsEventJS.java @@ -2,7 +2,7 @@ import dev.latvian.mods.kubejs.event.EventJS; import dev.latvian.mods.kubejs.util.ConsoleJS; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.enchantment.Enchantment; @@ -27,8 +27,8 @@ public void printEnchantmentInstances() { enchantments .stream() .sorted((ei1, ei2) -> { - ResourceLocation key1 = Registry.ENCHANTMENT.getKey(ei1.enchantment); - ResourceLocation key2 = Registry.ENCHANTMENT.getKey(ei2.enchantment); + ResourceLocation key1 = BuiltInRegistries.ENCHANTMENT.getKey(ei1.enchantment); + ResourceLocation key2 = BuiltInRegistries.ENCHANTMENT.getKey(ei2.enchantment); assert key1 != null; assert key2 != null; int c = key1.toString().compareTo(key2.toString()); @@ -36,7 +36,7 @@ public void printEnchantmentInstances() { return Integer.compare(ei1.level, ei2.level); }) .forEach(ei -> ConsoleJS.SERVER.info( - Registry.ENCHANTMENT.getKey(ei.enchantment) + " (Level: " + ei.level + ")")); + BuiltInRegistries.ENCHANTMENT.getKey(ei.enchantment) + " (Level: " + ei.level + ")")); } public List getEnchantmentInstances() { diff --git a/Common/src/main/java/com/almostreliable/morejs/features/potion/PotionBrewingRegisterEvent.java b/Common/src/main/java/com/almostreliable/morejs/features/potion/PotionBrewingRegisterEvent.java index 34c9fa2..ff1025c 100644 --- a/Common/src/main/java/com/almostreliable/morejs/features/potion/PotionBrewingRegisterEvent.java +++ b/Common/src/main/java/com/almostreliable/morejs/features/potion/PotionBrewingRegisterEvent.java @@ -5,7 +5,7 @@ import com.google.common.base.Preconditions; import dev.latvian.mods.kubejs.event.EventJS; import dev.latvian.mods.kubejs.util.ConsoleJS; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.alchemy.Potion; import net.minecraft.world.item.alchemy.PotionBrewing; @@ -46,9 +46,9 @@ public void removeByPotion(@Nullable Potion input, @Nullable Ingredient ingredie boolean matches = matchesInput && matchesIngredient && matchesOutput; if (matches) { ConsoleJS.STARTUP.info( - "Removed potion brewing recipe: " + Registry.POTION.getKey(getInputPotionFromMix(mix)) + " + " + + "Removed potion brewing recipe: " + BuiltInRegistries.POTION.getKey(getInputPotionFromMix(mix)) + " + " + StringUtils.abbreviate(mix.ingredient.toJson().toString(), 64) + " -> " + - Registry.POTION.getKey(getOutputPotionFromMix(mix))); + BuiltInRegistries.POTION.getKey(getOutputPotionFromMix(mix))); } return matches; }); diff --git a/Common/src/main/java/com/almostreliable/morejs/features/structure/EntityInfoWrapper.java b/Common/src/main/java/com/almostreliable/morejs/features/structure/EntityInfoWrapper.java index 2cca7e2..c96bf85 100644 --- a/Common/src/main/java/com/almostreliable/morejs/features/structure/EntityInfoWrapper.java +++ b/Common/src/main/java/com/almostreliable/morejs/features/structure/EntityInfoWrapper.java @@ -57,7 +57,7 @@ public void add(CompoundTag tag) { Mth.clamp(posTag.getDouble(1), 0, borderSize.getY()), Mth.clamp(posTag.getDouble(2), 0, borderSize.getZ()) ); - BlockPos blockPos = new BlockPos(pos); + BlockPos blockPos = new BlockPos(Mth.floor(pos.x), Mth.floor(pos.y), Mth.floor(pos.z)); this.entities.add(new StructureTemplate.StructureEntityInfo(pos, blockPos, tag)); } } diff --git a/Common/src/main/java/com/almostreliable/morejs/features/villager/VillagerUtils.java b/Common/src/main/java/com/almostreliable/morejs/features/villager/VillagerUtils.java index 49f6bef..9b39f32 100644 --- a/Common/src/main/java/com/almostreliable/morejs/features/villager/VillagerUtils.java +++ b/Common/src/main/java/com/almostreliable/morejs/features/villager/VillagerUtils.java @@ -2,12 +2,11 @@ import com.almostreliable.morejs.features.villager.trades.*; import com.almostreliable.morejs.util.WeightedList; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.entity.npc.VillagerProfession; import net.minecraft.world.entity.npc.VillagerTrades; import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; import java.util.Collection; import java.util.Set; @@ -38,7 +37,7 @@ public static boolean isMoreJSTrade(VillagerTrades.ItemListing listing) { } public static Collection getProfessions() { - return Registry.VILLAGER_PROFESSION + return BuiltInRegistries.VILLAGER_PROFESSION .stream() .filter(p -> !p.name().equals("none")) .toList(); diff --git a/Common/src/main/java/com/almostreliable/morejs/features/villager/events/FilterEnchantedTradeEventJS.java b/Common/src/main/java/com/almostreliable/morejs/features/villager/events/FilterEnchantedTradeEventJS.java index 5007928..54bd935 100644 --- a/Common/src/main/java/com/almostreliable/morejs/features/villager/events/FilterEnchantedTradeEventJS.java +++ b/Common/src/main/java/com/almostreliable/morejs/features/villager/events/FilterEnchantedTradeEventJS.java @@ -2,7 +2,7 @@ import dev.latvian.mods.kubejs.entity.LivingEntityEventJS; import dev.latvian.mods.kubejs.util.ConsoleJS; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.npc.AbstractVillager; import net.minecraft.world.entity.npc.Villager; @@ -58,7 +58,7 @@ public List getEnchantments() { public void printEnchantments() { ConsoleJS.SERVER.info("Potential Enchantments: " + enchantments.stream() - .flatMap(e -> Registry.ENCHANTMENT.getResourceKey(e).stream()) + .flatMap(e -> BuiltInRegistries.ENCHANTMENT.getResourceKey(e).stream()) .map(key -> key.location().toString()) .sorted(String::compareToIgnoreCase) .collect(Collectors.joining(", "))); diff --git a/Common/src/main/java/com/almostreliable/morejs/features/villager/trades/EnchantedItemTrade.java b/Common/src/main/java/com/almostreliable/morejs/features/villager/trades/EnchantedItemTrade.java index 2250bb4..267c59c 100644 --- a/Common/src/main/java/com/almostreliable/morejs/features/villager/trades/EnchantedItemTrade.java +++ b/Common/src/main/java/com/almostreliable/morejs/features/villager/trades/EnchantedItemTrade.java @@ -2,7 +2,7 @@ import com.almostreliable.morejs.features.villager.TradeItem; import dev.latvian.mods.kubejs.util.ConsoleJS; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; @@ -29,7 +29,7 @@ public class EnchantedItemTrade extends TransformableTrade { public EnchantedItemTrade(TradeItem[] inputs, Item itemToEnchant) { super(inputs); this.itemToEnchant = itemToEnchant; - enchantments = Registry.ENCHANTMENT.stream().toList(); + enchantments = BuiltInRegistries.ENCHANTMENT.stream().toList(); } public EnchantedItemTrade enchantments(Enchantment... enchantments) { diff --git a/Common/src/main/java/com/almostreliable/morejs/features/villager/trades/PotionTrade.java b/Common/src/main/java/com/almostreliable/morejs/features/villager/trades/PotionTrade.java index 522140a..29d05e8 100644 --- a/Common/src/main/java/com/almostreliable/morejs/features/villager/trades/PotionTrade.java +++ b/Common/src/main/java/com/almostreliable/morejs/features/villager/trades/PotionTrade.java @@ -2,7 +2,7 @@ import com.almostreliable.morejs.features.villager.TradeItem; import dev.latvian.mods.kubejs.util.ConsoleJS; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.item.Item; @@ -28,7 +28,7 @@ public class PotionTrade extends TransformableTrade { public PotionTrade(TradeItem[] inputs) { super(inputs); this.itemForPotion = Items.POTION; - potions = Registry.POTION.stream().toList(); + potions = BuiltInRegistries.POTION.stream().toList(); } public PotionTrade item(Item item) { diff --git a/Common/src/main/java/com/almostreliable/morejs/features/villager/trades/TreasureMapTrade.java b/Common/src/main/java/com/almostreliable/morejs/features/villager/trades/TreasureMapTrade.java index d65c2ca..07821a9 100644 --- a/Common/src/main/java/com/almostreliable/morejs/features/villager/trades/TreasureMapTrade.java +++ b/Common/src/main/java/com/almostreliable/morejs/features/villager/trades/TreasureMapTrade.java @@ -5,7 +5,7 @@ import com.almostreliable.morejs.util.ResourceOrTag; import com.almostreliable.morejs.util.WeightedList; import net.minecraft.core.BlockPos; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; @@ -36,7 +36,7 @@ public static TreasureMapTrade forStructure(TradeItem[] input, WeightedList { @@ -53,7 +53,7 @@ public static TreasureMapTrade forBiome(TradeItem[] input, WeightedList if (o == null) { return null; } - return ResourceOrTag.get(o.toString(), Registry.BIOME_REGISTRY); + return ResourceOrTag.get(o.toString(), Registries.BIOME); }); MapPosInfo.Provider func = (level, entity) -> { @@ -88,7 +88,7 @@ public TreasureMapTrade scale(byte scale) { @Override @Nullable public MerchantOffer createOffer(Entity trader, RandomSource random) { - if (trader.getLevel() instanceof ServerLevel level) { + if (trader.level() instanceof ServerLevel level) { MapPosInfo info = destinationPositionFunc.apply(level, trader); if (info == null) return null; diff --git a/Common/src/main/java/com/almostreliable/morejs/mixin/enchanting/EnchantmentMixin.java b/Common/src/main/java/com/almostreliable/morejs/mixin/enchanting/EnchantmentMixin.java index 45c09be..8f3c717 100644 --- a/Common/src/main/java/com/almostreliable/morejs/mixin/enchanting/EnchantmentMixin.java +++ b/Common/src/main/java/com/almostreliable/morejs/mixin/enchanting/EnchantmentMixin.java @@ -1,7 +1,7 @@ package com.almostreliable.morejs.mixin.enchanting; import dev.latvian.mods.rhino.util.RemapForJS; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.enchantment.Enchantment; import org.spongepowered.asm.mixin.Mixin; @@ -12,6 +12,6 @@ public class EnchantmentMixin { @RemapForJS("getId") public ResourceLocation morejs$getId() { //noinspection ConstantConditions - return Registry.ENCHANTMENT.getKey((Enchantment) (Object) this); + return BuiltInRegistries.ENCHANTMENT.getKey((Enchantment) (Object) this); } } diff --git a/Common/src/main/java/com/almostreliable/morejs/mixin/structure/StructureBlockInfoMixin.java b/Common/src/main/java/com/almostreliable/morejs/mixin/structure/StructureBlockInfoMixin.java index af049aa..f2c54aa 100644 --- a/Common/src/main/java/com/almostreliable/morejs/mixin/structure/StructureBlockInfoMixin.java +++ b/Common/src/main/java/com/almostreliable/morejs/mixin/structure/StructureBlockInfoMixin.java @@ -4,7 +4,7 @@ import com.almostreliable.morejs.util.Utils; import dev.latvian.mods.rhino.util.HideFromJS; import net.minecraft.core.BlockPos; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; @@ -31,7 +31,7 @@ public class StructureBlockInfoMixin implements StructureBlockInfoModification { @Override public String getId() { - return Registry.BLOCK.getKey(state.getBlock()).toString(); + return BuiltInRegistries.BLOCK.getKey(state.getBlock()).toString(); } @Override @@ -41,7 +41,7 @@ public Block getBlock() { @Override public void setBlock(ResourceLocation id) { - Block block = Registry.BLOCK + Block block = BuiltInRegistries.BLOCK .getOptional(id) .orElseThrow(() -> new IllegalArgumentException("Block not found: " + id)); state = block.defaultBlockState(); diff --git a/Common/src/main/java/com/almostreliable/morejs/mixin/villager/MerchantScreenMixin.java b/Common/src/main/java/com/almostreliable/morejs/mixin/villager/MerchantScreenMixin.java index adef13d..8e3af85 100644 --- a/Common/src/main/java/com/almostreliable/morejs/mixin/villager/MerchantScreenMixin.java +++ b/Common/src/main/java/com/almostreliable/morejs/mixin/villager/MerchantScreenMixin.java @@ -1,8 +1,9 @@ package com.almostreliable.morejs.mixin.villager; import com.almostreliable.morejs.features.villager.OfferExtension; -import com.mojang.blaze3d.vertex.PoseStack; import dev.latvian.mods.kubejs.util.ConsoleJS; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.gui.screens.inventory.MerchantScreen; import net.minecraft.network.chat.Component; @@ -35,11 +36,11 @@ public MerchantScreenMixin(MerchantMenu abstractContainerMenu, Inventory invento } @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/trading/MerchantOffer;isOutOfStock()Z", ordinal = 0)) - private void morejs$disableButtonsIfNeeded(PoseStack poseStack, int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { + private void morejs$disableButtonsIfNeeded(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { try { var offer = this.menu.getOffers().get(this.shopItem); if (morejs$offerIsDisabled(offer) && this.isHovering(186, 35, 22, 21, mouseX, mouseY)) { - this.renderTooltip(poseStack, + guiGraphics.renderTooltip(Minecraft.getInstance().font, Component.literal("You don't meet the requirements to buy this item."), mouseX, mouseY); diff --git a/Common/src/main/java/com/almostreliable/morejs/util/LevelUtils.java b/Common/src/main/java/com/almostreliable/morejs/util/LevelUtils.java index d01565e..566328b 100644 --- a/Common/src/main/java/com/almostreliable/morejs/util/LevelUtils.java +++ b/Common/src/main/java/com/almostreliable/morejs/util/LevelUtils.java @@ -3,7 +3,7 @@ import com.mojang.datafixers.util.Pair; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.Registries; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.levelgen.structure.Structure; @@ -16,7 +16,7 @@ public class LevelUtils { public static BlockPos findStructure(BlockPos position, ServerLevel level, ResourceOrTag rot, int chunkRadius) { return level .registryAccess() - .registry(Registry.STRUCTURE_REGISTRY) + .registry(Registries.STRUCTURE) .flatMap(rot::asHolderSet) .map(holderSet -> level .getChunkSource() diff --git a/Common/src/main/resources/morejs.accesswidener b/Common/src/main/resources/morejs.accesswidener index cc9cf2a..9af47a5 100644 --- a/Common/src/main/resources/morejs.accesswidener +++ b/Common/src/main/resources/morejs.accesswidener @@ -16,3 +16,5 @@ accessible class net/minecraft/world/item/alchemy/PotionBrewing$Mix accessible field net/minecraft/world/item/alchemy/PotionBrewing$Mix from Ljava/lang/Object; accessible field net/minecraft/world/item/alchemy/PotionBrewing$Mix ingredient Lnet/minecraft/world/item/crafting/Ingredient; accessible field net/minecraft/world/item/alchemy/PotionBrewing$Mix to Ljava/lang/Object; + +accessible field net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate$StructureBlockInfo pos Lnet/minecraft/core/BlockPos;