Skip to content
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

Add Thaumic Energistics support to the Apimancers drainer #37

Merged
merged 6 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies {
compileOnly('com.github.GTNewHorizons:Baubles:1.0.4:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Botania:1.10.5-GTNH:api') {transitive = false}
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.53:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.43:dev')
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.6.1-GTNH:dev')
}

11 changes: 11 additions & 0 deletions src/main/java/magicbees/main/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import magicbees.tileentity.TileEntityMagicApiary;
import magicbees.tileentity.TileEntityManaAuraProvider;
import magicbees.tileentity.TileEntityVisAuraProvider;
import thaumicenergistics.api.ThEApi;

/**
* A class to hold some data related to mod state & functions.
Expand Down Expand Up @@ -166,6 +167,7 @@ public class Config {
// ---- Loaded mods -----------------------------------------
public static boolean isGTLoaded = Loader.isModLoaded("gregtech");
public static boolean isGTNHCoreModLoaded = Loader.isModLoaded("gregtech") && Loader.isModLoaded("dreamcraft");
public static boolean isThaumicEnergisticsLoaded = Loader.isModLoaded("thaumicenergistics");

public Config(File configFile) {
configuration = new Configuration(configFile);
Expand Down Expand Up @@ -226,6 +228,15 @@ public void setupItems() {
setupMiscForestryItemHooks();
}

public void setupThaumicEnergistics() {
if (isThaumicEnergisticsLoaded) {
try {
Class c = BlockApimancersDrainer.drainer;
OneEyeMaker marked this conversation as resolved.
Show resolved Hide resolved
ThEApi.instance().transportPermissions().addAspectStorageTileToExtractPermissions(c);
} catch (Exception ignored) {}
}
}

private void processConfigFile() {
// Pull config from Forestry via reflection
Field f;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/magicbees/main/MagicBees.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public void postInit(FMLPostInitializationEvent event) {
proxy.registerRenderers();

this.modConfig.saveConfigs();
this.modConfig.setupThaumicEnergistics();

CraftingManager.setupCrafting();
CraftingManager.registerLiquidContainers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;

import cpw.mods.fml.common.Optional;
import forestry.api.apiculture.EnumBeeType;
import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.apiculture.IBee;
Expand All @@ -22,8 +23,12 @@
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.aspects.IAspectContainer;
import thaumcraft.api.aspects.IEssentiaTransport;
import thaumicenergistics.api.storage.IAspectStorage;

public class TileEntityApimancersDrainerCommon extends TileEntity implements IAspectContainer, IEssentiaTransport {
@Optional.InterfaceList({
@Optional.Interface(iface = "thaumicenergistics.api.storage.IAspectStorage", modid = "thaumicenergistics") })
public class TileEntityApimancersDrainerCommon extends TileEntity
implements IEssentiaTransport, IAspectContainer, IAspectStorage {

public Aspect aspect;
public AspectList essentia = new AspectList();
Expand All @@ -38,6 +43,7 @@ public void setAspect(Aspect sAspect) {

@Override
public void updateEntity() {
super.updateEntity();
// If there's no stored aspect we shouldn't even check for the above block.
// We also don't need to run all the logic if the cabinet is full.
if (aspect == null || essentia.visSize() == maxAmount) return;
Expand Down Expand Up @@ -100,6 +106,18 @@ private void drainQueen(IBeeHousing housing, IBeeModifier modifier, IBee queen)
housing.getBeeInventory().getQueen().setTagCompound(nbttagcompound);
}

@Override
@Optional.Method(modid = "thaumicenergistics")
public int getContainerCapacity() {
return maxAmount;
}

@Override
@Optional.Method(modid = "thaumicenergistics")
public boolean doesShareCapacity() {
return true;
}

@Override
public AspectList getAspects() {
return this.essentia;
Expand Down
Loading