Skip to content

Commit

Permalink
Merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
Azercoco committed Aug 5, 2023
2 parents 3f34a3e + c857bcd commit 2c7c25e
Show file tree
Hide file tree
Showing 126 changed files with 1,955 additions and 1,994 deletions.
88 changes: 41 additions & 47 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
plugins {
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'fabric-loom' version '1.2.7'
id 'maven-publish'
id 'com.diffplug.spotless' version '5.14.0'
id 'com.matthewprenger.cursegradle' version '1.4.0'
id "com.modrinth.minotaur" version "2.+"
id 'io.github.juuxel.loom-quiltflower' version '1.8.0'
id 'io.github.juuxel.loom-quiltflower' version '1.10.0'
}

apply plugin: 'java-library'
Expand All @@ -30,7 +30,11 @@ repositories {
}
// for WTHIT
maven {
url 'https://maven.bai.lol'
url "https://maven2.bai.lol"
content {
includeGroup "lol.bai"
includeGroup "mcp.mobius.waila"
}
}
// for AE2 and JEI
maven {
Expand Down Expand Up @@ -114,7 +118,7 @@ repositories {
// for PlayerAbilityLib
maven {
name = 'Ladysnake Mods'
url = 'https://ladysnake.jfrog.io/artifactory/mods'
url = 'https://maven.ladysnake.org/releases'
content {
includeGroup 'io.github.ladysnake'
includeGroupByRegex 'io\\.github\\.onyxstudios.*'
Expand Down Expand Up @@ -188,11 +192,11 @@ dependencies {
}

if (project.runtime_itemlist_mod == "emi") {
modImplementation("dev.emi:emi:${project.emi_version}+${project.emi_minecraft_version}") {
modImplementation("dev.emi:emi-fabric:${project.emi_version}+${project.emi_minecraft_version}") {
exclude group: "net.fabricmc.fabric-api"
}
} else {
modCompileOnly("dev.emi:emi:${project.emi_version}+${project.emi_minecraft_version}") {
modCompileOnly("dev.emi:emi-fabric:${project.emi_version}+${project.emi_minecraft_version}") {
exclude group: "net.fabricmc.fabric-api"
}
}
Expand All @@ -209,15 +213,15 @@ dependencies {
exclude(group: "net.fabricmc.fabric-api")
}

modImplementation("mcp.mobius.waila:wthit:fabric-${project.wthit_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
modCompileOnly "mcp.mobius.waila:wthit-api:fabric-${project.wthit_version}"
modRuntimeOnly "mcp.mobius.waila:wthit:fabric-${project.wthit_version}"
modRuntimeOnly "lol.bai:badpackets:fabric-${project.badpackets_version}"

modImplementation("com.terraformersmc:modmenu:${project.mod_menu_version}") {
exclude(group: "net.fabricmc.fabric-api")
}

modImplementation("dev.latvian.mods:kubejs-fabric:1902.6.0-build.114") {
modImplementation("dev.latvian.mods:kubejs-fabric:${project.kubejs_version}") {
exclude(group: "net.fabricmc.fabric-api")
}

Expand All @@ -229,6 +233,7 @@ dependencies {

include modApi("teamreborn:energy:${project.tr_energy_version}") {
exclude(group: "net.fabricmc.fabric-api")
exclude group: "net.fabricmc", module: "fabric-loader"
}

include modImplementation("io.github.ladysnake:PlayerAbilityLib:${project.pal_version}") {
Expand All @@ -238,21 +243,6 @@ dependencies {
// Include No Indium? https://github.com/Luligabi1/NoIndium
include "me.luligabi:NoIndium:${project.no_indium_version}"


modImplementation("lol.bai.megane:megane-api:${project.megane_api_version}") {
exclude(group: "net.fabricmc.fabric-api")
}

modRuntimeOnly("lol.bai.megane:megane-runtime:${project.megane_runtime_version}") {
exclude(group: "net.fabricmc.fabric-api")
exclude(group: "mcp.mobius.waila")
}

modRuntimeOnly("lol.bai.megane:megane-vanilla:${project.megane_vanilla_version}") {
exclude(group: "net.fabricmc.fabric-api")
exclude(group: "mcp.mobius.waila")
}

modCompileOnly('net.oskarstrom:DashLoader:2.1-dev4') {
exclude(group: "net.fabricmc.fabric-api")
}
Expand All @@ -268,6 +258,22 @@ dependencies {
}
}

configurations {
// due to a change in newer loom, loader isn't remapped
// except some mods pull in an older version of loader that *is* remapped
// so it has to be excluded explicitly.

modRuntimeOnly.exclude group: "net.fabricmc", module: "fabric-loader"
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}

withSourcesJar()
}

processResources {
inputs.property "version", project.version

Expand All @@ -276,10 +282,6 @@ processResources {
}
}

loom {
splitEnvironmentSourceSets()
}

sourceSets {
main {
java {
Expand All @@ -293,6 +295,8 @@ sourceSets {
}

loom {
splitEnvironmentSourceSets()

accessWidenerPath = file("src/main/resources/modern_industrialization.accesswidener")
mods {
moderndynamics {
Expand Down Expand Up @@ -333,14 +337,6 @@ tasks.withType(JavaCompile).configureEach {
it.options.release = 17
}

// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this task, sources will not be generated.
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
}

jar {
from "LICENSE"
}
Expand Down Expand Up @@ -392,7 +388,7 @@ import com.google.gson.GsonBuilder

final class JsonOrderStep {
private JsonOrderStep() {}
private static final Gson GSON = new GsonBuilder().disableHtmlEscaping().setLenient().setPrettyPrinting().create();
private static final Gson GSON = new GsonBuilder().disableHtmlEscaping().setLenient().setPrettyPrinting().create()

static FormatterStep create() {
return FormatterStep.create(
Expand All @@ -401,20 +397,20 @@ final class JsonOrderStep {
{
new FormatterFunc() {
String apply(String input) {
TreeMap<String, Object> jsonMap = GSON.fromJson(input, TreeMap.class);
String sortedJson = GSON.toJson(jsonMap);
String prettyPrinted = sortedJson.replace('\\u0027', '\'');
return prettyPrinted + "\n";
TreeMap<String, Object> jsonMap = GSON.fromJson(input, TreeMap.class)
String sortedJson = GSON.toJson(jsonMap)
String prettyPrinted = sortedJson.replace('\\u0027', '\'')
return prettyPrinted + "\n"
}
}
},
);
)
}

private static final class State implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L

private final int formatVersion = 1;
private final int formatVersion = 1
}
}

Expand Down Expand Up @@ -446,7 +442,6 @@ if (System.getenv("CURSEFORGE_API_KEY") && !version.endsWith("-SNAPSHOT")) {
requiredDependency "fabric-api"
requiredDependency "cloth-config"
optionalDependency "wthit"
optionalDependency "megane"
optionalDependency "emi"
optionalDependency "jei"
optionalDependency "roughly-enough-items"
Expand Down Expand Up @@ -482,7 +477,6 @@ modrinth {
required.project "fabric-api"
required.project "cloth-config"
optional.project "wthit"
optional.project "megane"
optional.project "emi"
optional.project "jei"
optional.project "rei"
Expand Down
65 changes: 65 additions & 0 deletions docs/ADDING_MACHINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ Here are a few explanations about the shape system:
- Positive `y` is for blocks above the controller, negative `y` for blocks below.
- Positive `z` is for blocks behind the controller, negative `z` for blocks in front of it.

**This is the low-level system, please read on for a nicer way to define multiblock shapes.**

Here is an example of how to create the shape for a pyrolyse oven multiblock:
```js
MIMachineEvents.registerMachines(event => {
Expand All @@ -177,6 +179,69 @@ MIMachineEvents.registerMachines(event => {

// register multiblock as steam or electric next...
```
### Simplified shape creation using layered shapes
It is hard to write a shape using the previous method.
MI offers an alternative way to build shapes using layer definitions, similarly to crafting recipes.
The keys are arranged in such a way that each 2D group of characters represents a horizontal slice of the multiblock.
Each key must be assigned a block and a set of hatches.
The character `#` is used for the controller, and a space is used for air.
```js
MIMachineEvents.registerMachines(event => {
const pyrolyseHatch = event.hatchOf("item_input", "item_output", "fluid_input", "fluid_output", "energy_input");
const heatproofMember = event.memberOfBlock("modern_industrialization:heatproof_machine_casing");
const cupronickelCoilMember = event.memberOfBlock("modern_industrialization:cupronickel_coil");
const pyrolyseShape = event.layeredShape("heatproof_machine_casing", [
[ "HHH", "HHH", "HHH" ],
[ "CCC", "C C", "CCC" ],
[ "CCC", "C C", "CCC" ],
[ "HHH", "H#H", "HHH" ],
])
.key("H", heatproofMember, pyrolyseHatch)
.key("C", cupronickelCoilMember, event.noHatch())
.build();

// register multiblock as steam or electric next...
```
In this example, the bottom layer (`y = -1`) of the shape is represented by
```
HHH
CCC
CCC
HHH
```
Then the middle layer (`y = 0`) is
```
HHH
C C
C C
H#H
```
Finally the top layer (`y = 1`) is
```
HHH
CCC
CCC
HHH
```
Here is how the axes work in a single layer:
```
^
| behind
| the
| controller
|
|
| right
| of the
| controller
+ ----------------------------->
```
### Register as steam or electric
Both steam and electric methods take the same parameters
* Use `event.simpleSteamCraftingMultiBlock` function to register a steam multiblock.
Expand Down
29 changes: 14 additions & 15 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ org.gradle.jvmargs=-Xmx1G \
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.19.2
loader_version=0.14.9
loader_version=0.14.21

# Mod Properties
mod_version=0.0.0-SNAPSHOT
Expand All @@ -19,26 +19,25 @@ org.gradle.jvmargs=-Xmx1G \

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.71.0+1.19.2
fabric_version=0.76.0+1.19.2
jei_minecraft_version=1.19.2
jei_version=11.3.0.260
rei_version=9.0.491
jei_version=11.6.0.1015
rei_version=9.0.493
emi_minecraft_version=1.19.2
emi_version=0.7.2
patchouli_version=1.19.2-76-FABRIC
cloth_config_version=7.0.72
wthit_version=5.12.0
mod_menu_version=4.0.6
emi_version=1.0.4
patchouli_version=1.19.2-77-FABRIC
cloth_config_version=7.0.74
wthit_version=5.18.0
badpackets_version=0.2.1
mod_menu_version=4.1.2
tr_energy_version=2.3.0
magna_version=1.8.1-1.19
pal_version=1.6.0
megane_api_version=8.1.0
megane_runtime_version=8.1.0
megane_vanilla_version=8.1.0
ae2_version=12.9.3
ae2_version=12.9.5
no_indium_version=1.1.0+1.19
ftb_quests_version=1902.4.11-build.209
ftb_quests_version=1902.4.16-build.235
kubejs_version=1902.6.1-build.300

# Set to rei or jei to pick which tooltip mod gets picked at runtime
# Set to "rei", "jei", or "emi" to pick which tooltip mod gets picked at runtime
# for the dev environment.
runtime_itemlist_mod=emi
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 0 additions & 4 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ pluginManagement {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'Cotton'
url = 'https://server.bbkr.space/artifactory/libs-release/'
}
gradlePluginPortal()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import aztech.modern_industrialization.MIText;
import aztech.modern_industrialization.util.TextHelper;
import java.text.DecimalFormat;
import javax.annotation.Nullable;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import org.jetbrains.annotations.Nullable;

public class ViewerUtil {
private static final DecimalFormat PROBABILITY_FORMAT = new DecimalFormat("#.#");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public ViewerCategory.SlotBuilder variant(TransferVariant<?> variant) {
isFluid = true;
hasBackground = false;
if (!fluid.isBlank()) {
ing = EmiStack.of(fluid);
ing = EmiStack.of(fluid.getFluid(), fluid.getNbt());
}
} else {
throw new IllegalArgumentException("Unknown variant type: " + variant.getClass());
Expand All @@ -162,7 +162,7 @@ public ViewerCategory.SlotBuilder variant(TransferVariant<?> variant) {
public ViewerCategory.SlotBuilder fluid(FluidVariant fluid, long amount, float probability) {
isFluid = true;
hasBackground = false;
ing = EmiStack.of(fluid, amount);
ing = EmiStack.of(fluid.getFluid(), fluid.getNbt(), amount);
processProbability(probability);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
import javax.annotation.Nullable;
import me.shedaniel.rei.api.client.gui.widgets.Tooltip;
import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.api.common.util.EntryStacks;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariantAttributes;
import net.minecraft.network.chat.Component;
import org.jetbrains.annotations.Nullable;

public class ReiSlotUtil {
private ReiSlotUtil() {
Expand Down
Loading

0 comments on commit 2c7c25e

Please sign in to comment.