Skip to content

Commit 23e4b33

Browse files
committed
Full move of all code from the Moni Labs project, as it was deemed good for other packs as well
1 parent eec81ae commit 23e4b33

File tree

18 files changed

+322
-164
lines changed

18 files changed

+322
-164
lines changed

README.md

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,8 @@
1-
# GregTech Addon Template
2-
## Template for GregTech Modern addons on 1.20.1
1+
# GregTech Utilities
2+
A GregTech Modern addon, adding some nice quality-of-life features.
33

4-
Original template by [screret](https://github.com/screret), updated by [JuiceyBeans](https://github.com/JuiceyBeans)
4+
## License
55

6-
<hr>
6+
All code is under LGPL3. Some parts were directly lifted from GregTech Modern.
77

8-
## How do I make an addon for GregTech Modern?
9-
Well for one, you WILL need to know Java to make an addon. There's no getting around this. A good starting point would be [MOOC](https://java-programming.mooc.fi/) or [W3Schools](https://www.w3schools.com/java/
10-
)
11-
12-
Unfortunately, there isn't any official documentation so far for making GregTech Modern addons. There are a couple of mods you can look at to reference though!
13-
14-
Repositories for other addons:
15-
16-
- [CosmicCore](https://github.com/Frontiers-PackForge/CosmicCore)
17-
- [Gregtech: Extended Chemistry Extended](https://github.com/jmoiron/Gregtech-Extended-Chemistry)
18-
- [Juiceycality](https://github.com/JuiceyBeans/Juiceycality)
19-
- [Gregicality Rocketry](https://github.com/Argent-Matter/gcyr/)
20-
21-
Additionally, you may be able to find help on the [GregTech CEu Discord](https://discord.gg/bWSWuYvURP)!
22-
23-
<hr>
24-
25-
## This template comes packaged with [Spotless](https://github.com/diffplug/spotless)!
26-
27-
### 1. What is Spotless?
28-
- Spotless keeps your code neatly formatted. It's essentially a grammar check for your code!
29-
### 2. Can I choose not to use Spotless?
30-
- Yes! Spotless is completely optional and will not affect your project by default
31-
### 3. How do I run Spotless?
32-
- You can run Spotless anytime by:
33-
- Running the `spotlessApply` task from the Gradle tab in IntelliJ
34-
- Installing the [Spotless Gradle plugin for IntelliJ](https://plugins.jetbrains.com/plugin/18321-spotless-gradle)
35-
- Typing in `gradlew.bat :spotlessApply` if you're on Windows
36-
- Typing in `bash gradlew :spotlessApply` if you're on Linux
37-
### 4. So how do I check if Spotless has been applied to my code?
38-
- Running `spotlessApply` will format all files for you automatically! If you want GitHub to check each commit for if Spotless has been run, you can add [this](https://github.com/Frontiers-PackForge/CosmicCore/blob/main-1.20.1-forge/.github/workflows/spotless.yml) and [this](https://github.com/Frontiers-PackForge/CosmicCore/blob/main-1.20.1-forge/.github/actions/build_setup/action.yml) to your project
8+
Assets are licensed under MIT. The texture for the sterile cleaning maintenance hatch was edited from GregTech Modern's Cleaning maintenance hatch and the colors from the Sterilizing Filter Casing.

gradle.properties

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ org.gradle.jvmargs=-Xmx1G
1212

1313
# Mod Properties
1414
mod_version=1.0.0
15-
maven_group=com.example.examplemod
16-
archives_base_name=examplemod
17-
mod_id=examplemod
18-
mod_name=Example Mod
15+
maven_group=net.neganote.gtutils
16+
archives_base_name=gtutils
17+
mod_id=gtutils
18+
mod_name=GregTech Utilities
1919
mod_url=
20-
mod_author=Example Author
20+
mod_author=NegaNote
2121
mod_license=LGPLv3.0
2222

2323
# Dependencies
2424
architectury_version=9.2.14
25-
gtceu_version=1.6.3
26-
ldlib_version=1.0.31
25+
gtceu_version=1.6.4
26+
ldlib_version=1.0.34
2727
registrate_version=MC1.20-1.3.11
2828
rhino_version=2001.2.3-build.6
2929
kubejs_version=2001.6.5-build.14

src/main/java/com/example/examplemod/ExampleGTAddon.java

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/main/java/com/example/examplemod/ExampleMod.java renamed to src/main/java/net/neganote/gtutilities/GregTechUtilities.java

Lines changed: 42 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.example.examplemod;
1+
package net.neganote.gtutilities;
22

33
import com.gregtechceu.gtceu.api.GTCEuAPI;
44
import com.gregtechceu.gtceu.api.data.chemical.material.event.MaterialEvent;
@@ -7,46 +7,65 @@
77
import com.gregtechceu.gtceu.api.machine.MachineDefinition;
88
import com.gregtechceu.gtceu.api.recipe.GTRecipeType;
99
import com.gregtechceu.gtceu.api.registry.registrate.GTRegistrate;
10-
import com.gregtechceu.gtceu.api.sound.SoundEntry;
11-
10+
import com.gregtechceu.gtceu.common.data.GTCreativeModeTabs;
11+
import com.tterrag.registrate.util.entry.RegistryEntry;
1212
import net.minecraft.client.Minecraft;
1313
import net.minecraft.resources.ResourceLocation;
14+
import net.minecraft.world.item.CreativeModeTab;
1415
import net.minecraft.world.item.Items;
1516
import net.minecraftforge.common.MinecraftForge;
1617
import net.minecraftforge.eventbus.api.IEventBus;
1718
import net.minecraftforge.fml.common.Mod;
1819
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
1920
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
2021
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
21-
22+
import net.neganote.gtutilities.common.item.UtilItems;
23+
import net.neganote.gtutilities.common.machine.UtilMachines;
2224
import org.apache.logging.log4j.LogManager;
2325
import org.apache.logging.log4j.Logger;
2426

25-
@Mod(ExampleMod.MOD_ID)
26-
public class ExampleMod {
27-
28-
public static final String MOD_ID = "examplemod";
27+
@Mod(GregTechUtilities.MOD_ID)
28+
public class GregTechUtilities {
29+
public static final String MOD_ID = "gtutils";
2930
public static final Logger LOGGER = LogManager.getLogger();
30-
public static GTRegistrate EXAMPLE_REGISTRATE = GTRegistrate.create(ExampleMod.MOD_ID);
31-
32-
public ExampleMod() {
31+
public static GTRegistrate REGISTRATE = GTRegistrate.create(GregTechUtilities.MOD_ID);
32+
33+
public static RegistryEntry<CreativeModeTab> UTIL_CREATIVE_TAB = REGISTRATE.defaultCreativeTab(GregTechUtilities.MOD_ID,
34+
builder -> builder
35+
.displayItems(new GTCreativeModeTabs.RegistrateDisplayItemsGenerator(GregTechUtilities.MOD_ID, REGISTRATE))
36+
.title(REGISTRATE.addLang("itemGroup", GregTechUtilities.id("creative_tab"), "GregTech Utilities"))
37+
.icon(UtilItems.OMNITOOL::asStack)
38+
.build())
39+
.register();
40+
41+
public GregTechUtilities() {
42+
GregTechUtilities.init();
3343
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
3444

3545
modEventBus.addListener(this::commonSetup);
3646
modEventBus.addListener(this::clientSetup);
37-
3847
modEventBus.addListener(this::addMaterialRegistries);
3948
modEventBus.addListener(this::addMaterials);
4049
modEventBus.addListener(this::modifyMaterials);
41-
4250
modEventBus.addGenericListener(GTRecipeType.class, this::registerRecipeTypes);
4351
modEventBus.addGenericListener(MachineDefinition.class, this::registerMachines);
44-
modEventBus.addGenericListener(SoundEntry.class, this::registerSounds);
52+
53+
4554

4655
// Most other events are fired on Forge's bus.
4756
// If we want to use annotations to register event listeners,
4857
// we need to register our object like this!
4958
MinecraftForge.EVENT_BUS.register(this);
59+
60+
61+
}
62+
63+
public static void init() {
64+
UtilItems.init();
65+
}
66+
67+
public static ResourceLocation id(String path) {
68+
return new ResourceLocation(MOD_ID, path);
5069
}
5170

5271
private void commonSetup(final FMLCommonSetupEvent event) {
@@ -60,73 +79,27 @@ private void clientSetup(final FMLClientSetupEvent event) {
6079
LOGGER.info("Hey, we're on Minecraft version {}!", Minecraft.getInstance().getLaunchedVersion());
6180
}
6281

63-
/**
64-
* Create a ResourceLocation in the format "modid:path"
65-
*
66-
* @param path
67-
* @return ResourceLocation with the namespace of your mod
68-
*/
69-
public static ResourceLocation id(String path) {
70-
return new ResourceLocation(MOD_ID, path);
71-
}
72-
73-
/**
74-
* Create a material manager for your mod using GT's API.
75-
* You MUST have this if you have custom materials.
76-
* Remember to register them not to GT's namespace, but your own.
77-
*
78-
* @param event
79-
*/
82+
// You MUST have this for custom materials.
83+
// Remember to register them not to GT's namespace, but your own.
8084
private void addMaterialRegistries(MaterialRegistryEvent event) {
81-
GTCEuAPI.materialManager.createRegistry(ExampleMod.MOD_ID);
85+
GTCEuAPI.materialManager.createRegistry(GregTechUtilities.MOD_ID);
8286
}
8387

84-
/**
85-
* You will also need this for registering custom materials
86-
* Call init() from your Material class(es) here
87-
*
88-
* @param event
89-
*/
88+
// As well as this.
9089
private void addMaterials(MaterialEvent event) {
91-
// CustomMaterials.init();
90+
//CustomMaterials.init();
9291
}
9392

94-
/**
95-
* (Optional) Used to modify pre-existing materials from GregTech
96-
*
97-
* @param event
98-
*/
93+
// This is optional, though.
9994
private void modifyMaterials(PostMaterialEvent event) {
100-
// CustomMaterials.modify();
95+
//CustomMaterials.modify();
10196
}
10297

103-
/**
104-
* Used to register your own new RecipeTypes.
105-
* Call init() from your RecipeType class(es) here
106-
*
107-
* @param event
108-
*/
10998
private void registerRecipeTypes(GTCEuAPI.RegisterEvent<ResourceLocation, GTRecipeType> event) {
110-
// CustomRecipeTypes.init();
99+
//CustomRecipeTypes.init();
111100
}
112101

113-
/**
114-
* Used to register your own new RecipeTypes.
115-
* Call init() from your Machine class(es) here
116-
*
117-
* @param event
118-
*/
119102
private void registerMachines(GTCEuAPI.RegisterEvent<ResourceLocation, MachineDefinition> event) {
120-
// CustomMachines.init();
121-
}
122-
123-
/**
124-
* Used to register your own new sounds
125-
* Call init from your Sound class(es) here
126-
*
127-
* @param event
128-
*/
129-
public void registerSounds(GTCEuAPI.RegisterEvent<ResourceLocation, SoundEntry> event) {
130-
// CustomSounds.init();
103+
UtilMachines.init();
131104
}
132105
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package net.neganote.gtutilities;
2+
3+
import com.gregtechceu.gtceu.api.addon.GTAddon;
4+
import com.gregtechceu.gtceu.api.addon.IGTAddon;
5+
import com.gregtechceu.gtceu.api.registry.registrate.GTRegistrate;
6+
import net.minecraft.data.recipes.FinishedRecipe;
7+
8+
import java.util.function.Consumer;
9+
10+
@SuppressWarnings("unused")
11+
@GTAddon
12+
public class GregTechUtilitiesGTAddon implements IGTAddon {
13+
@Override
14+
public GTRegistrate getRegistrate() {
15+
return GregTechUtilities.REGISTRATE;
16+
}
17+
18+
@Override
19+
public void initializeAddon() {
20+
21+
}
22+
23+
@Override
24+
public String addonModId() {
25+
return GregTechUtilities.MOD_ID;
26+
}
27+
28+
@Override
29+
public void registerTagPrefixes() {
30+
//CustomTagPrefixes.init();
31+
}
32+
33+
@Override
34+
public void addRecipes(Consumer<FinishedRecipe> provider) {
35+
//CustomRecipes.init(provider);
36+
}
37+
38+
// If you have custom ingredient types, uncomment this & change to match your capability.
39+
// KubeJS WILL REMOVE YOUR RECIPES IF THESE ARE NOT REGISTERED.
40+
/*
41+
public static final ContentJS<Double> PRESSURE_IN = new ContentJS<>(NumberComponent.ANY_DOUBLE, GregitasRecipeCapabilities.PRESSURE, false);
42+
public static final ContentJS<Double> PRESSURE_OUT = new ContentJS<>(NumberComponent.ANY_DOUBLE, GregitasRecipeCapabilities.PRESSURE, true);
43+
44+
@Override
45+
public void registerRecipeKeys(KJSRecipeKeyEvent event) {
46+
event.registerKey(CustomRecipeCapabilities.PRESSURE, Pair.of(PRESSURE_IN, PRESSURE_OUT));
47+
}
48+
*/
49+
}

0 commit comments

Comments
 (0)