From e545b7c605c52b5bd71246e7c1691b70d80e3b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Vo=C3=9F?= Date: Tue, 10 Nov 2020 15:33:49 +0100 Subject: [PATCH] add blast furnace and smoker block states also to PointOfInterestTypes to support mods like Just Enough Professions --- gradle.properties | 2 +- .../cech12/brickfurnace/BrickFurnaceMod.java | 19 +++++++++++-------- .../resources/META-INF/accesstransformer.cfg | 3 ++- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/gradle.properties b/gradle.properties index 2a3003e..2688ce6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false -mod_version=1.5.0 +mod_version=1.5.1 minecraft_version=1.16.1+ forge_version=1.16.1-32.0.70 diff --git a/src/main/java/cech12/brickfurnace/BrickFurnaceMod.java b/src/main/java/cech12/brickfurnace/BrickFurnaceMod.java index e6267a2..f2f83a2 100644 --- a/src/main/java/cech12/brickfurnace/BrickFurnaceMod.java +++ b/src/main/java/cech12/brickfurnace/BrickFurnaceMod.java @@ -22,6 +22,7 @@ import net.minecraftforge.fml.loading.FMLPaths; import net.minecraftforge.registries.ForgeRegistries; +import java.util.HashSet; import java.util.Set; import static cech12.brickfurnace.BrickFurnaceMod.MOD_ID; @@ -58,16 +59,18 @@ public static void registerRecipeSerializers(RegistryEvent.Register event) { - for (BlockState state : getAllStates(BrickFurnaceBlocks.BRICK_BLAST_FURNACE)) { - PointOfInterestType.POIT_BY_BLOCKSTATE.put(state, PointOfInterestType.ARMORER); - } - for (BlockState state : getAllStates(BrickFurnaceBlocks.BRICK_SMOKER)) { - PointOfInterestType.POIT_BY_BLOCKSTATE.put(state, PointOfInterestType.BUTCHER); - } + addBlockStatesToPOIType(PointOfInterestType.ARMORER, BrickFurnaceBlocks.BRICK_BLAST_FURNACE); + addBlockStatesToPOIType(PointOfInterestType.BUTCHER, BrickFurnaceBlocks.BRICK_SMOKER); } - private static Set getAllStates(Block blockIn) { - return ImmutableSet.copyOf(blockIn.getStateContainer().getValidStates()); + private static void addBlockStatesToPOIType(PointOfInterestType poiType, Block block) { + Set poiTypeStates = new HashSet<>(poiType.blockStates); + Set blockStates = new HashSet<>(block.getStateContainer().getValidStates()); + poiTypeStates.addAll(blockStates); + poiType.blockStates = ImmutableSet.copyOf(poiTypeStates); + for (BlockState state : blockStates) { + PointOfInterestType.POIT_BY_BLOCKSTATE.put(state, poiType); + } } } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index a19b974..378bfc8 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -1,2 +1,3 @@ public net.minecraft.item.crafting.CookingRecipeSerializer$IFactory -public net.minecraft.village.PointOfInterestType field_221073_u #POIT_BY_BLOCKSTATE \ No newline at end of file +public net.minecraft.village.PointOfInterestType field_221073_u #POIT_BY_BLOCKSTATE +public-f net.minecraft.village.PointOfInterestType field_221075_w # blockStates