diff --git a/common/src/main/java/com/unlikepaladin/pfm/PaladinFurnitureMod.java b/common/src/main/java/com/unlikepaladin/pfm/PaladinFurnitureMod.java index 3004d80be..994e8ef18 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/PaladinFurnitureMod.java +++ b/common/src/main/java/com/unlikepaladin/pfm/PaladinFurnitureMod.java @@ -12,12 +12,14 @@ import com.unlikepaladin.pfm.data.materials.DynamicBlockRegistry; import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; +import com.unlikepaladin.pfm.mixin.PFMPointOfInterestTypeAccessor; import com.unlikepaladin.pfm.registry.BlockEntityRegistry; import com.unlikepaladin.pfm.registry.PaladinFurnitureModBlocksItems; import com.unlikepaladin.pfm.registry.dynamic.LateBlockRegistry; import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import com.unlikepaladin.pfm.utilities.Version; import dev.architectury.injectables.annotations.ExpectPlatform; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import net.minecraft.block.BlockState; import net.minecraft.block.enums.BedPart; import net.minecraft.item.ItemGroup; @@ -82,7 +84,8 @@ public static void replaceHomePOI() { newBedStates.addAll(originalBedStates); newBedStates.addAll(addedBedStates); PointOfInterestType.HOME.blockStates = ImmutableSet.copyOf(newBedStates); - addedBedStates.forEach(state -> PointOfInterestType.BLOCK_STATE_TO_POINT_OF_INTEREST_TYPE.put(state, PointOfInterestType.HOME)); + addedBedStates.forEach(state -> PFMPointOfInterestTypeAccessor.getBlockStateToPointOfInterestType().put(state, PointOfInterestType.HOME)); + PFMPointOfInterestTypeAccessor.setRegisteredStates(new ObjectOpenHashSet<>(PFMPointOfInterestTypeAccessor.getBlockStateToPointOfInterestType().keySet())); } @ExpectPlatform diff --git a/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMPointOfInterestTypeAccessor.java b/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMPointOfInterestTypeAccessor.java new file mode 100644 index 000000000..72503ed7f --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMPointOfInterestTypeAccessor.java @@ -0,0 +1,24 @@ +package com.unlikepaladin.pfm.mixin; + +import net.minecraft.block.BlockState; +import net.minecraft.world.poi.PointOfInterestType; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Mutable; +import org.spongepowered.asm.mixin.gen.Accessor; + +import java.util.Map; +import java.util.Set; + +@Mixin(PointOfInterestType.class) +public interface PFMPointOfInterestTypeAccessor { + @Accessor("BLOCK_STATE_TO_POINT_OF_INTEREST_TYPE") + static Map getBlockStateToPointOfInterestType() { + throw new AssertionError(); + } + + @Mutable + @Accessor("REGISTERED_STATES") + static void setRegisteredStates(Set states) { + throw new AssertionError(); + } +} diff --git a/common/src/main/resources/pfm-common.mixins.json b/common/src/main/resources/pfm-common.mixins.json index ed1ba3536..4a9e821c0 100644 --- a/common/src/main/resources/pfm-common.mixins.json +++ b/common/src/main/resources/pfm-common.mixins.json @@ -7,6 +7,7 @@ "PFMAbstractTagProvider$ObjectBuilderMixin", "PFMIngredientMatchingStacksAccessor", "PFMPlayerInventoryMixin", + "PFMPointOfInterestTypeAccessor", "PFMTextureKeyFactory" ], "server": [ diff --git a/common/src/main/resources/pfm.accesswidener b/common/src/main/resources/pfm.accesswidener index 34c862db5..8f3ee155f 100644 --- a/common/src/main/resources/pfm.accesswidener +++ b/common/src/main/resources/pfm.accesswidener @@ -1,9 +1,6 @@ accessWidener v1 named accessible class net/minecraft/recipe/CookingRecipeSerializer$RecipeFactory -accessible field net/minecraft/world/poi/PointOfInterestType BED_STATES Ljava/util/Set; -accessible method net/minecraft/world/poi/PointOfInterestType setup (Lnet/minecraft/world/poi/PointOfInterestType;)Lnet/minecraft/world/poi/PointOfInterestType; -mutable field net/minecraft/world/poi/PointOfInterestType HOME Lnet/minecraft/world/poi/PointOfInterestType; accessible method net/minecraft/data/server/BlockLootTableGenerator drops (Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/loot/LootTable$Builder; accessible method net/minecraft/data/server/BlockLootTableGenerator dropsWithProperty (Lnet/minecraft/block/Block;Lnet/minecraft/state/property/Property;Ljava/lang/Comparable;)Lnet/minecraft/loot/LootTable$Builder; accessible class net/minecraft/data/server/AbstractTagProvider$ObjectBuilder @@ -11,5 +8,4 @@ accessible method net/minecraft/client/render/item/ItemRenderer renderBakedItemM accessible field net/minecraft/client/resource/language/LanguageManager field_25291 Lnet/minecraft/client/resource/language/LanguageDefinition; accessible field net/minecraft/block/AbstractBlock$Settings material Lnet/minecraft/block/Material; accessible field net/minecraft/world/poi/PointOfInterestType blockStates Ljava/util/Set; -mutable field net/minecraft/world/poi/PointOfInterestType blockStates Ljava/util/Set; -accessible field net/minecraft/world/poi/PointOfInterestType BLOCK_STATE_TO_POINT_OF_INTEREST_TYPE Ljava/util/Map; \ No newline at end of file +mutable field net/minecraft/world/poi/PointOfInterestType blockStates Ljava/util/Set; \ No newline at end of file