Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
921d3b9
initial add of QATs, no new functionality yet
NegaNote Apr 9, 2025
f9cb002
implement coolant mechanic
NegaNote Apr 10, 2025
ade88bf
add tooltip and UI info about coolant mechanic
NegaNote Apr 10, 2025
e94d313
Make the coolant consumption happen every second instead of every tick
NegaNote Apr 10, 2025
0f58d62
spotless
NegaNote Apr 10, 2025
5d62165
add wireless frequency to QAT
NegaNote Apr 10, 2025
0184794
add input/output toggle for QAT (doesn't do anything)
NegaNote Apr 11, 2025
68a038e
Rename QAT to PTERB (Power Transfer Einstein-Rosen Bridge)
NegaNote Apr 11, 2025
71cff25
spotless
NegaNote Apr 11, 2025
4438ab0
partial revert of input-only/output-only logic
NegaNote Apr 12, 2025
372b51d
beginnings of true wireless
NegaNote Apr 12, 2025
f1eee4c
implement saving the PTERBSavedData
NegaNote Apr 12, 2025
9501bd0
spotless
NegaNote Apr 12, 2025
a1663bd
Put together helper methods for PTERBSavedData
NegaNote Apr 12, 2025
69ed152
add wireless functionality to multi itself (still not actually working)
NegaNote Apr 13, 2025
63c24d5
refactor, should be working? but it's not?
NegaNote Apr 13, 2025
8aaf2aa
make it always use the overworld data cache
NegaNote Apr 13, 2025
1e8c6fe
Improve TPS significantly
NegaNote Apr 13, 2025
4d094df
Disable default zero frequency
NegaNote Apr 13, 2025
20a551b
fix coolant calculation and display info
NegaNote Apr 14, 2025
7a5b732
Change tooltips
NegaNote Apr 14, 2025
9382630
Add Jade integration
NegaNote Apr 14, 2025
31a05d8
add message telling players they can't use frequency 0
NegaNote Apr 14, 2025
f5e08f7
internal rename
NegaNote Apr 15, 2025
248ce1a
spotless
NegaNote Apr 15, 2025
992e1db
beginnings of renderer
NegaNote Apr 15, 2025
b64c4c5
cube(tm)
NegaNote Apr 16, 2025
fb20424
add PTERB recipe
NegaNote Apr 16, 2025
5a5f5a2
disable coolant by default
NegaNote Apr 16, 2025
63d0044
make a shape for the PTERB
NegaNote Apr 16, 2025
476f08d
replace renderer casing with PSS casing, fix direction of renderer tr…
NegaNote Apr 16, 2025
7507cfa
make it an actual sphere
NegaNote Apr 17, 2025
62dafaa
disable custom rendering for now :sadcowboy:
NegaNote Apr 17, 2025
44620ac
allow any blocks at the top
NegaNote Apr 17, 2025
db6794f
bump version and change the changelog and readme to reflect the PTERB…
NegaNote Apr 17, 2025
0513006
make the amount of soldering fluid used in the pterb recipe less of a…
NegaNote Apr 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ Current features:
* A Sterile Cleaning Maintenance Hatch
* An omni-breaker, that can break anything instantly
* 64A Energy Converters
* The Power Transfer Einstein-Rosen Bridge (PTERB), a wireless version of the Active Transformer
* Has an opt-in coolant system, where the PTERB requires coolant to be used, or it'll explode (or just stop if GTm is set to have harmless active transformers)

All features can be enabled or disabled in the config.

While this mod was originally created for Monifactory, feel free to use it in any GregTech modpack you like!

All features (except for the sterile cleaning hatch and optional coolant for the PTERB) have default recipes.
Feel free to change recipes in your own pack!

## License

All code is under LGPL3. Some parts were directly lifted from GregTech Modern.
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ dependencies {
runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}")
runtimeOnly fg.deobf("dev.emi:emi-forge:${emi_version}+${minecraft_version}")
runtimeOnly fg.deobf("curse.maven:jade-324717:5390389")
compileOnly fg.deobf("curse.maven:jade-324717:5390389")

// GregTech and dependencies
implementation fg.deobf("com.gregtechceu.gtceu:gtceu-${minecraft_version}:${gtceu_version}:slim") { transitive = false }
Expand Down
4 changes: 2 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# GregTech Modern Utilities version 1.0.3
# GregTech Modern Utilities version 1.1.0

HOTFIX - prevent server from trying to load client code
Add the Power Transfer Einstein-Rosen Bridge, a wireless version of the Active Transformer.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ org.gradle.jvmargs=-Xmx1G
mapping_version=2023.09.03-1.20.1

# Mod Properties
mod_version=1.0.3
mod_version=1.1.0
maven_group=net.neganote.gtmutils
archives_base_name=gtmutils
mod_id=gtmutils
Expand Down
21 changes: 20 additions & 1 deletion src/generated/resources/assets/gtmutils/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"block.gtmutils.max_64a_energy_converter": "ɹǝʇɹǝʌuoƆ ʎbɹǝuƎ ɹ§Ɐǝ§ㄣ9 ɹ§XⱯWן§ɔ§",
"block.gtmutils.mv_64a_energy_converter": "ɹǝʇɹǝʌuoƆ ʎbɹǝuƎ ɹ§Ɐǝ§ㄣ9 ɹ§ΛWq§",
"block.gtmutils.opv_64a_energy_converter": "ɹǝʇɹǝʌuoƆ ʎbɹǝuƎ ɹ§Ɐǝ§ㄣ9 ɹ§ΛdOן§6§",
"block.gtmutils.pterb_machine": "ǝbpıɹᗺ uǝsoᴚ-uıǝʇsuıƎ ɹǝɟsuɐɹ⟘ ɹǝʍoԀ",
"block.gtmutils.sterile_cleaning_maintenance_hatch": "ɥɔʇɐH ǝɔuɐuǝʇuıɐW buıuɐǝןƆ ǝןıɹǝʇS",
"block.gtmutils.uev_64a_energy_converter": "ɹǝʇɹǝʌuoƆ ʎbɹǝuƎ ɹ§Ɐǝ§ㄣ9 ɹ§ΛƎ∩ɐ§",
"block.gtmutils.uhv_64a_energy_converter": "ɹǝʇɹǝʌuoƆ ʎbɹǝuƎ ɹ§Ɐǝ§ㄣ9 ɹ§ΛH∩ㄣ§",
Expand All @@ -15,9 +16,27 @@
"block.gtmutils.uv_64a_energy_converter": "ɹǝʇɹǝʌuoƆ ʎbɹǝuƎ ɹ§Ɐǝ§ㄣ9 ɹ§Λ∩Ɛ§",
"block.gtmutils.uxv_64a_energy_converter": "ɹǝʇɹǝʌuoƆ ʎbɹǝuƎ ɹ§Ɐǝ§ㄣ9 ɹ§ΛX∩ǝ§",
"block.gtmutils.zpm_64a_energy_converter": "ɹǝʇɹǝʌuoƆ ʎbɹǝuƎ ɹ§Ɐǝ§ㄣ9 ɹ§WԀZɔ§",
"config.gtmutils.option.converters64aEnabled": "pǝןqɐuƎɐㄣ9sɹǝʇɹǝʌuoɔ",
"config.gtmutils.option.features": "sǝɹnʇɐǝɟ",
"config.gtmutils.option.omnibreakerEnabled": "pǝןqɐuƎɹǝʞɐǝɹqıuɯo",
"config.gtmutils.option.omnibreakerEnergyCapacity": "ʎʇıɔɐdɐƆʎbɹǝuƎɹǝʞɐǝɹqıuɯo",
"config.gtmutils.option.omnibreakerTier": "ɹǝı⟘ɹǝʞɐǝɹqıuɯo",
"config.gtmutils.option.pterbCoolantBaseDrain": "uıɐɹᗡǝsɐᗺʇuɐןooƆqɹǝʇd",
"config.gtmutils.option.pterbCoolantIOMultiplier": "ɹǝıןdıʇןnWOIʇuɐןooƆqɹǝʇd",
"config.gtmutils.option.pterbEnabled": "pǝןqɐuƎqɹǝʇd",
"config.gtmutils.option.sterileHatchEnabled": "pǝןqɐuƎɥɔʇɐHǝןıɹǝʇs",
"config.jade.plugin_gtmutils.frequency_info": "oɟuI ʎɔuǝnbǝɹℲ ᗺᴚƎ⟘Ԁ",
"gtmutils.gui.pterb.wireless_configurator.title": "ʎɔuǝnbǝɹɟ ssǝןǝɹıM",
"gtmutils.multiblock.pterb_machine.coolant_usage": "puoɔǝs ɹǝd %s ɟo Ꞁ%s suıɐɹᗡɔ§",
"gtmutils.pterb.current_frequency": "%s :ʎɔuǝnbǝɹɟ ʇuǝɹɹnƆ",
"gtmutils.pterb_machine.invalid_frequency": "¡0 ʎɔuǝnbǝɹɟ uo ʞɹoʍ ʇou ןןıʍ sᗺᴚƎ⟘Ԁ",
"item.gtmutils.omnibreaker": "ɹǝʞɐǝɹq-ıuɯO",
"itemGroup.gtmutils.creative_tab": "sǝıʇıןıʇ∩ uɹǝpoW ɥɔǝ⟘bǝɹ⅁",
"material.gtmutils.quantum_coolant": "ʇuɐןooƆ ɯnʇuɐnὉ",
"tooltip.omnibreaker.can_break_anything": "¡⅁NIH⟘ʎNⱯ ǝuıɯ-ɐʇsuı uɐɔ ɹǝʞɐǝɹq-ıuɯO ǝɥ⟘",
"tooltip.omnibreaker.charge_status": "∩Ǝ %s / ∩Ǝ %s :ʎbɹǝuƎ",
"tooltip.omnibreaker.right_click_function": "¡ʞɔıןɔ-ʇɥbıɹ ɥʇıʍ sʞɔoןq ןɐnpıʌıpuı ʞɐǝɹᗺ"
"tooltip.omnibreaker.right_click_function": "¡ʞɔıןɔ-ʇɥbıɹ ɥʇıʍ sʞɔoןq ןɐnpıʌıpuı ʞɐǝɹᗺ",
"tooltip.pterb_machine.frequencies": "˙ɹǝɯɹoɟsuɐɹ⟘ ǝʌıʇɔⱯ ǝןbuıs ɐ ǝʞıן ʇɔɐ ʎɔuǝnbǝɹɟ ǝɯɐs ǝɥʇ ɥʇıʍ sᗺᴚƎ⟘Ԁ ןןⱯ",
"tooltip.pterb_machine.purpose": ")ᗺᴚƎ⟘Ԁ( ɹǝɯɹoɟsuɐɹ⟘ ǝʌıʇɔⱯ ssǝןǝɹıM",
"tooltip.pterb_machine.uses_coolant": "¡uoıʇɔunɟ oʇ %s suıɐɹᗡ"
}
21 changes: 20 additions & 1 deletion src/generated/resources/assets/gtmutils/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"block.gtmutils.max_64a_energy_converter": "§c§lMAX§r 64§eA§r Energy Converter",
"block.gtmutils.mv_64a_energy_converter": "§bMV§r 64§eA§r Energy Converter",
"block.gtmutils.opv_64a_energy_converter": "§9§lOpV§r 64§eA§r Energy Converter",
"block.gtmutils.pterb_machine": "Power Transfer Einstein-Rosen Bridge",
"block.gtmutils.sterile_cleaning_maintenance_hatch": "Sterile Cleaning Maintenance Hatch",
"block.gtmutils.uev_64a_energy_converter": "§aUEV§r 64§eA§r Energy Converter",
"block.gtmutils.uhv_64a_energy_converter": "§4UHV§r 64§eA§r Energy Converter",
Expand All @@ -15,9 +16,27 @@
"block.gtmutils.uv_64a_energy_converter": "§3UV§r 64§eA§r Energy Converter",
"block.gtmutils.uxv_64a_energy_converter": "§eUXV§r 64§eA§r Energy Converter",
"block.gtmutils.zpm_64a_energy_converter": "§cZPM§r 64§eA§r Energy Converter",
"config.gtmutils.option.converters64aEnabled": "converters64aEnabled",
"config.gtmutils.option.features": "features",
"config.gtmutils.option.omnibreakerEnabled": "omnibreakerEnabled",
"config.gtmutils.option.omnibreakerEnergyCapacity": "omnibreakerEnergyCapacity",
"config.gtmutils.option.omnibreakerTier": "omnibreakerTier",
"config.gtmutils.option.pterbCoolantBaseDrain": "pterbCoolantBaseDrain",
"config.gtmutils.option.pterbCoolantIOMultiplier": "pterbCoolantIOMultiplier",
"config.gtmutils.option.pterbEnabled": "pterbEnabled",
"config.gtmutils.option.sterileHatchEnabled": "sterileHatchEnabled",
"config.jade.plugin_gtmutils.frequency_info": "PTERB Frequency Info",
"gtmutils.gui.pterb.wireless_configurator.title": "Wireless frequency",
"gtmutils.multiblock.pterb_machine.coolant_usage": "§cDrains %sL of %s per second",
"gtmutils.pterb.current_frequency": "Current frequency: %s",
"gtmutils.pterb_machine.invalid_frequency": "PTERBs will not work on frequency 0!",
"item.gtmutils.omnibreaker": "Omni-breaker",
"itemGroup.gtmutils.creative_tab": "GregTech Modern Utilities",
"material.gtmutils.quantum_coolant": "Quantum Coolant",
"tooltip.omnibreaker.can_break_anything": "The Omni-breaker can insta-mine ANYTHING!",
"tooltip.omnibreaker.charge_status": "Energy: %s EU / %s EU",
"tooltip.omnibreaker.right_click_function": "Break individual blocks with right-click!"
"tooltip.omnibreaker.right_click_function": "Break individual blocks with right-click!",
"tooltip.pterb_machine.frequencies": "All PTERBs with the same frequency act like a single Active Transformer.",
"tooltip.pterb_machine.purpose": "Wireless Active Transformer (PTERB)",
"tooltip.pterb_machine.uses_coolant": "Drains %s to function!"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"gtmutils:quantum_coolant_bucket"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.neganote.gtutilities.client.renderer.UtilShaders;
import net.neganote.gtutilities.common.item.UtilItems;
import net.neganote.gtutilities.common.machine.UtilMachines;
import net.neganote.gtutilities.common.materials.UtilMaterials;
import net.neganote.gtutilities.config.UtilConfig;
import net.neganote.gtutilities.data.UtilDatagen;
import net.neganote.gtutilities.datagen.UtilDatagen;

import com.tterrag.registrate.util.entry.RegistryEntry;
import org.apache.logging.log4j.LogManager;
Expand All @@ -49,6 +51,7 @@ public GregTechModernUtilities() {
modEventBus.addListener(this::commonSetup);
if (GTCEu.isClientSide()) {
modEventBus.addListener(this::clientSetup);
modEventBus.register(UtilShaders.class);
}
modEventBus.addListener(this::addMaterialRegistries);
modEventBus.addListener(this::addMaterials);
Expand Down Expand Up @@ -127,7 +130,7 @@ private void addMaterialRegistries(MaterialRegistryEvent event) {

// As well as this.
private void addMaterials(MaterialEvent event) {
// CustomMaterials.init();
UtilMaterials.register();
}

// This is optional, though.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package net.neganote.gtutilities.client.renderer;

import net.minecraft.client.renderer.RenderStateShard;
import net.minecraft.client.renderer.RenderStateShard.ShaderStateShard;
import net.minecraft.client.renderer.RenderType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat;

@OnlyIn(Dist.CLIENT)
public class UtilRenderTypes {

public static final ShaderStateShard WORMHOLE_SHADER_SHARD = new ShaderStateShard(
() -> UtilShaders.WORMHOLE_SHADER);

public static RenderType WORMHOLE = RenderType.create("wormhole", DefaultVertexFormat.POSITION,
VertexFormat.Mode.QUADS, 131072, false, false,
RenderType.CompositeState.builder()
.setShaderState(WORMHOLE_SHADER_SHARD)
// I would just use RenderStateShard.ADDITIVE_TRANSPARENCY, but that's protected for some reason
// So instead I'm just copying it directly
.setTransparencyState(new RenderStateShard.TransparencyStateShard("additive_transparency", () -> {
RenderSystem.enableBlend();
RenderSystem.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE);
}, () -> {
RenderSystem.disableBlend();
RenderSystem.defaultBlendFunc();
}))
.createCompositeState(false));
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package net.neganote.gtutilities.client.renderer;

import net.minecraft.client.renderer.ShaderInstance;
import net.minecraftforge.client.event.RegisterShadersEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.neganote.gtutilities.GregTechModernUtilities;

import com.mojang.blaze3d.vertex.DefaultVertexFormat;

import java.io.IOException;

public class UtilShaders {

public static ShaderInstance WORMHOLE_SHADER;

@SubscribeEvent
public static void shaderRegistry(RegisterShadersEvent event) {
try {
event.registerShader(new ShaderInstance(event.getResourceProvider(),
GregTechModernUtilities.id("rendertype_wormhole"), DefaultVertexFormat.POSITION),
(shaderInstance -> WORMHOLE_SHADER = shaderInstance));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package net.neganote.gtutilities.client.renderer.machine;

import com.gregtechceu.gtceu.GTCEu;
import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.api.blockentity.MetaMachineBlockEntity;
import com.gregtechceu.gtceu.api.pattern.util.RelativeDirection;
import com.gregtechceu.gtceu.client.renderer.machine.WorkableCasingMachineRenderer;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.Direction;
import net.minecraft.core.Vec3i;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.neganote.gtutilities.GregTechModernUtilities;
import net.neganote.gtutilities.client.renderer.UtilRenderTypes;
import net.neganote.gtutilities.common.machine.multiblock.PTERBMachine;

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;

import java.util.List;
import java.util.function.Consumer;

public class PTERBRenderer extends WorkableCasingMachineRenderer {

public static final ResourceLocation TEXTURE = GTCEu.id("block/casings/solid/machine_casing_palladium_substation");
// TODO: replace this texture with custom casing
public static final ResourceLocation OVERLAY_MODEL_TEXTURES = GTCEu.id("block/multiblock/data_bank");

public static final ResourceLocation SPHERE = GregTechModernUtilities.id("render/sphere");

public PTERBRenderer() {
super(TEXTURE, OVERLAY_MODEL_TEXTURES);
}

@Override
public void render(BlockEntity blockEntity, float partialTicks, PoseStack stack, MultiBufferSource buffer,
int combinedLight, int combinedOverlay) {
if (blockEntity instanceof MetaMachineBlockEntity mmbe && mmbe.getMetaMachine() instanceof PTERBMachine pterb &&
pterb.isFormed() && pterb.isActive()) {
var frontFacing = pterb.getFrontFacing();
var upwardsFacing = pterb.getUpwardsFacing();

Direction upwards = RelativeDirection.UP.getRelativeFacing(frontFacing, upwardsFacing, false);

// Disable the rendering for now. Might finish it later if I ever become smart enough/able to understand
// Minecraft's rendering system better.
// renderWormhole(stack, buffer, upwards, combinedLight, combinedOverlay);
}
}

@SuppressWarnings("deprecation")
private void renderWormhole(PoseStack stack, MultiBufferSource bufferSource, Direction upwards,
int combinedLight, int combinedOverlay) {
stack.pushPose();
var modelManager = Minecraft.getInstance().getModelManager();
BakedModel sphere = modelManager.getModel(SPHERE);
Vec3i movement = upwards.getNormal();
stack.translate(movement.getX() * 8 + 0.5f, movement.getY() * 8 + 0.5f, movement.getZ() * 8 + 0.5f);
PoseStack.Pose pose = stack.last();
VertexConsumer consumer = bufferSource.getBuffer(UtilRenderTypes.WORMHOLE);
List<BakedQuad> quads = sphere.getQuads(null, null, GTValues.RNG);
for (BakedQuad quad : quads) {
consumer.putBulkData(pose, quad, 1.0f, 1.0f, 1.0f, combinedLight, combinedOverlay);
}
stack.popPose();
}

@Override
public boolean hasTESR(BlockEntity blockEntity) {
return true;
}

@Override
public int getViewDistance() {
return 256;
}

@Override
public boolean isGlobalRenderer(BlockEntity blockEntity) {
return true;
}

@Override
public void onAdditionalModel(Consumer<ResourceLocation> registry) {
super.onAdditionalModel(registry);
registry.accept(SPHERE);
}
}
Loading
Loading