Skip to content

Commit ce2803e

Browse files
authored
Merge branch 'master' into zb-lotsa-mui2
2 parents b82aff5 + cec4b75 commit ce2803e

File tree

408 files changed

+5370
-22677
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

408 files changed

+5370
-22677
lines changed

dependencies.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
dependencies {
4141
// Published dependencies
4242
api("codechicken:codechickenlib:3.2.3.358")
43-
api("com.cleanroommc:modularui:2.5.0-rc1") { transitive = false }
44-
api("com.cleanroommc:groovyscript:1.1.1") { transitive = false }
43+
api("com.cleanroommc:modularui:2.5.0-rc2") { transitive = false }
44+
api("com.cleanroommc:groovyscript:1.2.0-hotfix1") { transitive = false }
4545
api("CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-4.1.20.700")
4646
api("appeng:ae2-uel:v0.56.4") { transitive = false }
4747
api rfg.deobf("curse.maven:ctm-267602:2915363") // CTM 1.0.2.31
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package meldexun.nothirium.api.renderer.chunk;
2+
3+
/**
4+
* Adapted and minimized from <a
5+
* href="https://github.com/Meldexun/Nothirium/blob/main/src/main/java/meldexun/nothirium/api/renderer/chunk/ChunkRenderPass.java">ChunkRenderPass.java</a>
6+
*/
7+
public enum ChunkRenderPass {
8+
;
9+
10+
public static final ChunkRenderPass[] ALL = ChunkRenderPass.values();
11+
12+
}

src/main/java/gregtech/GregTechMod.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
dependencies = "required:forge@[14.23.5.2847,);" + "required-after:codechickenlib@[3.2.3,);" +
3434
"required-after:modularui@[2.3,);" + "required-after:mixinbooter@[8.0,);" + "after:appliedenergistics2;" +
3535
"after:forestry;" + "after:extrabees;" + "after:extratrees;" + "after:genetics;" + "after:magicbees;" +
36-
"after:jei@[4.15.0,);" + "after:crafttweaker@[4.1.20,);" + "after:groovyscript@[1.1.0,);" +
36+
"after:jei@[4.15.0,);" + "after:crafttweaker@[4.1.20,);" + "after:groovyscript@[1.2.0,);" +
3737
"after:theoneprobe;" + "after:hwyla;")
3838
public class GregTechMod {
3939

src/main/java/gregtech/api/GTValues.java

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class GTValues {
5454
* The Voltage Tiers. Use this Array instead of the old named Voltage Variables
5555
*/
5656
public static final long[] V = { 8, 32, 128, 512, 2048, 8192, 32768, 131072, 524288, 2097152, 8388608, 33554432,
57-
134217728, 536870912, Integer.MAX_VALUE };
57+
134217728, 536870912, 2147483648L };
5858

5959
/**
6060
* The Voltage Tiers divided by 2.
@@ -78,10 +78,10 @@ public class GTValues {
7878
* The Voltage Tiers extended all the way to max Long value for overclocking
7979
*/
8080
public static final long[] VOC = { 8, 32, 128, 512, 2048, 8192, 32768, 131072, 524288, 2097152, 8388608, 33554432,
81-
134217728, 536870912, Integer.MAX_VALUE, 8589934592L, 34359738368L, 137438953472L, 549755813888L,
82-
2199023255552L,
83-
8796093022208L, 35184372088832L, 140737488355328L, 562949953421312L, 2251799813685248L, 9007199254740992L,
84-
36028797018963968L, 144115188075855872L, 576460752303423488L, 2305843009213693952L, Long.MAX_VALUE };
81+
134217728, 536870912, 2147483648L, 8589934592L, 34359738368L, 137438953472L, 549755813888L,
82+
2199023255552L, 8796093022208L, 35184372088832L, 140737488355328L, 562949953421312L, 2251799813685248L,
83+
9007199254740992L, 36028797018963968L, 144115188075855872L, 576460752303423488L, 2305843009213693952L,
84+
Long.MAX_VALUE };
8585

8686
public static final int ULV = 0;
8787
public static final int LV = 1;
@@ -105,14 +105,33 @@ public class GTValues {
105105
* The short names for the voltages, used for registration primarily
106106
*/
107107
public static final String[] VN = new String[] { "ULV", "LV", "MV", "HV", "EV", "IV", "LuV", "ZPM", "UV", "UHV",
108-
"UEV", "UIV", "UXV", "OpV", "MAX", "MAX+" };
108+
"UEV", "UIV", "UXV", "OpV", "MAX" };
109109

110110
/**
111-
* The short names for the voltages, formatted for text
111+
* The short names for the voltages, up to max Long, used for registration primarily
112112
*/
113-
public static final String MAX_PLUS = RED.toString() + BOLD + "M" + YELLOW + BOLD + "A" + GREEN + BOLD + "X" +
113+
public static final String[] VOCN = new String[] { "ULV", "LV", "MV", "HV", "EV", "IV", "LuV", "ZPM", "UV", "UHV",
114+
"UEV", "UIV", "UXV", "OpV", "MAX", "MAX+1", "MAX+2", "MAX+3", "MAX+4", "MAX+5", "MAX+6", "MAX+7", "MAX+8",
115+
"MAX+9", "MAX+10", "MAX+11", "MAX+12", "MAX+13", "MAX+14", "MAX+15", "MAX+16",
116+
};
117+
118+
private static final String MAX_PLUS = RED.toString() + BOLD + "M" + YELLOW + BOLD + "A" + GREEN + BOLD + "X" +
114119
AQUA + BOLD + "+" + LIGHT_PURPLE + BOLD;
120+
121+
/**
122+
* The short names for the voltages, formatted for text
123+
*/
115124
public static final String[] VNF = new String[] {
125+
DARK_GRAY + "ULV", GRAY + "LV", AQUA + "MV",
126+
GOLD + "HV", DARK_PURPLE + "EV", DARK_BLUE + "IV",
127+
LIGHT_PURPLE + "LuV", RED + "ZPM", DARK_AQUA + "UV",
128+
DARK_RED + "UHV", GREEN + "UEV", DARK_GREEN + "UIV",
129+
YELLOW + "UXV", BLUE + "OpV", RED.toString() + BOLD + "MAX" };
130+
131+
/**
132+
* The short names for the voltages, up to max Long, formatted for text
133+
*/
134+
public static final String[] VOCNF = new String[] {
116135
DARK_GRAY + "ULV", GRAY + "LV", AQUA + "MV",
117136
GOLD + "HV", DARK_PURPLE + "EV", DARK_BLUE + "IV",
118137
LIGHT_PURPLE + "LuV", RED + "ZPM", DARK_AQUA + "UV",

src/main/java/gregtech/api/capability/GregtechCapabilities.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import gregtech.api.GTValues;
44
import gregtech.api.capability.impl.EUToFEProvider;
5-
import gregtech.api.terminal.hardware.HardwareProvider;
65
import gregtech.api.util.GTUtility;
76
import gregtech.common.metatileentities.converter.ConverterTrait;
87

@@ -26,9 +25,6 @@ public class GregtechCapabilities {
2625
@CapabilityInject(IMultiblockController.class)
2726
public static Capability<IMultiblockController> CAPABILITY_MULTIBLOCK_CONTROLLER = null;
2827

29-
@CapabilityInject(HardwareProvider.class)
30-
public static Capability<HardwareProvider> CAPABILITY_HARDWARE_PROVIDER = null;
31-
3228
@CapabilityInject(ConverterTrait.class)
3329
public static Capability<ConverterTrait> CAPABILITY_CONVERTER = null;
3430

src/main/java/gregtech/api/capability/GregtechDataCodes.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ public static int assignId() {
140140
public static final int UPDATE_ITEM_COUNT = assignId();
141141
public static final int UPDATE_FLUID_AMOUNT = assignId();
142142

143+
// Quantum Storage Controller
144+
public static final int UPDATE_CONTROLLER_POS = assignId();
145+
public static final int REMOVE_CONTROLLER = assignId();
146+
public static final int LOCATE_CONTROLLER = assignId();
147+
143148
// Detector Covers
144149
public static final int UPDATE_INVERTED = assignId();
145150

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package gregtech.api.capability;
2+
3+
import net.minecraftforge.items.IItemHandler;
4+
5+
public interface IDualHandler {
6+
7+
boolean hasFluidTanks();
8+
9+
boolean hasItemHandlers();
10+
11+
IMultipleTankHandler getFluidTanks();
12+
13+
IItemHandler getItemHandlers();
14+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package gregtech.api.capability;
2+
3+
import net.minecraft.util.math.BlockPos;
4+
import net.minecraftforge.common.capabilities.ICapabilityProvider;
5+
6+
// ICapabilityProvider is needed because getCapability is called in the quantum proxy against this interface
7+
public interface IQuantumController extends ICapabilityProvider {
8+
9+
/**
10+
* Constructs the network upon placement and when storages are added/removed
11+
* <br />
12+
*/
13+
void rebuildNetwork();
14+
15+
/**
16+
* Return whether this storage block can connect. Can be used to implement a maximum distance from controller for
17+
* example.
18+
*/
19+
boolean canConnect(IQuantumStorage<?> storage);
20+
21+
BlockPos getPos();
22+
23+
IDualHandler getHandler();
24+
25+
boolean isPowered();
26+
27+
long getEnergyUsage();
28+
29+
int getCount(IQuantumStorage.Type type);
30+
31+
long getTypeEnergy(IQuantumStorage<?> storage);
32+
33+
void updateHandler();
34+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
package gregtech.api.capability;
2+
3+
import gregtech.api.cover.CoverableView;
4+
import gregtech.api.metatileentity.MetaTileEntity;
5+
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
6+
7+
import net.minecraft.util.EnumFacing;
8+
import net.minecraft.util.math.BlockPos;
9+
10+
import org.jetbrains.annotations.Nullable;
11+
12+
public interface IQuantumStorage<T> extends CoverableView {
13+
14+
Type getType();
15+
16+
void setConnected(IQuantumController controller);
17+
18+
void setDisconnected();
19+
20+
BlockPos getControllerPos();
21+
22+
@Nullable
23+
IQuantumController getQuantumController();
24+
25+
BlockPos getPos();
26+
27+
default boolean isConnected() {
28+
// use controllerPos here because it is synced
29+
// on both sides, where controller is not
30+
return getControllerPos() != null;
31+
}
32+
33+
default void tryFindNetwork() {
34+
for (EnumFacing facing : EnumFacing.VALUES) {
35+
var offset = getPos().offset(facing);
36+
var state = getWorld().getBlockState(offset);
37+
if (state.getBlock().isAir(state, getWorld(), offset)) continue;
38+
MetaTileEntity mte;
39+
if (getNeighbor(facing) instanceof IGregTechTileEntity gtte) {
40+
mte = gtte.getMetaTileEntity();
41+
} else {
42+
continue;
43+
}
44+
45+
IQuantumController candidate = null;
46+
if (mte instanceof IQuantumStorage<?>storage) {
47+
if (storage.isConnected()) {
48+
IQuantumController controller = storage.getQuantumController();
49+
if (controller != null && controller.canConnect(this)) {
50+
candidate = controller;
51+
}
52+
}
53+
} else if (mte instanceof IQuantumController quantumController) {
54+
if (quantumController.canConnect(this)) {
55+
candidate = quantumController;
56+
}
57+
}
58+
if (candidate != null) {
59+
candidate.rebuildNetwork();
60+
return;
61+
}
62+
}
63+
}
64+
65+
T getTypeValue();
66+
67+
enum Type {
68+
69+
ITEM,
70+
FLUID,
71+
EXTENDER,
72+
PROXY,
73+
ENERGY;
74+
75+
public static final Type[] VALUES = values();
76+
}
77+
}

src/main/java/gregtech/api/capability/SimpleCapabilityManager.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import gregtech.api.capability.impl.AbstractRecipeLogic;
44
import gregtech.api.cover.CoverHolder;
55
import gregtech.api.metatileentity.multiblock.IMaintenance;
6-
import gregtech.api.terminal.hardware.HardwareProvider;
76
import gregtech.api.worldgen.generator.GTWorldGenCapability;
87
import gregtech.common.metatileentities.converter.ConverterTrait;
98

@@ -48,7 +47,6 @@ public static void init() {
4847
registerCapabilityWithNoDefault(AbstractRecipeLogic.class);
4948
registerCapabilityWithNoDefault(IDataAccessHatch.class);
5049
registerCapabilityWithNoDefault(IOpticalComputationProvider.class);
51-
registerCapabilityWithNoDefault(HardwareProvider.class);
5250
registerCapabilityWithNoDefault(ConverterTrait.class);
5351
registerCapabilityWithNoDefault(ILaserContainer.class);
5452

0 commit comments

Comments
 (0)