Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ dependencies {
}

// Debug Binnies
compileOnly rfg.deobf("curse.maven:binnies-mods-patched-899182:5492997") // Binnie's Mods Patched 2.5.1.212
compileOnly rfg.deobf("curse.maven:binnies-mods-patched-899182:7731146") // Binnie's Mods Patched 2.5.1.213
if (project.debug_all.toBoolean() || project.debug_binnies.toBoolean()) {
runtimeOnly rfg.deobf("curse.maven:binnies-mods-patched-899182:5492997") // Binnie's Mods Patched 2.5.1.212
runtimeOnly rfg.deobf("curse.maven:binnies-mods-patched-899182:7731146") // Binnie's Mods Patched 2.5.1.213
}

// Debug EnderIO
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.github.gtexpert.gtbm.api.gui;

import net.minecraft.util.ResourceLocation;

import gregtech.api.gui.resources.TextureArea;

public class GTBMGuiTextures {
Expand All @@ -14,4 +16,16 @@ public class GTBMGuiTextures {
.fullImage("textures/gui/icon/gtbm_logo_blinking_yellow.png");
public static final TextureArea GTBM_LOGO_BLINKING_RED = TextureArea
.fullImage("textures/gui/icon/gtbm_logo_blinking_red.png");

// Bee status icon (from JEI)
public static final TextureArea BEE_INFO_ICON = new TextureArea(
new ResourceLocation("jei", "textures/gui/icons/info.png"), 0, 0, 1, 1);

// Bee slot overlays (directly from Gendustry's hint icons)
public static final TextureArea QUEEN_OVERLAY = new TextureArea(
new ResourceLocation("gendustry", "textures/items/hints/queen.png"), 0, 0, 1, 1);
public static final TextureArea DRONE_OVERLAY = new TextureArea(
new ResourceLocation("gendustry", "textures/items/hints/drone.png"), 0, 0, 1, 1);
public static final TextureArea UPGRADE_OVERLAY = new TextureArea(
new ResourceLocation("gendustry", "textures/items/hints/upgrade.png"), 0, 0, 1, 1);
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ public class ForestryConfigHolder {
"valid: [NORMAL, HARD]" })
public static String gameMode = "NORMAL";

@Config.Comment({ "If true, each will be uncraftable.", "default: false" })
public static boolean Still = false,
Fabricator = false,
Centrifuge = false,
Bottler = false,
Fermenter = false,
Rainmaker = false,
Carpenter = false,
Moistener = false,
Raintank = false,
Squeezer = false;
@Config.Comment({ "If true, each will be uncraftable.", "default: true" })
public static boolean Still = true,
Fabricator = true,
Centrifuge = true,
Bottler = true,
Fermenter = true,
Rainmaker = true,
Carpenter = true,
Moistener = true,
Raintank = true,
Squeezer = true,
FarmBlock = true;
Comment thread
tier940 marked this conversation as resolved.
Outdated
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.github.gtexpert.gtbm.integration.forestry.loaders.FFMOreDictionaryLoader;
import com.github.gtexpert.gtbm.integration.forestry.recipes.*;
import com.github.gtexpert.gtbm.integration.forestry.recipes.machines.*;
import com.github.gtexpert.gtbm.integration.forestry.util.BeeHousingInfoProvider;
import com.github.gtexpert.gtbm.module.Modules;

@TModule(
Expand All @@ -36,6 +37,11 @@ public void postInit(FMLPostInitializationEvent event) {
CarpenterLoader.initMode();
CentrifugeLoader.init();
FabricatorLoader.init();

// Register TOP provider for bee housing health display
if (Mods.TheOneProbe.isModLoaded()) {
mcjty.theoneprobe.TheOneProbe.theOneProbeImp.registerProvider(new BeeHousingInfoProvider());
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,24 @@ public class ForestryUtility {
public static float energyModifier = ForestryAPI.activeMode.getFloatSetting("energy.demand.modifier");
public static int feToEu = ConfigHolder.compat.energy.euToFeRatio;

/** Get ticks per bee work cycle from Forestry config. Default 550. */
public static int getTicksPerWorkCycle() {
return forestry.apiculture.ModuleApiculture.ticksPerBeeWorkCycle;
}

/** Effective ticks per health point, accounting for lifespan modifier. */
public static int getEffectiveTicksPerHealth(float lifespanModifier) {
return Math.round(getTicksPerWorkCycle() * lifespanModifier);
}

/** Format seconds as "Xm Ys" or "Xs". */
public static String formatTime(int totalSeconds) {
if (totalSeconds >= 60) {
return String.format("%dm %ds", totalSeconds / 60, totalSeconds % 60);
}
return totalSeconds + "s";
}

public static int timeCarpenter(int EUt) {
return Math.round(EUt * 204 * energyModifier / (100 * feToEu));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import gregtech.common.items.MetaItems;

import com.github.gtexpert.gtbm.api.util.Mods;
import com.github.gtexpert.gtbm.integration.forestry.ForestryConfigHolder;

import forestry.core.ModuleCore;
import forestry.core.items.EnumElectronTube;
Expand Down Expand Up @@ -69,6 +70,8 @@ public static void blockCharcoal() {
}

public static void farm() {
if (!ForestryConfigHolder.FarmBlock) return;
Comment thread
tier940 marked this conversation as resolved.
Outdated

BlockRegistryFarming blocks = getBlocks();

ItemStack basic = blocks.farm.get(EnumFarmBlockType.PLAIN, 1);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.github.gtexpert.gtbm.integration.forestry.util;

import javax.annotation.Nullable;

import net.bdew.gendustry.api.ApiaryModifiers;

import forestry.api.apiculture.DefaultBeeModifier;
import forestry.api.apiculture.IBeeGenome;

/**
* IBeeModifier implementation that delegates to ApiaryModifiers.
* Reusable bridge between Gendustry's upgrade system and Forestry's modifier interface.
* Override {@link #isHellish()} in subclass since it requires world/pos context.
*/
public class ApiaryModifierBridge extends DefaultBeeModifier {

protected final ApiaryModifiers modifiers;

public ApiaryModifierBridge(ApiaryModifiers modifiers) {
this.modifiers = modifiers;
}

@Override
public float getTerritoryModifier(IBeeGenome genome, float currentModifier) {
return Math.min(modifiers.territory, 5);
Comment thread
tier940 marked this conversation as resolved.
Outdated
}

@Override
public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) {
return modifiers.mutation;
}

@Override
public float getLifespanModifier(IBeeGenome genome, @Nullable IBeeGenome mate, float currentModifier) {
return modifiers.lifespan;
}

@Override
public float getProductionModifier(IBeeGenome genome, float currentModifier) {
return modifiers.production;
}

@Override
public float getFloweringModifier(IBeeGenome genome, float currentModifier) {
return modifiers.flowering;
}

@Override
public float getGeneticDecay(IBeeGenome genome, float currentModifier) {
return modifiers.geneticDecay;
}

@Override
public boolean isSealed() {
return modifiers.isSealed;
}

@Override
public boolean isSelfLighted() {
return modifiers.isSelfLighted;
}

@Override
public boolean isSunlightSimulated() {
return modifiers.isSunlightSimulated;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.github.gtexpert.gtbm.integration.forestry.util;

import javax.annotation.Nullable;

import net.bdew.gendustry.api.ApiaryModifiers;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;

import forestry.api.core.BiomeHelper;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;

/**
* Reusable climate calculation helper for bee housings.
* Combines biome data with ApiaryModifiers for temperature/humidity.
*/
public class BeeClimateHelper {

private final ApiaryModifiers modifiers;

public BeeClimateHelper(ApiaryModifiers modifiers) {
this.modifiers = modifiers;
}

@Nullable
public Biome getEffectiveBiome(@Nullable World world, BlockPos pos) {
if (modifiers.biomeOverride != null) return modifiers.biomeOverride;
return world != null ? world.getBiome(pos) : null;
}

public Biome getBiome(World world, BlockPos pos) {
Biome biome = getEffectiveBiome(world, pos);
return biome != null ? biome : world.getBiome(pos);
}

public EnumTemperature getTemperature(@Nullable World world, BlockPos pos) {
Biome biome = getEffectiveBiome(world, pos);
if (biome == null) return EnumTemperature.NORMAL;
if (BiomeHelper.isBiomeHellish(biome)) return EnumTemperature.HELLISH;
return EnumTemperature.getFromValue(biome.getTemperature(pos) + modifiers.temperature);
}

public EnumHumidity getHumidity(@Nullable World world, BlockPos pos) {
Biome biome = getEffectiveBiome(world, pos);
if (biome == null) return EnumHumidity.NORMAL;
return EnumHumidity.getFromValue(biome.getRainfall() + modifiers.humidity);
}

public boolean isHellish(@Nullable World world, BlockPos pos) {
Biome biome = getEffectiveBiome(world, pos);
return biome != null && BiomeHelper.isBiomeHellish(biome);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.github.gtexpert.gtbm.integration.forestry.util;

import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

import org.jetbrains.annotations.NotNull;

import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;

import com.github.gtexpert.gtbm.api.ModValues;

import forestry.api.apiculture.*;
import mcjty.theoneprobe.api.IProbeHitData;
import mcjty.theoneprobe.api.IProbeInfo;
import mcjty.theoneprobe.api.IProbeInfoProvider;
import mcjty.theoneprobe.api.ProbeMode;

/**
* TOP provider that shows queen health for any GT MTE implementing IBeeHousing.
*/
public class BeeHousingInfoProvider implements IProbeInfoProvider {

@Override
public String getID() {
return ModValues.MODID + ":bee_housing_provider";
}

@Override
public void addProbeInfo(@NotNull ProbeMode mode, @NotNull IProbeInfo probeInfo, @NotNull EntityPlayer player,
@NotNull World world, @NotNull IBlockState blockState, @NotNull IProbeHitData data) {
TileEntity te = world.getTileEntity(data.getPos());
if (!(te instanceof IGregTechTileEntity)) return;

var mte = ((IGregTechTileEntity) te).getMetaTileEntity();
if (!(mte instanceof IBeeHousing)) return;

IBeeHousing housing = (IBeeHousing) mte;
IBeeHousingInventory inv = housing.getBeeInventory();
if (inv.getQueen().isEmpty()) return;

IBeeRoot beeRoot = BeeManager.beeRoot;
if (beeRoot == null) return;

EnumBeeType type = beeRoot.getType(inv.getQueen());
if (type == EnumBeeType.QUEEN) {
IBee bee = beeRoot.getMember(inv.getQueen());
if (bee != null && bee.getMaxHealth() > 0) {
int health = bee.getHealth();
int maxHealth = bee.getMaxHealth();
int color = health > maxHealth / 4 ? 0xFF00D4CE : 0xFFBB1C28;
Comment thread
tier940 marked this conversation as resolved.
Outdated
probeInfo.progress(health, maxHealth, probeInfo.defaultProgressStyle()
.suffix(" / " + maxHealth + " HP")
.filledColor(color)
.alternateFilledColor(color)
.borderColor(0xFF555555));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package com.github.gtexpert.gtbm.integration.forestry.util;

import net.bdew.gendustry.api.ApiaryModifiers;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandlerModifiable;

import forestry.api.apiculture.EnumBeeType;
import forestry.api.apiculture.IBeeHousingInventory;
import forestry.api.apiculture.IBeeRoot;

/**
* Reusable product distribution logic for bee housings.
* Handles automated bee re-insertion and output slot management.
*/
public class BeeProductHelper {

/**
* Add a bee product to the housing's inventory.
* If automated, attempts to re-insert bees into queen/drone slots first.
*
* @param product the product to add
* @param beeRoot the bee root (nullable, skips automation if null)
* @param modifiers the apiary modifiers (checks isAutomated)
* @param autoBreeding whether auto-breeding is enabled (GT toggle button)
* @param beeInv the bee housing inventory (queen/drone access)
* @param importItems the import item handler (for drone merging)
* @param exportItems the export item handler (output slots)
* @return true if the product was fully inserted
*/
public static boolean addProduct(ItemStack product, IBeeRoot beeRoot, ApiaryModifiers modifiers,
boolean autoBreeding, IBeeHousingInventory beeInv,
IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems) {
if (product.isEmpty()) return true;

ItemStack remaining = product.copy();

if (beeRoot != null && beeRoot.isMember(remaining)) {
// Princess/Queen auto-insertion: controlled by autoBreeding button (master switch)
if (autoBreeding && (beeRoot.isMember(remaining, EnumBeeType.PRINCESS) ||
beeRoot.isMember(remaining, EnumBeeType.QUEEN))) {
if (beeInv.getQueen().isEmpty()) {
beeInv.setQueen(remaining);
return true;
}
}
// Drone auto-insertion: controlled by automation upgrade OR autoBreeding
if ((autoBreeding || modifiers.isAutomated) && beeRoot.isMember(remaining, EnumBeeType.DRONE)) {
if (beeInv.getDrone().isEmpty()) {
beeInv.setDrone(remaining);
return true;
}
ItemStack mergeResult = importItems.insertItem(1, remaining, false);
if (mergeResult.isEmpty()) return true;
remaining = mergeResult;
}
}

// Try to add to output slots
for (int i = 0; i < exportItems.getSlots(); i++) {
remaining = exportItems.insertItem(i, remaining, false);
if (remaining.isEmpty()) return true;
}
return remaining.isEmpty();
}
}
Loading