aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/kubatech/CommonProxy.java1
-rw-r--r--src/main/java/kubatech/api/LoaderReference.java1
-rw-r--r--src/main/java/kubatech/api/Variables.java19
-rw-r--r--src/main/java/kubatech/api/enums/ItemList.java1
-rw-r--r--src/main/java/kubatech/api/utils/StringUtils.java63
-rw-r--r--src/main/java/kubatech/commands/CommandBees.java127
-rw-r--r--src/main/java/kubatech/kubatech.java3
-rw-r--r--src/main/java/kubatech/loaders/RecipeLoader.java28
-rw-r--r--src/main/java/kubatech/loaders/item/items/TeaUltimate.java19
-rw-r--r--src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java570
10 files changed, 816 insertions, 16 deletions
diff --git a/src/main/java/kubatech/CommonProxy.java b/src/main/java/kubatech/CommonProxy.java
index 9f59dd02af..ccd4949137 100644
--- a/src/main/java/kubatech/CommonProxy.java
+++ b/src/main/java/kubatech/CommonProxy.java
@@ -52,6 +52,7 @@ public class CommonProxy {
CommandHandler cmd = new CommandHandler();
cmd.addCommand(new CommandHelp());
cmd.addCommand(new CommandConfig());
+ // cmd.addCommand(new CommandBees());
event.registerServerCommand(cmd);
}
diff --git a/src/main/java/kubatech/api/LoaderReference.java b/src/main/java/kubatech/api/LoaderReference.java
index 289ffb5d72..b9e76a9a30 100644
--- a/src/main/java/kubatech/api/LoaderReference.java
+++ b/src/main/java/kubatech/api/LoaderReference.java
@@ -14,4 +14,5 @@ public class LoaderReference {
public static final boolean GTPlusPlus = Loader.isModLoaded("miscutils");
public static final boolean HarvestCraft = Loader.isModLoaded("harvestcraft");
public static final boolean TwilightForest = Loader.isModLoaded("TwilightForest");
+ public static final boolean Forestry = Loader.isModLoaded("Forestry");
}
diff --git a/src/main/java/kubatech/api/Variables.java b/src/main/java/kubatech/api/Variables.java
index 3b926392fb..43bd457133 100644
--- a/src/main/java/kubatech/api/Variables.java
+++ b/src/main/java/kubatech/api/Variables.java
@@ -19,10 +19,27 @@
package kubatech.api;
+import kubatech.api.utils.StringUtils;
import net.minecraft.util.EnumChatFormatting;
public class Variables {
- public static final String Author = "Author: " + EnumChatFormatting.GOLD + "kuba6000";
+ public static final String Author =
+ "Author: " + StringUtils.applyRainbow("kuba6000", 0, EnumChatFormatting.BOLD.toString());
+
+ public static String buildAuthorList(String... authors) {
+ if (authors.length == 0) return "Author: Unknown";
+ StringBuilder b = new StringBuilder("Author: ")
+ .append(StringUtils.applyRainbow(authors[0], 0, EnumChatFormatting.BOLD.toString()));
+ for (int i = 1; i < authors.length; i++) {
+ String author = authors[i];
+ b.append(EnumChatFormatting.RESET)
+ .append(" & ")
+ .append(EnumChatFormatting.GOLD)
+ .append(author);
+ }
+ return b.toString();
+ }
+
public static final String StructureHologram =
"To see the structure, use a " + EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech"
+ EnumChatFormatting.RESET + "" + EnumChatFormatting.GRAY + " Blueprint on the Controller!";
diff --git a/src/main/java/kubatech/api/enums/ItemList.java b/src/main/java/kubatech/api/enums/ItemList.java
index 015a2b77b9..b37bd86c1c 100644
--- a/src/main/java/kubatech/api/enums/ItemList.java
+++ b/src/main/java/kubatech/api/enums/ItemList.java
@@ -15,6 +15,7 @@ import net.minecraft.item.ItemStack;
public enum ItemList implements IItemContainer {
ExtremeExterminationChamber,
+ ExtremeIndustrialApiary,
LegendaryBlackTea,
LegendaryButterflyTea,
LegendaryEarlGrayTea,
diff --git a/src/main/java/kubatech/api/utils/StringUtils.java b/src/main/java/kubatech/api/utils/StringUtils.java
new file mode 100644
index 0000000000..4305b25cb6
--- /dev/null
+++ b/src/main/java/kubatech/api/utils/StringUtils.java
@@ -0,0 +1,63 @@
+/*
+ * KubaTech - Gregtech Addon
+ * Copyright (C) 2022 kuba6000
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+package kubatech.api.utils;
+
+import net.minecraft.util.EnumChatFormatting;
+
+public class StringUtils {
+
+ private static final String[] rainbow = new String[] {
+ EnumChatFormatting.DARK_RED.toString(),
+ EnumChatFormatting.RED.toString(),
+ EnumChatFormatting.GOLD.toString(),
+ EnumChatFormatting.YELLOW.toString(),
+ EnumChatFormatting.DARK_GREEN.toString(),
+ EnumChatFormatting.GREEN.toString(),
+ EnumChatFormatting.AQUA.toString(),
+ EnumChatFormatting.DARK_AQUA.toString(),
+ EnumChatFormatting.DARK_BLUE.toString(),
+ EnumChatFormatting.BLUE.toString(),
+ EnumChatFormatting.LIGHT_PURPLE.toString(),
+ EnumChatFormatting.DARK_PURPLE.toString(),
+ EnumChatFormatting.WHITE.toString(),
+ EnumChatFormatting.GRAY.toString(),
+ EnumChatFormatting.DARK_GRAY.toString(),
+ EnumChatFormatting.BLACK.toString(),
+ };
+
+ public static String applyRainbow(String str, int offset, String additional) {
+ StringBuilder final_string = new StringBuilder();
+ int i = offset;
+ for (char c : str.toCharArray())
+ final_string
+ .append(rainbow[i++ % rainbow.length])
+ .append(additional)
+ .append(c);
+ return final_string.toString();
+ }
+
+ public static String applyRainbow(String str, int offset) {
+ return applyRainbow(str, offset, "");
+ }
+
+ public static String applyRainbow(String str) {
+ return applyRainbow(str, 0, "");
+ }
+}
diff --git a/src/main/java/kubatech/commands/CommandBees.java b/src/main/java/kubatech/commands/CommandBees.java
new file mode 100644
index 0000000000..8e1a1ad67e
--- /dev/null
+++ b/src/main/java/kubatech/commands/CommandBees.java
@@ -0,0 +1,127 @@
+/*
+ * KubaTech - Gregtech Addon
+ * Copyright (C) 2022 kuba6000
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+package kubatech.commands;
+
+import static forestry.api.apiculture.BeeManager.beeRoot;
+
+import com.google.common.io.Files;
+import forestry.api.apiculture.IAlleleBeeSpecies;
+import forestry.api.apiculture.IBee;
+import forestry.api.apiculture.IBeeGenome;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.item.ItemStack;
+
+public class CommandBees extends CommandBase {
+ @Override
+ public String getCommandName() {
+ return "bees";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender p_71518_1_) {
+ return "bees";
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 4;
+ }
+
+ @Override
+ public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) {
+ // https://docs.google.com/spreadsheets/d/1XaNGtJZ8WYv2nMnYcixTX4Jz3qUr71RadiKT5pToYFk/edit?usp=sharing
+ try {
+ File f = new File("bees.txt");
+ BufferedWriter writer = Files.newWriter(f, StandardCharsets.UTF_8);
+ String delimer = ",";
+
+ writer.write(
+ "Bee,CHANCE,OLD_0.6S_0UP,OLD_0.6S_8UP,OLD_1.7S_0UP,OLD_1.7S_8UP,NEW_0.6S_0UP_1T,NEW_0.6S_8UP_1T,NEW_1.7S_0UP_1T,NEW_1.7S_8UP_1T,NEW_1.7S_8UP_8T\n");
+
+ List<IBee> bees = beeRoot.getIndividualTemplates();
+ for (IBee bee : bees) {
+ // System.out.println("Bee: " + bee.getDisplayName());
+ StringBuilder b = new StringBuilder(bee.getDisplayName());
+ b.append(",-,-,-,-,-,-,-,-,-,-\n");
+ IBeeGenome genome = bee.getGenome();
+ IAlleleBeeSpecies primary = genome.getPrimary();
+ IAlleleBeeSpecies secondary = genome.getSecondary();
+ primary.getProductChances().forEach((k, v) -> printData("[PRIMARY]", k, v, delimer, b));
+ secondary.getProductChances().forEach((k, v) -> printData("[SECONDARY]", k, v / 2f, delimer, b));
+ primary.getSpecialtyChances().forEach((k, v) -> printData("[SPECIALITY]", k, v, delimer, b));
+ writer.write(b.toString());
+ }
+
+ writer.flush();
+ writer.close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void printData(String nameOfData, ItemStack k, float v, String delimer, StringBuilder b) {
+ b.append(nameOfData);
+ b.append(k.toString());
+ b.append(delimer);
+ b.append(format(v));
+ b.append(delimer);
+ b.append(format(productChanceOld(0, 0.6d, v)));
+ b.append(delimer);
+ b.append(format(productChanceOld(8, 0.6d, v)));
+ b.append(delimer);
+ b.append(format(productChanceOld(0, 1.7d, v)));
+ b.append(delimer);
+ b.append(format(productChanceOld(8, 1.7d, v)));
+ b.append(delimer);
+ b.append(format(productChanceNew(0, 0.6d, v, 1)));
+ b.append(delimer);
+ b.append(format(productChanceNew(8, 0.6d, v, 1)));
+ b.append(delimer);
+ b.append(format(productChanceNew(0, 1.7d, v, 1)));
+ b.append(delimer);
+ b.append(format(productChanceNew(8, 1.7d, v, 1)));
+ b.append(delimer);
+ b.append(format(productChanceNew(8, 1.7d, v, 8)));
+ b.append("\n");
+ }
+
+ private String format(double chance) {
+ return String.format("%.2f%%", chance * 100d);
+ }
+
+ private double productChanceNew(int upgradeCount, double beeSpeed, double chance, int t) {
+ chance *= 100f;
+ float productionModifier = (float) upgradeCount * 0.25f;
+ return (float) (((1f + t / 6f) * Math.sqrt(chance) * 2f * (1f + beeSpeed)
+ + Math.pow(productionModifier, Math.cbrt(chance))
+ - 3f)
+ / 100f);
+ }
+
+ private double productChanceOld(int upgradeCount, double beeSpeed, double chance) {
+ return chance * beeSpeed * Math.pow(1.2d, upgradeCount);
+ }
+}
diff --git a/src/main/java/kubatech/kubatech.java b/src/main/java/kubatech/kubatech.java
index 7d0ac1a192..3ce955e007 100644
--- a/src/main/java/kubatech/kubatech.java
+++ b/src/main/java/kubatech/kubatech.java
@@ -44,7 +44,7 @@ import org.apache.logging.log4j.Logger;
acceptedMinecraftVersions = "[1.7.10]",
dependencies = "required-after:gregtech; " + "required-after:spongemixins@[1.4.0,); " + "after:EnderIO; "
+ "after:AWWayofTime; " + "after:ExtraUtilities; " + "after: InfernalMobs; " + "after: Thaumcraft; "
- + "after: MineTweaker3; " + "after: miscutils; " + "after: harvestcraft; ")
+ + "after: MineTweaker3; " + "after: miscutils; " + "after: harvestcraft; " + "after: Forestry; ")
public class kubatech {
public static kubatech instance = null;
@@ -73,6 +73,7 @@ public class kubatech {
public void displayAllReleventItems(List p_78018_1_) {
super.displayAllReleventItems(p_78018_1_);
p_78018_1_.add(ItemList.ExtremeExterminationChamber.get(1));
+ p_78018_1_.add(ItemList.ExtremeIndustrialApiary.get(1));
}
};
diff --git a/src/main/java/kubatech/loaders/RecipeLoader.java b/src/main/java/kubatech/loaders/RecipeLoader.java
index 66a889b010..60e2884704 100644
--- a/src/main/java/kubatech/loaders/RecipeLoader.java
+++ b/src/main/java/kubatech/loaders/RecipeLoader.java
@@ -34,6 +34,7 @@ import kubatech.Tags;
import kubatech.api.LoaderReference;
import kubatech.api.enums.ItemList;
import kubatech.tileentity.gregtech.multiblock.GT_MetaTileEntity_ExtremeExterminationChamber;
+import kubatech.tileentity.gregtech.multiblock.GT_MetaTileEntity_MegaIndustrialApiary;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidRegistry;
@@ -73,6 +74,33 @@ public class RecipeLoader {
GT_ModHandler.getModItem("OpenBlocks", "vacuumhopper", 1, new ItemStack(Blocks.hopper))
});
}
+ if (registerMTE(
+ ExtremeIndustrialApiary,
+ GT_MetaTileEntity_MegaIndustrialApiary.class,
+ "multimachine.extremeapiary",
+ "Industrial Apicultural Acclimatiser and Drone Domestication Station",
+ LoaderReference.Forestry)) {
+ GT_Values.RA.addAssemblylineRecipe(
+ gregtech.api.enums.ItemList.Machine_IndustrialApiary.get(1),
+ 10000,
+ new Object[] {
+ gregtech.api.enums.ItemList.Machine_IndustrialApiary.get(64L),
+ gregtech.api.enums.ItemList.IndustrialApiary_Upgrade_Acceleration_8_Upgraded.get(64L),
+ gregtech.api.enums.ItemList.IndustrialApiary_Upgrade_STABILIZER.get(64L),
+ gregtech.api.enums.ItemList.Robot_Arm_UV.get(16L),
+ new Object[] {OrePrefixes.circuit.get(Materials.Infinite), 4L},
+ new Object[] {OrePrefixes.circuit.get(Materials.Infinite), 4L},
+ new Object[] {OrePrefixes.circuit.get(Materials.Infinite), 4L},
+ new Object[] {OrePrefixes.circuit.get(Materials.Infinite), 4L},
+ },
+ new FluidStack[] {
+ FluidRegistry.getFluidStack("molten.indalloy140", 28800),
+ FluidRegistry.getFluidStack("honey", 20000)
+ },
+ ExtremeIndustrialApiary.get(1),
+ 6000,
+ 2_048_000);
+ }
RegisterTeaLine();
if (MTEID > MTEIDMax + 1) throw new RuntimeException("MTE ID's");
}
diff --git a/src/main/java/kubatech/loaders/item/items/TeaUltimate.java b/src/main/java/kubatech/loaders/item/items/TeaUltimate.java
index 73bf8b33ac..1119de63d3 100644
--- a/src/main/java/kubatech/loaders/item/items/TeaUltimate.java
+++ b/src/main/java/kubatech/loaders/item/items/TeaUltimate.java
@@ -19,9 +19,8 @@
package kubatech.loaders.item.items;
-import java.util.Random;
-import kubatech.api.utils.FastRandom;
import kubatech.api.utils.ModUtils;
+import kubatech.api.utils.StringUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
@@ -31,17 +30,9 @@ public class TeaUltimate extends TeaCollection {
super("ultimate_tea");
}
- private static final String[] Colors = new String[] {
- "\u00a70", "\u00a71", "\u00a72", "\u00a73", "\u00a74", "\u00a75", "\u00a76", "\u00a77", "\u00a78", "\u00a79",
- "\u00a7a", "\u00a7b", "\u00a7c", "\u00a7d", "\u00a7e", "\u00a7f",
- };
- private static final Random rnd = new FastRandom();
private static String name = "";
private static long timeCounter = 0;
-
- private static String rndColor() {
- return Colors[rnd.nextInt(Colors.length)] + EnumChatFormatting.BOLD + "" + EnumChatFormatting.OBFUSCATED;
- }
+ private static int colorCounter = 0;
@Override
public String getDisplayName(ItemStack stack) {
@@ -52,10 +43,10 @@ public class TeaUltimate extends TeaCollection {
.getString("TeaOwner")
.equals(Minecraft.getMinecraft().thePlayer.getCommandSenderName()))) {
long current = System.currentTimeMillis();
- if (current - timeCounter > 200) {
+ if (current - timeCounter > 100) {
timeCounter = current;
- name = rndColor() + "U" + rndColor() + "L" + rndColor() + "T" + rndColor() + "I" + rndColor() + "M"
- + rndColor() + "A" + rndColor() + "T" + rndColor() + "E";
+ name = StringUtils.applyRainbow(
+ "ULTIMATE", colorCounter++, EnumChatFormatting.BOLD.toString() + EnumChatFormatting.OBFUSCATED);
}
return String.format(super.getDisplayName(stack), name + EnumChatFormatting.RESET);
}
diff --git a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java
new file mode 100644
index 0000000000..b61fad059f
--- /dev/null
+++ b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java
@@ -0,0 +1,570 @@
+/*
+ * KubaTech - Gregtech Addon
+ * Copyright (C) 2022 kuba6000
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+package kubatech.tileentity.gregtech.multiblock;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static forestry.api.apiculture.BeeManager.beeRoot;
+import static gregtech.api.enums.Textures.BlockIcons.*;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_GLOW;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static kubatech.api.Variables.*;
+
+import com.github.bartimaeusnek.bartworks.API.BorosilicateGlass;
+import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import forestry.api.apiculture.*;
+import forestry.apiculture.blocks.BlockAlveary;
+import forestry.apiculture.blocks.BlockApicultureType;
+import forestry.apiculture.genetics.Bee;
+import forestry.plugins.PluginApiculture;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
+import gregtech.api.render.TextureFactory;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Utility;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import kubatech.Tags;
+import kubatech.api.LoaderReference;
+import kubatech.api.helpers.GTHelper;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+
+public class GT_MetaTileEntity_MegaIndustrialApiary
+ extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_MegaIndustrialApiary> {
+
+ private byte mGlassTier = 0;
+ private int mCasing = 0;
+ private int mMaxSlots = 0;
+ private int mPrimaryMode = 0;
+ private int mSecondaryMode = 0;
+ private final ArrayList<BeeSimulator> mStorage = new ArrayList<>();
+
+ private static final ItemStack royalJelly = PluginApiculture.items.royalJelly.getItemStack(1);
+ private static final int CASING_INDEX = 10;
+ private static final String STRUCTURE_PIECE_MAIN = "main";
+
+ private static final IStructureDefinition<GT_MetaTileEntity_MegaIndustrialApiary> STRUCTURE_DEFINITION =
+ StructureDefinition.<GT_MetaTileEntity_MegaIndustrialApiary>builder()
+ .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][] { // spotless:off
+ {" "," "," "," HHH "," HHAAAHH "," HAPLPAH "," HAPAAAPAH "," HALAAALAH "," HAPAAAPAH "," HAPLPAH "," HHAAAHH "," HHH "," "," "," "},
+ {" "," "," GGG "," GGG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," GGG "," "," "},
+ {" "," HHH "," HHH HHH "," H GH "," H H "," H H "," H H "," H H "," H H "," H H "," H H "," HG GH "," HHH HHH "," HHH "," "},
+ {" GGG "," GGG GGG "," G G "," G G "," G G "," G G ","G G","G G","G G"," G G "," G G "," G G "," G G "," GGG GGG "," GGG "},
+ {" AAA "," OLA ALO "," P P "," O O "," L L "," A A ","A A","A A","A A"," A A "," L L "," O O "," P P "," OLA ALO "," AAA "},
+ {" AAAAA "," NA AO "," P P "," N O "," A A ","A A","A III A","A III A","A III A","A A"," A A "," N N "," P P "," NA AN "," AAAAA "},
+ {" AAAAA "," NA AO "," P P "," N O "," A A ","A A","A JJJ A","A JKJ A","A JJJ A","A A"," A A "," N N "," P P "," NA AN "," AAAAA "},
+ {" AAA "," OLA ALO "," P P "," O O "," L L "," A A ","A KKK A","A KKK A","A KKK A"," A A "," L L "," O O "," P P "," OLA ALO "," AAA "},
+ {" G~G "," GGGBBBGGG "," GBB BBG "," GB BBG "," GB BG "," G G ","GB KKK BG","GB KJK BG","GB KKK BG"," G G "," GB BG "," GBB BBG "," GBB BBG "," GGGBBBGGG "," GGG "},
+ {" HHH "," HHBBBHH "," HHBBBBBBBHH "," HBBBWWWBBBH "," HBBWWWWWWWBBH "," HBBWBBBBBWWBH ","HBBWWBBBBBBWBBH","HBBWBBBBBBBWBBH","HBBWBBBBBBWWBBH"," HBWWBBBBBWWBH "," HBBWWWBBWWBBH "," HBBBWWWWBBH "," HHBBBBBBBHH "," HHBBBHH "," HHH "},
+ {" "," GGGGG "," GGGBBBBGG "," GBBBBBBBBBG "," GBBBBBBBBBG "," GBBBBBBBBBBBG "," GBBBBBBBBBBBG "," GBBBBBBBBBBBG "," GBBBBBBBBBBBG "," GBBBBBBBBBBBG "," GBBBBBBBBBG "," GBBBBBBBBBG "," GGBBBBBGG "," GGGGG "," "},
+ {" "," HHH "," HHBBBHH "," HBBBBBBBH "," HBBBBBBBBBH "," HBBBBBBBBBH "," HBBBBBBBBBBBH "," HBBBBBBBBBBBH "," HBBBBBBBBBBBH "," HBBBBBBBBBH "," HBBBBBBBBBH "," HBBBBBBBH "," HHBBBHH "," HHH "," "},
+ {" "," "," GGG "," GGBBBGG "," GBBBBBBBG "," GBBBBBBBG "," GBBBBBBBBBG "," GBBBBBBBBBG "," GBBBBBBBBBG "," GBBBBBBBG "," GBBBBBBBG "," GGBBBGG "," GGG "," "," "},
+ {" "," "," H "," HHBHH "," HBBBBBH "," HBBBBBBBH "," HBBBBBBBH "," HBBBBBBBBBH "," HBBBBBBBH "," HBBBBBBBH "," HBBBBBH "," HHBHH "," H "," "," "},
+ {" "," "," "," G "," GGBGG "," GBBBBBG "," GBBBBBG "," GBBBBBBBG "," GBBBBBG "," GBBBBBG "," GGBGG "," G "," "," "," "},
+ {" "," "," "," "," HHH "," HHHHH "," HHBBBHH "," HHBBBHH "," HHBBBHH "," HHBHH "," HHH "," "," "," "," "},
+ {" "," "," "," "," "," "," GGG "," GHG "," GGG "," "," "," "," "," "," "}
+ })) // spotless:on
+ .addElement(
+ 'A',
+ LoaderReference.Bartworks
+ ? BorosilicateGlass.ofBoroGlass(
+ (byte) 0, (t, v) -> t.mGlassTier = v, t -> t.mGlassTier)
+ : onElementPass(t -> t.mGlassTier = 100, ofBlock(Blocks.glass, 0)))
+ .addElement('B', ofChain(ofBlockAnyMeta(Blocks.dirt, 0), ofBlock(Blocks.grass, 0)))
+ .addElement(
+ 'G',
+ ofChain(
+ onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings1, 10)),
+ ofHatchAdder(
+ GT_MetaTileEntity_MegaIndustrialApiary::addInputToMachineList,
+ CASING_INDEX,
+ 1),
+ ofHatchAdder(
+ GT_MetaTileEntity_MegaIndustrialApiary::addOutputToMachineList,
+ CASING_INDEX,
+ 1),
+ ofHatchAdder(
+ GT_MetaTileEntity_MegaIndustrialApiary::addEnergyInputToMachineList,
+ CASING_INDEX,
+ 1),
+ ofHatchAdder(
+ GT_MetaTileEntity_MegaIndustrialApiary::addMaintenanceToMachineList,
+ CASING_INDEX,
+ 1)))
+ .addElement('H', ofBlockAnyMeta(Blocks.planks, 5))
+ .addElement('I', ofBlockAnyMeta(Blocks.wooden_slab, 5))
+ .addElement('J', ofBlock(PluginApiculture.blocks.apiculture, BlockApicultureType.APIARY.getMeta()))
+ .addElement('K', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.PLAIN.ordinal()))
+ .addElement('L', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.HYGRO.ordinal()))
+ .addElement('N', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.STABILIZER.ordinal()))
+ .addElement('O', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.HEATER.ordinal()))
+ .addElement('P', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.FAN.ordinal()))
+ .addElement('W', ofBlock(Blocks.water, 0))
+ .build();
+
+ @SuppressWarnings("unused")
+ public GT_MetaTileEntity_MegaIndustrialApiary(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GT_MetaTileEntity_MegaIndustrialApiary(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 7, 8, 0);
+ }
+
+ @Override
+ public IStructureDefinition<GT_MetaTileEntity_MegaIndustrialApiary> getStructureDefinition() {
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ protected IAlignmentLimits getInitialAlignmentLimits() {
+ return (d, r, f) -> d.offsetY == 0 && r.isNotRotated();
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Apiary")
+ .addInfo("Controller block for Industrial Apicultural Acclimatiser and Drone Domestication Station")
+ .addInfo(buildAuthorList("kuba6000", "Runakai"))
+ .addInfo("The ideal home for your bees")
+ .addInfo("AKA. Mega Apiary")
+ .addInfo("Use scredriver to change primary mode (INPUT/OUTPUT/OPERATING)")
+ .addInfo("Use scredriver + shift to change operation mode (NORMAL/SWARMER)")
+ .addInfo("--------------------- INPUT MODE ---------------------")
+ .addInfo("- Does not take power")
+ .addInfo("- Put your queens in the input bus to put them in the internal buffer")
+ .addInfo("-------------------- OUTPUT MODE ---------------------")
+ .addInfo("- Does not take power")
+ .addInfo("- Will give your bees back to output bus")
+ .addInfo("------------------- OPERATING MODE -------------------")
+ .addInfo("- NORMAL:")
+ .addInfo(" - For each LuV amp you can insert 1 bee")
+ .addInfo(" - Processing time: 5 seconds")
+ .addInfo(" - Uses 1 LuV amp per bee")
+ .addInfo(" - All bees are accelerated 64 times")
+ .addInfo(" - 8 production upgrades are applied")
+ .addInfo(" - Genetic Stabilizer upgrade applied")
+ .addInfo(" - Simulates perfect environment for your bees")
+ .addInfo(" - Additionally you can provide royal jelly to increase the outputs:")
+ .addInfo(" - 1 royal jelly grants 5% bonus")
+ .addInfo(" - They will be consumed on each start of operation")
+ .addInfo(" - and be applied to that operation only")
+ .addInfo(" - Max bonus: 200%")
+ .addInfo("- SWARMER:")
+ .addInfo(" - You can only insert 1 queen")
+ .addInfo(" - It will slowly produce ignoble princesses")
+ .addInfo(" - Consumes 100 royal jelly per operation")
+ .addInfo(" - Base processing time: 1 minute")
+ .addInfo(" - Uses 1 amp IV")
+ .addInfo(" - Can overclock")
+ .addInfo(StructureHologram)
+ .addSeparator()
+ .beginStructureBlock(15, 17, 15, false)
+ .addController("Front Bottom Center")
+ .addCasingInfo("Bronze Plated Bricks", 190)
+ .addOtherStructurePart("Borosilicate Glass", "Look at the hologram")
+ .addStructureInfo("The glass tier limits the Energy Input tier")
+ .addInputBus("Any casing", 1)
+ .addOutputBus("Any casing", 1)
+ .addEnergyHatch("Any casing", 1)
+ .addMaintenanceHatch("Any casing", 1)
+ .toolTipFinisher(Tags.MODNAME);
+ return tt;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setByte("mGlassTier", mGlassTier);
+ aNBT.setInteger("mPrimaryMode", mPrimaryMode);
+ aNBT.setInteger("mSecondaryMode", mSecondaryMode);
+ aNBT.setInteger("mStorageSize", mStorage.size());
+ for (int i = 0; i < mStorage.size(); i++)
+ aNBT.setTag("mStorage." + i, mStorage.get(i).toNBTTagCompound());
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ mGlassTier = aNBT.getByte("mGlassTier");
+ mPrimaryMode = aNBT.getInteger("mPrimaryMode");
+ mSecondaryMode = aNBT.getInteger("mSecondaryMode");
+ for (int i = 0, isize = aNBT.getInteger("mStorageSize"); i < isize; i++)
+ mStorage.add(new BeeSimulator(aNBT.getCompoundTag("mStorage." + i)));
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (this.mMaxProgresstime > 0) {
+ GT_Utility.sendChatToPlayer(aPlayer, "Can't change mode when running !");
+ return;
+ }
+ if (!aPlayer.isSneaking()) {
+ mPrimaryMode++;
+ if (mPrimaryMode == 3) mPrimaryMode = 0;
+ switch (mPrimaryMode) {
+ case 0:
+ GT_Utility.sendChatToPlayer(aPlayer, "Changed primary mode to: Input mode");
+ break;
+ case 1:
+ GT_Utility.sendChatToPlayer(aPlayer, "Changed primary mode to: Output mode");
+ break;
+ case 2:
+ GT_Utility.sendChatToPlayer(aPlayer, "Changed primary mode to: Operating mode");
+ break;
+ }
+ } else {
+ if (!mStorage.isEmpty()) {
+ GT_Utility.sendChatToPlayer(aPlayer, "Can't change operating mode when the multi is not empty !");
+ return;
+ }
+ mSecondaryMode++;
+ if (mSecondaryMode == 2) mSecondaryMode = 0;
+ switch (mSecondaryMode) {
+ case 0:
+ GT_Utility.sendChatToPlayer(aPlayer, "Changed secondary mode to: Normal mode");
+ break;
+ case 1:
+ GT_Utility.sendChatToPlayer(aPlayer, "Changed secondary mode to: Swarmer mode");
+ break;
+ }
+ }
+ }
+
+ private void updateMaxSlots() {
+ long v = GTHelper.getMaxInputEU(this);
+ if (v < GT_Values.V[6]) mMaxSlots = 0;
+ else if (mSecondaryMode == 0) mMaxSlots = (int) (v / GT_Values.V[6]);
+ else mMaxSlots = 1;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ // Beeeee rendering inside ?
+ }
+
+ @Override
+ public boolean checkRecipe(ItemStack aStack) {
+ updateMaxSlots();
+ if (mPrimaryMode < 2) {
+ if (mPrimaryMode == 0 && mStorage.size() < mMaxSlots) {
+ World w = getBaseMetaTileEntity().getWorld();
+ ArrayList<ItemStack> inputs = getStoredInputs();
+ for (ItemStack input : inputs) {
+ if (beeRoot.getType(input) == EnumBeeType.QUEEN) {
+ BeeSimulator bs = new BeeSimulator(input, w);
+ if (bs.isValid) mStorage.add(bs);
+ }
+ }
+ updateSlots();
+ } else if (mPrimaryMode == 1 && mStorage.size() > 0) {
+ for (int i = 0, imax = Math.min(10, mStorage.size()); i < imax; i++) {
+ addOutput(mStorage.get(0).queenStack);
+ mStorage.remove(0);
+ }
+ } else return false;
+ mMaxProgresstime = 10;
+ mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ mEfficiencyIncrease = 10000;
+ mEUt = 0;
+ return true;
+ } else if (mPrimaryMode == 2) {
+ if (mMaxSlots > 0 && !mStorage.isEmpty()) {
+ if (mSecondaryMode == 0) {
+ this.mEUt = -((int) GT_Values.V[6] * mStorage.size());
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+ this.mMaxProgresstime = 100;
+
+ int maxConsume = Math.min(mStorage.size(), mMaxSlots) * 40;
+ int toConsume = maxConsume;
+ ArrayList<ItemStack> inputs = getStoredInputs();
+
+ for (ItemStack input : inputs) {
+ if (!input.isItemEqual(royalJelly)) continue;
+ int consumed = Math.min(input.stackSize, toConsume);
+ toConsume -= consumed;
+ input.stackSize -= toConsume;
+ if (toConsume == 0) break;
+ }
+ double boosted = 1d;
+ if (toConsume != maxConsume) {
+ boosted += (((double) maxConsume - (double) toConsume) / (double) maxConsume) * 2d;
+ this.updateSlots();
+ }
+
+ List<ItemStack> stacks = new ArrayList<>();
+ for (int i = 0, mStorageSize = Math.min(mStorage.size(), mMaxSlots); i < mStorageSize; i++) {
+ BeeSimulator beeSimulator = mStorage.get(i);
+ stacks.addAll(beeSimulator.getDrops(64_00d * boosted));
+ }
+ this.mOutputItems = stacks.toArray(new ItemStack[0]);
+ return true;
+ } else {
+ if (!depleteInput(PluginApiculture.items.royalJelly.getItemStack(64))
+ && !depleteInput(PluginApiculture.items.royalJelly.getItemStack(36))) {
+ this.updateSlots();
+ return false;
+ }
+ calculateOverclockedNessMulti((int) GT_Values.V[5], 1200, 2, getMaxInputVoltage());
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+ this.mOutputItems = new ItemStack[] {this.mStorage.get(0).createIgnobleCopy()};
+ this.updateSlots();
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mGlassTier = 0;
+ mCasing = 0;
+ if (!checkPiece(STRUCTURE_PIECE_MAIN, 7, 8, 0)) return false;
+ if (this.mGlassTier < 8 && !this.mEnergyHatches.isEmpty())
+ for (GT_MetaTileEntity_Hatch_Energy hatchEnergy : this.mEnergyHatches)
+ if (this.mGlassTier < hatchEnergy.mTier) return false;
+ boolean valid = this.mMaintenanceHatches.size() == 1 && this.mEnergyHatches.size() >= 1 && this.mCasing >= 190;
+ if (valid) updateMaxSlots();
+ return valid;
+ }
+
+ @Override
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_MegaIndustrialApiary(this.mName);
+ }
+
+ @Override
+ public ITexture[] getTexture(
+ IGregTechTileEntity aBaseMetaTileEntity,
+ byte aSide,
+ byte aFacing,
+ byte aColorIndex,
+ boolean aActive,
+ boolean aRedstone) {
+ if (aSide == aFacing) {
+ if (aActive)
+ return new ITexture[] {
+ Textures.BlockIcons.getCasingTextureForId(CASING_INDEX),
+ TextureFactory.builder()
+ .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE)
+ .extFacing()
+ .build(),
+ TextureFactory.builder()
+ .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW)
+ .extFacing()
+ .glow()
+ .build()
+ };
+ return new ITexture[] {
+ Textures.BlockIcons.getCasingTextureForId(CASING_INDEX),
+ TextureFactory.builder()
+ .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER)
+ .extFacing()
+ .build(),
+ TextureFactory.builder()
+ .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_GLOW)
+ .extFacing()
+ .glow()
+ .build()
+ };
+ }
+ return new ITexture[] {Textures.BlockIcons.getCasingTextureForId(CASING_INDEX)};
+ }
+
+ private static class BeeSimulator {
+ ItemStack queenStack;
+ boolean isValid;
+ // boolean isBreadingMode;
+ // boolean isInfinite;
+ List<BeeDrop> drops;
+ List<BeeDrop> specialDrops;
+ float beeSpeed;
+
+ float maxBeeCycles;
+
+ public BeeSimulator(ItemStack queenStack, World world) {
+ isValid = false;
+ this.queenStack = queenStack.copy();
+ if (beeRoot.getType(this.queenStack) != EnumBeeType.QUEEN) return;
+ IBee queen = beeRoot.getMember(this.queenStack);
+ IBeekeepingMode mode = beeRoot.getBeekeepingMode(world);
+ IBeeModifier beeModifier = mode.getBeeModifier();
+ float mod = beeModifier.getLifespanModifier(null, null, 1.f);
+ int h = queen.getMaxHealth();
+ maxBeeCycles = (float) h / (1.f / mod);
+ IBeeGenome genome = queen.getGenome();
+ // isInfinite = queen.isNatural();
+ // if (!isInfinite && h < 4) return;
+ IAlleleBeeSpecies primary = genome.getPrimary();
+ drops = new ArrayList<>();
+ specialDrops = new ArrayList<>();
+ beeSpeed = genome.getSpeed() * beeModifier.getProductionModifier(null, 1.f);
+ genome.getPrimary()
+ .getProductChances()
+ .forEach((key, value) -> drops.add(new BeeDrop(key, value, beeSpeed)));
+ genome.getSecondary()
+ .getProductChances()
+ .forEach((key, value) -> drops.add(new BeeDrop(key, value / 2.f, beeSpeed)));
+ primary.getSpecialtyChances().forEach((key, value) -> specialDrops.add(new BeeDrop(key, value, beeSpeed)));
+
+ isValid = true;
+ queenStack.stackSize--;
+ }
+
+ public BeeSimulator(NBTTagCompound tag) {
+ queenStack = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("queenstack"));
+ isValid = tag.getBoolean("isValid");
+ // isBreadingMode = tag.getBoolean("isBreadingMode");
+ // isInfinite = tag.getBoolean("isInfinite");
+ drops = new ArrayList<>();
+ specialDrops = new ArrayList<>();
+ for (int i = 0, isize = tag.getInteger("dropssize"); i < isize; i++)
+ drops.add(new BeeDrop(tag.getCompoundTag("drops" + i)));
+ for (int i = 0, isize = tag.getInteger("specialDropssize"); i < isize; i++)
+ specialDrops.add(new BeeDrop(tag.getCompoundTag("specialDrops" + i)));
+ beeSpeed = tag.getFloat("beeSpeed");
+ maxBeeCycles = tag.getFloat("maxBeeCycles");
+ }
+
+ public NBTTagCompound toNBTTagCompound() {
+ NBTTagCompound tag = new NBTTagCompound();
+ tag.setTag("queenStack", queenStack.writeToNBT(new NBTTagCompound()));
+ tag.setBoolean("isValid", isValid);
+ // tag.setBoolean("isBreadingMode", isBreadingMode);
+ // tag.setBoolean("isInfinite", isInfinite);
+ tag.setInteger("dropssize", drops.size());
+ for (int i = 0; i < drops.size(); i++)
+ tag.setTag("drops" + i, drops.get(i).toNBTTagCompound());
+ tag.setInteger("specialDropssize", drops.size());
+ for (int i = 0; i < specialDrops.size(); i++)
+ tag.setTag("specialDrops" + i, specialDrops.get(i).toNBTTagCompound());
+ tag.setFloat("beeSpeed", beeSpeed);
+ tag.setFloat("maxBeeCycles", maxBeeCycles);
+ return tag;
+ }
+
+ HashMap<BeeDrop, Double> dropProgress = new HashMap<>();
+
+ public List<ItemStack> getDrops(final double timePassed) {
+ drops.forEach(d -> dropProgress.merge(d, d.getAmount(timePassed / 550d), Double::sum));
+ specialDrops.forEach(d -> dropProgress.merge(d, d.getAmount(timePassed / 550d), Double::sum));
+ List<ItemStack> currentDrops = new ArrayList<>();
+ dropProgress.entrySet().forEach(e -> {
+ double v = e.getValue();
+ while (v > 1.f) {
+ int size = Math.min((int) v, 64);
+ currentDrops.add(e.getKey().get(size));
+ v -= size;
+ e.setValue(v);
+ }
+ });
+ return currentDrops;
+ }
+
+ public ItemStack createIgnobleCopy() {
+ IBee princess = beeRoot.getMember(queenStack);
+ princess.setIsNatural(false);
+ return beeRoot.getMemberStack(princess, EnumBeeType.PRINCESS.ordinal());
+ }
+
+ private static class BeeDrop {
+ ItemStack stack;
+ double amount;
+ GT_Utility.ItemId id;
+
+ public BeeDrop(ItemStack stack, float chance, float beeSpeed) {
+ this.stack = stack;
+ this.amount = Bee.getFinalChance(chance, beeSpeed, 2.f, 8.f);
+ id = GT_Utility.ItemId.createNoCopy(stack);
+ }
+
+ public double getAmount(double speedModifier) {
+ return amount * speedModifier;
+ }
+
+ public ItemStack get(int amount) {
+ ItemStack r = stack.copy();
+ r.stackSize = amount;
+ return r;
+ }
+
+ public BeeDrop(NBTTagCompound tag) {
+ stack = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("stack"));
+ amount = tag.getDouble("amount");
+ id = GT_Utility.ItemId.createNoCopy(stack);
+ }
+
+ public NBTTagCompound toNBTTagCompound() {
+ NBTTagCompound tag = new NBTTagCompound();
+ tag.setTag("stack", stack.writeToNBT(new NBTTagCompound()));
+ tag.setDouble("amount", amount);
+ return tag;
+ }
+
+ @Override
+ public int hashCode() {
+ return id.hashCode();
+ }
+ }
+ }
+}