mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-16 10:34:53 +00:00
BuildCraft support (#2158)
This commit is contained in:
1 parent
4515aa513a
commit
8feb3500a4
60 files changed
+1423
-767
No files matched your search
+10
-6
@@ -21,7 +21,7 @@ version = version_major + '.' + version_minor + '.' + version_patch + '.' + getB
|
||||
if (project.hasProperty('buildQualifier')) {
|
||||
version = project.version + '-' + project.buildQualifier
|
||||
}
|
||||
group= "net.sengir.forestry" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
group = "net.sengir.forestry" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = "forestry_" + mcversion
|
||||
|
||||
ext.dirDest = './build/dist'
|
||||
@@ -40,6 +40,9 @@ minecraft {
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url = 'http://maven.mcmoddev.com'
|
||||
}
|
||||
maven {
|
||||
url "http://dvs1.progwml6.com/files/maven"
|
||||
}
|
||||
@@ -52,8 +55,7 @@ repositories {
|
||||
url = "http://maven.modmuss50.me"
|
||||
}
|
||||
maven {
|
||||
|
||||
url 'http://maven.mcmoddev.com'
|
||||
url = 'https://mod-buildcraft.com/maven'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +65,8 @@ dependencies {
|
||||
runtime "mezz.jei:jei_${jei_mcversion}:${jei_version}"
|
||||
deobfCompile "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||
deobfCompile "TechReborn:TechReborn-${TR_mcversion}:${TR_version}:api"
|
||||
deobfProvided "com.mod-buildcraft:buildcraft-api:${buildcraft_version}"
|
||||
runtimeOnly "com.mod-buildcraft:buildcraft:${buildcraft_version}"
|
||||
}
|
||||
|
||||
configurations {
|
||||
@@ -81,7 +85,7 @@ processResources {
|
||||
include 'mcmod.info'
|
||||
|
||||
// replace version and mcversion
|
||||
expand 'version':project.version, 'mcversion':project.minecraft.version
|
||||
expand 'version': project.version, 'mcversion': project.minecraft.version
|
||||
}
|
||||
|
||||
// copy everything else, thats not the mcmod.info
|
||||
@@ -131,7 +135,7 @@ uploadArchives {
|
||||
repositories {
|
||||
if (project.hasProperty('mavenDir')) {
|
||||
mavenDeployer {
|
||||
repository(url: "file://"+mavenDir)
|
||||
repository(url: "file://" + mavenDir)
|
||||
}
|
||||
} else {
|
||||
println 'Archives upload disabled, mavenDir in gradle.properties is missing.'
|
||||
@@ -147,7 +151,7 @@ task makeChangelog(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) {
|
||||
filePath = "changelog.html"
|
||||
untaggedName = "Current release ${project.version}"
|
||||
fromCommit = "5a3850c2642e535656d090d1473054d5fa8d3331"
|
||||
toRef = "HEAD"
|
||||
toRef = "HEAD"
|
||||
templateContent = file('changelog.mustache').getText('UTF-8')
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ jei_mcversion=1.12.2
|
||||
ic2_version=2.8.24-ex112
|
||||
TR_mcversion=1.12.2
|
||||
TR_version=2.13.2.561
|
||||
buildcraft_version=7.99.17
|
||||
version_major=5
|
||||
version_minor=8
|
||||
version_patch=0
|
||||
@@ -15,6 +15,11 @@ import com.google.common.base.Preconditions;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
|
||||
import forestry.plugins.ForestryCompatPlugins;
|
||||
import forestry.plugins.PluginBuildCraftFuels;
|
||||
import forestry.plugins.PluginIC2;
|
||||
import forestry.plugins.PluginNatura;
|
||||
import forestry.plugins.PluginTechReborn;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
@@ -53,10 +58,6 @@ import forestry.core.utils.MigrationHelper;
|
||||
import forestry.core.worldgen.WorldGenerator;
|
||||
import forestry.modules.ForestryModules;
|
||||
import forestry.modules.ModuleManager;
|
||||
import forestry.plugins.ForestryCompatPlugins;
|
||||
import forestry.plugins.PluginIC2;
|
||||
import forestry.plugins.PluginNatura;
|
||||
import forestry.plugins.PluginTechReborn;
|
||||
|
||||
/**
|
||||
* Forestry Minecraft Mod
|
||||
@@ -74,7 +75,8 @@ import forestry.plugins.PluginTechReborn;
|
||||
+ "after:" + PluginIC2.MOD_ID + ";"
|
||||
+ "after:" + PluginNatura.MOD_ID + ";"
|
||||
+ "after:toughasnails;"
|
||||
+ "after:" + PluginTechReborn.MOD_ID + ";")
|
||||
+ "after:" + PluginTechReborn.MOD_ID + ";"
|
||||
+ "after:" + PluginBuildCraftFuels.MOD_ID + ";")
|
||||
public class Forestry {
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
|
||||
@@ -13,14 +13,6 @@ package forestry.apiculture;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.BlockFlowerPot;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
@@ -42,7 +34,6 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.IChunkGenerator;
|
||||
import net.minecraft.world.storage.loot.LootTableList;
|
||||
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -50,14 +41,22 @@ import net.minecraftforge.common.brewing.BrewingRecipeRegistry;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.Forestry;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
@@ -108,6 +107,7 @@ import forestry.apiculture.multiblock.TileAlvearySwarmer;
|
||||
import forestry.apiculture.network.PacketRegistryApiculture;
|
||||
import forestry.apiculture.tiles.TileCandle;
|
||||
import forestry.apiculture.tiles.TileHive;
|
||||
import forestry.apiculture.trigger.ApicultureTriggers;
|
||||
import forestry.apiculture.worldgen.HiveDecorator;
|
||||
import forestry.apiculture.worldgen.HiveDescription;
|
||||
import forestry.apiculture.worldgen.HiveGenHelper;
|
||||
@@ -246,11 +246,10 @@ public class ModuleApiculture extends BlankForestryModule {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
// @Override
|
||||
// public void registerTriggers() {
|
||||
// ApicultureTriggers.initialize();
|
||||
// }
|
||||
@Override
|
||||
public void registerTriggers() {
|
||||
ApicultureTriggers.initialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doInit() {
|
||||
|
||||
@@ -10,8 +10,24 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.multiblock;
|
||||
|
||||
//@Optional.Interface(iface = "buildcraft.api.statements.ITriggerProvider", modid = "BuildCraftAPI|statements")
|
||||
public class TileAlvearyPlain extends TileAlveary {//implements ITriggerProvider {
|
||||
import forestry.core.config.Constants;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import buildcraft.api.statements.ITriggerInternal;
|
||||
import buildcraft.api.statements.ITriggerInternalSided;
|
||||
import buildcraft.api.statements.ITriggerProvider;
|
||||
import forestry.apiculture.trigger.ApicultureTriggers;
|
||||
|
||||
@Optional.Interface(iface = "buildcraft.api.statements.ITriggerProvider", modid = Constants.BCLIB_MOD_ID)
|
||||
public class TileAlvearyPlain extends TileAlveary implements ITriggerProvider {
|
||||
|
||||
@Override
|
||||
public boolean allowsAutomation() {
|
||||
@@ -19,19 +35,18 @@ public class TileAlvearyPlain extends TileAlveary {//implements ITriggerProvider
|
||||
}
|
||||
|
||||
/* ITRIGGERPROVIDER */
|
||||
// TODO: buildcraft for 1.9
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerInternal> getInternalTriggers(IStatementContainer container) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
// Collection<ITriggerExternal> res = new ArrayList<>();
|
||||
// res.add(ApicultureTriggers.missingQueen);
|
||||
// res.add(ApicultureTriggers.missingDrone);
|
||||
// return res;
|
||||
// }
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
@Override
|
||||
public void addInternalTriggers(Collection<ITriggerInternal> triggers, IStatementContainer container) { }
|
||||
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
@Override
|
||||
public void addInternalSidedTriggers(Collection<ITriggerInternalSided> triggers, IStatementContainer container, @Nonnull EnumFacing side) { }
|
||||
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
@Override
|
||||
public void addExternalTriggers(Collection<ITriggerExternal> triggers, @Nonnull EnumFacing side, TileEntity tile) {
|
||||
triggers.add(ApicultureTriggers.missingQueen);
|
||||
triggers.add(ApicultureTriggers.missingDrone);
|
||||
}
|
||||
}
|
||||
@@ -10,11 +10,26 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.tiles;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import forestry.api.apiculture.IBeeHousingInventory;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
@@ -26,13 +41,7 @@ import forestry.apiculture.gui.ContainerBeeHousing;
|
||||
import forestry.apiculture.gui.GuiBeeHousing;
|
||||
import forestry.apiculture.inventory.IApiaryInventory;
|
||||
import forestry.apiculture.inventory.InventoryApiary;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import forestry.apiculture.trigger.ApicultureTriggers;
|
||||
|
||||
public class TileApiary extends TileBeeHousingBase implements IApiary {
|
||||
private final IBeeModifier beeModifier = new ApiaryBeeModifier();
|
||||
@@ -76,16 +85,14 @@ public class TileApiary extends TileBeeHousingBase implements IApiary {
|
||||
}
|
||||
|
||||
/* ITRIGGERPROVIDER */
|
||||
// TODO: buildcraft for 1.9
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
// LinkedList<ITriggerExternal> res = new LinkedList<>();
|
||||
// res.add(ApicultureTriggers.missingQueen);
|
||||
// res.add(ApicultureTriggers.missingDrone);
|
||||
// res.add(ApicultureTriggers.noFrames);
|
||||
// return res;
|
||||
// }
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
@Override
|
||||
public void addExternalTriggers(Collection<ITriggerExternal> triggers, @Nonnull EnumFacing side, TileEntity tile) {
|
||||
super.addExternalTriggers(triggers, side, tile);
|
||||
triggers.add(ApicultureTriggers.missingQueen);
|
||||
triggers.add(ApicultureTriggers.missingDrone);
|
||||
triggers.add(ApicultureTriggers.noFrames);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -10,16 +10,17 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.trigger;
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
import forestry.core.triggers.Trigger;
|
||||
|
||||
public class ApicultureTriggers {
|
||||
// public static Trigger noFrames;
|
||||
// public static Trigger missingQueen;
|
||||
// public static Trigger missingDrone;
|
||||
//
|
||||
// public static void initialize() {
|
||||
// noFrames = new TriggerNoFrames();
|
||||
//
|
||||
// missingQueen = new TriggerMissingQueen();
|
||||
// missingDrone = new TriggerMissingDrone();
|
||||
// }
|
||||
public static Trigger noFrames;
|
||||
public static Trigger missingQueen;
|
||||
public static Trigger missingDrone;
|
||||
|
||||
public static void initialize() {
|
||||
noFrames = new TriggerNoFrames();
|
||||
|
||||
missingQueen = new TriggerMissingQueen();
|
||||
missingDrone = new TriggerMissingDrone();
|
||||
}
|
||||
}
|
||||
@@ -10,25 +10,33 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.trigger;
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
public class TriggerMissingDrone {//extends Trigger {
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
// public TriggerMissingDrone() {
|
||||
// super("missingDrone");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Return true if the tile given in parameter activates the trigger, given the parameters.
|
||||
// */
|
||||
// @Override
|
||||
// public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
//
|
||||
// if (!(tile instanceof IErrorLogicSource)) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// IErrorLogicSource apiary = (IErrorLogicSource) tile;
|
||||
// return apiary.getErrorLogic().contains(EnumErrorCode.NO_DRONE);
|
||||
// }
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.triggers.Trigger;
|
||||
|
||||
public class TriggerMissingDrone extends Trigger {
|
||||
|
||||
public TriggerMissingDrone() {
|
||||
super("missingDrone", "missing_drone");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the tile given in parameter activates the trigger, given the parameters.
|
||||
*/
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
|
||||
if (!(tile instanceof IErrorLogicSource)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
IErrorLogicSource apiary = (IErrorLogicSource) tile;
|
||||
return apiary.getErrorLogic().contains(EnumErrorCode.NO_DRONE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,24 +10,32 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.trigger;
|
||||
|
||||
public class TriggerMissingQueen {//extends Trigger {
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
// public TriggerMissingQueen() {
|
||||
// super("missingQueen");
|
||||
// }
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.triggers.Trigger;
|
||||
|
||||
public class TriggerMissingQueen extends Trigger {
|
||||
|
||||
public TriggerMissingQueen() {
|
||||
super("missingQueen", "missing_queen");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the tile given in parameter activates the trigger, given the parameters.
|
||||
*/
|
||||
// TODO: buildcraft for 1.9
|
||||
// @Override
|
||||
// public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
//
|
||||
// if (!(tile instanceof IErrorLogicSource)) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// IErrorLogicSource apiary = (IErrorLogicSource) tile;
|
||||
// return apiary.getErrorLogic().contains(EnumErrorCode.NO_QUEEN);
|
||||
// }
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
|
||||
if (!(tile instanceof IErrorLogicSource)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
IErrorLogicSource apiary = (IErrorLogicSource) tile;
|
||||
return apiary.getErrorLogic().contains(EnumErrorCode.NO_QUEEN);
|
||||
}
|
||||
}
|
||||
@@ -10,28 +10,36 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.trigger;
|
||||
|
||||
public class TriggerNoFrames {//extends Trigger {
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
// public TriggerNoFrames() {
|
||||
// super("noFrames");
|
||||
// }
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import forestry.apiculture.inventory.InventoryApiary;
|
||||
import forestry.apiculture.tiles.TileApiary;
|
||||
import forestry.core.triggers.Trigger;
|
||||
|
||||
public class TriggerNoFrames extends Trigger {
|
||||
|
||||
public TriggerNoFrames() {
|
||||
super("noFrames", "no_frames");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the tile given in parameter activates the trigger, given the parameters.
|
||||
*/
|
||||
// TODO: buildcraft for 1.9
|
||||
// @Override
|
||||
// public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
//
|
||||
// if (!(tile instanceof TileApiary)) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// TileApiary apiary = (TileApiary) tile;
|
||||
//
|
||||
// InventoryApiary inventory = (InventoryApiary) apiary.getInternalInventory();
|
||||
//
|
||||
// return inventory.getFrames().isEmpty();
|
||||
// }
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
|
||||
if (!(tile instanceof TileApiary)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileApiary apiary = (TileApiary) tile;
|
||||
|
||||
InventoryApiary inventory = (InventoryApiary) apiary.getInternalInventory();
|
||||
|
||||
return inventory.getFrames().isEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package forestry.core.capabilities;
|
||||
|
||||
import buildcraft.api.tiles.IHasWork;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.tiles.TilePowered;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
@Optional.Interface(iface = "buildcraft.api.tiles.IHasWork", modid = Constants.BCLIB_MOD_ID)
|
||||
public class HasWorkWrapper implements IHasWork {
|
||||
|
||||
@CapabilityInject(IHasWork.class)
|
||||
public static Capability<IHasWork> CAPABILITY_HAS_WORK;
|
||||
|
||||
private final TilePowered self;
|
||||
|
||||
public HasWorkWrapper(TilePowered self) {
|
||||
this.self = self;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasWork() {
|
||||
return self.hasWork();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -66,10 +66,10 @@ public class Config {
|
||||
// Graphics
|
||||
public static boolean enableParticleFX = true;
|
||||
|
||||
//Humus
|
||||
// Humus
|
||||
public static int humusDegradeDelimiter = 3;
|
||||
|
||||
//Greenhouse
|
||||
// Greenhouse
|
||||
public static int climateSourceRange = 36;
|
||||
public static float climateSourceEnergyModifier = 1.5F;
|
||||
public static int greenhouseSize = 4;
|
||||
@@ -143,6 +143,12 @@ public class Config {
|
||||
public static final LinkedListMultimap<String, String> hints = LinkedListMultimap.create();
|
||||
public static boolean enableEnergyStat = true;
|
||||
|
||||
// Energy
|
||||
public static boolean enableRF = true;
|
||||
public static boolean enableMJ = true;
|
||||
public static boolean enableTesla = true;
|
||||
public static EnergyDisplayMode energyDisplayMode = EnergyDisplayMode.RF;
|
||||
|
||||
public static boolean isStructureEnabled(String uid) {
|
||||
return !Config.disabledStructures.contains(uid);
|
||||
}
|
||||
@@ -214,7 +220,7 @@ public class Config {
|
||||
|
||||
public static void load(Side side) {
|
||||
File configCommonFile = new File(Forestry.instance.getConfigFolder(), CATEGORY_COMMON + ".cfg");
|
||||
configCommon = new LocalizedConfiguration(configCommonFile, "1.2.0");
|
||||
configCommon = new LocalizedConfiguration(configCommonFile, "1.2.1");
|
||||
loadConfigCommon(side);
|
||||
|
||||
File configFluidsFile = new File(Forestry.instance.getConfigFolder(), CATEGORY_FLUIDS + ".cfg");
|
||||
@@ -248,13 +254,13 @@ public class Config {
|
||||
// Make sure the default mode files are there.
|
||||
|
||||
File opMode = new File(Forestry.instance.getConfigFolder(), "gamemodes/OP.cfg");
|
||||
CopyFileToFS(opMode, "/config/forestry/gamemodes/OP.cfg");
|
||||
copyFileToFS(opMode, "/config/forestry/gamemodes/OP.cfg");
|
||||
|
||||
File normalMode = new File(Forestry.instance.getConfigFolder(), "gamemodes/NORMAL.cfg");
|
||||
CopyFileToFS(normalMode, "/config/forestry/gamemodes/NORMAL.cfg");
|
||||
copyFileToFS(normalMode, "/config/forestry/gamemodes/NORMAL.cfg");
|
||||
|
||||
File hardMode = new File(Forestry.instance.getConfigFolder(), "gamemodes/HARD.cfg");
|
||||
CopyFileToFS(hardMode, "/config/forestry/gamemodes/HARD.cfg");
|
||||
copyFileToFS(hardMode, "/config/forestry/gamemodes/HARD.cfg");
|
||||
}
|
||||
|
||||
// RetroGen
|
||||
@@ -377,6 +383,13 @@ public class Config {
|
||||
|
||||
spawnWithBook = configCommon.getBooleanLocalized("tweaks.book", "spawn", spawnWithBook);
|
||||
|
||||
enableRF = configCommon.getBooleanLocalized("power.types", "rf", true);
|
||||
enableMJ = configCommon.getBooleanLocalized("power.types", "mj", true);
|
||||
enableTesla = configCommon.getBooleanLocalized("power.types", "tesla", true);
|
||||
|
||||
energyDisplayMode = configCommon.getEnumLocalized("power.display", "mode", EnergyDisplayMode.RF, EnergyDisplayMode.values());
|
||||
|
||||
|
||||
configCommon.save();
|
||||
}
|
||||
|
||||
@@ -402,7 +415,7 @@ public class Config {
|
||||
configFluid.save();
|
||||
}
|
||||
|
||||
private static void CopyFileToFS(File destination, String resourcePath) {
|
||||
private static void copyFileToFS(File destination, String resourcePath) {
|
||||
InputStream stream = Config.class.getResourceAsStream(resourcePath);
|
||||
OutputStream outstream;
|
||||
int readBytes;
|
||||
|
||||
@@ -27,6 +27,7 @@ public class Constants implements IForestryConstants {
|
||||
|
||||
public static final String RF_MOD_ID = "CoFHAPI|energy";
|
||||
public static final String TESLA_MOD_ID = "tesla";
|
||||
public static final String BCLIB_MOD_ID = "buildcraftlib";
|
||||
|
||||
public static final int FLAG_BLOCK_UPDATE = 1;
|
||||
public static final int FLAG_BLOCK_SYNC = 2;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package forestry.core.config;
|
||||
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
public enum EnergyDisplayMode {
|
||||
RF("RF", 1),
|
||||
FE("FE", 1),
|
||||
MJ("MJ", 0.1f),
|
||||
TESLA("T", 1);
|
||||
|
||||
private final String energyName;
|
||||
private final float factor;
|
||||
|
||||
EnergyDisplayMode(String energyName, float factor) {
|
||||
this.energyName = energyName;
|
||||
this.factor = factor;
|
||||
}
|
||||
|
||||
public String formatRate(int energy) {
|
||||
String amountString = formatEnergyNum(energy);
|
||||
return String.format("%s %s/t", amountString, energyName);
|
||||
}
|
||||
|
||||
public String formatEnergyValue(int energy) {
|
||||
String amountString = formatEnergyNum(energy);
|
||||
return String.format("%s %s", amountString, energyName);
|
||||
}
|
||||
|
||||
private String formatEnergyNum(int energy) {
|
||||
Locale locale = MinecraftForgeClient.getLocale();
|
||||
NumberFormat numberFormat = NumberFormat.getIntegerInstance(locale);
|
||||
float amount = energy * factor;
|
||||
return numberFormat.format(amount);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.gui.ledgers;
|
||||
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.render.TextureManagerForestry;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.energy.EnergyManager;
|
||||
@@ -41,18 +42,18 @@ public class PowerLedger extends Ledger {
|
||||
drawHeader(Translator.translateToLocal("for.gui.energy"), xHeader, y + 8);
|
||||
|
||||
drawSubheader(Translator.translateToLocal("for.gui.stored") + ':', xBody, y + 20);
|
||||
drawText(energyManager.getEnergyStored() + " RF", xBody, y + 32);
|
||||
drawText(Config.energyDisplayMode.formatEnergyValue(energyManager.getEnergyStored()), xBody, y + 32);
|
||||
|
||||
drawSubheader(Translator.translateToLocal("for.gui.maxenergy") + ':', xBody, y + 44);
|
||||
drawText(energyManager.getMaxEnergyStored() + " RF", xBody, y + 56);
|
||||
drawText(Config.energyDisplayMode.formatEnergyValue(energyManager.getMaxEnergyStored()), xBody, y + 56);
|
||||
|
||||
drawSubheader(Translator.translateToLocal("for.gui.maxenergyreceive") + ':', xBody, y + 68);
|
||||
drawText(energyManager.getMaxEnergyReceived() + " RF", xBody, y + 80);
|
||||
drawText(Config.energyDisplayMode.formatEnergyValue(energyManager.getMaxEnergyReceived()), xBody, y + 80);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return energyManager.getEnergyStored() + " RF";
|
||||
return Config.energyDisplayMode.formatEnergyValue(energyManager.getEnergyStored());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,16 +10,21 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.items;
|
||||
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
import forestry.core.config.Constants;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
//@Optional.Interface(iface = "buildcraft.api.tools.IToolWrench", modid = "BuildCraftAPI|tools")
|
||||
public class ItemWrench extends ItemForestry {//implements IToolWrench {
|
||||
@Optional.Interface(iface = "buildcraft.api.tools.IToolWrench", modid = Constants.BCLIB_MOD_ID)
|
||||
public class ItemWrench extends ItemForestry implements IToolWrench {
|
||||
|
||||
public ItemWrench() {
|
||||
setHarvestLevel("wrench", 0);
|
||||
@@ -35,23 +40,11 @@ public class ItemWrench extends ItemForestry {//implements IToolWrench {
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public boolean canWrench(EntityPlayer player, BlockPos pos) {
|
||||
public boolean canWrench(EntityPlayer player, EnumHand hand, ItemStack wrench, RayTraceResult rayTrace) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wrenchUsed(EntityPlayer player, BlockPos pos) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrench(EntityPlayer entityPlayer, Entity entity) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wrenchUsed(EntityPlayer entityPlayer, Entity entity) {
|
||||
}
|
||||
*/
|
||||
public void wrenchUsed(EntityPlayer player, EnumHand hand, ItemStack wrench, RayTraceResult rayTrace) {}
|
||||
}
|
||||
@@ -14,12 +14,15 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.gui.GuiHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public abstract class TileBase extends TileForestry {
|
||||
|
||||
public void openGui(EntityPlayer player, ItemStack heldItem) {
|
||||
@@ -41,4 +44,10 @@ public abstract class TileBase extends TileForestry {
|
||||
Block newBlock = newState.getBlock();
|
||||
return oldBlock != newBlock || !(oldBlock instanceof BlockBase) || !(newBlock instanceof BlockBase);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public EnumFacing getFacing() {
|
||||
return getWorld().getBlockState(getPos()).getValue(BlockBase.FACING);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,19 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.tiles;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.config.Constants;
|
||||
@@ -34,6 +21,16 @@ import forestry.core.utils.NetworkUtil;
|
||||
import forestry.energy.EnergyHelper;
|
||||
import forestry.energy.EnergyManager;
|
||||
import forestry.energy.EnergyTransferMode;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
|
||||
public abstract class TileEngine extends TileBase implements IActivatable, IStreamableGui {
|
||||
private static final int CANT_SEND_ENERGY_TIME = 20;
|
||||
@@ -303,15 +300,17 @@ public abstract class TileEngine extends TileBase implements IActivatable, IStre
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return energyManager.hasCapability(capability) || super.hasCapability(capability, facing);
|
||||
return (facing == getFacing() && energyManager.hasCapability(capability)) || super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
T energyCapability = energyManager.getCapability(capability);
|
||||
if (energyCapability != null) {
|
||||
return energyCapability;
|
||||
if (facing == getFacing()) {
|
||||
T energyCapability = energyManager.getCapability(capability);
|
||||
if (energyCapability != null) {
|
||||
return energyCapability;
|
||||
}
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
@@ -12,9 +12,7 @@ package forestry.core.tiles;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -27,15 +25,25 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.wrapper.InvWrapper;
|
||||
import net.minecraftforge.items.wrapper.SidedInvWrapper;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import buildcraft.api.statements.ITriggerInternal;
|
||||
import buildcraft.api.statements.ITriggerInternalSided;
|
||||
import buildcraft.api.statements.ITriggerProvider;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
import forestry.api.core.ILocatable;
|
||||
@@ -50,8 +58,8 @@ import forestry.core.utils.NBTUtilForestry;
|
||||
import forestry.core.utils.NetworkUtil;
|
||||
import forestry.core.utils.TickHelper;
|
||||
|
||||
//@Optional.Interface(iface = "buildcraft.api.statements.ITriggerProvider", modid = "BuildCraftAPI|statements")
|
||||
public abstract class TileForestry extends TileEntity implements IStreamable, IErrorLogicSource, ISidedInventory, IFilterSlotDelegate, ITitled, ILocatable, IGuiHandlerTile, ITickable {
|
||||
@Optional.Interface(iface = "buildcraft.api.statements.ITriggerProvider", modid = Constants.BCLIB_MOD_ID)
|
||||
public abstract class TileForestry extends TileEntity implements IStreamable, IErrorLogicSource, ISidedInventory, IFilterSlotDelegate, ITitled, ILocatable, IGuiHandlerTile, ITickable, ITriggerProvider {
|
||||
private final ErrorLogic errorHandler = new ErrorLogic();
|
||||
private final AdjacentTileCache tileCache = new AdjacentTileCache(this);
|
||||
|
||||
@@ -170,18 +178,16 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IE
|
||||
}
|
||||
|
||||
/* ITriggerProvider */
|
||||
// TODO: buildcraft for 1.9
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerInternal> getInternalTriggers(IStatementContainer container) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
// return null;
|
||||
// }
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
@Override
|
||||
public void addInternalTriggers(Collection<ITriggerInternal> triggers, IStatementContainer container) { }
|
||||
|
||||
@Override
|
||||
public void addInternalSidedTriggers(Collection<ITriggerInternalSided> triggers, IStatementContainer container, @Nonnull EnumFacing side) { }
|
||||
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
@Override
|
||||
public void addExternalTriggers(Collection<ITriggerExternal> triggers, @Nonnull EnumFacing side, TileEntity tile) { }
|
||||
|
||||
// / REDSTONE INFO
|
||||
protected boolean isRedstoneActivated() {
|
||||
|
||||
@@ -10,10 +10,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.tiles;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
|
||||
import buildcraft.api.tiles.IHasWork;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.core.capabilities.HasWorkWrapper;
|
||||
import forestry.core.circuits.ISpeedUpgradable;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.network.IStreamableGui;
|
||||
@@ -25,11 +24,17 @@ import forestry.energy.EnergyTransferMode;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
//@Optional.Interface(iface = "buildcraft.api.tiles.IHasWork", modid = "BuildCraftAPI|tiles")
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
|
||||
import static forestry.core.capabilities.HasWorkWrapper.CAPABILITY_HAS_WORK;
|
||||
|
||||
public abstract class TilePowered extends TileBase implements IRenderableTile, ISpeedUpgradable, IStreamableGui {
|
||||
|
||||
private static final int WORK_TICK_INTERVAL = 5; // one Forestry work tick happens every WORK_TICK_INTERVAL game ticks
|
||||
|
||||
private final EnergyManager energyManager;
|
||||
@@ -88,8 +93,6 @@ public abstract class TilePowered extends TileBase implements IRenderableTile, I
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: buildcraft for 1.9
|
||||
// @Override
|
||||
public abstract boolean hasWork();
|
||||
|
||||
@Override
|
||||
@@ -197,12 +200,14 @@ public abstract class TilePowered extends TileBase implements IRenderableTile, I
|
||||
/* IPowerHandler */
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == CAPABILITY_HAS_WORK) return true;
|
||||
return energyManager.hasCapability(capability) || super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == CAPABILITY_HAS_WORK) return CAPABILITY_HAS_WORK.cast(new HasWorkWrapper(this));
|
||||
T energyCapability = energyManager.getCapability(capability);
|
||||
if (energyCapability != null) {
|
||||
return energyCapability;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package forestry.core.triggers;
|
||||
|
||||
import buildcraft.api.core.render.ISprite;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class Sprite implements ISprite {
|
||||
|
||||
private final ResourceLocation rl;
|
||||
|
||||
public Sprite(ResourceLocation rl) {
|
||||
this.rl = rl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindTexture() {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(rl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getInterpU(double u) {
|
||||
return u;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getInterpV(double v) {
|
||||
return v;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,62 +10,81 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.triggers;
|
||||
|
||||
// TODO: buildcraft for 1.9
|
||||
public abstract class Trigger {//implements ITriggerExternal {
|
||||
import buildcraft.api.core.render.ISprite;
|
||||
import buildcraft.api.statements.IStatement;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import buildcraft.api.statements.StatementManager;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.Translator;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
// private final String uid;
|
||||
// private final String localization;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
// protected Trigger(String uid) {
|
||||
// this(uid, uid);
|
||||
// }
|
||||
//
|
||||
// protected Trigger(String uid, String localization) {
|
||||
// this.uid = "forestry:" + uid;
|
||||
// this.localization = localization;
|
||||
// StatementManager.registerStatement(this);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getUniqueTag() {
|
||||
// return uid;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getDescription() {
|
||||
// return Translator.translateToLocal("for.trigger." + localization);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public IStatementParameter createParameter(int index) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int maxParameters() {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int minParameters() {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// private TextureAtlasSprite icon;
|
||||
//
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerSprites() {
|
||||
// icon = TextureManager.registerSprite("triggers/" + localization);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public TextureAtlasSprite getGuiSprite() {
|
||||
// return icon;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public IStatement rotateLeft() {
|
||||
// return this;
|
||||
// }
|
||||
public abstract class Trigger implements ITriggerExternal {
|
||||
|
||||
private final String uid;
|
||||
private final String localization;
|
||||
private final String textureName;
|
||||
|
||||
protected Trigger(String uid, String textureName) {
|
||||
this(uid, uid, textureName);
|
||||
}
|
||||
|
||||
protected Trigger(String uid, String localization, String textureName) {
|
||||
this.uid = "forestry:" + uid;
|
||||
this.localization = localization;
|
||||
this.textureName = textureName;
|
||||
StatementManager.registerStatement(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueTag() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return Translator.translateToLocal("for.trigger." + localization);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStatementParameter createParameter(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int maxParameters() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int minParameters() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nullable
|
||||
private ISprite icon;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ISprite getSprite() {
|
||||
if (icon == null) {
|
||||
icon = new Sprite(new ResourceLocation(Constants.MOD_ID, String.format("textures/gui/triggers/%s.png", textureName)));
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStatement rotateLeft() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStatement[] getPossible() {
|
||||
return new IStatement[0];
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,17 @@
|
||||
package forestry.energy;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.energy.compat.mj.MjHelper;
|
||||
import forestry.energy.compat.tesla.TeslaHelper;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class EnergyHelper {
|
||||
public static int scaleForDifficulty(int energyValue) {
|
||||
float energyModifier = ForestryAPI.activeMode.getFloatSetting("energy.demand.modifier");
|
||||
@@ -72,17 +74,21 @@ public class EnergyHelper {
|
||||
return receptor.getEnergyManager().receiveEnergy(extractable, simulate);
|
||||
}
|
||||
|
||||
if (tile.hasCapability(CapabilityEnergy.ENERGY, side)) {
|
||||
if (Config.enableRF && tile.hasCapability(CapabilityEnergy.ENERGY, side)) {
|
||||
IEnergyStorage energyStorage = tile.getCapability(CapabilityEnergy.ENERGY, side);
|
||||
if (energyStorage != null) {
|
||||
return energyStorage.receiveEnergy(extractable, simulate);
|
||||
}
|
||||
}
|
||||
|
||||
if (TeslaHelper.isEnergyReceiver(tile, side)) {
|
||||
if (Config.enableTesla && TeslaHelper.isEnergyReceiver(tile, side)) {
|
||||
return TeslaHelper.sendEnergy(tile, side, extractable, simulate);
|
||||
}
|
||||
|
||||
if (Config.enableMJ && MjHelper.isEnergyReceiver(tile, side)) {
|
||||
return MjHelper.sendEnergy(tile, side, extractable, simulate);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -106,6 +112,7 @@ public class EnergyHelper {
|
||||
return energyStorage != null && energyStorage.canReceive();
|
||||
}
|
||||
|
||||
return TeslaHelper.isEnergyReceiver(tile, side);
|
||||
return TeslaHelper.isEnergyReceiver(tile, side) ||
|
||||
MjHelper.isEnergyReceiver(tile, side);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +1,38 @@
|
||||
package forestry.energy;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
|
||||
import buildcraft.api.mj.IMjConnector;
|
||||
import buildcraft.api.mj.IMjPassiveProvider;
|
||||
import buildcraft.api.mj.IMjReadable;
|
||||
import buildcraft.api.mj.IMjReceiver;
|
||||
import buildcraft.api.mj.IMjRedstoneReceiver;
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.core.network.PacketBufferForestry;
|
||||
import forestry.energy.compat.EnergyStorageWrapper;
|
||||
import forestry.energy.compat.mj.MjConnectorWrapper;
|
||||
import forestry.energy.compat.mj.MjHelper;
|
||||
import forestry.energy.compat.mj.MjPassiveProviderWrapper;
|
||||
import forestry.energy.compat.mj.MjReadableWrapper;
|
||||
import forestry.energy.compat.mj.MjReceiverWrapper;
|
||||
import forestry.energy.compat.mj.MjRedstoneReceiverWrapper;
|
||||
import forestry.energy.compat.tesla.TeslaConsumerWrapper;
|
||||
import forestry.energy.compat.tesla.TeslaHelper;
|
||||
import forestry.energy.compat.tesla.TeslaHolderWrapper;
|
||||
import forestry.energy.compat.tesla.TeslaProducerWrapper;
|
||||
import net.darkhax.tesla.api.ITeslaConsumer;
|
||||
import net.darkhax.tesla.api.ITeslaHolder;
|
||||
import net.darkhax.tesla.api.ITeslaProducer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.EnergyStorage;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.core.network.PacketBufferForestry;
|
||||
import forestry.energy.compat.EnergyStorageWrapper;
|
||||
import forestry.energy.compat.tesla.TeslaConsumerWrapper;
|
||||
import forestry.energy.compat.tesla.TeslaHelper;
|
||||
import forestry.energy.compat.tesla.TeslaHolderWrapper;
|
||||
import forestry.energy.compat.tesla.TeslaProducerWrapper;
|
||||
|
||||
import net.darkhax.tesla.api.ITeslaConsumer;
|
||||
import net.darkhax.tesla.api.ITeslaHolder;
|
||||
import net.darkhax.tesla.api.ITeslaProducer;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
|
||||
public class EnergyManager extends EnergyStorage implements IStreamable, INbtReadable, INbtWritable {
|
||||
private EnergyTransferMode externalMode = EnergyTransferMode.BOTH;
|
||||
@@ -99,18 +108,32 @@ public class EnergyManager extends EnergyStorage implements IStreamable, INbtRea
|
||||
}
|
||||
|
||||
public boolean hasCapability(Capability<?> capability) {
|
||||
return capability == CapabilityEnergy.ENERGY ||
|
||||
capability == TeslaHelper.TESLA_PRODUCER && externalMode.canExtract() ||
|
||||
return Config.enableRF && capability == CapabilityEnergy.ENERGY ||
|
||||
Config.enableTesla && hasTeslaCapability(capability) ||
|
||||
Config.enableMJ && hasMjCapability(capability);
|
||||
}
|
||||
|
||||
private boolean hasTeslaCapability(Capability<?> capability) {
|
||||
return capability == TeslaHelper.TESLA_PRODUCER && externalMode.canExtract() ||
|
||||
capability == TeslaHelper.TESLA_CONSUMER && externalMode.canReceive() ||
|
||||
capability == TeslaHelper.TESLA_HOLDER;
|
||||
}
|
||||
|
||||
private boolean hasMjCapability(Capability<?> capability) {
|
||||
return capability == MjHelper.CAP_READABLE ||
|
||||
capability == MjHelper.CAP_CONNECTOR ||
|
||||
capability == MjHelper.CAP_PASSIVE_PROVIDER && externalMode.canExtract() ||
|
||||
capability == MjHelper.CAP_REDSTONE_RECEIVER && externalMode.canReceive() ||
|
||||
capability == MjHelper.CAP_RECEIVER && externalMode.canReceive();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public <T> T getCapability(Capability<T> capability) {
|
||||
if (!hasCapability(capability)) return null;
|
||||
if (capability == CapabilityEnergy.ENERGY) {
|
||||
IEnergyStorage energyStorage = new EnergyStorageWrapper(this, externalMode);
|
||||
return CapabilityEnergy.ENERGY.cast(energyStorage);
|
||||
} else {
|
||||
} else if (TeslaHelper.isTeslaCapability(capability)) {
|
||||
Capability<ITeslaProducer> teslaProducer = TeslaHelper.TESLA_PRODUCER;
|
||||
Capability<ITeslaConsumer> teslaConsumer = TeslaHelper.TESLA_CONSUMER;
|
||||
Capability<ITeslaHolder> teslaHolder = TeslaHelper.TESLA_HOLDER;
|
||||
@@ -121,14 +144,31 @@ public class EnergyManager extends EnergyStorage implements IStreamable, INbtRea
|
||||
return teslaConsumer.cast(new TeslaConsumerWrapper(this));
|
||||
} else if (capability == teslaHolder) {
|
||||
return teslaHolder.cast(new TeslaHolderWrapper(this));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else if (MjHelper.isMjCapability(capability)) {
|
||||
Capability<IMjConnector> mjConnector = MjHelper.CAP_CONNECTOR;
|
||||
Capability<IMjPassiveProvider> mjPassiveProvider = MjHelper.CAP_PASSIVE_PROVIDER;
|
||||
Capability<IMjReadable> mjReadable = MjHelper.CAP_READABLE;
|
||||
Capability<IMjReceiver> mjReceiver = MjHelper.CAP_RECEIVER;
|
||||
Capability<IMjRedstoneReceiver> mjRedstoneReceiver = MjHelper.CAP_REDSTONE_RECEIVER;
|
||||
|
||||
if (capability == mjPassiveProvider && externalMode.canExtract()) {
|
||||
return mjPassiveProvider.cast(new MjPassiveProviderWrapper(this));
|
||||
} else if (capability == mjReceiver && externalMode.canReceive()) {
|
||||
return mjReceiver.cast(new MjReceiverWrapper(this));
|
||||
} else if (capability == mjRedstoneReceiver && externalMode.canReceive()) {
|
||||
return mjRedstoneReceiver.cast(new MjRedstoneReceiverWrapper(this));
|
||||
} else if (capability == mjReadable) {
|
||||
return mjReadable.cast(new MjReadableWrapper(this));
|
||||
} else if (capability == mjConnector) {
|
||||
return mjConnector.cast(new MjConnectorWrapper(this));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int calculateRedstone(){
|
||||
return MathHelper.floor(((float)energy / (float)capacity) * 14.0F) + (energy > 0 ? 1 : 0);
|
||||
public int calculateRedstone() {
|
||||
return MathHelper.floor(((float) energy / (float) capacity) * 14.0F) + (energy > 0 ? 1 : 0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package forestry.energy.compat.mj;
|
||||
|
||||
import buildcraft.api.mj.IMjConnector;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.energy.EnergyManager;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@Optional.Interface(iface = "buildcraft.api.mj.IMjConnector", modid = Constants.BCLIB_MOD_ID)
|
||||
public class MjConnectorWrapper implements IMjConnector {
|
||||
protected final EnergyManager energyManager;
|
||||
|
||||
public MjConnectorWrapper(EnergyManager energyManager) {
|
||||
this.energyManager = energyManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(@Nonnull IMjConnector other) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package forestry.energy.compat.mj;
|
||||
|
||||
import buildcraft.api.mj.IMjConnector;
|
||||
import buildcraft.api.mj.IMjPassiveProvider;
|
||||
import buildcraft.api.mj.IMjReadable;
|
||||
import buildcraft.api.mj.IMjReceiver;
|
||||
import buildcraft.api.mj.IMjRedstoneReceiver;
|
||||
import buildcraft.api.mj.MjAPI;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.Log;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static java.lang.Math.max;
|
||||
import static java.lang.Math.min;
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public class MjHelper {
|
||||
@Nullable
|
||||
@CapabilityInject(IMjConnector.class)
|
||||
public static Capability<IMjConnector> CAP_CONNECTOR = null;
|
||||
|
||||
@Nullable
|
||||
@CapabilityInject(IMjReceiver.class)
|
||||
public static Capability<IMjReceiver> CAP_RECEIVER = null;
|
||||
|
||||
@Nullable
|
||||
@CapabilityInject(IMjRedstoneReceiver.class)
|
||||
public static Capability<IMjRedstoneReceiver> CAP_REDSTONE_RECEIVER = null;
|
||||
|
||||
@Nullable
|
||||
@CapabilityInject(IMjReadable.class)
|
||||
public static Capability<IMjReadable> CAP_READABLE = null;
|
||||
|
||||
@Nullable
|
||||
@CapabilityInject(IMjPassiveProvider.class)
|
||||
public static Capability<IMjPassiveProvider> CAP_PASSIVE_PROVIDER = null;
|
||||
|
||||
public static boolean isLoaded() {
|
||||
return CAP_CONNECTOR != null && CAP_RECEIVER != null && CAP_REDSTONE_RECEIVER != null && CAP_READABLE != null && CAP_PASSIVE_PROVIDER != null;
|
||||
}
|
||||
|
||||
public static boolean isEnergyReceiver(TileEntity tile, EnumFacing side) {
|
||||
return isLoaded() && _isEnergyReceiver(tile, side);
|
||||
}
|
||||
|
||||
public static int sendEnergy(TileEntity tile, EnumFacing side, int amount, boolean simulate) {
|
||||
if (isLoaded()) {
|
||||
return mjToRf(_sendEnergy(tile, side, rfToMj(amount), simulate));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
private static boolean _isEnergyReceiver(TileEntity tile, EnumFacing side) {
|
||||
return CAP_RECEIVER != null && tile.hasCapability(CAP_RECEIVER, side);
|
||||
}
|
||||
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
private static int _sendEnergy(TileEntity tile, EnumFacing side, int amount, boolean simulate) {
|
||||
long amountMicro = toMicroJoules(amount);
|
||||
IMjReceiver consumer = tile.getCapability(CAP_RECEIVER, side);
|
||||
if (consumer == null) {
|
||||
if (tile.hasCapability(CAP_RECEIVER, side)) {
|
||||
Log.error("Tile claims to support MJ but does not have the capability. {} {}", tile.getPos(), tile);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
long req = consumer.getPowerRequested();
|
||||
return fromMicroJoules(amountMicro - consumer.receivePower(min(amountMicro, req), simulate) - max(0, amountMicro - req));
|
||||
}
|
||||
|
||||
public static boolean isMjCapability(Capability<?> capability) {
|
||||
if (!isLoaded()) return false;
|
||||
|
||||
return capability == CAP_CONNECTOR || capability == CAP_RECEIVER || capability == CAP_REDSTONE_RECEIVER ||
|
||||
capability == CAP_READABLE || capability == CAP_PASSIVE_PROVIDER;
|
||||
}
|
||||
|
||||
public static int fromMicroJoules(long microJoules) {
|
||||
return (int) (microJoules / MjAPI.MJ);
|
||||
}
|
||||
|
||||
public static long toMicroJoules(long mj) {
|
||||
return mj * MjAPI.MJ;
|
||||
}
|
||||
|
||||
public static int rfToMj(int rf) {
|
||||
return rf / 10;
|
||||
}
|
||||
|
||||
public static int mjToRf(int mj) {
|
||||
return mj * 10;
|
||||
}
|
||||
|
||||
public static long rfToMicro(int rf) {
|
||||
return toMicroJoules(rfToMj(rf));
|
||||
}
|
||||
|
||||
public static int microToRf(long microJoules) {
|
||||
return mjToRf(fromMicroJoules(microJoules));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package forestry.energy.compat.mj;
|
||||
|
||||
import buildcraft.api.mj.IMjPassiveProvider;
|
||||
import buildcraft.api.mj.IMjReadable;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.energy.EnergyManager;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
@Optional.Interface(iface = "buildcraft.api.mj.IMjPassiveProvider", modid = Constants.BCLIB_MOD_ID)
|
||||
public class MjPassiveProviderWrapper extends MjConnectorWrapper implements IMjPassiveProvider {
|
||||
public MjPassiveProviderWrapper(EnergyManager energyManager) {
|
||||
super(energyManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long extractPower(long min, long max, boolean simulate) {
|
||||
int max1 = MjHelper.microToRf(max);
|
||||
int actualMin = energyManager.extractEnergy(max1, true);
|
||||
if (actualMin < min) return 0;
|
||||
return MjHelper.rfToMicro(energyManager.extractEnergy(max1, simulate));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package forestry.energy.compat.mj;
|
||||
|
||||
import buildcraft.api.mj.IMjReadable;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.energy.EnergyManager;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
@Optional.Interface(iface = "buildcraft.api.mj.IMjReadable", modid = Constants.BCLIB_MOD_ID)
|
||||
public class MjReadableWrapper extends MjConnectorWrapper implements IMjReadable {
|
||||
public MjReadableWrapper(EnergyManager energyManager) {
|
||||
super(energyManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getStored() {
|
||||
return MjHelper.rfToMicro(energyManager.getEnergyStored());
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCapacity() {
|
||||
return MjHelper.rfToMicro(energyManager.getMaxEnergyStored());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package forestry.energy.compat.mj;
|
||||
|
||||
import buildcraft.api.mj.IMjReceiver;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.energy.EnergyManager;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
import static java.lang.Math.min;
|
||||
|
||||
@Optional.Interface(iface = "buildcraft.api.mj.IMjReceiver", modid = Constants.BCLIB_MOD_ID)
|
||||
public class MjReceiverWrapper extends MjConnectorWrapper implements IMjReceiver {
|
||||
public MjReceiverWrapper(EnergyManager energyManager) {
|
||||
super(energyManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPowerRequested() {
|
||||
return MjHelper.rfToMicro(min(energyManager.getMaxEnergyReceived(), energyManager.getMaxEnergyStored() - energyManager.getEnergyStored()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public long receivePower(long microJoules, boolean simulate) {
|
||||
return microJoules - MjHelper.rfToMicro(energyManager.receiveEnergy(MjHelper.microToRf(microJoules), simulate));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package forestry.energy.compat.mj;
|
||||
|
||||
import buildcraft.api.mj.IMjRedstoneReceiver;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.energy.EnergyManager;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
import static java.lang.Math.min;
|
||||
|
||||
@Optional.Interface(iface = "buildcraft.api.mj.IMjRedstoneReceiver", modid = Constants.BCLIB_MOD_ID)
|
||||
public class MjRedstoneReceiverWrapper extends MjConnectorWrapper implements IMjRedstoneReceiver {
|
||||
public MjRedstoneReceiverWrapper(EnergyManager energyManager) {
|
||||
super(energyManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPowerRequested() {
|
||||
return MjHelper.rfToMicro(min(energyManager.getMaxEnergyReceived(), energyManager.getMaxEnergyStored() - energyManager.getEnergyStored()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public long receivePower(long microJoules, boolean simulate) {
|
||||
return microJoules - MjHelper.rfToMicro(energyManager.receiveEnergy(MjHelper.microToRf(microJoules), simulate));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package forestry.energy.compat.mj;
|
||||
|
||||
import forestry.core.utils.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -1,7 +1,5 @@
|
||||
package forestry.energy.compat.tesla;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.Log;
|
||||
import net.darkhax.tesla.api.ITeslaConsumer;
|
||||
@@ -13,6 +11,8 @@ import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TeslaHelper {
|
||||
@Nullable
|
||||
@CapabilityInject(ITeslaConsumer.class)
|
||||
@@ -58,4 +58,9 @@ public class TeslaHelper {
|
||||
}
|
||||
return (int) consumer.givePower(amount, simulate);
|
||||
}
|
||||
|
||||
public static boolean isTeslaCapability(Capability<?> capability) {
|
||||
if (!isLoaded()) return false;
|
||||
return capability == TESLA_CONSUMER || capability == TESLA_HOLDER || capability == TESLA_PRODUCER;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.energy.gui;
|
||||
|
||||
import forestry.core.config.Config;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
import forestry.core.gui.GuiForestryTitled;
|
||||
@@ -49,10 +50,10 @@ public abstract class GuiEngine<C extends Container, I extends TileEngine> exten
|
||||
drawHeader(Translator.translateToLocal("for.gui.energy"), x + 22, y + 8);
|
||||
|
||||
drawSubheader(Translator.translateToLocal("for.gui.currentOutput") + ':', x + 22, y + 20);
|
||||
drawText(tile.getCurrentOutput() + " RF/t", x + 22, y + 32);
|
||||
drawText(Config.energyDisplayMode.formatRate(tile.getCurrentOutput()), x + 22, y + 32);
|
||||
|
||||
drawSubheader(Translator.translateToLocal("for.gui.stored") + ':', x + 22, y + 44);
|
||||
drawText(tile.getEnergyManager().getEnergyStored() + " RF", x + 22, y + 56);
|
||||
drawText(Config.energyDisplayMode.formatEnergyValue(tile.getEnergyManager().getEnergyStored()), x + 22, y + 56);
|
||||
|
||||
drawSubheader(Translator.translateToLocal("for.gui.heat") + ':', x + 22, y + 68);
|
||||
drawText((double) tile.getHeat() / (double) 10 + 20.0 + " C", x + 22, y + 80);
|
||||
@@ -60,7 +61,7 @@ public abstract class GuiEngine<C extends Container, I extends TileEngine> exten
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return tile.getCurrentOutput() + " RF/t";
|
||||
return Config.energyDisplayMode.formatRate(tile.getCurrentOutput());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.energy.tiles;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@@ -20,14 +17,20 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.wrapper.InvWrapper;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.core.ModuleCore;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
@@ -43,6 +46,7 @@ import forestry.core.utils.InventoryUtil;
|
||||
import forestry.energy.gui.ContainerEnginePeat;
|
||||
import forestry.energy.gui.GuiEnginePeat;
|
||||
import forestry.energy.inventory.InventoryEnginePeat;
|
||||
import forestry.factory.triggers.FactoryTriggers;
|
||||
|
||||
public class TileEnginePeat extends TileEngine implements ISidedInventory {
|
||||
private ItemStack fuel = ItemStack.EMPTY;
|
||||
@@ -310,15 +314,13 @@ public class TileEnginePeat extends TileEngine implements ISidedInventory {
|
||||
}
|
||||
|
||||
/* ITriggerProvider */
|
||||
// TODO: buildcraft for 1.9
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
// LinkedList<ITriggerExternal> res = new LinkedList<>();
|
||||
// res.add(FactoryTriggers.lowFuel25);
|
||||
// res.add(FactoryTriggers.lowFuel10);
|
||||
// return res;
|
||||
// }
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
@Override
|
||||
public void addExternalTriggers(Collection<ITriggerExternal> triggers, @Nonnull EnumFacing side, TileEntity tile) {
|
||||
super.addExternalTriggers(triggers, side, tile);
|
||||
triggers.add(FactoryTriggers.lowFuel25);
|
||||
triggers.add(FactoryTriggers.lowFuel10);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -10,10 +10,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.tiles;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumMap;
|
||||
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
@@ -31,12 +34,15 @@ import forestry.factory.gui.ContainerBottler;
|
||||
import forestry.factory.gui.GuiBottler;
|
||||
import forestry.factory.inventory.InventoryBottler;
|
||||
import forestry.factory.recipes.BottlerRecipe;
|
||||
import forestry.factory.triggers.FactoryTriggers;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@@ -47,6 +53,7 @@ import net.minecraftforge.fluids.FluidUtil;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -356,15 +363,13 @@ public class TileBottler extends TilePowered implements ISidedInventory, ILiquid
|
||||
}
|
||||
|
||||
/* ITRIGGERPROVIDER */
|
||||
// TODO: BuildCraft for 1.9
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
// LinkedList<ITriggerExternal> res = new LinkedList<>();
|
||||
// res.add(FactoryTriggers.lowResource25);
|
||||
// res.add(FactoryTriggers.lowResource10);
|
||||
// return res;
|
||||
// }
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
@Override
|
||||
public void addExternalTriggers(Collection<ITriggerExternal> triggers, @Nonnull EnumFacing side, TileEntity tile) {
|
||||
super.addExternalTriggers(triggers, side, tile);
|
||||
triggers.add(FactoryTriggers.lowResource25);
|
||||
triggers.add(FactoryTriggers.lowResource10);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -10,11 +10,29 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.tiles;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.inventory.InventoryCraftResult;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Stack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitBoard;
|
||||
@@ -34,17 +52,7 @@ import forestry.factory.gui.ContainerCentrifuge;
|
||||
import forestry.factory.gui.GuiCentrifuge;
|
||||
import forestry.factory.inventory.InventoryCentrifuge;
|
||||
import forestry.factory.recipes.CentrifugeRecipeManager;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.inventory.InventoryCraftResult;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import forestry.factory.triggers.FactoryTriggers;
|
||||
|
||||
public class TileCentrifuge extends TilePowered implements ISocketable, ISidedInventory, IItemStackDisplay {
|
||||
private static final int TICKS_PER_RECIPE_TIME = 1;
|
||||
@@ -207,15 +215,13 @@ public class TileCentrifuge extends TilePowered implements ISocketable, ISidedIn
|
||||
}
|
||||
|
||||
/* ITRIGGERPROVIDER */
|
||||
// TODO: BuildCraft for 1.9
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
// LinkedList<ITriggerExternal> res = new LinkedList<>();
|
||||
// res.add(FactoryTriggers.lowResource25);
|
||||
// res.add(FactoryTriggers.lowResource10);
|
||||
// return res;
|
||||
// }
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
@Override
|
||||
public void addExternalTriggers(Collection<ITriggerExternal> triggers, @Nonnull EnumFacing side, TileEntity tile) {
|
||||
super.addExternalTriggers(triggers, side, tile);
|
||||
triggers.add(FactoryTriggers.lowResource25);
|
||||
triggers.add(FactoryTriggers.lowResource10);
|
||||
}
|
||||
|
||||
/* ISocketable */
|
||||
@Override
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.tiles;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@@ -20,15 +17,23 @@ import net.minecraft.inventory.IContainerListener;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.fuels.FermenterFuel;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
@@ -47,6 +52,7 @@ import forestry.factory.gui.ContainerFermenter;
|
||||
import forestry.factory.gui.GuiFermenter;
|
||||
import forestry.factory.inventory.InventoryFermenter;
|
||||
import forestry.factory.recipes.FermenterRecipeManager;
|
||||
import forestry.factory.triggers.FactoryTriggers;
|
||||
|
||||
public class TileFermenter extends TilePowered implements ISidedInventory, ILiquidTankTile {
|
||||
private final FilteredTank resourceTank;
|
||||
@@ -306,15 +312,13 @@ public class TileFermenter extends TilePowered implements ISidedInventory, ILiqu
|
||||
}
|
||||
|
||||
/* ITRIGGERPROVIDER */
|
||||
// TODO: BuildCraft for 1.9
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
// LinkedList<ITriggerExternal> res = new LinkedList<>();
|
||||
// res.add(FactoryTriggers.lowResource25);
|
||||
// res.add(FactoryTriggers.lowResource10);
|
||||
// return res;
|
||||
// }
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
@Override
|
||||
public void addExternalTriggers(Collection<ITriggerExternal> triggers, @Nonnull EnumFacing side, TileEntity tile) {
|
||||
super.addExternalTriggers(triggers, side, tile);
|
||||
triggers.add(FactoryTriggers.lowResource25);
|
||||
triggers.add(FactoryTriggers.lowResource10);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -10,16 +10,18 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.triggers;
|
||||
|
||||
import forestry.core.triggers.Trigger;
|
||||
|
||||
public class FactoryTriggers {
|
||||
// public static Trigger lowResource25;
|
||||
// public static Trigger lowResource10;
|
||||
// public static Trigger lowFuel25;
|
||||
// public static Trigger lowFuel10;
|
||||
//
|
||||
// public static void initialize() {
|
||||
// lowResource25 = new TriggerLowResource("lowResources.25", 0.25f);
|
||||
// lowResource10 = new TriggerLowResource("lowResources.10", 0.1f);
|
||||
// lowFuel25 = new TriggerLowFuel("lowFuel.25", 0.25f);
|
||||
// lowFuel10 = new TriggerLowFuel("lowFuel.10", 0.1f);
|
||||
// }
|
||||
public static Trigger lowResource25;
|
||||
public static Trigger lowResource10;
|
||||
public static Trigger lowFuel25;
|
||||
public static Trigger lowFuel10;
|
||||
|
||||
public static void initialize() {
|
||||
lowResource25 = new TriggerLowResource("lowResources.25", 0.25f);
|
||||
lowResource10 = new TriggerLowResource("lowResources.10", 0.1f);
|
||||
lowFuel25 = new TriggerLowFuel("lowFuel.25", 0.25f);
|
||||
lowFuel10 = new TriggerLowFuel("lowFuel.10", 0.1f);
|
||||
}
|
||||
}
|
||||
@@ -10,39 +10,45 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.triggers;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.core.tiles.TilePowered;
|
||||
import forestry.core.triggers.Trigger;
|
||||
|
||||
// TODO: BuildCraft for 1.9
|
||||
public class TriggerLowFuel extends Trigger {
|
||||
|
||||
private float threshold = 0.25F;
|
||||
|
||||
public TriggerLowFuel(String uid, float threshold) {
|
||||
// super(uid, "lowFuel");
|
||||
super(uid, "lowFuel", "low_fuel");
|
||||
this.threshold = threshold;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String getDescription() {
|
||||
// return super.getDescription() + " < " + threshold * 100 + "%";
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Return true if the tile given in parameter activates the trigger, given the parameters.
|
||||
// */
|
||||
// @Override
|
||||
// public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
//
|
||||
// if (tile instanceof TilePowered) {
|
||||
// return !((TilePowered) tile).hasFuelMin(threshold);
|
||||
// }
|
||||
//
|
||||
// if (tile instanceof TileEngine) {
|
||||
// TileEngine tileEngine = (TileEngine) tile;
|
||||
// return !tileEngine.hasFuelMin(threshold);
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return super.getDescription() + " < " + threshold * 100 + "%";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the tile given in parameter activates the trigger, given the parameters.
|
||||
*/
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
|
||||
if (tile instanceof TilePowered) {
|
||||
return !((TilePowered) tile).hasFuelMin(threshold);
|
||||
}
|
||||
|
||||
if (tile instanceof TileEngine) {
|
||||
TileEngine tileEngine = (TileEngine) tile;
|
||||
return !tileEngine.hasFuelMin(threshold);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,33 +10,38 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.triggers;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import forestry.core.tiles.TilePowered;
|
||||
import forestry.core.triggers.Trigger;
|
||||
|
||||
// TODO: BuildCraft for 1.9
|
||||
public class TriggerLowResource extends Trigger {
|
||||
|
||||
private float threshold = 0.25F;
|
||||
|
||||
public TriggerLowResource(String tag, float threshold) {
|
||||
// super(tag, "lowResources");
|
||||
super(tag, "lowResources", "low_resources");
|
||||
this.threshold = threshold;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String getDescription() {
|
||||
// return super.getDescription() + " < " + threshold * 100 + "%";
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Return true if the tile given in parameter activates the trigger, given the parameters.
|
||||
// */
|
||||
// @Override
|
||||
// public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
// if (!(tile instanceof TilePowered)) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return !((TilePowered) tile).hasResourcesMin(threshold);
|
||||
// }
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return super.getDescription() + " < " + threshold * 100 + "%";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the tile given in parameter activates the trigger, given the parameters.
|
||||
*/
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
if (!(tile instanceof TilePowered)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !((TilePowered) tile).hasResourcesMin(threshold);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,24 +10,37 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.tiles;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import buildcraft.api.statements.ITriggerInternal;
|
||||
import buildcraft.api.statements.ITriggerInternalSided;
|
||||
import buildcraft.api.statements.ITriggerProvider;
|
||||
import forestry.api.multiblock.IFarmComponent;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.inventory.AdjacentInventoryCache;
|
||||
import forestry.core.tiles.AdjacentTileCache;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.farming.triggers.FarmingTriggers;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.wrapper.InvWrapper;
|
||||
import net.minecraftforge.items.wrapper.SidedInvWrapper;
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
//@Optional.Interface(iface = "buildcraft.api.statements.ITriggerProvider", modid = "BuildCraftAPI|statements")
|
||||
public class TileFarmHatch extends TileFarm implements ISidedInventory, IFarmComponent.Active {
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
@Optional.Interface(iface = "buildcraft.api.statements.ITriggerProvider", modid = Constants.BCLIB_MOD_ID)
|
||||
public class TileFarmHatch extends TileFarm implements ISidedInventory, IFarmComponent.Active, ITriggerProvider {
|
||||
|
||||
private static final EnumFacing[] dumpDirections = new EnumFacing[]{EnumFacing.DOWN};
|
||||
|
||||
@@ -76,22 +89,20 @@ public class TileFarmHatch extends TileFarm implements ISidedInventory, IFarmCom
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerInternal> getInternalTriggers(IStatementContainer container) {
|
||||
// return Collections.emptyList();
|
||||
// }
|
||||
//
|
||||
// /* ITRIGGERPROVIDER */
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
// if (!getMultiblockLogic().isConnected()) {
|
||||
// return Collections.emptyList();
|
||||
// }
|
||||
//
|
||||
// return FarmingTriggers.allExternalTriggers;
|
||||
// }
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
@Override
|
||||
public void addInternalTriggers(Collection<ITriggerInternal> triggers, IStatementContainer container) { }
|
||||
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
@Override
|
||||
public void addInternalSidedTriggers(Collection<ITriggerInternalSided> triggers, IStatementContainer container, @Nonnull EnumFacing side) { }
|
||||
|
||||
/* ITRIGGERPROVIDER */
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
@Override
|
||||
public void addExternalTriggers(Collection<ITriggerExternal> triggers, @Nonnull EnumFacing side, TileEntity tile) {
|
||||
if (getMultiblockLogic().isConnected()) {
|
||||
triggers.addAll(FarmingTriggers.allExternalTriggers);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,30 +10,35 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.triggers;
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import forestry.core.triggers.Trigger;
|
||||
|
||||
public class FarmingTriggers {
|
||||
// public static Trigger lowResourceLiquid50;
|
||||
// public static Trigger lowResourceLiquid25;
|
||||
// public static Trigger lowSoil128;
|
||||
// public static Trigger lowSoil64;
|
||||
// public static Trigger lowSoil32;
|
||||
// public static Trigger lowFertilizer50;
|
||||
// public static Trigger lowFertilizer25;
|
||||
// public static Trigger lowGermlings25;
|
||||
// public static Trigger lowGermlings10;
|
||||
// public static List<ITriggerExternal> allExternalTriggers;
|
||||
public static Trigger lowResourceLiquid50;
|
||||
public static Trigger lowResourceLiquid25;
|
||||
public static Trigger lowSoil128;
|
||||
public static Trigger lowSoil64;
|
||||
public static Trigger lowSoil32;
|
||||
public static Trigger lowFertilizer50;
|
||||
public static Trigger lowFertilizer25;
|
||||
public static Trigger lowGermlings25;
|
||||
public static Trigger lowGermlings10;
|
||||
public static List<ITriggerExternal> allExternalTriggers;
|
||||
|
||||
public static void initialize() {
|
||||
// allExternalTriggers = Arrays.asList(
|
||||
// lowResourceLiquid50 = new TriggerLowLiquid("lowLiquid.50", 0.5f),
|
||||
// lowResourceLiquid25 = new TriggerLowLiquid("lowLiquid.25", 0.25f),
|
||||
// lowSoil128 = new TriggerLowSoil(128),
|
||||
// lowSoil64 = new TriggerLowSoil(64),
|
||||
// lowSoil32 = new TriggerLowSoil(32),
|
||||
// lowFertilizer50 = new TriggerLowFertilizer("lowFertilizer.50", 0.5f),
|
||||
// lowFertilizer25 = new TriggerLowFertilizer("lowFertilizer.25", 0.25f),
|
||||
// lowGermlings25 = new TriggerLowGermlings("lowGermlings.25", 0.25f),
|
||||
// lowGermlings10 = new TriggerLowGermlings("lowGermlings.10", 0.1f)
|
||||
// );
|
||||
allExternalTriggers = Arrays.asList(
|
||||
lowResourceLiquid50 = new TriggerLowLiquid("lowLiquid.50", 0.5f),
|
||||
lowResourceLiquid25 = new TriggerLowLiquid("lowLiquid.25", 0.25f),
|
||||
lowSoil128 = new TriggerLowSoil(128),
|
||||
lowSoil64 = new TriggerLowSoil(64),
|
||||
lowSoil32 = new TriggerLowSoil(32),
|
||||
lowFertilizer50 = new TriggerLowFertilizer("lowFertilizer.50", 0.5f),
|
||||
lowFertilizer25 = new TriggerLowFertilizer("lowFertilizer.25", 0.25f),
|
||||
lowGermlings25 = new TriggerLowGermlings("lowGermlings.25", 0.25f),
|
||||
lowGermlings10 = new TriggerLowGermlings("lowGermlings.10", 0.1f)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -10,29 +10,38 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.triggers;
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
public class TriggerLowFertilizer {//} extends Trigger {
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
// private final float threshold;
|
||||
//
|
||||
// public TriggerLowFertilizer(String tag, float threshold) {
|
||||
// super(tag, "lowFertilizer");
|
||||
// this.threshold = threshold;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getDescription() {
|
||||
// return super.getDescription() + " < " + threshold * 100 + "%";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
// if (!(tile instanceof TileFarmHatch)) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// TileFarmHatch tileHatch = (TileFarmHatch) tile;
|
||||
// IInventory fertilizerInventory = tileHatch.getMultiblockLogic().getController().getFarmInventory().getFertilizerInventory();
|
||||
// return InventoryUtil.containsPercent(fertilizerInventory, threshold);
|
||||
// }
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import forestry.core.triggers.Trigger;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.farming.tiles.TileFarmHatch;
|
||||
|
||||
public class TriggerLowFertilizer extends Trigger {
|
||||
|
||||
private final float threshold;
|
||||
|
||||
public TriggerLowFertilizer(String tag, float threshold) {
|
||||
super(tag, "lowFertilizer", "low_fertilizer");
|
||||
this.threshold = threshold;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return super.getDescription() + " < " + threshold * 100 + "%";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
if (!(tile instanceof TileFarmHatch)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileFarmHatch tileHatch = (TileFarmHatch) tile;
|
||||
IInventory fertilizerInventory = tileHatch.getMultiblockLogic().getController().getFarmInventory().getFertilizerInventory();
|
||||
return InventoryUtil.containsPercent(fertilizerInventory, threshold);
|
||||
}
|
||||
}
|
||||
@@ -10,34 +10,41 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.triggers;
|
||||
|
||||
import forestry.core.triggers.Trigger;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import forestry.core.triggers.Trigger;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.farming.tiles.TileFarmHatch;
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
public class TriggerLowGermlings extends Trigger {
|
||||
|
||||
private final float threshold;
|
||||
|
||||
public TriggerLowGermlings(String tag, float threshold) {
|
||||
// super(tag, "lowGermlings");
|
||||
super(tag, "lowGermlings", "low_germlings");
|
||||
this.threshold = threshold;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String getDescription() {
|
||||
// return super.getDescription() + " < " + threshold * 100 + "%";
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Return true if the tile given in parameter activates the trigger, given the parameters.
|
||||
// */
|
||||
// @Override
|
||||
// public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
// if (!(tile instanceof TileFarmHatch)) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// TileFarmHatch tileHatch = (TileFarmHatch) tile;
|
||||
// IInventory germlingsInventory = tileHatch.getMultiblockLogic().getController().getFarmInventory().getGermlingsInventory();
|
||||
// return InventoryUtil.containsPercent(germlingsInventory, threshold);
|
||||
// }
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return super.getDescription() + " < " + threshold * 100 + "%";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the tile given in parameter activates the trigger, given the parameters.
|
||||
*/
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
if (!(tile instanceof TileFarmHatch)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileFarmHatch tileHatch = (TileFarmHatch) tile;
|
||||
IInventory germlingsInventory = tileHatch.getMultiblockLogic().getController().getFarmInventory().getGermlingsInventory();
|
||||
return InventoryUtil.containsPercent(germlingsInventory, threshold);
|
||||
}
|
||||
}
|
||||
@@ -10,40 +10,47 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.triggers;
|
||||
|
||||
import forestry.core.triggers.Trigger;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import forestry.core.fluids.ITankManager;
|
||||
import forestry.core.triggers.Trigger;
|
||||
import forestry.farming.tiles.TileFarmHatch;
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
public class TriggerLowLiquid extends Trigger {
|
||||
|
||||
private final float threshold;
|
||||
|
||||
public TriggerLowLiquid(String tag, float threshold) {
|
||||
// super(tag, "lowLiquid");
|
||||
super(tag, "lowLiquid", "low_liquid");
|
||||
this.threshold = threshold;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String getDescription() {
|
||||
// return super.getDescription() + " < " + threshold * 100 + "%";
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Return true if the tile given in parameter activates the trigger, given
|
||||
// * the parameters.
|
||||
// */
|
||||
// @Override
|
||||
// public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
// if (!(tile instanceof TileFarmHatch)) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// TileFarmHatch tileHatch = (TileFarmHatch) tile;
|
||||
// ITankManager tankManager = tileHatch.getMultiblockLogic().getController().getTankManager();
|
||||
//
|
||||
// IFluidTank tank = tankManager.getTank(0);
|
||||
// if (tank.getCapacity() == 0) {
|
||||
// return false;
|
||||
// }
|
||||
// return (float) tank.getFluidAmount() / tank.getCapacity() <= threshold;
|
||||
// }
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return super.getDescription() + " < " + threshold * 100 + "%";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the tile given in parameter activates the trigger, given
|
||||
* the parameters.
|
||||
*/
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
if (!(tile instanceof TileFarmHatch)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileFarmHatch tileHatch = (TileFarmHatch) tile;
|
||||
ITankManager tankManager = tileHatch.getMultiblockLogic().getController().getTankManager();
|
||||
|
||||
IFluidTank tank = tankManager.getTank(0);
|
||||
if (tank.getCapacity() == 0) {
|
||||
return false;
|
||||
}
|
||||
return (float) tank.getFluidAmount() / tank.getCapacity() <= threshold;
|
||||
}
|
||||
}
|
||||
@@ -10,54 +10,65 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.triggers;
|
||||
|
||||
import forestry.core.triggers.Trigger;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import forestry.api.farming.IFarmInventory;
|
||||
import forestry.api.multiblock.IFarmController;
|
||||
import forestry.core.triggers.Trigger;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.farming.tiles.TileFarmHatch;
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
public class TriggerLowSoil extends Trigger {
|
||||
|
||||
private final int threshold;
|
||||
|
||||
public TriggerLowSoil(int threshold) {
|
||||
// super("lowSoil." + threshold, "lowSoil");
|
||||
super("lowSoil." + threshold, "lowSoil", "low_soil");
|
||||
this.threshold = threshold;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String getDescription() {
|
||||
// return super.getDescription() + " < " + threshold;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int maxParameters() {
|
||||
// return 1;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Return true if the tile given in parameter activates the trigger, given
|
||||
// * the parameters.
|
||||
// */
|
||||
// @Override
|
||||
// public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
// IStatementParameter parameter = null;
|
||||
// if (parameters.length > 0) {
|
||||
// parameter = parameters[0];
|
||||
// }
|
||||
//
|
||||
// if (!(tile instanceof TileFarmHatch)) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// TileFarmHatch tileHatch = (TileFarmHatch) tile;
|
||||
// IFarmController farmController = tileHatch.getMultiblockLogic().getController();
|
||||
// IFarmInventory farmInventory = farmController.getFarmInventory();
|
||||
//
|
||||
// if (parameter == null || parameter.getItemStack() == null) {
|
||||
// IInventory resourcesInventory = farmInventory.getResourcesInventory();
|
||||
// return InventoryUtil.containsPercent(resourcesInventory, threshold);
|
||||
// } else {
|
||||
// ItemStack filter = parameter.getItemStack().copy();
|
||||
// filter.setCount(threshold);
|
||||
// return farmInventory.hasResources(new ItemStack[]{filter});
|
||||
// }
|
||||
// }
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return super.getDescription() + " < " + threshold;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int maxParameters() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the tile given in parameter activates the trigger, given
|
||||
* the parameters.
|
||||
*/
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
IStatementParameter parameter = null;
|
||||
if (parameters.length > 0) {
|
||||
parameter = parameters[0];
|
||||
}
|
||||
|
||||
if (!(tile instanceof TileFarmHatch)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileFarmHatch tileHatch = (TileFarmHatch) tile;
|
||||
IFarmController farmController = tileHatch.getMultiblockLogic().getController();
|
||||
IFarmInventory farmInventory = farmController.getFarmInventory();
|
||||
|
||||
if (parameter == null || parameter.getItemStack().isEmpty()) {
|
||||
IInventory resourcesInventory = farmInventory.getResourcesInventory();
|
||||
return InventoryUtil.containsPercent(resourcesInventory, threshold);
|
||||
} else {
|
||||
ItemStack filter = parameter.getItemStack().copy();
|
||||
filter.setCount(threshold);
|
||||
return farmInventory.hasResources(NonNullList.from(ItemStack.EMPTY, filter));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.greenhouse.gui;
|
||||
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.gui.ledgers.Ledger;
|
||||
import forestry.core.gui.ledgers.LedgerManager;
|
||||
import forestry.core.render.TextureManagerForestry;
|
||||
@@ -41,7 +42,7 @@ public class GreenhouseEnergyLedger extends Ledger {
|
||||
drawHeader(Translator.translateToLocal("for.gui.energy"), x + 22, y + 8);
|
||||
|
||||
drawSubheader(Translator.translateToLocal("for.gui.stored") + ':', x + 22, y + 20);
|
||||
drawText(controller.getEnergyManager().getEnergyStored() + " RF", x + 22, y + 32);
|
||||
drawText(Config.energyDisplayMode.formatEnergyValue(controller.getEnergyManager().getEnergyStored()), x + 22, y + 32);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,15 +12,14 @@ package forestry.mail;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.circuits.ICircuit;
|
||||
import forestry.api.mail.EnumAddressee;
|
||||
import forestry.api.mail.PostManager;
|
||||
@@ -45,6 +44,7 @@ import forestry.mail.commands.CommandMail;
|
||||
import forestry.mail.items.EnumStampDefinition;
|
||||
import forestry.mail.items.ItemRegistryMail;
|
||||
import forestry.mail.network.PacketRegistryMail;
|
||||
import forestry.mail.triggers.MailTriggers;
|
||||
import forestry.modules.BlankForestryModule;
|
||||
import forestry.modules.ForestryModuleUids;
|
||||
import forestry.modules.ModuleHelper;
|
||||
@@ -88,11 +88,10 @@ public class ModuleMail extends BlankForestryModule {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
// @Override
|
||||
// public void registerTriggers() {
|
||||
// MailTriggers.initialize();
|
||||
// }
|
||||
@Override
|
||||
public void registerTriggers() {
|
||||
MailTriggers.initialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doInit() {
|
||||
|
||||
@@ -10,11 +10,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.mail.tiles;
|
||||
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.mail.ILetter;
|
||||
import forestry.api.mail.IMailAddress;
|
||||
import forestry.api.mail.IPostalState;
|
||||
import forestry.api.mail.PostManager;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.tiles.TileBase;
|
||||
import forestry.mail.EnumDeliveryState;
|
||||
@@ -22,16 +24,23 @@ import forestry.mail.POBox;
|
||||
import forestry.mail.PostRegistry;
|
||||
import forestry.mail.gui.ContainerMailbox;
|
||||
import forestry.mail.gui.GuiMailbox;
|
||||
import forestry.mail.triggers.MailTriggers;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collection;
|
||||
|
||||
public class TileMailbox extends TileBase {
|
||||
|
||||
public TileMailbox() {
|
||||
@@ -81,6 +90,13 @@ public class TileMailbox extends TileBase {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
@Override
|
||||
public void addExternalTriggers(Collection<ITriggerExternal> triggers, @Nonnull EnumFacing side, TileEntity tile) {
|
||||
super.addExternalTriggers(triggers, side, tile);
|
||||
// triggers.add(MailTriggers.triggerHasMail);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiContainer getGui(EntityPlayer player, int data) {
|
||||
|
||||
@@ -10,9 +10,28 @@
|
||||
******************************************************************************/
|
||||
package forestry.mail.tiles;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.mail.IMailAddress;
|
||||
import forestry.api.mail.IStamps;
|
||||
@@ -35,15 +54,7 @@ import forestry.mail.gui.GuiTradeName;
|
||||
import forestry.mail.gui.GuiTrader;
|
||||
import forestry.mail.inventory.InventoryTradeStation;
|
||||
import forestry.mail.network.packets.PacketTraderAddressResponse;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import forestry.mail.triggers.MailTriggers;
|
||||
|
||||
public class TileTrader extends TileBase implements IOwnedTile {
|
||||
private final OwnerHandler ownerHandler = new OwnerHandler();
|
||||
@@ -306,21 +317,19 @@ public class TileTrader extends TileBase implements IOwnedTile {
|
||||
return (TradeStation) PostManager.postRegistry.getOrCreateTradeStation(world, getOwnerHandler().getOwner(), address);
|
||||
}
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
// LinkedList<ITriggerExternal> res = new LinkedList<>();
|
||||
// res.add(MailTriggers.lowPaper64);
|
||||
// res.add(MailTriggers.lowPaper32);
|
||||
// res.add(MailTriggers.lowInput25);
|
||||
// res.add(MailTriggers.lowInput10);
|
||||
// res.add(MailTriggers.lowPostage40);
|
||||
// res.add(MailTriggers.lowPostage20);
|
||||
// res.add(MailTriggers.highBuffer90);
|
||||
// res.add(MailTriggers.highBuffer75);
|
||||
// return res;
|
||||
// }
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
@Override
|
||||
public void addExternalTriggers(Collection<ITriggerExternal> triggers, @Nonnull EnumFacing side, TileEntity tile) {
|
||||
super.addExternalTriggers(triggers, side, tile);
|
||||
triggers.add(MailTriggers.lowPaper64);
|
||||
triggers.add(MailTriggers.lowPaper32);
|
||||
triggers.add(MailTriggers.lowInput25);
|
||||
triggers.add(MailTriggers.lowInput10);
|
||||
triggers.add(MailTriggers.lowPostage40);
|
||||
triggers.add(MailTriggers.lowPostage20);
|
||||
triggers.add(MailTriggers.highBuffer90);
|
||||
triggers.add(MailTriggers.highBuffer75);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -10,27 +10,28 @@
|
||||
******************************************************************************/
|
||||
package forestry.mail.triggers;
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
import forestry.core.triggers.Trigger;
|
||||
|
||||
public class MailTriggers {
|
||||
// public static Trigger triggerHasMail;
|
||||
// public static Trigger lowPaper64;
|
||||
// public static Trigger lowPaper32;
|
||||
// public static Trigger lowPostage40;
|
||||
// public static Trigger lowPostage20;
|
||||
// public static Trigger lowInput25;
|
||||
// public static Trigger lowInput10;
|
||||
// public static Trigger highBuffer75;
|
||||
// public static Trigger highBuffer90;
|
||||
//
|
||||
// public static void initialize() {
|
||||
// triggerHasMail = new TriggerHasMail();
|
||||
// lowPaper64 = new TriggerLowPaper("mail.lowPaper.64", 64);
|
||||
// lowPaper32 = new TriggerLowPaper("mail.lowPaper.32", 32);
|
||||
// lowPostage40 = new TriggerLowStamps("mail.lowStamps.40", 40);
|
||||
// lowPostage20 = new TriggerLowStamps("mail.lowStamps.20", 20);
|
||||
// lowInput25 = new TriggerLowInput("mail.lowInput.25", 0.25f);
|
||||
// lowInput10 = new TriggerLowInput("mail.lowInput.10", 0.1f);
|
||||
// highBuffer75 = new TriggerBuffer("mail.lowBuffer.75", 0.75f);
|
||||
// highBuffer90 = new TriggerBuffer("mail.lowBuffer.90", 0.90f);
|
||||
// }
|
||||
public static Trigger triggerHasMail;
|
||||
public static Trigger lowPaper64;
|
||||
public static Trigger lowPaper32;
|
||||
public static Trigger lowPostage40;
|
||||
public static Trigger lowPostage20;
|
||||
public static Trigger lowInput25;
|
||||
public static Trigger lowInput10;
|
||||
public static Trigger highBuffer75;
|
||||
public static Trigger highBuffer90;
|
||||
|
||||
public static void initialize() {
|
||||
// triggerHasMail = new TriggerHasMail();
|
||||
lowPaper64 = new TriggerLowPaper("mail.lowPaper.64", 64);
|
||||
lowPaper32 = new TriggerLowPaper("mail.lowPaper.32", 32);
|
||||
lowPostage40 = new TriggerLowStamps("mail.lowStamps.40", 40);
|
||||
lowPostage20 = new TriggerLowStamps("mail.lowStamps.20", 20);
|
||||
lowInput25 = new TriggerLowInput("mail.lowInput.25", 0.25f);
|
||||
lowInput10 = new TriggerLowInput("mail.lowInput.10", 0.1f);
|
||||
highBuffer75 = new TriggerBuffer("mail.lowBuffer.75", 0.75f);
|
||||
highBuffer90 = new TriggerBuffer("mail.lowBuffer.90", 0.90f);
|
||||
}
|
||||
}
|
||||
@@ -10,28 +10,35 @@
|
||||
******************************************************************************/
|
||||
package forestry.mail.triggers;
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
public class TriggerBuffer {//extends Trigger {
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
// private final float threshold;
|
||||
//
|
||||
// public TriggerBuffer(String tag, float threshold) {
|
||||
// super(tag, "mailBuffer");
|
||||
// this.threshold = threshold;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getDescription() {
|
||||
// return super.getDescription() + " > " + threshold * 100 + "%";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
//
|
||||
// if (!(tile instanceof TileTrader)) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return ((TileTrader) tile).hasOutputBufMin(threshold);
|
||||
// }
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import forestry.core.triggers.Trigger;
|
||||
import forestry.mail.tiles.TileTrader;
|
||||
|
||||
public class TriggerBuffer extends Trigger {
|
||||
|
||||
private final float threshold;
|
||||
|
||||
public TriggerBuffer(String tag, float threshold) {
|
||||
super(tag, "mailBuffer", "mail_buffer");
|
||||
this.threshold = threshold;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return super.getDescription() + " > " + threshold * 100 + "%";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
|
||||
if (!(tile instanceof TileTrader)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((TileTrader) tile).hasOutputBufMin(threshold);
|
||||
}
|
||||
}
|
||||
@@ -10,21 +10,26 @@
|
||||
******************************************************************************/
|
||||
package forestry.mail.triggers;
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
public class TriggerHasMail {//extends Trigger {
|
||||
|
||||
// public TriggerHasMail() {
|
||||
// super("mail.hasMail", "hasMail");
|
||||
// }
|
||||
// import buildcraft.api.statements.IStatementContainer;
|
||||
// import buildcraft.api.statements.IStatementParameter;
|
||||
// import forestry.core.triggers.Trigger;
|
||||
// import forestry.mail.tiles.TileMailbox;
|
||||
// import net.minecraft.tileentity.TileEntity;
|
||||
// import net.minecraft.util.EnumFacing;
|
||||
//
|
||||
// @Override
|
||||
// public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
// public class TriggerHasMail extends Trigger {
|
||||
//
|
||||
// if (!(tile instanceof IMailContainer)) {
|
||||
// return false;
|
||||
// }
|
||||
// public TriggerHasMail() {
|
||||
// super("mail.hasMail", "hasMail", "has_mail");
|
||||
// }
|
||||
//
|
||||
// return ((IMailContainer) tile).hasMail();
|
||||
// }
|
||||
|
||||
}
|
||||
// @Override
|
||||
// public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
// if (!(tile instanceof TileMailbox)) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return !((TileMailbox) tile).getInternalInventory().isEmpty();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
@@ -10,28 +10,35 @@
|
||||
******************************************************************************/
|
||||
package forestry.mail.triggers;
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
public class TriggerLowInput {//extends Trigger {
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
// private final float threshold;
|
||||
//
|
||||
// public TriggerLowInput(String tag, float threshold) {
|
||||
// super(tag, "lowInput");
|
||||
// this.threshold = threshold;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getDescription() {
|
||||
// return super.getDescription() + " < " + threshold * 100 + "%";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
//
|
||||
// if (!(tile instanceof TileTrader)) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return !((TileTrader) tile).hasInputBufMin(threshold);
|
||||
// }
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import forestry.core.triggers.Trigger;
|
||||
import forestry.mail.tiles.TileTrader;
|
||||
|
||||
public class TriggerLowInput extends Trigger {
|
||||
|
||||
private final float threshold;
|
||||
|
||||
public TriggerLowInput(String tag, float threshold) {
|
||||
super(tag, "lowInput", "low_input");
|
||||
this.threshold = threshold;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return super.getDescription() + " < " + threshold * 100 + "%";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
|
||||
if (!(tile instanceof TileTrader)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !((TileTrader) tile).hasInputBufMin(threshold);
|
||||
}
|
||||
}
|
||||
@@ -10,29 +10,36 @@
|
||||
******************************************************************************/
|
||||
package forestry.mail.triggers;
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
public class TriggerLowPaper {//} extends Trigger {
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
// private final int threshold;
|
||||
//
|
||||
// public TriggerLowPaper(String tag, int threshold) {
|
||||
// super(tag, "lowPaper");
|
||||
// this.threshold = threshold;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getDescription() {
|
||||
// return super.getDescription() + " < " + threshold;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
//
|
||||
// if (!(tile instanceof TileTrader)) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return !((TileTrader) tile).hasPaperMin(threshold);
|
||||
// }
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import forestry.core.triggers.Trigger;
|
||||
import forestry.mail.tiles.TileTrader;
|
||||
|
||||
public class TriggerLowPaper extends Trigger {
|
||||
|
||||
private final int threshold;
|
||||
|
||||
public TriggerLowPaper(String tag, int threshold) {
|
||||
super(tag, "lowPaper", "low_paper");
|
||||
this.threshold = threshold;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return super.getDescription() + " < " + threshold;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
|
||||
if (!(tile instanceof TileTrader)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !((TileTrader) tile).hasPaperMin(threshold);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,29 +10,36 @@
|
||||
******************************************************************************/
|
||||
package forestry.mail.triggers;
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
public class TriggerLowStamps {//extends Trigger {
|
||||
//
|
||||
// private final int threshold;
|
||||
//
|
||||
// public TriggerLowStamps(String tag, int threshold) {
|
||||
// super(tag, "lowStamps");
|
||||
// this.threshold = threshold;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getDescription() {
|
||||
// return super.getDescription() + " < " + threshold + "p";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
//
|
||||
// if (!(tile instanceof TileTrader)) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return !((TileTrader) tile).hasPostageMin(threshold);
|
||||
// }
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import forestry.core.triggers.Trigger;
|
||||
import forestry.mail.tiles.TileTrader;
|
||||
|
||||
public class TriggerLowStamps extends Trigger {
|
||||
|
||||
private final int threshold;
|
||||
|
||||
public TriggerLowStamps(String tag, int threshold) {
|
||||
super(tag, "lowStamps", "low_stamps");
|
||||
this.threshold = threshold;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return super.getDescription() + " < " + threshold + "p";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
|
||||
if (!(tile instanceof TileTrader)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !((TileTrader) tile).hasPostageMin(threshold);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,19 +10,29 @@
|
||||
******************************************************************************/
|
||||
package forestry.plugins;
|
||||
|
||||
import buildcraft.api.fuels.BuildcraftFuelRegistry;
|
||||
import buildcraft.api.fuels.ICoolant;
|
||||
import buildcraft.api.fuels.ICoolantManager;
|
||||
import buildcraft.api.mj.MjAPI;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.modules.ForestryModule;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.utils.ModUtil;
|
||||
import forestry.modules.BlankForestryModule;
|
||||
import forestry.modules.ForestryModuleUids;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
@ForestryModule(containerID = ForestryCompatPlugins.ID, moduleID = ForestryModuleUids.BUILDCRAFT_FUELS, name = "BuildCraft 6 Fuels", author = "mezz", url = Constants.URL, unlocalizedDescription = "for.module.buildcraft6.description")
|
||||
public class PluginBuildCraftFuels extends BlankForestryModule {
|
||||
|
||||
public static final String MOD_ID = "buildcraftenergy";
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return ModUtil.isAPILoaded("buildcraft.api.fuels", "[2.0, 3.0)");
|
||||
return ModUtil.isModLoaded(Constants.BCLIB_MOD_ID, "[7.99.17,8.0)");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -30,21 +40,21 @@ public class PluginBuildCraftFuels extends BlankForestryModule {
|
||||
return "Compatible BuildCraftAPI|fuels version not found";
|
||||
}
|
||||
|
||||
// @Optional.Method(modid = "BuildCraftAPI|fuels")
|
||||
// @Override
|
||||
// public void doInit() {
|
||||
// ICoolantManager coolantManager = BuildcraftFuelRegistry.coolant;
|
||||
// ICoolant waterCoolant = coolantManager.getCoolant(FluidRegistry.WATER);
|
||||
// float waterCooling = waterCoolant.getDegreesCoolingPerMB(100);
|
||||
//
|
||||
// coolantManager.addCoolant(Fluids.ICE.getFluid(), Constants.ICE_COOLING_MULTIPLIER * waterCooling);
|
||||
//
|
||||
// Fluid ethanol = Fluids.BIO_ETHANOL.getFluid();
|
||||
// if (ethanol != null) {
|
||||
// int ethanolPower = 40;
|
||||
// int ethanolBurnTime = Math.round(Constants.ENGINE_CYCLE_DURATION_ETHANOL * ForestryAPI.activeMode.getFloatSetting("fuel.ethanol.combustion"));
|
||||
// BuildcraftFuelRegistry.fuel.addFuel(ethanol, ethanolPower, ethanolBurnTime);
|
||||
// }
|
||||
// }
|
||||
@Override
|
||||
public void doInit() {
|
||||
ICoolantManager coolantManager = BuildcraftFuelRegistry.coolant;
|
||||
FluidStack water = new FluidStack(FluidRegistry.WATER, 1);
|
||||
ICoolant waterCoolant = coolantManager.getCoolant(water);
|
||||
float waterCooling = waterCoolant.getDegreesCoolingPerMB(water, 100);
|
||||
|
||||
coolantManager.addCoolant(Fluids.ICE.getFluid(), Constants.ICE_COOLING_MULTIPLIER * waterCooling);
|
||||
|
||||
Fluid ethanol = Fluids.BIO_ETHANOL.getFluid();
|
||||
if (ethanol != null) {
|
||||
long ethanolPower = 40 * MjAPI.MJ;
|
||||
int ethanolBurnTime = Math.round(Constants.ENGINE_CYCLE_DURATION_ETHANOL * ForestryAPI.activeMode.getFloatSetting("fuel.ethanol.combustion"));
|
||||
BuildcraftFuelRegistry.fuel.addFuel(ethanol, ethanolPower, ethanolBurnTime);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,21 +10,22 @@
|
||||
******************************************************************************/
|
||||
package forestry.plugins;
|
||||
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
import buildcraft.api.mj.MjAPI;
|
||||
import buildcraft.api.recipes.BuildcraftRecipeRegistry;
|
||||
import forestry.api.modules.ForestryModule;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.utils.ModUtil;
|
||||
import forestry.modules.BlankForestryModule;
|
||||
import forestry.modules.ForestryModuleUids;
|
||||
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
@ForestryModule(containerID = ForestryCompatPlugins.ID, moduleID = ForestryModuleUids.BUILDCRAFT_RECIPES, name = "BuildCraft 6 Recipes", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.module.buildcraft6.description")
|
||||
public class PluginBuildCraftRecipes extends BlankForestryModule {
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return ModUtil.isAPILoaded("buildcraft.api.recipes", "[2.0, 4.0)");
|
||||
return ModUtil.isModLoaded(Constants.BCLIB_MOD_ID, "[7.99.17,8.0)");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -32,11 +33,11 @@ public class PluginBuildCraftRecipes extends BlankForestryModule {
|
||||
return "Compatible BuildCraftAPI|recipes version not found";
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "BuildCraftAPI|recipes")
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
@Override
|
||||
public void registerRecipes() {
|
||||
// Add recipe for ethanol
|
||||
// TODO: Buildcraft for 1.9
|
||||
// BuildcraftRecipeRegistry.refinery.addRecipe("forestry:BiomassToEthanol", Fluids.BIOMASS.getFluid(4), Fluids.BIO_ETHANOL.getFluid(1), 100, 1);
|
||||
BuildcraftRecipeRegistry.refineryRecipes.addDistillationRecipe(Fluids.BIOMASS.getFluid(10),
|
||||
Fluids.BIO_ETHANOL.getFluid(0), Fluids.BIO_ETHANOL.getFluid(3), 20 * MjAPI.MJ);
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,20 @@
|
||||
******************************************************************************/
|
||||
package forestry.plugins;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import buildcraft.api.statements.ITriggerInternal;
|
||||
import buildcraft.api.statements.ITriggerInternalSided;
|
||||
import buildcraft.api.statements.ITriggerProvider;
|
||||
import buildcraft.api.statements.StatementManager;
|
||||
import forestry.api.modules.ForestryModule;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.ModUtil;
|
||||
@@ -19,12 +31,12 @@ import forestry.modules.BlankForestryModule;
|
||||
import forestry.modules.ForestryModuleUids;
|
||||
|
||||
@ForestryModule(containerID = ForestryCompatPlugins.ID, moduleID = ForestryModuleUids.BUILDCRAFT_STATEMENTS, name = "BuildCraft 6 Statements", author = "mezz", url = Constants.URL, unlocalizedDescription = "for.module.buildcraft6.description")
|
||||
//@Optional.Interface(iface = "buildcraft.api.statements.ITriggerProvider", modid = "BuildCraftAPI|statements")
|
||||
public class PluginBuildCraftStatements extends BlankForestryModule {//implements ITriggerProvider {
|
||||
@Optional.Interface(iface = "buildcraft.api.statements.ITriggerProvider", modid = Constants.BCLIB_MOD_ID)
|
||||
public class PluginBuildCraftStatements extends BlankForestryModule implements ITriggerProvider {
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return ModUtil.isAPILoaded("buildcraft.api.statements", "[1.0, 2.0)");
|
||||
return ModUtil.isModLoaded(Constants.BCLIB_MOD_ID, "[7.99.17,8.0)");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -32,35 +44,38 @@ public class PluginBuildCraftStatements extends BlankForestryModule {//implement
|
||||
return "Compatible BuildCraftAPI|statements version not found";
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
@Override
|
||||
public void doInit() {
|
||||
// Add custom trigger handler
|
||||
// TODO: Buildcraft for 1.9
|
||||
// StatementManager.registerTriggerProvider(this);
|
||||
StatementManager.registerTriggerProvider(this);
|
||||
}
|
||||
|
||||
/* ITriggerProvider */
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerInternal> getInternalTriggers(IStatementContainer container) {
|
||||
// TileEntity tile = container.getTile();
|
||||
// if (tile instanceof ITriggerProvider) {
|
||||
// return ((ITriggerProvider) tile).getInternalTriggers(container);
|
||||
// }
|
||||
//
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
// if (tile instanceof ITriggerProvider) {
|
||||
// return ((ITriggerProvider) tile).getExternalTriggers(side, tile);
|
||||
// }
|
||||
//
|
||||
// return null;
|
||||
// }
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
@Override
|
||||
public void addInternalTriggers(Collection<ITriggerInternal> triggers, IStatementContainer container) {
|
||||
TileEntity tile = container.getTile();
|
||||
if (tile instanceof ITriggerProvider) {
|
||||
((ITriggerProvider) tile).addInternalTriggers(triggers, container);
|
||||
}
|
||||
}
|
||||
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
@Override
|
||||
public void addInternalSidedTriggers(Collection<ITriggerInternalSided> triggers, IStatementContainer container, @Nonnull EnumFacing side) {
|
||||
TileEntity tile = container.getTile();
|
||||
if (tile instanceof ITriggerProvider) {
|
||||
((ITriggerProvider) tile).addInternalSidedTriggers(triggers, container, side);
|
||||
}
|
||||
}
|
||||
|
||||
@Optional.Method(modid = Constants.BCLIB_MOD_ID)
|
||||
@Override
|
||||
public void addExternalTriggers(Collection<ITriggerExternal> triggers, @Nonnull EnumFacing side, TileEntity tile) {
|
||||
if (tile instanceof ITriggerProvider) {
|
||||
((ITriggerProvider) tile).addExternalTriggers(triggers, side, tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1911,6 +1911,15 @@ for.config.gamemode.squeezer.mulch.apple.comment=modifies the chance of mulch pe
|
||||
|
||||
for.config.gamemode.energy.engine.clockwork.comment=Enable the clockwork engine.
|
||||
|
||||
for.config.power.types.rf=Redstone Flux
|
||||
for.config.power.types.rf.comment=Enable Redstone Flux power support.
|
||||
for.config.power.types.mj=MJ
|
||||
for.config.power.types.mj.comment=Enable MJ power support.
|
||||
for.config.power.types.tesla=Tesla
|
||||
for.config.power.types.tesla.comment=Enable Tesla power support.
|
||||
for.config.power.display.mode=Power Display Mode
|
||||
for.config.power.display.mode.comment=The format power will be displayed in in engine/machine interfaces.
|
||||
|
||||
###################################
|
||||
# CUSTOM BEE AND TREE SPECIES NAMES
|
||||
###################################
|
||||
|
||||
Reference in new issue
Block a user