尝试修复客户端崩溃问题
This commit is contained in:
parent
594c4decf3
commit
470b5839a4
220
build.gradle
220
build.gradle
|
|
@ -1,113 +1,179 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'eclipse'
|
id 'java'
|
||||||
|
id 'idea'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
id 'net.neoforged.gradle' version '[6.0.18,6.2)'
|
id 'com.github.johnrengelman.shadow' version '8.1.1'
|
||||||
id 'org.spongepowered.mixin' version '0.7.+'
|
id 'net.neoforged.moddev.legacyforge' version '2.0.103'
|
||||||
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
|
|
||||||
}
|
}
|
||||||
apply plugin: 'org.spongepowered.mixin'
|
|
||||||
|
|
||||||
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
|
// Only add ProGuard if building with it
|
||||||
|
def enableProguard = project.hasProperty("enableProguard") && project.enableProguard.toBoolean()
|
||||||
|
if (enableProguard) {
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.guardsquare:proguard-gradle:7.7.0'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
version = mod_version
|
base {
|
||||||
group = maven_group // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
archivesName = mod_id
|
||||||
archivesBaseName = archives_base_name
|
}
|
||||||
|
|
||||||
|
group = mod_group_id
|
||||||
|
version = "${minecraft_version}-${mod_version}"
|
||||||
|
|
||||||
// set java version
|
|
||||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||||
|
|
||||||
// required for making a functional mod
|
println "Java: ${System.getProperty 'java.version'}"
|
||||||
sourceSets.main.resources.srcDirs += 'src/generated/resources'
|
|
||||||
mixin.add sourceSets.main, "webdisplays.refmap.json"
|
|
||||||
|
|
||||||
// neoforge gradle
|
repositories {
|
||||||
minecraft {
|
mavenCentral()
|
||||||
mappings channel: 'parchment', version: '2023.06.26-1.20.1'
|
maven { url = "https://libraries.minecraft.net/" }
|
||||||
|
maven { url = "https://cursemaven.com" }
|
||||||
|
maven { url = "https://maven.parchmentmc.org" }
|
||||||
|
maven { url = 'https://mcef-download.cinemamod.com/repositories/releases/' }
|
||||||
|
maven { url = "https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/" }
|
||||||
|
maven { url = "https://maven.theillusivec4.top/" }
|
||||||
|
maven { url = "https://repo.lucko.me/" }
|
||||||
|
maven { url = "https://maven.kosmx.dev/" }
|
||||||
|
maven { url = "https://modmaven.dev" }
|
||||||
|
flatDir { dir "libs" }
|
||||||
|
}
|
||||||
|
|
||||||
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
legacyForge {
|
||||||
|
version = "${minecraft_version}-${forge_version}"
|
||||||
|
|
||||||
copyIdeResources = true
|
// Access transformer
|
||||||
|
accessTransformers = files("src/main/resources/META-INF/accesstransformer.cfg")
|
||||||
|
|
||||||
|
// Parchment mappings
|
||||||
|
parchment {
|
||||||
|
minecraftVersion = minecraft_version
|
||||||
|
mappingsVersion = mapping_lasting_version
|
||||||
|
}
|
||||||
|
|
||||||
runs {
|
runs {
|
||||||
client {
|
configureEach {
|
||||||
properties 'mixin.env.remapRefMap': 'true'
|
systemProperty 'forge.logging.console.level', 'debug'
|
||||||
property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg"
|
logLevel = org.slf4j.event.Level.DEBUG
|
||||||
workingDirectory project.file('run')
|
}
|
||||||
arg "-mixin.config=webdisplays.mixins.json"
|
|
||||||
property 'forge.logging.console.level', 'debug'
|
|
||||||
|
|
||||||
mods {
|
client {
|
||||||
webdisplays {
|
client()
|
||||||
source sourceSets.main
|
programArgument "-mixin.config=${mod_id}.mixins.json"
|
||||||
}
|
systemProperty 'mixin.debug.export', 'true'
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
properties 'mixin.env.remapRefMap': 'true'
|
server()
|
||||||
property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg"
|
programArgument "-mixin.config=${mod_id}.mixins.json"
|
||||||
workingDirectory project.file('run')
|
|
||||||
arg "-mixin.config=webdisplays.mixins.json"
|
|
||||||
|
|
||||||
|
|
||||||
property 'forge.logging.console.level', 'debug'
|
|
||||||
|
|
||||||
mods {
|
|
||||||
webdisplays {
|
|
||||||
source sourceSets.main
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data {
|
data {
|
||||||
workingDirectory project.file('run')
|
data()
|
||||||
properties 'mixin.env.remapRefMap': 'true'
|
programArguments.addAll '--mod', mod_id, '--all',
|
||||||
property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg"
|
'--output', file('src/generated/resources/').absolutePath,
|
||||||
property 'forge.logging.console.level', 'debug'
|
'--existing', file('src/main/resources/').absolutePath
|
||||||
args '--mod', 'webdisplays', '--all', '--output', file('src/generated/resources/'), '--existing', sourceSets.main.resources.srcDirs[0]
|
}
|
||||||
mods {
|
}
|
||||||
webdisplays {
|
|
||||||
source sourceSets.main
|
mods {
|
||||||
}
|
"${mod_id}" {
|
||||||
}
|
sourceSet sourceSets.main
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories{
|
sourceSets.main.resources {
|
||||||
maven {
|
srcDir 'src/generated/resources'
|
||||||
name = "cursemaven"
|
|
||||||
url = "https://www.cursemaven.com"
|
|
||||||
}
|
|
||||||
maven { url 'https://mcef-download.cinemamod.com/repositories/releases/' }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft 'net.neoforged:forge:1.20.1-47.1.65'
|
// MCEF dependency
|
||||||
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
|
modImplementation("com.cinemamod:mcef-forge:2.1.1-1.20.1") {
|
||||||
|
|
||||||
// useful for debugging performance problems
|
|
||||||
implementation fg.deobf("curse.maven:spark-361579:4381167")
|
|
||||||
// here because we need to manually open the VR keyboard
|
|
||||||
compileOnly fg.deobf("curse.maven:vivecraft-667903:4794431")
|
|
||||||
|
|
||||||
implementation fg.deobf("com.cinemamod:mcef-forge:2.1.1-1.20.1") {
|
|
||||||
transitive = false
|
transitive = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Optional mods (make sure versions exist)
|
||||||
|
modRuntimeOnly "curse.maven:spark-361579:4738952"
|
||||||
|
modCompileOnly "curse.maven:vivecraft-667903:4794431"
|
||||||
|
modImplementation "software.bernie.geckolib:geckolib-forge-${minecraft_version}:${geckolib_version}"
|
||||||
|
modCompileOnly "top.theillusivec4.curios:curios-forge:${curios_version}:api"
|
||||||
|
modRuntimeOnly "top.theillusivec4.curios:curios-forge:${curios_version}"
|
||||||
|
|
||||||
|
// Mixin Extras
|
||||||
|
compileOnly annotationProcessor("io.github.llamalad7:mixinextras-common:0.4.1")
|
||||||
|
modImplementation "io.github.llamalad7:mixinextras-forge:0.4.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
// jar meta-info
|
tasks.named('jar', Jar) {
|
||||||
jar {
|
|
||||||
manifest {
|
manifest {
|
||||||
attributes([
|
attributes([
|
||||||
"Specification-Title": "WebDisplays",
|
'Specification-Title': mod_name,
|
||||||
"Specification-Vendor": "CinemaMod Group",
|
'Specification-Vendor': mod_authors,
|
||||||
"Specification-Version": "1", // We are version 1 of ourselves
|
'Specification-Version': '1',
|
||||||
"Implementation-Title": project.name,
|
'Implementation-Title': project.name,
|
||||||
"Implementation-Version": project.version,
|
'Implementation-Version': project.version,
|
||||||
"Implementation-Vendor": "CinemaMod Group",
|
'Implementation-Vendor': mod_authors,
|
||||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
'MixinConfigs': "${mod_id}.mixins.json"
|
||||||
"MixinConfigs": "webdisplays.mixins.json"
|
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Exclude ProGuard renamed files if ProGuard is used
|
||||||
|
if (enableProguard) {
|
||||||
|
exclude 'META-INF/versions/**'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate sources jar
|
||||||
|
tasks.register('sourcesJar', Jar) {
|
||||||
|
dependsOn classes
|
||||||
|
archiveClassifier = 'sources'
|
||||||
|
from sourceSets.main.allSource
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reobfuscation handling
|
||||||
|
tasks.named('reobfJar') {
|
||||||
|
if (enableProguard) {
|
||||||
|
dependsOn 'proguard'
|
||||||
|
input = file("${buildDir}/libs/${mod_id}-${minecraft_version}-${mod_version}-proguard.jar")
|
||||||
|
} else {
|
||||||
|
dependsOn 'jar'
|
||||||
|
input = tasks.jar.archiveFile.get().asFile
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ProGuard configuration (if enabled)
|
||||||
|
if (enableProguard) {
|
||||||
|
tasks.register('proguard', proguard.gradle.ProGuardTask) {
|
||||||
|
dependsOn tasks.jar
|
||||||
|
configuration 'proguard.pro'
|
||||||
|
|
||||||
|
libraryjars "${System.getProperty('java.home')}/jmods"
|
||||||
|
|
||||||
|
def inputJar = tasks.jar.archiveFile.get().asFile
|
||||||
|
injars inputJar
|
||||||
|
outjars "${buildDir}/libs/${mod_id}-${minecraft_version}-${mod_version}-proguard.jar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
mavenJava(MavenPublication) {
|
||||||
|
artifactId = mod_id
|
||||||
|
artifact reobfJar
|
||||||
|
artifact sourcesJar
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "local"
|
||||||
|
url = layout.buildDirectory.dir("repo")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,36 @@
|
||||||
# Done to increase the memory available to gradle.
|
# Gradle settings
|
||||||
org.gradle.jvmargs = -Xmx3G
|
org.gradle.jvmargs=-Xmx3G
|
||||||
mod_version = 2.0.2-1.20.1
|
org.gradle.daemon=false
|
||||||
maven_group = com.cinemamod
|
org.gradle.parallel=true
|
||||||
archives_base_name = webdisplays
|
org.gradle.caching=true
|
||||||
|
|
||||||
|
# ProGuard
|
||||||
|
enableProguard=false
|
||||||
|
|
||||||
|
# Mod properties
|
||||||
|
mod_id=webdisplays
|
||||||
|
mod_name=WebDisplays
|
||||||
|
mod_version=2.0.3
|
||||||
|
mod_group_id=com.cinemamod
|
||||||
|
mod_authors=CinemaMod Group
|
||||||
|
mod_description=Web browser displays for Minecraft
|
||||||
|
mod_license=All Rights Reserved
|
||||||
|
mod_credits=CinemaMod Group
|
||||||
|
|
||||||
|
# Minecraft/Forge versions
|
||||||
|
minecraft_version=1.20.1
|
||||||
|
forge_version=47.3.4
|
||||||
|
minecraft_version_range=[1.20.1,1.21)
|
||||||
|
forge_version_range=[47,)
|
||||||
|
loader_version_range=[47,)
|
||||||
|
|
||||||
|
# Parchment mappings
|
||||||
|
mapping_channel=parchment
|
||||||
|
mapping_version=2023.09.03-1.20.1
|
||||||
|
mapping_lasting_version=2023.09.03
|
||||||
|
|
||||||
|
# Other mod versions
|
||||||
|
jei_version=15.20.0.112
|
||||||
|
player_anim_version=1.0.2-rc1+1.20
|
||||||
|
geckolib_version=4.2.1
|
||||||
|
curios_version=5.5.0+1.20.1
|
||||||
|
|
@ -1,28 +1,11 @@
|
||||||
pluginManagement {
|
pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
maven {
|
maven { url = 'https://maven.neoforged.net/releases' }
|
||||||
name = 'NeoForged'
|
|
||||||
url = 'https://maven.neoforged.net/releases'
|
|
||||||
}
|
|
||||||
maven { url = 'https://maven.parchmentmc.org' } // Add this line
|
maven { url = 'https://maven.parchmentmc.org' } // Add this line
|
||||||
}
|
}
|
||||||
// resolutionStrategy {
|
|
||||||
// eachPlugin {
|
|
||||||
// switch (requested.id.toString()) {
|
|
||||||
// case "net.minecraftforge.gradle": {
|
|
||||||
// useModule("${requested.id}:ForgeGradle:${requested.version}")
|
|
||||||
// break
|
|
||||||
// }
|
|
||||||
// case "org.spongepowered.mixin": {
|
|
||||||
// useModule("org.spongepowered:mixingradle:${requested.version}")
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
|
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
|
||||||
}
|
}
|
||||||
|
|
@ -21,6 +21,7 @@ import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||||
import net.minecraft.client.multiplayer.ClientAdvancements;
|
import net.minecraft.client.multiplayer.ClientAdvancements;
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
||||||
|
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.NonNullList;
|
import net.minecraft.core.NonNullList;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
|
@ -589,7 +590,9 @@ public class ClientProxy extends SharedProxy implements ResourceManagerReloadLis
|
||||||
if (!tes.isLoaded())
|
if (!tes.isLoaded())
|
||||||
tes.load();
|
tes.load();
|
||||||
} else {
|
} else {
|
||||||
Camera camera = mc.getEntityRenderDispatcher().camera;
|
EntityRenderDispatcher entityRenderDispatcher = mc.getEntityRenderDispatcher();
|
||||||
|
if (entityRenderDispatcher == null) return;
|
||||||
|
Camera camera = entityRenderDispatcher.camera;
|
||||||
Entity entity = null;
|
Entity entity = null;
|
||||||
|
|
||||||
// ide inspection says this is a bunch of constant expressions
|
// ide inspection says this is a bunch of constant expressions
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user