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:
context: changelog
workflow_id: release.yml
- run: ./gradlew build publish publishMods github --stacktrace -x test
- run: ./gradlew build publish publishMods --stacktrace -x test
env:
RELEASE_CHANNEL: ${{ github.event.inputs.channel }}
MAVEN_URL: ${{ secrets.MAVEN_URL }}

1
.gitignore vendored
View file

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

View file

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

View file

@ -1,9 +1,3 @@
buildscript {
dependencies {
classpath 'org.kohsuke:github-api:1.135'
}
}
plugins {
id 'java'
id 'groovy'
@ -13,7 +7,7 @@ plugins {
id 'maven-publish'
id 'com.diffplug.spotless' version '6.19.0'
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 {
@ -83,7 +77,7 @@ allprojects {
publications {
register("maven", MavenPublication) {
groupId project.name
artifactId project.archivesBaseName + "-" + getBranch()
artifactId project.archivesBaseName + "-" + (ENV.GITHUB_REF_NAME ?: "local")
version project.version
from components.java
@ -259,7 +253,7 @@ tasks.sourcesJar.dependsOn runDatagen
jar {
exclude "**/*.psd"
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
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
@ -285,15 +279,15 @@ tasks.register('crowdinExport') {
def translationsUrl = "https://crowdin.com/backend/download/project/techreborn.zip"
def translationsZip = file("build/translations.zip")
tasks.register('crowdin') {
dependsOn crowdinExport
description "Downloads translations from CrowdIn"
outputs.file translationsZip
// tasks.register('crowdin') {
// dependsOn crowdinExport
// description "Downloads translations from CrowdIn"
// outputs.file translationsZip
doLast {
translationsZip.bytes = new URL(translationsUrl).bytes
}
}
// doLast {
// translationsZip.bytes = new URL(translationsUrl).bytes
// }
// }
tasks.register('cleanCrowdin', Delete) {
description "Delete old translations"
@ -302,7 +296,7 @@ tasks.register('cleanCrowdin', Delete) {
clean.dependsOn cleanCrowdin
tasks.register('renameCrowdin', Copy) {
dependsOn crowdin
// dependsOn crowdin
description "Renames the translation files to be all lower case"
from zipTree(translationsZip)
into file('build/translations')
@ -340,11 +334,11 @@ tasks.register('copyTranslationsToGenerated', Copy) {
}
publishMods {
changelog = ENV.CHANGELOG ?: "No changelog provided"
changelog = providers.environmentVariable("CHANGELOG").orElse("No changelog provided")
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")
dryRun = ENV.CURSEFORGE_API_KEY == null
dryRun = providers.environmentVariable("CURSEFORGE_API_KEY").getOrNull() == null
def options = curseforgeOptions {
accessToken = providers.environmentVariable("CURSEFORGE_API_KEY")
@ -372,40 +366,14 @@ publishMods {
from options
projectId = "237903"
file = project(":RebornCore").tasks.remapJar.archiveFile
displayName = "RebornCore $version"
}
}
static def getBranch() {
def ENV = System.getenv()
if (ENV.GITHUB_REF) {
def branch = ENV.GITHUB_REF
return branch.substring(branch.lastIndexOf("/") + 1)
github {
file = remapJar.archiveFile
additionalFiles.from project(":RebornCore").tasks.remapJar.archiveFile
repository = providers.environmentVariable("GITHUB_REPOSITORY").orElse("dryrun")
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
# Mod properties
mod_version=5.8.5
mod_version=5.8.7
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.20.1
yarn_version=1.20.1+build.1
loader_version=0.14.21
fapi_version=0.83.0+1.20.1
loader_version=0.14.22
fapi_version=0.86.1+1.20.1
# Dependencies
energy_version=3.0.0

View file

@ -26,7 +26,7 @@ package techreborn;
import net.fabricmc.api.ClientModInitializer;
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.renderer.v1.RendererAccess;
import net.minecraft.client.item.ClampedModelPredicateProvider;
@ -87,38 +87,48 @@ public class TechRebornClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
ModelLoadingRegistry.INSTANCE.registerModelProvider((manager, out) -> {
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_base"), "inventory"));
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_fluid"), "inventory"));
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_background"), "inventory"));
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_glass"), "inventory"));
ModelLoadingPlugin.register((pluginContext) -> {
pluginContext.addModels(
new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_base"), "inventory"),
new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_fluid"), "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"));
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "bucket_fluid"), "inventory"));
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "bucket_background"), "inventory"));
});
pluginContext.resolveModel().register((context) -> {
final Identifier id = context.id();
ModelLoadingRegistry.INSTANCE.registerVariantProvider(resourceManager -> (modelIdentifier, modelProviderContext) -> {
if (modelIdentifier.getNamespace().equals(TechReborn.MOD_ID)) {
if (modelIdentifier.getPath().equals("cell")) {
if (!id.getNamespace().equals(TechReborn.MOD_ID) || !id.getPath().startsWith("item/")) {
return null;
}
String path = id.getPath().replace("item/", "");
if (path.equals("cell")) {
if (!RendererAccess.INSTANCE.hasRenderer()) {
return JsonUnbakedModel.deserialize("{\"parent\":\"minecraft:item/generated\",\"textures\":{\"layer0\":\"techreborn:item/cell_background\"}}");
}
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()) {
return JsonUnbakedModel.deserialize("{\"parent\":\"minecraft:item/generated\",\"textures\":{\"layer0\":\"minecraft:item/bucket\"}}");
}
return new UnbakedDynamicModel(DynamicBucketBakedModel::new);
}
}
return null;
return null;
});
});
StackToolTipHandler.setup();
ClientboundPacketHandlers.init();

View file

@ -56,7 +56,6 @@ import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent;
import java.util.List;
import java.util.Objects;
public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implements InventoryProvider, IToolDrop, IListInfoProvider, BuiltScreenHandlerProvider {
@ -533,8 +532,10 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
}
@SuppressWarnings("UnstableApiUsage")
private Storage<ItemVariant> getInternalStoreStorage(Direction side) {
Objects.requireNonNull(side);
private Storage<ItemVariant> getInternalStoreStorage(@Nullable Direction direction) {
// 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) {
internalStoreStorage[side.getId()] = new SingleStackStorage() {
@Override

View file

@ -274,6 +274,12 @@ public class TechRebornConfig {
@Config(config = "items", category = "power", key = "clockingDeviceEnergyUsage", comment = "Cloaking device energy usage")
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")
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) {
attributes.put(EntityAttributes.GENERIC_ARMOR, new EntityAttributeModifier(MODIFIERS[getSlotType().getEntitySlotId()], "Armor modifier", 20, EntityAttributeModifier.Operation.ADDITION));
attributes.put(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE, new EntityAttributeModifier(MODIFIERS[getSlotType().getEntitySlotId()], "Knockback modifier", 2, 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", TechRebornConfig.quantumSuitKnockbackResist, EntityAttributeModifier.Operation.ADDITION));
}
return ImmutableMultimap.copyOf(attributes);

View file

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