aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbasdxz <tudurap.com@gmail.com>2020-11-04 09:07:01 +0000
committerbasdxz <tudurap.com@gmail.com>2020-11-04 09:07:01 +0000
commitcd67397e44d5301c030bf6f6545c055dbb66c375 (patch)
treefe389776a7406286d3f5d2ec016024afa092bda4
parentf14ea1f84ab07a7fd32fa520ca4fc1e18a1333d5 (diff)
parent5de583bf34003095ff286aa132aa0e005020cab7 (diff)
downloadGT5-Unofficial-cd67397e44d5301c030bf6f6545c055dbb66c375.tar.gz
GT5-Unofficial-cd67397e44d5301c030bf6f6545c055dbb66c375.tar.bz2
GT5-Unofficial-cd67397e44d5301c030bf6f6545c055dbb66c375.zip
Merge branch 'BassAddons'
-rw-r--r--build.gradle16
-rw-r--r--build.properties3
-rw-r--r--src/main/java/com/github/technus/tectech/TecTech.java2
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java39
-rw-r--r--src/main/java/com/github/technus/tectech/loader/TecTechConfig.java146
-rw-r--r--src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java22
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java28
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java15
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java29
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java146
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java8
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java22
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java6
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java2
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java4
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java8
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java50
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/structure/StructureIterationType.java8
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java654
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java4
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java6
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java4
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java123
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectableSimple.java22
-rw-r--r--src/main/java/com/github/technus/tectech/thing/CustomItemList.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java37
-rw-r--r--src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java75
-rw-r--r--src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java12
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java14
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java18
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java595
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java7
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TeslaCoil.java272
-rw-r--r--src/main/java/com/github/technus/tectech/util/Util.java1
-rw-r--r--src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_6.pngbin0 -> 814 bytes
-rw-r--r--src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_TOP_BOTTOM_6.pngbin0 -> 838 bytes
-rw-r--r--src/main/resources/assets/tectech/lang/en_US.lang3
-rw-r--r--src/main/resources/assets/tectech/textures/items/itemCapacitorLuV.pngbin0 -> 570 bytes
-rw-r--r--src/main/resources/assets/tectech/textures/items/itemCapacitorZPM.pngbin0 -> 563 bytes
40 files changed, 1361 insertions, 1046 deletions
diff --git a/build.gradle b/build.gradle
index 9689a82607..ca8da27742 100644
--- a/build.gradle
+++ b/build.gradle
@@ -97,10 +97,14 @@ repositories {
name "Tterrag maven"
url "https://maven.tterrag.com/"
}
- ivy { //CoFHCore
- name 'gtnh_download_source'
- artifactPattern "http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]-[revision].[ext]"
+ maven {
+ name = "Curse Maven"
+ url = "https://www.cursemaven.com"
}
+ //ivy { //CoFHCore
+ // name 'gtnh_download_source'
+ // artifactPattern "http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]-[revision].[ext]"
+ //}
}
dependencies {
@@ -126,8 +130,12 @@ dependencies {
compile "micdoodle8.mods:Galacticraft-Planets:${config.galacticraft.version}:Dev"
compile "micdoodle8.mods:Galacticraft:${config.galacticraft.version}:API"
compile "com.mod-buildcraft:buildcraft:${config.buildcraft.version}:dev"
+
+ //TODO Re-work the formatting and add documentation
+ runtime "curse.maven:cofh-core:${config.cofh_core_version}"
//Ivy
- compile name: 'CoFHCore', version: config.cofhcore.version, ext: 'jar'
+ //compile name: 'CoFHCore', version: config.cofhcore.version, ext: 'jar'
+
}
task getGregTech(type: Download) {
diff --git a/build.properties b/build.properties
index be76171615..d0ee72aeac 100644
--- a/build.properties
+++ b/build.properties
@@ -8,7 +8,8 @@ codechickencore.version=1.0.7.47
nei.version=1.0.5.120
gregtech.jenkinsbuild=648
gregtech.version=5.09.33.52
-cofhcore.version=[1.7.10]3.1.4-329-dev
+#cofhcore.version=[1.7.10]3.1.4-329-dev
+cofh_core_version=2388751
yamcore.version=0.5.79
baubles.version=1.0.1.10
thaumcraft.version=4.2.3.5
diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java
index 47a3b576b1..809a7e877d 100644
--- a/src/main/java/com/github/technus/tectech/TecTech.java
+++ b/src/main/java/com/github/technus/tectech/TecTech.java
@@ -78,7 +78,7 @@ public class TecTech {
LOGGER.error(Reference.MODID + " could not load its config file. Things are going to be weird!");
}
- if (configTecTech.modAdminErrorLogs) {
+ if (configTecTech.MOD_ADMIN_ERROR_LOGS) {
LOGGER.setDebugOutput(DEBUG_MODE);
LOGGER.debug("moduleAdminErrorLogs is enabled");
moduleAdminErrorLogs = new IngameErrorLog();
diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java
index 7ab4a8fab5..df5c11e67b 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java
@@ -224,7 +224,12 @@ public class DreamCraftRecipeLoader implements Runnable {
GT_Values.RA.addAssemblerRecipe(new ItemStack[]{
GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorLuV, 8),
getItemContainer("MicaInsulatorFoil").get(28)
- }, Materials.Indium.getMolten(144), CustomItemList.tM_TeslaPrimary_5.get(1), 50, 30720);
+ }, Materials.Indium.getMolten(144), CustomItemList.tM_TeslaPrimary_5.get(1), 200, 30720);
+ //Tesla Primary Coils T6
+ GT_Values.RA.addAssemblerRecipe(new ItemStack[]{
+ GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorZPM, 8),
+ getItemContainer("MicaInsulatorFoil").get(32)
+ }, Materials.Naquadah.getMolten(144), CustomItemList.tM_TeslaPrimary_6.get(1), 200, 122880);
//endregion
@@ -928,8 +933,6 @@ public class DreamCraftRecipeLoader implements Runnable {
48000, 64, 200000, 8, new Object[]{
GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.CosmicNeutronium, 1L),
GT_OreDictUnificator.get(OrePrefixes.plate, Materials.CosmicNeutronium, 6L),
- ItemList.Gravistar.get(4L),
- ItemList.Emitter_UHV.get(4L),
new Object[]{OrePrefixes.circuit.get(Materials.Bio), 4L},
GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Neutronium, 64L),
GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Neutronium, 64L),
@@ -949,9 +952,7 @@ public class DreamCraftRecipeLoader implements Runnable {
96000, 128, 400000, 16, new Object[]{
GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Infinity, 1L),
GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Infinity, 6L),
- ItemList.Gravistar.get(8L),
- ItemList.Emitter_UEV.get(4L),
- new Object[]{OrePrefixes.circuit.get(Materials.Nano), 4},
+ new Object[]{OrePrefixes.circuit.get(Materials.Bio), 8L},
GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Tritanium, 64L),
GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Tritanium, 64L),
GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Tritanium, 64L),
@@ -1083,7 +1084,7 @@ public class DreamCraftRecipeLoader implements Runnable {
GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 64),
GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Polybenzimidazole, 64)
}, new FluidStack[]{
- Materials.SolderingAlloy.getMolten(3744L),
+ Materials.SolderingAlloy.getMolten(3760L),
Materials.Naquadria.getMolten(4032L),
new FluidStack(FluidRegistry.getFluid("ic2coolant"), 20000)
}, getItemContainer("NanoCircuit").get(1L), 8000, 8000000);
@@ -1104,7 +1105,7 @@ public class DreamCraftRecipeLoader implements Runnable {
GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Neutronium, 16),
GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Lanthanum, 64)
}, new FluidStack[]{
- Materials.SolderingAlloy.getMolten(4032L),
+ Materials.SolderingAlloy.getMolten(3760L),
Materials.UUMatter.getFluid(8000L),
Materials.Osmium.getMolten(1152L)
}, getItemContainer("PikoCircuit").get(1L), 10000, 8000000);
@@ -1123,7 +1124,7 @@ public class DreamCraftRecipeLoader implements Runnable {
GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Bedrockium, 8),
GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Lanthanum, 64)
}, new FluidStack[]{
- Materials.SolderingAlloy.getMolten(4608L),
+ Materials.SolderingAlloy.getMolten(3760L),
Materials.UUMatter.getFluid(24000L),
Materials.Osmium.getMolten(2304L)
}, getItemContainer("QuantumCircuit").get(1L), 20000, 32000000);
@@ -1623,6 +1624,20 @@ public class DreamCraftRecipeLoader implements Runnable {
GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 24),
GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 24),
}, Materials.Epoxid.getMolten(360), CustomItemList.teslaCapacitor.getWithDamage(1, 4), 320, 7680);
+ //LuV Tesla Capacitor
+ GT_Values.RA.addAssemblerRecipe(new ItemStack[]{
+ GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.HSSG, 4),
+ GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 14),
+ GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 28),
+ GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 28),
+ }, Materials.Epoxid.getMolten(432), CustomItemList.teslaCapacitor.getWithDamage(1, 5), 320, 30720);
+ //ZPM Tesla Capacitor
+ GT_Values.RA.addAssemblerRecipe(new ItemStack[]{
+ GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.Naquadah, 4),
+ GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 16),
+ GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 32),
+ GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 32),
+ }, Materials.Epoxid.getMolten(504), CustomItemList.teslaCapacitor.getWithDamage(1, 6), 320, 122880);
//Tesla Cover
GT_Values.RA.addAssemblerRecipe(new ItemStack[]{
CustomItemList.teslaComponent.getWithDamage(4, 0),
@@ -1687,6 +1702,12 @@ public class DreamCraftRecipeLoader implements Runnable {
//IV Tesla Capacitor
GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 4),
GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 12), 300, 2);
+ //LuV Tesla Capacitor
+ GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 5),
+ GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 14), 300, 2);
+ //ZPM Tesla Capacitor
+ GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 6),
+ GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 16), 300, 2);
//endregion
diff --git a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java
index 0c2920e585..66e549ddb1 100644
--- a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java
+++ b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java
@@ -9,87 +9,132 @@ public class TecTechConfig extends ConfigManager {
super(pConfigBaseDirectory, pModCollectionDirectory, pModID);
}
- public boolean modAdminErrorLogs;
-
//final static to allow compiler to remove the debug code when this is false
public static boolean DEBUG_MODE = false;
+ public boolean DISABLE_MATERIAL_LOADING_FFS;
+
public boolean BOOM_ENABLE;
+ public boolean DISABLE_BLOCK_HARDNESS_NERF;
public boolean EASY_SCAN;
public boolean NERF_FUSION;
public boolean ENABLE_TURRET_EXPLOSIONS;
- public boolean DISABLE_MATERIAL_LOADING_FFS;
- public boolean DISABLE_BLOCK_HARDNESS_NERF;
public float TURRET_DAMAGE_FACTOR;
public float TURRET_EXPLOSION_FACTOR;
- public float TESLA_MULTI_MIN_EFFICIENCY;
- public float TESLA_MULTI_MAX_EFFICIENCY;
- public float TESLA_MULTI_OVERDRIVE_LOSS;
- public float TESLA_SINGLE_MIN_EFFICIENCY;
- public float TESLA_SINGLE_MAX_EFFICIENCY;
- public float TESLA_SINGLE_OVERDRIVE_LOSS;
+ public boolean MOD_ADMIN_ERROR_LOGS;
+ public boolean TESLA_MULTI_GAS_OUTPUT;
+ public float TESLA_MULTI_LOSS_FACTOR_OVERDRIVE;
+ public int TESLA_MULTI_LOSS_PER_BLOCK_T0;
+ public int TESLA_MULTI_LOSS_PER_BLOCK_T1;
+ public int TESLA_MULTI_LOSS_PER_BLOCK_T2;
+ public int TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM;
+ public int TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN;
+ public int TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON;
+ public int TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1;
+ public int TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2;
+ public int TESLA_MULTI_RANGE_COVER;
+ public int TESLA_MULTI_RANGE_TOWER;
+ public int TESLA_MULTI_RANGE_TRANSCEIVER;
+ public float TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE;
+ public int TESLA_SINGLE_LOSS_PER_BLOCK;
+ public int TESLA_SINGLE_RANGE;
/**
* This loading phases do not correspond to mod loading phases!
*/
@Override
protected void PreInit() {
- modAdminErrorLogs = false;
- EASY_SCAN = false;
+ DISABLE_MATERIAL_LOADING_FFS = false;
+
BOOM_ENABLE = true;
- NERF_FUSION = false;
DISABLE_BLOCK_HARDNESS_NERF = false;
+ EASY_SCAN = false;
+ NERF_FUSION = false;
ENABLE_TURRET_EXPLOSIONS = true;
- DISABLE_MATERIAL_LOADING_FFS = false;
TURRET_DAMAGE_FACTOR = 10;
TURRET_EXPLOSION_FACTOR = 1;
- TESLA_MULTI_MIN_EFFICIENCY = 0.955F;
- TESLA_MULTI_MAX_EFFICIENCY = 0.98F;
- TESLA_MULTI_OVERDRIVE_LOSS = 0.005F;
- TESLA_SINGLE_MIN_EFFICIENCY = 0.91F;
- TESLA_SINGLE_MAX_EFFICIENCY = 0.95F;
- TESLA_SINGLE_OVERDRIVE_LOSS = 0.010F;
- }
+ MOD_ADMIN_ERROR_LOGS = false;
+
+ TESLA_MULTI_GAS_OUTPUT = false;
+ TESLA_MULTI_LOSS_FACTOR_OVERDRIVE = 0.25F;
+ TESLA_MULTI_LOSS_PER_BLOCK_T0 = 1;
+ TESLA_MULTI_LOSS_PER_BLOCK_T1 = 1;
+ TESLA_MULTI_LOSS_PER_BLOCK_T2 = 1;
+ TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM = 100;
+ TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN = 50;
+ TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON = 50;
+ TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1 = 2;
+ TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2 = 4;
+ TESLA_MULTI_RANGE_COVER = 16;
+ TESLA_MULTI_RANGE_TOWER = 32;
+ TESLA_MULTI_RANGE_TRANSCEIVER = 16;
+ TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE = 0.25F;
+ TESLA_SINGLE_LOSS_PER_BLOCK = 1;
+ TESLA_SINGLE_RANGE = 20;
+ }
/**
* This loading phases do not correspond to mod loading phases!
*/
@Override
protected void Init() {
- modAdminErrorLogs = _mainConfig.getBoolean("AdminErrorLog", "Modules", modAdminErrorLogs,
- "If set to true, every op/admin will receive all errors occurred during the startup phase as in game message on join");
- DEBUG_MODE = _mainConfig.getBoolean("DebugMode", "Debug", DEBUG_MODE,
+ DEBUG_MODE = _mainConfig.getBoolean("DebugMode", "debug", DEBUG_MODE,
"Enables logging and other purely debug features");
- EASY_SCAN = _mainConfig.getBoolean("EasyScan", "Features", EASY_SCAN,
- "Enables tricorder to scan EM i/o hatches directly, too CHEEKY");
- BOOM_ENABLE = _mainConfig.getBoolean("BoomEnable", "Features", BOOM_ENABLE,
+ DISABLE_MATERIAL_LOADING_FFS = _mainConfig.getBoolean("DisableMaterialLoading", "debug",
+ DISABLE_MATERIAL_LOADING_FFS, "Set to true to disable gregtech material processing");
+
+ BOOM_ENABLE = _mainConfig.getBoolean("BoomEnable", "features", BOOM_ENABLE,
"Set to false to disable explosions on everything bad that you can do");
- NERF_FUSION = _mainConfig.getBoolean("NerfFusion", "Features", NERF_FUSION,
+ DISABLE_BLOCK_HARDNESS_NERF = _mainConfig.getBoolean("DisableBlockHardnessNerf", "features",
+ DISABLE_BLOCK_HARDNESS_NERF, "Set to true to disable the block hardness nerf");
+ EASY_SCAN = _mainConfig.getBoolean("EasyScan", "features", EASY_SCAN,
+ "Enables tricorder to scan EM i/o hatches directly, too CHEEKY");
+ NERF_FUSION = _mainConfig.getBoolean("NerfFusion", "features", NERF_FUSION,
"Set to true to enable removal of plasmas heavier than Fe and other weird ones");
- ENABLE_TURRET_EXPLOSIONS = _mainConfig.getBoolean("TurretBoomEnable", "Features", ENABLE_TURRET_EXPLOSIONS,
- "Set to false to disable explosions caused by EM turrets");
- TURRET_DAMAGE_FACTOR = _mainConfig.getFloat("TurretDamageFactor", "Features", TURRET_DAMAGE_FACTOR, 0, Short.MAX_VALUE,
- "Damage is multiplied by this number");
- TURRET_EXPLOSION_FACTOR = _mainConfig.getFloat("TurretExplosionFactor", "Features", TURRET_EXPLOSION_FACTOR, 0, Short.MAX_VALUE,
- "Explosion strength is multiplied by this number");
- DISABLE_BLOCK_HARDNESS_NERF = _mainConfig.getBoolean("DisableBlockHardnessNerf", "Features", DISABLE_BLOCK_HARDNESS_NERF,
- "Set to true to disable the block hardness nerf");
- DISABLE_MATERIAL_LOADING_FFS = _mainConfig.getBoolean("DisableMaterialLoading", "Debug", DISABLE_MATERIAL_LOADING_FFS,
- "Set to true to disable gregtech material processing");
- TESLA_MULTI_MIN_EFFICIENCY = _mainConfig.getFloat("teslaMultiMinEfficency", "Features", TESLA_MULTI_MIN_EFFICIENCY, 0, 1,
- "Worst possible power loss per block for the multi block tesla");
- TESLA_MULTI_MAX_EFFICIENCY = _mainConfig.getFloat("teslaMultiMaxEfficency", "Features", TESLA_MULTI_MAX_EFFICIENCY, 0, 1,
- "Best possible power loss per block for the multi block tesla");
- TESLA_MULTI_OVERDRIVE_LOSS = _mainConfig.getFloat("teslaMultiOverdriveLoss", "Features", TESLA_MULTI_OVERDRIVE_LOSS, 0, 1,
- "Additional losses for overdrive use on the multi block tesla");
- TESLA_SINGLE_MIN_EFFICIENCY = _mainConfig.getFloat("teslaSingleMinEfficency", "Features", TESLA_SINGLE_MIN_EFFICIENCY, 0, 1,
- "Worst possible power loss per block for the single block tesla");
- TESLA_SINGLE_MAX_EFFICIENCY = _mainConfig.getFloat("teslaSingleMaxEfficency", "Features", TESLA_SINGLE_MAX_EFFICIENCY, 0, 1,
- "Best possible power loss per block for the single block tesla");
- TESLA_SINGLE_OVERDRIVE_LOSS = _mainConfig.getFloat("teslaSingleOverdriveLoss", "Features", TESLA_SINGLE_OVERDRIVE_LOSS, 0, 1,
- "Additional losses for overdrive use on the single block tesla");
+ ENABLE_TURRET_EXPLOSIONS = _mainConfig.getBoolean("TurretBoomEnable", "features",
+ ENABLE_TURRET_EXPLOSIONS, "Set to false to disable explosions caused by EM turrets");
+ TURRET_DAMAGE_FACTOR = _mainConfig.getFloat("TurretDamageFactor", "features", TURRET_DAMAGE_FACTOR,
+ 0, Short.MAX_VALUE, "Damage is multiplied by this number");
+ TURRET_EXPLOSION_FACTOR = _mainConfig.getFloat("TurretExplosionFactor", "features",
+ TURRET_EXPLOSION_FACTOR, 0, Short.MAX_VALUE, "Explosion strength is multiplied by this number");
+
+ MOD_ADMIN_ERROR_LOGS = _mainConfig.getBoolean("AdminErrorLog", "modules", MOD_ADMIN_ERROR_LOGS,
+ "If set to true, every op/admin will receive all errors occurred during the startup phase as in game message on join");
+
+ TESLA_MULTI_GAS_OUTPUT = _mainConfig.getBoolean("TeslaMultiGasOutput", "tesla_tweaks",
+ TESLA_MULTI_GAS_OUTPUT, "Set to true to enable outputting plasmas as gasses from the tesla tower with a 1:1 ratio");
+ TESLA_MULTI_LOSS_FACTOR_OVERDRIVE = _mainConfig.getFloat("TeslaMultiLossFactorOverdrive", "tesla_tweaks",
+ TESLA_MULTI_LOSS_FACTOR_OVERDRIVE, 0, 1, "Additional Tesla Tower power loss per amp as a factor of the tier voltage");
+ TESLA_MULTI_LOSS_PER_BLOCK_T0 = _mainConfig.getInt("TeslaMultiLossPerBlockT0", "tesla_tweaks",
+ TESLA_MULTI_LOSS_PER_BLOCK_T0, 0, Integer.MAX_VALUE, "Tesla Tower power transmission loss per block per amp using no plasmas");
+ TESLA_MULTI_LOSS_PER_BLOCK_T1 = _mainConfig.getInt("TeslaMultiLossPerBlockT1", "tesla_tweaks",
+ TESLA_MULTI_LOSS_PER_BLOCK_T1, 0, Integer.MAX_VALUE, "Tesla Tower power transmission loss per block per amp using helium or nitrogen plasma");
+ TESLA_MULTI_LOSS_PER_BLOCK_T2 = _mainConfig.getInt("TeslaMultiLossPerBlockT2", "tesla_tweaks",
+ TESLA_MULTI_LOSS_PER_BLOCK_T2, 0, Integer.MAX_VALUE, "Tesla Tower power transmission loss per block per amp using radon plasma");
+ TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM = _mainConfig.getInt("TeslaMultiPlasmaPerSecondT1Helium",
+ "tesla_tweaks", TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM, 0, Integer.MAX_VALUE, "Tesla Tower helium plasma consumed each second the tesla tower is active");
+ TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN = _mainConfig.getInt("TeslaMultiPlasmaPerSecondT1Nitrogen",
+ "tesla_tweaks", TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN, 0, Integer.MAX_VALUE, "Tesla Tower nitrogen plasma consumed each second the tesla tower is active");
+ TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON = _mainConfig.getInt("TeslaMultiPlasmaPerSecondT2Radon",
+ "tesla_tweaks", TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON, 0, Integer.MAX_VALUE, "Tesla Tower radon plasma consumed each second the tesla tower is active");
+ TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1 = _mainConfig.getInt("TeslaMultiRangeCoefficientPlasmaT1",
+ "tesla_tweaks", TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1, 0, Integer.MAX_VALUE, "Tesla Tower T1 Plasmas Range Multiplier");
+ TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2 = _mainConfig.getInt("TeslaMultiRangeCoefficientPlasmaT2",
+ "tesla_tweaks", TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2, 0, Integer.MAX_VALUE, "Tesla Tower T2 Plasmas Range Multiplier");
+ TESLA_MULTI_RANGE_COVER = _mainConfig.getInt("TeslaMultiRangeCover", "tesla_tweaks",
+ TESLA_MULTI_RANGE_COVER, 0, Integer.MAX_VALUE, "Tesla Tower to Tesla Coil Rich Edition Cover max range");
+ TESLA_MULTI_RANGE_TOWER = _mainConfig.getInt("TeslaMultiRangeTower", "tesla_tweaks",
+ TESLA_MULTI_RANGE_TOWER, 0, Integer.MAX_VALUE, "Tesla Tower to Tower max range");
+ TESLA_MULTI_RANGE_TRANSCEIVER = _mainConfig.getInt("TeslaMultiRangeTransceiver", "tesla_tweaks",
+ TESLA_MULTI_RANGE_TRANSCEIVER, 0, Integer.MAX_VALUE, "Tesla Tower to Transceiver max range");
+ TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE = _mainConfig.getFloat("TeslaSingleLossFactorOverdrive", "tesla_tweaks",
+ TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE, 0, 1, "Additional Tesla Transceiver power loss per amp as a factor of the tier voltage");
+ TESLA_SINGLE_LOSS_PER_BLOCK = _mainConfig.getInt("TeslaSingleLossPerBlock", "tesla_tweaks",
+ TESLA_SINGLE_LOSS_PER_BLOCK, 0, Integer.MAX_VALUE, "Tesla Transceiver power transmission loss per block per amp");
+ TESLA_SINGLE_RANGE = _mainConfig.getInt("TeslaSingleRange", "tesla_tweaks",
+ TESLA_SINGLE_RANGE, 0, Integer.MAX_VALUE, "Tesla Transceiver to max range");
}
/**
@@ -97,6 +142,5 @@ public class TecTechConfig extends ConfigManager {
*/
@Override
protected void PostInit() {
-
}
}
diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java
index 70f64d3719..7b8cc14f4d 100644
--- a/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java
+++ b/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java
@@ -191,6 +191,7 @@ public class BloodyRecipeLoader implements Runnable {
GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE,
new Object[]{"WWW", "WwW", "WWW",
'W', OrePrefixes.wireGt02.get(Materials.Superconductor)});
+ //TODO Add Tesla Primary Coils T6
//endregion
@@ -1157,6 +1158,21 @@ public class BloodyRecipeLoader implements Runnable {
GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 24),
GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 24),
}, Materials.Epoxid.getMolten(360), CustomItemList.teslaCapacitor.getWithDamage(1, 4), 320, 7680);
+ //LuV Tesla Capacitor
+ GT_Values.RA.addAssemblerRecipe(new ItemStack[]{
+ GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.HSSG, 4),
+ GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 14),
+ GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 28),
+ GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 28),
+ }, Materials.Epoxid.getMolten(432), CustomItemList.teslaCapacitor.getWithDamage(1, 5), 320, 30720);
+ //ZPM Tesla Capacitor
+ //GT_Values.RA.addAssemblerRecipe(new ItemStack[]{
+ // GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.Naquadah, 4),
+ // GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 16),
+ // GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 32),
+ // GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 32),
+ //}, Materials.Epoxid.getMolten(504), CustomItemList.teslaCapacitor.getWithDamage(1, 6), 320, 122880);
+ //TODO Allow with the coils, useless alone and will only cause trouble
//Tesla Cover
GT_Values.RA.addAssemblerRecipe(new ItemStack[]{
CustomItemList.teslaComponent.getWithDamage(4, 0),
@@ -1221,6 +1237,12 @@ public class BloodyRecipeLoader implements Runnable {
//IV Tesla Capacitor
GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 4),
GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 12), 300, 2);
+ //LuV Tesla Capacitor
+ GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 5),
+ GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 14), 300, 2);
+ //ZPM Tesla Capacitor
+ GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 6),
+ GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 16), 300, 2);
//endregion
diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java
index 2a93bcc540..5949b432df 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java
@@ -128,6 +128,7 @@ public enum ExtendedFacing {
private static final Map<String, ExtendedFacing> NAME_LOOKUP = stream(VALUES).collect(toMap(ExtendedFacing::getName2, (extendedFacing) -> extendedFacing));
private final ForgeDirection direction;
+ private final ForgeDirection a,b,c;
private final Rotation rotation;
private final Flip flip;
@@ -206,6 +207,9 @@ public enum ExtendedFacing {
default:
throw new RuntimeException("More impossible...");
}
+ this.a=a;
+ this.b=b;
+ this.c=c;
integerAxisSwap =new IntegerAxisSwap(a,b,c);
}
@@ -327,4 +331,28 @@ public enum ExtendedFacing {
public IntegerAxisSwap getIntegerAxisSwap() {
return integerAxisSwap;
}
+
+ public ForgeDirection getRelativeLeftInWorld() {
+ return a;
+ }
+
+ public ForgeDirection getRelativeRightInWorld() {
+ return a.getOpposite();
+ }
+
+ public ForgeDirection getRelativeDownInWorld() {
+ return b;
+ }
+
+ public ForgeDirection getRelativeUpInWorld() {
+ return b.getOpposite();
+ }
+
+ public ForgeDirection getRelativeBackInWorld() {
+ return c;
+ }
+
+ public ForgeDirection getRelativeForwardInWorld() {
+ return c.getOpposite();
+ }
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java b/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java
index f2fd17817d..58caed7951 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java
@@ -5,6 +5,7 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import eu.usrv.yamcore.network.client.AbstractClientMessageHandler;
import io.netty.buffer.ByteBuf;
+import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
@@ -71,12 +72,14 @@ public class RendererMessage implements IMessage {
private static void thaumLightning(int tX, int tY, int tZ, int tXN, int tYN, int tZN, int wID) {
//This is enough to check for thaum, since it only ever matters for client side effects (Tested not to crash)
if (Loader.isModLoaded("Thaumcraft")) {
- World world = DimensionManager.getWorld(wID);
- FXLightningBolt bolt = new FXLightningBolt(world, tX + 0.5F, tY + 0.5F, tZ + 0.5F, tX + tXN + 0.5F, tY + tYN + 0.5F, tZ + tZN + 0.5F, world.rand.nextLong(), 6, 0.5F, 8);
- bolt.defaultFractal();
- bolt.setType(2);
- bolt.setWidth(0.125F);
- bolt.finalizeBolt();
+ World world = Minecraft.getMinecraft().theWorld;
+ if (world.provider.dimensionId == wID){
+ FXLightningBolt bolt = new FXLightningBolt(world, tX + 0.5F, tY + 0.5F, tZ + 0.5F, tX + tXN + 0.5F, tY + tYN + 0.5F, tZ + tZN + 0.5F, world.rand.nextLong(), 6, 0.5F, 8);
+ bolt.defaultFractal();
+ bolt.setType(2);
+ bolt.setWidth(0.125F);
+ bolt.finalizeBolt();
+ }
}
}
} \ No newline at end of file
diff --git a/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java b/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java
index 604624828c..e31e63f250 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java
@@ -1,5 +1,7 @@
package com.github.technus.tectech.mechanics.spark;
+import com.github.technus.tectech.util.Vec3Impl;
+
import java.io.Serializable;
import java.util.Objects;
@@ -9,22 +11,10 @@ public class ThaumSpark implements Serializable {
public int x, y, z, wID;
public byte xR, yR, zR;
- public ThaumSpark(){
- this.x = 0;
- this.z = 0;
- this.y = 0;
-
- this.xR = 0;
- this.yR = 0;
- this.zR = 0;
-
- this.wID = 0;
- }
-
public ThaumSpark(int x, int y, int z, byte xR, byte yR, byte zR, int wID) {
this.x = x;
- this.z = z;
this.y = y;
+ this.z = z;
this.xR = xR;
this.yR = yR;
@@ -33,6 +23,19 @@ public class ThaumSpark implements Serializable {
this.wID = wID;
}
+ public ThaumSpark(Vec3Impl origin, Vec3Impl target, int wID) {
+ this.x = origin.get0();
+ this.y = origin.get1();
+ this.z = origin.get2();
+
+ Vec3Impl offset = target.sub(origin);
+ this.xR = (byte) offset.get0();
+ this.yR = (byte) offset.get1();
+ this.zR = (byte) offset.get2();
+
+ this.wID = wID;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java
index ca9712df04..c8488d5cea 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java
@@ -1,47 +1,167 @@
package com.github.technus.tectech.mechanics.structure;
+import com.github.technus.tectech.TecTech;
import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
-import static com.github.technus.tectech.mechanics.structure.StructureIterationType.*;
-import static com.github.technus.tectech.mechanics.structure.StructureUtility.iterate;
+import java.util.Arrays;
-public interface IStructureDefinition<MultiBlock> {
+import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
+
+public interface IStructureDefinition<T> {
/**
* Used internally
* @param name same name as for other methods here
* @return the array of elements to process
*/
- IStructureElement<MultiBlock>[] getStructureFor(String name);
+ IStructureElement<T>[] getStructureFor(String name);
- default boolean check(MultiBlock object, String piece, World world, ExtendedFacing extendedFacing,
+ default boolean check(T object,String piece, World world, ExtendedFacing extendedFacing,
int basePositionX, int basePositionY, int basePositionZ,
int basePositionA, int basePositionB, int basePositionC,
boolean forceCheckAllBlocks){
return iterate(object, null, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ,
- basePositionA, basePositionB, basePositionC,forceCheckAllBlocks? CHECK_FULLY:CHECK);
+ basePositionA, basePositionB, basePositionC,false,forceCheckAllBlocks);
}
- default boolean hints(MultiBlock object, ItemStack trigger, String piece, World world, ExtendedFacing extendedFacing,
+ default boolean hints(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing,
int basePositionX, int basePositionY, int basePositionZ,
int basePositionA, int basePositionB, int basePositionC) {
return iterate(object, trigger, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ,
- basePositionA, basePositionB, basePositionC,SPAWN_HINTS);
+ basePositionA, basePositionB, basePositionC,true,null);
}
- default boolean build(MultiBlock object, ItemStack trigger, String piece, World world, ExtendedFacing extendedFacing,
+ default boolean build(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing,
int basePositionX, int basePositionY, int basePositionZ,
int basePositionA, int basePositionB, int basePositionC) {
return iterate(object, trigger, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ,
- basePositionA, basePositionB, basePositionC,BUILD_TEMPLATE);
+ basePositionA, basePositionB, basePositionC,false,null);
}
- default boolean buildOrHints(MultiBlock object, ItemStack trigger, String piece, World world, ExtendedFacing extendedFacing,
+ default boolean buildOrHints(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing,
int basePositionX, int basePositionY, int basePositionZ,
int basePositionA, int basePositionB, int basePositionC,
- boolean hints){
+ boolean hintsOnly){
return iterate(object, trigger, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ,
- basePositionA, basePositionB, basePositionC,hints?SPAWN_HINTS:BUILD_TEMPLATE);
+ basePositionA, basePositionB, basePositionC,hintsOnly,null);
+ }
+
+ static <T> boolean iterate(T object, ItemStack trigger, IStructureElement<T>[] elements, World world, ExtendedFacing extendedFacing,
+ int basePositionX, int basePositionY, int basePositionZ,
+ int basePositionA, int basePositionB, int basePositionC,
+ boolean hintsOnly, Boolean checkBlocksIfNotNullForceCheckAllIfTrue){
+ if(world.isRemote ^ hintsOnly){
+ return false;
+ }
+
+ //change base position to base offset
+ basePositionA=-basePositionA;
+ basePositionB=-basePositionB;
+ basePositionC=-basePositionC;
+
+ int[] abc = new int[]{basePositionA,basePositionB,basePositionC};
+ int[] xyz = new int[3];
+
+ if(checkBlocksIfNotNullForceCheckAllIfTrue!=null){
+ if(checkBlocksIfNotNullForceCheckAllIfTrue){
+ for (IStructureElement<T> element : elements) {
+ if(element.isNavigating()) {
+ abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA();
+ abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB();
+ abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC();
+ }else {
+ extendedFacing.getWorldOffset(abc, xyz);
+ xyz[0] += basePositionX;
+ xyz[1] += basePositionY;
+ xyz[2] += basePositionZ;
+
+ if (world.blockExists(xyz[0], xyz[1], xyz[2])) {
+ if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){
+ if(DEBUG_MODE){
+ TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] failed @ "+
+ Arrays.toString(xyz)+" "+Arrays.toString(abc));
+ }
+ return false;
+ }
+ } else {
+ if(DEBUG_MODE){
+ TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] !blockExists @ "+
+ Arrays.toString(xyz)+" "+Arrays.toString(abc));
+ }
+ return false;
+ }
+ abc[0]+=1;
+ }
+ }
+ } else {
+ for (IStructureElement<T> element : elements) {
+ if(element.isNavigating()) {
+ abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA();
+ abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB();
+ abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC();
+ }else {
+ extendedFacing.getWorldOffset(abc, xyz);
+ xyz[0] += basePositionX;
+ xyz[1] += basePositionY;
+ xyz[2] += basePositionZ;
+
+ if (world.blockExists(xyz[0], xyz[1], xyz[2])) {
+ if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){
+ if(DEBUG_MODE){
+ TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] failed @ "+
+ Arrays.toString(xyz)+" "+Arrays.toString(abc));
+ }
+ return false;
+ }
+ } else {
+ if(DEBUG_MODE){
+ TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] !blockExists @ "+
+ Arrays.toString(xyz)+" "+Arrays.toString(abc));
+ }
+ }
+ abc[0]+=1;
+ }
+ }
+ }
+ }else {
+ if(hintsOnly) {
+ for (IStructureElement<T> element : elements) {
+ if(element.isNavigating()) {
+ abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA();
+ abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB();
+ abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC();
+ }else {
+ extendedFacing.getWorldOffset(abc, xyz);
+ xyz[0] += basePositionX;
+ xyz[1] += basePositionY;
+ xyz[2] += basePositionZ;
+
+ element.spawnHint(object, world, xyz[0], xyz[1], xyz[2], trigger);
+
+ abc[0]+=1;
+ }
+ }
+ } else {
+ for (IStructureElement<T> element : elements) {
+ if(element.isNavigating()) {
+ abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA();
+ abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB();
+ abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC();
+ }else {
+ extendedFacing.getWorldOffset(abc, xyz);
+ xyz[0] += basePositionX;
+ xyz[1] += basePositionY;
+ xyz[2] += basePositionZ;
+
+ if (world.blockExists(xyz[0], xyz[1], xyz[2])) {
+ element.placeBlock(object, world, xyz[0], xyz[1], xyz[2], trigger);
+ }
+ abc[0]+=1;
+ }
+ }
+ }
+ }
+ return true;
}
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java
index 436c7ce203..f946e71f91 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java
@@ -6,12 +6,12 @@ import net.minecraft.world.World;
/**
* Use StructureUtility to instantiate
*/
-public interface IStructureElement<MultiBlock> {
- boolean check(MultiBlock multiBlock, World world, int x, int y, int z);
+public interface IStructureElement<T> {
+ boolean check(T t,World world,int x,int y,int z);
- boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger);
+ boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger);
- boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger);
+ boolean placeBlock(T t,World world,int x,int y,int z, ItemStack trigger);
default int getStepA(){
return 1;
diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java
index 4c7059dd81..f9593ee1c5 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java
@@ -6,13 +6,13 @@ import net.minecraft.world.World;
/**
* Use StructureUtility to instantiate
*/
-public interface IStructureElementChain<MultiBlock> extends IStructureElement<MultiBlock> {
- IStructureElement<MultiBlock>[] fallbacks();
+public interface IStructureElementChain<T> extends IStructureElement<T> {
+ IStructureElement<T>[] fallbacks();
@Override
- default boolean check(MultiBlock multiBlock, World world, int x, int y, int z){
- for (IStructureElement<MultiBlock> fallback : fallbacks()) {
- if (fallback.check(multiBlock, world, x, y, z)) {
+ default boolean check(T t, World world, int x, int y, int z){
+ for (IStructureElement<T> fallback : fallbacks()) {
+ if (fallback.check(t, world, x, y, z)) {
return true;
}
}
@@ -20,9 +20,9 @@ public interface IStructureElementChain<MultiBlock> extends IStructureElement<Mu
}
@Override
- default boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- for (IStructureElement<MultiBlock> fallback : fallbacks()) {
- if (fallback.spawnHint(multiBlock, world, x, y, z, trigger)) {
+ default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ for (IStructureElement<T> fallback : fallbacks()) {
+ if (fallback.spawnHint(t, world, x, y, z, trigger)) {
return true;
}
}
@@ -30,9 +30,9 @@ public interface IStructureElementChain<MultiBlock> extends IStructureElement<Mu
}
@Override
- default boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- for (IStructureElement<MultiBlock> fallback : fallbacks()) {
- if (fallback.placeBlock(multiBlock, world, x, y, z, trigger)) {
+ default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ for (IStructureElement<T> fallback : fallbacks()) {
+ if (fallback.placeBlock(t, world, x, y, z, trigger)) {
return true;
}
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java
index c6492a5ed6..ec15aea53b 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java
@@ -3,14 +3,14 @@ package com.github.technus.tectech.mechanics.structure;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
-public interface IStructureElementCheckOnly<MultiBlock> extends IStructureElement<MultiBlock> {
+public interface IStructureElementCheckOnly<T> extends IStructureElement<T> {
@Override
- default boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger){
+ default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger){
return false;
}
@Override
- default boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger){
+ default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger){
return false;
}
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java
index c0e39bb2ad..dbb74312a8 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java
@@ -3,5 +3,5 @@ package com.github.technus.tectech.mechanics.structure;
/**
* Use StructureUtility to instantiate
*/
-public interface IStructureElementDeferred<MultiBlock> extends IStructureElement<MultiBlock> {
+public interface IStructureElementDeferred<T> extends IStructureElement<T> {
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java
index 12cf2141ae..47e6060878 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java
@@ -3,9 +3,9 @@ package com.github.technus.tectech.mechanics.structure;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
-public interface IStructureElementNoPlacement<MultiBlock> extends IStructureElement<MultiBlock> {
+public interface IStructureElementNoPlacement<T> extends IStructureElement<T> {
@Override
- default boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger){
+ default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger){
return false;
}
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java
index 8c7c837a94..d3f4134cea 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java
@@ -6,19 +6,19 @@ import net.minecraft.world.World;
/**
* Use StructureUtility to instantiate
*/
-interface IStructureNavigate<MultiBlock> extends IStructureElement<MultiBlock> {
+interface IStructureNavigate<T> extends IStructureElement<T> {
@Override
- default boolean check(MultiBlock multiBlock, World world, int x, int y, int z){
+ default boolean check(T t, World world, int x, int y, int z){
return true;
}
@Override
- default boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
return true;
}
@Override
- default boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
return true;
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java
index f42cbd35d1..9a1e94d98a 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java
@@ -7,31 +7,31 @@ import java.util.*;
import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
import static com.github.technus.tectech.mechanics.structure.StructureUtility.*;
-public class StructureDefinition<MultiBlock> implements IStructureDefinition<MultiBlock> {
- private final Map<Character, IStructureElement<MultiBlock>> elements;
+public class StructureDefinition<T> implements IStructureDefinition<T> {
+ private final Map<Character, IStructureElement<T>> elements;
private final Map<String, String> shapes;
- private final Map<String, IStructureElement<MultiBlock>[]> structures;
+ private final Map<String, IStructureElement<T>[]> structures;
- public static <MultiBlock> Builder<MultiBlock> builder() {
+ public static <B> Builder<B> builder() {
return new Builder<>();
}
private StructureDefinition(
- Map<Character, IStructureElement<MultiBlock>> elements,
+ Map<Character, IStructureElement<T>> elements,
Map<String, String> shapes,
- Map<String, IStructureElement<MultiBlock>[]> structures) {
+ Map<String, IStructureElement<T>[]> structures) {
this.elements =elements;
this.shapes=shapes;
this.structures = structures;
}
- public static class Builder<MultiBlock> {
+ public static class Builder<T> {
private static final char A='\uA000';
private static final char B='\uB000';
private static final char C='\uC000';
private char d ='\uD000';
private final Map<Vec3Impl,Character> navigates;
- private final Map<Character, IStructureElement<MultiBlock>> elements;
+ private final Map<Character, IStructureElement<T>> elements;
private final Map<String, String> shapes;
private Builder() {
@@ -40,7 +40,7 @@ public class StructureDefinition<MultiBlock> implements IStructureDefinition<Mul
shapes = new HashMap<>();
}
- public Map<Character, IStructureElement<MultiBlock>> getElements() {
+ public Map<Character, IStructureElement<T>> getElements() {
return elements;
}
@@ -57,7 +57,7 @@ public class StructureDefinition<MultiBlock> implements IStructureDefinition<Mul
* @return
*/
@Deprecated
- public Builder<MultiBlock> addShapeOldApi(String name, String[][] structurePiece) {
+ public Builder<T> addShapeOldApi(String name, String[][] structurePiece) {
StringBuilder builder = new StringBuilder();
if (structurePiece.length > 0) {
for (String[] strings : structurePiece) {
@@ -142,7 +142,7 @@ public class StructureDefinition<MultiBlock> implements IStructureDefinition<Mul
* @param structurePiece generated or written struct - DO NOT STORE IT ANYWHERE, or at least set them to null afterwards
* @return this builder
*/
- public Builder<MultiBlock> addShape(String name, String[][] structurePiece) {
+ public Builder<T> addShape(String name, String[][] structurePiece) {
StringBuilder builder = new StringBuilder();
if (structurePiece.length > 0) {
for (String[] strings : structurePiece) {
@@ -199,13 +199,13 @@ public class StructureDefinition<MultiBlock> implements IStructureDefinition<Mul
return this;
}
- public Builder<MultiBlock> addElement(Character name, IStructureElement<MultiBlock> structurePiece) {
+ public Builder<T> addElement(Character name, IStructureElement<T> structurePiece) {
elements.putIfAbsent(name, structurePiece);
return this;
}
- public IStructureDefinition<MultiBlock> build() {
- Map<String, IStructureElement<MultiBlock>[]> structures = compileStructureMap();
+ public IStructureDefinition<T> build() {
+ Map<String, IStructureElement<T>[]> structures = compileStructureMap();
if(DEBUG_MODE){
return new StructureDefinition<>(new HashMap<>(elements), new HashMap<>(shapes), structures);
}else {
@@ -214,22 +214,22 @@ public class StructureDefinition<MultiBlock> implements IStructureDefinition<Mul
}
@SuppressWarnings("unchecked")
- private Map<String, IStructureElement<MultiBlock>[]> compileElementSetMap() {
+ private Map<String, IStructureElement<T>[]> compileElementSetMap() {
Set<Integer> missing = new HashSet<>();
shapes.values().stream().map(CharSequence::chars).forEach(intStream -> intStream.forEach(c -> {
- IStructureElement<MultiBlock> iStructureElement = elements.get((char) c);
+ IStructureElement<T> iStructureElement = elements.get((char) c);
if (iStructureElement == null) {
missing.add(c);
}
}));
if (missing.isEmpty()) {
- Map<String, IStructureElement<MultiBlock>[]> map = new HashMap<>();
+ Map<String, IStructureElement<T>[]> map = new HashMap<>();
shapes.forEach((key, value) -> {
Set<Character> chars=new HashSet<>();
for (char c : value.toCharArray()) {
chars.add(c);
}
- IStructureElement<MultiBlock>[] compiled = new IStructureElement[chars.size()];
+ IStructureElement<T>[] compiled = new IStructureElement[chars.size()];
int i=0;
for (Character aChar : chars) {
compiled[i++]=elements.get(aChar);
@@ -244,18 +244,18 @@ public class StructureDefinition<MultiBlock> implements IStructureDefinition<Mul
}
@SuppressWarnings("unchecked")
- private Map<String, IStructureElement<MultiBlock>[]> compileStructureMap() {
+ private Map<String, IStructureElement<T>[]> compileStructureMap() {
Set<Integer> mising = new HashSet<>();
shapes.values().stream().map(CharSequence::chars).forEach(intStream -> intStream.forEach(c -> {
- IStructureElement<MultiBlock> iStructureElement = elements.get((char) c);
+ IStructureElement<T> iStructureElement = elements.get((char) c);
if (iStructureElement == null) {
mising.add(c);
}
}));
if (mising.isEmpty()) {
- Map<String, IStructureElement<MultiBlock>[]> map = new HashMap<>();
+ Map<String, IStructureElement<T>[]> map = new HashMap<>();
shapes.forEach((key, value) -> {
- IStructureElement<MultiBlock>[] compiled = new IStructureElement[value.length()];
+ IStructureElement<T>[] compiled = new IStructureElement[value.length()];
for (int i = 0; i < value.length(); i++) {
compiled[i] = elements.get(value.charAt(i));
}
@@ -269,7 +269,7 @@ public class StructureDefinition<MultiBlock> implements IStructureDefinition<Mul
}
}
- public Map<Character, IStructureElement<MultiBlock>> getElements(){
+ public Map<Character, IStructureElement<T>> getElements(){
return elements;
}
@@ -277,12 +277,12 @@ public class StructureDefinition<MultiBlock> implements IStructureDefinition<Mul
return shapes;
}
- public Map<String, IStructureElement<MultiBlock>[]> getStructures() {
+ public Map<String, IStructureElement<T>[]> getStructures() {
return structures;
}
@Override
- public IStructureElement<MultiBlock>[] getStructureFor(String name) {
+ public IStructureElement<T>[] getStructureFor(String name) {
return structures.get(name);
}
} \ No newline at end of file
diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureIterationType.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureIterationType.java
deleted file mode 100644
index 618c07f970..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureIterationType.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.github.technus.tectech.mechanics.structure;
-
-public enum StructureIterationType {
- SPAWN_HINTS, //only spawn hint particles
- BUILD_TEMPLATE, //only builds template
- CHECK, //checks the structure skipping all unloaded chunks (for machines that were validated already)
- CHECK_FULLY, //checks the structure failing on unloaded chunks (for machines that are not valid currently)
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java
index 14930952c5..521b0e7645 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java
@@ -22,8 +22,6 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
-import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
-import static com.github.technus.tectech.mechanics.structure.StructureIterationType.SPAWN_HINTS;
import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT;
import static java.lang.Integer.MIN_VALUE;
@@ -39,18 +37,18 @@ public class StructureUtility {
@SuppressWarnings("rawtypes")
private static final IStructureElement AIR = new IStructureElement() {
@Override
- public boolean check(Object multiBlock, World world, int x, int y, int z) {
+ public boolean check(Object t, World world, int x, int y, int z) {
return world.getBlock(x, y, z).getMaterial() == Material.air;
}
@Override
- public boolean spawnHint(Object multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 13);
return true;
}
@Override
- public boolean placeBlock(Object multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) {
world.setBlock(x, y, z, Blocks.air, 0, 2);
return false;
}
@@ -58,18 +56,18 @@ public class StructureUtility {
@SuppressWarnings("rawtypes")
private static final IStructureElement NOT_AIR = new IStructureElement() {
@Override
- public boolean check(Object multiBlock, World world, int x, int y, int z) {
+ public boolean check(Object t, World world, int x, int y, int z) {
return world.getBlock(x, y, z).getMaterial() != Material.air;
}
@Override
- public boolean spawnHint(Object multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 14);
return true;
}
@Override
- public boolean placeBlock(Object multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) {
world.setBlock(x, y, z, sHintCasingsTT, 14, 2);
return true;
}
@@ -77,18 +75,18 @@ public class StructureUtility {
@SuppressWarnings("rawtypes")
private static final IStructureElement ERROR = new IStructureElement() {
@Override
- public boolean check(Object multiBlock, World world, int x, int y, int z) {
+ public boolean check(Object t, World world, int x, int y, int z) {
return false;
}
@Override
- public boolean spawnHint(Object multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 15);
return true;
}
@Override
- public boolean placeBlock(Object multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) {
return true;
}
};
@@ -98,12 +96,12 @@ public class StructureUtility {
}
@SuppressWarnings("unchecked")
- public static <MultiBlock> IStructureElement<MultiBlock> isAir() {
+ public static <T> IStructureElement<T> isAir() {
return AIR;
}
@SuppressWarnings("unchecked")
- public static <MultiBlock> IStructureElement<MultiBlock> notAir() {
+ public static <T> IStructureElement<T> notAir() {
return NOT_AIR;
}
@@ -112,11 +110,11 @@ public class StructureUtility {
* Placement is always handled by this and does nothing.
* Makes little to no use it in fallback chain.
*
- * @param <MultiBlock>
+ * @param <T>
* @return
*/
@SuppressWarnings("unchecked")
- public static <MultiBlock> IStructureElement<MultiBlock> error() {
+ public static <T> IStructureElement<T> error() {
return ERROR;
}
@@ -126,19 +124,19 @@ public class StructureUtility {
* Check always returns: true.
*
* @param dots
- * @param <MultiBlock>
+ * @param <T>
* @return
*/
- public static <MultiBlock> IStructureElementNoPlacement<MultiBlock> ofHint(int dots) {
+ public static <T> IStructureElementNoPlacement<T> ofHint(int dots) {
int meta = dots - 1;
- return new IStructureElementNoPlacement<MultiBlock>() {
+ return new IStructureElementNoPlacement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
return true;
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, meta);
return false;
}
@@ -149,18 +147,18 @@ public class StructureUtility {
* Check always returns: true.
*
* @param icons
- * @param <MultiBlock>
+ * @param <T>
* @return
*/
- public static <MultiBlock> IStructureElementNoPlacement<MultiBlock> ofHintDeferred(Supplier<IIcon[]> icons) {
- return new IStructureElementNoPlacement<MultiBlock>() {
+ public static <T> IStructureElementNoPlacement<T> ofHintDeferred(Supplier<IIcon[]> icons) {
+ return new IStructureElementNoPlacement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
return true;
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, icons.get());
return false;
}
@@ -172,18 +170,18 @@ public class StructureUtility {
*
* @param icons
* @param RGBa
- * @param <MultiBlock>
+ * @param <T>
* @return
*/
- public static <MultiBlock> IStructureElementNoPlacement<MultiBlock> ofHintDeferred(Supplier<IIcon[]> icons, short[] RGBa) {
- return new IStructureElementNoPlacement<MultiBlock>() {
+ public static <T> IStructureElementNoPlacement<T> ofHintDeferred(Supplier<IIcon[]> icons, short[] RGBa) {
+ return new IStructureElementNoPlacement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
return true;
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle_tinted(world, x, y, z, icons.get(), RGBa);
return false;
}
@@ -197,19 +195,19 @@ public class StructureUtility {
/**
* Does not allow Block duplicates (with different meta)
*/
- public static <MultiBlock> IStructureElementNoPlacement<MultiBlock> ofBlocksFlatHint(Map<Block, Integer> blocsMap, Block hintBlock, int hintMeta) {
+ public static <T> IStructureElementNoPlacement<T> ofBlocksFlatHint(Map<Block, Integer> blocsMap, Block hintBlock, int hintMeta) {
if (blocsMap == null || blocsMap.isEmpty() || hintBlock == null) {
throw new IllegalArgumentException();
}
- return new IStructureElementNoPlacement<MultiBlock>() {
+ return new IStructureElementNoPlacement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
Block worldBlock = world.getBlock(x, y, z);
return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta);
return true;
}
@@ -219,66 +217,66 @@ public class StructureUtility {
/**
* Allows block duplicates (with different meta)
*/
- public static <MultiBlock> IStructureElementNoPlacement<MultiBlock> ofBlocksMapHint(Map<Block, Set<Integer>> blocsMap, Block hintBlock, int hintMeta) {
+ public static <T> IStructureElementNoPlacement<T> ofBlocksMapHint(Map<Block, Collection<Integer>> blocsMap, Block hintBlock, int hintMeta) {
if (blocsMap == null || blocsMap.isEmpty() || hintBlock == null) {
throw new IllegalArgumentException();
}
- for (Set<Integer> value : blocsMap.values()) {
+ for (Collection<Integer> value : blocsMap.values()) {
if (value.isEmpty()) {
throw new IllegalArgumentException();
}
}
- return new IStructureElementNoPlacement<MultiBlock>() {
+ return new IStructureElementNoPlacement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
Block worldBlock = world.getBlock(x, y, z);
return blocsMap.getOrDefault(worldBlock, Collections.emptySet()).contains(worldBlock.getDamageValue(world, x, y, z));
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta);
return true;
}
};
}
- public static <MultiBlock> IStructureElementNoPlacement<MultiBlock> ofBlockHint(Block block, int meta, Block hintBlock, int hintMeta) {
+ public static <T> IStructureElementNoPlacement<T> ofBlockHint(Block block, int meta, Block hintBlock, int hintMeta) {
if (block == null || hintBlock == null) {
throw new IllegalArgumentException();
}
- return new IStructureElementNoPlacement<MultiBlock>() {
+ return new IStructureElementNoPlacement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
Block worldBlock = world.getBlock(x, y, z);
return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta);
return true;
}
};
}
- public static <MultiBlock> IStructureElementNoPlacement<MultiBlock> ofBlockHint(Block block, int meta) {
+ public static <T> IStructureElementNoPlacement<T> ofBlockHint(Block block, int meta) {
return ofBlockHint(block, meta, block, meta);
}
- public static <MultiBlock> IStructureElementNoPlacement<MultiBlock> ofBlockAdderHint(IBlockAdder<MultiBlock> iBlockAdder, Block hintBlock, int hintMeta) {
+ public static <T> IStructureElementNoPlacement<T> ofBlockAdderHint(IBlockAdder<T> iBlockAdder, Block hintBlock, int hintMeta) {
if (iBlockAdder == null || hintBlock == null) {
throw new IllegalArgumentException();
}
- return new IStructureElementNoPlacement<MultiBlock>() {
+ return new IStructureElementNoPlacement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
Block worldBlock = world.getBlock(x, y, z);
- return iBlockAdder.apply(multiBlock, worldBlock, worldBlock.getDamageValue(world, x, y, z));
+ return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z));
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta);
return true;
}
@@ -288,46 +286,46 @@ public class StructureUtility {
/**
* Does not allow Block duplicates (with different meta)
*/
- public static <MultiBlock> IStructureElement<MultiBlock> ofBlocksFlat(Map<Block, Integer> blocsMap, Block defaultBlock, int defaultMeta) {
+ public static <T> IStructureElement<T> ofBlocksFlat(Map<Block, Integer> blocsMap, Block defaultBlock, int defaultMeta) {
if (blocsMap == null || blocsMap.isEmpty() || defaultBlock == null) {
throw new IllegalArgumentException();
}
if(defaultBlock instanceof ICustomBlockSetting){
- return new IStructureElement<MultiBlock>() {
+ return new IStructureElement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
Block worldBlock = world.getBlock(x, y, z);
return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z);
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta);
return true;
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta);
return true;
}
};
}else {
- return new IStructureElement<MultiBlock>() {
+ return new IStructureElement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
Block worldBlock = world.getBlock(x, y, z);
return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z);
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
return true;
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta);
return true;
}
@@ -338,51 +336,51 @@ public class StructureUtility {
/**
* Allows block duplicates (with different meta)
*/
- public static <MultiBlock> IStructureElement<MultiBlock> ofBlocksMap(Map<Block, Set<Integer>> blocsMap, Block defaultBlock, int defaultMeta) {
+ public static <T> IStructureElement<T> ofBlocksMap(Map<Block, Collection<Integer>> blocsMap, Block defaultBlock, int defaultMeta) {
if (blocsMap == null || blocsMap.isEmpty() || defaultBlock == null) {
throw new IllegalArgumentException();
}
- for (Set<Integer> value : blocsMap.values()) {
+ for (Collection<Integer> value : blocsMap.values()) {
if (value.isEmpty()) {
throw new IllegalArgumentException();
}
}
if(defaultBlock instanceof ICustomBlockSetting){
- return new IStructureElement<MultiBlock>() {
+ return new IStructureElement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
Block worldBlock = world.getBlock(x, y, z);
return blocsMap.getOrDefault(worldBlock, Collections.emptySet()).contains(worldBlock.getDamageValue(world, x, y, z));
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta);
return true;
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta);
return true;
}
};
}else {
- return new IStructureElement<MultiBlock>() {
+ return new IStructureElement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
Block worldBlock = world.getBlock(x, y, z);
return blocsMap.getOrDefault(worldBlock, Collections.emptySet()).contains(worldBlock.getDamageValue(world, x, y, z));
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
return true;
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta);
return true;
}
@@ -390,46 +388,46 @@ public class StructureUtility {
}
}
- public static <MultiBlock> IStructureElement<MultiBlock> ofBlock(Block block, int meta, Block defaultBlock, int defaultMeta) {
+ public static <T> IStructureElement<T> ofBlock(Block block, int meta, Block defaultBlock, int defaultMeta) {
if (block == null || defaultBlock == null) {
throw new IllegalArgumentException();
}
if(block instanceof ICustomBlockSetting){
- return new IStructureElement<MultiBlock>() {
+ return new IStructureElement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
Block worldBlock = world.getBlock(x, y, z);
return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z);
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta);
return true;
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta);
return true;
}
};
} else {
- return new IStructureElement<MultiBlock>() {
+ return new IStructureElement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
Block worldBlock = world.getBlock(x, y, z);
return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z);
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
return true;
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta);
return true;
}
@@ -440,44 +438,44 @@ public class StructureUtility {
/**
* Same as above but ignores target meta id
*/
- public static <MultiBlock> IStructureElement<MultiBlock> ofBlockAnyMeta(Block block, Block defaultBlock, int defaultMeta) {
+ public static <T> IStructureElement<T> ofBlockAnyMeta(Block block, Block defaultBlock, int defaultMeta) {
if (block == null || defaultBlock == null) {
throw new IllegalArgumentException();
}
if(block instanceof ICustomBlockSetting){
- return new IStructureElement<MultiBlock>() {
+ return new IStructureElement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
return block == world.getBlock(x, y, z);
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta);
return true;
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta);
return true;
}
};
} else {
- return new IStructureElement<MultiBlock>() {
+ return new IStructureElement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
return block == world.getBlock(x, y, z);
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
return true;
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta);
return true;
}
@@ -485,21 +483,21 @@ public class StructureUtility {
}
}
- public static <MultiBlock> IStructureElement<MultiBlock> ofBlock(Block block, int meta) {
+ public static <T> IStructureElement<T> ofBlock(Block block, int meta) {
return ofBlock(block, meta, block, meta);
}
/**
* Same as above but ignores target meta id
*/
- public static <MultiBlock> IStructureElement<MultiBlock> ofBlockAnyMeta(Block block) {
+ public static <T> IStructureElement<T> ofBlockAnyMeta(Block block) {
return ofBlockAnyMeta(block, block, 0);
}
/**
* Same as above but allows to set hint particle render
*/
- public static <MultiBlock> IStructureElement<MultiBlock> ofBlockAnyMeta(Block block,int defaultMeta) {
+ public static <T> IStructureElement<T> ofBlockAnyMeta(Block block,int defaultMeta) {
return ofBlockAnyMeta(block, block, defaultMeta);
}
@@ -507,46 +505,46 @@ public class StructureUtility {
//region adders
- public static <MultiBlock> IStructureElement<MultiBlock> ofBlockAdder(IBlockAdder<MultiBlock> iBlockAdder, Block defaultBlock, int defaultMeta) {
+ public static <T> IStructureElement<T> ofBlockAdder(IBlockAdder<T> iBlockAdder, Block defaultBlock, int defaultMeta) {
if (iBlockAdder == null || defaultBlock == null) {
throw new IllegalArgumentException();
}
if(defaultBlock instanceof ICustomBlockSetting){
- return new IStructureElement<MultiBlock>() {
+ return new IStructureElement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
Block worldBlock = world.getBlock(x, y, z);
- return iBlockAdder.apply(multiBlock, worldBlock, worldBlock.getDamageValue(world, x, y, z));
+ return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z));
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta);
return true;
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta);
return true;
}
};
}else {
- return new IStructureElement<MultiBlock>() {
+ return new IStructureElement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
Block worldBlock = world.getBlock(x, y, z);
- return iBlockAdder.apply(multiBlock, worldBlock, worldBlock.getDamageValue(world, x, y, z));
+ return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z));
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
return true;
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta);
return true;
}
@@ -554,102 +552,102 @@ public class StructureUtility {
}
}
- public static <MultiBlock> IStructureElement<MultiBlock> ofBlockAdder(IBlockAdder<MultiBlock> iBlockAdder, int dots) {
+ public static <T> IStructureElement<T> ofBlockAdder(IBlockAdder<T> iBlockAdder, int dots) {
return ofBlockAdder(iBlockAdder, sHintCasingsTT, dots - 1);
}
- public static <MultiBlock> IStructureElementNoPlacement<MultiBlock> ofTileAdder(ITileAdder<MultiBlock> iTileAdder, Block hintBlock, int hintMeta) {
+ public static <T> IStructureElementNoPlacement<T> ofTileAdder(ITileAdder<T> iTileAdder, Block hintBlock, int hintMeta) {
if (iTileAdder == null || hintBlock == null) {
throw new IllegalArgumentException();
}
- return new IStructureElementNoPlacement<MultiBlock>() {
+ return new IStructureElementNoPlacement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
- return tileEntity instanceof IGregTechTileEntity && iTileAdder.apply(multiBlock, tileEntity);
+ return tileEntity instanceof IGregTechTileEntity && iTileAdder.apply(t, tileEntity);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta);
return true;
}
};
}
- public static <MultiBlock> IStructureElementNoPlacement<MultiBlock> ofHatchAdder(IHatchAdder<MultiBlock> iHatchAdder, int textureIndex, int dots) {
+ public static <T> IStructureElementNoPlacement<T> ofHatchAdder(IHatchAdder<T> iHatchAdder, int textureIndex, int dots) {
return ofHatchAdder(iHatchAdder, textureIndex, sHintCasingsTT, dots - 1);
}
- public static <MultiBlock> IStructureElementNoPlacement<MultiBlock> ofHatchAdder(IHatchAdder<MultiBlock> iHatchAdder, int textureIndex, Block hintBlock, int hintMeta) {
+ public static <T> IStructureElementNoPlacement<T> ofHatchAdder(IHatchAdder<T> iHatchAdder, int textureIndex, Block hintBlock, int hintMeta) {
if (iHatchAdder == null || hintBlock == null) {
throw new IllegalArgumentException();
}
- return new IStructureElementNoPlacement<MultiBlock>() {
+ return new IStructureElementNoPlacement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
- return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(multiBlock, (IGregTechTileEntity) tileEntity, (short) textureIndex);
+ return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta);
return true;
}
};
}
- public static <MultiBlock> IStructureElement<MultiBlock> ofHatchAdderOptional(IHatchAdder<MultiBlock> iHatchAdder, int textureIndex, int dots, Block placeCasing, int placeCasingMeta) {
+ public static <T> IStructureElement<T> ofHatchAdderOptional(IHatchAdder<T> iHatchAdder, int textureIndex, int dots, Block placeCasing, int placeCasingMeta) {
return ofHatchAdderOptional(iHatchAdder, textureIndex, sHintCasingsTT, dots - 1, placeCasing, placeCasingMeta);
}
- public static <MultiBlock> IStructureElement<MultiBlock> ofHatchAdderOptional(IHatchAdder<MultiBlock> iHatchAdder, int textureIndex, Block hintBlock, int hintMeta, Block placeCasing, int placeCasingMeta) {
+ public static <T> IStructureElement<T> ofHatchAdderOptional(IHatchAdder<T> iHatchAdder, int textureIndex, Block hintBlock, int hintMeta, Block placeCasing, int placeCasingMeta) {
if (iHatchAdder == null || hintBlock == null) {
throw new IllegalArgumentException();
}
if(placeCasing instanceof ICustomBlockSetting){
- return new IStructureElement<MultiBlock>() {
+ return new IStructureElement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
Block worldBlock = world.getBlock(x, y, z);
return (tileEntity instanceof IGregTechTileEntity &&
- iHatchAdder.apply(multiBlock, (IGregTechTileEntity) tileEntity, (short) textureIndex)) ||
+ iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex)) ||
(worldBlock == placeCasing && worldBlock.getDamageValue(world, x, y, z) == placeCasingMeta);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta);
return true;
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
((ICustomBlockSetting) placeCasing).setBlock(world, x, y, z, placeCasingMeta);
return true;
}
};
}else {
- return new IStructureElement<MultiBlock>() {
+ return new IStructureElement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
+ public boolean check(T t, World world, int x, int y, int z) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
Block worldBlock = world.getBlock(x, y, z);
return (tileEntity instanceof IGregTechTileEntity &&
- iHatchAdder.apply(multiBlock, (IGregTechTileEntity) tileEntity, (short) textureIndex)) ||
+ iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex)) ||
(worldBlock == placeCasing && worldBlock.getDamageValue(world, x, y, z) == placeCasingMeta);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta);
return true;
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
world.setBlock(x, y, z, placeCasing, placeCasingMeta, 2);
return true;
}
@@ -661,48 +659,48 @@ public class StructureUtility {
//region side effects
- public static <MultiBlock> IStructureElement<MultiBlock> onElementPass(Consumer<MultiBlock> onCheckPass, IStructureElement<MultiBlock> element) {
- return new IStructureElement<MultiBlock>() {
+ public static <B extends IStructureElement<T>, T> IStructureElement<T> onElementPass(Consumer<T> onCheckPass, B element) {
+ return new IStructureElement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
- boolean check = element.check(multiBlock, world, x, y, z);
+ public boolean check(T t, World world, int x, int y, int z) {
+ boolean check = element.check(t, world, x, y, z);
if (check) {
- onCheckPass.accept(multiBlock);
+ onCheckPass.accept(t);
}
return check;
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return element.placeBlock(multiBlock, world, x, y, z, trigger);
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return element.placeBlock(t, world, x, y, z, trigger);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return element.spawnHint(multiBlock, world, x, y, z, trigger);
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return element.spawnHint(t, world, x, y, z, trigger);
}
};
}
- public static <MultiBlock> IStructureElement<MultiBlock> onElementFail(Consumer<MultiBlock> onFail, IStructureElement<MultiBlock> element) {
- return new IStructureElement<MultiBlock>() {
+ public static <B extends IStructureElement<T>, T> IStructureElement<T> onElementFail(Consumer<T> onFail, B element) {
+ return new IStructureElement<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
- boolean check = element.check(multiBlock, world, x, y, z);
+ public boolean check(T t, World world, int x, int y, int z) {
+ boolean check = element.check(t, world, x, y, z);
if (!check) {
- onFail.accept(multiBlock);
+ onFail.accept(t);
}
return check;
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return element.placeBlock(multiBlock, world, x, y, z, trigger);
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return element.placeBlock(t, world, x, y, z, trigger);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return element.spawnHint(multiBlock, world, x, y, z, trigger);
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return element.spawnHint(t, world, x, y, z, trigger);
}
};
}
@@ -714,15 +712,15 @@ public class StructureUtility {
* If none does it will finally return false.
*
* @param elementChain
- * @param <MultiBlock>
+ * @param <T>
* @return
*/
@SafeVarargs
- public static <MultiBlock> IStructureElementChain<MultiBlock> ofChain(IStructureElement<MultiBlock>... elementChain) {
+ public static <T> IStructureElementChain<T> ofChain(IStructureElement<T>... elementChain) {
if (elementChain == null || elementChain.length == 0) {
throw new IllegalArgumentException();
}
- for (IStructureElement<MultiBlock> iStructureElement : elementChain) {
+ for (IStructureElement<T> iStructureElement : elementChain) {
if (iStructureElement == null) {
throw new IllegalArgumentException();
}
@@ -735,317 +733,317 @@ public class StructureUtility {
* If none does it will finally return false.
*
* @param elementChain
- * @param <MultiBlock>
+ * @param <T>
* @return
*/
@SuppressWarnings("unchecked")
- public static <MultiBlock> IStructureElementChain<MultiBlock> ofChain(List<IStructureElement<MultiBlock>> elementChain) {
+ public static <T> IStructureElementChain<T> ofChain(List<IStructureElement<T>> elementChain) {
return ofChain(elementChain.toArray(new IStructureElement[0]));
}
//region defer
- public static <MultiBlock> IStructureElementDeferred<MultiBlock> defer(Supplier<IStructureElement<MultiBlock>> to) {
+ public static <T> IStructureElementDeferred<T> defer(Supplier<IStructureElement<T>> to) {
if (to == null) {
throw new IllegalArgumentException();
}
- return new IStructureElementDeferred<MultiBlock>() {
+ return new IStructureElementDeferred<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
- return to.get().check(multiBlock, world, x, y, z);
+ public boolean check(T t, World world, int x, int y, int z) {
+ return to.get().check(t, world, x, y, z);
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return to.get().placeBlock(multiBlock, world, x, y, z, trigger);
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return to.get().placeBlock(t, world, x, y, z, trigger);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return to.get().spawnHint(multiBlock, world, x, y, z, trigger);
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return to.get().spawnHint(t, world, x, y, z, trigger);
}
};
}
- public static <MultiBlock> IStructureElementDeferred<MultiBlock> defer(Function<MultiBlock, IStructureElement<MultiBlock>> to) {
+ public static <T> IStructureElementDeferred<T> defer(Function<T, IStructureElement<T>> to) {
if (to == null) {
throw new IllegalArgumentException();
}
- return new IStructureElementDeferred<MultiBlock>() {
+ return new IStructureElementDeferred<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
- return to.apply(multiBlock).check(multiBlock, world, x, y, z);
+ public boolean check(T t, World world, int x, int y, int z) {
+ return to.apply(t).check(t, world, x, y, z);
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return to.apply(multiBlock).placeBlock(multiBlock, world, x, y, z, trigger);
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return to.apply(t).placeBlock(t, world, x, y, z, trigger);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return to.apply(multiBlock).spawnHint(multiBlock, world, x, y, z, trigger);
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return to.apply(t).spawnHint(t, world, x, y, z, trigger);
}
};
}
- public static <MultiBlock, K> IStructureElementDeferred<MultiBlock> defer(Function<MultiBlock, K> keyExtractor, Map<K, IStructureElement<MultiBlock>> map) {
+ public static <T, K> IStructureElementDeferred<T> defer(Function<T, K> keyExtractor, Map<K, IStructureElement<T>> map) {
if (keyExtractor == null || map == null) {
throw new IllegalArgumentException();
}
- return new IStructureElementDeferred<MultiBlock>() {
+ return new IStructureElementDeferred<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
- return map.get(keyExtractor.apply(multiBlock)).check(multiBlock, world, x, y, z);
+ public boolean check(T t, World world, int x, int y, int z) {
+ return map.get(keyExtractor.apply(t)).check(t, world, x, y, z);
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return map.get(keyExtractor.apply(multiBlock)).placeBlock(multiBlock, world, x, y, z, trigger);
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return map.get(keyExtractor.apply(t)).placeBlock(t, world, x, y, z, trigger);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return map.get(keyExtractor.apply(multiBlock)).spawnHint(multiBlock, world, x, y, z, trigger);
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return map.get(keyExtractor.apply(t)).spawnHint(t, world, x, y, z, trigger);
}
};
}
- public static <MultiBlock, K> IStructureElementDeferred<MultiBlock> defer(Function<MultiBlock, K> keyExtractor, Map<K, IStructureElement<MultiBlock>> map, IStructureElement<MultiBlock> defaultElem) {
+ public static <T, K> IStructureElementDeferred<T> defer(Function<T, K> keyExtractor, Map<K, IStructureElement<T>> map, IStructureElement<T> defaultElem) {
if (keyExtractor == null || map == null) {
throw new IllegalArgumentException();
}
- return new IStructureElementDeferred<MultiBlock>() {
+ return new IStructureElementDeferred<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
- return map.getOrDefault(keyExtractor.apply(multiBlock), defaultElem).check(multiBlock, world, x, y, z);
+ public boolean check(T t, World world, int x, int y, int z) {
+ return map.getOrDefault(keyExtractor.apply(t), defaultElem).check(t, world, x, y, z);
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return map.getOrDefault(keyExtractor.apply(multiBlock), defaultElem).placeBlock(multiBlock, world, x, y, z, trigger);
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return map.getOrDefault(keyExtractor.apply(t), defaultElem).placeBlock(t, world, x, y, z, trigger);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return map.getOrDefault(keyExtractor.apply(multiBlock), defaultElem).spawnHint(multiBlock, world, x, y, z, trigger);
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return map.getOrDefault(keyExtractor.apply(t), defaultElem).spawnHint(t, world, x, y, z, trigger);
}
};
}
@SafeVarargs
- public static <MultiBlock> IStructureElementDeferred<MultiBlock> defer(Function<MultiBlock, Integer> keyExtractor, IStructureElement<MultiBlock>... array) {
+ public static <T> IStructureElementDeferred<T> defer(Function<T, Integer> keyExtractor, IStructureElement<T>... array) {
if (keyExtractor == null || array == null) {
throw new IllegalArgumentException();
}
- return new IStructureElementDeferred<MultiBlock>() {
+ return new IStructureElementDeferred<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
- return array[keyExtractor.apply(multiBlock)].check(multiBlock, world, x, y, z);
+ public boolean check(T t, World world, int x, int y, int z) {
+ return array[keyExtractor.apply(t)].check(t, world, x, y, z);
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return array[keyExtractor.apply(multiBlock)].placeBlock(multiBlock, world, x, y, z, trigger);
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return array[keyExtractor.apply(t)].placeBlock(t, world, x, y, z, trigger);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return array[keyExtractor.apply(multiBlock)].spawnHint(multiBlock, world, x, y, z, trigger);
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return array[keyExtractor.apply(t)].spawnHint(t, world, x, y, z, trigger);
}
};
}
@SuppressWarnings("unchecked")
- public static <MultiBlock> IStructureElementDeferred<MultiBlock> defer(Function<MultiBlock, Integer> keyExtractor, List<IStructureElement<MultiBlock>> array) {
+ public static <T> IStructureElementDeferred<T> defer(Function<T, Integer> keyExtractor, List<IStructureElement<T>> array) {
return defer(keyExtractor, array.toArray(new IStructureElement[0]));
}
- public static <MultiBlock> IStructureElementDeferred<MultiBlock> defer(BiFunction<MultiBlock, ItemStack, IStructureElement<MultiBlock>> to) {
+ public static <T> IStructureElementDeferred<T> defer(BiFunction<T, ItemStack, IStructureElement<T>> to) {
if (to == null) {
throw new IllegalArgumentException();
}
- return new IStructureElementDeferred<MultiBlock>() {
+ return new IStructureElementDeferred<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
- return to.apply(multiBlock, null).check(multiBlock, world, x, y, z);
+ public boolean check(T t, World world, int x, int y, int z) {
+ return to.apply(t, null).check(t, world, x, y, z);
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return to.apply(multiBlock, trigger).placeBlock(multiBlock, world, x, y, z, trigger);
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return to.apply(t, trigger).placeBlock(t, world, x, y, z, trigger);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return to.apply(multiBlock, trigger).spawnHint(multiBlock, world, x, y, z, trigger);
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return to.apply(t, trigger).spawnHint(t, world, x, y, z, trigger);
}
};
}
- public static <MultiBlock, K> IStructureElementDeferred<MultiBlock> defer(BiFunction<MultiBlock, ItemStack, K> keyExtractor, Map<K, IStructureElement<MultiBlock>> map) {
+ public static <T, K> IStructureElementDeferred<T> defer(BiFunction<T, ItemStack, K> keyExtractor, Map<K, IStructureElement<T>> map) {
if (keyExtractor == null || map == null) {
throw new IllegalArgumentException();
}
- return new IStructureElementDeferred<MultiBlock>() {
+ return new IStructureElementDeferred<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
- return map.get(keyExtractor.apply(multiBlock, null)).check(multiBlock, world, x, y, z);
+ public boolean check(T t, World world, int x, int y, int z) {
+ return map.get(keyExtractor.apply(t, null)).check(t, world, x, y, z);
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return map.get(keyExtractor.apply(multiBlock, trigger)).placeBlock(multiBlock, world, x, y, z, trigger);
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return map.get(keyExtractor.apply(t, trigger)).placeBlock(t, world, x, y, z, trigger);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return map.get(keyExtractor.apply(multiBlock, trigger)).spawnHint(multiBlock, world, x, y, z, trigger);
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return map.get(keyExtractor.apply(t, trigger)).spawnHint(t, world, x, y, z, trigger);
}
};
}
- public static <MultiBlock, K> IStructureElementDeferred<MultiBlock> defer(BiFunction<MultiBlock, ItemStack, K> keyExtractor, Map<K, IStructureElement<MultiBlock>> map, IStructureElement<MultiBlock> defaultElem) {
+ public static <T, K> IStructureElementDeferred<T> defer(BiFunction<T, ItemStack, K> keyExtractor, Map<K, IStructureElement<T>> map, IStructureElement<T> defaultElem) {
if (keyExtractor == null || map == null) {
throw new IllegalArgumentException();
}
- return new IStructureElementDeferred<MultiBlock>() {
+ return new IStructureElementDeferred<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
- return map.getOrDefault(keyExtractor.apply(multiBlock, null), defaultElem).check(multiBlock, world, x, y, z);
+ public boolean check(T t, World world, int x, int y, int z) {
+ return map.getOrDefault(keyExtractor.apply(t, null), defaultElem).check(t, world, x, y, z);
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return map.getOrDefault(keyExtractor.apply(multiBlock, trigger), defaultElem).placeBlock(multiBlock, world, x, y, z, trigger);
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).placeBlock(t, world, x, y, z, trigger);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return map.getOrDefault(keyExtractor.apply(multiBlock, trigger), defaultElem).spawnHint(multiBlock, world, x, y, z, trigger);
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).spawnHint(t, world, x, y, z, trigger);
}
};
}
@SafeVarargs
- public static <MultiBlock> IStructureElementDeferred<MultiBlock> defer(BiFunction<MultiBlock, ItemStack, Integer> keyExtractor, IStructureElement<MultiBlock>... array) {
+ public static <T> IStructureElementDeferred<T> defer(BiFunction<T, ItemStack, Integer> keyExtractor, IStructureElement<T>... array) {
if (keyExtractor == null || array == null) {
throw new IllegalArgumentException();
}
- return new IStructureElementDeferred<MultiBlock>() {
+ return new IStructureElementDeferred<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
- return array[keyExtractor.apply(multiBlock, null)].check(multiBlock, world, x, y, z);
+ public boolean check(T t, World world, int x, int y, int z) {
+ return array[keyExtractor.apply(t, null)].check(t, world, x, y, z);
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return array[keyExtractor.apply(multiBlock, trigger)].placeBlock(multiBlock, world, x, y, z, trigger);
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return array[keyExtractor.apply(t, trigger)].placeBlock(t, world, x, y, z, trigger);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return array[keyExtractor.apply(multiBlock, trigger)].spawnHint(multiBlock, world, x, y, z, trigger);
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return array[keyExtractor.apply(t, trigger)].spawnHint(t, world, x, y, z, trigger);
}
};
}
@SuppressWarnings("unchecked")
- public static <MultiBlock> IStructureElementDeferred<MultiBlock> defer(BiFunction<MultiBlock, ItemStack, Integer> keyExtractor, List<IStructureElement<MultiBlock>> array) {
+ public static <T> IStructureElementDeferred<T> defer(BiFunction<T, ItemStack, Integer> keyExtractor, List<IStructureElement<T>> array) {
return defer(keyExtractor, array.toArray(new IStructureElement[0]));
}
- public static <MultiBlock> IStructureElementDeferred<MultiBlock> defer(Function<MultiBlock, IStructureElement<MultiBlock>> toCheck, BiFunction<MultiBlock, ItemStack, IStructureElement<MultiBlock>> to) {
+ public static <T> IStructureElementDeferred<T> defer(Function<T, IStructureElement<T>> toCheck, BiFunction<T, ItemStack, IStructureElement<T>> to) {
if (to == null) {
throw new IllegalArgumentException();
}
- return new IStructureElementDeferred<MultiBlock>() {
+ return new IStructureElementDeferred<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
- return toCheck.apply(multiBlock).check(multiBlock, world, x, y, z);
+ public boolean check(T t, World world, int x, int y, int z) {
+ return toCheck.apply(t).check(t, world, x, y, z);
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return to.apply(multiBlock, trigger).placeBlock(multiBlock, world, x, y, z, trigger);
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return to.apply(t, trigger).placeBlock(t, world, x, y, z, trigger);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return to.apply(multiBlock, trigger).spawnHint(multiBlock, world, x, y, z, trigger);
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return to.apply(t, trigger).spawnHint(t, world, x, y, z, trigger);
}
};
}
- public static <MultiBlock, K> IStructureElementDeferred<MultiBlock> defer(Function<MultiBlock, K> keyExtractorCheck, BiFunction<MultiBlock, ItemStack, K> keyExtractor, Map<K, IStructureElement<MultiBlock>> map) {
+ public static <T, K> IStructureElementDeferred<T> defer(Function<T, K> keyExtractorCheck, BiFunction<T, ItemStack, K> keyExtractor, Map<K, IStructureElement<T>> map) {
if (keyExtractor == null || map == null) {
throw new IllegalArgumentException();
}
- return new IStructureElementDeferred<MultiBlock>() {
+ return new IStructureElementDeferred<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
- return map.get(keyExtractorCheck.apply(multiBlock)).check(multiBlock, world, x, y, z);
+ public boolean check(T t, World world, int x, int y, int z) {
+ return map.get(keyExtractorCheck.apply(t)).check(t, world, x, y, z);
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return map.get(keyExtractor.apply(multiBlock, trigger)).placeBlock(multiBlock, world, x, y, z, trigger);
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return map.get(keyExtractor.apply(t, trigger)).placeBlock(t, world, x, y, z, trigger);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return map.get(keyExtractor.apply(multiBlock, trigger)).spawnHint(multiBlock, world, x, y, z, trigger);
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return map.get(keyExtractor.apply(t, trigger)).spawnHint(t, world, x, y, z, trigger);
}
};
}
- public static <MultiBlock, K> IStructureElementDeferred<MultiBlock> defer(Function<MultiBlock, K> keyExtractorCheck, BiFunction<MultiBlock, ItemStack, K> keyExtractor, Map<K, IStructureElement<MultiBlock>> map, IStructureElement<MultiBlock> defaultElem) {
+ public static <T, K> IStructureElementDeferred<T> defer(Function<T, K> keyExtractorCheck, BiFunction<T, ItemStack, K> keyExtractor, Map<K, IStructureElement<T>> map, IStructureElement<T> defaultElem) {
if (keyExtractor == null || map == null) {
throw new IllegalArgumentException();
}
- return new IStructureElementDeferred<MultiBlock>() {
+ return new IStructureElementDeferred<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
- return map.getOrDefault(keyExtractorCheck.apply(multiBlock), defaultElem).check(multiBlock, world, x, y, z);
+ public boolean check(T t, World world, int x, int y, int z) {
+ return map.getOrDefault(keyExtractorCheck.apply(t), defaultElem).check(t, world, x, y, z);
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return map.getOrDefault(keyExtractor.apply(multiBlock, trigger), defaultElem).placeBlock(multiBlock, world, x, y, z, trigger);
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).placeBlock(t, world, x, y, z, trigger);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return map.getOrDefault(keyExtractor.apply(multiBlock, trigger), defaultElem).spawnHint(multiBlock, world, x, y, z, trigger);
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).spawnHint(t, world, x, y, z, trigger);
}
};
}
@SafeVarargs
- public static <MultiBlock> IStructureElementDeferred<MultiBlock> defer(Function<MultiBlock, Integer> keyExtractorCheck, BiFunction<MultiBlock, ItemStack, Integer> keyExtractor, IStructureElement<MultiBlock>... array) {
+ public static <T> IStructureElementDeferred<T> defer(Function<T, Integer> keyExtractorCheck, BiFunction<T, ItemStack, Integer> keyExtractor, IStructureElement<T>... array) {
if (keyExtractor == null || array == null) {
throw new IllegalArgumentException();
}
- return new IStructureElementDeferred<MultiBlock>() {
+ return new IStructureElementDeferred<T>() {
@Override
- public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
- return array[keyExtractorCheck.apply(multiBlock)].check(multiBlock, world, x, y, z);
+ public boolean check(T t, World world, int x, int y, int z) {
+ return array[keyExtractorCheck.apply(t)].check(t, world, x, y, z);
}
@Override
- public boolean placeBlock(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return array[keyExtractor.apply(multiBlock, trigger)].placeBlock(multiBlock, world, x, y, z, trigger);
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return array[keyExtractor.apply(t, trigger)].placeBlock(t, world, x, y, z, trigger);
}
@Override
- public boolean spawnHint(MultiBlock multiBlock, World world, int x, int y, int z, ItemStack trigger) {
- return array[keyExtractor.apply(multiBlock, trigger)].spawnHint(multiBlock, world, x, y, z, trigger);
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return array[keyExtractor.apply(t, trigger)].spawnHint(t, world, x, y, z, trigger);
}
};
}
@SuppressWarnings("unchecked")
- public static <MultiBlock> IStructureElementDeferred<MultiBlock> defer(Function<MultiBlock, Integer> keyExtractorCheck, BiFunction<MultiBlock, ItemStack, Integer> keyExtractor, List<IStructureElement<MultiBlock>> array) {
+ public static <T> IStructureElementDeferred<T> defer(Function<T, Integer> keyExtractorCheck, BiFunction<T, ItemStack, Integer> keyExtractor, List<IStructureElement<T>> array) {
return defer(keyExtractorCheck, keyExtractor, array.toArray(new IStructureElement[0]));
}
@@ -1057,10 +1055,10 @@ public class StructureUtility {
* @param a
* @param b
* @param c
- * @param <MultiBlock>
+ * @param <T>
* @return
*/
- public static <MultiBlock> IStructureNavigate<MultiBlock> step(int a, int b, int c) {
+ public static <T> IStructureNavigate<T> step(int a, int b, int c) {
return step(new Vec3Impl(a, b, c));
}
@@ -1068,11 +1066,11 @@ public class StructureUtility {
* Used internally, to generate skips for structure definitions
*
* @param step
- * @param <MultiBlock>
+ * @param <T>
* @return
*/
@SuppressWarnings("unchecked")
- public static <MultiBlock> IStructureNavigate<MultiBlock> step(Vec3Impl step) {
+ public static <T> IStructureNavigate<T> step(Vec3Impl step) {
if (step == null || step.get0() < 0 || step.get1() < 0 || step.get2() < 0) {
throw new IllegalArgumentException();
}
@@ -1087,8 +1085,8 @@ public class StructureUtility {
});
}
- private static <MultiBlock> IStructureNavigate<MultiBlock> stepA(int a, int b, int c) {
- return new IStructureNavigate<MultiBlock>() {
+ private static <T> IStructureNavigate<T> stepA(int a, int b, int c) {
+ return new IStructureNavigate<T>() {
@Override
public int getStepA() {
return a;
@@ -1106,8 +1104,8 @@ public class StructureUtility {
};
}
- private static <MultiBlock> IStructureNavigate<MultiBlock> stepB(int a, int b, int c) {
- return new IStructureNavigate<MultiBlock>() {
+ private static <T> IStructureNavigate<T> stepB(int a, int b, int c) {
+ return new IStructureNavigate<T>() {
@Override
public int getStepA() {
return a;
@@ -1130,8 +1128,8 @@ public class StructureUtility {
};
}
- private static <MultiBlock> IStructureNavigate<MultiBlock> stepC(int a, int b, int c) {
- return new IStructureNavigate<MultiBlock>() {
+ private static <T> IStructureNavigate<T> stepC(int a, int b, int c) {
+ return new IStructureNavigate<T>() {
@Override
public int getStepA() {
return a;
@@ -1378,134 +1376,6 @@ public class StructureUtility {
}
}
- public static <MultiBlock> boolean iterate(MultiBlock object,
- ItemStack trigger,
- IStructureElement<MultiBlock>[] elements,
- World world,
- ExtendedFacing extendedFacing,
- int basePositionX, int basePositionY, int basePositionZ,
- int basePositionA, int basePositionB, int basePositionC,
- StructureIterationType iterationType) {
- if (world.isRemote ^ (iterationType == SPAWN_HINTS)) {
- return false;
- }
-
- //change base position to base offset
- basePositionA = -basePositionA;
- basePositionB = -basePositionB;
- basePositionC = -basePositionC;
-
- int[] abc = new int[]{basePositionA, basePositionB, basePositionC};
- int[] xyz = new int[3];
-
- switch (iterationType) {
- case SPAWN_HINTS: {
- for (IStructureElement<MultiBlock> element : elements) {
- if (element.isNavigating()) {
- abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA();
- abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB();
- abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC();
- } else {
- extendedFacing.getWorldOffset(abc, xyz);
- xyz[0] += basePositionX;
- xyz[1] += basePositionY;
- xyz[2] += basePositionZ;
-
- element.spawnHint(object, world, xyz[0], xyz[1], xyz[2], trigger);
-
- abc[0] += 1;
- }
- }
- break;
- }
- case BUILD_TEMPLATE: {
- for (IStructureElement<MultiBlock> element : elements) {
- if (element.isNavigating()) {
- abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA();
- abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB();
- abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC();
- } else {
- extendedFacing.getWorldOffset(abc, xyz);
- xyz[0] += basePositionX;
- xyz[1] += basePositionY;
- xyz[2] += basePositionZ;
-
- if (world.blockExists(xyz[0], xyz[1], xyz[2])) {
- element.placeBlock(object, world, xyz[0], xyz[1], xyz[2], trigger);
- }
- abc[0] += 1;
- }
- }
- break;
- }
- case CHECK: {
- for (IStructureElement<MultiBlock> element : elements) {
- if (element.isNavigating()) {
- abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA();
- abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB();
- abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC();
- } else {
- extendedFacing.getWorldOffset(abc, xyz);
- xyz[0] += basePositionX;
- xyz[1] += basePositionY;
- xyz[2] += basePositionZ;
-
- if (world.blockExists(xyz[0], xyz[1], xyz[2])) {
- if (!element.check(object, world, xyz[0], xyz[1], xyz[2])) {
- if (DEBUG_MODE) {
- TecTech.LOGGER.info("Multi [" + basePositionX + ", " + basePositionY + ", " + basePositionZ + "] failed @ " +
- Arrays.toString(xyz) + " " + Arrays.toString(abc));
- }
- return false;
- }
- } else {
- if (DEBUG_MODE) {
- TecTech.LOGGER.info("Multi [" + basePositionX + ", " + basePositionY + ", " + basePositionZ + "] !blockExists @ " +
- Arrays.toString(xyz) + " " + Arrays.toString(abc));
- }
- }
- abc[0] += 1;
- }
- break;
- }
- }
- case CHECK_FULLY: {
- for (IStructureElement<MultiBlock> element : elements) {
- if (element.isNavigating()) {
- abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA();
- abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB();
- abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC();
- } else {
- extendedFacing.getWorldOffset(abc, xyz);
- xyz[0] += basePositionX;
- xyz[1] += basePositionY;
- xyz[2] += basePositionZ;
-
- if (world.blockExists(xyz[0], xyz[1], xyz[2])) {
- if (!element.check(object, world, xyz[0], xyz[1], xyz[2])) {
- if (DEBUG_MODE) {
- TecTech.LOGGER.info("Multi [" + basePositionX + ", " + basePositionY + ", " + basePositionZ + "] failed @ " +
- Arrays.toString(xyz) + " " + Arrays.toString(abc));
- }
- return false;
- }
- } else {
- if (DEBUG_MODE) {
- TecTech.LOGGER.info("Multi [" + basePositionX + ", " + basePositionY + ", " + basePositionZ + "] !blockExists @ " +
- Arrays.toString(xyz) + " " + Arrays.toString(abc));
- }
- return false;
- }
- abc[0] += 1;
- }
- }
- break;
- }
- default: return false;
- }
- return true;
- }
-
/**
* Transposes shape (swaps B and C axis, can be used to un-transpose transposed shape)
* WARNING! Do not use on old api...
diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java
index 36ebfb3d21..908c4c4aca 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java
@@ -3,12 +3,12 @@ package com.github.technus.tectech.mechanics.structure.adders;
import net.minecraft.block.Block;
-public interface IBlockAdder<MultiBlock> {
+public interface IBlockAdder<T> {
/**
* Callback on block added, needs to check if block is valid (and add it)
* @param block block attempted to add
* @param meta meta of block attempted to add
* @return is structure still valid
*/
- boolean apply(MultiBlock multiBlock, Block block, int meta);
+ boolean apply(T t,Block block, Integer meta);
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java
index 0545a83d9e..a47befc2e8 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java
@@ -3,12 +3,12 @@ package com.github.technus.tectech.mechanics.structure.adders;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-public interface IHatchAdder<MultiBlock> {
+public interface IHatchAdder<T> {
/**
* Callback to add hatch, needs to check if hatch is valid (and add it)
* @param iGregTechTileEntity hatch
- * @param textureIndex requested texture index, or null if not...
+ * @param aShort requested texture index, or null if not...
* @return managed to add hatch (structure still valid)
*/
- boolean apply(MultiBlock multiBlock, IGregTechTileEntity iGregTechTileEntity, int textureIndex);
+ boolean apply(T t,IGregTechTileEntity iGregTechTileEntity, Short aShort);
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java
index 72d08751b5..cc3c7dbb7a 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java
@@ -2,11 +2,11 @@ package com.github.technus.tectech.mechanics.structure.adders;
import net.minecraft.tileentity.TileEntity;
-public interface ITileAdder<MultiBlock> {
+public interface ITileAdder<T> {
/**
* Callback to add hatch, needs to check if tile is valid (and add it)
* @param tileEntity tile
* @return managed to add hatch (structure still valid)
*/
- boolean apply(MultiBlock multiBlock, TileEntity tileEntity);
+ boolean apply(T t,TileEntity tileEntity);
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java
new file mode 100644
index 0000000000..e397c1dc5f
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java
@@ -0,0 +1,123 @@
+package com.github.technus.tectech.mechanics.tesla;
+
+import com.github.technus.tectech.mechanics.spark.ThaumSpark;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Objects;
+
+import static com.github.technus.tectech.util.Util.entriesSortedByValues;
+import static java.lang.Math.sqrt;
+
+public interface ITeslaConnectable extends ITeslaConnectableSimple {
+ //Map with all Teslas in the same dimension and the distance to them //TODO Range
+ HashMap<ITeslaConnectableSimple, Integer> teslaNodeMap = new HashMap<>();
+ //ThaumCraft lighting coordinate pairs, so we can send them in bursts and save on lag
+ HashSet<ThaumSpark> sparkList = new HashSet<>();
+
+ //-128 to -1 disables capability
+ //0 means any source or target
+ //1 to 127 must match on source and target or source/target must be 0
+ byte getTeslaTransmissionCapability();
+
+ //Transmission Range is typically 16+ in blocks
+ int getTeslaTransmissionRange();
+ boolean isOverdriveEnabled();
+
+ int getTeslaEnergyLossPerBlock();
+ float getTeslaOverdriveLossCoefficient();
+
+ long getTeslaOutputVoltage();
+ long getTeslaOutputCurrent();
+
+ boolean teslaDrainEnergy(long teslaVoltageDrained);
+
+ class TeslaUtil {
+ public static final HashSet<ITeslaConnectableSimple> teslaNodeSet = new HashSet<>();//Targets for power transmission
+
+ public static void generateTeslaNodeMap(ITeslaConnectable origin) {
+ origin.teslaNodeMap.clear();
+ for (ITeslaConnectableSimple target : teslaNodeSet) {
+ //Sanity checks
+ if (target == null) {
+ //The Tesla Covers do not remove themselves from the list and this is the code that does
+ teslaNodeSet.remove(null);
+ continue;
+ } else if (origin.equals(target) || !origin.getTeslaDimension().equals(target.getTeslaDimension())) {
+ //Skip if looking at myself and skip if not in the same dimension
+ //TODO, INTERDIM?
+ continue;
+ } else if (origin.getTeslaTransmissionCapability() != 0 && origin.getTeslaReceptionCapability() != 0 &&
+ origin.getTeslaTransmissionCapability() != origin.getTeslaReceptionCapability()) {
+ //Skip if incompatible
+ continue;
+ }
+
+ //Range calc
+ int distance = (int) sqrt(origin.getTeslaPosition().distanceSq(target.getTeslaPosition()));
+ if (distance > origin.getTeslaTransmissionRange() * target.getTeslaReceptionCoefficient()) {
+ //Skip if the range is too vast
+ continue;
+ }
+ origin.teslaNodeMap.put(target, distance);
+ }
+ }
+
+ public static void cleanTeslaNodeMap(ITeslaConnectable origin) {
+ //Wipes all null objects, in practice this is unloaded or improperly removed tesla objects
+ origin.teslaNodeMap.keySet().removeIf(Objects::isNull);
+ }
+
+ public static long powerTeslaNodeMap(ITeslaConnectable origin) {
+ //Teslas can only send OR receive
+ if (origin.isTeslaReadyToReceive()) {
+ return 0L;//TODO Negative values to indicate charging?
+ }
+ long remainingAmperes = origin.getTeslaOutputCurrent();
+ while (remainingAmperes > 0) {
+ long startingAmperes = remainingAmperes;
+ for (HashMap.Entry<ITeslaConnectableSimple, Integer> Rx : entriesSortedByValues(teslaNodeMap)) {
+ if (origin.getTeslaStoredEnergy() < (origin.isOverdriveEnabled() ? origin.getTeslaOutputVoltage() * 2 : origin.getTeslaOutputVoltage())) {
+ //Return and end the tick if we're out of energy to send
+ return origin.getTeslaOutputCurrent() - remainingAmperes;
+ }
+
+ ITeslaConnectableSimple target = Rx.getKey();
+ int distance = Rx.getValue();
+
+ //Calculate the voltage output
+ long outputVoltageInjectable;
+ long outputVoltageConsumption;
+
+ if (origin.isOverdriveEnabled()) {
+ outputVoltageInjectable = origin.getTeslaOutputVoltage();
+ outputVoltageConsumption = origin.getTeslaOutputVoltage() + (distance * origin.getTeslaEnergyLossPerBlock()) +
+ (long) Math.round(origin.getTeslaOutputVoltage() * origin.getTeslaOverdriveLossCoefficient());
+ } else {
+ outputVoltageInjectable = origin.getTeslaOutputVoltage() - (distance * origin.getTeslaEnergyLossPerBlock());
+ outputVoltageConsumption = origin.getTeslaOutputVoltage();
+ }
+
+ //Skip the target if the cost is too high
+ if (origin.getTeslaStoredEnergy() < outputVoltageConsumption) {
+ continue;
+ }
+
+ if (target.teslaInjectEnergy(outputVoltageInjectable)) {
+ origin.teslaDrainEnergy(outputVoltageConsumption);
+ sparkList.add(new ThaumSpark(origin.getTeslaPosition(), target.getTeslaPosition(), origin.getTeslaDimension()));
+ remainingAmperes--;
+ }
+ if (remainingAmperes == 0) {
+ return origin.getTeslaOutputCurrent();
+ }
+ }
+ //End the tick after one iteration with no transmissions
+ if (remainingAmperes == startingAmperes) {
+ return origin.getTeslaOutputCurrent() - remainingAmperes;
+ }
+ }
+ return origin.getTeslaOutputCurrent() - remainingAmperes;
+ }
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectableSimple.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectableSimple.java
new file mode 100644
index 0000000000..3b56b6968c
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectableSimple.java
@@ -0,0 +1,22 @@
+package com.github.technus.tectech.mechanics.tesla;
+
+import com.github.technus.tectech.util.Vec3Impl;
+
+public interface ITeslaConnectableSimple {
+ //-128 to -1 disables capability
+ //0 means any source or target
+ //1 to 127 must match on source and target or source/target must be 0
+ byte getTeslaReceptionCapability();
+
+ //Reception Coefficient is a range extension, typical is 1
+ float getTeslaReceptionCoefficient();
+
+ boolean isTeslaReadyToReceive();
+
+ long getTeslaStoredEnergy();
+
+ boolean teslaInjectEnergy(long teslaVoltageInjected);
+
+ Vec3Impl getTeslaPosition();
+ Integer getTeslaDimension();
+}
diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
index 5265ad25c6..a86695ff4a 100644
--- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
+++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
@@ -78,7 +78,7 @@ public enum CustomItemList implements IItemContainer {
eM_Containment, eM_Containment_Field, eM_Containment_Advanced, eM_Coil, eM_Teleportation, eM_Dimensional, eM_Ultimate_Containment, eM_Ultimate_Containment_Advanced, eM_Ultimate_Containment_Field, eM_Spacetime, eM_Computer_Casing, eM_Computer_Bus, eM_Computer_Vent, eM_Hollow, eM_Power,
debugBlock,
- tM_TeslaBase, tM_TeslaToroid, tM_TeslaSecondary, tM_TeslaPrimary_0, tM_TeslaPrimary_1, tM_TeslaPrimary_2, tM_TeslaPrimary_3, tM_TeslaPrimary_4, tM_TeslaPrimary_5,
+ tM_TeslaBase, tM_TeslaToroid, tM_TeslaSecondary, tM_TeslaPrimary_0, tM_TeslaPrimary_1, tM_TeslaPrimary_2, tM_TeslaPrimary_3, tM_TeslaPrimary_4, tM_TeslaPrimary_5, tM_TeslaPrimary_6,
Machine_Multi_Microwave, Machine_Multi_TeslaCoil,
Machine_Multi_Transformer,
diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java
index 6d5bcd2b04..0d2f710ae9 100644
--- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java
+++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java
@@ -23,8 +23,8 @@ import static com.github.technus.tectech.TecTech.tectechTexturePage1;
* Created by danie_000 on 03.10.2016.
*/
public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract {
- public static final byte texturePage=tectechTexturePage1;
- public static final short textureOffset = (texturePage << 7)+16;//Start of PAGE 8 (which is the 9th page) (8*128)+16
+ public static final byte texturePage = tectechTexturePage1;
+ public static final short textureOffset = (texturePage << 7) + 16;//Start of PAGE 8 (which is the 9th page) (8*128)+16
private static IIcon[] tM0 = new IIcon[2];
private static IIcon[] tM1 = new IIcon[2];
@@ -35,11 +35,12 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract {
private static IIcon[] tM6 = new IIcon[2];
private static IIcon tM7;
private static IIcon[] tM8 = new IIcon[2];
+ private static IIcon[] tM9 = new IIcon[2];
public GT_Block_CasingsBA0() {
super(GT_Item_CasingsBA0.class, "gt.blockcasingsBA0", GT_Material_Casings.INSTANCE);
for (byte b = 0; b < 16; b = (byte) (b + 1)) {
- Textures.BlockIcons.casingTexturePages[texturePage][b+16] = new GT_CopiedBlockTexture(this, 6, b);
+ Textures.BlockIcons.casingTexturePages[texturePage][b + 16] = new GT_CopiedBlockTexture(this, 6, b);
/*IMPORTANT for block recoloring**/
}
@@ -49,6 +50,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract {
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "EV Superconductor Primary Tesla Windings");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "IV Superconductor Primary Tesla Windings");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "LuV Superconductor Primary Tesla Windings");
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "ZPM Superconductor Primary Tesla Windings");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Tesla Base Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Tesla Toroid Casing");
@@ -60,6 +62,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract {
CustomItemList.tM_TeslaPrimary_3.set(new ItemStack(this, 1, 3));
CustomItemList.tM_TeslaPrimary_4.set(new ItemStack(this, 1, 4));
CustomItemList.tM_TeslaPrimary_5.set(new ItemStack(this, 1, 5));
+ CustomItemList.tM_TeslaPrimary_6.set(new ItemStack(this, 1, 9));
CustomItemList.tM_TeslaBase.set(new ItemStack(this, 1, 6));
CustomItemList.tM_TeslaToroid.set(new ItemStack(this, 1, 7));
@@ -80,6 +83,8 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract {
tM4[1] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_4");
tM5[0] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_WINDING_PRIMARY_TOP_BOTTOM_5");
tM5[1] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_5");
+ tM9[0] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_WINDING_PRIMARY_TOP_BOTTOM_6");
+ tM9[1] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_6");
tM6[0] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_BASE_TOP_BOTTOM");
tM6[1] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_BASE_SIDES");
@@ -92,7 +97,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract {
public IIcon getIcon(int aSide, int aMeta) {
switch (aMeta) {
case 0:
- switch (aSide){
+ switch (aSide) {
case 0:
case 1:
return tM0[0];
@@ -100,7 +105,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract {
return tM0[1];
}
case 1:
- switch (aSide){
+ switch (aSide) {
case 0:
case 1:
return tM1[0];
@@ -108,7 +113,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract {
return tM1[1];
}
case 2:
- switch (aSide){
+ switch (aSide) {
case 0:
case 1:
return tM2[0];
@@ -116,7 +121,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract {
return tM2[1];
}
case 3:
- switch (aSide){
+ switch (aSide) {
case 0:
case 1:
return tM3[0];
@@ -124,7 +129,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract {
return tM3[1];
}
case 4:
- switch (aSide){
+ switch (aSide) {
case 0:
case 1:
return tM4[0];
@@ -132,7 +137,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract {
return tM4[1];
}
case 5:
- switch (aSide){
+ switch (aSide) {
case 0:
case 1:
return tM5[0];
@@ -140,7 +145,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract {
return tM5[1];
}
case 6:
- switch (aSide){
+ switch (aSide) {
case 0:
case 1:
return tM6[0];
@@ -150,13 +155,21 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract {
case 7:
return tM7;
case 8:
- switch (aSide){
+ switch (aSide) {
case 0:
case 1:
return tM8[0];
default:
return tM8[1];
}
+ case 9:
+ switch (aSide) {
+ case 0:
+ case 1:
+ return tM9[0];
+ default:
+ return tM9[1];
+ }
default:
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
}
@@ -171,7 +184,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract {
@Override
public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List aList) {
- for (int i = 0; i <= 8; i++) {
+ for (int i = 0; i <= 9; i++) {
aList.add(new ItemStack(aItem, 1, i));
}
}
diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java
index 56fdfd22bb..50630820df 100644
--- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java
+++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java
@@ -45,6 +45,10 @@ public class GT_Item_CasingsBA0 extends GT_Item_Casings_Abstract {
aList.add(translateToLocal("gt.blockcasingsBA0.8.desc.0"));//Picks up power from a primary coil
aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsBA0.8.desc.1"));//Who wouldn't want a 32k epoxy multi?
break;
+ case 9://"ZPM Superconductor Primary Tesla Windings"
+ aList.add(translateToLocal("gt.blockcasingsBA0.0.desc.0") + " " + V[7] + " EU/t");//Handles up to
+ aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsBA0.0.desc.1"));//What one man calls God, another calls the laws of physics.
+ break;
default://WTF?
aList.add("Damn son where did you get that!?");
aList.add(EnumChatFormatting.BLUE.toString() + "From outer space... I guess...");
diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java
index 721f730960..2efe2f3cbc 100644
--- a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java
+++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java
@@ -1,28 +1,95 @@
package com.github.technus.tectech.thing.cover;
+import com.github.technus.tectech.mechanics.tesla.ITeslaConnectableSimple;
+import com.github.technus.tectech.util.Vec3Impl;
import gregtech.api.interfaces.tileentity.ICoverable;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_CoverBehavior;
import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.EntityPlayer;
+import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.*;
import static ic2.api.info.Info.DMG_ELECTRIC;
-public class GT_Cover_TM_TeslaCoil extends GT_CoverBehavior {
+public class GT_Cover_TM_TeslaCoil extends GT_CoverBehavior implements ITeslaConnectableSimple {
+ private IGregTechTileEntity IGT;
+
public GT_Cover_TM_TeslaCoil() {
}
+ @Override
+ public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ //Only do stuff if we're on top and have power
+ if (aSide == 1 || aTileEntity.getEUCapacity() > 0) {
+ //Pull IGT onto the outside, should only execute first tick
+ if (IGT == null) {
+ IGT = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0);
+ }
+ //Makes sure we're on the list
+ teslaNodeSet.add(this);
+ }
+
+ return super.doCoverThings(aSide, aInputRedstone, aCoverID, aCoverVariable, aTileEntity, aTimer);
+ }
+
+ @Override
public String getDescription(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
- return "Do not attempt to use screwdriver!";
+ return "Do not attempt to use screwdriver!";//TODO Translation support
}
+ @Override
public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return true;
}
+ @Override
public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- if(aTileEntity.getStoredEU() > 0 && !GT_Utility.isWearingFullElectroHazmat(aPlayer)){
+ //Shock a non-hazmat player if they dare stuff a screwdriver into one of these
+ if (aTileEntity.getStoredEU() > 0 && !GT_Utility.isWearingFullElectroHazmat(aPlayer)) {
aPlayer.attackEntityFrom(DMG_ELECTRIC, 20);
}
return aCoverVariable;
}
-} \ No newline at end of file
+
+ @Override
+ public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ //It updates once every 200 ticks, so once every 10 seconds
+ return 200;
+ }
+
+ @Override
+ public byte getTeslaReceptionCapability() {
+ return 2;
+ }
+
+ @Override
+ public float getTeslaReceptionCoefficient() {
+ return 1;
+ }
+
+ @Override
+ public boolean isTeslaReadyToReceive() {
+ return true;
+ }
+
+ @Override
+ public long getTeslaStoredEnergy() {
+ return IGT.getStoredEU();
+ }
+
+ @Override
+ public Vec3Impl getTeslaPosition() {
+ return new Vec3Impl(IGT);
+ }
+
+ @Override
+ public Integer getTeslaDimension() {
+ return IGT.getWorld().provider.dimensionId;
+ }
+
+ @Override
+ public boolean teslaInjectEnergy(long teslaVoltageInjected) {
+ //Same as in the microwave transmitters, this does not account for amp limits
+ return IGT.injectEnergyUnits((byte) 1, teslaVoltageInjected, 1L) > 0L;
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java
index db7c751fc6..028ac3a4d6 100644
--- a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java
+++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java
@@ -7,23 +7,33 @@ public class GT_Cover_TM_TeslaCoil_Ultimate extends GT_Cover_TM_TeslaCoil {
public GT_Cover_TM_TeslaCoil_Ultimate() {
}
+ @Override
public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return true;
}
+ @Override
public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) {
return true;
}
+ @Override
public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) {
return true;
}
+ @Override
public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) {
return true;
}
+ @Override
public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) {
return true;
}
-} \ No newline at end of file
+
+ @Override
+ public byte getTeslaReceptionCapability() {
+ return 1;
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java
index 6e7e8c426d..86982e7c09 100644
--- a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java
+++ b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java
@@ -22,7 +22,7 @@ import static net.minecraft.util.StatCollector.translateToLocal;
public final class TeslaCoilCapacitor extends Item {
public static TeslaCoilCapacitor INSTANCE;
- private static IIcon LVicon, MVicon, HVicon, EVicon, IVicon;
+ private static IIcon LVicon, MVicon, HVicon, EVicon, IVicon, LuVicon, ZPMicon;
private TeslaCoilCapacitor() {
setHasSubtypes(true);
@@ -33,8 +33,8 @@ public final class TeslaCoilCapacitor extends Item {
@Override
public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) {
aList.add(CommonValues.BASS_MARK);
- if (aStack.getItemDamage() >= 0 && aStack.getItemDamage() <= 4) {
- aList.add(translateToLocal("item.tm.teslaCoilCapacitor.desc.0") + " " + V[aStack.getItemDamage() + 1] * 512 + " " + translateToLocal("item.tm.teslaCoilCapacitor.desc.1") +" " + V[aStack.getItemDamage() + 1] + " EU/t");//Stores 16384 EU in a tesla tower at 32 EU/t
+ if (aStack.getItemDamage() >= 0 && aStack.getItemDamage() <= 6) {
+ aList.add(translateToLocal("item.tm.teslaCoilCapacitor.desc.0") + " " + V[aStack.getItemDamage() + 1] * 512 + " " + translateToLocal("item.tm.teslaCoilCapacitor.desc.1") + " " + V[aStack.getItemDamage() + 1] + " EU/t");//Stores 16384 EU in a tesla tower at 32 EU/t
} else {
aList.add(translateToLocal("item.tm.teslaCoilCapacitor.desc.2"));//Yeet this broken item into some spicy water!
}
@@ -61,6 +61,8 @@ public final class TeslaCoilCapacitor extends Item {
HVicon = iconRegister.registerIcon(MODID + ":itemCapacitorHV");
EVicon = iconRegister.registerIcon(MODID + ":itemCapacitorEV");
IVicon = iconRegister.registerIcon(MODID + ":itemCapacitorIV");
+ LuVicon = iconRegister.registerIcon(MODID + ":itemCapacitorLuV");
+ ZPMicon = iconRegister.registerIcon(MODID + ":itemCapacitorZPM");
}
@Override
@@ -74,6 +76,10 @@ public final class TeslaCoilCapacitor extends Item {
return EVicon;
case 4:
return IVicon;
+ case 5:
+ return LuVicon;
+ case 6:
+ return ZPMicon;
default:
return LVicon;
}
@@ -81,7 +87,7 @@ public final class TeslaCoilCapacitor extends Item {
@Override
public void getSubItems(Item aItem, CreativeTabs par2CreativeTabs, List aList) {
- for (int i = 0; i <= 4; i++) {
+ for (int i = 0; i <= 6; i++) {
aList.add(new ItemStack(aItem, 1, i));
}
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java
index b4e8f03a74..4e07622c25 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java
@@ -38,7 +38,7 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch {
public GT_MetaTileEntity_Hatch_Capacitor(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 16, "");
- Util.setTier(aTier,this);
+ Util.setTier(aTier, this);
}
public GT_MetaTileEntity_Hatch_Capacitor(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
@@ -173,11 +173,13 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch {
}
public static void run() {
- new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":item.tm.teslaCoilCapacitor.0", 0, 1, V[1]*512);//LV Capacitor
- new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":item.tm.teslaCoilCapacitor.1", 1, 1, V[2]*512);//MV Capacitor
- new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":item.tm.teslaCoilCapacitor.2", 2, 1, V[3]*512);//HV Capacitor
- new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":item.tm.teslaCoilCapacitor.3", 3, 1, V[4]*512);//EV Capacitor
- new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":item.tm.teslaCoilCapacitor.4", 4, 1, V[5]*512);//IV Capacitor
+ new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.0", 0, 1, V[1] * 512);//LV Capacitor
+ new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.1", 1, 1, V[2] * 512);//MV Capacitor
+ new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.2", 2, 1, V[3] * 512);//HV Capacitor
+ new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.3", 3, 1, V[4] * 512);//EV Capacitor
+ new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.4", 4, 1, V[5] * 512);//IV Capacitor
+ new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.5", 5, 1, V[6] * 512);//LuV Capacitor
+ new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.6", 6, 1, V[7] * 512);//ZPM Capacitor
}
public static class CapacitorComponent implements Comparable<GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent> {
@@ -206,12 +208,10 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch {
@Override
public boolean equals(Object obj) {
- if(obj instanceof CapacitorComponent) {
+ if (obj instanceof CapacitorComponent) {
return compareTo((CapacitorComponent) obj) == 0;
}
return false;
}
}
}
-
-
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java
index 89093bdba7..93f6e50c5a 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java
@@ -5,10 +5,9 @@ import com.github.technus.tectech.loader.NetworkDispatcher;
import com.github.technus.tectech.mechanics.constructable.IConstructable;
import com.github.technus.tectech.mechanics.spark.RendererMessage;
import com.github.technus.tectech.mechanics.spark.ThaumSpark;
-import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder;
import com.github.technus.tectech.mechanics.structure.Structure;
-import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil;
-import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil_Ultimate;
+import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder;
+import com.github.technus.tectech.mechanics.tesla.ITeslaConnectable;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Capacitor;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti;
@@ -18,11 +17,11 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture;
-import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_TeslaCoil;
import com.github.technus.tectech.util.CommonValues;
import com.github.technus.tectech.util.Vec3Impl;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.Materials;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -33,58 +32,63 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
import static com.github.technus.tectech.mechanics.structure.Structure.adders;
+import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.*;
import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage;
import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsBA0;
import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*;
import static com.github.technus.tectech.util.CommonValues.V;
-import static com.github.technus.tectech.util.Util.entriesSortedByValues;
-import static com.github.technus.tectech.util.Util.map;
import static gregtech.api.enums.GT_Values.E;
-import static java.lang.Math.max;
-import static java.lang.Math.min;
+import static java.lang.Math.*;
import static net.minecraft.util.StatCollector.translateToLocal;
-public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable {
+public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable, ITeslaConnectable {
//region variables
- private final static HashSet<ThaumSpark> sparkList = new HashSet<>();
-
+ private static final int transferRadiusTowerFromConfig = TecTech.configTecTech.TESLA_MULTI_RANGE_TOWER;//Default is 32
+ private static final int transferRadiusTransceiverFromConfig = TecTech.configTecTech.TESLA_MULTI_RANGE_TRANSCEIVER;//Default is 16
+ private static final int transferRadiusCoverUltimateFromConfig = TecTech.configTecTech.TESLA_MULTI_RANGE_COVER;//Default is 16
+ private static final int plasmaRangeMultiT1 = TecTech.configTecTech.TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1;//Default is 2
+ private static final int plasmaRangeMultiT2 = TecTech.configTecTech.TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2;//Default is 4
+ private static final int heliumUse = TecTech.configTecTech.TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM;//Default is 100
+ private static final int nitrogenUse = TecTech.configTecTech.TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN;//Default is 50
+ private static final int radonUse = TecTech.configTecTech.TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON;//Default is 50
+ //Default is {1, 1, 1}
+ private static final int[] plasmaTierLoss = new int[]{TecTech.configTecTech.TESLA_MULTI_LOSS_PER_BLOCK_T0,
+ TecTech.configTecTech.TESLA_MULTI_LOSS_PER_BLOCK_T1, TecTech.configTecTech.TESLA_MULTI_LOSS_PER_BLOCK_T2};
+ private static final float overDriveLoss = TecTech.configTecTech.TESLA_MULTI_LOSS_FACTOR_OVERDRIVE;//Default is 0.25F;
+ private static final boolean doFluidOutput = TecTech.configTecTech.TESLA_MULTI_GAS_OUTPUT; //Default is false
+
+ //Face icons
private static Textures.BlockIcons.CustomIcon ScreenOFF;
private static Textures.BlockIcons.CustomIcon ScreenON;
- private int mTier = 0; //Determines max voltage and efficiency (MV to LuV)
- private int maxTier = 6; //Max tier for efficiency calcuation
+ private int mTier = 0; //Determines max voltage (LV to ZPM)
+ private int plasmaTier = 0; //0 is None, 1 is Helium or Nitrogen, 2 is Radon (Does not match actual plasma tiers)
- private float energyEfficiency = 1;
- private float overdriveEfficiency = 1;
- private float minEfficiency = TecTech.configTecTech.TESLA_MULTI_MIN_EFFICIENCY;//Default is 0.955F
- private float maxEfficiency = TecTech.configTecTech.TESLA_MULTI_MAX_EFFICIENCY;//Default is 0.98F;
- private float overdriveEfficiencyExtra = TecTech.configTecTech.TESLA_MULTI_OVERDRIVE_LOSS;//Default is 0.005F
+ private FluidStack[] mOutputFluidsQueue; //Used to buffer the fluid outputs, so the tesla takes a second to 'cool' any plasma it would output as a gas
- private Map<IGregTechTileEntity, Integer> eTeslaMap = new HashMap<>(); //Used to store targets for power transmission
- private final ArrayList<GT_MetaTileEntity_Hatch_Capacitor> eCapacitorHatches = new ArrayList<>(); //Used to determine count and tier of capacitors present
+ private final ArrayList<GT_MetaTileEntity_Hatch_Capacitor> eCapacitorHatches = new ArrayList<>(); //Capacitor hatches which determine the max voltage tier and count of amps
- private int scanTime = 0; //Scan timer used for tesla search intervals
+ private int sortTime = 0; //Scan timer used for tesla search intervals
private long energyCapacity = 0; //Total energy storage limited by capacitors
private long outputVoltageMax = 0; //Tesla voltage output limited by capacitors
private int vTier = -1; //Tesla voltage tier limited by capacitors
private long outputCurrentMax = 0; //Tesla current output limited by capacitors
- //Prevents unnecessary offset calculation
+ //outputVoltage and current after settings
+ private long outputVoltage;
+ private long outputCurrent;
+
+ //Prevents unnecessary offset calculation, saving on lag
private byte oldRotation = -1;
private byte oldOrientation = -1;
-
- //Coordinate Arrays
- private final Vec3Impl[] scanPosOffsets = new Vec3Impl[10];
- private Vec3Impl posZap = Vec3Impl.NULL_VECTOR;//Power Transfer Origin
- public Vec3Impl posTop = Vec3Impl.NULL_VECTOR;//Lightning Origin
+ //Location of the center of the sphere on top of the tower, used as the Thaumcraft lightning and origin
+ public Vec3Impl posTop = Vec3Impl.NULL_VECTOR;
//endregion
//region structure
@@ -104,7 +108,8 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
private static final byte[] blockMetaT3 = new byte[]{7, 3, 6, 8};
private static final byte[] blockMetaT4 = new byte[]{7, 4, 6, 8};
private static final byte[] blockMetaT5 = new byte[]{7, 5, 6, 8};
- private static final byte[][] blockMetas = new byte[][]{blockMetaT0, blockMetaT1, blockMetaT2, blockMetaT3, blockMetaT4, blockMetaT5};
+ private static final byte[] blockMetaT6 = new byte[]{7, 9, 6, 8};
+ private static final byte[][] blockMetas = new byte[][]{blockMetaT0, blockMetaT1, blockMetaT2, blockMetaT3, blockMetaT4, blockMetaT5, blockMetaT6};
private static final IHatchAdder<GT_MetaTileEntity_TM_teslaCoil>[] addingMethods = adders(
GT_MetaTileEntity_TM_teslaCoil::addCapacitorToMachineList,
GT_MetaTileEntity_TM_teslaCoil::addFrameToMachineList);
@@ -119,8 +124,8 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
//endregion
//region parameters
- protected Parameters.Group.ParameterIn popogaSetting, histLowSetting, histHighSetting, transferRadiusTowerSetting, transferRadiusTransceiverSetting, transferRadiusCoverUltimateSetting, outputVoltageSetting, outputCurrentSetting, scanTimeMinSetting, overDriveSetting;
- protected Parameters.Group.ParameterOut popogaDisplay, transferRadiusTowerDisplay, transferRadiusTransceiverDisplay, transferRadiusCoverUltimateDisplay, outputVoltageDisplay, outputCurrentDisplay, energyCapacityDisplay, energyStoredDisplay, energyFractionDisplay, scanTimeDisplay;
+ protected Parameters.Group.ParameterIn popogaSetting, histLowSetting, histHighSetting, transferRadiusTowerSetting, transferRadiusTransceiverSetting, transferRadiusCoverUltimateSetting, outputVoltageSetting, outputCurrentSetting, sortTimeMinSetting, overDriveSetting;
+ protected Parameters.Group.ParameterOut popogaDisplay, transferRadiusTowerDisplay, transferRadiusTransceiverDisplay, transferRadiusCoverUltimateDisplay, outputVoltageDisplay, outputCurrentDisplay, energyCapacityDisplay, energyStoredDisplay, energyFractionDisplay, sortTimeDisplay;
private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> HYSTERESIS_LOW_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.0");//Hysteresis low setting
private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> HYSTERESIS_HIGH_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.1");//Hysteresis high setting
@@ -164,17 +169,26 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
if (Double.isNaN(value)) return STATUS_WRONG;
value = (int) value;
if (value < 0) return STATUS_TOO_LOW;
- if (value > 40) return STATUS_TOO_HIGH;
- if (value < 32) return STATUS_LOW;
+ if (value > transferRadiusTowerFromConfig) return STATUS_HIGH;
+ if (value < transferRadiusTowerFromConfig) return STATUS_LOW;
+ return STATUS_OK;
+ };
+ private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TRANSCEIVER_STATUS = (base, p) -> {
+ double value = p.get();
+ if (Double.isNaN(value)) return STATUS_WRONG;
+ value = (int) value;
+ if (value < 0) return STATUS_TOO_LOW;
+ if (value > transferRadiusTransceiverFromConfig) return STATUS_HIGH;
+ if (value < transferRadiusTransceiverFromConfig) return STATUS_LOW;
return STATUS_OK;
};
- private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS = (base, p) -> {
+ private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_COVER_ULTIMATE_STATUS = (base, p) -> {
double value = p.get();
if (Double.isNaN(value)) return STATUS_WRONG;
value = (int) value;
if (value < 0) return STATUS_TOO_LOW;
- if (value > 20) return STATUS_TOO_HIGH;
- if (value < 16) return STATUS_LOW;
+ if (value > transferRadiusCoverUltimateFromConfig) return STATUS_HIGH;
+ if (value < transferRadiusCoverUltimateFromConfig) return STATUS_LOW;
return STATUS_OK;
};
private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_VOLTAGE_OR_CURRENT_STATUS = (base, p) -> {
@@ -211,7 +225,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
double value = p.get();
if (Double.isNaN(value)) return STATUS_WRONG;
value = (int) value;
- if (value == 0 || value == 20 || value == 40 || value == 60 || value == 80) return STATUS_HIGH;
+ if (value == 0) return STATUS_HIGH;
return STATUS_LOW;
};
private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> POWER_STATUS = (base, p) -> {
@@ -245,61 +259,64 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
super(aName);
}
- private long getEnergyEfficiency(long voltage, int distance, boolean overDriveToggle) {
- if (overDriveToggle) {
- return (long) ((voltage * 2) - (voltage * Math.pow(overdriveEfficiency, distance)));
- } else {
- return (long) (voltage * Math.pow(energyEfficiency, distance));
+ private float getRangeMulti(int mTier, int vTier) {
+ //By Default:
+ //Helium and Nitrogen Plasmas will double the range
+ //Radon will quadruple the range
+ int plasmaBoost;
+ switch (plasmaTier) {
+ case 2:
+ plasmaBoost = plasmaRangeMultiT2;
+ break;
+ case 1:
+ plasmaBoost = plasmaRangeMultiT1;
+ break;
+ default:
+ plasmaBoost = 1;
}
- }
- private float getRangeMulti(int mTier, int vTier) {
//Over-tiered coils will add +25% range
if (vTier > mTier) {
- return 1.25F;
- }
- return 1F;
- }
-
- private void scanForTransmissionTargets(Vec3Impl coordsMin, Vec3Impl coordsMax) {
- //This makes sure the minimums are actually smaller than the maximums
- int xMin = min(coordsMin.get0(), coordsMax.get0());
- int yMin = min(coordsMin.get1(), coordsMax.get1());
- int zMin = min(coordsMin.get2(), coordsMax.get2());
- //And vice versa
- int xMax = max(coordsMin.get0(), coordsMax.get0());
- int yMax = max(coordsMin.get1(), coordsMax.get1());
- int zMax = max(coordsMin.get2(), coordsMax.get2());
-
- for (int xPos = xMin; xPos <= xMax; xPos++) {
- for (int yPos = yMin; yPos <= yMax; yPos++) {
- for (int zPos = zMin; zPos <= zMax; zPos++) {
- if (xPos == 0 && yPos == 0 && zPos == 0) {
- continue;
+ return 1.25F * plasmaBoost;
+ }
+ return 1F * plasmaBoost;
+ }
+
+ private void checkPlasmaBoost() {
+ //If there's fluid in the queue, try to output it
+ //That way it takes at least a second to 'process' the plasma
+ if (mOutputFluidsQueue != null) {
+ mOutputFluids = mOutputFluidsQueue;
+ mOutputFluidsQueue = null;
+ }
+
+ for (GT_MetaTileEntity_Hatch_Input fluidHatch : mInputHatches) {
+ if (fluidHatch.mFluid != null) {
+ if (fluidHatch.mFluid.isFluidEqual(Materials.Helium.getPlasma(1)) && fluidHatch.mFluid.amount >= heliumUse) {
+ fluidHatch.mFluid.amount = fluidHatch.mFluid.amount - heliumUse;
+ if (doFluidOutput) {
+ mOutputFluidsQueue = new FluidStack[]{Materials.Helium.getGas(heliumUse)};
+ }
+ plasmaTier = 1;
+ return;
+ } else if (fluidHatch.mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)) && fluidHatch.mFluid.amount >= nitrogenUse) {
+ fluidHatch.mFluid.amount = fluidHatch.mFluid.amount - nitrogenUse;
+ if (doFluidOutput) {
+ mOutputFluidsQueue = new FluidStack[]{Materials.Nitrogen.getGas(nitrogenUse)};
}
- IGregTechTileEntity node = getBaseMetaTileEntity().getIGregTechTileEntityOffset(xPos, yPos, zPos);
- if (node != null) {
- IMetaTileEntity nodeInside = node.getMetaTileEntity();
- if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil ||
- nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && node.isActive() ||
- (node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil)) {
- eTeslaMap.put(node, (int) Math.ceil(Math.sqrt(Math.pow(xPos, 2) + Math.pow(yPos, 2) + Math.pow(zPos, 2))));
- }
+ plasmaTier = 1;
+ return;
+ } else if (fluidHatch.mFluid.isFluidEqual(Materials.Radon.getPlasma(1)) && fluidHatch.mFluid.amount >= radonUse) {
+ fluidHatch.mFluid.amount = fluidHatch.mFluid.amount - radonUse;
+ if (doFluidOutput) {
+ mOutputFluidsQueue = new FluidStack[]{Materials.Radon.getGas(radonUse)};
}
+ plasmaTier = 2;
+ return;
}
}
}
-
- }
-
- private void thaumLightning(IGregTechTileEntity mte, IGregTechTileEntity node) {
- byte xR = (byte) (node.getXCoord() - posTop.get0());
- byte yR = (byte) (node.getYCoord() - posTop.get1());
- byte zR = (byte) (node.getZCoord() - posTop.get2());
-
- int wID = mte.getWorld().provider.dimensionId;
-
- sparkList.add(new ThaumSpark(posTop.get0(), posTop.get1(), posTop.get2(), xR, yR, zR, wID));
+ plasmaTier = 0;
}
@Override
@@ -317,9 +334,11 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
eCapacitorHatches.clear();
Vec3Impl xyzOffsets;
-
xyzOffsets = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -1, 1));
mTier = iGregTechTileEntity.getMetaIDOffset(xyzOffsets.get0(), xyzOffsets.get1(), xyzOffsets.get2());
+ if (mTier == 9) {
+ mTier = 6;
+ }//Hacky remap because the ZPM coils were added later
if (structureCheck_EM(shape, blockType, blockMetas[mTier], addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 3, 16, 0) && eCapacitorHatches.size() > 0) {
for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) {
@@ -334,26 +353,10 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
oldOrientation = iGregTechTileEntity.getFrontFacing();
//Calculate coordinates of the middle bottom
- posZap = getExtendedFacing().getWorldOffset(new Vec3Impl(0, 0, 2)).add(getBaseMetaTileEntity());
+ posTop = getExtendedFacing().getWorldOffset(new Vec3Impl(0, 0, 2)).add(getBaseMetaTileEntity());
//Calculate coordinates of the top sphere
posTop = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -14, 2)).add(getBaseMetaTileEntity());
-
- //Calculate offsets for scanning
- scanPosOffsets[0] = getExtendedFacing().getWorldOffset(new Vec3Impl(40, 0, 43));
- scanPosOffsets[1] = getExtendedFacing().getWorldOffset(new Vec3Impl(-40, -4, -37));
-
- scanPosOffsets[2] = getExtendedFacing().getWorldOffset(new Vec3Impl(40, -5, 43));
- scanPosOffsets[3] = getExtendedFacing().getWorldOffset(new Vec3Impl(-40, -8, -37));
-
- scanPosOffsets[4] = getExtendedFacing().getWorldOffset(new Vec3Impl(40, -9, 43));
- scanPosOffsets[5] = getExtendedFacing().getWorldOffset(new Vec3Impl(-40, -12, -37));
-
- scanPosOffsets[6] = getExtendedFacing().getWorldOffset(new Vec3Impl(40, -13, 43));
- scanPosOffsets[7] = getExtendedFacing().getWorldOffset(new Vec3Impl(-40, -16, -37));
-
- scanPosOffsets[8] = getExtendedFacing().getWorldOffset(new Vec3Impl(40, -17, 43));
- scanPosOffsets[9] = getExtendedFacing().getWorldOffset(new Vec3Impl(-40, -20, -37));
}
return true;
}
@@ -362,6 +365,8 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
@Override
public boolean checkRecipe_EM(ItemStack itemStack) {
+ checkPlasmaBoost();
+
if (!histHighSetting.getStatus(false).isOk ||
!histLowSetting.getStatus(false).isOk ||
!transferRadiusTowerSetting.getStatus(false).isOk ||
@@ -369,7 +374,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
!transferRadiusCoverUltimateSetting.getStatus(false).isOk ||
!outputVoltageSetting.getStatus(false).isOk ||
!outputCurrentSetting.getStatus(false).isOk ||
- !scanTimeMinSetting.getStatus(false).isOk ||
+ !sortTimeMinSetting.getStatus(false).isOk ||
!overDriveSetting.getStatus(false).isOk
) return false;
@@ -386,10 +391,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
}
}
- //Calculate Efficiency values
- energyEfficiency = map(mTier + 1, 1, maxTier, minEfficiency, maxEfficiency);
- overdriveEfficiency = energyEfficiency - overdriveEfficiencyExtra;
-
energyCapacity = 0;
outputCurrentMax = 0;
@@ -450,6 +451,10 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
@Override
public void onRemoval() {
super.onRemoval();
+ if (this.getBaseMetaTileEntity().isClientSide()) {
+ return;
+ }
+ teslaNodeSet.remove(this);
for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) {
if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(cap)) {
cap.getBaseMetaTileEntity().setActive(false);
@@ -474,17 +479,17 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
popogaSetting = hatch_0.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS);
histHighSetting = hatch_1.makeInParameter(0, 0.75, HYSTERESIS_HIGH_SETTING_NAME, HYSTERESIS_HIGH_STATUS);
popogaSetting = hatch_1.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS);
- transferRadiusTowerSetting = hatch_2.makeInParameter(0, 32, TRANSFER_RADIUS_TOWER_SETTING_NAME, TRANSFER_RADIUS_TOWER_STATUS);
+ transferRadiusTowerSetting = hatch_2.makeInParameter(0, transferRadiusTowerFromConfig, TRANSFER_RADIUS_TOWER_SETTING_NAME, TRANSFER_RADIUS_TOWER_STATUS);
popogaSetting = hatch_2.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS);
- transferRadiusTransceiverSetting = hatch_3.makeInParameter(0, 16, TRANSFER_RADIUS_TRANSCEIVER_SETTING_NAME, TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS);
- transferRadiusCoverUltimateSetting = hatch_3.makeInParameter(1, 16, TRANSFER_RADIUS_COVER_ULTIMATE_SETTING_NAME, TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS);
+ transferRadiusTransceiverSetting = hatch_3.makeInParameter(0, transferRadiusTransceiverFromConfig, TRANSFER_RADIUS_TRANSCEIVER_SETTING_NAME, TRANSFER_RADIUS_TRANSCEIVER_STATUS);
+ transferRadiusCoverUltimateSetting = hatch_3.makeInParameter(1, transferRadiusCoverUltimateFromConfig, TRANSFER_RADIUS_COVER_ULTIMATE_SETTING_NAME, TRANSFER_RADIUS_COVER_ULTIMATE_STATUS);
outputVoltageSetting = hatch_4.makeInParameter(0, -1, OUTPUT_VOLTAGE_SETTING_NAME, OUTPUT_VOLTAGE_OR_CURRENT_STATUS);
popogaSetting = hatch_4.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS);
outputCurrentSetting = hatch_5.makeInParameter(0, -1, OUTPUT_CURRENT_SETTING_NAME, OUTPUT_VOLTAGE_OR_CURRENT_STATUS);
popogaSetting = hatch_5.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS);
popogaSetting = hatch_6.makeInParameter(0, 0, POPOGA_NAME, POPOGA_STATUS);
popogaSetting = hatch_6.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS);
- scanTimeMinSetting = hatch_7.makeInParameter(0, 100, SCAN_TIME_MIN_SETTING_NAME, SCAN_TIME_MIN_STATUS);
+ sortTimeMinSetting = hatch_7.makeInParameter(0, 100, SCAN_TIME_MIN_SETTING_NAME, SCAN_TIME_MIN_STATUS);
popogaSetting = hatch_7.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS);
overDriveSetting = hatch_8.makeInParameter(0, 0, OVERDRIVE_SETTING_NAME, OVERDRIVE_STATUS);
popogaSetting = hatch_8.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS);
@@ -497,15 +502,15 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
popogaDisplay = hatch_1.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS);
transferRadiusTowerDisplay = hatch_2.makeOutParameter(0, 0, TRANSFER_RADIUS_TOWER_DISPLAY_NAME, TRANSFER_RADIUS_TOWER_STATUS);
popogaDisplay = hatch_2.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS);
- transferRadiusTransceiverDisplay = hatch_3.makeOutParameter(0, 0, TRANSFER_RADIUS_TRANSCEIVER_DISPLAY_NAME, TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS);
- transferRadiusCoverUltimateDisplay = hatch_3.makeOutParameter(1, 0, TRANSFER_RADIUS_COVER_ULTIMATE_DISPLAY_NAME, TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS);
+ transferRadiusTransceiverDisplay = hatch_3.makeOutParameter(0, 0, TRANSFER_RADIUS_TRANSCEIVER_DISPLAY_NAME, TRANSFER_RADIUS_TRANSCEIVER_STATUS);
+ transferRadiusCoverUltimateDisplay = hatch_3.makeOutParameter(1, 0, TRANSFER_RADIUS_COVER_ULTIMATE_DISPLAY_NAME, TRANSFER_RADIUS_COVER_ULTIMATE_STATUS);
outputVoltageDisplay = hatch_4.makeOutParameter(0, 0, OUTPUT_VOLTAGE_DISPLAY_NAME, POWER_STATUS);
popogaDisplay = hatch_4.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS);
outputCurrentDisplay = hatch_5.makeOutParameter(0, 0, OUTPUT_CURRENT_DISPLAY_NAME, POWER_STATUS);
energyCapacityDisplay = hatch_5.makeOutParameter(1, 0, ENERGY_CAPACITY_DISPLAY_NAME, ENERGY_STATUS);
energyStoredDisplay = hatch_6.makeOutParameter(0, 0, ENERGY_STORED_DISPLAY_NAME, ENERGY_STATUS);
energyFractionDisplay = hatch_6.makeOutParameter(1, 0, ENERGY_FRACTION_DISPLAY_NAME, ENERGY_STATUS);
- scanTimeDisplay = hatch_7.makeOutParameter(0, 0, SCAN_TIME_DISPLAY_NAME, SCAN_TIME_STATUS);
+ sortTimeDisplay = hatch_7.makeOutParameter(0, 0, SCAN_TIME_DISPLAY_NAME, SCAN_TIME_STATUS);
popogaDisplay = hatch_7.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS);
popogaDisplay = hatch_8.makeOutParameter(0, 0, POPOGA_NAME, POPOGA_STATUS);
popogaDisplay = hatch_8.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS);
@@ -523,6 +528,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
energyCapacity = aNBT.getLong("eEnergyCapacity");
+ teslaNodeSet.add(this);
}
@Override
@@ -532,23 +538,29 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
cap.getBaseMetaTileEntity().setActive(false);
}
+ ePowerPass = false;
setEUVar(0);
energyStoredDisplay.set(0);
energyFractionDisplay.set(0);
}
@Override
+ public void onFirstTick_EM(IGregTechTileEntity aBaseMetaTileEntity) {
+ super.onFirstTick_EM(aBaseMetaTileEntity);
+ if (!aBaseMetaTileEntity.isClientSide()) {
+ teslaNodeSet.add(this);
+ }
+ }
+
+ @Override
public boolean onRunningTick(ItemStack aStack) {
IGregTechTileEntity mte = getBaseMetaTileEntity();
//Hysteresis based ePowerPass setting
- long energyMax = maxEUStore() / 2;
- long energyStored = getEUVar();
+ float energyFrac = (float) getEUVar() / energyCapacity;
- float energyFrac = (float) energyStored / energyMax;
-
- energyCapacityDisplay.set(energyMax);
- energyStoredDisplay.set(energyStored);
+ energyCapacityDisplay.set(energyCapacity);
+ energyStoredDisplay.set(getEUVar());
energyFractionDisplay.set(energyFrac);
if (!ePowerPass && energyFrac > histHighSetting.get()) {
@@ -557,105 +569,16 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
ePowerPass = false;
}
- //Clean the eTeslaMap
- for (Map.Entry<IGregTechTileEntity, Integer> Rx : eTeslaMap.entrySet()) {
- IGregTechTileEntity node = Rx.getKey();
- if (node != null) {
- IMetaTileEntity nodeInside = node.getMetaTileEntity();
- try {
- if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && node.isActive()) {
- GT_MetaTileEntity_TM_teslaCoil teslaTower = (GT_MetaTileEntity_TM_teslaCoil) nodeInside;
- if (teslaTower.maxEUStore() > 0) {
- continue;
- }
- } else if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil) {
- GT_MetaTileEntity_TeslaCoil teslaTransceiver = (GT_MetaTileEntity_TeslaCoil) nodeInside;
- if (teslaTransceiver.mBatteryCount > 0) {
- continue;
- }
- } else if ((node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil) && node.getEUCapacity() > 0) {
- continue;
- }
- } catch (Exception e) {
- }
- }
- eTeslaMap.remove(Rx.getKey());
- }
-
- //Scan for transmission targets
- switch (scanTime) {
- case 0:
- scanTimeDisplay.updateStatus();
- scanForTransmissionTargets(scanPosOffsets[0], scanPosOffsets[1]);
- break;
- case 20:
- scanTimeDisplay.updateStatus();
- scanForTransmissionTargets(scanPosOffsets[2], scanPosOffsets[3]);
- break;
- case 40:
- scanTimeDisplay.updateStatus();
- scanForTransmissionTargets(scanPosOffsets[4], scanPosOffsets[5]);
- break;
- case 60:
- scanTimeDisplay.updateStatus();
- scanForTransmissionTargets(scanPosOffsets[6], scanPosOffsets[7]);
- break;
- case 80:
- scanTimeDisplay.updateStatus();
- scanForTransmissionTargets(scanPosOffsets[8], scanPosOffsets[9]);
- break;
- default:
- if (scanTime == (int) scanTimeMinSetting.get() - 1) {
- scanTime = -1;
-
- for (Map.Entry<IGregTechTileEntity, Integer> Rx : eTeslaMap.entrySet()) {
- IGregTechTileEntity node = Rx.getKey();
- if (node != null) {
- IMetaTileEntity nodeInside = node.getMetaTileEntity();
- try {
- if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil) {
- GT_MetaTileEntity_TeslaCoil teslaCoil = (GT_MetaTileEntity_TeslaCoil) nodeInside;
-
- int tX = node.getXCoord();
- int tY = node.getYCoord();
- int tZ = node.getZCoord();
-
- int tXN = posZap.get0();
- int tYN = posZap.get1();
- int tZN = posZap.get2();
-
- int tOffset = (int) Math.ceil(Math.sqrt(Math.pow(tX - tXN, 2) + Math.pow(tY - tYN, 2) + Math.pow(tZ - tZN, 2)));
- teslaCoil.eTeslaMap.put(mte, tOffset);
-
- for (Map.Entry<IGregTechTileEntity, Integer> RRx : eTeslaMap.entrySet()) {
- IGregTechTileEntity nodeN = RRx.getKey();
- if (nodeN == node) {
- continue;
- }
- tXN = nodeN.getXCoord();
- tYN = nodeN.getYCoord();
- tZN = nodeN.getZCoord();
- tOffset = (int) Math.ceil(Math.sqrt(Math.pow(tX - tXN, 2) + Math.pow(tY - tYN, 2) + Math.pow(tZ - tZN, 2)));
- if (tOffset > 20) {
- continue;
- }
- teslaCoil.eTeslaMap.put(nodeN, tOffset);
- }
- }
- } catch (Exception e) {
- eTeslaMap.remove(Rx.getKey());
- }
- }
- }
- }
- break;
+ //Create the teslaNodeMap
+ if (sortTime == sortTimeMinSetting.get()) {
+ sortTime = 0;
+ sortTimeDisplay.updateStatus();
+ generateTeslaNodeMap(this);
}
-
- scanTime++;
- scanTimeDisplay.set(scanTime);
+ sortTime++;
+ sortTimeDisplay.set(sortTime);
//Power Limit Settings
- long outputVoltage;
if (outputVoltageSetting.get() > 0) {
outputVoltage = min(outputVoltageMax, (long) outputVoltageSetting.get());
} else {
@@ -663,130 +586,48 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
}
outputVoltageDisplay.set(outputVoltage);
- long outputCurrent;
if (outputCurrentSetting.get() > 0) {
outputCurrent = min(outputCurrentMax, (long) outputCurrentSetting.get());
} else {
outputCurrent = outputCurrentMax;
}
- outputCurrentDisplay.set(0);
-
- //Stuff to do if ePowerPass
- if (ePowerPass) {
- //Range calculation and display
- float rangeFrac = (float) ((-0.5 * Math.pow(energyFrac, 2)) + (1.5 * energyFrac));
- int transferRadiusTower = (int) (transferRadiusTowerSetting.get() * getRangeMulti(mTier, vTier) * rangeFrac);
- transferRadiusTowerDisplay.set(transferRadiusTower);
- int transferRadiusTransceiver = (int) (transferRadiusTransceiverSetting.get() * getRangeMulti(mTier, vTier) * rangeFrac);
- transferRadiusTransceiverDisplay.set(transferRadiusTransceiver);
- int transferRadiusCoverUltimate = (int) (transferRadiusCoverUltimateSetting.get() * getRangeMulti(mTier, vTier) * rangeFrac);
- transferRadiusCoverUltimateDisplay.set(transferRadiusCoverUltimate);
-
- //Clean the eTeslaMap
- for (Map.Entry<IGregTechTileEntity, Integer> Rx : eTeslaMap.entrySet()) {
- IGregTechTileEntity node = Rx.getKey();
- if (node != null) {
- IMetaTileEntity nodeInside = node.getMetaTileEntity();
- try {
- if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && node.isActive()) {
- GT_MetaTileEntity_TM_teslaCoil teslaTower = (GT_MetaTileEntity_TM_teslaCoil) nodeInside;
- if (teslaTower.maxEUStore() > 0) {
- continue;
- }
- } else if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil) {
- GT_MetaTileEntity_TeslaCoil teslaCoil = (GT_MetaTileEntity_TeslaCoil) nodeInside;
- if (teslaCoil.getStoredEnergy()[1] > 0) {
- continue;
- }
- } else if ((node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil) && node.getEUCapacity() > 0) {
- continue;
- }
- } catch (Exception e) {
- }
- }
- eTeslaMap.remove(Rx.getKey());
- }
- //Power transfer
- long sparks = outputCurrent;
- while (sparks > 0) {
- boolean overdriveToggle = overDriveSetting.get() > 0;
- boolean idle = true;
- for (Map.Entry<IGregTechTileEntity, Integer> Rx : entriesSortedByValues(eTeslaMap)) {
- if (energyStored >= (overdriveToggle ? outputVoltage * 2 : outputVoltage)) {
- IGregTechTileEntity node = Rx.getKey();
- IMetaTileEntity nodeInside = node.getMetaTileEntity();
-
- long outputVoltageInjectable;
- long outputVoltageConsumption;
- if (overdriveToggle) {
- outputVoltageInjectable = outputVoltage;
- outputVoltageConsumption = getEnergyEfficiency(outputVoltage, Rx.getValue(), true);
- } else {
- outputVoltageInjectable = getEnergyEfficiency(outputVoltage, Rx.getValue(), false);
- outputVoltageConsumption = outputVoltage;
- }
-
- if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && Rx.getValue() <= transferRadiusTower) {
- GT_MetaTileEntity_TM_teslaCoil nodeTesla = (GT_MetaTileEntity_TM_teslaCoil) nodeInside;
- if (!nodeTesla.ePowerPass) {
- if (nodeTesla.getEUVar() + outputVoltageInjectable <= (nodeTesla.maxEUStore() / 2)) {
- setEUVar(getEUVar() - outputVoltageConsumption);
- node.increaseStoredEnergyUnits(outputVoltageConsumption, true);
- thaumLightning(mte, node);
- sparks--;
- idle = false;
- }
- }
- } else if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil && Rx.getValue() <= transferRadiusTransceiver) {
- GT_MetaTileEntity_TeslaCoil nodeTesla = (GT_MetaTileEntity_TeslaCoil) nodeInside;
- if (!nodeTesla.powerPassToggle) {
- if (node.injectEnergyUnits((byte) 6, outputVoltageInjectable, 1L) > 0L) {
- setEUVar(getEUVar() - outputVoltageConsumption);
- thaumLightning(mte, node);
- sparks--;
- idle = false;
- }
- }
- } else if ((node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil_Ultimate) && Rx.getValue() <= transferRadiusCoverUltimate) {
- if (node.injectEnergyUnits((byte) 1, outputVoltageInjectable, 1L) > 0L) {
- setEUVar(getEUVar() - outputVoltageConsumption);
- thaumLightning(mte, node);
- sparks--;
- idle = false;
- }
- }
- if (sparks == 0) {
- break;
- }
- } else {
- idle = true;
- break;
- }
- }
- if (idle) {
- break;
- }
- }
- outputCurrentDisplay.set(outputCurrent - sparks);
- if (scanTime % 60 == 0 && !sparkList.isEmpty()) {
- NetworkDispatcher.INSTANCE.sendToAllAround(new RendererMessage.RendererData(sparkList),
- mte.getWorld().provider.dimensionId,
- mte.getXCoord(),
- mte.getYCoord(),
- mte.getZCoord(),
- 256);
- }
- sparkList.clear();
- } else {
- outputCurrentDisplay.set(0);
+ //Range calculation and display
+ int transferRadiusTower = getTeslaTransmissionRange();
+ transferRadiusTowerDisplay.set(transferRadiusTower);
+ transferRadiusTransceiverDisplay.set(transferRadiusTower * 2);
+ transferRadiusCoverUltimateDisplay.set(transferRadiusTower);
+
+ //Clean the teslaNodeMap
+ cleanTeslaNodeMap(this);
+
+ //Power transfer
+ outputCurrentDisplay.set(powerTeslaNodeMap(this));
+
+ if (!sparkList.isEmpty()) {
+ NetworkDispatcher.INSTANCE.sendToAllAround(new RendererMessage.RendererData(sparkList),
+ mte.getWorld().provider.dimensionId,
+ posTop.get0(),
+ posTop.get1(),
+ posTop.get2(),
+ 256);
}
+ sparkList.clear();
+
return true;
}
@Override
public long maxEUStore() {
- return energyCapacity * 2;
+ //Setting the power here so that the tower looses all it's charge once disabled
+ //This also stops it from exploding
+ return getBaseMetaTileEntity().isActive() ? energyCapacity * 2 : 0;
+ }
+
+ @Override
+ public long getEUVar() {
+ //Same reason as maxEUStore, set to 1 instead of zero so it doesn't drain constantly
+ return getBaseMetaTileEntity().isActive() ? super.getEUVar() : 1;
}
private boolean addCapacitorToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
@@ -825,6 +666,14 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
return eParamHatches.add((GT_MetaTileEntity_Hatch_Param) aMetaTileEntity);
}
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity);
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity);
+ }
return false;
}
@@ -834,11 +683,95 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
@Override
public void construct(ItemStack stackSize, boolean hintsOnly) {
- Structure.builder(shape, blockType, blockMetas[(stackSize.stackSize - 1) % 6], 3, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly);
+ Structure.builder(shape, blockType, blockMetas[(stackSize.stackSize - 1) % 7], 3, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly);
}
@Override
public String[] getStructureDescription(ItemStack stackSize) {
return description;
}
-} \ No newline at end of file
+
+ @Override
+ public byte getTeslaReceptionCapability() {
+ return 0;
+ }
+
+ @Override
+ public float getTeslaReceptionCoefficient() {
+ return 0;
+ }
+
+ @Override
+ public byte getTeslaTransmissionCapability() {
+ return 1;
+ }
+
+ @Override
+ public int getTeslaTransmissionRange() {
+ return (int) (transferRadiusTowerSetting.get() * getRangeMulti(mTier, vTier));
+ }
+
+ @Override
+ public boolean isOverdriveEnabled() {
+ return overDriveSetting.get() > 0;
+ }
+
+ @Override
+ public int getTeslaEnergyLossPerBlock() {
+ return plasmaTierLoss[plasmaTier];
+ }
+
+ @Override
+ public float getTeslaOverdriveLossCoefficient() {
+ return overDriveLoss;
+ }
+
+ @Override
+ public long getTeslaOutputVoltage() {
+ return outputVoltage;
+ }
+
+ @Override
+ public long getTeslaOutputCurrent() {
+ return outputCurrent;
+ }
+
+ @Override
+ public boolean teslaDrainEnergy(long teslaVoltageDrained) {
+ if (getEUVar() < teslaVoltageDrained) {
+ return false;
+ }
+
+ setEUVar(getEUVar() - teslaVoltageDrained);
+ return true;
+ }
+
+ @Override
+ public boolean isTeslaReadyToReceive() {
+ return !this.ePowerPass;
+ }
+
+ @Override
+ public long getTeslaStoredEnergy() {
+ return getEUVar();
+ }
+
+ @Override
+ public Vec3Impl getTeslaPosition() {
+ return posTop;
+ }
+
+ @Override
+ public Integer getTeslaDimension() {
+ return this.getBaseMetaTileEntity().getWorld().provider.dimensionId;
+ }
+
+ @Override
+ public boolean teslaInjectEnergy(long teslaVoltageInjected) {
+ if (this.getEUVar() + teslaVoltageInjected <= (this.maxEUStore() / 2)) {
+ this.getBaseMetaTileEntity().increaseStoredEnergyUnits(teslaVoltageInjected, true);
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java
index 9e508f9e7e..9af6d40df7 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java
@@ -166,10 +166,11 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
}
@Override
- public void setExtendedFacing(ExtendedFacing alignment) {
- if(extendedFacing!=alignment){
- extendedFacing=alignment;
+ public void setExtendedFacing(ExtendedFacing newExtendedFacing) {
+ if(extendedFacing!=newExtendedFacing){
+ extendedFacing=newExtendedFacing;
IGregTechTileEntity base = getBaseMetaTileEntity();
+ mMachine = false;
if (getBaseMetaTileEntity().isServerSide()) {
NetworkDispatcher.INSTANCE.sendToAllAround(new AlignmentMessage.AlignmentData(this),
base.getWorld().provider.dimensionId,
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TeslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TeslaCoil.java
index ed36dec7cb..388a253b27 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TeslaCoil.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TeslaCoil.java
@@ -1,14 +1,14 @@
package com.github.technus.tectech.thing.metaTileEntity.single;
+import com.github.technus.tectech.mechanics.tesla.ITeslaConnectable;
import com.github.technus.tectech.util.CommonValues;
import com.github.technus.tectech.TecTech;
-import com.github.technus.tectech.util.Util;
import com.github.technus.tectech.loader.NetworkDispatcher;
import com.github.technus.tectech.mechanics.spark.RendererMessage;
import com.github.technus.tectech.mechanics.spark.ThaumSpark;
-import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil;
-import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil_Ultimate;
import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_TM_teslaCoil;
+import com.github.technus.tectech.util.Util;
+import com.github.technus.tectech.util.Vec3Impl;
import eu.usrv.yamcore.auxiliary.PlayerChatHelper;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -17,60 +17,47 @@ import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicBatteryBuffer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.reflect.FieldUtils;
import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
+import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.*;
import static com.github.technus.tectech.util.CommonValues.V;
-import static com.github.technus.tectech.util.Util.entriesSortedByValues;
-import static com.github.technus.tectech.util.Util.map;
import static com.github.technus.tectech.thing.metaTileEntity.Textures.*;
import static java.lang.Math.round;
import static net.minecraft.util.StatCollector.translateToLocal;
import static net.minecraft.util.StatCollector.translateToLocalFormatted;
+public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryBuffer implements ITeslaConnectable {
+ private final static int transferRadiusMax = TecTech.configTecTech.TESLA_SINGLE_RANGE;//Default is 20
+ private final static int perBlockLoss = TecTech.configTecTech.TESLA_SINGLE_LOSS_PER_BLOCK;//Default is 1
+ private final static float overDriveLoss = TecTech.configTecTech.TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE;//Default is 0.25F
-public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryBuffer {
- private final static HashSet<ThaumSpark> sparkList = new HashSet<>();
private byte sparkCount = 0;
- private int maxTier = 4; //Max tier of transceiver
- private int minTier = 0; //Min tier of transceiver
-
- public Map<IGregTechTileEntity, Integer> eTeslaMap = new HashMap<>();//Tesla Map to map them tesla bois!
-
- private int transferRadiusMax = 20;
- private int transferRadiusMin = 4;
- private int transferRadiusLimitTop = (int) map(mTier + 1, minTier + 1, maxTier + 1, transferRadiusMin, transferRadiusMax);
- private int transferRadiusLimitBottom = 1; //Minimum user configurable
- private int transferRadius = transferRadiusLimitTop; //Default transferRadius setting
- private int transferRadiusTower = 0; //Radius for transceiver to tower transfers
- private int transferRadiusCover = 0; //Radius for transceiver to cover transfers
-
- public boolean powerPassToggle = false; //Power Pass for public viewing
- private int histSteps = 20; //Hysteresis Resolution
- private int histSettingLow = 3; //Hysteresis Low Limit
- private int histSettingHigh = 15; //Hysteresis High Limit
- private int histLowLimit = 1; //How low can you configure it?
- private int histHighLimit = 19; //How high can you configure it?
- private float histLow = (float) histSettingLow / histSteps; //Power pass is disabled if power is under this fraction
- private float histHigh = (float) histSettingHigh / histSteps; //Power pass is enabled if power is over this fraction
-
- private long outputVoltage = V[mTier];
- private float minEfficiency = TecTech.configTecTech.TESLA_SINGLE_MIN_EFFICIENCY;//Default is 0.91F
- private float maxEfficiency = TecTech.configTecTech.TESLA_SINGLE_MAX_EFFICIENCY;//Default is 0.95F
- private float overdriveEfficiencyExtra = TecTech.configTecTech.TESLA_SINGLE_OVERDRIVE_LOSS;//Default is 0.010F
- private float energyEfficiency = map(mTier + 1, minTier + 1, maxTier + 1, minEfficiency, maxEfficiency);
- private float overdriveEfficiency = energyEfficiency - overdriveEfficiencyExtra;
+ private final static int transferRadiusMin = 4;//Minimum user configurable
+ private int transferRadius = transferRadiusMax;//Default transferRadius setting
+
+ public boolean powerPassToggle = false;//Power Pass for public viewing
+ private final static int histSteps = 20;//Hysteresis Resolution
+ private int histSettingLow = 3;//Hysteresis Low Limit
+ private int histSettingHigh = 15;//Hysteresis High Limit
+ private final static int histLowLimit = 1;//How low can you configure it?
+ private final static int histHighLimit = 19;//How high can you configure it?
+ private float histLow = (float) histSettingLow / histSteps;//Power pass is disabled if power is under this fraction
+ private float histHigh = (float) histSettingHigh / histSteps;//Power pass is enabled if power is over this fraction
+
+ private final long outputVoltage = V[mTier];
private boolean overdriveToggle = false;
private String clientLocale = "en_US";
+ private int sortTime = 0;//Sorting tick counter
+ private final static int sortTimeMax = 100;//Sorting tick counter limit, so we only sort once every 5 seconds
+
public GT_MetaTileEntity_TeslaCoil(int aID, String aName, String aNameRegional, int aTier, int aSlotCount) {
super(aID, aName, aNameRegional, aTier, "", aSlotCount);
Util.setTier(aTier, this);
@@ -128,11 +115,11 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB
@Override
public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
if (aPlayer.isSneaking()) {
- if (transferRadius > transferRadiusLimitBottom) {
+ if (transferRadius > transferRadiusMin) {
transferRadius--;
}
} else {
- if (transferRadius < 0) {
+ if (transferRadius < transferRadiusMax) {
transferRadius++;
}
}
@@ -174,13 +161,11 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB
@Override
public ITexture[][][] getTextureSet(ITexture[] aTextures) {
ITexture[][][] rTextures = new ITexture[3][17][];
-
for (byte i = -1; i < 16; ++i) {
rTextures[0][i + 1] = new ITexture[]{MACHINE_CASINGS_TT[this.mTier][i + 1]};
rTextures[1][i + 1] = new ITexture[]{MACHINE_CASINGS_TT[this.mTier][i + 1], TESLA_TRANSCEIVER_TOP_BA};
rTextures[2][i + 1] = new ITexture[]{MACHINE_CASINGS_TT[this.mTier][i + 1], this.mInventory.length == 16 ? OVERLAYS_ENERGY_OUT_POWER_TT[this.mTier] : (this.mInventory.length > 4 ? OVERLAYS_ENERGY_OUT_MULTI_TT[this.mTier] : OVERLAYS_ENERGY_OUT_TT[this.mTier])};
}
-
return rTextures;
}
@@ -220,15 +205,43 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB
sparkList.add(new ThaumSpark(x, y, z, xR, yR, zR, wID));
}
- private long getEnergyEfficiency(long voltage, int distance, boolean overDriveToggle) {
+ private long[] getOutputVoltage(long outputVoltage, int distance, boolean overDriveToggle) {
+ long outputVoltageInjectable;
+ long outputVoltageConsumption;
+
if (overDriveToggle) {
- return (long) ((voltage * 2) - (voltage * Math.pow(overdriveEfficiency, distance)));
+ outputVoltageInjectable = outputVoltage;
+ outputVoltageConsumption = outputVoltage + (distance * perBlockLoss) + (long) Math.round(overDriveLoss * outputVoltage);
} else {
- return (long) (voltage * Math.pow(energyEfficiency, distance));
+ outputVoltageInjectable = outputVoltage - (distance * perBlockLoss);
+ outputVoltageConsumption = outputVoltage;
+ }
+ return new long[]{outputVoltageInjectable, outputVoltageConsumption};
+ }
+
+ @Override
+ public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
+ super.onFirstTick(aBaseMetaTileEntity);
+ if (!aBaseMetaTileEntity.isClientSide()) {
+ teslaNodeSet.add(this);
}
}
@Override
+ public void onRemoval() {
+ super.onRemoval();
+ if (!this.getBaseMetaTileEntity().isClientSide()) {
+ teslaNodeSet.remove(this);
+ }
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ teslaNodeSet.add(this);
+ }
+
+ @Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPostTick(aBaseMetaTileEntity, aTick);
if (aBaseMetaTileEntity.isClientSide()) {
@@ -247,88 +260,16 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB
powerPassToggle = false;
}
- //Stuff to do if ePowerPass
- if (powerPassToggle) {
- float rangeFrac = (float) ((-0.5 * Math.pow(energyFrac, 2)) + (1.5 * energyFrac));
- long outputCurrent = mBatteryCount;
- transferRadiusTower = (int) (transferRadius * rangeFrac);
- transferRadiusCover = (int) (transferRadiusTower / 1.25);
-
- //Clean the eTeslaMap
- for (Map.Entry<IGregTechTileEntity, Integer> Rx : eTeslaMap.entrySet()) {
- IGregTechTileEntity node = Rx.getKey();
- if (node != null) {
- IMetaTileEntity nodeInside = node.getMetaTileEntity();
- try {
- if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && node.isActive()) {
- GT_MetaTileEntity_TM_teslaCoil teslaTower = (GT_MetaTileEntity_TM_teslaCoil) nodeInside;
- if (teslaTower.maxEUStore() > 0) {
- continue;
- }
- } else if ((node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil) && node.getEUCapacity() > 0) {
- continue;
- }
- } catch (Exception e) {
- }
- }
- eTeslaMap.remove(Rx.getKey());
- }
-
- //Power transfer
- while (outputCurrent > 0) {
- boolean idle = true;
- for (Map.Entry<IGregTechTileEntity, Integer> Rx : entriesSortedByValues(eTeslaMap)) {
- if (getEUVar() >= (overdriveToggle ? outputVoltage * 2 : outputVoltage)) {
- IGregTechTileEntity node = Rx.getKey();
- IMetaTileEntity nodeInside = node.getMetaTileEntity();
-
- long outputVoltageInjectable;
- long outputVoltageConsumption;
- if (overdriveToggle) {
- outputVoltageInjectable = outputVoltage;
- outputVoltageConsumption = getEnergyEfficiency(outputVoltage, Rx.getValue(), true);
- } else {
- outputVoltageInjectable = getEnergyEfficiency(outputVoltage, Rx.getValue(), false);
- outputVoltageConsumption = outputVoltage;
- }
- if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && Rx.getValue() <= transferRadiusTower) {
- GT_MetaTileEntity_TM_teslaCoil nodeTesla = (GT_MetaTileEntity_TM_teslaCoil) nodeInside;
- if (!nodeTesla.ePowerPass) {
- if (nodeTesla.getEUVar() + outputVoltageInjectable <= (nodeTesla.maxEUStore() / 2)) {
- setEUVar(getEUVar() - outputVoltageConsumption);
- node.increaseStoredEnergyUnits(outputVoltageInjectable, true);
- thaumLightning(aBaseMetaTileEntity, node);
- outputCurrent--;
- idle = false;
- }
- }
- } else if ((node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil) && !(node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil_Ultimate) && Rx.getValue() <= transferRadiusCover) {
- if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil){
- GT_MetaTileEntity_TeslaCoil nodeTesla = (GT_MetaTileEntity_TeslaCoil) nodeInside;
- if (nodeTesla.powerPassToggle){
- continue;
- }
- }
- if (node.injectEnergyUnits((byte) 1, outputVoltageInjectable, 1L) > 0L) {
- setEUVar(getEUVar() - outputVoltageConsumption);
- thaumLightning(aBaseMetaTileEntity, node);
- outputCurrent--;
- idle = false;
- }
- }
- if (outputCurrent == 0) {
- break;
- }
- } else {
- idle = true;
- break;
- }
- }
- if (idle) {
- break;
- }
- }
+ //Create the teslaNodeMap
+ if (sortTime == sortTimeMax) {
+ sortTime = 0;
+ generateTeslaNodeMap(this);
}
+ sortTime++;
+
+ //Send Power
+ powerTeslaNodeMap(this);
+
sparkCount++;
if (sparkCount == 60 && !sparkList.isEmpty()) {
sparkCount = 0;
@@ -357,4 +298,83 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB
return true;
}
+ @Override
+ public byte getTeslaReceptionCapability() {
+ return 1;
+ }
+
+ @Override
+ public float getTeslaReceptionCoefficient() {
+ return 1;
+ }
+
+ @Override
+ public byte getTeslaTransmissionCapability() {
+ return 2;
+ }
+
+ @Override
+ public int getTeslaTransmissionRange() {
+ return transferRadius;
+ }
+
+ @Override
+ public boolean isOverdriveEnabled() {
+ return overdriveToggle;
+ }
+
+ @Override
+ public int getTeslaEnergyLossPerBlock() {
+ return perBlockLoss;
+ }
+
+ @Override
+ public float getTeslaOverdriveLossCoefficient() {
+ return overDriveLoss;
+ }
+
+ @Override
+ public long getTeslaOutputVoltage() {
+ return outputVoltage;
+ }
+
+ @Override
+ public long getTeslaOutputCurrent() {
+ return mBatteryCount;
+ }
+
+ @Override
+ public boolean teslaDrainEnergy(long teslaVoltageDrained) {
+ if (getEUVar() < teslaVoltageDrained) {
+ return false;
+ }
+
+ setEUVar(getEUVar() - teslaVoltageDrained);
+ return true;
+ }
+
+ @Override
+ public boolean isTeslaReadyToReceive() {
+ return !this.powerPassToggle;
+ }
+
+ @Override
+ public long getTeslaStoredEnergy() {
+ return getEUVar();
+ }
+
+ @Override
+ public Vec3Impl getTeslaPosition() {
+ return new Vec3Impl(this.getBaseMetaTileEntity());
+ }
+
+ @Override
+ public Integer getTeslaDimension() {
+ return this.getBaseMetaTileEntity().getWorld().provider.dimensionId;
+ }
+
+ @Override
+ public boolean teslaInjectEnergy(long teslaVoltageInjected) {
+ return this.getBaseMetaTileEntity().injectEnergyUnits((byte) 1, teslaVoltageInjected, 1L) > 0L;
+ }
}
diff --git a/src/main/java/com/github/technus/tectech/util/Util.java b/src/main/java/com/github/technus/tectech/util/Util.java
index 8c693620b6..1843770e3a 100644
--- a/src/main/java/com/github/technus/tectech/util/Util.java
+++ b/src/main/java/com/github/technus/tectech/util/Util.java
@@ -40,6 +40,7 @@ public final class Util {
private Util() {
}
+ @SuppressWarnings("ComparatorMethodParameterNotUsed")
public static <K, V extends Comparable<? super V>> SortedSet<Map.Entry<K, V>> entriesSortedByValues(Map<K, V> map) {
SortedSet<Map.Entry<K, V>> sortedEntries = new TreeSet<>(
(e1, e2) -> {
diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_6.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_6.png
new file mode 100644
index 0000000000..833597130b
--- /dev/null
+++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_6.png
Binary files differ
diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_TOP_BOTTOM_6.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_TOP_BOTTOM_6.png
new file mode 100644
index 0000000000..de4ce136e7
--- /dev/null
+++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_TOP_BOTTOM_6.png
Binary files differ
diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang
index 3b8bc433ed..dc4af9970b 100644
--- a/src/main/resources/assets/tectech/lang/en_US.lang
+++ b/src/main/resources/assets/tectech/lang/en_US.lang
@@ -64,6 +64,8 @@ item.tm.teslaCoilCapacitor.1.name=MV Tesla Capacitor
item.tm.teslaCoilCapacitor.2.name=HV Tesla Capacitor
item.tm.teslaCoilCapacitor.3.name=EV Tesla Capacitor
item.tm.teslaCoilCapacitor.4.name=IV Tesla Capacitor
+item.tm.teslaCoilCapacitor.5.name=LuV Tesla Capacitor
+item.tm.teslaCoilCapacitor.6.name=ZPM Tesla Capacitor
item.tm.teslaCoilCapacitor.desc.0=Stores
item.tm.teslaCoilCapacitor.desc.1=EU in a tesla tower at
item.tm.teslaCoilCapacitor.desc.2=Yeet this broken item into some spicy water!
@@ -518,6 +520,7 @@ gt.blockcasingsBA0.2.name=HV Superconductor Primary Tesla Windings
gt.blockcasingsBA0.3.name=EV Superconductor Primary Tesla Windings
gt.blockcasingsBA0.4.name=IV Superconductor Primary Tesla Windings
gt.blockcasingsBA0.5.name=LuV Superconductor Primary Tesla Windings
+gt.blockcasingsBA0.9.name=ZPM Superconductor Primary Tesla Windings
gt.blockcasingsBA0.0.desc.0=Handles up to
gt.blockcasingsBA0.0.desc.1=What one man calls God, another calls the laws of physics.
gt.blockcasingsBA0.6.name=Tesla Base Casing
diff --git a/src/main/resources/assets/tectech/textures/items/itemCapacitorLuV.png b/src/main/resources/assets/tectech/textures/items/itemCapacitorLuV.png
new file mode 100644
index 0000000000..0801e3f0d7
--- /dev/null
+++ b/src/main/resources/assets/tectech/textures/items/itemCapacitorLuV.png
Binary files differ
diff --git a/src/main/resources/assets/tectech/textures/items/itemCapacitorZPM.png b/src/main/resources/assets/tectech/textures/items/itemCapacitorZPM.png
new file mode 100644
index 0000000000..29b30dc63e
--- /dev/null
+++ b/src/main/resources/assets/tectech/textures/items/itemCapacitorZPM.png
Binary files differ