Skip to content

Commit

Permalink
Add more blocks to things that can smoke beehives
Browse files Browse the repository at this point in the history
This pleases the yogurt guy
@Yoghurt4C
  • Loading branch information
Roadhog360 committed Oct 25, 2024
1 parent f44618b commit fad3ef4
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 7 deletions.
11 changes: 10 additions & 1 deletion src/main/java/ganymedes01/etfuturum/compat/ExternalContent.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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"),

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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<TileEntityBeeHive.Bee> 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()) {
Expand Down Expand Up @@ -109,21 +127,33 @@ public boolean isSmoked() {
}

public static boolean isLitCampfireBelow(World world, int x, int y, int z, int spacing) {
List<Block> 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<RegistryMapping<Block>> 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;
Expand Down

0 comments on commit fad3ef4

Please sign in to comment.