mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-22 21:19:56 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f431507d8b | ||
|
|
73d5cf353f | ||
|
|
ef0de4c86c | ||
|
|
03d1177079 | ||
|
|
8a47994438 | ||
|
|
1a3b24c589 | ||
|
|
d77c705d54 | ||
|
|
3222bf35ca | ||
|
|
56c2e72748 | ||
|
|
0f2e6bd76e | ||
|
|
880f952d0f | ||
|
|
5db9be848f | ||
|
|
57345f4daa | ||
|
|
ccd425de9d | ||
|
|
df042779de | ||
|
|
162ac5a46c | ||
|
|
1077567cc3 | ||
|
|
a5ac246a28 |
No files matched your search
+1
-1
@@ -4,7 +4,7 @@ dependencies {
|
|||||||
api('com.github.GTNewHorizons:ForestryMC:4.10.0:dev')
|
api('com.github.GTNewHorizons:ForestryMC:4.10.0:dev')
|
||||||
implementation('com.github.GTNewHorizons:GTNHLib:0.6.0:dev')
|
implementation('com.github.GTNewHorizons:GTNHLib:0.6.0:dev')
|
||||||
|
|
||||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.7.0-GTNH:dev')
|
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.7.4-GTNH:dev')
|
||||||
|
|
||||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.39:api')
|
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.39:api')
|
||||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
||||||
|
|||||||
@@ -8,14 +8,12 @@ import binnie.core.genetics.ManagerGenetics;
|
|||||||
import binnie.core.item.ManagerItem;
|
import binnie.core.item.ManagerItem;
|
||||||
import binnie.core.liquid.ManagerLiquid;
|
import binnie.core.liquid.ManagerLiquid;
|
||||||
import binnie.core.machines.ManagerMachine;
|
import binnie.core.machines.ManagerMachine;
|
||||||
import binnie.core.mod.config.ManagerConfig;
|
|
||||||
import binnie.core.resource.ManagerResource;
|
import binnie.core.resource.ManagerResource;
|
||||||
|
|
||||||
public final class Binnie {
|
public final class Binnie {
|
||||||
|
|
||||||
public static List<ManagerBase> Managers = new ArrayList<>();
|
public static List<ManagerBase> Managers = new ArrayList<>();
|
||||||
public static ManagerGenetics Genetics = new ManagerGenetics();
|
public static ManagerGenetics Genetics = new ManagerGenetics();
|
||||||
public static ManagerConfig Configuration = new ManagerConfig();
|
|
||||||
public static ManagerLiquid Liquid = new ManagerLiquid();
|
public static ManagerLiquid Liquid = new ManagerLiquid();
|
||||||
public static ManagerMachine Machine = new ManagerMachine();
|
public static ManagerMachine Machine = new ManagerMachine();
|
||||||
public static ManagerItem Item = new ManagerItem();
|
public static ManagerItem Item = new ManagerItem();
|
||||||
|
|||||||
@@ -303,11 +303,6 @@ public class Botany extends AbstractMod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isActive() {
|
|
||||||
return BinnieCore.isBotanyActive();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void onIMC(FMLInterModComms.IMCEvent event) {
|
public void onIMC(FMLInterModComms.IMCEvent event) {
|
||||||
for (FMLInterModComms.IMCMessage message : event.getMessages()) {
|
for (FMLInterModComms.IMCMessage message : event.getMessages()) {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
|
||||||
import binnie.Binnie;
|
|
||||||
import binnie.core.gui.IBinnieGUID;
|
import binnie.core.gui.IBinnieGUID;
|
||||||
import binnie.core.mod.parser.FieldParser;
|
import binnie.core.mod.parser.FieldParser;
|
||||||
import binnie.core.network.BinniePacketHandler;
|
import binnie.core.network.BinniePacketHandler;
|
||||||
@@ -33,7 +32,9 @@ public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
|||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract boolean isActive();
|
public boolean isActive() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract String getChannel();
|
public abstract String getChannel();
|
||||||
@@ -47,10 +48,6 @@ public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
|||||||
return new IBinnieGUID[0];
|
return new IBinnieGUID[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<?>[] getConfigs() {
|
|
||||||
return new Class[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract IProxyCore getProxy();
|
public abstract IProxyCore getProxy();
|
||||||
|
|
||||||
public abstract String getModID();
|
public abstract String getModID();
|
||||||
@@ -67,12 +64,6 @@ public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getConfigs() != null) {
|
|
||||||
for (Class<?> cls : getConfigs()) {
|
|
||||||
Binnie.Configuration.registerConfiguration(cls, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getProxy().preInit();
|
getProxy().preInit();
|
||||||
for (IInitializable module : modules) {
|
for (IInitializable module : modules) {
|
||||||
module.preInit();
|
module.preInit();
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ import binnie.core.liquid.FluidContainer;
|
|||||||
import binnie.core.liquid.ItemFluidContainer;
|
import binnie.core.liquid.ItemFluidContainer;
|
||||||
import binnie.core.machines.MachineGroup;
|
import binnie.core.machines.MachineGroup;
|
||||||
import binnie.core.machines.storage.ModuleStorage;
|
import binnie.core.machines.storage.ModuleStorage;
|
||||||
import binnie.core.mod.config.ConfigurationMain;
|
|
||||||
import binnie.core.mod.config.ConfigurationMods;
|
|
||||||
import binnie.core.mod.parser.FieldParser;
|
import binnie.core.mod.parser.FieldParser;
|
||||||
import binnie.core.mod.parser.ItemParser;
|
import binnie.core.mod.parser.ItemParser;
|
||||||
import binnie.core.network.BinnieCorePacketID;
|
import binnie.core.network.BinnieCorePacketID;
|
||||||
@@ -49,13 +47,16 @@ import forestry.api.core.ForestryEvent;
|
|||||||
import forestry.plugins.PluginManager;
|
import forestry.plugins.PluginManager;
|
||||||
|
|
||||||
@Mod(
|
@Mod(
|
||||||
modid = "BinnieCore",
|
modid = BinnieCore.CORE_MODID,
|
||||||
name = "Binnie Core",
|
name = BinnieCore.CORE_MOD_NAME,
|
||||||
version = Tags.VERSION,
|
version = Tags.VERSION,
|
||||||
useMetadata = true,
|
useMetadata = true,
|
||||||
dependencies = "after:Forestry@[4.2,),required-after:gtnhlib@[0.0.10,)")
|
dependencies = "after:Forestry@[4.2,),required-after:gtnhlib@[0.0.10,)")
|
||||||
public class BinnieCore extends AbstractMod {
|
public class BinnieCore extends AbstractMod {
|
||||||
|
|
||||||
|
public static final String CORE_MODID = "BinnieCore";
|
||||||
|
public static final String CORE_MOD_NAME = "Binnie Core";
|
||||||
|
|
||||||
@Mod.Instance("BinnieCore")
|
@Mod.Instance("BinnieCore")
|
||||||
public static BinnieCore instance;
|
public static BinnieCore instance;
|
||||||
|
|
||||||
@@ -70,7 +71,6 @@ public class BinnieCore extends AbstractMod {
|
|||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
Binnie.Configuration.registerConfiguration(ConfigurationMods.class, this);
|
|
||||||
for (ManagerBase baseManager : Binnie.Managers) {
|
for (ManagerBase baseManager : Binnie.Managers) {
|
||||||
addModule(baseManager);
|
addModule(baseManager);
|
||||||
}
|
}
|
||||||
@@ -134,20 +134,12 @@ public class BinnieCore extends AbstractMod {
|
|||||||
return PluginManager.Module.ARBORICULTURE.isEnabled();
|
return PluginManager.Module.ARBORICULTURE.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isBotanyActive() {
|
|
||||||
return ConfigurationMods.botany;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isGeneticsActive() {
|
|
||||||
return ConfigurationMods.genetics;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isExtraBeesActive() {
|
public static boolean isExtraBeesActive() {
|
||||||
return ConfigurationMods.extraBees && isApicultureActive();
|
return isApicultureActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isExtraTreesActive() {
|
public static boolean isExtraTreesActive() {
|
||||||
return ConfigurationMods.extraTrees && isArboricultureActive();
|
return isArboricultureActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -215,11 +207,6 @@ public class BinnieCore extends AbstractMod {
|
|||||||
Binnie.Resource.registerIcons(event.map, event.map.getTextureType());
|
Binnie.Resource.registerIcons(event.map, event.map.getTextureType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<?>[] getConfigs() {
|
|
||||||
return new Class[] { ConfigurationMain.class };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
||||||
return PacketHandler.class;
|
return PacketHandler.class;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ public class Mods {
|
|||||||
public static final Mod botania = new Mod("Botania");
|
public static final Mod botania = new Mod("Botania");
|
||||||
public static final Mod extraBiomes = new Mod("ExtrabiomesXL");
|
public static final Mod extraBiomes = new Mod("ExtrabiomesXL");
|
||||||
public static final Mod dreamcraft = new Mod("dreamcraft");
|
public static final Mod dreamcraft = new Mod("dreamcraft");
|
||||||
|
public static final Mod buildcraftCore = new Mod("BuildCraft|Core");
|
||||||
|
|
||||||
private static Item findItem(String modId, String name) {
|
private static Item findItem(String modId, String name) {
|
||||||
Item stack = GameRegistry.findItem(modId, name);
|
Item stack = GameRegistry.findItem(modId, name);
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package binnie.core.craftgui.minecraft.control;
|
package binnie.core.craftgui.minecraft.control;
|
||||||
|
|
||||||
import net.minecraft.inventory.IInventory;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import binnie.core.craftgui.CraftGUI;
|
import binnie.core.craftgui.CraftGUI;
|
||||||
@@ -17,8 +15,6 @@ import binnie.core.craftgui.minecraft.MinecraftTooltip;
|
|||||||
import binnie.core.craftgui.minecraft.Window;
|
import binnie.core.craftgui.minecraft.Window;
|
||||||
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
||||||
import binnie.core.machines.Machine;
|
import binnie.core.machines.Machine;
|
||||||
import binnie.core.machines.TileEntityMachine;
|
|
||||||
import binnie.core.machines.power.IPoweredMachine;
|
|
||||||
import binnie.core.machines.power.IProcess;
|
import binnie.core.machines.power.IProcess;
|
||||||
import binnie.core.util.I18N;
|
import binnie.core.util.I18N;
|
||||||
|
|
||||||
@@ -34,17 +30,6 @@ public class ControlEnergyBar extends Control implements ITooltip {
|
|||||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO unused method?
|
|
||||||
public IPoweredMachine getClientPower() {
|
|
||||||
IInventory inventory = Window.get(this).getInventory();
|
|
||||||
TileEntityMachine machine = (inventory instanceof TileEntityMachine) ? (TileEntityMachine) inventory : null;
|
|
||||||
if (machine == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return machine.getMachine().getInterface(IPoweredMachine.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getPercentage() {
|
public float getPercentage() {
|
||||||
float percentage = 100.0f * getStoredEnergy() / getMaxEnergy();
|
float percentage = 100.0f * getStoredEnergy() / getMaxEnergy();
|
||||||
if (percentage > 100.0f) {
|
if (percentage > 100.0f) {
|
||||||
|
|||||||
@@ -58,9 +58,8 @@ public class ManagerGenetics extends ManagerBase {
|
|||||||
if (BinnieCore.isLepidopteryActive()) {
|
if (BinnieCore.isLepidopteryActive()) {
|
||||||
mothBreedingSystem = new MothBreedingSystem();
|
mothBreedingSystem = new MothBreedingSystem();
|
||||||
}
|
}
|
||||||
if (BinnieCore.isBotanyActive()) {
|
|
||||||
flowerBreedingSystem = new FlowerBreedingSystem();
|
flowerBreedingSystem = new FlowerBreedingSystem();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class ModuleItems implements IInitializable {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onUseFieldKit(PlayerInteractEvent event) {
|
public void onUseFieldKit(PlayerInteractEvent event) {
|
||||||
if (!BinnieCore.isBotanyActive() || event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,4 @@ import binnie.core.network.IOrdinaled;
|
|||||||
public interface IMachineType extends IOrdinaled {
|
public interface IMachineType extends IOrdinaled {
|
||||||
|
|
||||||
Class<? extends MachinePackage> getPackageClass();
|
Class<? extends MachinePackage> getPackageClass();
|
||||||
|
|
||||||
boolean isActive();
|
|
||||||
}
|
}
|
||||||
@@ -31,14 +31,14 @@ public class MachineGroup {
|
|||||||
this.blockName = blockName;
|
this.blockName = blockName;
|
||||||
|
|
||||||
for (IMachineType type : types) {
|
for (IMachineType type : types) {
|
||||||
if (type.getPackageClass() != null && type.isActive()) {
|
if (type.getPackageClass() != null) {
|
||||||
try {
|
try {
|
||||||
MachinePackage pack = type.getPackageClass().newInstance();
|
MachinePackage pack = type.getPackageClass().newInstance();
|
||||||
pack.assignMetadata(type.ordinal());
|
pack.assignMetadata(type.ordinal());
|
||||||
pack.setActive(type.isActive());
|
pack.setActive(true);
|
||||||
addPackage(pack);
|
addPackage(pack);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException("Failed to create machine package " + type.toString(), e);
|
throw new RuntimeException("Failed to create machine package " + type, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,233 +0,0 @@
|
|||||||
package binnie.core.machines.inventory;
|
|
||||||
|
|
||||||
import net.minecraft.inventory.IInventory;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.fluids.IFluidTank;
|
|
||||||
|
|
||||||
import binnie.core.machines.Machine;
|
|
||||||
import binnie.core.machines.power.ITankMachine;
|
|
||||||
|
|
||||||
// TODO unused class?
|
|
||||||
public class TransferHandler {
|
|
||||||
|
|
||||||
public static ItemStack transfer(ItemStack item, IInventory origin, IInventory destination, boolean doAdd) {
|
|
||||||
ItemStack ret = transferItemToInventory(item, destination, doAdd);
|
|
||||||
if (destination instanceof ITankMachine) {
|
|
||||||
ret = transferContainerIntoTank(ret, origin, (ITankMachine) destination, doAdd);
|
|
||||||
ret = transferTankIntoContainer(ret, origin, (ITankMachine) destination, doAdd);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack transferItemToInventory(ItemStack item, IInventory destination, boolean doAdd) {
|
|
||||||
if (item == null || destination == null) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack addition = item.copy();
|
|
||||||
for (int i = 0; i < destination.getSizeInventory(); ++i) {
|
|
||||||
addition = transferToInventory(addition, destination, new int[] { i }, doAdd, false);
|
|
||||||
if (addition == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return addition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack transferToInventory(ItemStack item, IInventory destination, int[] targetSlots,
|
|
||||||
boolean doAdd, boolean ignoreValidation) {
|
|
||||||
for (int i : targetSlots) {
|
|
||||||
if (destination.isItemValidForSlot(i, item) || ignoreValidation) {
|
|
||||||
if (destination.getStackInSlot(i) == null) {
|
|
||||||
if (doAdd) {
|
|
||||||
destination.setInventorySlotContents(i, item.copy());
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (item.isStackable()) {
|
|
||||||
ItemStack merged = destination.getStackInSlot(i).copy();
|
|
||||||
ItemStack[] newStacks = mergeStacks(item.copy(), merged.copy());
|
|
||||||
item = newStacks[0];
|
|
||||||
if (doAdd) {
|
|
||||||
destination.setInventorySlotContents(i, newStacks[1]);
|
|
||||||
}
|
|
||||||
if (item == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack[] mergeStacks(ItemStack itemstack, ItemStack merged) {
|
|
||||||
if (ItemStack.areItemStackTagsEqual(itemstack, merged) && itemstack.isItemEqual(merged)) {
|
|
||||||
int space = merged.getMaxStackSize() - merged.stackSize;
|
|
||||||
if (space > 0) {
|
|
||||||
if (itemstack.stackSize > space) {
|
|
||||||
itemstack.stackSize -= space;
|
|
||||||
merged.stackSize += space;
|
|
||||||
} else {
|
|
||||||
merged.stackSize += itemstack.stackSize;
|
|
||||||
itemstack = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new ItemStack[] { itemstack, merged };
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack transferContainerIntoTank(ItemStack item, IInventory origin, ITankMachine destination,
|
|
||||||
boolean doAdd) {
|
|
||||||
if (item == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
IFluidTank[] tanks = destination.getTanks();
|
|
||||||
ItemStack stack = item.copy();
|
|
||||||
for (int i = 0; i < tanks.length; ++i) {
|
|
||||||
stack = transferToTank(stack, origin, destination, i, doAdd);
|
|
||||||
}
|
|
||||||
return stack;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack transferTankIntoContainer(ItemStack item, IInventory origin, ITankMachine destination,
|
|
||||||
boolean doAdd) {
|
|
||||||
if (item == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
IFluidTank[] tanks = destination.getTanks();
|
|
||||||
ItemStack stack = item.copy();
|
|
||||||
for (int i = 0; i < tanks.length; ++i) {
|
|
||||||
stack = transferFromTank(stack, origin, destination, i, doAdd);
|
|
||||||
}
|
|
||||||
return stack;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack transferToTank(ItemStack item, IInventory origin, ITankMachine destination, int tankID,
|
|
||||||
boolean doAdd) {
|
|
||||||
if (item == null) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
FluidStack containerLiquid = null;
|
|
||||||
FluidContainerRegistry.FluidContainerData containerLiquidData = null;
|
|
||||||
for (FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry
|
|
||||||
.getRegisteredFluidContainerData()) {
|
|
||||||
if (data.filledContainer.isItemEqual(item)) {
|
|
||||||
containerLiquidData = data;
|
|
||||||
containerLiquid = data.fluid.copy();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (containerLiquid == null) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
IFluidTank tank = destination.getTanks()[tankID];
|
|
||||||
IValidatedTankContainer validated = Machine.getInterface(IValidatedTankContainer.class, destination);
|
|
||||||
if (validated != null && !validated.isLiquidValidForTank(containerLiquid, tankID)) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
FluidStack largeAmountOfLiquid = containerLiquid.copy();
|
|
||||||
largeAmountOfLiquid.amount = tank.getCapacity();
|
|
||||||
int amountAdded = tank.fill(largeAmountOfLiquid, false);
|
|
||||||
int numberOfContainersToAdd = amountAdded / containerLiquid.amount;
|
|
||||||
if (numberOfContainersToAdd > item.stackSize) {
|
|
||||||
numberOfContainersToAdd = item.stackSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack copy;
|
|
||||||
ItemStack leftOverContainers = copy = item.copy();
|
|
||||||
copy.stackSize -= numberOfContainersToAdd;
|
|
||||||
if (leftOverContainers.stackSize <= 0) {
|
|
||||||
leftOverContainers = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack emptyContainers = containerLiquidData.emptyContainer.copy();
|
|
||||||
emptyContainers.stackSize = 0;
|
|
||||||
ItemStack itemStack = emptyContainers;
|
|
||||||
itemStack.stackSize += numberOfContainersToAdd;
|
|
||||||
if (emptyContainers.stackSize <= 0) {
|
|
||||||
emptyContainers = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack containersThatCantBeDumped = transferItemToInventory(emptyContainers, origin, false);
|
|
||||||
if (containersThatCantBeDumped != null) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (doAdd) {
|
|
||||||
FluidStack copy2;
|
|
||||||
FluidStack liquidToFillTank = copy2 = containerLiquid.copy();
|
|
||||||
copy2.amount *= numberOfContainersToAdd;
|
|
||||||
tank.fill(liquidToFillTank, true);
|
|
||||||
transferItemToInventory(emptyContainers, origin, true);
|
|
||||||
}
|
|
||||||
return leftOverContainers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack transferFromTank(ItemStack item, IInventory origin, ITankMachine destination, int tankID,
|
|
||||||
boolean doAdd) {
|
|
||||||
if (item == null) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
IFluidTank tank = destination.getTanks()[tankID];
|
|
||||||
FluidStack liquidInTank = tank.getFluid();
|
|
||||||
if (liquidInTank == null) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
FluidContainerRegistry.FluidContainerData containerLiquidData = null;
|
|
||||||
for (FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry
|
|
||||||
.getRegisteredFluidContainerData()) {
|
|
||||||
if (data.emptyContainer.isItemEqual(item) && liquidInTank.isFluidEqual(data.fluid)) {
|
|
||||||
containerLiquidData = data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (containerLiquidData == null) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
int maximumExtractedLiquid = item.stackSize * containerLiquidData.fluid.amount;
|
|
||||||
FluidStack drainedLiquid = tank.drain(maximumExtractedLiquid, false);
|
|
||||||
int amountInTank = (drainedLiquid == null) ? 0 : drainedLiquid.amount;
|
|
||||||
int numberOfContainersToFill = amountInTank / containerLiquidData.fluid.amount;
|
|
||||||
if (numberOfContainersToFill > item.stackSize) {
|
|
||||||
numberOfContainersToFill = item.stackSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack copy;
|
|
||||||
ItemStack leftOverContainers = copy = item.copy();
|
|
||||||
copy.stackSize -= numberOfContainersToFill;
|
|
||||||
if (leftOverContainers.stackSize <= 0) {
|
|
||||||
leftOverContainers = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack filledContainers = containerLiquidData.filledContainer.copy();
|
|
||||||
filledContainers.stackSize = 0;
|
|
||||||
ItemStack itemStack = filledContainers;
|
|
||||||
itemStack.stackSize += numberOfContainersToFill;
|
|
||||||
if (filledContainers.stackSize <= 0) {
|
|
||||||
filledContainers = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack containersThatCantBeDumped = transferItemToInventory(filledContainers, origin, false);
|
|
||||||
if (containersThatCantBeDumped != null) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (doAdd) {
|
|
||||||
tank.drain(maximumExtractedLiquid, true);
|
|
||||||
transferItemToInventory(filledContainers, origin, true);
|
|
||||||
}
|
|
||||||
return leftOverContainers;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -32,11 +32,6 @@ enum Compartment implements IMachineType {
|
|||||||
return clss;
|
return clss;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isActive() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack get(int i) {
|
public ItemStack get(int i) {
|
||||||
return new ItemStack(BinnieCore.packageCompartment.getBlock(), i, ordinal());
|
return new ItemStack(BinnieCore.packageCompartment.getBlock(), i, ordinal());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
package binnie.core.machines.transfer;
|
|
||||||
|
|
||||||
// TODO unused class?
|
|
||||||
public class TransferHandler {
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package binnie.core.mod.config;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import net.minecraftforge.common.config.Configuration;
|
|
||||||
|
|
||||||
import binnie.core.AbstractMod;
|
|
||||||
import binnie.core.BinnieCore;
|
|
||||||
|
|
||||||
public class BinnieConfiguration extends Configuration {
|
|
||||||
|
|
||||||
public AbstractMod mod;
|
|
||||||
private final String filename;
|
|
||||||
|
|
||||||
public BinnieConfiguration(String filename, AbstractMod mod) {
|
|
||||||
super(new File(BinnieCore.proxy.getDirectory(), filename));
|
|
||||||
this.mod = mod;
|
|
||||||
this.filename = filename;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package binnie.core.mod.config;
|
|
||||||
|
|
||||||
// TODO Why do we need this class?
|
|
||||||
class BinnieItemData {
|
|
||||||
|
|
||||||
private final int item;
|
|
||||||
private final BinnieConfiguration configFile;
|
|
||||||
private final String configKey;
|
|
||||||
|
|
||||||
public BinnieItemData(int item, BinnieConfiguration configFile, String configKey) {
|
|
||||||
this.item = item;
|
|
||||||
this.configFile = configFile;
|
|
||||||
this.configKey = configKey;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package binnie.core.mod.config;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
public @interface ConfigFile {
|
|
||||||
|
|
||||||
String filename();
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package binnie.core.mod.config;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target({ ElementType.FIELD })
|
|
||||||
public @interface ConfigProperty {
|
|
||||||
|
|
||||||
String key();
|
|
||||||
|
|
||||||
String category() default "";
|
|
||||||
|
|
||||||
String[] comment() default {};
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target({ ElementType.ANNOTATION_TYPE })
|
|
||||||
@interface Type {
|
|
||||||
|
|
||||||
Class<? extends PropertyBase> propertyClass();
|
|
||||||
|
|
||||||
String category() default "general";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package binnie.core.mod.config;
|
|
||||||
|
|
||||||
@ConfigFile(filename = "/config/forestry/binniecore/main.conf")
|
|
||||||
public class ConfigurationMain {
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package binnie.core.mod.config;
|
|
||||||
|
|
||||||
@ConfigFile(filename = "/config/forestry/binnie-mods.conf")
|
|
||||||
public class ConfigurationMods {
|
|
||||||
|
|
||||||
@ConfigProperty(key = "extraBees", comment = { "Enables the Extra Bees Mod." })
|
|
||||||
@PropBoolean
|
|
||||||
public static boolean extraBees = true;
|
|
||||||
|
|
||||||
@ConfigProperty(key = "extraTrees", comment = { "Enables the Extra Trees Mod." })
|
|
||||||
@PropBoolean
|
|
||||||
public static boolean extraTrees = true;
|
|
||||||
|
|
||||||
@ConfigProperty(key = "botany", comment = { "Enables the Botany Mod." })
|
|
||||||
@PropBoolean
|
|
||||||
public static boolean botany = true;
|
|
||||||
|
|
||||||
@ConfigProperty(key = "genetics", comment = { "Enables the Genetics Mod." })
|
|
||||||
@PropBoolean
|
|
||||||
public static boolean genetics = true;
|
|
||||||
}
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
package binnie.core.mod.config;
|
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import net.minecraftforge.common.config.Configuration;
|
|
||||||
|
|
||||||
import binnie.core.AbstractMod;
|
|
||||||
import binnie.core.ManagerBase;
|
|
||||||
|
|
||||||
public class ManagerConfig extends ManagerBase {
|
|
||||||
|
|
||||||
private final Map<Class<?>, Configuration> configurations;
|
|
||||||
private final Map<AbstractMod, List<BinnieItemData>> itemIDs;
|
|
||||||
|
|
||||||
public ManagerConfig() {
|
|
||||||
configurations = new LinkedHashMap<>();
|
|
||||||
itemIDs = new HashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerConfiguration(Class<?> cls, AbstractMod mod) {
|
|
||||||
if (cls.isAnnotationPresent(ConfigFile.class)) {
|
|
||||||
loadConfiguration(cls, mod);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadConfiguration(Class<?> cls, AbstractMod mod) {
|
|
||||||
try {
|
|
||||||
String filename = cls.getAnnotation(ConfigFile.class).filename();
|
|
||||||
BinnieConfiguration config = new BinnieConfiguration(filename, mod);
|
|
||||||
config.load();
|
|
||||||
for (Field field : cls.getFields()) {
|
|
||||||
if (field.isAnnotationPresent(ConfigProperty.class)) {
|
|
||||||
ConfigProperty propertyAnnot = field.getAnnotation(ConfigProperty.class);
|
|
||||||
for (Annotation annotation : field.getAnnotations()) {
|
|
||||||
if (annotation.annotationType().isAnnotationPresent(ConfigProperty.Type.class)) {
|
|
||||||
Class<?> propertyClass = annotation.annotationType()
|
|
||||||
.getAnnotation(ConfigProperty.Type.class).propertyClass();
|
|
||||||
// TODO what for?
|
|
||||||
PropertyBase property = (PropertyBase) propertyClass.getConstructor(
|
|
||||||
Field.class,
|
|
||||||
BinnieConfiguration.class,
|
|
||||||
ConfigProperty.class,
|
|
||||||
annotation.annotationType()).newInstance(
|
|
||||||
field,
|
|
||||||
config,
|
|
||||||
propertyAnnot,
|
|
||||||
annotation.annotationType().cast(annotation));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
config.save();
|
|
||||||
configurations.put(cls, config);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addItemID(Integer configValue, String configKey, BinnieConfiguration configFile) {
|
|
||||||
if (!itemIDs.containsKey(configFile.mod)) {
|
|
||||||
itemIDs.put(configFile.mod, new ArrayList<>());
|
|
||||||
}
|
|
||||||
itemIDs.get(configFile.mod).add(new BinnieItemData(configValue + 256, configFile, configKey));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package binnie.core.mod.config;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
import net.minecraftforge.common.config.Property;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@ConfigProperty.Type(propertyClass = PropBoolean.PropertyBoolean.class)
|
|
||||||
public @interface PropBoolean {
|
|
||||||
|
|
||||||
class PropertyBoolean extends PropertyBase<Boolean, PropBoolean> {
|
|
||||||
|
|
||||||
public PropertyBoolean(Field field, BinnieConfiguration file, ConfigProperty configProperty,
|
|
||||||
PropBoolean annotedProperty) throws IllegalArgumentException, IllegalAccessException {
|
|
||||||
super(field, file, configProperty, annotedProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Property getProperty() {
|
|
||||||
return file.get(getCategory(), getKey(), defaultValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Boolean getConfigValue() {
|
|
||||||
return property.getBoolean(defaultValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addComments() {
|
|
||||||
addComment("Default value is " + defaultValue + ".");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package binnie.core.mod.config;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
import net.minecraftforge.common.config.Property;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@ConfigProperty.Type(propertyClass = PropDouble.PropertyDouble.class)
|
|
||||||
public @interface PropDouble {
|
|
||||||
|
|
||||||
class PropertyDouble extends PropertyBase<Double, PropDouble> {
|
|
||||||
|
|
||||||
public PropertyDouble(Field field, BinnieConfiguration file, ConfigProperty configProperty,
|
|
||||||
PropDouble annotedProperty) throws IllegalArgumentException, IllegalAccessException {
|
|
||||||
super(field, file, configProperty, annotedProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Property getProperty() {
|
|
||||||
return file.get(getCategory(), getKey(), defaultValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Double getConfigValue() {
|
|
||||||
return property.getDouble(defaultValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addComments() {
|
|
||||||
addComment("Default value is " + defaultValue + ".");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package binnie.core.mod.config;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
import net.minecraftforge.common.config.Property;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@ConfigProperty.Type(propertyClass = PropInteger.PropertyInteger.class)
|
|
||||||
public @interface PropInteger {
|
|
||||||
|
|
||||||
class PropertyInteger extends PropertyBase<Integer, PropInteger> {
|
|
||||||
|
|
||||||
public PropertyInteger(Field field, BinnieConfiguration file, ConfigProperty configProperty,
|
|
||||||
PropInteger annotedProperty) throws IllegalArgumentException, IllegalAccessException {
|
|
||||||
super(field, file, configProperty, annotedProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Property getProperty() {
|
|
||||||
return file.get(getCategory(), getKey(), defaultValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Integer getConfigValue() {
|
|
||||||
return property.getInt(defaultValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addComments() {
|
|
||||||
addComment("Default value is " + defaultValue + ".");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
package binnie.core.mod.config;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
import net.minecraftforge.common.config.Property;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@ConfigProperty.Type(propertyClass = PropPercentage.PropertyPercentage.class)
|
|
||||||
public @interface PropPercentage {
|
|
||||||
|
|
||||||
int upper() default 100;
|
|
||||||
|
|
||||||
int lower() default 0;
|
|
||||||
|
|
||||||
class PropertyPercentage extends PropertyBase<Integer, PropPercentage> {
|
|
||||||
|
|
||||||
public PropertyPercentage(Field field, BinnieConfiguration file, ConfigProperty configProperty,
|
|
||||||
PropPercentage annotedProperty) throws IllegalArgumentException, IllegalAccessException {
|
|
||||||
super(field, file, configProperty, annotedProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Integer getConfigValue() {
|
|
||||||
return property.getInt(defaultValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addComments() {
|
|
||||||
addComment("Default value is " + defaultValue + "%.");
|
|
||||||
addComment("Range is " + annotatedProperty.lower() + "-" + annotatedProperty.upper() + "%.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Property getProperty() {
|
|
||||||
return file.get(getCategory(), getKey(), defaultValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
package binnie.core.mod.config;
|
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraftforge.common.config.Configuration;
|
|
||||||
import net.minecraftforge.common.config.Property;
|
|
||||||
|
|
||||||
public abstract class PropertyBase<ValueType, AnnotationType extends Annotation> {
|
|
||||||
|
|
||||||
protected Configuration file;
|
|
||||||
protected Property property;
|
|
||||||
protected ValueType defaultValue;
|
|
||||||
protected AnnotationType annotatedProperty;
|
|
||||||
|
|
||||||
private final ConfigProperty configProperty;
|
|
||||||
private final List<String> comments;
|
|
||||||
private final Field field;
|
|
||||||
|
|
||||||
protected PropertyBase(Field field, BinnieConfiguration file, ConfigProperty configProperty,
|
|
||||||
AnnotationType annotedProperty) throws IllegalArgumentException, IllegalAccessException {
|
|
||||||
comments = new ArrayList<>();
|
|
||||||
this.field = field;
|
|
||||||
this.file = file;
|
|
||||||
this.configProperty = configProperty;
|
|
||||||
annotatedProperty = annotedProperty;
|
|
||||||
defaultValue = getDefaultValue(field);
|
|
||||||
property = getProperty();
|
|
||||||
|
|
||||||
for (String comment : configProperty.comment()) {
|
|
||||||
addComment(comment);
|
|
||||||
}
|
|
||||||
addComments();
|
|
||||||
property.comment = getComment();
|
|
||||||
field.set(null, getConfigValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract Property getProperty();
|
|
||||||
|
|
||||||
protected abstract ValueType getConfigValue();
|
|
||||||
|
|
||||||
protected abstract void addComments();
|
|
||||||
|
|
||||||
protected String getCategory() {
|
|
||||||
return configProperty.category().isEmpty()
|
|
||||||
? annotatedProperty.annotationType().getAnnotation(ConfigProperty.Type.class).category()
|
|
||||||
: configProperty.category();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getKey() {
|
|
||||||
return configProperty.key();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ValueType getDefaultValue(Field field) throws IllegalArgumentException, IllegalAccessException {
|
|
||||||
return (ValueType) field.get(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addComment(String comment) {
|
|
||||||
comments.add(comment);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getComment() {
|
|
||||||
StringBuilder comment = new StringBuilder();
|
|
||||||
for (String com : comments) {
|
|
||||||
comment.append(com).append(" ");
|
|
||||||
}
|
|
||||||
return comment.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package binnie.core.network.packet;
|
|
||||||
|
|
||||||
import net.minecraft.network.Packet;
|
|
||||||
|
|
||||||
// TODO unused interface?
|
|
||||||
public interface IPacket {
|
|
||||||
|
|
||||||
Packet getPacket();
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package binnie.core.network.packet;
|
|
||||||
|
|
||||||
// TODO unused class?
|
|
||||||
public class IndexInPayload {
|
|
||||||
|
|
||||||
public int intIndex;
|
|
||||||
public int floatIndex;
|
|
||||||
public int stringIndex;
|
|
||||||
|
|
||||||
public IndexInPayload(int intIndex, int floatIndex, int stringIndex) {
|
|
||||||
this.intIndex = intIndex;
|
|
||||||
this.floatIndex = floatIndex;
|
|
||||||
this.stringIndex = stringIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,8 +8,4 @@ public class MessageContainerUpdate extends MessageCraftGUI {
|
|||||||
super(nbt);
|
super(nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO unused constructor?
|
|
||||||
public MessageContainerUpdate(MessageBinnie message) {
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,6 @@ package binnie.core.network.packet;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ChunkCoordinates;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
@@ -18,11 +17,6 @@ public class MessageCoordinates extends MessageBase {
|
|||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO unused constructor?
|
|
||||||
public MessageCoordinates(int id, ChunkCoordinates coordinates) {
|
|
||||||
this(id, coordinates.posX, coordinates.posY, coordinates.posZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MessageCoordinates(int id, int posX, int posY, int posZ) {
|
public MessageCoordinates(int id, int posX, int posY, int posZ) {
|
||||||
super(id);
|
super(id);
|
||||||
this.posX = posX;
|
this.posX = posX;
|
||||||
@@ -44,11 +38,6 @@ public class MessageCoordinates extends MessageBase {
|
|||||||
posZ = data.readInt();
|
posZ = data.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO unused method?
|
|
||||||
public ChunkCoordinates getCoordinates() {
|
|
||||||
return new ChunkCoordinates(posX, posY, posZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TileEntity getTileEntity(World world) {
|
public TileEntity getTileEntity(World world) {
|
||||||
return world.getTileEntity(posX, posY, posZ);
|
return world.getTileEntity(posX, posY, posZ);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import java.io.IOException;
|
|||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
import binnie.core.network.INetworkedEntity;
|
import binnie.core.network.INetworkedEntity;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
@@ -75,8 +74,4 @@ public class MessageUpdate extends MessageCoordinates {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO unused method?
|
|
||||||
public TileEntity getTarget(World world) {
|
|
||||||
return world.getTileEntity(posX, posY, posZ);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -3,8 +3,6 @@ package binnie.core.network.packet;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import binnie.core.network.INetworkedEntity;
|
|
||||||
|
|
||||||
public class PacketPayload {
|
public class PacketPayload {
|
||||||
|
|
||||||
public List<Integer> intPayload;
|
public List<Integer> intPayload;
|
||||||
@@ -17,12 +15,6 @@ public class PacketPayload {
|
|||||||
stringPayload = new ArrayList<>();
|
stringPayload = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO unused constructor?
|
|
||||||
public PacketPayload(INetworkedEntity tile) {
|
|
||||||
this();
|
|
||||||
tile.writeToPacket(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInteger(int a) {
|
public void addInteger(int a) {
|
||||||
intPayload.add(a);
|
intPayload.add(a);
|
||||||
}
|
}
|
||||||
@@ -47,16 +39,6 @@ public class PacketPayload {
|
|||||||
return stringPayload.remove(0);
|
return stringPayload.remove(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO unused method
|
|
||||||
public void append(PacketPayload other) {
|
|
||||||
if (other == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
intPayload.addAll(other.intPayload);
|
|
||||||
floatPayload.addAll(other.floatPayload);
|
|
||||||
stringPayload.addAll(other.stringPayload);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
return intPayload.isEmpty() && floatPayload.isEmpty() && stringPayload.isEmpty();
|
return intPayload.isEmpty() && floatPayload.isEmpty() && stringPayload.isEmpty();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import binnie.core.network.INetworkedEntity;
|
|||||||
import binnie.core.network.packet.MessageUpdate;
|
import binnie.core.network.packet.MessageUpdate;
|
||||||
import binnie.core.resource.BinnieResource;
|
import binnie.core.resource.BinnieResource;
|
||||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
public class BinnieProxy extends BinnieModProxy implements IBinnieProxy {
|
public class BinnieProxy extends BinnieModProxy implements IBinnieProxy {
|
||||||
@@ -69,11 +68,6 @@ public class BinnieProxy extends BinnieModProxy implements IBinnieProxy {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO unused method?
|
|
||||||
public void throwException(String message, Throwable e) {
|
|
||||||
FMLCommonHandler.instance().raiseException(e, message, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Minecraft getMinecraftInstance() {
|
public Minecraft getMinecraftInstance() {
|
||||||
return null;
|
return null;
|
||||||
@@ -129,16 +123,6 @@ public class BinnieProxy extends BinnieModProxy implements IBinnieProxy {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO unused method?
|
|
||||||
public void handleTextureRefresh(IIconRegister register, int type) {
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO unused method?
|
|
||||||
public void handlePostTextureRefresh(IIconRegister register, int type) {
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getUniqueTextureUID() {
|
public short getUniqueTextureUID() {
|
||||||
uniqueTextureUID++;
|
uniqueTextureUID++;
|
||||||
return uniqueTextureUID;
|
return uniqueTextureUID;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import net.minecraftforge.client.MinecraftForgeClient;
|
|||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import binnie.Binnie;
|
|
||||||
import binnie.core.craftgui.resource.minecraft.CraftGUIResourceManager;
|
import binnie.core.craftgui.resource.minecraft.CraftGUIResourceManager;
|
||||||
import binnie.core.resource.BinnieResource;
|
import binnie.core.resource.BinnieResource;
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
import cpw.mods.fml.client.FMLClientHandler;
|
||||||
@@ -139,13 +138,6 @@ public class BinnieProxyClient extends BinnieProxy implements IBinnieProxy {
|
|||||||
return Minecraft.getMinecraft().thePlayer;
|
return Minecraft.getMinecraft().thePlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO unused method?
|
|
||||||
public void handlePreTextureRefresh(IIconRegister register, int type) {
|
|
||||||
if (type == 0) {
|
|
||||||
Binnie.Liquid.reloadIcons(register);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preInit() {
|
public void preInit() {
|
||||||
IResourceManager manager = Minecraft.getMinecraft().getResourceManager();
|
IResourceManager manager = Minecraft.getMinecraft().getResourceManager();
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import net.minecraft.block.Block;
|
|||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
|
||||||
|
import com.gtnewhorizon.gtnhlib.config.ConfigException;
|
||||||
|
import com.gtnewhorizon.gtnhlib.config.ConfigurationManager;
|
||||||
|
|
||||||
import binnie.core.AbstractMod;
|
import binnie.core.AbstractMod;
|
||||||
import binnie.core.BinnieCore;
|
import binnie.core.BinnieCore;
|
||||||
import binnie.core.Tags;
|
import binnie.core.Tags;
|
||||||
@@ -11,8 +14,7 @@ import binnie.core.gui.IBinnieGUID;
|
|||||||
import binnie.core.network.BinniePacketHandler;
|
import binnie.core.network.BinniePacketHandler;
|
||||||
import binnie.core.proxy.IProxyCore;
|
import binnie.core.proxy.IProxyCore;
|
||||||
import binnie.extrabees.apiary.ModuleApiary;
|
import binnie.extrabees.apiary.ModuleApiary;
|
||||||
import binnie.extrabees.config.ConfigurationMachines;
|
import binnie.extrabees.config.EBConfig;
|
||||||
import binnie.extrabees.config.ConfigurationMain;
|
|
||||||
import binnie.extrabees.core.ExtraBeeGUID;
|
import binnie.extrabees.core.ExtraBeeGUID;
|
||||||
import binnie.extrabees.core.ModuleCore;
|
import binnie.extrabees.core.ModuleCore;
|
||||||
import binnie.extrabees.genetics.ModuleGenetics;
|
import binnie.extrabees.genetics.ModuleGenetics;
|
||||||
@@ -27,13 +29,17 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
|||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
|
||||||
@Mod(
|
@Mod(
|
||||||
modid = "ExtraBees",
|
modid = ExtraBees.EB_MODID,
|
||||||
name = "Extra Bees",
|
name = ExtraBees.EB_MOD_NAME,
|
||||||
version = Tags.VERSION,
|
version = Tags.VERSION,
|
||||||
useMetadata = true,
|
useMetadata = true,
|
||||||
dependencies = "after:BinnieCore")
|
dependencies = "after:BinnieCore",
|
||||||
|
guiFactory = "binnie.extrabees.config.EBConfigGUIFactory")
|
||||||
public class ExtraBees extends AbstractMod {
|
public class ExtraBees extends AbstractMod {
|
||||||
|
|
||||||
|
public static final String EB_MODID = "ExtraBees";
|
||||||
|
public static final String EB_MOD_NAME = "Extra Bees";
|
||||||
|
|
||||||
@Mod.Instance("ExtraBees")
|
@Mod.Instance("ExtraBees")
|
||||||
public static ExtraBees instance;
|
public static ExtraBees instance;
|
||||||
|
|
||||||
@@ -42,6 +48,14 @@ public class ExtraBees extends AbstractMod {
|
|||||||
serverSide = "binnie.extrabees.proxy.ExtraBeesProxyServer")
|
serverSide = "binnie.extrabees.proxy.ExtraBeesProxyServer")
|
||||||
public static ExtraBeesProxy proxy;
|
public static ExtraBeesProxy proxy;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
ConfigurationManager.registerConfig(EBConfig.class);
|
||||||
|
} catch (ConfigException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static Block hive;
|
public static Block hive;
|
||||||
public static Material materialBeehive;
|
public static Material materialBeehive;
|
||||||
public static Block ectoplasm;
|
public static Block ectoplasm;
|
||||||
@@ -81,11 +95,6 @@ public class ExtraBees extends AbstractMod {
|
|||||||
return ExtraBeeGUID.values();
|
return ExtraBeeGUID.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<?>[] getConfigs() {
|
|
||||||
return new Class[] { ConfigurationMain.class, ConfigurationMachines.class };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IProxyCore getProxy() {
|
public IProxyCore getProxy() {
|
||||||
return ExtraBees.proxy;
|
return ExtraBees.proxy;
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
package binnie.extrabees.apiary;
|
package binnie.extrabees.apiary;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
import binnie.core.machines.Machine;
|
import binnie.core.machines.Machine;
|
||||||
import binnie.core.machines.MachineComponent;
|
import binnie.core.machines.MachineComponent;
|
||||||
import forestry.api.apiculture.IBee;
|
|
||||||
import forestry.api.apiculture.IBeeGenome;
|
import forestry.api.apiculture.IBeeGenome;
|
||||||
import forestry.api.apiculture.IBeeListener;
|
import forestry.api.apiculture.IBeeListener;
|
||||||
import forestry.api.apiculture.IBeeModifier;
|
import forestry.api.apiculture.IBeeModifier;
|
||||||
@@ -61,21 +58,11 @@ public class ComponentBeeModifier extends MachineComponent implements IBeeModifi
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO unused method?
|
|
||||||
public void onQueenChange(ItemStack queen) {
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void wearOutEquipment(int amount) {
|
public void wearOutEquipment(int amount) {
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO unused method?
|
|
||||||
public boolean onEggLaid(IBee queen) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getGeneticDecay(IBeeGenome genome, float currentModifier) {
|
public float getGeneticDecay(IBeeGenome genome, float currentModifier) {
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
|
|||||||
@@ -46,11 +46,6 @@ public enum AlvearyMachine implements IMachineType {
|
|||||||
return new ItemStack(ModuleApiary.blockComponent, size, ordinal());
|
return new ItemStack(ModuleApiary.blockComponent, size, ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isActive() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract static class AlvearyPackage extends MachinePackage {
|
public abstract static class AlvearyPackage extends MachinePackage {
|
||||||
|
|
||||||
protected BinnieResource machineTexture;
|
protected BinnieResource machineTexture;
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
package binnie.extrabees.config;
|
|
||||||
|
|
||||||
import binnie.core.mod.config.ConfigFile;
|
|
||||||
import binnie.core.mod.config.ConfigProperty;
|
|
||||||
import binnie.core.mod.config.PropDouble;
|
|
||||||
import binnie.core.mod.config.PropPercentage;
|
|
||||||
|
|
||||||
@ConfigFile(filename = "/config/forestry/extrabees/machines.conf")
|
|
||||||
public class ConfigurationMachines {
|
|
||||||
|
|
||||||
@ConfigProperty(
|
|
||||||
key = "isolatorConsumptionChance",
|
|
||||||
comment = { "Percentage chance of Isolator consuming bee, in x%." })
|
|
||||||
@PropPercentage
|
|
||||||
public static int isolatorConsumptionChance = 30;
|
|
||||||
|
|
||||||
@ConfigProperty(
|
|
||||||
key = "geneticErrorModifier",
|
|
||||||
comment = { "Modifier that changes how severe splicer/inoculator erros are.",
|
|
||||||
"0 would result in no errors, even for awful serums.",
|
|
||||||
"2.0 would result in twice as severe errors" })
|
|
||||||
@PropDouble
|
|
||||||
public static double geneticErrorModifier = 1.0;
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package binnie.extrabees.config;
|
|
||||||
|
|
||||||
import binnie.core.mod.config.ConfigFile;
|
|
||||||
import binnie.core.mod.config.ConfigProperty;
|
|
||||||
import binnie.core.mod.config.PropBoolean;
|
|
||||||
import binnie.core.mod.config.PropInteger;
|
|
||||||
|
|
||||||
@ConfigFile(filename = "/config/forestry/extrabees/main.conf")
|
|
||||||
public class ConfigurationMain {
|
|
||||||
|
|
||||||
@ConfigProperty(key = "canQuarryMineHives")
|
|
||||||
@PropBoolean
|
|
||||||
public static boolean canQuarryMineHives = true;
|
|
||||||
|
|
||||||
@ConfigProperty(key = "waterHiveRate")
|
|
||||||
@PropInteger
|
|
||||||
public static int waterHiveRate = 1;
|
|
||||||
|
|
||||||
@ConfigProperty(key = "rockHiveRate")
|
|
||||||
@PropInteger
|
|
||||||
public static int rockHiveRate = 2;
|
|
||||||
|
|
||||||
@ConfigProperty(key = "netherHiveRate")
|
|
||||||
@PropInteger
|
|
||||||
public static int netherHiveRate = 2;
|
|
||||||
|
|
||||||
@ConfigProperty(key = "marbleHiveRate")
|
|
||||||
@PropInteger
|
|
||||||
public static int marbleHiveRate = 2;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package binnie.extrabees.config;
|
||||||
|
|
||||||
|
import static binnie.extrabees.ExtraBees.EB_MODID;
|
||||||
|
|
||||||
|
import com.gtnewhorizon.gtnhlib.config.Config;
|
||||||
|
|
||||||
|
@Config(modid = EB_MODID)
|
||||||
|
public class EBConfig {
|
||||||
|
|
||||||
|
@Config.DefaultBoolean(true)
|
||||||
|
@Config.RequiresMcRestart
|
||||||
|
public static boolean canQuarryMineHives;
|
||||||
|
|
||||||
|
@Config.Comment("Attempt to generate this many hives per chunk.")
|
||||||
|
@Config.RangeInt(min = 0)
|
||||||
|
@Config.DefaultInt(1)
|
||||||
|
public static int waterHiveRate;
|
||||||
|
|
||||||
|
@Config.Comment("Attempt to generate this many hives per chunk.")
|
||||||
|
@Config.RangeInt(min = 0)
|
||||||
|
@Config.DefaultInt(2)
|
||||||
|
public static int rockHiveRate;
|
||||||
|
|
||||||
|
@Config.Comment("Attempt to generate this many hives per chunk.")
|
||||||
|
@Config.RangeInt(min = 0)
|
||||||
|
@Config.DefaultInt(2)
|
||||||
|
public static int netherHiveRate;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package binnie.extrabees.config;
|
||||||
|
|
||||||
|
import static binnie.extrabees.ExtraBees.EB_MODID;
|
||||||
|
import static binnie.extrabees.ExtraBees.EB_MOD_NAME;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
|
||||||
|
import com.gtnewhorizon.gtnhlib.config.ConfigException;
|
||||||
|
import com.gtnewhorizon.gtnhlib.config.SimpleGuiConfig;
|
||||||
|
|
||||||
|
public class EBConfigGUI extends SimpleGuiConfig {
|
||||||
|
|
||||||
|
public EBConfigGUI(GuiScreen parent) throws ConfigException {
|
||||||
|
super(parent, EB_MODID, EB_MOD_NAME, false, EBConfig.class, EBConfigMachines.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package binnie.extrabees.config;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
|
||||||
|
import com.gtnewhorizon.gtnhlib.config.SimpleGuiFactory;
|
||||||
|
|
||||||
|
public class EBConfigGUIFactory implements SimpleGuiFactory {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends GuiScreen> mainConfigGuiClass() {
|
||||||
|
return EBConfigGUI.class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package binnie.extrabees.config;
|
||||||
|
|
||||||
|
import static binnie.extrabees.ExtraBees.EB_MODID;
|
||||||
|
|
||||||
|
import com.gtnewhorizon.gtnhlib.config.Config;
|
||||||
|
|
||||||
|
@Config(modid = EB_MODID)
|
||||||
|
public class EBConfigMachines {
|
||||||
|
|
||||||
|
@Config.Comment("Percentage chance of Isolator consuming bee. 0 never consumes, 1 always does.")
|
||||||
|
@Config.RangeFloat(min = 0f, max = 1f)
|
||||||
|
@Config.DefaultFloat(0.05f)
|
||||||
|
public static float isolatorConsumptionChance;
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package binnie.extrabees.worldgen;
|
package binnie.extrabees.worldgen;
|
||||||
|
|
||||||
|
import static binnie.core.Mods.buildcraftCore;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@@ -7,7 +9,7 @@ import net.minecraft.world.chunk.IChunkProvider;
|
|||||||
|
|
||||||
import binnie.core.IInitializable;
|
import binnie.core.IInitializable;
|
||||||
import binnie.extrabees.ExtraBees;
|
import binnie.extrabees.ExtraBees;
|
||||||
import binnie.extrabees.config.ConfigurationMain;
|
import binnie.extrabees.config.EBConfig;
|
||||||
import binnie.extrabees.genetics.ExtraBeeDefinition;
|
import binnie.extrabees.genetics.ExtraBeeDefinition;
|
||||||
import buildcraft.api.core.BuildCraftAPI;
|
import buildcraft.api.core.BuildCraftAPI;
|
||||||
import cpw.mods.fml.common.IWorldGenerator;
|
import cpw.mods.fml.common.IWorldGenerator;
|
||||||
@@ -16,11 +18,6 @@ import forestry.apiculture.genetics.BeeDefinition;
|
|||||||
|
|
||||||
public class ModuleGeneration implements IWorldGenerator, IInitializable {
|
public class ModuleGeneration implements IWorldGenerator, IInitializable {
|
||||||
|
|
||||||
protected static int waterRate = 2;
|
|
||||||
protected static int rockRate = 2;
|
|
||||||
protected static int netherRate = 2;
|
|
||||||
protected static int marbleRate = 2;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preInit() {
|
public void preInit() {
|
||||||
ExtraBees.materialBeehive = new MaterialBeehive();
|
ExtraBees.materialBeehive = new MaterialBeehive();
|
||||||
@@ -30,11 +27,8 @@ public class ModuleGeneration implements IWorldGenerator, IInitializable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
ModuleGeneration.waterRate = ConfigurationMain.waterHiveRate;
|
|
||||||
ModuleGeneration.rockRate = ConfigurationMain.rockHiveRate;
|
|
||||||
ModuleGeneration.netherRate = ConfigurationMain.netherHiveRate;
|
|
||||||
GameRegistry.registerWorldGenerator(new ModuleGeneration(), 0);
|
GameRegistry.registerWorldGenerator(new ModuleGeneration(), 0);
|
||||||
if (!ConfigurationMain.canQuarryMineHives) {
|
if (!EBConfig.canQuarryMineHives && buildcraftCore.active()) {
|
||||||
BuildCraftAPI.softBlocks.add(ExtraBees.hive);
|
BuildCraftAPI.softBlocks.add(ExtraBees.hive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,21 +56,21 @@ public class ModuleGeneration implements IWorldGenerator, IInitializable {
|
|||||||
chunkX <<= 4;
|
chunkX <<= 4;
|
||||||
chunkZ <<= 4;
|
chunkZ <<= 4;
|
||||||
|
|
||||||
for (int i = 0; i < ModuleGeneration.waterRate; ++i) {
|
for (int i = 0; i < EBConfig.waterHiveRate; ++i) {
|
||||||
int randPosX = chunkX + rand.nextInt(16);
|
int randPosX = chunkX + rand.nextInt(16);
|
||||||
int randPosY = rand.nextInt(50) + 20;
|
int randPosY = rand.nextInt(50) + 20;
|
||||||
int randPosZ = chunkZ + rand.nextInt(16);
|
int randPosZ = chunkZ + rand.nextInt(16);
|
||||||
new WorldGenHiveWater().generate(world, rand, randPosX, randPosY, randPosZ);
|
new WorldGenHiveWater().generate(world, rand, randPosX, randPosY, randPosZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < ModuleGeneration.rockRate; ++i) {
|
for (int i = 0; i < EBConfig.rockHiveRate; ++i) {
|
||||||
int randPosX = chunkX + rand.nextInt(16);
|
int randPosX = chunkX + rand.nextInt(16);
|
||||||
int randPosY = rand.nextInt(50) + 20;
|
int randPosY = rand.nextInt(50) + 20;
|
||||||
int randPosZ = chunkZ + rand.nextInt(16);
|
int randPosZ = chunkZ + rand.nextInt(16);
|
||||||
new WorldGenHiveRock().generate(world, rand, randPosX, randPosY, randPosZ);
|
new WorldGenHiveRock().generate(world, rand, randPosX, randPosY, randPosZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < ModuleGeneration.netherRate; ++i) {
|
for (int i = 0; i < EBConfig.netherHiveRate; ++i) {
|
||||||
int randPosX = chunkX + rand.nextInt(16);
|
int randPosX = chunkX + rand.nextInt(16);
|
||||||
int randPosY = rand.nextInt(50) + 20;
|
int randPosY = rand.nextInt(50) + 20;
|
||||||
int randPosZ = chunkZ + rand.nextInt(16);
|
int randPosZ = chunkZ + rand.nextInt(16);
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
package binnie.extratrees;
|
package binnie.extratrees;
|
||||||
|
|
||||||
|
import static binnie.extratrees.ExtraTrees.EB_MOD_NAME;
|
||||||
|
import static binnie.extratrees.ExtraTrees.ET_MODID;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
|
||||||
|
import com.gtnewhorizon.gtnhlib.config.ConfigException;
|
||||||
|
import com.gtnewhorizon.gtnhlib.config.ConfigurationManager;
|
||||||
|
|
||||||
import binnie.core.AbstractMod;
|
import binnie.core.AbstractMod;
|
||||||
import binnie.core.BinnieCore;
|
import binnie.core.BinnieCore;
|
||||||
import binnie.core.Tags;
|
import binnie.core.Tags;
|
||||||
@@ -16,7 +22,7 @@ import binnie.extratrees.block.decor.BlockMultiFence;
|
|||||||
import binnie.extratrees.carpentry.BlockCarpentry;
|
import binnie.extratrees.carpentry.BlockCarpentry;
|
||||||
import binnie.extratrees.carpentry.BlockStainedDesign;
|
import binnie.extratrees.carpentry.BlockStainedDesign;
|
||||||
import binnie.extratrees.carpentry.ModuleCarpentry;
|
import binnie.extratrees.carpentry.ModuleCarpentry;
|
||||||
import binnie.extratrees.config.ConfigurationMain;
|
import binnie.extratrees.config.ETConfig;
|
||||||
import binnie.extratrees.core.ExtraTreesGUID;
|
import binnie.extratrees.core.ExtraTreesGUID;
|
||||||
import binnie.extratrees.core.ModuleCore;
|
import binnie.extratrees.core.ModuleCore;
|
||||||
import binnie.extratrees.genetics.ModuleGenetics;
|
import binnie.extratrees.genetics.ModuleGenetics;
|
||||||
@@ -31,19 +37,31 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
|||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
|
||||||
@Mod(
|
@Mod(
|
||||||
modid = "ExtraTrees",
|
modid = ET_MODID,
|
||||||
name = "Extra Trees",
|
name = EB_MOD_NAME,
|
||||||
version = Tags.VERSION,
|
version = Tags.VERSION,
|
||||||
useMetadata = true,
|
useMetadata = true,
|
||||||
dependencies = "after:BinnieCore")
|
dependencies = "after:BinnieCore",
|
||||||
|
guiFactory = "binnie.extratrees.config.ETConfigGUIFactory")
|
||||||
public class ExtraTrees extends AbstractMod {
|
public class ExtraTrees extends AbstractMod {
|
||||||
|
|
||||||
|
public static final String ET_MODID = "ExtraTrees";
|
||||||
|
public static final String EB_MOD_NAME = "Extra Trees";
|
||||||
|
|
||||||
@Mod.Instance("ExtraTrees")
|
@Mod.Instance("ExtraTrees")
|
||||||
public static ExtraTrees instance;
|
public static ExtraTrees instance;
|
||||||
|
|
||||||
@SidedProxy(clientSide = "binnie.extratrees.proxy.ProxyClient", serverSide = "binnie.extratrees.proxy.ProxyServer")
|
@SidedProxy(clientSide = "binnie.extratrees.proxy.ProxyClient", serverSide = "binnie.extratrees.proxy.ProxyServer")
|
||||||
public static Proxy proxy;
|
public static Proxy proxy;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
ConfigurationManager.registerConfig(ETConfig.class);
|
||||||
|
} catch (ConfigException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static Item itemDictionary;
|
public static Item itemDictionary;
|
||||||
public static Item itemDictionaryLepi;
|
public static Item itemDictionaryLepi;
|
||||||
public static Item itemMisc;
|
public static Item itemMisc;
|
||||||
@@ -101,11 +119,6 @@ public class ExtraTrees extends AbstractMod {
|
|||||||
return ExtraTreesGUID.values();
|
return ExtraTreesGUID.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<?>[] getConfigs() {
|
|
||||||
return new Class[] { ConfigurationMain.class };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getChannel() {
|
public String getChannel() {
|
||||||
return "ET";
|
return "ET";
|
||||||
@@ -116,6 +129,7 @@ public class ExtraTrees extends AbstractMod {
|
|||||||
return ExtraTrees.proxy;
|
return ExtraTrees.proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Concerningly, this isn't the same as the MODID
|
||||||
@Override
|
@Override
|
||||||
public String getModID() {
|
public String getModID() {
|
||||||
return "extratrees";
|
return "extratrees";
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
package binnie.extratrees.config;
|
|
||||||
|
|
||||||
import binnie.core.mod.config.ConfigFile;
|
|
||||||
import binnie.core.mod.config.ConfigProperty;
|
|
||||||
import binnie.core.mod.config.PropBoolean;
|
|
||||||
|
|
||||||
@ConfigFile(filename = "/config/forestry/extratrees/main.conf")
|
|
||||||
public class ConfigurationMain {
|
|
||||||
|
|
||||||
@ConfigProperty(
|
|
||||||
key = "lemon.citrus.family",
|
|
||||||
comment = { "Uses reflection to convert the Forestry lemon tree to the Citrus family." })
|
|
||||||
@PropBoolean
|
|
||||||
public static boolean alterLemon = true;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package binnie.extratrees.config;
|
||||||
|
|
||||||
|
import static binnie.extratrees.ExtraTrees.ET_MODID;
|
||||||
|
|
||||||
|
import com.gtnewhorizon.gtnhlib.config.Config;
|
||||||
|
|
||||||
|
@Config(modid = ET_MODID)
|
||||||
|
public class ETConfig {
|
||||||
|
|
||||||
|
@Config.Comment("Uses reflection to convert the Forestry lemon tree to the Citrus family.")
|
||||||
|
@Config.DefaultBoolean(true)
|
||||||
|
@Config.RequiresMcRestart
|
||||||
|
public static boolean alterLemon;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package binnie.extratrees.config;
|
||||||
|
|
||||||
|
import static binnie.extratrees.ExtraTrees.EB_MOD_NAME;
|
||||||
|
import static binnie.extratrees.ExtraTrees.ET_MODID;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
|
||||||
|
import com.gtnewhorizon.gtnhlib.config.ConfigException;
|
||||||
|
import com.gtnewhorizon.gtnhlib.config.SimpleGuiConfig;
|
||||||
|
|
||||||
|
public class ETConfigGUI extends SimpleGuiConfig {
|
||||||
|
|
||||||
|
public ETConfigGUI(GuiScreen parent) throws ConfigException {
|
||||||
|
super(parent, ETConfig.class, ET_MODID, EB_MOD_NAME);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package binnie.extratrees.config;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
|
||||||
|
import com.gtnewhorizon.gtnhlib.config.SimpleGuiFactory;
|
||||||
|
|
||||||
|
public class ETConfigGUIFactory implements SimpleGuiFactory {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends GuiScreen> mainConfigGuiClass() {
|
||||||
|
return ETConfigGUI.class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ import binnie.Binnie;
|
|||||||
import binnie.core.util.I18N;
|
import binnie.core.util.I18N;
|
||||||
import binnie.extratrees.ExtraTrees;
|
import binnie.extratrees.ExtraTrees;
|
||||||
import binnie.extratrees.block.FruitPod;
|
import binnie.extratrees.block.FruitPod;
|
||||||
import binnie.extratrees.config.ConfigurationMain;
|
import binnie.extratrees.config.ETConfig;
|
||||||
import binnie.extratrees.item.Food;
|
import binnie.extratrees.item.Food;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@@ -254,7 +254,7 @@ public enum ExtraTreeFruitGene implements IAlleleFruit, IFruitProvider {
|
|||||||
ExtraTreeFruitGene.Candlenut.addProduct(Food.Candlenut.get(1), 1.0f);
|
ExtraTreeFruitGene.Candlenut.addProduct(Food.Candlenut.get(1), 1.0f);
|
||||||
ExtraTreeFruitGene.Candlenut.setFamily(familyJungle);
|
ExtraTreeFruitGene.Candlenut.setFamily(familyJungle);
|
||||||
|
|
||||||
if (ConfigurationMain.alterLemon) {
|
if (ETConfig.alterLemon) {
|
||||||
try {
|
try {
|
||||||
IAlleleFruit lemon = (IAlleleFruit) AlleleManager.alleleRegistry.getAllele("forestry.fruitLemon");
|
IAlleleFruit lemon = (IAlleleFruit) AlleleManager.alleleRegistry.getAllele("forestry.fruitLemon");
|
||||||
FruitProviderNone prov = (FruitProviderNone) lemon.getProvider();
|
FruitProviderNone prov = (FruitProviderNone) lemon.getProvider();
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package binnie.extratrees.genetics;
|
package binnie.extratrees.genetics;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -690,19 +689,6 @@ public enum ExtraTreeSpecies implements IAlleleTreeSpecies, IIconProvider, IGerm
|
|||||||
.setFertility(EnumAllele.Saplings.LOW).setMaturation(EnumAllele.Maturation.SLOWER);
|
.setFertility(EnumAllele.Saplings.LOW).setMaturation(EnumAllele.Maturation.SLOWER);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO unused method?
|
|
||||||
static ItemStack getEBXLStack(String name) {
|
|
||||||
try {
|
|
||||||
Class elements = Class.forName("extrabiomes.lib.Element");
|
|
||||||
Method getElementMethod = elements.getMethod("valueOf", String.class);
|
|
||||||
Method getItemStack = elements.getMethod("get");
|
|
||||||
Object element = getElementMethod.invoke(null, "SAPLING_AUTUMN_YELLOW");
|
|
||||||
return (ItemStack) getItemStack.invoke(element);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ExtraTreeSpecies addFamily(IFruitFamily family) {
|
private ExtraTreeSpecies addFamily(IFruitFamily family) {
|
||||||
families.add(family);
|
families.add(family);
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import binnie.Binnie;
|
import binnie.Binnie;
|
||||||
import binnie.core.BinnieCore;
|
|
||||||
import binnie.core.machines.IMachineType;
|
import binnie.core.machines.IMachineType;
|
||||||
import binnie.core.machines.Machine;
|
import binnie.core.machines.Machine;
|
||||||
import binnie.core.machines.MachineComponent;
|
import binnie.core.machines.MachineComponent;
|
||||||
@@ -43,14 +42,6 @@ public enum ExtraTreeMachine implements IMachineType {
|
|||||||
return cls;
|
return cls;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isActive() {
|
|
||||||
if (this == ExtraTreeMachine.Tileworker) {
|
|
||||||
return BinnieCore.isBotanyActive();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack get(int i) {
|
public ItemStack get(int i) {
|
||||||
return new ItemStack(ExtraTrees.blockMachine, i, ordinal());
|
return new ItemStack(ExtraTrees.blockMachine, i, ordinal());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package binnie.genetics;
|
|||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
|
||||||
import binnie.core.AbstractMod;
|
import binnie.core.AbstractMod;
|
||||||
import binnie.core.BinnieCore;
|
|
||||||
import binnie.core.Tags;
|
import binnie.core.Tags;
|
||||||
import binnie.core.gui.IBinnieGUID;
|
import binnie.core.gui.IBinnieGUID;
|
||||||
import binnie.core.machines.MachineGroup;
|
import binnie.core.machines.MachineGroup;
|
||||||
@@ -106,7 +105,7 @@ public class Genetics extends AbstractMod {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
return BinnieCore.isGeneticsActive();
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PacketHandler extends BinniePacketHandler {
|
public static class PacketHandler extends BinniePacketHandler {
|
||||||
|
|||||||
@@ -11,11 +11,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||||||
|
|
||||||
public class GeneticsCreativeTab extends CreativeTabs {
|
public class GeneticsCreativeTab extends CreativeTabs {
|
||||||
|
|
||||||
public static CreativeTabs instance;
|
public static CreativeTabs instance = new GeneticsCreativeTab();
|
||||||
|
|
||||||
static {
|
|
||||||
GeneticsCreativeTab.instance = new GeneticsCreativeTab();
|
|
||||||
}
|
|
||||||
|
|
||||||
public GeneticsCreativeTab() {
|
public GeneticsCreativeTab() {
|
||||||
super("Genetics");
|
super("Genetics");
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
package binnie.genetics.config;
|
|
||||||
|
|
||||||
import binnie.core.mod.config.ConfigFile;
|
|
||||||
|
|
||||||
@ConfigFile(filename = "/config/forestry/genetics/main.conf")
|
|
||||||
public class ConfigurationMain {
|
|
||||||
}
|
|
||||||
@@ -306,7 +306,7 @@ public class ModuleItem implements IInitializable {
|
|||||||
|
|
||||||
// as above, there are only 24 permutations here; let's find a way to just get those recipes rather than trying
|
// as above, there are only 24 permutations here; let's find a way to just get those recipes rather than trying
|
||||||
// 256 combinations in an n^4 loop. This will help performance and maybe be a bit more maintainable.
|
// 256 combinations in an n^4 loop. This will help performance and maybe be a bit more maintainable.
|
||||||
if (BinnieCore.isBotanyActive() && BinnieCore.isExtraBeesActive() && BinnieCore.isExtraTreesActive()) {
|
if (BinnieCore.isExtraBeesActive() && BinnieCore.isExtraTreesActive()) {
|
||||||
// 24 full recipe lines is a bit much to maintain; so we'll use a loop here, but we're only going
|
// 24 full recipe lines is a bit much to maintain; so we'll use a loop here, but we're only going
|
||||||
// to run it 24 times. Start by making an array of all 24 valid dictionary permutations...
|
// to run it 24 times. Start by making an array of all 24 valid dictionary permutations...
|
||||||
String[] permutations = new String[] { "btlf", "btfl", "bltf", "blft", "bftl", "bflt", "tblf", "tbfl",
|
String[] permutations = new String[] { "btlf", "btfl", "bltf", "blft", "bftl", "bflt", "tblf", "tbfl",
|
||||||
|
|||||||
@@ -23,11 +23,6 @@ public enum AdvGeneticMachine implements IMachineType {
|
|||||||
return cls;
|
return cls;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isActive() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack get(int i) {
|
public ItemStack get(int i) {
|
||||||
return new ItemStack(Genetics.packageAdvGenetic.getBlock(), i, ordinal());
|
return new ItemStack(Genetics.packageAdvGenetic.getBlock(), i, ordinal());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,9 +116,8 @@ public class ComponentGUIHolder extends MachineComponent implements INetwork.Til
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Item> validSelections = new ArrayList<>();
|
List<Item> validSelections = new ArrayList<>();
|
||||||
if (BinnieCore.isBotanyActive()) {
|
validSelections.add(Botany.database);
|
||||||
validSelections.add(Botany.database);
|
|
||||||
}
|
|
||||||
if (BinnieCore.isExtraBeesActive()) {
|
if (BinnieCore.isExtraBeesActive()) {
|
||||||
validSelections.add(ExtraBees.dictionary);
|
validSelections.add(ExtraBees.dictionary);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,11 +28,6 @@ public enum GeneticMachine implements IMachineType {
|
|||||||
return clss;
|
return clss;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isActive() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack get(int i) {
|
public ItemStack get(int i) {
|
||||||
return new ItemStack(Genetics.packageGenetic.getBlock(), i, ordinal());
|
return new ItemStack(Genetics.packageGenetic.getBlock(), i, ordinal());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,11 +30,6 @@ public enum LaboratoryMachine implements IMachineType {
|
|||||||
return clss;
|
return clss;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isActive() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack get(int i) {
|
public ItemStack get(int i) {
|
||||||
return new ItemStack(Genetics.packageLabMachine.getBlock(), i, ordinal());
|
return new ItemStack(Genetics.packageLabMachine.getBlock(), i, ordinal());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,17 +106,15 @@ public class Acclimatiser {
|
|||||||
ToleranceType.Temperature);
|
ToleranceType.Temperature);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BinnieCore.isBotanyActive()) {
|
addTolerance(
|
||||||
addTolerance(
|
Binnie.Genetics.getFlowerRoot().getUID(),
|
||||||
Binnie.Genetics.getFlowerRoot().getUID(),
|
EnumFlowerChromosome.HUMIDITY_TOLERANCE,
|
||||||
EnumFlowerChromosome.HUMIDITY_TOLERANCE,
|
ToleranceType.Humidity);
|
||||||
ToleranceType.Humidity);
|
addTolerance(
|
||||||
addTolerance(
|
Binnie.Genetics.getFlowerRoot().getUID(),
|
||||||
Binnie.Genetics.getFlowerRoot().getUID(),
|
EnumFlowerChromosome.TEMPERATURE_TOLERANCE,
|
||||||
EnumFlowerChromosome.TEMPERATURE_TOLERANCE,
|
ToleranceType.Temperature);
|
||||||
ToleranceType.Temperature);
|
addTolerance(Binnie.Genetics.getFlowerRoot().getUID(), EnumFlowerChromosome.PH_TOLERANCE, ToleranceType.PH);
|
||||||
addTolerance(Binnie.Genetics.getFlowerRoot().getUID(), EnumFlowerChromosome.PH_TOLERANCE, ToleranceType.PH);
|
|
||||||
}
|
|
||||||
|
|
||||||
addTemperatureItem(new ItemStack(Items.blaze_powder), 0.5f);
|
addTemperatureItem(new ItemStack(Items.blaze_powder), 0.5f);
|
||||||
addTemperatureItem(new ItemStack(Items.blaze_rod), 0.75f);
|
addTemperatureItem(new ItemStack(Items.blaze_rod), 0.75f);
|
||||||
|
|||||||
@@ -4,9 +4,6 @@ import java.util.Random;
|
|||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
|
|
||||||
import binnie.core.genetics.Gene;
|
import binnie.core.genetics.Gene;
|
||||||
import binnie.core.machines.Machine;
|
import binnie.core.machines.Machine;
|
||||||
import binnie.core.machines.inventory.IChargedSlots;
|
import binnie.core.machines.inventory.IChargedSlots;
|
||||||
@@ -14,6 +11,7 @@ import binnie.core.machines.power.ComponentProcessSetCost;
|
|||||||
import binnie.core.machines.power.ErrorState;
|
import binnie.core.machines.power.ErrorState;
|
||||||
import binnie.core.machines.power.IProcess;
|
import binnie.core.machines.power.IProcess;
|
||||||
import binnie.core.util.I18N;
|
import binnie.core.util.I18N;
|
||||||
|
import binnie.extrabees.config.EBConfigMachines;
|
||||||
import binnie.genetics.item.ItemSequence;
|
import binnie.genetics.item.ItemSequence;
|
||||||
import forestry.api.genetics.AlleleManager;
|
import forestry.api.genetics.AlleleManager;
|
||||||
import forestry.api.genetics.IAllele;
|
import forestry.api.genetics.IAllele;
|
||||||
@@ -23,8 +21,6 @@ import forestry.api.genetics.ISpeciesRoot;
|
|||||||
|
|
||||||
public class IsolatorComponentLogic extends ComponentProcessSetCost implements IProcess {
|
public class IsolatorComponentLogic extends ComponentProcessSetCost implements IProcess {
|
||||||
|
|
||||||
private static final Logger LOG = LogManager.getLogger("Genetics");
|
|
||||||
|
|
||||||
protected float enzymePerProcess = 0.5f;
|
protected float enzymePerProcess = 0.5f;
|
||||||
protected float ethanolPerProcess = 10.0f;
|
protected float ethanolPerProcess = 10.0f;
|
||||||
|
|
||||||
@@ -83,28 +79,20 @@ public class IsolatorComponentLogic extends ComponentProcessSetCost implements I
|
|||||||
}
|
}
|
||||||
|
|
||||||
final IChromosomeType[] karyo = root.getKaryotype();
|
final IChromosomeType[] karyo = root.getKaryotype();
|
||||||
final IChromosomeType chromosome = karyo[rand.nextInt(karyo.length)];
|
|
||||||
final IAllele allele;
|
IChromosomeType chromosome;
|
||||||
try {
|
do {
|
||||||
allele = rand.nextBoolean() ? individual.getGenome().getActiveAllele(chromosome)
|
chromosome = karyo[rand.nextInt(karyo.length)];
|
||||||
: individual.getGenome().getInactiveAllele(chromosome);
|
} while (individual.getGenome().getChromosomes()[chromosome.ordinal()] == null);
|
||||||
} catch (NullPointerException npe) {
|
|
||||||
// just return and eat the power without eating the rest of it
|
final IAllele allele = rand.nextBoolean() ? individual.getGenome().getActiveAllele(chromosome)
|
||||||
LOG.warn(
|
: individual.getGenome().getInactiveAllele(chromosome);
|
||||||
"NPE occurred on unknown gene: name: " + chromosome.getName()
|
|
||||||
+ " | ordinal: "
|
|
||||||
+ chromosome.ordinal()
|
|
||||||
+ " | is null? "
|
|
||||||
+ (individual.getGenome().getChromosomes()[chromosome.ordinal()] == null ? "true"
|
|
||||||
: "false"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final Gene gene = new Gene(allele, chromosome, root);
|
final Gene gene = new Gene(allele, chromosome, root);
|
||||||
|
|
||||||
ItemStack serum = ItemSequence.create(gene);
|
ItemStack serum = ItemSequence.create(gene);
|
||||||
getUtil().setStack(Isolator.SLOT_RESULT, serum);
|
getUtil().setStack(Isolator.SLOT_RESULT, serum);
|
||||||
getUtil().decreaseStack(Isolator.SLOT_SEQUENCER_VIAL, 1);
|
getUtil().decreaseStack(Isolator.SLOT_SEQUENCER_VIAL, 1);
|
||||||
if (rand.nextFloat() < 0.05f) {
|
if (rand.nextFloat() < EBConfigMachines.isolatorConsumptionChance) {
|
||||||
getUtil().decreaseStack(Isolator.SLOT_TARGET, 1);
|
getUtil().decreaseStack(Isolator.SLOT_TARGET, 1);
|
||||||
}
|
}
|
||||||
getUtil().drainTank(Isolator.TANK_ETHANOL, (int) ethanolPerProcess);
|
getUtil().drainTank(Isolator.TANK_ETHANOL, (int) ethanolPerProcess);
|
||||||
|
|||||||
@@ -37,11 +37,10 @@ public class AcclimatiserRecipeHandler extends RecipeHandlerBase {
|
|||||||
targets.add(Mods.forestry.stack("caterpillarGE", 1, OreDictionary.WILDCARD_VALUE));
|
targets.add(Mods.forestry.stack("caterpillarGE", 1, OreDictionary.WILDCARD_VALUE));
|
||||||
targets.add(Mods.forestry.stack("serumGE", 1, OreDictionary.WILDCARD_VALUE));
|
targets.add(Mods.forestry.stack("serumGE", 1, OreDictionary.WILDCARD_VALUE));
|
||||||
}
|
}
|
||||||
if (BinnieCore.isBotanyActive()) {
|
|
||||||
targets.add(new ItemStack(Botany.flowerItem, 1, OreDictionary.WILDCARD_VALUE));
|
targets.add(new ItemStack(Botany.flowerItem, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
targets.add(new ItemStack(Botany.seed, 1, OreDictionary.WILDCARD_VALUE));
|
targets.add(new ItemStack(Botany.seed, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
targets.add(new ItemStack(Botany.pollen, 1, OreDictionary.WILDCARD_VALUE));
|
targets.add(new ItemStack(Botany.pollen, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
}
|
|
||||||
recipes.add(new AcclimatiserRecipe(targets, resource, effect, ToleranceType.Temperature));
|
recipes.add(new AcclimatiserRecipe(targets, resource, effect, ToleranceType.Temperature));
|
||||||
});
|
});
|
||||||
Acclimatiser.humidityItems.forEach((resource, effect) -> {
|
Acclimatiser.humidityItems.forEach((resource, effect) -> {
|
||||||
@@ -57,11 +56,10 @@ public class AcclimatiserRecipeHandler extends RecipeHandlerBase {
|
|||||||
targets.add(Mods.forestry.stack("caterpillarGE", 1, OreDictionary.WILDCARD_VALUE));
|
targets.add(Mods.forestry.stack("caterpillarGE", 1, OreDictionary.WILDCARD_VALUE));
|
||||||
targets.add(Mods.forestry.stack("serumGE", 1, OreDictionary.WILDCARD_VALUE));
|
targets.add(Mods.forestry.stack("serumGE", 1, OreDictionary.WILDCARD_VALUE));
|
||||||
}
|
}
|
||||||
if (BinnieCore.isBotanyActive()) {
|
|
||||||
targets.add(new ItemStack(Botany.flowerItem, 1, OreDictionary.WILDCARD_VALUE));
|
targets.add(new ItemStack(Botany.flowerItem, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
targets.add(new ItemStack(Botany.seed, 1, OreDictionary.WILDCARD_VALUE));
|
targets.add(new ItemStack(Botany.seed, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
targets.add(new ItemStack(Botany.pollen, 1, OreDictionary.WILDCARD_VALUE));
|
targets.add(new ItemStack(Botany.pollen, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
}
|
|
||||||
recipes.add(new AcclimatiserRecipe(targets, resource, effect, ToleranceType.Humidity));
|
recipes.add(new AcclimatiserRecipe(targets, resource, effect, ToleranceType.Humidity));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,11 +42,10 @@ public class AnalyserRecipeHandler extends RecipeHandlerBase {
|
|||||||
recipes.add(new AnalyserRecipe(Mods.forestry.stack("caterpillarGE", 1, OreDictionary.WILDCARD_VALUE)));
|
recipes.add(new AnalyserRecipe(Mods.forestry.stack("caterpillarGE", 1, OreDictionary.WILDCARD_VALUE)));
|
||||||
recipes.add(new AnalyserRecipe(Mods.forestry.stack("serumGE", 1, OreDictionary.WILDCARD_VALUE)));
|
recipes.add(new AnalyserRecipe(Mods.forestry.stack("serumGE", 1, OreDictionary.WILDCARD_VALUE)));
|
||||||
}
|
}
|
||||||
if (BinnieCore.isBotanyActive()) {
|
|
||||||
recipes.add(new AnalyserRecipe(new ItemStack(Botany.flowerItem, 1, OreDictionary.WILDCARD_VALUE)));
|
recipes.add(new AnalyserRecipe(new ItemStack(Botany.flowerItem, 1, OreDictionary.WILDCARD_VALUE)));
|
||||||
recipes.add(new AnalyserRecipe(new ItemStack(Botany.seed, 1, OreDictionary.WILDCARD_VALUE)));
|
recipes.add(new AnalyserRecipe(new ItemStack(Botany.seed, 1, OreDictionary.WILDCARD_VALUE)));
|
||||||
recipes.add(new AnalyserRecipe(new ItemStack(Botany.pollen, 1, OreDictionary.WILDCARD_VALUE)));
|
recipes.add(new AnalyserRecipe(new ItemStack(Botany.pollen, 1, OreDictionary.WILDCARD_VALUE)));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -44,11 +44,10 @@ public class GenepoolRecipeHandler extends RecipeHandlerBase {
|
|||||||
recipes.add(new GenepoolRecipe(Mods.forestry.stack("caterpillarGE", 1, OreDictionary.WILDCARD_VALUE)));
|
recipes.add(new GenepoolRecipe(Mods.forestry.stack("caterpillarGE", 1, OreDictionary.WILDCARD_VALUE)));
|
||||||
recipes.add(new GenepoolRecipe(Mods.forestry.stack("serumGE", 1, OreDictionary.WILDCARD_VALUE)));
|
recipes.add(new GenepoolRecipe(Mods.forestry.stack("serumGE", 1, OreDictionary.WILDCARD_VALUE)));
|
||||||
}
|
}
|
||||||
if (BinnieCore.isBotanyActive()) {
|
|
||||||
recipes.add(new GenepoolRecipe(new ItemStack(Botany.flowerItem, 1, OreDictionary.WILDCARD_VALUE)));
|
recipes.add(new GenepoolRecipe(new ItemStack(Botany.flowerItem, 1, OreDictionary.WILDCARD_VALUE)));
|
||||||
recipes.add(new GenepoolRecipe(new ItemStack(Botany.seed, 1, OreDictionary.WILDCARD_VALUE)));
|
recipes.add(new GenepoolRecipe(new ItemStack(Botany.seed, 1, OreDictionary.WILDCARD_VALUE)));
|
||||||
recipes.add(new GenepoolRecipe(new ItemStack(Botany.pollen, 1, OreDictionary.WILDCARD_VALUE)));
|
recipes.add(new GenepoolRecipe(new ItemStack(Botany.pollen, 1, OreDictionary.WILDCARD_VALUE)));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ public class InoculatorRecipeHandler extends RecipeHandlerBase {
|
|||||||
createInoculatorRecipeForNEI(Mods.forestry.stack("pollenFertile", 1, OreDictionary.WILDCARD_VALUE));
|
createInoculatorRecipeForNEI(Mods.forestry.stack("pollenFertile", 1, OreDictionary.WILDCARD_VALUE));
|
||||||
if (BinnieCore.isLepidopteryActive())
|
if (BinnieCore.isLepidopteryActive())
|
||||||
createInoculatorRecipeForNEI(Mods.forestry.stack("serumGE", 1, OreDictionary.WILDCARD_VALUE));
|
createInoculatorRecipeForNEI(Mods.forestry.stack("serumGE", 1, OreDictionary.WILDCARD_VALUE));
|
||||||
if (BinnieCore.isBotanyActive())
|
|
||||||
createInoculatorRecipeForNEI(new ItemStack(Botany.pollen, 1, OreDictionary.WILDCARD_VALUE));
|
createInoculatorRecipeForNEI(new ItemStack(Botany.pollen, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -50,11 +50,10 @@ public class IsolatorRecipeHandler extends RecipeHandlerBase {
|
|||||||
recipes.add(new IsolatorRecipe(Mods.forestry.stack("caterpillarGE", 1, OreDictionary.WILDCARD_VALUE)));
|
recipes.add(new IsolatorRecipe(Mods.forestry.stack("caterpillarGE", 1, OreDictionary.WILDCARD_VALUE)));
|
||||||
recipes.add(new IsolatorRecipe(Mods.forestry.stack("serumGE", 1, OreDictionary.WILDCARD_VALUE)));
|
recipes.add(new IsolatorRecipe(Mods.forestry.stack("serumGE", 1, OreDictionary.WILDCARD_VALUE)));
|
||||||
}
|
}
|
||||||
if (BinnieCore.isBotanyActive()) {
|
|
||||||
recipes.add(new IsolatorRecipe(new ItemStack(Botany.flowerItem, 1, OreDictionary.WILDCARD_VALUE)));
|
recipes.add(new IsolatorRecipe(new ItemStack(Botany.flowerItem, 1, OreDictionary.WILDCARD_VALUE)));
|
||||||
recipes.add(new IsolatorRecipe(new ItemStack(Botany.seed, 1, OreDictionary.WILDCARD_VALUE)));
|
recipes.add(new IsolatorRecipe(new ItemStack(Botany.seed, 1, OreDictionary.WILDCARD_VALUE)));
|
||||||
recipes.add(new IsolatorRecipe(new ItemStack(Botany.pollen, 1, OreDictionary.WILDCARD_VALUE)));
|
recipes.add(new IsolatorRecipe(new ItemStack(Botany.pollen, 1, OreDictionary.WILDCARD_VALUE)));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ public class SplicerRecipeHandler extends RecipeHandlerBase {
|
|||||||
createSplicerRecipeForNEI(Mods.forestry.stack("pollenFertile", 1, OreDictionary.WILDCARD_VALUE));
|
createSplicerRecipeForNEI(Mods.forestry.stack("pollenFertile", 1, OreDictionary.WILDCARD_VALUE));
|
||||||
if (BinnieCore.isLepidopteryActive())
|
if (BinnieCore.isLepidopteryActive())
|
||||||
createSplicerRecipeForNEI(Mods.forestry.stack("serumGE", 1, OreDictionary.WILDCARD_VALUE));
|
createSplicerRecipeForNEI(Mods.forestry.stack("serumGE", 1, OreDictionary.WILDCARD_VALUE));
|
||||||
if (BinnieCore.isBotanyActive())
|
|
||||||
createSplicerRecipeForNEI(new ItemStack(Botany.pollen, 1, OreDictionary.WILDCARD_VALUE));
|
createSplicerRecipeForNEI(new ItemStack(Botany.pollen, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in new issue
Block a user