Skip to content

Commit

Permalink
add blast furnace and smoker block states also to PointOfInterestType…
Browse files Browse the repository at this point in the history
…s to support mods like Just Enough Professions
  • Loading branch information
cech12 committed Nov 10, 2020
1 parent 2ba9194 commit e545b7c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 11 additions & 8 deletions src/main/java/cech12/brickfurnace/BrickFurnaceMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -58,16 +59,18 @@ public static void registerRecipeSerializers(RegistryEvent.Register<IRecipeSeria

@SubscribeEvent
public static void registerVillagerWorkstations(RegistryEvent.Register<PointOfInterestType> 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<BlockState> getAllStates(Block blockIn) {
return ImmutableSet.copyOf(blockIn.getStateContainer().getValidStates());
private static void addBlockStatesToPOIType(PointOfInterestType poiType, Block block) {
Set<BlockState> poiTypeStates = new HashSet<>(poiType.blockStates);
Set<BlockState> 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);
}
}

}
3 changes: 2 additions & 1 deletion src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
public net.minecraft.item.crafting.CookingRecipeSerializer$IFactory
public net.minecraft.village.PointOfInterestType field_221073_u #POIT_BY_BLOCKSTATE
public net.minecraft.village.PointOfInterestType field_221073_u #POIT_BY_BLOCKSTATE
public-f net.minecraft.village.PointOfInterestType field_221075_w # blockStates

0 comments on commit e545b7c

Please sign in to comment.