aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api')
-rw-r--r--src/main/java/gregtech/api/enums/ItemList.java22
-rw-r--r--src/main/java/gregtech/api/util/GT_ApiaryModifier.java22
-rw-r--r--src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java159
3 files changed, 172 insertions, 31 deletions
diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java
index a6d93af7a3..626f97e817 100644
--- a/src/main/java/gregtech/api/enums/ItemList.java
+++ b/src/main/java/gregtech/api/enums/ItemList.java
@@ -1431,6 +1431,7 @@ public enum ItemList implements IItemContainer {
Machine_HV_Miner,
Machine_IndustrialApiary,
+ IndustrialApiary_Upgrade_Frame,
IndustrialApiary_Upgrade_Acceleration_1,
IndustrialApiary_Upgrade_Acceleration_2,
IndustrialApiary_Upgrade_Acceleration_3,
@@ -1440,6 +1441,27 @@ public enum ItemList implements IItemContainer {
IndustrialApiary_Upgrade_Acceleration_7,
IndustrialApiary_Upgrade_Acceleration_8,
IndustrialApiary_Upgrade_Acceleration_8_Upgraded,
+ IndustrialApiary_Upgrade_PRODUCTION,
+ IndustrialApiary_Upgrade_PLAINS,
+ IndustrialApiary_Upgrade_LIGHT,
+ IndustrialApiary_Upgrade_FLOWERING,
+ IndustrialApiary_Upgrade_WINTER,
+ IndustrialApiary_Upgrade_DRYER,
+ IndustrialApiary_Upgrade_AUTOMATION,
+ IndustrialApiary_Upgrade_HUMIDIFIER,
+ IndustrialApiary_Upgrade_HELL,
+ IndustrialApiary_Upgrade_POLLEN,
+ IndustrialApiary_Upgrade_DESERT,
+ IndustrialApiary_Upgrade_COOLER,
+ IndustrialApiary_Upgrade_LIFESPAN,
+ IndustrialApiary_Upgrade_SEAL,
+ IndustrialApiary_Upgrade_STABILIZER,
+ IndustrialApiary_Upgrade_JUNGLE,
+ IndustrialApiary_Upgrade_TERRITORY,
+ IndustrialApiary_Upgrade_OCEAN,
+ IndustrialApiary_Upgrade_SKY,
+ IndustrialApiary_Upgrade_HEATER,
+ IndustrialApiary_Upgrade_SIEVE,
Neutron_Reflector,
diff --git a/src/main/java/gregtech/api/util/GT_ApiaryModifier.java b/src/main/java/gregtech/api/util/GT_ApiaryModifier.java
new file mode 100644
index 0000000000..9df7bf9a7b
--- /dev/null
+++ b/src/main/java/gregtech/api/util/GT_ApiaryModifier.java
@@ -0,0 +1,22 @@
+package gregtech.api.util;
+
+import net.minecraft.world.biome.BiomeGenBase;
+
+public class GT_ApiaryModifier {
+ public float territory = 1.0F;
+ public float mutation = 1.0F;
+ public float lifespan = 1.0F;
+ public float production = 1.0F;
+ public float flowering = 1.0F;
+ public float geneticDecay = 1.0F;
+ public boolean isSealed = false;
+ public boolean isSelfLighted = false;
+ public boolean isSunlightSimulated = false;
+ public boolean isAutomated = false;
+ public boolean isCollectingPollen = false;
+ public BiomeGenBase biomeOverride = null;
+ public float energy = 1.0F;
+ public float temperature = 0.0F;
+ public float humidity = 0.0F;
+ public int maxSpeed = 0;
+}
diff --git a/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java b/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java
index 4cbd014cbc..a7e61c6e16 100644
--- a/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java
+++ b/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java
@@ -1,28 +1,135 @@
package gregtech.api.util;
-import cpw.mods.fml.common.Loader;
import gregtech.api.enums.OrePrefixes;
import gregtech.common.items.GT_MetaGenerated_Item_03;
import java.util.*;
import java.util.function.Consumer;
-import net.bdew.gendustry.api.ApiaryModifiers;
-import net.bdew.gendustry.api.items.IApiaryUpgrade;
import net.minecraft.item.ItemStack;
+import net.minecraft.world.biome.BiomeGenBase;
public enum GT_ApiaryUpgrade {
- speed1(UNIQUE_INDEX.SPEED_UPGRADE, 32200, 1, 1),
- speed2(UNIQUE_INDEX.SPEED_UPGRADE, 32201, 1, 2),
- speed3(UNIQUE_INDEX.SPEED_UPGRADE, 32202, 1, 3),
- speed4(UNIQUE_INDEX.SPEED_UPGRADE, 32203, 1, 4),
- speed5(UNIQUE_INDEX.SPEED_UPGRADE, 32204, 1, 5),
- speed6(UNIQUE_INDEX.SPEED_UPGRADE, 32205, 1, 6),
- speed7(UNIQUE_INDEX.SPEED_UPGRADE, 32206, 1, 7),
- speed8(UNIQUE_INDEX.SPEED_UPGRADE, 32207, 1, 8),
- speed8upgraded(UNIQUE_INDEX.SPEED_UPGRADE, 32208, 1, 8),
+ speed1(UNIQUE_INDEX.SPEED_UPGRADE, 32200, 1, (mods) -> mods.maxSpeed = 1),
+ speed2(UNIQUE_INDEX.SPEED_UPGRADE, 32201, 1, (mods) -> mods.maxSpeed = 2),
+ speed3(UNIQUE_INDEX.SPEED_UPGRADE, 32202, 1, (mods) -> mods.maxSpeed = 3),
+ speed4(UNIQUE_INDEX.SPEED_UPGRADE, 32203, 1, (mods) -> mods.maxSpeed = 4),
+ speed5(UNIQUE_INDEX.SPEED_UPGRADE, 32204, 1, (mods) -> mods.maxSpeed = 5),
+ speed6(UNIQUE_INDEX.SPEED_UPGRADE, 32205, 1, (mods) -> mods.maxSpeed = 6),
+ speed7(UNIQUE_INDEX.SPEED_UPGRADE, 32206, 1, (mods) -> mods.maxSpeed = 7),
+ speed8(UNIQUE_INDEX.SPEED_UPGRADE, 32207, 1, (mods) -> mods.maxSpeed = 8),
+ speed8upgraded(UNIQUE_INDEX.SPEED_UPGRADE, 32208, 1, (mods) -> {
+ mods.maxSpeed = 8;
+ mods.production = 2f;
+ mods.energy *= 14.75;
+ }),
+ production(UNIQUE_INDEX.PRODUCTION_UPGRADE, 32209, 8, (mods) -> {
+ mods.production += 0.25f;
+ mods.energy *= 1.4f;
+ }),
+ plains(UNIQUE_INDEX.PLAINS_UPGRADE, 32210, 1, (mods) -> {
+ mods.biomeOverride = BiomeGenBase.plains;
+ mods.energy *= 1.2f;
+ }),
+ light(UNIQUE_INDEX.LIGHT_UPGRADE, 32211, 1, (mods) -> {
+ mods.isSelfLighted = true;
+ mods.energy *= 1.05f;
+ }),
+ flowering(UNIQUE_INDEX.FLOWERING_UPGRADE, 32212, 8, (mods) -> {
+ mods.flowering *= 1.2f;
+ mods.energy *= 1.1f;
+ }),
+ winter(UNIQUE_INDEX.WINTER_UPGRADE, 32213, 1, (mods) -> {
+ mods.biomeOverride = BiomeGenBase.taiga;
+ mods.energy *= 1.5f;
+ }),
+ dryer(UNIQUE_INDEX.DRYER_UPGRADE, 32214, 8, (mods) -> {
+ mods.humidity -= 0.25f;
+ mods.energy *= 1.05f;
+ }),
+ automation(UNIQUE_INDEX.AUTOMATION_UPGRADE, 32215, 1, (mods) -> {
+ mods.isAutomated = true;
+ mods.energy *= 1.1f;
+ }),
+ humidifier(UNIQUE_INDEX.HUMIDIFIER_UPGRADE, 32216, 8, (mods) -> {
+ mods.humidity += 0.25f;
+ mods.energy *= 1.1f;
+ }),
+ hell(UNIQUE_INDEX.HELL_UPGRADE, 32217, 1, (mods) -> {
+ mods.biomeOverride = BiomeGenBase.hell;
+ mods.energy *= 1.5f;
+ }),
+ pollen(UNIQUE_INDEX.POLLEN_UPGRADE, 32218, 1, (mods) -> {
+ mods.flowering = 0f;
+ mods.energy *= 1.3f;
+ }),
+ desert(UNIQUE_INDEX.DESERT_UPGRADE, 32219, 1, (mods) -> {
+ mods.biomeOverride = BiomeGenBase.desert;
+ mods.energy *= 1.2f;
+ }),
+ cooler(UNIQUE_INDEX.COOLER_UPGRADE, 32220, 8, (mods) -> {
+ mods.temperature -= 0.25f;
+ mods.energy *= 1.05f;
+ }),
+ lifespan(UNIQUE_INDEX.LIFESPAN_UPGRADE, 32221, 4, (mods) -> {
+ mods.lifespan /= 1.5f;
+ mods.energy *= 1.05f;
+ }),
+ seal(UNIQUE_INDEX.SEAL_UPGRADE, 32222, 1, (mods) -> {
+ mods.isSealed = true;
+ mods.energy *= 1.05f;
+ }),
+ stabilizer(UNIQUE_INDEX.STABILIZER_UPGRADE, 32223, 1, (mods) -> {
+ mods.geneticDecay = 0f;
+ mods.energy *= 2.50f;
+ }),
+ jungle(UNIQUE_INDEX.JUNGLE_UPGRADE, 32224, 1, (mods) -> {
+ mods.biomeOverride = BiomeGenBase.jungle;
+ mods.energy *= 1.20f;
+ }),
+ territory(UNIQUE_INDEX.TERRITORY_UPGRADE, 32225, 4, (mods) -> {
+ mods.territory *= 1.5f;
+ mods.energy *= 1.05f;
+ }),
+ ocean(UNIQUE_INDEX.OCEAN_UPGRADE, 32226, 1, (mods) -> {
+ mods.biomeOverride = BiomeGenBase.ocean;
+ mods.energy *= 1.20f;
+ }),
+ sky(UNIQUE_INDEX.SKY_UPGRADE, 32227, 1, (mods) -> {
+ mods.isSunlightSimulated = true;
+ mods.energy *= 1.05f;
+ }),
+ heater(UNIQUE_INDEX.HEATER_UPGRADE, 32228, 8, (mods) -> {
+ mods.temperature += 0.25f;
+ mods.energy *= 1.05f;
+ }),
+ sieve(UNIQUE_INDEX.SIEVE_UPGRADE, 32229, 1, (mods) -> {
+ mods.isCollectingPollen = true;
+ mods.energy *= 1.05f;
+ }),
;
private enum UNIQUE_INDEX {
SPEED_UPGRADE,
+ PRODUCTION_UPGRADE,
+ PLAINS_UPGRADE,
+ LIGHT_UPGRADE,
+ FLOWERING_UPGRADE,
+ WINTER_UPGRADE,
+ DRYER_UPGRADE,
+ AUTOMATION_UPGRADE,
+ HUMIDIFIER_UPGRADE,
+ HELL_UPGRADE,
+ POLLEN_UPGRADE,
+ DESERT_UPGRADE,
+ COOLER_UPGRADE,
+ LIFESPAN_UPGRADE,
+ SEAL_UPGRADE,
+ STABILIZER_UPGRADE,
+ JUNGLE_UPGRADE,
+ TERRITORY_UPGRADE,
+ OCEAN_UPGRADE,
+ SKY_UPGRADE,
+ HEATER_UPGRADE,
+ SIEVE_UPGRADE,
;
void apply(Consumer<GT_ApiaryUpgrade> fn) {
@@ -35,20 +142,18 @@ public enum GT_ApiaryUpgrade {
private int meta = 0;
private int maxnumber = 1;
- private int maxspeedmodifier = 0; // formula: maxspeed = modifier
private final GT_Utility.ItemId id;
private final UNIQUE_INDEX unique_index;
+ private final Consumer<GT_ApiaryModifier> applier;
- private final HashMap<GT_Utility.ItemId, ItemStack> additionalGendustryUpgrades = new HashMap<>();
- private final HashSet<GT_Utility.ItemId> blacklistedUpgrades =
- new HashSet<>(); // additionalGendustryUpgrades are blacklisted by default
+ private final HashSet<GT_Utility.ItemId> blacklistedUpgrades = new HashSet<>();
- GT_ApiaryUpgrade(UNIQUE_INDEX unique_index, int meta, int maxnumber, int maxspeedmodifier) {
+ GT_ApiaryUpgrade(UNIQUE_INDEX unique_index, int meta, int maxnumber, Consumer<GT_ApiaryModifier> applier) {
this.unique_index = unique_index;
this.meta = meta;
this.maxnumber = maxnumber;
- this.maxspeedmodifier = maxspeedmodifier;
+ this.applier = applier;
this.id = GT_Utility.ItemId.createNoCopy(get(1));
}
@@ -75,15 +180,15 @@ public enum GT_ApiaryUpgrade {
public boolean isAllowedToWorkWith(ItemStack s) {
GT_Utility.ItemId id = GT_Utility.ItemId.createNoCopy(s);
- return !additionalGendustryUpgrades.containsKey(id) && !blacklistedUpgrades.contains(id);
+ return !blacklistedUpgrades.contains(id);
}
public int getMaxNumber() {
return maxnumber;
}
- public void applyModifiers(ApiaryModifiers mods, ItemStack s) {
- additionalGendustryUpgrades.forEach((k, u) -> ((IApiaryUpgrade) u.getItem()).applyModifiers(mods, u));
+ public void applyModifiers(GT_ApiaryModifier mods) {
+ if (applier != null) applier.accept(mods);
}
public ItemStack get(int count) {
@@ -94,19 +199,11 @@ public enum GT_ApiaryUpgrade {
return OrePrefixes.apiaryUpgrade.contains(s);
}
- public int applyMaxSpeedModifier(int maxspeed) {
- return Math.max(maxspeed, maxspeedmodifier);
- }
-
private static final HashMap<Integer, GT_ApiaryUpgrade> quickLookup = new HashMap<>();
static {
EnumSet.allOf(GT_ApiaryUpgrade.class).forEach(GT_ApiaryUpgrade::setup_static_variables);
-
- if (Loader.isModLoaded("gendustry")) {
- ItemStack s = GT_ModHandler.getModItem("gendustry", "ApiaryUpgrade", 8L, 0);
- GT_Utility.ItemId a = GT_Utility.ItemId.createNoCopy(s);
- speed8upgraded.additionalGendustryUpgrades.put(a, s);
- }
+ speed8upgraded.blacklistedUpgrades.add(production.id);
+ production.blacklistedUpgrades.add(speed8upgraded.id);
}
}