-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Advanced Memory Card: - Interface P2P Support - Allow changing Input/Output via right click menu - Two New Modes - New Colors, separating input(s) and output(s) - Bug Fixes, especially relating to renaming and multiple inputs
- Loading branch information
1 parent
501c910
commit 31ba721
Showing
41 changed files
with
1,317 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
...nomiceu/nomilabs/gregtech/LabsSounds.java → ...java/com/nomiceu/nomilabs/LabsSounds.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.nomiceu.nomilabs; | ||
|
||
import com.nomiceu.nomilabs.util.LabsNames; | ||
|
||
import gregtech.api.gui.resources.TextureArea; | ||
import gregtech.client.renderer.texture.cube.OrientedOverlayRenderer; | ||
import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; | ||
|
||
public class LabsTextures { | ||
|
||
/* Overlays (Machine) */ | ||
public static OrientedOverlayRenderer GROWTH_CHAMBER_OVERLAY; | ||
|
||
/* Overlays (Casings) */ | ||
public static SimpleOverlayRenderer MICROVERSE_CASING; | ||
|
||
/* Recipe Map Textures */ | ||
public static TextureArea PROGRESS_BAR_ROCKET; | ||
|
||
/* Gui Textures */ | ||
public static TextureArea[] P2P_CUSTOM_MODES; | ||
public static TextureArea P2P_INPUT_ICON; | ||
public static TextureArea P2P_OUTPUT_ICON; | ||
|
||
public static void preInit() { | ||
GROWTH_CHAMBER_OVERLAY = new OrientedOverlayRenderer("nomilabs:multiblock/growth_chamber"); | ||
MICROVERSE_CASING = new SimpleOverlayRenderer("nomilabs:microverse_casing"); | ||
PROGRESS_BAR_ROCKET = labsFullImage("textures/gui/progress_bar/progress_bar_rocket.png"); | ||
|
||
var imageSizeX = 64; | ||
var imageSizeY = 32; | ||
var imageLoc = "textures/gui/advanced_memory_card/custom_modes.png"; | ||
var spriteSize = 32; | ||
P2P_CUSTOM_MODES = new TextureArea[] { | ||
labsAreaImage(imageLoc, imageSizeX, imageSizeY, 0, 0, spriteSize, spriteSize), | ||
labsAreaImage(imageLoc, imageSizeX, imageSizeY, spriteSize, 0, spriteSize, spriteSize), | ||
}; | ||
|
||
P2P_INPUT_ICON = labsFullImage("textures/gui/advanced_memory_card/input.png"); | ||
P2P_OUTPUT_ICON = labsFullImage("textures/gui/advanced_memory_card/output.png"); | ||
} | ||
|
||
/** | ||
* Like the one in TextureArea, but with Labs Registry. | ||
*/ | ||
public static TextureArea labsFullImage(String imageLocation) { | ||
return new TextureArea(LabsNames.makeLabsName(imageLocation), 0.0, 0.0, 1.0, 1.0); | ||
} | ||
|
||
/** | ||
* Almost like the one in TextureArea, but with Labs Registry. | ||
*/ | ||
public static TextureArea labsAreaImage(String imageLocation, int imageSizeX, int imageSizeY, int u, int v, | ||
int width, int height) { | ||
return new TextureArea(LabsNames.makeLabsName(imageLocation), | ||
u / (imageSizeX * 1.0), | ||
v / (imageSizeY * 1.0), | ||
width / (imageSizeX * 1.0), | ||
height / (imageSizeY * 1.0)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 0 additions & 32 deletions
32
src/main/java/com/nomiceu/nomilabs/gregtech/LabsTextures.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/java/com/nomiceu/nomilabs/integration/betterp2p/AccessibleGridServerCache.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.nomiceu.nomilabs.integration.betterp2p; | ||
|
||
import com.projecturanus.betterp2p.network.data.P2PLocation; | ||
|
||
import appeng.parts.p2p.PartP2PTunnel; | ||
|
||
public interface AccessibleGridServerCache { | ||
|
||
PartP2PTunnel<?> labs$changeIsInput(P2PLocation key, boolean isInput); | ||
|
||
boolean labs$addInput(P2PLocation key, short sourceFrequency); | ||
|
||
boolean labs$addOutput(P2PLocation key, short sourceFrequency); | ||
} |
14 changes: 14 additions & 0 deletions
14
...main/java/com/nomiceu/nomilabs/integration/betterp2p/AccessibleGuiAdvancedMemoryCard.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.nomiceu.nomilabs.integration.betterp2p; | ||
|
||
import com.projecturanus.betterp2p.item.BetterMemoryCardModes; | ||
|
||
public interface AccessibleGuiAdvancedMemoryCard { | ||
|
||
BetterMemoryCardModes labs$getMode(); | ||
|
||
void labs$setMode(BetterMemoryCardModes mode); | ||
|
||
void labs$syncMemoryInfo(); | ||
|
||
void labs$closeTypeSelector(); | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/com/nomiceu/nomilabs/integration/betterp2p/ExtendedITypeReceiver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.nomiceu.nomilabs.integration.betterp2p; | ||
|
||
public interface ExtendedITypeReceiver { | ||
|
||
void acceptIsInput(boolean isInput); | ||
} |
44 changes: 44 additions & 0 deletions
44
src/main/java/com/nomiceu/nomilabs/integration/betterp2p/LabsBetterMemoryCardModes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.nomiceu.nomilabs.integration.betterp2p; | ||
|
||
import java.util.Map; | ||
|
||
import net.minecraftforge.common.util.EnumHelper; | ||
|
||
import com.projecturanus.betterp2p.item.BetterMemoryCardModes; | ||
|
||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; | ||
|
||
public class LabsBetterMemoryCardModes { | ||
|
||
/** | ||
* Map of Mode to Labs ID. | ||
*/ | ||
public static final Map<BetterMemoryCardModes, Integer> LABS_ADDED_MODES = new Object2ObjectOpenHashMap<>(); | ||
|
||
public static final BetterMemoryCardModes ADD_AS_INPUT = addMode(0, "ADD_AS_INPUT", | ||
"nomilabs.gui.advanced_memory_card.mode.add_input", | ||
"nomilabs.gui.advanced_memory_card.mode.add_input.desc.1", | ||
"nomilabs.gui.advanced_memory_card.mode.add_input.desc.2"); | ||
|
||
public static final BetterMemoryCardModes ADD_AS_OUTPUT = addMode(1, "ADD_AS_OUTPUT", | ||
"nomilabs.gui.advanced_memory_card.mode.add_output", | ||
"nomilabs.gui.advanced_memory_card.mode.add_output.desc.1", | ||
"nomilabs.gui.advanced_memory_card.mode.add_output.desc.2"); | ||
|
||
/** | ||
* Essentially, this loads the class, allowing the above values to be added. | ||
* <p> | ||
* If for some reason, the values are needed before this, they will still be loaded, and calling init will have no | ||
* affect on that. | ||
*/ | ||
public static void preInit() {} | ||
|
||
private static BetterMemoryCardModes addMode(int labsId, String name, String unlocalizedName, | ||
String... unlocalizedDesc) { | ||
BetterMemoryCardModes result = EnumHelper.addEnum(BetterMemoryCardModes.class, name, | ||
new Class<?>[] { String.class, String[].class }, | ||
unlocalizedName, unlocalizedDesc); | ||
LABS_ADDED_MODES.put(result, labsId); | ||
return result; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/com/nomiceu/nomilabs/integration/betterp2p/ModeDescriptionsHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.nomiceu.nomilabs.integration.betterp2p; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import com.nomiceu.nomilabs.mixin.betterp2p.GuiAdvancedMemoryCardKtAccessor; | ||
import com.projecturanus.betterp2p.item.BetterMemoryCardModes; | ||
import com.projecturanus.betterp2p.item.BetterMemoryCardModesKt; | ||
|
||
public class ModeDescriptionsHandler { | ||
|
||
public static final Map<BetterMemoryCardModes, List<String>> labsModeDescriptions; | ||
|
||
public static void refreshDescriptions() { | ||
labsModeDescriptions.clear(); | ||
for (var mode : BetterMemoryCardModes.values()) { | ||
labsModeDescriptions.put(mode, | ||
GuiAdvancedMemoryCardKtAccessor.fmtTooltips(mode.getUnlocalizedName(), mode.getUnlocalizedDesc(), | ||
BetterMemoryCardModesKt.MAX_TOOLTIP_LENGTH)); | ||
} | ||
} | ||
|
||
static { | ||
labsModeDescriptions = new HashMap<>(); | ||
refreshDescriptions(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.