Compare commits

..

10 commits

Author SHA1 Message Date
44079faabd move quantum armour values to config
Some checks failed
Check / build (17-jdk) (push) Has been cancelled
Check / build (19-jdk) (push) Has been cancelled
2024-10-21 22:11:38 +02:00
1a190bdbff update gitignore 2024-10-21 22:10:49 +02:00
1dca64f916 fucking crowdin 2024-10-21 22:09:43 +02:00
modmuss50
2211b35513 fix build 2023-08-17 09:48:33 +01:00
modmuss50
9523da1744 Quick fix for https://github.com/TechReborn/TechReborn/issues/3175 2023-08-17 09:08:29 +01:00
modmuss50
0b4b28dd62 Fix reborn core display name. 2023-08-09 13:25:06 +01:00
modmuss50
1c6a48de0f Opps, also bump the version 2023-08-09 13:22:02 +01:00
modmuss50
76005a114b Fix release 2023-08-09 13:13:31 +01:00
modmuss50
f9017f2475 Cleanup model stuff and build script 2023-08-09 13:09:43 +01:00
modmuss50
a31af2bd7c Move to new model loading API. 2023-08-09 12:33:31 +01:00
10 changed files with 70 additions and 84 deletions

View file

@ -27,7 +27,7 @@ jobs:
with: with:
context: changelog context: changelog
workflow_id: release.yml workflow_id: release.yml
- run: ./gradlew build publish publishMods github --stacktrace -x test - run: ./gradlew build publish publishMods --stacktrace -x test
env: env:
RELEASE_CHANNEL: ${{ github.event.inputs.channel }} RELEASE_CHANNEL: ${{ github.event.inputs.channel }}
MAVEN_URL: ${{ secrets.MAVEN_URL }} MAVEN_URL: ${{ secrets.MAVEN_URL }}

1
.gitignore vendored
View file

@ -11,6 +11,7 @@
/.settings /.settings
/classpath /classpath
/dep /dep
/.vscode
TechReborn.iws TechReborn.iws
TechReborn.ipr TechReborn.ipr

View file

@ -28,8 +28,8 @@
} }
], ],
"depends": { "depends": {
"fabricloader": ">=0.14.21", "fabricloader": ">=0.14.22",
"fabric-api": ">=0.82.1", "fabric-api": ">=0.86.1",
"team_reborn_energy": ">=3.0.0", "team_reborn_energy": ">=3.0.0",
"fabric-biome-api-v1": ">=3.0.0", "fabric-biome-api-v1": ">=3.0.0",
"minecraft": ">=1.20.1- <1.20.2-" "minecraft": ">=1.20.1- <1.20.2-"

View file

@ -1,9 +1,3 @@
buildscript {
dependencies {
classpath 'org.kohsuke:github-api:1.135'
}
}
plugins { plugins {
id 'java' id 'java'
id 'groovy' id 'groovy'
@ -13,7 +7,7 @@ plugins {
id 'maven-publish' id 'maven-publish'
id 'com.diffplug.spotless' version '6.19.0' id 'com.diffplug.spotless' version '6.19.0'
id 'fabric-loom' version '1.3-SNAPSHOT' id 'fabric-loom' version '1.3-SNAPSHOT'
id 'me.modmuss50.mod-publish-plugin' version '0.0.3' id 'me.modmuss50.mod-publish-plugin' version '0.3.3'
} }
repositories { repositories {
@ -83,7 +77,7 @@ allprojects {
publications { publications {
register("maven", MavenPublication) { register("maven", MavenPublication) {
groupId project.name groupId project.name
artifactId project.archivesBaseName + "-" + getBranch() artifactId project.archivesBaseName + "-" + (ENV.GITHUB_REF_NAME ?: "local")
version project.version version project.version
from components.java from components.java
@ -259,7 +253,7 @@ tasks.sourcesJar.dependsOn runDatagen
jar { jar {
exclude "**/*.psd" exclude "**/*.psd"
from file('src/main/generated') from file('src/main/generated')
from { crowdin.getDidWork() ? fileTree('build/translations').matching{exclude "**/en_US.json"} : null} from { fileTree('build/translations').matching{exclude "**/en_US.json"} }
// A bit of a hack to allow the generated sources when they already exist // A bit of a hack to allow the generated sources when they already exist
duplicatesStrategy = DuplicatesStrategy.EXCLUDE duplicatesStrategy = DuplicatesStrategy.EXCLUDE
@ -285,15 +279,15 @@ tasks.register('crowdinExport') {
def translationsUrl = "https://crowdin.com/backend/download/project/techreborn.zip" def translationsUrl = "https://crowdin.com/backend/download/project/techreborn.zip"
def translationsZip = file("build/translations.zip") def translationsZip = file("build/translations.zip")
tasks.register('crowdin') { // tasks.register('crowdin') {
dependsOn crowdinExport // dependsOn crowdinExport
description "Downloads translations from CrowdIn" // description "Downloads translations from CrowdIn"
outputs.file translationsZip // outputs.file translationsZip
doLast { // doLast {
translationsZip.bytes = new URL(translationsUrl).bytes // translationsZip.bytes = new URL(translationsUrl).bytes
} // }
} // }
tasks.register('cleanCrowdin', Delete) { tasks.register('cleanCrowdin', Delete) {
description "Delete old translations" description "Delete old translations"
@ -302,7 +296,7 @@ tasks.register('cleanCrowdin', Delete) {
clean.dependsOn cleanCrowdin clean.dependsOn cleanCrowdin
tasks.register('renameCrowdin', Copy) { tasks.register('renameCrowdin', Copy) {
dependsOn crowdin // dependsOn crowdin
description "Renames the translation files to be all lower case" description "Renames the translation files to be all lower case"
from zipTree(translationsZip) from zipTree(translationsZip)
into file('build/translations') into file('build/translations')
@ -340,11 +334,11 @@ tasks.register('copyTranslationsToGenerated', Copy) {
} }
publishMods { publishMods {
changelog = ENV.CHANGELOG ?: "No changelog provided" changelog = providers.environmentVariable("CHANGELOG").orElse("No changelog provided")
version = project.version version = project.version
type = ENV.RELEASE_CHANNEL == "release" ? STABLE : BETA type = providers.environmentVariable("RELEASE_CHANNEL").orElse("release").map {it == "release" ? STABLE : BETA }
modLoaders.add("fabric") modLoaders.add("fabric")
dryRun = ENV.CURSEFORGE_API_KEY == null dryRun = providers.environmentVariable("CURSEFORGE_API_KEY").getOrNull() == null
def options = curseforgeOptions { def options = curseforgeOptions {
accessToken = providers.environmentVariable("CURSEFORGE_API_KEY") accessToken = providers.environmentVariable("CURSEFORGE_API_KEY")
@ -372,40 +366,14 @@ publishMods {
from options from options
projectId = "237903" projectId = "237903"
file = project(":RebornCore").tasks.remapJar.archiveFile file = project(":RebornCore").tasks.remapJar.archiveFile
} displayName = "RebornCore $version"
} }
static def getBranch() { github {
def ENV = System.getenv() file = remapJar.archiveFile
if (ENV.GITHUB_REF) { additionalFiles.from project(":RebornCore").tasks.remapJar.archiveFile
def branch = ENV.GITHUB_REF repository = providers.environmentVariable("GITHUB_REPOSITORY").orElse("dryrun")
return branch.substring(branch.lastIndexOf("/") + 1) accessToken = providers.environmentVariable("GITHUB_TOKEN")
} commitish = providers.environmentVariable("GITHUB_REF_NAME").orElse("dryrun")
return "unknown"
}
import org.kohsuke.github.GHReleaseBuilder
import org.kohsuke.github.GitHub
tasks.register('github') {
dependsOn remapJar
onlyIf {
ENV.GITHUB_TOKEN
}
doLast {
def github = GitHub.connectUsingOAuth(ENV.GITHUB_TOKEN as String)
def repository = github.getRepository(ENV.GITHUB_REPOSITORY)
def releaseBuilder = new GHReleaseBuilder(repository, version as String)
releaseBuilder.name("${archivesBaseName}-${version}")
releaseBuilder.body(ENV.CHANGELOG)
releaseBuilder.commitish(getBranch())
def ghRelease = releaseBuilder.create()
ghRelease.uploadAsset(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar"), "application/java-archive")
ghRelease.uploadAsset(file("RebornCore/build/libs/RebornCore-${version}.jar"), "application/java-archive")
} }
} }
github.dependsOn(project(":RebornCore").getTasks().named("remapJar"))

View file

@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx2G
fabric.loom.multiProjectOptimisation=true fabric.loom.multiProjectOptimisation=true
# Mod properties # Mod properties
mod_version=5.8.5 mod_version=5.8.7
# Fabric Properties # Fabric Properties
# check these on https://modmuss50.me/fabric.html # check these on https://modmuss50.me/fabric.html
minecraft_version=1.20.1 minecraft_version=1.20.1
yarn_version=1.20.1+build.1 yarn_version=1.20.1+build.1
loader_version=0.14.21 loader_version=0.14.22
fapi_version=0.83.0+1.20.1 fapi_version=0.86.1+1.20.1
# Dependencies # Dependencies
energy_version=3.0.0 energy_version=3.0.0

View file

@ -26,7 +26,7 @@ package techreborn;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry; import net.fabricmc.fabric.api.client.model.loading.v1.ModelLoadingPlugin;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
import net.fabricmc.fabric.api.renderer.v1.RendererAccess; import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
import net.minecraft.client.item.ClampedModelPredicateProvider; import net.minecraft.client.item.ClampedModelPredicateProvider;
@ -87,37 +87,47 @@ public class TechRebornClient implements ClientModInitializer {
@Override @Override
public void onInitializeClient() { public void onInitializeClient() {
ModelLoadingRegistry.INSTANCE.registerModelProvider((manager, out) -> { ModelLoadingPlugin.register((pluginContext) -> {
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_base"), "inventory")); pluginContext.addModels(
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_fluid"), "inventory")); new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_base"), "inventory"),
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_background"), "inventory")); new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_fluid"), "inventory"),
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_glass"), "inventory")); new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_background"), "inventory"),
new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_glass"), "inventory"),
new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "bucket_base"), "inventory"),
new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "bucket_fluid"), "inventory"),
new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "bucket_background"), "inventory")
);
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "bucket_base"), "inventory")); pluginContext.resolveModel().register((context) -> {
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "bucket_fluid"), "inventory")); final Identifier id = context.id();
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "bucket_background"), "inventory"));
});
ModelLoadingRegistry.INSTANCE.registerVariantProvider(resourceManager -> (modelIdentifier, modelProviderContext) -> { if (!id.getNamespace().equals(TechReborn.MOD_ID) || !id.getPath().startsWith("item/")) {
if (modelIdentifier.getNamespace().equals(TechReborn.MOD_ID)) { return null;
if (modelIdentifier.getPath().equals("cell")) { }
String path = id.getPath().replace("item/", "");
if (path.equals("cell")) {
if (!RendererAccess.INSTANCE.hasRenderer()) { if (!RendererAccess.INSTANCE.hasRenderer()) {
return JsonUnbakedModel.deserialize("{\"parent\":\"minecraft:item/generated\",\"textures\":{\"layer0\":\"techreborn:item/cell_background\"}}"); return JsonUnbakedModel.deserialize("{\"parent\":\"minecraft:item/generated\",\"textures\":{\"layer0\":\"techreborn:item/cell_background\"}}");
} }
return new UnbakedDynamicModel(DynamicCellBakedModel::new); return new UnbakedDynamicModel(DynamicCellBakedModel::new);
} }
Fluid fluid = Registries.FLUID.get(new Identifier(TechReborn.MOD_ID, modelIdentifier.getPath().split("_bucket")[0]));
if (modelIdentifier.getPath().endsWith("_bucket") && fluid != Fluids.EMPTY) { Fluid fluid = Registries.FLUID.get(new Identifier(TechReborn.MOD_ID, path.split("_bucket")[0]));
if (path.endsWith("_bucket") && fluid != Fluids.EMPTY) {
if (!RendererAccess.INSTANCE.hasRenderer()) { if (!RendererAccess.INSTANCE.hasRenderer()) {
return JsonUnbakedModel.deserialize("{\"parent\":\"minecraft:item/generated\",\"textures\":{\"layer0\":\"minecraft:item/bucket\"}}"); return JsonUnbakedModel.deserialize("{\"parent\":\"minecraft:item/generated\",\"textures\":{\"layer0\":\"minecraft:item/bucket\"}}");
} }
return new UnbakedDynamicModel(DynamicBucketBakedModel::new); return new UnbakedDynamicModel(DynamicBucketBakedModel::new);
} }
}
return null; return null;
}); });
});
StackToolTipHandler.setup(); StackToolTipHandler.setup();
ClientboundPacketHandlers.init(); ClientboundPacketHandlers.init();

View file

@ -56,7 +56,6 @@ import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import java.util.List; import java.util.List;
import java.util.Objects;
public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implements InventoryProvider, IToolDrop, IListInfoProvider, BuiltScreenHandlerProvider { public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implements InventoryProvider, IToolDrop, IListInfoProvider, BuiltScreenHandlerProvider {
@ -533,8 +532,10 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
} }
@SuppressWarnings("UnstableApiUsage") @SuppressWarnings("UnstableApiUsage")
private Storage<ItemVariant> getInternalStoreStorage(Direction side) { private Storage<ItemVariant> getInternalStoreStorage(@Nullable Direction direction) {
Objects.requireNonNull(side); // Quick fix to handle null sides. https://github.com/TechReborn/TechReborn/issues/3175
final Direction side = direction != null ? direction : Direction.DOWN;
if (internalStoreStorage[side.getId()] == null) { if (internalStoreStorage[side.getId()] == null) {
internalStoreStorage[side.getId()] = new SingleStackStorage() { internalStoreStorage[side.getId()] = new SingleStackStorage() {
@Override @Override

View file

@ -274,6 +274,12 @@ public class TechRebornConfig {
@Config(config = "items", category = "power", key = "clockingDeviceEnergyUsage", comment = "Cloaking device energy usage") @Config(config = "items", category = "power", key = "clockingDeviceEnergyUsage", comment = "Cloaking device energy usage")
public static int cloakingDeviceCost = 10; public static int cloakingDeviceCost = 10;
@Config(config = "items", category = "power", key = "quantumSuitArmour", comment = "Quantum Suit armour value")
public static double quantumSuitArmour = 20;
@Config(config = "items", category = "power", key = "quantumSuitKnockbackResist", comment = "Quantum Suit knockback resistance")
public static double quantumSuitKnockbackResist = 2;
@Config(config = "items", category = "power", key = "quantumSuitCapacity", comment = "Quantum Suit Energy Capacity") @Config(config = "items", category = "power", key = "quantumSuitCapacity", comment = "Quantum Suit Energy Capacity")
public static long quantumSuitCapacity = 40_000_000; public static long quantumSuitCapacity = 40_000_000;

View file

@ -71,8 +71,8 @@ public class QuantumSuitItem extends TREnergyArmourItem implements ArmorBlockEnt
} }
if (equipmentSlot == this.getSlotType() && getStoredEnergy(stack) > 0) { if (equipmentSlot == this.getSlotType() && getStoredEnergy(stack) > 0) {
attributes.put(EntityAttributes.GENERIC_ARMOR, new EntityAttributeModifier(MODIFIERS[getSlotType().getEntitySlotId()], "Armor modifier", 20, EntityAttributeModifier.Operation.ADDITION)); attributes.put(EntityAttributes.GENERIC_ARMOR, new EntityAttributeModifier(MODIFIERS[getSlotType().getEntitySlotId()], "Armor modifier", TechRebornConfig.quantumSuitArmour, EntityAttributeModifier.Operation.ADDITION));
attributes.put(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE, new EntityAttributeModifier(MODIFIERS[getSlotType().getEntitySlotId()], "Knockback modifier", 2, EntityAttributeModifier.Operation.ADDITION)); attributes.put(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE, new EntityAttributeModifier(MODIFIERS[getSlotType().getEntitySlotId()], "Knockback modifier", TechRebornConfig.quantumSuitKnockbackResist, EntityAttributeModifier.Operation.ADDITION));
} }
return ImmutableMultimap.copyOf(attributes); return ImmutableMultimap.copyOf(attributes);

View file

@ -30,8 +30,8 @@
] ]
}, },
"depends": { "depends": {
"fabricloader": ">=0.14.21", "fabricloader": ">=0.14.22",
"fabric-api": ">=0.82.1", "fabric-api": ">=0.86.1",
"reborncore": "*", "reborncore": "*",
"team_reborn_energy": ">=3.0.0", "team_reborn_energy": ">=3.0.0",
"fabric-biome-api-v1": ">=3.0.0", "fabric-biome-api-v1": ">=3.0.0",