From fad3ef4815d591da9601f696f43a02e3b780dc0d Mon Sep 17 00:00:00 2001 From: roadhog360 Date: Thu, 24 Oct 2024 23:43:25 -0500 Subject: [PATCH] Add more blocks to things that can smoke beehives This pleases the yogurt guy @Yoghurt4c --- .../etfuturum/compat/ExternalContent.java | 11 ++++- .../tileentities/TileEntityBeeHive.java | 42 ++++++++++++++++--- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/src/main/java/ganymedes01/etfuturum/compat/ExternalContent.java b/src/main/java/ganymedes01/etfuturum/compat/ExternalContent.java index 598eb23e..5fca982f 100644 --- a/src/main/java/ganymedes01/etfuturum/compat/ExternalContent.java +++ b/src/main/java/ganymedes01/etfuturum/compat/ExternalContent.java @@ -11,9 +11,17 @@ public class ExternalContent { public enum Blocks { CFB_CAMPFIRE("campfirebackport", "campfire"), - CFB_SOUL_CAMPFIRE("campfirebackport", "soul_campfire"), CFB_CAMPFIRE_BASE("campfirebackport", "campfire_base"), + CFB_SOUL_CAMPFIRE("campfirebackport", "soul_campfire"), CFB_SOUL_CAMPFIRE_BASE("campfirebackport", "soul_campfire_base"), + CFB_FOXFIRE_CAMPFIRE("campfirebackport", "foxfire_campfire"), + CFB_FOXFIRE_CAMPFIRE_BASE("campfirebackport", "foxfire_campfire_base"), + CFB_SHADOW_CAMPFIRE("campfirebackport", "shadow_campfire"), + CFB_SHADOW_CAMPFIRE_BASE("campfirebackport", "shadow_campfire_base"), + + BAMBOO_CAMPFIRE("BambooMod", "campfire"), + + ECRU_LEAVES_FIRE("mod_ecru_MapleTree", "ecru_BlockFallenLeavesFire"), TCON_GRAVEL_ORE("TConstruct", "GravelOre"), TCON_MULTIBRICK("TConstruct", "decoration.multibrick"), @@ -38,6 +46,7 @@ public enum Blocks { ARS_MAGICA_2_ORE("arsmagica2", "vinteumOre"), THAUMCRAFT_ORE("Thaumcraft", "blockCustomOre"), + THAUMCRAFT_AIRY("Thaumcraft", "blockAiry"), BOP_GEM_ORE("BiomesOPlenty", "gemOre"), diff --git a/src/main/java/ganymedes01/etfuturum/tileentities/TileEntityBeeHive.java b/src/main/java/ganymedes01/etfuturum/tileentities/TileEntityBeeHive.java index 2ce26b14..72fbc28d 100644 --- a/src/main/java/ganymedes01/etfuturum/tileentities/TileEntityBeeHive.java +++ b/src/main/java/ganymedes01/etfuturum/tileentities/TileEntityBeeHive.java @@ -1,12 +1,16 @@ package ganymedes01.etfuturum.tileentities; import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import ganymedes01.etfuturum.api.mappings.RegistryMapping; import ganymedes01.etfuturum.blocks.BlockBeeHive; import ganymedes01.etfuturum.compat.ExternalContent; import ganymedes01.etfuturum.compat.ModsList; import ganymedes01.etfuturum.core.utils.helpers.BlockPos; import ganymedes01.etfuturum.entities.EntityBee; import ganymedes01.etfuturum.lib.Reference; +import ganymedes01.etfuturum.recipes.ModRecipes; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; @@ -18,15 +22,29 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import net.minecraftforge.oredict.OreDictionary; import java.util.Iterator; import java.util.List; +import java.util.Map; +import java.util.Set; public class TileEntityBeeHive extends TileEntity { private final List bees = Lists.newArrayList(); private BlockPos flowerPos = null; private int honeyLevel = 0; + public TileEntityBeeHive() { + addSmokeBlock(ExternalContent.Blocks.CFB_CAMPFIRE.get()); + addSmokeBlock(ExternalContent.Blocks.CFB_SOUL_CAMPFIRE.get()); + addSmokeBlock(ExternalContent.Blocks.CFB_FOXFIRE_CAMPFIRE.get()); + addSmokeBlock(ExternalContent.Blocks.CFB_SHADOW_CAMPFIRE.get()); + + addSmokeBlock(ExternalContent.Blocks.BAMBOO_CAMPFIRE.get()); + addSmokeBlock(ExternalContent.Blocks.ECRU_LEAVES_FIRE.get()); + addSmokeBlock(ExternalContent.Blocks.THAUMCRAFT_AIRY.get()); + } + @Override public void markDirty() { if (this.isNearFire()) { @@ -109,21 +127,33 @@ public boolean isSmoked() { } public static boolean isLitCampfireBelow(World world, int x, int y, int z, int spacing) { - List fires = Lists.newArrayList(); - if (ModsList.CAMPFIRE_BACKPORT.isLoaded()) { - fires.add(ExternalContent.Blocks.CFB_CAMPFIRE.get()); - fires.add(ExternalContent.Blocks.CFB_SOUL_CAMPFIRE.get()); - } for (int i = 1; i <= spacing; i++) { Block block = world.getBlock(x, y - i, z); if (block.isOpaqueCube()) break; - if (fires.contains(block) || (fires.isEmpty() && block.getMaterial() == Material.fire)) { + int meta = world.getBlockMetadata(x, y - i, z); + if ((TEMPORARY_FIRES_LIST.isEmpty() && block.getMaterial() == Material.fire) || TEMPORARY_FIRES_LIST.contains(RegistryMapping.getKeyFor(block, meta))) { return true; } } return false; } + /** + * Will be replaced when HogUtils exists and has tags. Has an adder func so people can add fires, will redirect to using the tag when HogUtils gets them. + * Don't reflect into this directly, please use the adder. This set will be removed in a future version. + */ + private static final Set> TEMPORARY_FIRES_LIST = Sets.newHashSet(); + + public static void addSmokeBlock(Block block) { + addSmokeBlock(block, OreDictionary.WILDCARD_VALUE); + } + + public static void addSmokeBlock(Block block, int meta) { + if(ModRecipes.validateItems(block)) { + TEMPORARY_FIRES_LIST.add(new RegistryMapping<>(block, meta)); + } + } + public void tryEnterHive(Entity p_226962_1_, boolean p_226962_2_, int p_226962_3_) { if (getBeeCount() < maxHiveSize() && p_226962_1_ instanceof EntityBee) { p_226962_1_.riddenByEntity = null;