aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/api
diff options
context:
space:
mode:
authorGlodBlock <1356392126@qq.com>2021-11-14 00:52:31 +0800
committerGlodBlock <1356392126@qq.com>2021-11-14 00:52:31 +0800
commit233181e78afc26be0a60acee88f601198a70be00 (patch)
treedad697e333d8cce34f4a937aa2f5df3228b1d443 /src/Java/gtPlusPlus/xmod/gregtech/api
parent01f920644376e0d056b09fd6203035936af4e9ba (diff)
downloadGT5-Unofficial-233181e78afc26be0a60acee88f601198a70be00.tar.gz
GT5-Unofficial-233181e78afc26be0a60acee88f601198a70be00.tar.bz2
GT5-Unofficial-233181e78afc26be0a60acee88f601198a70be00.zip
structurelib interation
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java38
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_TreeFarmer.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_TreeFarmer.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java211
5 files changed, 110 insertions, 147 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
index 9e62d05df2..8066c82862 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
@@ -227,18 +227,18 @@ public enum GregtechItemList implements GregtechItemContainer {
//LFTR
- ThoriumReactor,
+ /*ThoriumReactor,*/
Casing_Reactor_I,
Casing_Reactor_II,
//Multitank
- Industrial_MultiTank,
+ /*Industrial_MultiTank,*/
Industrial_MultiTankDense,
Casing_MultitankExterior,
//Fission Fuel Refinery
- Industrial_FuelRefinery,
+ /*Industrial_FuelRefinery,*/
Casing_Refinery_External,
Casing_Refinery_Structural,
Casing_Refinery_Internal,
@@ -266,7 +266,7 @@ public enum GregtechItemList implements GregtechItemContainer {
//Tree Farm
- Industrial_TreeFarm,
+ /*Industrial_TreeFarm, */
TreeFarmer_Structural,
Casing_PLACEHOLDER_TreeFarmer,
@@ -292,7 +292,7 @@ public enum GregtechItemList implements GregtechItemContainer {
//Generator Array
- Generator_Array_Controller,
+ /*Generator_Array_Controller, */
//Cutting Factory Controller
@@ -301,7 +301,7 @@ public enum GregtechItemList implements GregtechItemContainer {
//Tesla Tower
- TelsaTower,
+ /*TelsaTower,*/
Casing_TeslaTower,
@@ -316,9 +316,9 @@ public enum GregtechItemList implements GregtechItemContainer {
//Bedrock Mining Platforms
- BedrockMiner_MKI,
- BedrockMiner_MKII,
- BedrockMiner_MKIII,
+ /*BedrockMiner_MKI, */
+ /*BedrockMiner_MKII, */
+ /*BedrockMiner_MKIII, */
Casing_BedrockMiner,
@@ -334,7 +334,7 @@ public enum GregtechItemList implements GregtechItemContainer {
Machine_Adv_DistillationTower,
//Advanced Assembly Line
- Machine_Adv_AssemblyLine,
+ /*Machine_Adv_AssemblyLine,*/
//Advanced Vacuum Freezer
Industrial_Cryogenic_Freezer,
@@ -355,7 +355,7 @@ public enum GregtechItemList implements GregtechItemContainer {
Casing_Naq_Reactor_A,
Casing_Naq_Reactor_B,
Casing_Naq_Reactor_C,
- Controller_Naq_Reactor,
+ /*Controller_Naq_Reactor, */
Casing_Containment,
//Arc Furnace
@@ -363,13 +363,13 @@ public enum GregtechItemList implements GregtechItemContainer {
Casing_Industrial_Arc_Furnace,
//Solar Tower
- Industrial_Solar_Tower,
+ /*Industrial_Solar_Tower,*/
Casing_SolarTower_Structural,
Casing_SolarTower_SaltContainment,
Casing_SolarTower_HeatContainment,
//Larger Turbines
- Large_Steam_Turbine, Large_HPSteam_Turbine,
+ /*Large_Steam_Turbine, Large_HPSteam_Turbine, */
Casing_Turbine_Shaft,
Casing_Turbine_LP, Casing_Turbine_HP,
Casing_Turbine_Gas, Casing_Turbine_Plasma,
@@ -398,7 +398,7 @@ public enum GregtechItemList implements GregtechItemContainer {
Controller_Flotation_Cell,
// Elemental Duplicator
- Controller_ElementalDuplicator,
+ /*Controller_ElementalDuplicator,*/
Casing_ElementalDuplicator,
// Big Steam Macerator
@@ -427,7 +427,7 @@ public enum GregtechItemList implements GregtechItemContainer {
Hatch_Air_Intake,
//XL Turbine Rotor Hatch
- Hatch_Turbine_Rotor,
+ /*Hatch_Turbine_Rotor,*/
//Standard Turbine Rotor Hatch
Hatch_Input_TurbineHousing,
@@ -452,7 +452,7 @@ public enum GregtechItemList implements GregtechItemContainer {
Hatch_Output_Bus_Steam,
//Elemental Duplicator Data Orb Bus
- Hatch_Input_Elemental_Duplicator,
+ /*Hatch_Input_Elemental_Duplicator,*/
//RTG Hatch
Hatch_RTG_LV,
@@ -556,7 +556,7 @@ public enum GregtechItemList implements GregtechItemContainer {
SimpleDustWasher_UV,
//Solar Tower Reflector
- Solar_Tower_Reflector,
+ /*Solar_Tower_Reflector,*/
//Super Tier Chests
Super_Chest_LV, Super_Chest_MV, Super_Chest_HV, Super_Chest_EV, Super_Chest_IV,
@@ -572,7 +572,7 @@ public enum GregtechItemList implements GregtechItemContainer {
//Tiny Fusion
- Miniature_Fusion,
+ /*Miniature_Fusion, */
//Component Makers
@@ -696,7 +696,7 @@ public enum GregtechItemList implements GregtechItemContainer {
RTG,
//Plasma Tank
- Plasma_Tank,
+ /*Plasma_Tank,*/
//----------------------------------------------------------------------------
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_TreeFarmer.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_TreeFarmer.java
index e7776fca46..0a8624354b 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_TreeFarmer.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_TreeFarmer.java
@@ -1,3 +1,4 @@
+/*
package gtPlusPlus.xmod.gregtech.api.gui;
import java.util.List;
@@ -67,4 +68,4 @@ public class CONTAINER_TreeFarmer extends GT_ContainerMetaTile_Machine {
}
}
-} \ No newline at end of file
+}*/
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_TreeFarmer.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_TreeFarmer.java
index d00a30673f..762dcbf640 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_TreeFarmer.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_TreeFarmer.java
@@ -1,3 +1,4 @@
+/*
package gtPlusPlus.xmod.gregtech.api.gui;
@@ -43,3 +44,4 @@ public class GUI_TreeFarmer extends GT_GUIContainerMetaTile_Machine {
this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
}
}
+*/
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java
index bead570558..a9cd179214 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java
@@ -1,3 +1,4 @@
+/*
package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations;
import gregtech.api.GregTech_API;
@@ -312,4 +313,4 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch {
-} \ No newline at end of file
+}*/
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
index e4a6907335..19b98be9d3 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
@@ -1,5 +1,7 @@
package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base;
+import com.gtnewhorizon.structurelib.StructureLibAPI;
+import com.gtnewhorizon.structurelib.structure.IStructureElement;
import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Materials;
@@ -55,10 +57,13 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;
import java.util.concurrent.TimeUnit;
+import java.util.function.BiConsumer;
+import java.util.function.BiPredicate;
+import java.util.function.Function;
import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
-public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_MultiBlockBase {
+public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_EnhancedMultiBlockBase<T>> extends GT_MetaTileEntity_EnhancedMultiBlockBase<T> {
public static final boolean DEBUG_DISABLE_CORES_TEMPORARILY = true;
@@ -302,108 +307,6 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult
public final static String TAG_HIDE_POLLUTION = "TAG_HIDE_POLLUTION";
public final static String TAG_HIDE_MACHINE_TYPE = "TAG_HIDE_MACHINE_TYPE";
- @Override
- public final String[] getDescription() {
- /*if (aCachedToolTip != null) {
- boolean uuuu = false;
- for (String s : aCachedToolTip) {
- if (s.toLowerCase().contains(".")) {
- uuuu = true;
- break;
- }
- }
- if (!uuuu) {
- return aCachedToolTip;
- }
- else {
- aCachedToolTip = null;
- }
- }*/
-
- String aRequiresMuffler = "1x Muffler Hatch";
- //String aRequiresCoreModule = "1x Core Module";
- String aRequiresMaint = "1x Maintenance Hatch";
-
- String[] x = getTooltip();
-
- //Filter List, toggle switches, rebuild map without flags
- boolean showHatches = true;
- boolean showMachineType = true;
- boolean showMaint = true;
- boolean showPollution = getPollutionPerTick(null) > 0;
- AutoMap<String> aTempMap = new AutoMap<String>();
- for (int ee = 0; ee < x.length; ee++) {
- String hh = x[ee];
- if (hh.equals(TAG_HIDE_HATCHES)) {
- showHatches = false;
- }
- else if (hh.equals(TAG_HIDE_POLLUTION)) {
- showPollution = false;
- }
- else if (hh.equals(TAG_HIDE_MACHINE_TYPE)) {
- showMachineType = false;
- }
- else if (hh.equals(TAG_HIDE_MAINT)) {
- showMaint = false;
- }
- else {
- aTempMap.put(x[ee]);
- }
- }
- //Rebuild
- x = new String[aTempMap.size()];
- for (int ee = 0; ee < x.length; ee++) {
- x[ee] = aTempMap.get(ee);
- }
-
-
- //Assemble ordered map for misc tooltips
- AutoMap<String> aOrderedMap = new AutoMap<String>();
- if (showHatches) {
- //aOrderedMap.put(aRequiresCoreModule);
- if (showPollution) {
- aOrderedMap.put(aRequiresMuffler);
- }
- if (showMaint) {
- aOrderedMap.put(aRequiresMaint);
- }
- }
-
- if (showMachineType) {
- aOrderedMap.put(getMachineTooltip());
- }
-
- if (showPollution) {
- aOrderedMap.put(getPollutionTooltip());
- }
-
-
-
-
-
- //Add Stock Tooltip to bottom of list
- String[] z;
- z = new String[aOrderedMap.size()];
- for (int ee = 0; ee < z.length; ee++) {
- z[ee] = aOrderedMap.get(ee);
- }
-
- int a2, a3;
- a2 = x != null ? x.length : 0;
- a3 = z != null ? z.length : 0;
- String[] aToolTip = new String[(a2 + a3)];
- aToolTip = ArrayUtils.addAll(aToolTip, x);
- aToolTip = ArrayUtils.addAll(aToolTip, z);
-
- //Valid Cached Tooltip during Run-Time
- if (aCachedToolTip == null || aCachedToolTip.length <= 0 || aCachedToolTip.length != aToolTip.length || this.mTotalRunTime % 100 == 0) {
- aCachedToolTip = aToolTip;
- }
- return aCachedToolTip;
- }
-
- public abstract String[] getTooltip();
-
public synchronized final MultiblockRequirements getRequirements() {
return mRequirements;
}
@@ -813,6 +716,25 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult
return checkRecipeGeneric(tItemInputs, tFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll);
}
+ public boolean checkRecipeGeneric(GT_Recipe aRecipe,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll, boolean isPerfectOC) {
+ if (aRecipe == null) {
+ return false;
+ }
+ ArrayList<ItemStack> tItems = getStoredInputs();
+ ArrayList<FluidStack> tFluids = getStoredFluids();
+ ItemStack[] tItemInputs = tItems.toArray(new ItemStack[tItems.size()]);
+ FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]);
+ return checkRecipeGeneric(tItemInputs, tFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, aRecipe, isPerfectOC);
+ }
+
+ public boolean checkRecipeGeneric(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll) {
+ return checkRecipeGeneric(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, null, false);
+ }
public boolean checkRecipeGeneric(GT_Recipe aRecipe,
int aMaxParallelRecipes, int aEUPercent,
@@ -824,14 +746,14 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult
ArrayList<FluidStack> tFluids = getStoredFluids();
ItemStack[] tItemInputs = tItems.toArray(new ItemStack[tItems.size()]);
FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]);
- return checkRecipeGeneric(tItemInputs, tFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, aRecipe);
+ return checkRecipeGeneric(tItemInputs, tFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, aRecipe, false);
}
public boolean checkRecipeGeneric(
ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
int aMaxParallelRecipes, int aEUPercent,
- int aSpeedBonusPercent, int aOutputChanceRoll) {
- return checkRecipeGeneric(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, null);
+ int aSpeedBonusPercent, int aOutputChanceRoll, boolean isPerfectOC) {
+ return checkRecipeGeneric(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, null, isPerfectOC);
}
@@ -985,7 +907,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult
public boolean checkRecipeGeneric(
ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
int aMaxParallelRecipes, int aEUPercent,
- int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) {
+ int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isPerpectOC) {
// Based on the Processing Array. A bit overkill, but very flexible.
// Reset outputs and progress stats
@@ -1110,7 +1032,8 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult
} else {
while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
this.mEUt *= 4;
- this.mMaxProgresstime /= 2;
+ if (isPerpectOC) this.mMaxProgresstime /= 4;
+ else this.mMaxProgresstime /= 2;
}
}
@@ -2237,15 +2160,6 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult
return 0;
}
- public String getPollutionTooltip() {
- if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) {
- return "Causes " + 20 * this.getPollutionPerTick(null) + " Pollution per second";
- }
- else {
- return "";
- }
- }
-
private static Method calculatePollutionReduction = null;
public int calculatePollutionReductionForHatch(GT_MetaTileEntity_Hatch_Muffler i , int g) {
if (calculatePollutionReduction != null) {
@@ -2499,15 +2413,6 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult
return true;
}
- public final boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- boolean aStructureCheck = checkMultiblock(aBaseMetaTileEntity, aStack);
- boolean aHasCore = DEBUG_DISABLE_CORES_TEMPORARILY; //(requireControlCores ? (this.getControlCoreBus() != null) : true);
- return aStructureCheck && aHasCore;
- }
-
- public abstract boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack);
-
-
public boolean isValidBlockForStructure(IGregTechTileEntity aBaseMetaTileEntity, int aCasingID, boolean canBeHatch,
Block aFoundBlock, int aFoundMeta, Block aExpectedBlock, int aExpectedMeta) {
boolean isHatch = false;
@@ -2627,7 +2532,61 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult
}*/
}
+ //Only support to use meta to tier
+ public static <T> IStructureElement<T> addTieredBlock(Block aBlock, BiConsumer<T, Integer> aSetTheFuckingMeta, Function<T, Integer> aGetTheFuckingMeta, int maxMeta) {
+ return addTieredBlock(aBlock, (t, i) -> {
+ aSetTheFuckingMeta.accept(t, i);
+ return true;
+ }, aGetTheFuckingMeta, 0, maxMeta
+ );
+ }
+
+ public static <T> IStructureElement<T> addTieredBlock(Block aBlock, BiConsumer<T, Integer> aSetTheFuckingMeta, Function<T, Integer> aGetTheFuckingMeta, int minMeta, int maxMeta) {
+ return addTieredBlock(aBlock, (t, i) -> {
+ aSetTheFuckingMeta.accept(t, i);
+ return true;
+ }, aGetTheFuckingMeta, minMeta, maxMeta
+ );
+ }
+
+ public static <T> IStructureElement<T> addTieredBlock(Block aBlock, BiPredicate<T, Integer> aSetTheFuckingMeta, Function<T, Integer> aGetTheFuckingMeta, int minMeta, int maxMeta) {
+
+ return new IStructureElement<T>() {
+ @Override
+ public boolean check(T t, World world, int x, int y, int z) {
+ Block tBlock = world.getBlock(x, y, z);
+ if (aBlock == tBlock) {
+ Integer currentMeta = aGetTheFuckingMeta.apply(t);
+ int newMeta = tBlock.getDamageValue(world, x, y, z) + 1;
+ if (newMeta > maxMeta || newMeta < minMeta + 1) return false;
+ if (currentMeta == 0) {
+ return aSetTheFuckingMeta.test(t, newMeta);
+ } else {
+ return currentMeta == newMeta;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ StructureLibAPI.hintParticle(world, x, y, z, aBlock, getMeta(trigger));
+ return true;
+ }
+
+ @Override
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return world.setBlock(x, y, z, aBlock, getMeta(trigger), 3);
+ }
+ private int getMeta(ItemStack trigger) {
+ int meta = trigger.stackSize;
+ if (meta <= 0) meta = minMeta;
+ if (meta + minMeta > maxMeta) meta = maxMeta - 1;
+ return meta;
+ }
+ };
+ }
}