aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_IndustrialApiary.java25
-rw-r--r--src/main/java/gregtech/loaders/misc/GT_BeeDefinition.java10
-rw-r--r--src/main/java/gregtech/loaders/misc/GT_Bees.java16
-rw-r--r--src/main/java/gregtech/loaders/misc/bees/GT_AlleleEffect.java44
-rw-r--r--src/main/java/gregtech/loaders/misc/bees/GT_EffectTreeTwister.java86
-rw-r--r--src/main/resources/assets/gregtech/lang/en_US.lang1
6 files changed, 177 insertions, 5 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_IndustrialApiary.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_IndustrialApiary.java
index de1640e958..e43b1a305c 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_IndustrialApiary.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_IndustrialApiary.java
@@ -144,7 +144,13 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM
aNameRegional,
aTier,
4,
- new String[] { "BEES GOES BRRRR", EnumChatFormatting.GRAY + AuthorKuba },
+ new String[] { "BEES GOES BRRRR", EnumChatFormatting.GRAY + AuthorKuba,
+ "Effective production chance as a percent is", "2.8 * b^0.52 * (p + t)^0.52 * s^0.37",
+ "where b is the base production chance as a percent,",
+ "p is the production modifier (2 w/o upgrades, or 4 * 1.2^n with n production upgrades),",
+ "t is 8 for the industrial apiary, and", "s is the speed value for the bee",
+ "Outputs are generated at the end of every bee tick (...)",
+ "Primary outputs are rolled once with base chance, once with half base" },
6,
9,
"IndustrialApiary.png",
@@ -1457,6 +1463,11 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM
currenttip.add(
"Current Queen: " + EnumChatFormatting.GREEN + StatCollector.translateToLocal(tag.getString("queen")));
}
+ if (tag.hasKey("dummyProduction")) {
+ currenttip.add(
+ "Effective Production: " + EnumChatFormatting.AQUA
+ + String.format("b^0.52 * %.2f", tag.getFloat("dummyProduction")));
+ }
if (tag.hasKey("errors")) {
NBTTagCompound errorNbt = tag.getCompoundTag("errors");
for (int i = 0; i < errorNbt.getInteger("size"); i++) {
@@ -1472,12 +1483,18 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM
int z) {
super.getWailaNBTData(player, tile, tag, world, x, y, z);
if (usedQueen != null) {
+ IBeeGenome genome = beeRoot.getMember(usedQueen)
+ .getGenome();
tag.setString(
"queen",
- beeRoot.getMember(usedQueen)
- .getGenome()
- .getPrimary()
+ genome.getPrimary()
.getUnlocalizedName());
+ float prodModifier = getProductionModifier(genome, 0f);
+ prodModifier += beeRoot.getBeekeepingMode(world)
+ .getBeeModifier()
+ .getProductionModifier(genome, prodModifier);
+ float dummyProduction = 100f * Bee.getFinalChance(0.01f, genome.getSpeed(), prodModifier, 8f);
+ tag.setFloat("dummyProduction", dummyProduction);
}
if (hasErrors()) {
NBTTagCompound errorNbt = new NBTTagCompound();
diff --git a/src/main/java/gregtech/loaders/misc/GT_BeeDefinition.java b/src/main/java/gregtech/loaders/misc/GT_BeeDefinition.java
index 197c012825..25665eaf7c 100644
--- a/src/main/java/gregtech/loaders/misc/GT_BeeDefinition.java
+++ b/src/main/java/gregtech/loaders/misc/GT_BeeDefinition.java
@@ -713,6 +713,11 @@ public enum GT_BeeDefinition implements IBeeDefinition {
IBeeMutationCustom tMutation = dis.registerMutation(LEAD, OSMIUM, 1);
tMutation.requireResource("blockIndium");
tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(39, "Venus")); // Venus Dim
+ // Harder mutation that isn't dim locked
+ tMutation = dis.registerMutation(SILVER, OSMIUM, 1);
+ tMutation.requireResource("blockCinobiteA243");
+ tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(60, "Bedrock")); // Thaumic Tinkerer
+ // Bedrock Dim
}),
// IC2
@@ -2224,7 +2229,10 @@ public enum GT_BeeDefinition implements IBeeDefinition {
beeSpecies.addProduct(GT_Bees.combs.getStackForType(CombType.BARNARDA), 0.25f);
beeSpecies.setHumidity(ARID);
beeSpecies.setTemperature(HOT);
- }, template -> AlleleHelper.instance.set(template, LIFESPAN, Lifespan.SHORTEST), dis -> {
+ }, template -> {
+ AlleleHelper.instance.set(template, LIFESPAN, Lifespan.SHORTEST);
+ AlleleHelper.instance.set(template, EFFECT, getEffect(GREGTECH, "Treetwister"));
+ }, dis -> {
IBeeMutationCustom tMutation = dis.registerMutation(BARNARDA, AMERICIUM, 3, 2);
if (GalaxySpace.isModLoaded()) {
tMutation.requireResource(GameRegistry.findBlock(GalaxySpace.ID, "barnardaEgrunt"), 0);
diff --git a/src/main/java/gregtech/loaders/misc/GT_Bees.java b/src/main/java/gregtech/loaders/misc/GT_Bees.java
index cca35521a2..497105d75c 100644
--- a/src/main/java/gregtech/loaders/misc/GT_Bees.java
+++ b/src/main/java/gregtech/loaders/misc/GT_Bees.java
@@ -1,11 +1,14 @@
package gregtech.loaders.misc;
import static gregtech.api.enums.Mods.Forestry;
+import static gregtech.api.enums.Mods.GalaxySpace;
+import static gregtech.api.enums.Mods.TwilightForest;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import forestry.api.apiculture.EnumBeeChromosome;
+import forestry.api.apiculture.IAlleleBeeEffect;
import forestry.api.core.IClimateProvider;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
@@ -22,6 +25,8 @@ import gregtech.common.items.ItemComb;
import gregtech.common.items.ItemDrop;
import gregtech.common.items.ItemPollen;
import gregtech.common.items.ItemPropolis;
+import gregtech.loaders.misc.bees.GT_AlleleEffect;
+import gregtech.loaders.misc.bees.GT_EffectTreeTwister;
public class GT_Bees {
@@ -41,6 +46,8 @@ public class GT_Bees {
public static IAlleleInteger blinkLife;
public static IAlleleInteger superLife;
+ public static IAlleleBeeEffect treetwisterEffect;
+
public static ItemPropolis propolis;
public static ItemPollen pollen;
public static ItemDrop drop;
@@ -84,6 +91,15 @@ public class GT_Bees {
blinkLife = new AlleleInteger("lifeBlink", 2, false, EnumBeeChromosome.LIFESPAN);
superLife = new AlleleInteger("lifeEon", 600, false, EnumBeeChromosome.LIFESPAN);
+
+ if (GalaxySpace.isModLoaded() && TwilightForest.isModLoaded()) {
+ GT_Mod.GT_FML_LOGGER.info("treetwisterEffect: GalaxySpace and TwilightForest loaded, using default impl");
+ treetwisterEffect = new GT_EffectTreeTwister();
+ } else {
+ GT_Mod.GT_FML_LOGGER
+ .info("treetwisterEffect: GalaxySpace or TwilightForest was not loaded, using fallback impl");
+ treetwisterEffect = GT_AlleleEffect.FORESTRY_BASE_EFFECT;
+ }
}
private static class AlleleFloat extends Allele implements IAlleleFloat {
diff --git a/src/main/java/gregtech/loaders/misc/bees/GT_AlleleEffect.java b/src/main/java/gregtech/loaders/misc/bees/GT_AlleleEffect.java
new file mode 100644
index 0000000000..bb0d9eef8b
--- /dev/null
+++ b/src/main/java/gregtech/loaders/misc/bees/GT_AlleleEffect.java
@@ -0,0 +1,44 @@
+package gregtech.loaders.misc.bees;
+
+import forestry.api.apiculture.EnumBeeChromosome;
+import forestry.api.apiculture.IAlleleBeeEffect;
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeHousing;
+import forestry.api.genetics.AlleleManager;
+import forestry.api.genetics.IEffectData;
+import forestry.core.genetics.alleles.Allele;
+
+// helper class for implementing custom bee effects, based on MagicBees' implementation
+public abstract class GT_AlleleEffect extends Allele implements IAlleleBeeEffect {
+
+ public static final IAlleleBeeEffect FORESTRY_BASE_EFFECT = (IAlleleBeeEffect) AlleleManager.alleleRegistry
+ .getAllele("forestry.effectNone");
+ protected boolean combinable;
+
+ public GT_AlleleEffect(String id, boolean isDominant) {
+ super("gregtech." + id, "gregtech." + id, isDominant);
+ AlleleManager.alleleRegistry.registerAllele(this, EnumBeeChromosome.EFFECT);
+ combinable = false;
+ }
+
+ @Override
+ public boolean isCombinable() {
+ return combinable;
+ }
+
+ public GT_AlleleEffect setIsCombinable(boolean canCombine) {
+ combinable = canCombine;
+ return this;
+ }
+
+ @Override
+ public abstract IEffectData validateStorage(IEffectData storedData);
+
+ @Override
+ public abstract IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing);
+
+ @Override
+ public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
+ return FORESTRY_BASE_EFFECT.doFX(genome, storedData, housing);
+ }
+}
diff --git a/src/main/java/gregtech/loaders/misc/bees/GT_EffectTreeTwister.java b/src/main/java/gregtech/loaders/misc/bees/GT_EffectTreeTwister.java
new file mode 100644
index 0000000000..61c78e7443
--- /dev/null
+++ b/src/main/java/gregtech/loaders/misc/bees/GT_EffectTreeTwister.java
@@ -0,0 +1,86 @@
+package gregtech.loaders.misc.bees;
+
+import static gregtech.api.enums.Mods.GalaxySpace;
+import static gregtech.api.enums.Mods.TwilightForest;
+
+import java.util.Arrays;
+
+import net.minecraft.block.Block;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ChunkCoordinates;
+import net.minecraft.world.World;
+
+import forestry.api.apiculture.BeeManager;
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeHousing;
+import forestry.api.apiculture.IBeeModifier;
+import forestry.api.genetics.IEffectData;
+import gregtech.GT_Mod;
+import gregtech.api.util.GT_ModHandler;
+
+public class GT_EffectTreeTwister extends GT_AlleleEffect {
+
+ private static final Integer[] ALLOWED_DIMS = { 2, // spectre
+ 112, // last millenium
+ 60, // bedrock
+ 69, // pocket plane
+ };
+
+ private static final ItemStack TF_TRANS_SAPLING = GT_ModHandler
+ .getModItem(TwilightForest.ID, "tile.TFSapling", 1, 6);
+ private static final ItemStack BARN_SAPLING = GT_ModHandler.getModItem(GalaxySpace.ID, "barnardaCsapling", 1, 0);
+
+ static {
+ if (TF_TRANS_SAPLING == null) {
+ GT_Mod.GT_FML_LOGGER.info("GT_EffectTreeTwister(): Could not get ItemStack for BarnardaC sapling");
+ }
+ if (BARN_SAPLING == null) {
+ GT_Mod.GT_FML_LOGGER.info("GT_EffectTreeTwister(): Could not get ItemStack for BarnardaC sapling");
+ }
+ }
+
+ public GT_EffectTreeTwister() {
+ super("effectTreetwister", false);
+ }
+
+ public IEffectData validateStorage(IEffectData storedData) {
+ return storedData; // unused for this effect
+ }
+
+ public IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
+ if (TF_TRANS_SAPLING == null || BARN_SAPLING == null) {
+ return storedData;
+ }
+ World world = housing.getWorld();
+ if (!Arrays.asList(ALLOWED_DIMS)
+ .contains(world.provider.dimensionId)) {
+ return storedData;
+ }
+ ChunkCoordinates coords = housing.getCoordinates();
+ IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
+
+ // Get random coords within territory
+ int xRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]);
+ int yRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]);
+ int zRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[2]);
+
+ int xCoord = coords.posX + world.rand.nextInt(xRange) - xRange / 2;
+ int yCoord = coords.posY + world.rand.nextInt(yRange) - yRange / 2;
+ int zCoord = coords.posZ + world.rand.nextInt(zRange) - zRange / 2;
+
+ ItemStack sourceBlock = new ItemStack(
+ world.getBlock(xCoord, yCoord, zCoord),
+ 1,
+ world.getBlockMetadata(xCoord, yCoord, zCoord));
+ if (TF_TRANS_SAPLING != null && BARN_SAPLING != null && TF_TRANS_SAPLING.isItemEqual(sourceBlock)) {
+ world.setBlock(
+ xCoord,
+ yCoord,
+ zCoord,
+ Block.getBlockFromItem(BARN_SAPLING.getItem()),
+ BARN_SAPLING.getItemDamage(),
+ 2);
+ }
+ return storedData;
+ }
+}
diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang
index ff1952aae5..dc67ba0531 100644
--- a/src/main/resources/assets/gregtech/lang/en_US.lang
+++ b/src/main/resources/assets/gregtech/lang/en_US.lang
@@ -1193,6 +1193,7 @@ gregtech.speedUnproductive=Unproductive
gregtech.speedAccelerated=Accelerated
gregtech.lifeBlink=Blink
gregtech.lifeEon=Eon
+gregtech.effectTreetwister=Treetwister
entity.gregtech.GT_Entity_Arrow.name= a GregTech arrow