-
Notifications
You must be signed in to change notification settings - Fork 0
Industrial Apiary #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7b4b381
ApiaryのUI仮完成
tier940 ed1f633
fix
tier940 7634200
fix
tier940 5057c33
fix
tier940 d74f32e
fix
tier940 9bcce4f
fix
tier940 b7e3d40
fix
tier940 ebd29f7
GeminiのRV対応
tier940 19352d9
動作中エフェクト追加
tier940 2ff8979
エフェクト処理改善
tier940 5157b1b
Utilの再整理
tier940 9a66522
Update CHANGELOG.md
tier940 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
src/main/java/com/github/gtexpert/gtbm/integration/forestry/util/ApiaryModifierBridge.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
|
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; | ||
| } | ||
| } | ||
54 changes: 54 additions & 0 deletions
54
src/main/java/com/github/gtexpert/gtbm/integration/forestry/util/BeeClimateHelper.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
| } | ||
| } |
61 changes: 61 additions & 0 deletions
61
src/main/java/com/github/gtexpert/gtbm/integration/forestry/util/BeeHousingInfoProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
|
tier940 marked this conversation as resolved.
Outdated
|
||
| probeInfo.progress(health, maxHealth, probeInfo.defaultProgressStyle() | ||
| .suffix(" / " + maxHealth + " HP") | ||
| .filledColor(color) | ||
| .alternateFilledColor(color) | ||
| .borderColor(0xFF555555)); | ||
| } | ||
| } | ||
| } | ||
| } | ||
65 changes: 65 additions & 0 deletions
65
src/main/java/com/github/gtexpert/gtbm/integration/forestry/util/BeeProductHelper.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.