Cleanup modcompat code, initial build setup for JEI support.
This commit is contained in:
parent
497c0134a6
commit
abcac85d0e
30 changed files with 91 additions and 208 deletions
|
@ -28,7 +28,7 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.14.6",
|
"fabricloader": ">=0.14.8",
|
||||||
"fabric": ">=0.55.1",
|
"fabric": ">=0.55.1",
|
||||||
"team_reborn_energy": ">=2.2.0",
|
"team_reborn_energy": ">=2.2.0",
|
||||||
"fabric-biome-api-v1": ">=3.0.0",
|
"fabric-biome-api-v1": ">=3.0.0",
|
||||||
|
|
110
build.gradle
110
build.gradle
|
@ -18,19 +18,6 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
|
||||||
url = "https://www.cursemaven.com"
|
|
||||||
content {
|
|
||||||
includeGroup "curse.maven"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name "DashLoader"
|
|
||||||
url = "https://maven.oskarstrom.net"
|
|
||||||
content {
|
|
||||||
includeGroup "net.oskarstrom"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
maven {
|
maven {
|
||||||
name "REI"
|
name "REI"
|
||||||
url "https://maven.shedaniel.me/"
|
url "https://maven.shedaniel.me/"
|
||||||
|
@ -41,17 +28,10 @@ repositories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
url = 'https://ladysnake.jfrog.io/artifactory/mods'
|
name = "JEI"
|
||||||
|
url = "https://dvs1.progwml6.com/files/maven/"
|
||||||
content {
|
content {
|
||||||
// Trinkets dependency
|
includeGroup "mezz.jei"
|
||||||
includeGroup "io.github.onyxstudios.Cardinal-Components-API"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
url = "https://jitpack.io"
|
|
||||||
content {
|
|
||||||
// Trinkets API
|
|
||||||
includeGroup "com.github.emilyploszaj"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,16 +187,9 @@ dependencies {
|
||||||
|
|
||||||
include project(":RebornCore")
|
include project(":RebornCore")
|
||||||
|
|
||||||
disabledOptionalDependency "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}"
|
|
||||||
disabledOptionalDependency "com.github.emilyploszaj:trinkets:${project.trinkets_version}"
|
|
||||||
disabledOptionalDependency "net.oskarstrom:DashLoader:${project.dashloader_version}"
|
|
||||||
|
|
||||||
// REI's deps depend on the deprecated command module.
|
|
||||||
modRuntimeOnly "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fapi_version}"
|
|
||||||
|
|
||||||
// Use groovy for datagen/gametest, if you are copying this you prob dont want it.
|
// Use groovy for datagen/gametest, if you are copying this you prob dont want it.
|
||||||
gametestImplementation 'org.apache.groovy:groovy:4.0.1'
|
gametestImplementation 'org.apache.groovy:groovy:4.0.3'
|
||||||
datagenImplementation 'org.apache.groovy:groovy:4.0.1'
|
datagenImplementation 'org.apache.groovy:groovy:4.0.3'
|
||||||
|
|
||||||
gametestImplementation ("com.google.truth:truth:1.1.3") {
|
gametestImplementation ("com.google.truth:truth:1.1.3") {
|
||||||
exclude module: "guava"
|
exclude module: "guava"
|
||||||
|
@ -224,27 +197,81 @@ dependencies {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def optionalDependency(String dep) {
|
def modCompat(Map args) {
|
||||||
|
SourceSet compatSourceSet = sourceSets.create(args.name) {
|
||||||
|
compileClasspath += args.sourceSet.compileClasspath
|
||||||
|
runtimeClasspath += args.sourceSet.runtimeClasspath
|
||||||
|
|
||||||
|
java {
|
||||||
|
srcDirs = ["src/compat/${args.name}"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
from compatSourceSet.output.classesDirs
|
||||||
|
from compatSourceSet.output.resourcesDir
|
||||||
|
}
|
||||||
|
|
||||||
|
sourcesJar {
|
||||||
|
from compatSourceSet.allSource
|
||||||
|
}
|
||||||
|
|
||||||
def excludes = {
|
def excludes = {
|
||||||
exclude group: "net.fabricmc.fabric-api"
|
exclude group: "net.fabricmc.fabric-api"
|
||||||
exclude module: "nbt-crafting"
|
exclude module: "nbt-crafting"
|
||||||
exclude module: "modmenu"
|
exclude module: "modmenu"
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies.modLocalRuntime(dep, excludes)
|
// TODO use sourceset specific configurations with https://github.com/FabricMC/fabric-loom/pull/674
|
||||||
dependencies.modCompileOnly(dep, excludes)
|
dependencies {
|
||||||
|
args.dependencies.each { dependency ->
|
||||||
|
modLocalRuntime(dependency, excludes)
|
||||||
|
modCompileOnly(dependency, excludes)
|
||||||
|
}
|
||||||
|
args.compile.each { dependency ->
|
||||||
|
modCompileOnly(dependency, excludes)
|
||||||
|
}
|
||||||
|
args.runtime.each { dependency ->
|
||||||
|
modLocalRuntime(dependency, excludes)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def disabledOptionalDependency(String dep) {
|
allprojects {
|
||||||
def excludes = {
|
loom {
|
||||||
exclude group: "net.fabricmc.fabric-api"
|
mods {
|
||||||
exclude module: "nbt-crafting"
|
techreborn {
|
||||||
exclude module: "modmenu"
|
sourceSet compatSourceSet
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies.modCompileOnly(dep, excludes)
|
configurations.each {
|
||||||
|
println it
|
||||||
}
|
}
|
||||||
|
|
||||||
|
modCompat(
|
||||||
|
name: "rei",
|
||||||
|
dependencies: [
|
||||||
|
"me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}"
|
||||||
|
],
|
||||||
|
sourceSet: sourceSets.client,
|
||||||
|
)
|
||||||
|
|
||||||
|
modCompat(
|
||||||
|
name: "jei",
|
||||||
|
runtime: [
|
||||||
|
// Uncomment to enable JEI
|
||||||
|
// "mezz.jei:jei-1.19-fabric:${project.jei_version}"
|
||||||
|
],
|
||||||
|
compile: [
|
||||||
|
"mezz.jei:jei-1.19-common-api:${project.jei_version}",
|
||||||
|
"mezz.jei:jei-1.19-fabric-api:${project.jei_version}"
|
||||||
|
],
|
||||||
|
sourceSet: sourceSets.client,
|
||||||
|
)
|
||||||
|
|
||||||
loom {
|
loom {
|
||||||
runs {
|
runs {
|
||||||
// Add a data gen run config
|
// Add a data gen run config
|
||||||
|
@ -276,7 +303,6 @@ loom {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
test.dependsOn runGametest
|
|
||||||
|
|
||||||
runDatagen {
|
runDatagen {
|
||||||
// Doesn't re-run the task when its up-to date
|
// Doesn't re-run the task when its up-to date
|
||||||
|
|
|
@ -7,12 +7,11 @@ org.gradle.jvmargs=-Xmx2G
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://modmuss50.me/fabric.html
|
# check these on https://modmuss50.me/fabric.html
|
||||||
minecraft_version=1.19
|
minecraft_version=1.19
|
||||||
yarn_version=1.19+build.1
|
yarn_version=1.19+build.4
|
||||||
loader_version=0.14.6
|
loader_version=0.14.8
|
||||||
fapi_version=0.55.1+1.19
|
fapi_version=0.56.2+1.19
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
energy_version=2.2.0
|
energy_version=2.2.0
|
||||||
rei_version=9.0.466
|
rei_version=9.0.491
|
||||||
trinkets_version=3.0.2
|
jei_version=11.0.0.206
|
||||||
dashloader_version=2.0
|
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
|
||||||
*
|
|
||||||
* Copyright (c) 2020 TechReborn
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package techreborn.client.compat.dashloader;
|
|
||||||
|
|
||||||
import net.oskarstrom.dashloader.DashRegistry;
|
|
||||||
import net.oskarstrom.dashloader.api.annotation.DashConstructor;
|
|
||||||
import net.oskarstrom.dashloader.api.annotation.DashObject;
|
|
||||||
import net.oskarstrom.dashloader.api.enums.ConstructorMode;
|
|
||||||
import net.oskarstrom.dashloader.model.DashModel;
|
|
||||||
import techreborn.client.render.DynamicBucketBakedModel;
|
|
||||||
|
|
||||||
@DashObject(DynamicBucketBakedModel.class)
|
|
||||||
public class DashDynamicBucketBakedModel implements DashModel {
|
|
||||||
|
|
||||||
@DashConstructor(ConstructorMode.EMPTY)
|
|
||||||
public DashDynamicBucketBakedModel() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DynamicBucketBakedModel toUndash(DashRegistry registry) {
|
|
||||||
return new DynamicBucketBakedModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getStage() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
|
||||||
*
|
|
||||||
* Copyright (c) 2020 TechReborn
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package techreborn.client.compat.dashloader;
|
|
||||||
|
|
||||||
import net.oskarstrom.dashloader.DashRegistry;
|
|
||||||
import net.oskarstrom.dashloader.api.annotation.DashConstructor;
|
|
||||||
import net.oskarstrom.dashloader.api.annotation.DashObject;
|
|
||||||
import net.oskarstrom.dashloader.api.enums.ConstructorMode;
|
|
||||||
import net.oskarstrom.dashloader.model.DashModel;
|
|
||||||
import techreborn.client.render.DynamicCellBakedModel;
|
|
||||||
|
|
||||||
@DashObject(DynamicCellBakedModel.class)
|
|
||||||
public class DashDynamicCellBakedModel implements DashModel {
|
|
||||||
|
|
||||||
@DashConstructor(ConstructorMode.EMPTY)
|
|
||||||
public DashDynamicCellBakedModel() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DynamicCellBakedModel toUndash(DashRegistry registry) {
|
|
||||||
return new DynamicCellBakedModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getStage() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package techreborn.client.compat.jei;
|
||||||
|
|
||||||
|
public class TechRebornJEI {
|
||||||
|
// Hello o/
|
||||||
|
}
|
|
@ -40,7 +40,6 @@ import reborncore.common.config.Configuration;
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
import reborncore.common.recipes.RecipeCrafter;
|
||||||
import reborncore.common.util.Torus;
|
import reborncore.common.util.Torus;
|
||||||
import techreborn.blockentity.GuiType;
|
import techreborn.blockentity.GuiType;
|
||||||
import techreborn.compat.trinkets.Trinkets;
|
|
||||||
import techreborn.config.TechRebornConfig;
|
import techreborn.config.TechRebornConfig;
|
||||||
import techreborn.events.ApplyArmorToDamageHandler;
|
import techreborn.events.ApplyArmorToDamageHandler;
|
||||||
import techreborn.events.OreDepthSyncHandler;
|
import techreborn.events.OreDepthSyncHandler;
|
||||||
|
@ -64,8 +63,6 @@ public class TechReborn implements ModInitializer {
|
||||||
new Identifier("techreborn", "item_group"),
|
new Identifier("techreborn", "item_group"),
|
||||||
() -> new ItemStack(TRContent.NUKE));
|
() -> new ItemStack(TRContent.NUKE));
|
||||||
|
|
||||||
public static Predicate<PlayerEntity> elytraPredicate = playerEntity -> false;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
INSTANCE = this;
|
INSTANCE = this;
|
||||||
|
@ -110,10 +107,6 @@ public class TechReborn implements ModInitializer {
|
||||||
ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE.put(TRContent.Dusts.SAW.asItem(), 0.3F);
|
ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE.put(TRContent.Dusts.SAW.asItem(), 0.3F);
|
||||||
ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE.put(TRContent.SmallDusts.SAW.asItem(), 0.1F);
|
ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE.put(TRContent.SmallDusts.SAW.asItem(), 0.1F);
|
||||||
|
|
||||||
if (FabricLoader.getInstance().isModLoaded("trinkets")) {
|
|
||||||
elytraPredicate = Trinkets.isElytraEquipped();
|
|
||||||
}
|
|
||||||
|
|
||||||
TechRebornTemplates.init();
|
TechRebornTemplates.init();
|
||||||
|
|
||||||
LOGGER.info("TechReborn setup done!");
|
LOGGER.info("TechReborn setup done!");
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
|
||||||
*
|
|
||||||
* Copyright (c) 2020 TechReborn
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package techreborn.compat.trinkets;
|
|
||||||
|
|
||||||
import dev.emi.trinkets.api.TrinketsApi;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
|
||||||
import net.minecraft.item.Items;
|
|
||||||
|
|
||||||
import java.util.function.Predicate;
|
|
||||||
|
|
||||||
public class Trinkets {
|
|
||||||
|
|
||||||
public static Predicate<PlayerEntity> isElytraEquipped() {
|
|
||||||
return playerEntity -> TrinketsApi.getTrinketComponent(playerEntity)
|
|
||||||
.map(component -> component.isEquipped(Items.ELYTRA))
|
|
||||||
.orElse(false);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -97,7 +97,7 @@ public class QuantumSuitItem extends TRArmourItem implements ArmorBlockEntityTic
|
||||||
break;
|
break;
|
||||||
case CHEST:
|
case CHEST:
|
||||||
if (enableFlight){
|
if (enableFlight){
|
||||||
if (getStoredEnergy(stack) > flyCost && !TechReborn.elytraPredicate.test(playerEntity)) {
|
if (getStoredEnergy(stack) > flyCost) {
|
||||||
playerEntity.getAbilities().allowFlying = true;
|
playerEntity.getAbilities().allowFlying = true;
|
||||||
if (playerEntity.getAbilities().flying) {
|
if (playerEntity.getAbilities().flying) {
|
||||||
tryUseEnergy(stack, flyCost);
|
tryUseEnergy(stack, flyCost);
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.14.6",
|
"fabricloader": ">=0.14.8",
|
||||||
"fabric": ">=0.55.1",
|
"fabric": ">=0.55.1",
|
||||||
"reborncore": "*",
|
"reborncore": "*",
|
||||||
"team_reborn_energy": ">=2.2.0",
|
"team_reborn_energy": ">=2.2.0",
|
||||||
|
|
Loading…
Reference in a new issue