尝试修复客户端崩溃问题
This commit is contained in:
parent
594c4decf3
commit
470b5839a4
228
build.gradle
228
build.gradle
|
|
@ -1,113 +1,179 @@
|
|||
plugins {
|
||||
id 'eclipse'
|
||||
id 'java'
|
||||
id 'idea'
|
||||
id 'maven-publish'
|
||||
id 'net.neoforged.gradle' version '[6.0.18,6.2)'
|
||||
id 'org.spongepowered.mixin' version '0.7.+'
|
||||
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
|
||||
id 'com.github.johnrengelman.shadow' version '8.1.1'
|
||||
id 'net.neoforged.moddev.legacyforge' version '2.0.103'
|
||||
}
|
||||
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
|
||||
group = maven_group // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = archives_base_name
|
||||
base {
|
||||
archivesName = mod_id
|
||||
}
|
||||
|
||||
group = mod_group_id
|
||||
version = "${minecraft_version}-${mod_version}"
|
||||
|
||||
// set java version
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
|
||||
// required for making a functional mod
|
||||
sourceSets.main.resources.srcDirs += 'src/generated/resources'
|
||||
mixin.add sourceSets.main, "webdisplays.refmap.json"
|
||||
println "Java: ${System.getProperty 'java.version'}"
|
||||
|
||||
// neoforge gradle
|
||||
minecraft {
|
||||
mappings channel: 'parchment', version: '2023.06.26-1.20.1'
|
||||
repositories {
|
||||
mavenCentral()
|
||||
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 {
|
||||
client {
|
||||
properties 'mixin.env.remapRefMap': 'true'
|
||||
property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg"
|
||||
workingDirectory project.file('run')
|
||||
arg "-mixin.config=webdisplays.mixins.json"
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
configureEach {
|
||||
systemProperty 'forge.logging.console.level', 'debug'
|
||||
logLevel = org.slf4j.event.Level.DEBUG
|
||||
}
|
||||
|
||||
mods {
|
||||
webdisplays {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
client {
|
||||
client()
|
||||
programArgument "-mixin.config=${mod_id}.mixins.json"
|
||||
systemProperty 'mixin.debug.export', 'true'
|
||||
}
|
||||
|
||||
server {
|
||||
properties 'mixin.env.remapRefMap': 'true'
|
||||
property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg"
|
||||
workingDirectory project.file('run')
|
||||
arg "-mixin.config=webdisplays.mixins.json"
|
||||
|
||||
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
mods {
|
||||
webdisplays {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
server()
|
||||
programArgument "-mixin.config=${mod_id}.mixins.json"
|
||||
}
|
||||
|
||||
data {
|
||||
workingDirectory project.file('run')
|
||||
properties 'mixin.env.remapRefMap': 'true'
|
||||
property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg"
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
args '--mod', 'webdisplays', '--all', '--output', file('src/generated/resources/'), '--existing', sourceSets.main.resources.srcDirs[0]
|
||||
data()
|
||||
programArguments.addAll '--mod', mod_id, '--all',
|
||||
'--output', file('src/generated/resources/').absolutePath,
|
||||
'--existing', file('src/main/resources/').absolutePath
|
||||
}
|
||||
}
|
||||
|
||||
mods {
|
||||
webdisplays {
|
||||
source sourceSets.main
|
||||
"${mod_id}" {
|
||||
sourceSet sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets.main.resources {
|
||||
srcDir 'src/generated/resources'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// MCEF dependency
|
||||
modImplementation("com.cinemamod:mcef-forge:2.1.1-1.20.1") {
|
||||
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"
|
||||
}
|
||||
|
||||
tasks.named('jar', Jar) {
|
||||
manifest {
|
||||
attributes([
|
||||
'Specification-Title': mod_name,
|
||||
'Specification-Vendor': mod_authors,
|
||||
'Specification-Version': '1',
|
||||
'Implementation-Title': project.name,
|
||||
'Implementation-Version': project.version,
|
||||
'Implementation-Vendor': mod_authors,
|
||||
'MixinConfigs': "${mod_id}.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 = "cursemaven"
|
||||
url = "https://www.cursemaven.com"
|
||||
}
|
||||
maven { url 'https://mcef-download.cinemamod.com/repositories/releases/' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
minecraft 'net.neoforged:forge:1.20.1-47.1.65'
|
||||
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
|
||||
|
||||
// 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
|
||||
name = "local"
|
||||
url = layout.buildDirectory.dir("repo")
|
||||
}
|
||||
}
|
||||
|
||||
// jar meta-info
|
||||
jar {
|
||||
manifest {
|
||||
attributes([
|
||||
"Specification-Title": "WebDisplays",
|
||||
"Specification-Vendor": "CinemaMod Group",
|
||||
"Specification-Version": "1", // We are version 1 of ourselves
|
||||
"Implementation-Title": project.name,
|
||||
"Implementation-Version": project.version,
|
||||
"Implementation-Vendor": "CinemaMod Group",
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
||||
"MixinConfigs": "webdisplays.mixins.json"
|
||||
])
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,36 @@
|
|||
# Done to increase the memory available to gradle.
|
||||
# Gradle settings
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
mod_version = 2.0.2-1.20.1
|
||||
maven_group = com.cinemamod
|
||||
archives_base_name = webdisplays
|
||||
org.gradle.daemon=false
|
||||
org.gradle.parallel=true
|
||||
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 {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
name = 'NeoForged'
|
||||
url = 'https://maven.neoforged.net/releases'
|
||||
}
|
||||
maven { url = 'https://maven.neoforged.net/releases' }
|
||||
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 {
|
||||
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.multiplayer.ClientAdvancements;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
|
@ -589,7 +590,9 @@ public class ClientProxy extends SharedProxy implements ResourceManagerReloadLis
|
|||
if (!tes.isLoaded())
|
||||
tes.load();
|
||||
} else {
|
||||
Camera camera = mc.getEntityRenderDispatcher().camera;
|
||||
EntityRenderDispatcher entityRenderDispatcher = mc.getEntityRenderDispatcher();
|
||||
if (entityRenderDispatcher == null) return;
|
||||
Camera camera = entityRenderDispatcher.camera;
|
||||
Entity entity = null;
|
||||
|
||||
// ide inspection says this is a bunch of constant expressions
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user