Compare commits

..
10 Commits
Author SHA1 Message Date
bombcar 901dfcb5a0 Merge pull request #21 from GTNewHorizons/chicken
update to support 1.2.0 CCL - needs work to be more performant
2024-01-03 05:38:30 -06:00
bombcar 794c3ca030 fix the rest 2024-01-02 13:07:44 -06:00
bombcar ee37e779fd partial maintain state 2024-01-02 13:02:02 -06:00
bombcar 5039fb8984 update to support 1.2.0 CCL - needs work to be more performant 2024-01-02 11:38:11 -06:00
Martin Robertz cb276d92f5 update bs 2024-01-01 20:21:30 +01:00
Roadhog360andMartin Robertz d336cfbb67 Fix ButtonPart.java crashes, tweaks to allow mods to hook it (#20)
* Fix ButtonPart.java crashes, tweaks to allow mods to hook it
`ButtonPart`:
- Rewrite `getBounds()` to use a list generated from the button hitbox itself, instead of being a hardcoded list. Then mods like Et Futurum Requiem which change buttons only have to mix to `metaSideMap` and `sideMetaMap`
  - This adds an access transformer to get the button hitbox states, which are ordinarily private.
- Change `placement` to check if the corresponding side's value in `sideMetaMap` is `-1` instead of a hardcoded side check, so top/bottom is still unplaceable unless mods add it.
`McSidedMetaPart.java`:
- Fix crash from out of bounds side values from meta (notably in this commit, `-1` from buttons) by making any value below 0 or above 5 return false.

* update bs+sa+gradle+deps

* backdate ccl mod

* derp

---------

Co-authored-by: Martin Robertz <[email protected]>
2023-12-31 16:40:51 +01:00
Ryan Nasers ce032ee9a8 Potential Fix to some FMP stuff relating to Redstone parts not connecting to bottoms of machines. (#18)
* BS Update and spotlessApply

* Forgot this bit

* Changing a line that I'm not actually sure if it will break things
2023-11-25 15:33:31 +01:00
Martin Robertz 819d28b993 update bs+deps 2023-11-08 08:13:28 +01:00
rjnasers f2dc70a3c9 Forgot this bit 2023-11-06 17:23:20 +01:00
rjnasers 75958e3892 BS Update and spotlessApply 2023-11-06 17:23:20 +01:00
20 changed files with 318 additions and 184 deletions

No files matched your search

+204 -111
View File
@@ -1,4 +1,4 @@
//version: 1685785062 //version: 1704135167
/* /*
DO NOT CHANGE THIS FILE! DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available. Also, you may replace this file at any time if there is an update available.
@@ -28,27 +28,11 @@ import java.util.concurrent.TimeUnit
buildscript { buildscript {
repositories { repositories {
mavenCentral()
maven {
name 'forge'
url 'https://maven.minecraftforge.net'
}
maven { maven {
// GTNH RetroFuturaGradle and ASM Fork // GTNH RetroFuturaGradle and ASM Fork
name "GTNH Maven" name "GTNH Maven"
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" url "https://nexus.gtnewhorizons.com/repository/public/"
allowInsecureProtocol = true
} }
maven {
name 'sonatype'
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
maven {
name 'Scala CI dependencies'
url 'https://repo1.maven.org/maven2/'
}
mavenLocal() mavenLocal()
} }
} }
@@ -64,12 +48,12 @@ plugins {
id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version, unused, available for addon.gradle id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version, unused, available for addon.gradle
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
id 'com.palantir.git-version' version '3.0.0' apply false id 'com.palantir.git-version' version '3.0.0' apply false
id 'de.undercouch.download' version '5.4.0' id 'de.undercouch.download' version '5.5.0'
id 'com.github.gmazzo.buildconfig' version '3.1.0' apply false // Unused, available for addon.gradle id 'com.github.gmazzo.buildconfig' version '3.1.0' apply false // Unused, available for addon.gradle
id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version
id 'com.modrinth.minotaur' version '2.+' apply false id 'com.modrinth.minotaur' version '2.+' apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.14' id 'com.gtnewhorizons.retrofuturagradle' version '1.3.26'
} }
print("You might want to check out './gradlew :faq' if your build fails.\n") print("You might want to check out './gradlew :faq' if your build fails.\n")
@@ -89,6 +73,23 @@ def out = services.get(StyledTextOutputFactory).create('an-output')
def projectJavaVersion = JavaLanguageVersion.of(8) def projectJavaVersion = JavaLanguageVersion.of(8)
boolean disableSpotless = project.hasProperty("disableSpotless") ? project.disableSpotless.toBoolean() : false boolean disableSpotless = project.hasProperty("disableSpotless") ? project.disableSpotless.toBoolean() : false
boolean disableCheckstyle = project.hasProperty("disableCheckstyle") ? project.disableCheckstyle.toBoolean() : false
final String CHECKSTYLE_CONFIG = """
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="TreeWalker">
<!-- Use CHECKSTYLE:OFF and CHECKSTYLE:ON comments to suppress checkstyle lints in a block -->
<module name="SuppressionCommentFilter"/>
<module name="AvoidStarImport">
<!-- Allow static wildcard imports for cases like Opcodes and LWJGL classes, these don't get created accidentally by the IDE -->
<property name="allowStaticMemberImports" value="true"/>
</module>
</module>
</module>
"""
checkPropertyExists("modName") checkPropertyExists("modName")
checkPropertyExists("modId") checkPropertyExists("modId")
@@ -115,6 +116,8 @@ propertyDefaultIfUnset("usesMixinDebug", project.usesMixins)
propertyDefaultIfUnset("forceEnableMixins", false) propertyDefaultIfUnset("forceEnableMixins", false)
propertyDefaultIfUnset("channel", "stable") propertyDefaultIfUnset("channel", "stable")
propertyDefaultIfUnset("mappingsVersion", "12") propertyDefaultIfUnset("mappingsVersion", "12")
propertyDefaultIfUnset("usesMavenPublishing", true)
propertyDefaultIfUnset("mavenPublishUrl", "https://nexus.gtnewhorizons.com/repository/releases/")
propertyDefaultIfUnset("modrinthProjectId", "") propertyDefaultIfUnset("modrinthProjectId", "")
propertyDefaultIfUnset("modrinthRelations", "") propertyDefaultIfUnset("modrinthRelations", "")
propertyDefaultIfUnset("curseForgeProjectId", "") propertyDefaultIfUnset("curseForgeProjectId", "")
@@ -138,6 +141,17 @@ if (!disableSpotless) {
apply from: Blowdryer.file('spotless.gradle') apply from: Blowdryer.file('spotless.gradle')
} }
if (!disableCheckstyle) {
apply plugin: 'checkstyle'
tasks.named("checkstylePatchedMc") { enabled = false }
tasks.named("checkstyleMcLauncher") { enabled = false }
tasks.named("checkstyleIdeVirtualMain") { enabled = false }
tasks.named("checkstyleInjectedTags") { enabled = false }
checkstyle {
config = resources.text.fromString(CHECKSTYLE_CONFIG)
}
}
String javaSourceDir = "src/main/java/" String javaSourceDir = "src/main/java/"
String scalaSourceDir = "src/main/scala/" String scalaSourceDir = "src/main/scala/"
String kotlinSourceDir = "src/main/kotlin/" String kotlinSourceDir = "src/main/kotlin/"
@@ -272,7 +286,7 @@ if (apiPackage) {
} }
if (accessTransformersFile) { if (accessTransformersFile) {
for (atFile in accessTransformersFile.split(",")) { for (atFile in accessTransformersFile.split(" ")) {
String targetFile = "src/main/resources/META-INF/" + atFile.trim() String targetFile = "src/main/resources/META-INF/" + atFile.trim()
if (!getFile(targetFile).exists()) { if (!getFile(targetFile).exists()) {
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
@@ -357,7 +371,27 @@ catch (Exception ignored) {
String identifiedVersion String identifiedVersion
String versionOverride = System.getenv("VERSION") ?: null String versionOverride = System.getenv("VERSION") ?: null
try { try {
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride // Produce a version based on the tag, or for branches something like 0.2.2-configurable-maven-and-extras.38+43090270b6-dirty
if (versionOverride == null) {
def gitDetails = versionDetails()
def isDirty = gitVersion().endsWith(".dirty") // No public API for this, isCleanTag has a different meaning
String branchName = gitDetails.branchName ?: (System.getenv('GIT_BRANCH') ?: 'git')
if (branchName.startsWith('origin/')) {
branchName = branchName.minus('origin/')
}
branchName = branchName.replaceAll("[^a-zA-Z0-9-]+", "-") // sanitize branch names for semver
identifiedVersion = gitDetails.lastTag ?: '${gitDetails.gitHash}'
if (gitDetails.commitDistance > 0) {
identifiedVersion += "-${branchName}.${gitDetails.commitDistance}+${gitDetails.gitHash}"
if (isDirty) {
identifiedVersion += "-dirty"
}
} else if (isDirty) {
identifiedVersion += "-${branchName}+${gitDetails.gitHash}-dirty"
}
} else {
identifiedVersion = versionOverride
}
} }
catch (Exception ignored) { catch (Exception ignored) {
out.style(Style.Failure).text( out.style(Style.Failure).text(
@@ -379,9 +413,13 @@ if (identifiedVersion == versionOverride) {
group = "com.github.GTNewHorizons" group = "com.github.GTNewHorizons"
if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) { if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
archivesBaseName = customArchiveBaseName base {
archivesName = customArchiveBaseName
}
} else { } else {
archivesBaseName = modId base {
archivesName = modId
}
} }
@@ -465,10 +503,19 @@ sourceSets {
} }
} }
if (file('addon.gradle').exists()) { if (file('addon.gradle.kts').exists()) {
apply from: 'addon.gradle.kts'
} else if (file('addon.gradle').exists()) {
apply from: 'addon.gradle' apply from: 'addon.gradle'
} }
// File for local tweaks not commited to Git
if (file('addon.local.gradle.kts').exists()) {
apply from: 'addon.local.gradle.kts'
} else if (file('addon.local.gradle').exists()) {
apply from: 'addon.local.gradle'
}
// Allow unsafe repos but warn // Allow unsafe repos but warn
repositories.configureEach { repo -> repositories.configureEach { repo ->
if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) { if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) {
@@ -479,7 +526,14 @@ repositories.configureEach { repo ->
} }
} }
apply from: 'repositories.gradle' if (file('repositories.gradle.kts').exists()) {
apply from: 'repositories.gradle.kts'
} else if (file('repositories.gradle').exists()) {
apply from: 'repositories.gradle'
} else {
logger.error("Neither repositories.gradle.kts nor repositories.gradle was found, make sure you extracted the full ExampleMod template.")
throw new RuntimeException("Missing repositories.gradle[.kts]")
}
configurations { configurations {
runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable) runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
@@ -518,16 +572,15 @@ afterEvaluate {
repositories { repositories {
maven { maven {
name 'Overmind forge repo mirror' name = "GTNH Maven"
url 'https://gregtech.overminddl1.com/' url = "https://nexus.gtnewhorizons.com/repository/public/"
mavenContent { // Links for convenience:
excludeGroup("net.minecraftforge") // missing the `universal` artefact // Simple HTML browsing: https://nexus.gtnewhorizons.com/service/rest/repository/browse/releases/
} // Rich web UI browsing: https://nexus.gtnewhorizons.com/#browse/browse:releases
} }
maven { maven {
name = "GTNH Maven" name 'Overmind forge repo mirror'
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" url 'https://gregtech.overminddl1.com/'
allowInsecureProtocol = true
} }
maven { maven {
name 'sonatype' name 'sonatype'
@@ -537,24 +590,34 @@ repositories {
} }
} }
if (includeWellKnownRepositories.toBoolean()) { if (includeWellKnownRepositories.toBoolean()) {
maven { exclusiveContent {
name "CurseMaven" forRepository {
url "https://cursemaven.com" maven {
content { name "CurseMaven"
url "https://cursemaven.com"
}
}
filter {
includeGroup "curse.maven" includeGroup "curse.maven"
} }
} }
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
filter {
includeGroup "maven.modrinth"
}
}
maven { maven {
name = "ic2" name = "ic2"
url = "https://maven.ic2.player.to/" url = getURL("https://maven2.ic2.player.to/", "https://maven.ic2.player.to/")
metadataSources { content {
mavenPom() includeGroup "net.industrial-craft"
artifact()
} }
}
maven {
name = "ic2-mirror"
url = "https://maven2.ic2.player.to/"
metadataSources { metadataSources {
mavenPom() mavenPom()
artifact() artifact()
@@ -569,11 +632,13 @@ repositories {
def mixinProviderGroup = "io.github.legacymoddingmc" def mixinProviderGroup = "io.github.legacymoddingmc"
def mixinProviderModule = "unimixins" def mixinProviderModule = "unimixins"
def mixinProviderVersion = "0.1.7.1" def mixinProviderVersion = "0.1.13"
def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}" def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}"
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev" def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
ext.mixinProviderSpec = mixinProviderSpec ext.mixinProviderSpec = mixinProviderSpec
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
dependencies { dependencies {
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
@@ -585,7 +650,7 @@ dependencies {
} }
} }
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
implementation(mixinProviderSpec) implementation(modUtils.enableMixins(mixinProviderSpec, mixingConfigRefMap))
} else if (forceEnableMixins.toBoolean()) { } else if (forceEnableMixins.toBoolean()) {
runtimeOnlyNonPublishable(mixinProviderSpec) runtimeOnlyNonPublishable(mixinProviderSpec)
} }
@@ -608,15 +673,37 @@ configurations.all {
substitute module('com.github.GTNewHorizons:SpongePoweredMixin') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods") substitute module('com.github.GTNewHorizons:SpongePoweredMixin') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
substitute module('com.github.GTNewHorizons:SpongeMixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods") substitute module('com.github.GTNewHorizons:SpongeMixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
substitute module('io.github.legacymoddingmc:unimixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Our previous unimixins upload was missing the dev classifier") substitute module('io.github.legacymoddingmc:unimixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Our previous unimixins upload was missing the dev classifier")
substitute module('org.scala-lang:scala-library:2.11.1') using module('org.scala-lang:scala-library:2.11.5') because('To allow mixing with Java 8 targets')
} }
} }
apply from: 'dependencies.gradle' dependencies {
constraints {
def minGtnhLibVersion = "0.0.13"
implementation("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
}
runtimeOnly("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
}
devOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
}
runtimeOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
}
}
}
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' if (file('dependencies.gradle.kts').exists()) {
def mixinTmpDir = buildDir.path + File.separator + 'tmp' + File.separator + 'mixins' apply from: 'dependencies.gradle.kts'
def refMap = "${mixinTmpDir}" + File.separator + mixingConfigRefMap } else if (file('dependencies.gradle').exists()) {
def mixinSrg = "${mixinTmpDir}" + File.separator + "mixins.srg" apply from: 'dependencies.gradle'
} else {
logger.error("Neither dependencies.gradle.kts nor dependencies.gradle was found, make sure you extracted the full ExampleMod template.")
throw new RuntimeException("Missing dependencies.gradle[.kts]")
}
tasks.register('generateAssets') { tasks.register('generateAssets') {
group = "GTNH Buildscript" group = "GTNH Buildscript"
@@ -648,46 +735,17 @@ tasks.register('generateAssets') {
} }
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
tasks.named("reobfJar", ReobfuscatedJar).configure {
extraSrgFiles.from(mixinSrg)
}
tasks.named("processResources").configure { tasks.named("processResources").configure {
dependsOn("generateAssets") dependsOn("generateAssets")
} }
tasks.named("compileJava", JavaCompile).configure { tasks.named("compileJava", JavaCompile).configure {
doFirst {
new File(mixinTmpDir).mkdirs()
}
options.compilerArgs += [ options.compilerArgs += [
"-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}",
"-AoutSrgFile=${mixinSrg}",
"-AoutRefMapFile=${refMap}",
// Elan: from what I understand they are just some linter configs so you get some warning on how to properly code // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code
"-XDenableSunApiLintControl", "-XDenableSunApiLintControl",
"-XDignore.symbol.file" "-XDignore.symbol.file"
] ]
} }
pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
kapt {
correctErrorTypes = true
javacOptions {
option("-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}")
option("-AoutSrgFile=$mixinSrg")
option("-AoutRefMapFile=$refMap")
}
}
tasks.configureEach { task ->
if (task.name == "kaptKotlin") {
task.doFirst {
new File(mixinTmpDir).mkdirs()
}
}
}
}
} }
tasks.named("processResources", ProcessResources).configure { tasks.named("processResources", ProcessResources).configure {
@@ -705,7 +763,6 @@ tasks.named("processResources", ProcessResources).configure {
} }
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
from refMap
dependsOn("compileJava", "compileScala") dependsOn("compileJava", "compileScala")
} }
} }
@@ -724,23 +781,14 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies"
} }
dependencies { dependencies {
def lwjgl3ifyVersion = '1.3.5' def lwjgl3ifyVersion = '1.5.7'
def asmVersion = '9.4'
if (modId != 'lwjgl3ify') { if (modId != 'lwjgl3ify') {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
} }
if (modId != 'hodgepodge') { if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.13') java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.35')
} }
java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false}
java17PatchDependencies("org.ow2.asm:asm:${asmVersion}")
java17PatchDependencies("org.ow2.asm:asm-commons:${asmVersion}")
java17PatchDependencies("org.ow2.asm:asm-tree:${asmVersion}")
java17PatchDependencies("org.ow2.asm:asm-analysis:${asmVersion}")
java17PatchDependencies("org.ow2.asm:asm-util:${asmVersion}")
java17PatchDependencies('org.ow2.asm:asm-deprecated:7.1')
java17PatchDependencies("org.apache.commons:commons-lang3:3.12.0")
java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false} java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false}
} }
@@ -913,8 +961,7 @@ if (usesShadowedDependencies.toBoolean()) {
configurations.runtimeElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar)) configurations.runtimeElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar))
configurations.apiElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar)) configurations.apiElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar))
tasks.named("jar", Jar) { tasks.named("jar", Jar) {
enabled = false archiveClassifier.set('dev-preshadow')
finalizedBy(tasks.shadowJar)
} }
tasks.named("reobfJar", ReobfuscatedJar) { tasks.named("reobfJar", ReobfuscatedJar) {
inputJar.set(tasks.named("shadowJar", ShadowJar).flatMap({it.archiveFile})) inputJar.set(tasks.named("shadowJar", ShadowJar).flatMap({it.archiveFile}))
@@ -923,11 +970,6 @@ if (usesShadowedDependencies.toBoolean()) {
javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) { javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) {
skip() skip()
} }
for (runTask in ["runClient", "runServer", "runClient17", "runServer17"]) {
tasks.named(runTask).configure {
dependsOn("shadowJar")
}
}
} }
ext.publishableDevJar = usesShadowedDependencies.toBoolean() ? tasks.shadowJar : tasks.jar ext.publishableDevJar = usesShadowedDependencies.toBoolean() ? tasks.shadowJar : tasks.jar
ext.publishableObfJar = tasks.reobfJar ext.publishableObfJar = tasks.reobfJar
@@ -979,6 +1021,9 @@ idea {
} }
} }
runConfigurations { runConfigurations {
"0. Build and Test"(Gradle) {
taskNames = ["build"]
}
"1. Run Client"(Gradle) { "1. Run Client"(Gradle) {
taskNames = ["runClient"] taskNames = ["runClient"]
} }
@@ -1098,6 +1143,14 @@ tasks.named("processIdeaSettings").configure {
dependsOn("injectTags") dependsOn("injectTags")
} }
tasks.named("ideVirtualMainClasses").configure {
// Make IntelliJ "Build project" build the mod jars
dependsOn("jar", "reobfJar")
if (!disableSpotless) {
dependsOn("spotlessCheck")
}
}
// workaround variable hiding in pom processing // workaround variable hiding in pom processing
def projectConfigs = project.configurations def projectConfigs = project.configurations
@@ -1116,14 +1169,15 @@ publishing {
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
} }
} }
repositories { repositories {
maven { if (usesMavenPublishing.toBoolean() && System.getenv("MAVEN_USER") != null) {
url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases" maven {
allowInsecureProtocol = true url = mavenPublishUrl
credentials { allowInsecureProtocol = mavenPublishUrl.startsWith("http://")
username = System.getenv("MAVEN_USER") ?: "NONE" credentials {
password = System.getenv("MAVEN_PASSWORD") ?: "NONE" username = System.getenv("MAVEN_USER") ?: "NONE"
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
}
} }
} }
} }
@@ -1238,7 +1292,7 @@ def addCurseForgeRelation(String type, String name) {
// Updating // Updating
def buildscriptGradleVersion = "8.1.1" def buildscriptGradleVersion = "8.5"
tasks.named('wrapper', Wrapper).configure { tasks.named('wrapper', Wrapper).configure {
gradleVersion = buildscriptGradleVersion gradleVersion = buildscriptGradleVersion
@@ -1344,8 +1398,14 @@ boolean isNewBuildScriptVersionAvailable() {
String currentBuildScript = getFile("build.gradle").getText() String currentBuildScript = getFile("build.gradle").getText()
String currentBuildScriptHash = getVersionHash(currentBuildScript) String currentBuildScriptHash = getVersionHash(currentBuildScript)
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() String availableBuildScriptHash
String availableBuildScriptHash = getVersionHash(availableBuildScript) try {
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
availableBuildScriptHash = getVersionHash(availableBuildScript)
} catch (IOException e) {
logger.warn("Could not check for buildscript update availability: {}", e.message)
return false
}
boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash
return !isUpToDate return !isUpToDate
@@ -1510,3 +1570,36 @@ def getSecondaryArtifacts() {
if (apiPackage) secondaryArtifacts += [apiJar] if (apiPackage) secondaryArtifacts += [apiJar]
return secondaryArtifacts return secondaryArtifacts
} }
def getURL(String main, String fallback) {
return pingURL(main, 10000) ? main : fallback
}
// credit: https://stackoverflow.com/a/3584332
def pingURL(String url, int timeout) {
url = url.replaceFirst("^https", "http") // Otherwise an exception may be thrown on invalid SSL certificates.
try {
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection()
connection.setConnectTimeout(timeout)
connection.setReadTimeout(timeout)
connection.setRequestMethod("HEAD")
int responseCode = connection.getResponseCode()
return 200 <= responseCode && responseCode <= 399
} catch (IOException ignored) {
return false
}
}
// For easier scripting of things that require variables defined earlier in the buildscript
if (file('addon.late.gradle.kts').exists()) {
apply from: 'addon.late.gradle.kts'
} else if (file('addon.late.gradle').exists()) {
apply from: 'addon.late.gradle'
}
// File for local tweaks not commited to Git
if (file('addon.late.local.gradle.kts').exists()) {
apply from: 'addon.late.local.gradle.kts'
} else if (file('addon.late.local.gradle').exists()) {
apply from: 'addon.late.local.gradle'
}
+2 -2
View File
@@ -1,6 +1,6 @@
// Add your dependencies here // Add your dependencies here
dependencies { dependencies {
api("com.github.GTNewHorizons:CodeChickenLib:1.1.8:dev") api("com.github.GTNewHorizons:CodeChickenLib:1.2.0:dev")
devOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.3.57-GTNH:dev") devOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.4.13-GTNH:dev")
} }
+1 -1
View File
@@ -38,7 +38,7 @@ apiPackage =
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/ # Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg # Example value: mymodid_at.cfg
accessTransformersFile = accessTransformersFile = multipart_at.cfg
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! # Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false usesMixins = false
Binary file not shown.
+2 -1
View File
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
Vendored
+8 -4
View File
@@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@@ -133,10 +130,13 @@ location of your Java installation."
fi fi
else else
JAVACMD=java JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
@@ -197,6 +197,10 @@ if "$cygwin" || "$msys" ; then
done done
fi fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command; # Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in # shell script including quotes and variable substitutions, so put them in
@@ -0,0 +1 @@
public net.minecraft.block.BlockButton func_150043_b(I)V #function that sets up hitboxes for that meta
-7
View File
@@ -1,7 +0,0 @@
{
"repo": "https://github.com/GTNewHorizons/CodeChickenLib/releases/download/1.1.5.5/",
"file": "CodeChickenLib-1.7.10-1.1.5.5.jar",
"dev": "https://github.com/GTNewHorizons/CodeChickenLib/releases/download/1.1.5.5/CodeChickenLib-1.7.10-1.1.5.5-dev.jar",
"class": "codechicken.lib.asm.ASMHelper",
"coreLib": true
}
@@ -1,27 +1,48 @@
package codechicken.core.launch; package codechicken.core.launch;
import java.awt.*; import static java.awt.Component.LEFT_ALIGNMENT;
import java.awt.Desktop;
import java.awt.Dialog.ModalityType; import java.awt.Dialog.ModalityType;
import java.awt.Dimension;
import java.awt.GraphicsEnvironment;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.io.*; import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.InterruptedIOException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.net.URLClassLoader; import java.net.URLClassLoader;
import java.net.URLConnection; import java.net.URLConnection;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.*; import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException; import java.util.regex.PatternSyntaxException;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
import javax.swing.*; import javax.swing.Box;
import javax.swing.JDialog;
import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JProgressBar;
import javax.swing.WindowConstants;
import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener; import javax.swing.event.HyperlinkListener;
@@ -24,7 +24,7 @@ object MaterialRenderHelper {
def start(pos: Vector3, pass: Int, uvt: UVTransformation) = { def start(pos: Vector3, pass: Int, uvt: UVTransformation) = {
this.pass = pass this.pass = pass
builder = CCRenderState.pipeline.builder() builder = CCRenderState.instance().pipeline.builder()
builder.add(pos.translation()).add(uvt) builder.add(pos.translation()).add(uvt)
this this
} }
@@ -36,7 +36,7 @@ object MaterialRenderHelper {
def lighting() = { def lighting() = {
if (pass != -1) if (pass != -1)
builder.add(CCRenderState.lightMatrix) builder.add(CCRenderState.instance().lightMatrix)
this this
} }
@@ -85,9 +85,10 @@ class BlockMicroMaterial(val block: Block, val meta: Int = 0)
if (pass == -1) if (pass == -1)
block.getBlockColor << 8 | 0xff block.getBlockColor << 8 | 0xff
else { else {
val pos = CCRenderState.lightMatrix.pos val state = CCRenderState.instance
val pos = state.lightMatrix.pos
block.colorMultiplier( block.colorMultiplier(
CCRenderState.lightMatrix.access, state.lightMatrix.access,
pos.x, pos.x,
pos.y, pos.y,
pos.z pos.z
@@ -2,7 +2,7 @@ package codechicken.microblock
import codechicken.lib.vec.{Cuboid6, Vector3} import codechicken.lib.vec.{Cuboid6, Vector3}
import net.minecraft.block.Block import net.minecraft.block.Block
import codechicken.lib.render.{ColourMultiplier, CCRenderState} import codechicken.lib.render.CCRenderState
import net.minecraft.block.BlockGrass import net.minecraft.block.BlockGrass
import net.minecraft.init.Blocks import net.minecraft.init.Blocks
import codechicken.lib.render.uv.{UVTranslation, IconTransformation} import codechicken.lib.render.uv.{UVTranslation, IconTransformation}
@@ -17,7 +17,7 @@ class GrassMicroMaterial extends BlockMicroMaterial(Blocks.grass, 0) {
} }
override def renderMicroFace(pos: Vector3, pass: Int, bounds: Cuboid6) { override def renderMicroFace(pos: Vector3, pass: Int, bounds: Cuboid6) {
val face = CCRenderState.model.asInstanceOf[BlockFace] val face = CCRenderState.instance().model.asInstanceOf[BlockFace]
if (pass != -1) if (pass != -1)
face.computeLightCoords() face.computeLightCoords()
@@ -42,7 +42,7 @@ class GrassMicroMaterial extends BlockMicroMaterial(Blocks.grass, 0) {
class TopMicroMaterial($block: Block, $meta: Int = 0) class TopMicroMaterial($block: Block, $meta: Int = 0)
extends BlockMicroMaterial($block, $meta) { extends BlockMicroMaterial($block, $meta) {
override def renderMicroFace(pos: Vector3, pass: Int, bounds: Cuboid6) { override def renderMicroFace(pos: Vector3, pass: Int, bounds: Cuboid6) {
val face = CCRenderState.model.asInstanceOf[BlockFace] val face = CCRenderState.instance().model.asInstanceOf[BlockFace]
if (face.side <= 1) if (face.side <= 1)
MaterialRenderHelper MaterialRenderHelper
.start(pos, pass, icont) .start(pos, pass, icont)
@@ -14,7 +14,6 @@ import Vector3._
import codechicken.lib.raytracer.IndexedCuboid6 import codechicken.lib.raytracer.IndexedCuboid6
import org.lwjgl.opengl.GL11 import org.lwjgl.opengl.GL11
import codechicken.lib.render.uv.IconTransformation import codechicken.lib.render.uv.IconTransformation
import codechicken.lib.lighting.LightMatrix
object HollowPlacement extends PlacementProperties { object HollowPlacement extends PlacementProperties {
object HollowPlacementGrid extends FaceEdgeGrid(3 / 8d) object HollowPlacementGrid extends FaceEdgeGrid(3 / 8d)
@@ -74,8 +73,9 @@ trait HollowMicroblockClient
} }
override def drawBreaking(renderBlocks: RenderBlocks) { override def drawBreaking(renderBlocks: RenderBlocks) {
CCRenderState.reset() val state = CCRenderState.instance
CCRenderState.setPipeline( state.reset()
state.setPipeline(
new Translation(x, y, z), new Translation(x, y, z),
new IconTransformation(renderBlocks.overrideBlockTexture) new IconTransformation(renderBlocks.overrideBlockTexture)
) )
@@ -170,17 +170,17 @@ object ItemMicroPartRenderer extends IItemRenderer {
GL11.glScaled(0.5, 0.5, 0.5) GL11.glScaled(0.5, 0.5, 0.5)
if (t == ItemRenderType.INVENTORY || t == ItemRenderType.ENTITY) if (t == ItemRenderType.INVENTORY || t == ItemRenderType.ENTITY)
GL11.glTranslatef(-0.5f, -0.5f, -0.5f) GL11.glTranslatef(-0.5f, -0.5f, -0.5f)
TextureUtils.bindAtlas(0) TextureUtils.bindAtlas(0)
CCRenderState.reset() val state = CCRenderState.instance
CCRenderState.useNormals = true state.reset()
CCRenderState.pullLightmap() state.useNormals = true
CCRenderState.startDrawing() state.pullLightmap()
state.startDrawing()
val part = val part =
mcrClass.create(true, getMaterialID(item)).asInstanceOf[MicroblockClient] mcrClass.create(true, getMaterialID(item)).asInstanceOf[MicroblockClient]
part.setShape(size, mcrClass.itemSlot) part.setShape(size, mcrClass.itemSlot)
part.render(new Vector3(0.5, 0.5, 0.5).subtract(part.getBounds.center), -1) part.render(new Vector3(0.5, 0.5, 0.5).subtract(part.getBounds.center), -1)
CCRenderState.draw() state.draw()
GL11.glPopMatrix() GL11.glPopMatrix()
} }
@@ -112,17 +112,17 @@ object ItemSawRenderer extends IItemRenderer {
) )
case _ => return case _ => return
} }
val state = CCRenderState.instance
CCRenderState.reset() state.reset()
CCRenderState.useNormals = true state.useNormals = true
CCRenderState.pullLightmap() state.pullLightmap()
CCRenderState.changeTexture("microblock:textures/items/saw.png") CCRenderState.changeTexture("microblock:textures/items/saw.png")
CCRenderState.startDrawing() state.startDrawing()
handle.render(t) handle.render(t)
holder.render(t) holder.render(t)
CCRenderState.draw() state.draw()
GL11.glDisable(GL11.GL_CULL_FACE) GL11.glDisable(GL11.GL_CULL_FACE)
CCRenderState.startDrawing() state.startDrawing()
blade.render( blade.render(
t, t,
new UVTranslation( new UVTranslation(
@@ -130,7 +130,7 @@ object ItemSawRenderer extends IItemRenderer {
(item.getItem.asInstanceOf[Saw].getCuttingStrength(item) - 1) * 4 / 64d (item.getItem.asInstanceOf[Saw].getCuttingStrength(item) - 1) * 4 / 64d
) )
) )
CCRenderState.draw() state.draw()
GL11.glEnable(GL11.GL_CULL_FACE) GL11.glEnable(GL11.GL_CULL_FACE)
} }
} }
@@ -31,6 +31,7 @@ object MicroblockRender {
return return
val pos = placement.pos val pos = placement.pos
val part = placement.part.asInstanceOf[MicroblockClient] val part = placement.part.asInstanceOf[MicroblockClient]
val state = CCRenderState.instance
glPushMatrix() glPushMatrix()
glTranslated(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5) glTranslated(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5)
@@ -40,14 +41,14 @@ object MicroblockRender {
glEnable(GL_BLEND) glEnable(GL_BLEND)
glDepthMask(false) glDepthMask(false)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
// TODO: update to use a thread local copy
TextureUtils.bindAtlas(0) TextureUtils.bindAtlas(0)
CCRenderState.reset() state.reset()
CCRenderState.alphaOverride = 80 state.alphaOverride = 80
CCRenderState.useNormals = true state.useNormals = true
CCRenderState.startDrawing() state.startDrawing()
part.render(Vector3.zero, -1) part.render(Vector3.zero, -1)
CCRenderState.draw() state.draw()
glDisable(GL_BLEND) glDisable(GL_BLEND)
glDepthMask(true) glDepthMask(true)
@@ -62,7 +63,7 @@ object MicroblockRender {
c: Cuboid6, c: Cuboid6,
faces: Int faces: Int
) { ) {
CCRenderState.setModel(face) CCRenderState.instance().setModel(face)
for (s <- 0 until 6 if (faces & 1 << s) == 0) { for (s <- 0 until 6 if (faces & 1 << s) == 0) {
face.loadCuboidFace(c, s) face.loadCuboidFace(c, s)
mat.renderMicroFace(pos, pass, c) mat.renderMicroFace(pos, pass, c)
@@ -276,9 +276,6 @@ object RedstoneInteractions {
if (fullVanillaBlocks(block)) if (fullVanillaBlocks(block))
return 0x1f return 0x1f
if (side == 0) // vanilla doesn't handle side 0
return if (power) 0x1f else 0
/** so that these can be conducted to from face parts on the other side of /** so that these can be conducted to from face parts on the other side of
* the block. Due to vanilla's in adequecy with redstone/logic on walls * the block. Due to vanilla's in adequecy with redstone/logic on walls
*/ */
@@ -36,9 +36,10 @@ object MultipartRenderer
if (tmpart.partList.isEmpty) if (tmpart.partList.isEmpty)
return return
CCRenderState.reset() val state = CCRenderState.instance
CCRenderState.pullLightmap() state.reset()
CCRenderState.useNormals = true state.pullLightmap()
state.useNormals = true
val pos = new Vector3(x, y, z) val pos = new Vector3(x, y, z)
tmpart.renderDynamic(pos, f, pass) tmpart.renderDynamic(pos, f, pass)
@@ -81,8 +82,9 @@ object MultipartRenderer
return false return false
} }
CCRenderState.reset() val state = CCRenderState.instance
CCRenderState.lightMatrix.locate(world, x, y, z) state.reset()
state.lightMatrix.locate(world, x, y, z)
return tmpart.renderStatic(new Vector3(x, y, z), pass) return tmpart.renderStatic(new Vector3(x, y, z), pass)
} }
@@ -31,8 +31,9 @@ trait TCuboidPart extends TMultiPart {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
override def drawBreaking(renderBlocks: RenderBlocks) { override def drawBreaking(renderBlocks: RenderBlocks) {
CCRenderState.reset() val state = CCRenderState.instance
CCRenderState.setPipeline( state.reset()
state.setPipeline(
new Translation(x, y, z), new Translation(x, y, z),
new IconTransformation(renderBlocks.overrideBlockTexture) new IconTransformation(renderBlocks.overrideBlockTexture)
) )
@@ -20,8 +20,31 @@ public class ButtonPart extends McSidedMetaPart implements IFaceRedstonePart {
public static BlockButton stoneButton = (BlockButton) Blocks.stone_button; public static BlockButton stoneButton = (BlockButton) Blocks.stone_button;
public static BlockButton woodenButton = (BlockButton) Blocks.wooden_button; public static BlockButton woodenButton = (BlockButton) Blocks.wooden_button;
public static int[] metaSideMap = new int[] { -1, 4, 5, 2, 3 }; public static int[] metaSideMap = new int[] { -1, 4, 5, 2, 3, -1, -1, -1 };
public static int[] sideMetaMap = new int[] { -1, -1, 3, 4, 1, 2 }; public static int[] sideMetaMap = new int[] { -1, -1, 3, 4, 1, 2 };
public static Cuboid6[] cuboidRegions = setupCuboids();
/**
* Capture the boxes of all 16 button states, copying all button hitboxes directly We do this so any button mixins
* will use the proper mixed hitbox size. So mods like Et Futurum Requiem which add floor/ceiling buttons need no
* extra setup to have proper block bounds.
*/
private static Cuboid6[] setupCuboids() {
Cuboid6[] regions = new Cuboid6[16];
for (int i = 0; i < regions.length; i++) {
woodenButton.setBlockBoundsForItemRender(); // Reset bounds
woodenButton.func_150043_b(i); // Set button bounds based on meta; this is how buttons change their hitbox
regions[i] = new Cuboid6(
woodenButton.getBlockBoundsMinX(),
woodenButton.getBlockBoundsMinY(),
woodenButton.getBlockBoundsMinZ(),
woodenButton.getBlockBoundsMaxX(),
woodenButton.getBlockBoundsMaxY(),
woodenButton.getBlockBoundsMaxZ()); // Use the button hitbox to generate a Cuboid6 region. This
// isn't the actual instance, we'll copy from this later.
}
return regions;
}
public static BlockButton getButton(int meta) { public static BlockButton getButton(int meta) {
return (meta & 0x10) > 0 ? woodenButton : stoneButton; return (meta & 0x10) > 0 ? woodenButton : stoneButton;
@@ -58,19 +81,12 @@ public class ButtonPart extends McSidedMetaPart implements IFaceRedstonePart {
@Override @Override
public Cuboid6 getBounds() { public Cuboid6 getBounds() {
int m = meta & 7; // Somehow I got a crash here for meta 20? Let's wrap it to be safe
double d = pressed() ? 0.0625 : 0.125; return cuboidRegions[meta & 15].copy();// these objects get transformed I think, so we need to make a copy.
if (m == 1) return new Cuboid6(0.0, 0.375, 0.5 - 0.1875, d, 0.625, 0.5 + 0.1875);
if (m == 2) return new Cuboid6(1.0 - d, 0.375, 0.5 - 0.1875, 1.0, 0.625, 0.5 + 0.1875);
if (m == 3) return new Cuboid6(0.5 - 0.1875, 0.375, 0.0, 0.5 + 0.1875, 0.625, d);
if (m == 4) return new Cuboid6(0.5 - 0.1875, 0.375, 1.0 - d, 0.5 + 0.1875, 0.625, 1.0);
return null; // falloff
} }
public static McBlockPart placement(World world, BlockCoord pos, int side, int type) { public static McBlockPart placement(World world, BlockCoord pos, int side, int type) {
if (side == 0 || side == 1) return null; if (sideMetaMap[side ^ 1] == -1) return null;
pos = pos.copy().offset(side ^ 1); pos = pos.copy().offset(side ^ 1);
if (!world.isSideSolid(pos.x, pos.y, pos.z, ForgeDirection.getOrientation(side))) return null; if (!world.isSideSolid(pos.x, pos.y, pos.z, ForgeDirection.getOrientation(side))) return null;
@@ -24,8 +24,11 @@ public abstract class McSidedMetaPart extends McMetaPart implements TFacePart {
} }
public boolean canStay() { public boolean canStay() {
BlockCoord pos = new BlockCoord(tile()).offset(sideForMeta(meta)); int side = sideForMeta(meta);
return world().isSideSolid(pos.x, pos.y, pos.z, ForgeDirection.getOrientation(sideForMeta(meta) ^ 1)); if (side < 0 || side > 5) return false;
BlockCoord pos = new BlockCoord(tile()).offset(side);
return world().isSideSolid(pos.x, pos.y, pos.z, ForgeDirection.getOrientation(side ^ 1));
} }
public boolean dropIfCantStay() { public boolean dropIfCantStay() {