mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-24 22:04:34 +00:00
Refactor fluids code, create PluginFluids
This commit is contained in:
1 parent
a4f7e4c583
commit
98e62aa1e3
17 files changed
+645
-556
No files matched your search
@@ -10,23 +10,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.plugins;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
import forestry.core.GameMode;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
|
||||
import buildcraft.api.fuels.BuildcraftFuelRegistry;
|
||||
import forestry.core.items.ItemLiquidContainer.EnumContainerType;
|
||||
|
||||
@Plugin(pluginID = "BC6|Fuels", name = "BuildCraft 6 Fuels", author = "mezz", url = Defaults.URL, unlocalizedDescription = "for.plugin.buildcraft6.description")
|
||||
public class PluginBuildCraftFuels extends ForestryPlugin {
|
||||
@@ -46,42 +39,12 @@ public class PluginBuildCraftFuels extends ForestryPlugin {
|
||||
public void doInit() {
|
||||
BuildcraftFuelRegistry.coolant.addCoolant(Fluids.ICE.getFluid(), 10.0f);
|
||||
|
||||
Fluid ethanol = Fluids.BIOETHANOL.getFluid();
|
||||
Fluid ethanol = Fluids.ETHANOL.getFluid();
|
||||
if (ethanol != null) {
|
||||
int ethanolPower = 40;
|
||||
int ethanolBurnTime = Math.round(Defaults.ENGINE_CYCLE_DURATION_ETHANOL * GameMode.getGameMode().getFloatSetting("fuel.ethanol.combustion"));
|
||||
BuildcraftFuelRegistry.fuel.addFuel(ethanol, ethanolPower, ethanolBurnTime);
|
||||
}
|
||||
|
||||
Fluid oil = Fluids.OIL.getFluid();
|
||||
if (oil != null) {
|
||||
Block oilBlock = oil.getBlock();
|
||||
if (oilBlock != null) {
|
||||
Color oilColor = new Color(0x404040);
|
||||
ForestryItem.waxCapsuleOil.registerContainer(EnumContainerType.CAPSULE, oilBlock, oilColor);
|
||||
ForestryItem.canOil.registerContainer(EnumContainerType.CAN, oilBlock, oilColor);
|
||||
ForestryItem.refractoryOil.registerContainer(EnumContainerType.REFRACTORY, oilBlock, oilColor);
|
||||
|
||||
LiquidHelper.injectLiquidContainer(Fluids.OIL, ForestryItem.waxCapsuleOil.getItemStack());
|
||||
LiquidHelper.injectLiquidContainer(Fluids.OIL, ForestryItem.refractoryOil.getItemStack());
|
||||
LiquidHelper.injectLiquidContainer(Fluids.OIL, ForestryItem.canOil.getItemStack());
|
||||
}
|
||||
}
|
||||
|
||||
Fluid fuel = Fluids.FUEL.getFluid();
|
||||
if (fuel != null) {
|
||||
Block fuelBlock = fuel.getBlock();
|
||||
if (fuelBlock != null) {
|
||||
Color fuelColor = new Color(0xffff00);
|
||||
ForestryItem.waxCapsuleFuel.registerContainer(EnumContainerType.CAPSULE, fuelBlock, fuelColor);
|
||||
ForestryItem.canFuel.registerContainer(EnumContainerType.CAN, fuelBlock, fuelColor);
|
||||
ForestryItem.refractoryFuel.registerContainer(EnumContainerType.REFRACTORY, fuelBlock, fuelColor);
|
||||
|
||||
LiquidHelper.injectLiquidContainer(Fluids.FUEL, ForestryItem.waxCapsuleFuel.getItemStack());
|
||||
LiquidHelper.injectLiquidContainer(Fluids.FUEL, ForestryItem.refractoryFuel.getItemStack());
|
||||
LiquidHelper.injectLiquidContainer(Fluids.FUEL, ForestryItem.canFuel.getItemStack());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,6 +33,6 @@ public class PluginBuildCraftRecipes extends ForestryPlugin {
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
// Add recipe for ethanol
|
||||
BuildcraftRecipeRegistry.refinery.addRecipe("forestry:BiomassToEthanol", Fluids.BIOMASS.getFluid(4), Fluids.BIOETHANOL.getFluid(1), 100, 1);
|
||||
BuildcraftRecipeRegistry.refinery.addRecipe("forestry:BiomassToEthanol", Fluids.BIOMASS.getFluid(4), Fluids.ETHANOL.getFluid(1), 100, 1);
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.plugins;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -43,7 +42,6 @@ import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.fluids.ForestryFluids;
|
||||
import forestry.core.gadgets.BlockBase;
|
||||
import forestry.core.gadgets.BlockResource;
|
||||
import forestry.core.gadgets.BlockResourceStorageBlock;
|
||||
@@ -65,7 +63,6 @@ import forestry.core.items.ItemForestryBlock;
|
||||
import forestry.core.items.ItemForestryPickaxe;
|
||||
import forestry.core.items.ItemForestryShovel;
|
||||
import forestry.core.items.ItemFruit;
|
||||
import forestry.core.items.ItemLiquidContainer;
|
||||
import forestry.core.items.ItemMisc;
|
||||
import forestry.core.items.ItemOverlay;
|
||||
import forestry.core.items.ItemOverlay.OverlayInfo;
|
||||
@@ -76,11 +73,6 @@ import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.ForestryModEnvWarningCallable;
|
||||
import forestry.core.utils.ShapedRecipeCustom;
|
||||
|
||||
import static forestry.core.items.ItemLiquidContainer.EnumContainerType.BUCKET;
|
||||
import static forestry.core.items.ItemLiquidContainer.EnumContainerType.CAN;
|
||||
import static forestry.core.items.ItemLiquidContainer.EnumContainerType.CAPSULE;
|
||||
import static forestry.core.items.ItemLiquidContainer.EnumContainerType.REFRACTORY;
|
||||
|
||||
@Plugin(pluginID = "Core", name = "Core", author = "SirSengir", url = Defaults.URL, unlocalizedDescription = "for.plugin.core.description")
|
||||
public class PluginCore extends ForestryPlugin {
|
||||
|
||||
@@ -96,10 +88,6 @@ public class PluginCore extends ForestryPlugin {
|
||||
rootCommand.addChildCommand(new CommandVersion());
|
||||
rootCommand.addChildCommand(new CommandPlugins());
|
||||
|
||||
ForestryFluids.preInit();
|
||||
MinecraftForge.EVENT_BUS.register(ForestryFluids.getTextureHook());
|
||||
MinecraftForge.EVENT_BUS.register(ForestryFluids.getFillBucketHook());
|
||||
|
||||
ChipsetManager.solderManager = new ItemSolderingIron.SolderManager();
|
||||
|
||||
CircuitRegistry circuitRegistry = new CircuitRegistry();
|
||||
@@ -149,8 +137,6 @@ public class PluginCore extends ForestryPlugin {
|
||||
public void doInit() {
|
||||
super.doInit();
|
||||
|
||||
ForestryFluids.init();
|
||||
|
||||
definitionEscritoire.register();
|
||||
crashCallable = new ForestryModEnvWarningCallable();
|
||||
|
||||
@@ -174,7 +160,6 @@ public class PluginCore extends ForestryPlugin {
|
||||
|
||||
@Override
|
||||
protected void registerItems() {
|
||||
|
||||
// / FERTILIZERS
|
||||
ForestryItem.fertilizerBio.registerItem((new ItemForestry()), "fertilizerBio");
|
||||
ForestryItem.fertilizerCompound.registerItem((new ItemForestry()).setBonemeal(true), "fertilizerCompound");
|
||||
@@ -278,58 +263,10 @@ public class PluginCore extends ForestryPlugin {
|
||||
|
||||
// FRUITS
|
||||
ForestryItem.fruits.registerItem(new ItemFruit(), "fruits");
|
||||
|
||||
// / EMPTY LIQUID CONTAINERS
|
||||
ForestryItem.waxCapsule.registerItem(new ItemLiquidContainer(CAPSULE, Blocks.air, null).setMaxStackSize(64), "waxCapsule");
|
||||
ForestryItem.canEmpty.registerItem(new ItemLiquidContainer(CAN, Blocks.air, null).setMaxStackSize(64), "canEmpty");
|
||||
ForestryItem.refractoryEmpty.registerItem(new ItemLiquidContainer(REFRACTORY, Blocks.air, null).setMaxStackSize(64), "refractoryEmpty");
|
||||
|
||||
// / BUCKETS
|
||||
ForestryItem.bucketBiomass.registerContainer(BUCKET, ForestryFluids.BIOMASS);
|
||||
ForestryItem.bucketEthanol.registerContainer(BUCKET, ForestryFluids.ETHANOL);
|
||||
ForestryItem.bucketGlass.registerContainer(BUCKET, ForestryFluids.LIQUID_GLASS);
|
||||
ForestryItem.bucketHoney.registerContainer(BUCKET, ForestryFluids.HONEY);
|
||||
ForestryItem.bucketIce.registerContainer(BUCKET, ForestryFluids.ICE);
|
||||
ForestryItem.bucketJuice.registerContainer(BUCKET, ForestryFluids.JUICE);
|
||||
ForestryItem.bucketSeedoil.registerContainer(BUCKET, ForestryFluids.SEEDOIL);
|
||||
ForestryItem.bucketShortMead.registerContainer(BUCKET, ForestryFluids.SHORT_MEAD);
|
||||
|
||||
Color colorWater = new Color(0x2432ec);
|
||||
Color colorLava = new Color(0xfd461f);
|
||||
|
||||
// / WAX CAPSULES
|
||||
ForestryItem.waxCapsuleBiomass.registerContainer(CAPSULE, ForestryFluids.BIOMASS);
|
||||
ForestryItem.waxCapsuleEthanol.registerContainer(CAPSULE, ForestryFluids.ETHANOL);
|
||||
ForestryItem.waxCapsuleHoney.registerContainer(CAPSULE, ForestryFluids.HONEY, Defaults.FOOD_HONEY_HEAL, Defaults.FOOD_HONEY_SATURATION);
|
||||
ForestryItem.waxCapsuleIce.registerContainer(CAPSULE, ForestryFluids.ICE);
|
||||
ForestryItem.waxCapsuleJuice.registerContainer(CAPSULE, ForestryFluids.JUICE, Defaults.FOOD_JUICE_HEAL, Defaults.FOOD_JUICE_SATURATION);
|
||||
ForestryItem.waxCapsuleSeedOil.registerContainer(CAPSULE, ForestryFluids.SEEDOIL);
|
||||
ForestryItem.waxCapsuleWater.registerContainer(CAPSULE, Blocks.flowing_water, colorWater);
|
||||
|
||||
// / CANS
|
||||
ForestryItem.canBiomass.registerContainer(CAN, ForestryFluids.BIOMASS);
|
||||
ForestryItem.canEthanol.registerContainer(CAN, ForestryFluids.ETHANOL);
|
||||
ForestryItem.canLava.registerContainer(CAN, Blocks.flowing_lava, colorLava);
|
||||
ForestryItem.canHoney.registerContainer(CAN, ForestryFluids.HONEY, Defaults.FOOD_HONEY_HEAL, Defaults.FOOD_HONEY_SATURATION);
|
||||
ForestryItem.canIce.registerContainer(CAN, ForestryFluids.ICE);
|
||||
ForestryItem.canJuice.registerContainer(CAN, ForestryFluids.JUICE, Defaults.FOOD_JUICE_HEAL, Defaults.FOOD_JUICE_SATURATION);
|
||||
ForestryItem.canSeedOil.registerContainer(CAN, ForestryFluids.SEEDOIL);
|
||||
ForestryItem.canWater.registerContainer(CAN, Blocks.flowing_water, colorWater);
|
||||
|
||||
// / REFRACTORY CAPSULES
|
||||
ForestryItem.refractoryBiomass.registerContainer(REFRACTORY, ForestryFluids.BIOMASS);
|
||||
ForestryItem.refractoryEthanol.registerContainer(REFRACTORY, ForestryFluids.ETHANOL);
|
||||
ForestryItem.refractoryLava.registerContainer(REFRACTORY, Blocks.flowing_lava, colorLava);
|
||||
ForestryItem.refractoryHoney.registerContainer(REFRACTORY, ForestryFluids.HONEY, Defaults.FOOD_HONEY_HEAL, Defaults.FOOD_HONEY_SATURATION);
|
||||
ForestryItem.refractoryIce.registerContainer(REFRACTORY, ForestryFluids.ICE);
|
||||
ForestryItem.refractoryJuice.registerContainer(REFRACTORY, ForestryFluids.JUICE, Defaults.FOOD_JUICE_HEAL, Defaults.FOOD_JUICE_SATURATION);
|
||||
ForestryItem.refractorySeedOil.registerContainer(REFRACTORY, ForestryFluids.SEEDOIL);
|
||||
ForestryItem.refractoryWater.registerContainer(REFRACTORY, Blocks.flowing_water, colorWater);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
ForestryFluids.postInit();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Executable → Regular
+1
-1
@@ -297,7 +297,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
|
||||
// STILL
|
||||
RecipeManagers.stillManager.addRecipe(Defaults.STILL_DESTILLATION_DURATION, Fluids.BIOMASS.getFluid(Defaults.STILL_DESTILLATION_INPUT),
|
||||
Fluids.BIOETHANOL.getFluid(Defaults.STILL_DESTILLATION_OUTPUT));
|
||||
Fluids.ETHANOL.getFluid(Defaults.STILL_DESTILLATION_OUTPUT));
|
||||
|
||||
// convert old honey to new honey
|
||||
RecipeManagers.stillManager.addRecipe(1, Fluids.LEGACY_HONEY.getFluid(1000), Fluids.HONEY.getFluid(1000));
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.plugins;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.fluids.BlockForestryFluid;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.items.ItemLiquidContainer;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
|
||||
import static forestry.core.items.ItemLiquidContainer.EnumContainerType;
|
||||
|
||||
@Plugin(pluginID = "Fluids", name = "Fluids", author = "mezz", url = Defaults.URL, unlocalizedDescription = "for.plugin.fluids.description")
|
||||
public class PluginFluids extends ForestryPlugin {
|
||||
|
||||
private static final List<Fluids> forestryFluidsWithBlocks = new ArrayList<Fluids>();
|
||||
|
||||
private static void createFluid(Fluids forestryFluid) {
|
||||
if (forestryFluid.getFluid() == null && Config.isFluidEnabled(forestryFluid)) {
|
||||
String fluidName = forestryFluid.getTag();
|
||||
if (!FluidRegistry.isFluidRegistered(fluidName)) {
|
||||
Fluid fluid = new Fluid(fluidName).setDensity(forestryFluid.getDensity()).setViscosity(forestryFluid.getViscosity()).setTemperature(forestryFluid.getTemperature());
|
||||
FluidRegistry.registerFluid(fluid);
|
||||
createBlock(forestryFluid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void createBlock(Fluids forestryFluid) {
|
||||
Fluid fluid = forestryFluid.getFluid();
|
||||
Block fluidBlock = fluid.getBlock();
|
||||
|
||||
if (Config.isBlockEnabled(forestryFluid.getTag())) {
|
||||
if (fluidBlock == null) {
|
||||
fluidBlock = forestryFluid.makeBlock();
|
||||
if (fluidBlock != null) {
|
||||
fluidBlock.setBlockName("forestry.fluid." + forestryFluid.getTag());
|
||||
Proxies.common.registerBlock(fluidBlock, ItemBlock.class);
|
||||
forestryFluidsWithBlocks.add(forestryFluid);
|
||||
}
|
||||
} else {
|
||||
GameRegistry.UniqueIdentifier blockID = GameRegistry.findUniqueIdentifierFor(fluidBlock);
|
||||
Proxies.log.severe("Pre-existing {0} fluid block detected, deferring to {1}:{2}, "
|
||||
+ "this may cause issues if the server/client have different mod load orders, "
|
||||
+ "recommended that you disable all but one instance of {0} fluid blocks via your configs.", fluid.getName(), blockID.modId, blockID.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
for (Fluids fluidType : Fluids.values()) {
|
||||
createFluid(fluidType);
|
||||
}
|
||||
MinecraftForge.EVENT_BUS.register(getTextureHook());
|
||||
MinecraftForge.EVENT_BUS.register(getFillBucketHook());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerItems() {
|
||||
for (EnumContainerType type : EnumContainerType.values()) {
|
||||
Item emptyContainer = new ItemLiquidContainer(type, Blocks.air, null);
|
||||
switch (type) {
|
||||
case CAN:
|
||||
ForestryItem.canEmpty.registerItem(emptyContainer, "canEmpty");
|
||||
break;
|
||||
case CAPSULE:
|
||||
ForestryItem.waxCapsule.registerItem(emptyContainer, "waxCapsule");
|
||||
break;
|
||||
case REFRACTORY:
|
||||
ForestryItem.refractoryEmpty.registerItem(emptyContainer, "refractoryEmpty");
|
||||
break;
|
||||
}
|
||||
|
||||
for (Fluids fluidType : Fluids.values()) {
|
||||
ForestryItem container = fluidType.getContainerForType(type);
|
||||
if (container == null)
|
||||
continue;
|
||||
|
||||
ItemLiquidContainer liquidContainer = new ItemLiquidContainer(type, fluidType.getBlock(), fluidType.getColor());
|
||||
fluidType.setDrink(liquidContainer);
|
||||
container.registerItem(liquidContainer, container.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doInit() {
|
||||
for (Fluids fluidType : Fluids.values()) {
|
||||
if (fluidType.getFluid() == null)
|
||||
continue;
|
||||
|
||||
for (EnumContainerType type : EnumContainerType.values()) {
|
||||
ForestryItem container = fluidType.getContainerForType(type);
|
||||
if (container == null)
|
||||
continue;
|
||||
|
||||
LiquidHelper.injectLiquidContainer(fluidType, container.getItemStack());
|
||||
}
|
||||
|
||||
for (ItemStack filledContainer : fluidType.getOtherContainers()) {
|
||||
LiquidHelper.injectLiquidContainer(fluidType, filledContainer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class MissingFluidException extends RuntimeException {
|
||||
public MissingFluidException(String tag) {
|
||||
super("Fluid '" + tag + "' was not found. Please check your configs.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
for (Fluids fluidType : Fluids.values()) {
|
||||
if (fluidType.getFluid() == null)
|
||||
throw new MissingFluidException(fluidType.getTag());
|
||||
}
|
||||
}
|
||||
|
||||
public static class TextureHook {
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void textureHook(TextureStitchEvent.Post event) {
|
||||
if (event.map.getTextureType() == 0) {
|
||||
for (Fluids fluidType : forestryFluidsWithBlocks) {
|
||||
Fluid fluid = fluidType.getFluid();
|
||||
Block fluidBlock = fluidType.getBlock();
|
||||
if (fluid != null && fluidBlock != null)
|
||||
fluid.setIcons(fluidBlock.getBlockTextureFromSide(1), fluidBlock.getBlockTextureFromSide(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Object getTextureHook() {
|
||||
return new TextureHook();
|
||||
}
|
||||
|
||||
public static class FillBucketHook {
|
||||
@SubscribeEvent
|
||||
public void fillBucket(FillBucketEvent event) {
|
||||
MovingObjectPosition movingObjectPosition = event.target;
|
||||
int x = movingObjectPosition.blockX;
|
||||
int y = movingObjectPosition.blockY;
|
||||
int z = movingObjectPosition.blockZ;
|
||||
Block targetedBlock = event.world.getBlock(x, y, z);
|
||||
if (targetedBlock instanceof BlockForestryFluid) {
|
||||
Item filledBucket = ItemLiquidContainer.getExistingBucket(targetedBlock);
|
||||
if (filledBucket != null) {
|
||||
event.result = new ItemStack(filledBucket);
|
||||
event.setResult(Event.Result.ALLOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Object getFillBucketHook() {
|
||||
return new FillBucketHook();
|
||||
}
|
||||
}
|
||||
@@ -195,7 +195,7 @@ public class PluginIC2 extends ForestryPlugin {
|
||||
definitionEngineTin.register();
|
||||
definitionGenerator.register();
|
||||
|
||||
FluidStack ethanol = Fluids.BIOETHANOL.getFluid(1);
|
||||
FluidStack ethanol = Fluids.ETHANOL.getFluid(1);
|
||||
GeneratorFuel ethanolFuel = new GeneratorFuel(ethanol, (int) (32 * GameMode.getGameMode().getFloatSetting("fuel.ethanol.generator")), 4);
|
||||
FuelManager.generatorFuel.put(ethanol.getFluid(), ethanolFuel);
|
||||
|
||||
|
||||
@@ -61,7 +61,8 @@ public class PluginManager {
|
||||
|
||||
public enum Module {
|
||||
|
||||
CORE(new PluginCore()),
|
||||
CORE(new PluginCore(), false),
|
||||
FLUIDS(new PluginFluids(), false),
|
||||
APICULTURE(new PluginApiculture()),
|
||||
ARBORICULTURE(new PluginArboriculture()),
|
||||
ENERGY(new PluginEnergy()),
|
||||
@@ -82,9 +83,15 @@ public class PluginManager {
|
||||
NATURA(new PluginNatura()),;
|
||||
|
||||
private final ForestryPlugin instance;
|
||||
private final boolean canBeDisabled;
|
||||
|
||||
private Module(ForestryPlugin plugin) {
|
||||
this(plugin, true);
|
||||
}
|
||||
|
||||
private Module(ForestryPlugin plugin, boolean canBeDisabled) {
|
||||
this.instance = plugin;
|
||||
this.canBeDisabled = canBeDisabled;
|
||||
}
|
||||
|
||||
public ForestryPlugin instance() {
|
||||
@@ -95,6 +102,10 @@ public class PluginManager {
|
||||
return isModuleLoaded(this);
|
||||
}
|
||||
|
||||
public boolean canBeDisabled() {
|
||||
return canBeDisabled;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Stage getStage() {
|
||||
@@ -128,7 +139,7 @@ public class PluginManager {
|
||||
Iterator<Module> it = toLoad.iterator();
|
||||
while (it.hasNext()) {
|
||||
Module m = it.next();
|
||||
if (m == Module.CORE)
|
||||
if (!m.canBeDisabled())
|
||||
continue;
|
||||
if (!isEnabled(config, m)) {
|
||||
it.remove();
|
||||
|
||||
Reference in new issue
Block a user