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": {
|
||||
"fabricloader": ">=0.14.6",
|
||||
"fabricloader": ">=0.14.8",
|
||||
"fabric": ">=0.55.1",
|
||||
"team_reborn_energy": ">=2.2.0",
|
||||
"fabric-biome-api-v1": ">=3.0.0",
|
||||
|
|
124
build.gradle
124
build.gradle
|
@ -18,19 +18,6 @@ plugins {
|
|||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url = "https://www.cursemaven.com"
|
||||
content {
|
||||
includeGroup "curse.maven"
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name "DashLoader"
|
||||
url = "https://maven.oskarstrom.net"
|
||||
content {
|
||||
includeGroup "net.oskarstrom"
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name "REI"
|
||||
url "https://maven.shedaniel.me/"
|
||||
|
@ -40,18 +27,11 @@ repositories {
|
|||
includeGroup "dev.architectury"
|
||||
}
|
||||
}
|
||||
maven {
|
||||
url = 'https://ladysnake.jfrog.io/artifactory/mods'
|
||||
content {
|
||||
// Trinkets dependency
|
||||
includeGroup "io.github.onyxstudios.Cardinal-Components-API"
|
||||
}
|
||||
}
|
||||
maven {
|
||||
url = "https://jitpack.io"
|
||||
name = "JEI"
|
||||
url = "https://dvs1.progwml6.com/files/maven/"
|
||||
content {
|
||||
// Trinkets API
|
||||
includeGroup "com.github.emilyploszaj"
|
||||
includeGroup "mezz.jei"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -207,16 +187,9 @@ dependencies {
|
|||
|
||||
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.
|
||||
gametestImplementation 'org.apache.groovy:groovy:4.0.1'
|
||||
datagenImplementation 'org.apache.groovy:groovy:4.0.1'
|
||||
gametestImplementation 'org.apache.groovy:groovy:4.0.3'
|
||||
datagenImplementation 'org.apache.groovy:groovy:4.0.3'
|
||||
|
||||
gametestImplementation ("com.google.truth:truth:1.1.3") {
|
||||
exclude module: "guava"
|
||||
|
@ -224,27 +197,81 @@ dependencies {
|
|||
}
|
||||
}
|
||||
|
||||
def optionalDependency(String dep) {
|
||||
def excludes = {
|
||||
exclude group: "net.fabricmc.fabric-api"
|
||||
exclude module: "nbt-crafting"
|
||||
exclude module: "modmenu"
|
||||
}
|
||||
def modCompat(Map args) {
|
||||
SourceSet compatSourceSet = sourceSets.create(args.name) {
|
||||
compileClasspath += args.sourceSet.compileClasspath
|
||||
runtimeClasspath += args.sourceSet.runtimeClasspath
|
||||
|
||||
dependencies.modLocalRuntime(dep, excludes)
|
||||
dependencies.modCompileOnly(dep, excludes)
|
||||
java {
|
||||
srcDirs = ["src/compat/${args.name}"]
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
from compatSourceSet.output.classesDirs
|
||||
from compatSourceSet.output.resourcesDir
|
||||
}
|
||||
|
||||
sourcesJar {
|
||||
from compatSourceSet.allSource
|
||||
}
|
||||
|
||||
def excludes = {
|
||||
exclude group: "net.fabricmc.fabric-api"
|
||||
exclude module: "nbt-crafting"
|
||||
exclude module: "modmenu"
|
||||
}
|
||||
|
||||
// TODO use sourceset specific configurations with https://github.com/FabricMC/fabric-loom/pull/674
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
loom {
|
||||
mods {
|
||||
techreborn {
|
||||
sourceSet compatSourceSet
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def disabledOptionalDependency(String dep) {
|
||||
def excludes = {
|
||||
exclude group: "net.fabricmc.fabric-api"
|
||||
exclude module: "nbt-crafting"
|
||||
exclude module: "modmenu"
|
||||
}
|
||||
|
||||
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 {
|
||||
runs {
|
||||
// Add a data gen run config
|
||||
|
@ -276,7 +303,6 @@ loom {
|
|||
}
|
||||
}
|
||||
}
|
||||
test.dependsOn runGametest
|
||||
|
||||
runDatagen {
|
||||
// Doesn't re-run the task when its up-to date
|
||||
|
|
|
@ -2,17 +2,16 @@
|
|||
org.gradle.jvmargs=-Xmx2G
|
||||
|
||||
# Mod properties
|
||||
mod_version=5.3.2
|
||||
mod_version=5.3.2
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://modmuss50.me/fabric.html
|
||||
minecraft_version=1.19
|
||||
yarn_version=1.19+build.1
|
||||
loader_version=0.14.6
|
||||
fapi_version=0.55.1+1.19
|
||||
minecraft_version=1.19
|
||||
yarn_version=1.19+build.4
|
||||
loader_version=0.14.8
|
||||
fapi_version=0.56.2+1.19
|
||||
|
||||
# Dependencies
|
||||
energy_version=2.2.0
|
||||
rei_version=9.0.466
|
||||
trinkets_version=3.0.2
|
||||
dashloader_version=2.0
|
||||
energy_version=2.2.0
|
||||
rei_version=9.0.491
|
||||
jei_version=11.0.0.206
|
||||
|
|
|
@ -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.util.Torus;
|
||||
import techreborn.blockentity.GuiType;
|
||||
import techreborn.compat.trinkets.Trinkets;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.events.ApplyArmorToDamageHandler;
|
||||
import techreborn.events.OreDepthSyncHandler;
|
||||
|
@ -64,8 +63,6 @@ public class TechReborn implements ModInitializer {
|
|||
new Identifier("techreborn", "item_group"),
|
||||
() -> new ItemStack(TRContent.NUKE));
|
||||
|
||||
public static Predicate<PlayerEntity> elytraPredicate = playerEntity -> false;
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
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.SmallDusts.SAW.asItem(), 0.1F);
|
||||
|
||||
if (FabricLoader.getInstance().isModLoaded("trinkets")) {
|
||||
elytraPredicate = Trinkets.isElytraEquipped();
|
||||
}
|
||||
|
||||
TechRebornTemplates.init();
|
||||
|
||||
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;
|
||||
case CHEST:
|
||||
if (enableFlight){
|
||||
if (getStoredEnergy(stack) > flyCost && !TechReborn.elytraPredicate.test(playerEntity)) {
|
||||
if (getStoredEnergy(stack) > flyCost) {
|
||||
playerEntity.getAbilities().allowFlying = true;
|
||||
if (playerEntity.getAbilities().flying) {
|
||||
tryUseEnergy(stack, flyCost);
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
]
|
||||
},
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14.6",
|
||||
"fabricloader": ">=0.14.8",
|
||||
"fabric": ">=0.55.1",
|
||||
"reborncore": "*",
|
||||
"team_reborn_energy": ">=2.2.0",
|
||||
|
|
Loading…
Reference in a new issue