Skip to content

Commit

Permalink
Arminias' Tweaks Addon for BTW CE 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Arminias committed Nov 23, 2024
0 parents commit 7149556
Show file tree
Hide file tree
Showing 36 changed files with 1,757 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# gradle
.gradle/
build/
out/
classes/

# eclipse
*.launch

# idea
.idea/
*.iml
*.ipr
*.iws

# vscode
.settings/
.vscode/
bin/
.classpath
.project

# fabric
run/

# macos
*.DS_Store
407 changes: 407 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Arminias' Tweaks
This is a collection of tweaks for BTW CE 3.0+.
Most tweaks are optional and can be disabled in the config file.

## Features
- Join invulnerability can be turned off
- Wither can spawn in the end
- Two dragons can spawn in the end
- Login only with this mod installed
- Temp fix for language loading and proxy chat

## License
This project is licensed as CC BY-NC 4.0 and incorporates:
* A precompiled version of [Tiny Remapper](https://github.com/FabricMC/tiny-remapper) (LGPL-3.0)
170 changes: 170 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
import net.fabricmc.loom.api.processor.MinecraftJarProcessor
import net.fabricmc.loom.api.processor.ProcessorContext
import net.fabricmc.loom.api.processor.SpecContext

import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.StandardCopyOption;
plugins {
id 'maven-publish'
id 'fabric-loom' version "1.4-SNAPSHOT"
}

archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group

repositories {
maven {
name = 'legacy-fabric'
url = 'https://maven.legacyfabric.net'
}
// Fixed LWJGL on Linux
maven {
name = 'Babric'
url = 'https://maven.glass-launcher.net/babric'
}
maven {
url file('mavenRepo')
}
mavenCentral() //For fastutil
}

loom {
setIntermediaryUrl('https://maven.legacyfabric.net/net/legacyfabric/intermediary/%1$s/intermediary-%1$s-v2.jar');
//accessWidenerPath = file('src/main/resources/<NAME>.accesswidener')
addMinecraftJarProcessor(
BTWJarReplacer, "BTWJarReplacer", projectDir.toString()
)
}

def lwjglVersion = System.getProperty("os.name").toLowerCase().contains("mac") ? "2.9.1" : "2.9.0"

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "btw.community:mappings:1.0.3"

modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

implementation 'net.fabricmc:fabric-loom:1.4-SNAPSHOT'

implementation 'org.apache.logging.log4j:log4j-core:2.19.0'
implementation 'org.apache.logging.log4j:log4j-api:2.19.0'

implementation "org.lwjgl.lwjgl:lwjgl_util:${lwjglVersion}"
implementation "org.lwjgl.lwjgl:lwjgl:${lwjglVersion}"
implementation "org.lwjgl.lwjgl:lwjgl-platform:${lwjglVersion}"

implementation fileTree(dir: "libs", include: "**.zip")

implementation 'com.google.guava:guava:14.0.1'

// This is what MC 1.6 uses
implementation 'com.google.code.gson:gson:2.2.2'

implementation group: 'it.unimi.dsi', name: 'fastutil', version: '8.5.12'
}

configurations.all {
resolutionStrategy {
dependencySubstitution {
substitute module('org.lwjgl.lwjgl:lwjgl_util:2.9.1-nightly-20130708-debug3') with {
module("org.lwjgl.lwjgl:lwjgl_util:${lwjglVersion}")
}
substitute module('org.lwjgl.lwjgl:lwjgl:2.9.1-nightly-20130708-debug3') with {
module("org.lwjgl.lwjgl:lwjgl:${lwjglVersion}")
}
}
force "org.lwjgl.lwjgl:lwjgl-platform:${lwjglVersion}"
}
}

processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}

tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
}

java {
withSourcesJar()
}

jar {
from sourceSets.main.output.resourcesDir
from sourceSets.main.output.classesDirs
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}

loom {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
accessWidenerPath = file('src/main/resources/tweaks.accesswidener')
}

runClient {
dependsOn(jar)
}

runServer {
dependsOn(jar)
}

class BTWJarReplacer implements MinecraftJarProcessor<Spec> {
String name
String path

@javax.inject.Inject
BTWJarReplacer(String name, String path) {
this.name = name
this.path = path
}

@Override
Spec buildSpec(SpecContext context) {
return new Spec(path)
}

@Override
void processJar(java.nio.file.Path jar, Spec spec, ProcessorContext context) throws IOException {
// Replace the Minecraft jar with the custom one from BTW_dev.
// This is just a straight up file replacement, no remapping or anything.
if (!Files.exists(Paths.get(path, "build_BTW/BTW_dev/BTW_dev.zip"))) {
// Print a warning if the BTW_dev zip doesn't exist.
System.err.println("BTW_dev zip not found, skipping BTWJarReplacer")
} else {
System.out.println("BTW_dev zip found, replacing Minecraft jar with BTW_dev jar.")
Files.copy(Paths.get(path, "build_BTW/BTW_dev/BTW_dev.zip"), jar, StandardCopyOption.REPLACE_EXISTING)
// Add Javadocs
Files.copy(Paths.get(path, "build_BTW/BTW_dev/BTW_dev-javadoc.jar"), jar.resolveSibling(jar.getFileName().toString().replace(".jar", "-javadoc.jar")), StandardCopyOption.REPLACE_EXISTING)
}
}

@Override
String getName() {
return name
}

class Spec implements MinecraftJarProcessor.Spec {
String path

Spec(String path) {
this.path = path
}

@Override
int hashCode() {
if (!Files.exists(Paths.get(path, "build_BTW/BTW_dev/BTW_dev.zip"))) {
return name.hashCode()
} else {
return Files.getLastModifiedTime(Paths.get(path, "build_BTW/BTW_dev/BTW_dev.zip")).hashCode() ^ name.hashCode()
}
}
}
}
12 changes: 12 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Project name (required)
name=Arminias' Tweaks

minecraft_version = 1.6.4
yarn_mappings = 1.6.4+build.420
loader_version = 0.14.19

mod_version = 1.0.0
maven_group = net.fabricmc
archives_base_name = arminias-tweaks

org.gradle.jvmargs=-Xmx4g
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 7149556

Please sign in to comment.