Compare commits

..
2 Commits
Author SHA1 Message Date
Glease 6f1899f14e spotless
Signed-off-by: Glease <[email protected]>
2023-07-17 01:51:44 +08:00
Glease 26862cd669 validate tp packets
Signed-off-by: Glease <[email protected]>
2023-07-17 01:47:34 +08:00
49 changed files with 321 additions and 616 deletions

No files matched your search

+80 -191
View File
@@ -1,4 +1,4 @@
//version: 1699290261
//version: 1685785062
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
@@ -69,7 +69,7 @@ plugins {
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.matthewprenger.cursegradle' version '1.4.0' apply false
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.24'
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.14'
}
print("You might want to check out './gradlew :faq' if your build fails.\n")
@@ -89,23 +89,6 @@ def out = services.get(StyledTextOutputFactory).create('an-output')
def projectJavaVersion = JavaLanguageVersion.of(8)
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("modId")
@@ -132,8 +115,6 @@ propertyDefaultIfUnset("usesMixinDebug", project.usesMixins)
propertyDefaultIfUnset("forceEnableMixins", false)
propertyDefaultIfUnset("channel", "stable")
propertyDefaultIfUnset("mappingsVersion", "12")
propertyDefaultIfUnset("usesMavenPublishing", true)
propertyDefaultIfUnset("mavenPublishUrl", "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases")
propertyDefaultIfUnset("modrinthProjectId", "")
propertyDefaultIfUnset("modrinthRelations", "")
propertyDefaultIfUnset("curseForgeProjectId", "")
@@ -157,17 +138,6 @@ if (!disableSpotless) {
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 scalaSourceDir = "src/main/scala/"
String kotlinSourceDir = "src/main/kotlin/"
@@ -387,27 +357,7 @@ catch (Exception ignored) {
String identifiedVersion
String versionOverride = System.getenv("VERSION") ?: null
try {
// 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
}
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
}
catch (Exception ignored) {
out.style(Style.Failure).text(
@@ -429,13 +379,9 @@ if (identifiedVersion == versionOverride) {
group = "com.github.GTNewHorizons"
if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
base {
archivesName = customArchiveBaseName
}
archivesBaseName = customArchiveBaseName
} else {
base {
archivesName = modId
}
archivesBaseName = modId
}
@@ -519,19 +465,10 @@ sourceSets {
}
}
if (file('addon.gradle.kts').exists()) {
apply from: 'addon.gradle.kts'
} else if (file('addon.gradle').exists()) {
if (file('addon.gradle').exists()) {
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
repositories.configureEach { repo ->
if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) {
@@ -542,14 +479,7 @@ repositories.configureEach { repo ->
}
}
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]")
}
apply from: 'repositories.gradle'
configurations {
runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
@@ -590,6 +520,9 @@ repositories {
maven {
name 'Overmind forge repo mirror'
url 'https://gregtech.overminddl1.com/'
mavenContent {
excludeGroup("net.minecraftforge") // missing the `universal` artefact
}
}
maven {
name = "GTNH Maven"
@@ -604,34 +537,24 @@ repositories {
}
}
if (includeWellKnownRepositories.toBoolean()) {
exclusiveContent {
forRepository {
maven {
name "CurseMaven"
url "https://cursemaven.com"
}
}
filter {
maven {
name "CurseMaven"
url "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
}
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
filter {
includeGroup "maven.modrinth"
}
}
maven {
name = "ic2"
url = getURL("https://maven.ic2.player.to/", "https://maven2.ic2.player.to/")
content {
includeGroup "net.industrial-craft"
url = "https://maven.ic2.player.to/"
metadataSources {
mavenPom()
artifact()
}
}
maven {
name = "ic2-mirror"
url = "https://maven2.ic2.player.to/"
metadataSources {
mavenPom()
artifact()
@@ -646,13 +569,11 @@ repositories {
def mixinProviderGroup = "io.github.legacymoddingmc"
def mixinProviderModule = "unimixins"
def mixinProviderVersion = "0.1.13"
def mixinProviderVersion = "0.1.7.1"
def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}"
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
ext.mixinProviderSpec = mixinProviderSpec
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
dependencies {
if (usesMixins.toBoolean()) {
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
@@ -664,7 +585,7 @@ dependencies {
}
}
if (usesMixins.toBoolean()) {
implementation(modUtils.enableMixins(mixinProviderSpec, mixingConfigRefMap))
implementation(mixinProviderSpec)
} else if (forceEnableMixins.toBoolean()) {
runtimeOnlyNonPublishable(mixinProviderSpec)
}
@@ -690,32 +611,12 @@ configurations.all {
}
}
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")
}
}
}
apply from: 'dependencies.gradle'
if (file('dependencies.gradle.kts').exists()) {
apply from: 'dependencies.gradle.kts'
} else if (file('dependencies.gradle').exists()) {
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]")
}
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
def mixinTmpDir = buildDir.path + File.separator + 'tmp' + File.separator + 'mixins'
def refMap = "${mixinTmpDir}" + File.separator + mixingConfigRefMap
def mixinSrg = "${mixinTmpDir}" + File.separator + "mixins.srg"
tasks.register('generateAssets') {
group = "GTNH Buildscript"
@@ -747,17 +648,46 @@ tasks.register('generateAssets') {
}
if (usesMixins.toBoolean()) {
tasks.named("reobfJar", ReobfuscatedJar).configure {
extraSrgFiles.from(mixinSrg)
}
tasks.named("processResources").configure {
dependsOn("generateAssets")
}
tasks.named("compileJava", JavaCompile).configure {
doFirst {
new File(mixinTmpDir).mkdirs()
}
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
"-XDenableSunApiLintControl",
"-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 {
@@ -775,6 +705,7 @@ tasks.named("processResources", ProcessResources).configure {
}
if (usesMixins.toBoolean()) {
from refMap
dependsOn("compileJava", "compileScala")
}
}
@@ -793,14 +724,23 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies"
}
dependencies {
def lwjgl3ifyVersion = '1.5.1'
def lwjgl3ifyVersion = '1.3.5'
def asmVersion = '9.4'
if (modId != 'lwjgl3ify') {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
}
if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.17')
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.13')
}
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}
}
@@ -1039,9 +979,6 @@ idea {
}
}
runConfigurations {
"0. Build and Test"(Gradle) {
taskNames = ["build"]
}
"1. Run Client"(Gradle) {
taskNames = ["runClient"]
}
@@ -1161,14 +1098,6 @@ tasks.named("processIdeaSettings").configure {
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
def projectConfigs = project.configurations
@@ -1187,15 +1116,14 @@ publishing {
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
}
}
repositories {
if (usesMavenPublishing.toBoolean() && System.getenv("MAVEN_USER") != null) {
maven {
url = mavenPublishUrl
allowInsecureProtocol = mavenPublishUrl.startsWith("http://") // Mostly for the GTNH maven
credentials {
username = System.getenv("MAVEN_USER") ?: "NONE"
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
}
maven {
url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases"
allowInsecureProtocol = true
credentials {
username = System.getenv("MAVEN_USER") ?: "NONE"
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
}
}
}
@@ -1310,7 +1238,7 @@ def addCurseForgeRelation(String type, String name) {
// Updating
def buildscriptGradleVersion = "8.2.1"
def buildscriptGradleVersion = "8.1.1"
tasks.named('wrapper', Wrapper).configure {
gradleVersion = buildscriptGradleVersion
@@ -1416,14 +1344,8 @@ boolean isNewBuildScriptVersionAvailable() {
String currentBuildScript = getFile("build.gradle").getText()
String currentBuildScriptHash = getVersionHash(currentBuildScript)
String availableBuildScriptHash
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
}
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
String availableBuildScriptHash = getVersionHash(availableBuildScript)
boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash
return !isUpToDate
@@ -1588,36 +1510,3 @@ def getSecondaryArtifacts() {
if (apiPackage) secondaryArtifacts += [apiJar]
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'
}
+14 -14
View File
@@ -1,26 +1,26 @@
// Add your dependencies here
dependencies {
api('com.github.GTNewHorizons:EnderCore:0.2.18:dev')
implementation('com.github.GTNewHorizons:ForestryMC:4.7.0:dev')
implementation('com.github.GTNewHorizons:NotEnoughItems:2.4.12-GTNH:dev')
api('com.github.GTNewHorizons:EnderCore:0.2.14:dev')
implementation('com.github.GTNewHorizons:ForestryMC:4.6.7:dev')
implementation('com.github.GTNewHorizons:NotEnoughItems:2.3.53-GTNH:dev')
implementation("com.github.GTNewHorizons:GTNHLib:0.0.13:dev")
api('com.github.GTNewHorizons:BuildCraft:7.1.36:dev')
api('com.github.GTNewHorizons:BuildCraft:7.1.33:dev')
api('curse.maven:cofh-lib-220333:2388748') // https://www.curseforge.com/minecraft/mc-mods/cofh-lib/files/2388748
shadowImplementation('cglib:cglib-nodep:3.3.0')
compileOnly('com.github.GTNewHorizons:waila:1.6.3:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-282-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:waila:1.6.0:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-215-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Baubles:1.0.1.16:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.44.83:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Railcraft:9.15.1:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.12.1-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Chisel:2.12.2-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.9.19-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.43.46:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Railcraft:9.14.1:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.2.0-GTNH:api') {transitive = false}
implementation('com.github.GTNewHorizons:Chisel:2.11.0-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.9.5-GTNH:api') {transitive = false}
compileOnly('curse.maven:minefactory-reloaded-66672:2366150') // https://www.curseforge.com/minecraft/mc-mods/minefactory-reloaded/files/2366150
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('curse.maven:ee3-65509:2305023') // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
compileOnly(rfg.deobf('curse.maven:computercraft-67504:2269339')) // https://www.curseforge.com/minecraft/mc-mods/computercraft/files/2269339
compileOnly(rfg.deobf('curse.maven:mekanism-268560:2475797')) // https://www.curseforge.com/minecraft/mc-mods/mekanism/files/2475797
compileOnly(rfg.deobf('maven.modrinth:immibis-microblocks:59.1.2')) // https://modrinth.com/mod/immibis-microblocks/version/59.1.2
compileOnly(deobf('https://media.forgecdn.net/files/2269/339/ComputerCraft1.75.jar')) // https://www.curseforge.com/minecraft/mc-mods/computercraft/files/2269339
compileOnly(deobf('https://media.forgecdn.net/files/2426/270/Mekanism-1.7.10-9.1.0.281.jar')) // https://aidancbrady.com/mekanism/download/
compileOnly(deobf('https://immibis.com/mcmoddl/files/immibis-microblocks-59.1.2.jar'))
}
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+5 -6
View File
@@ -85,6 +85,9 @@ done
APP_BASE_NAME=${0##*/}
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.
MAX_FD=maximum
@@ -141,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -149,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -194,10 +197,6 @@ if "$cygwin" || "$msys" ; then
done
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;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
@@ -788,7 +788,7 @@ public class EnderIO {
@EventHandler
public void loadComplete(FMLLoadCompleteEvent event) {
processImc(FMLInterModComms.fetchRuntimeMessages(this)); // Some mods send IMCs during PostInit, so we catch
// them here.
// them here.
}
private static String getXPJuiceName() {
@@ -94,10 +94,11 @@ public interface ITelePad extends ITravelAccessable {
/**
* Util method to set all coords using a {@link BlockCoord} object.
*
* @param coords The coords to set this telepad to.
* @see #setX(int)
* @see #setY(int)
* @see #setZ(int)
*
* @param coords The coords to set this telepad to.
*/
void setCoords(BlockCoord coords);
@@ -14,8 +14,9 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
* <li>Staff of travelling</li>
* <li>Telepad</li>
* </ul>
* <p>
*
* As well as any externally added teleports, assuming they fire this event manually.
*
*/
@Cancelable
public class TeleportEntityEvent extends EntityEvent {
@@ -88,7 +88,7 @@ public abstract class AbstractConduit implements IConduit {
* If this is true, it will trigger a reconnection on the next Tick.
* <p>
* Use the method needUpdateConnections() instead of setting this to true.
*
*
* @see needUpdateConnections()
*/
private boolean needUpdateConnections = false;
@@ -47,13 +47,7 @@ import crazypants.enderio.api.tool.ITool;
import crazypants.enderio.conduit.facade.ItemConduitFacade.FacadeType;
import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.geom.ConduitConnectorType;
import crazypants.enderio.conduit.gui.ExternalConnectionContainer;
import crazypants.enderio.conduit.gui.GuiExternalConnection;
import crazypants.enderio.conduit.gui.GuiExternalConnectionSelector;
import crazypants.enderio.conduit.gui.PacketFluidChannel;
import crazypants.enderio.conduit.gui.PacketFluidFilter;
import crazypants.enderio.conduit.gui.PacketOpenConduitUI;
import crazypants.enderio.conduit.gui.PacketSlotVisibility;
import crazypants.enderio.conduit.gui.*;
import crazypants.enderio.conduit.gui.item.PacketExistingItemFilterSnapshot;
import crazypants.enderio.conduit.gui.item.PacketModItemFilter;
import crazypants.enderio.conduit.liquid.PacketFluidLevel;
@@ -641,8 +635,8 @@ public class BlockConduitBundle extends BlockEio
@Override
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
ITool tool = ToolUtil.getEquippedTool(player);
if (!player.isSneaking() || tool == null || !tool.canUse(player.getCurrentEquippedItem(), player, x, y, z)) {
ItemStack equipped = player.getCurrentEquippedItem();
if (!player.isSneaking() || equipped == null || equipped.getItem() != EnderIO.itemYetaWench) {
return;
}
ConduitUtil.openConduitGui(world, x, y, z, player);
@@ -1,15 +1,6 @@
package crazypants.enderio.conduit;
import static crazypants.enderio.gui.IconEIO.CROSS;
import static crazypants.enderio.gui.IconEIO.TICK;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_FLUID;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_FLUID_OFF;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_ITEM;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_ITEM_OFF;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_POWER;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_POWER_OFF;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_REDSTONE;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_REDSTONE_OFF;
import static crazypants.enderio.gui.IconEIO.*;
import java.util.List;
@@ -64,10 +55,11 @@ public class ConduitDisplayMode {
* Use this constructor if you have custom display logic, it will use {@code IConduit.class} as the conduitType, and
* the passed name as the override name.
*
* @see #ConduitDisplayMode(Class, IWidgetIcon, IWidgetIcon)
*
* @param name The override name.
* @param widgetSelected The widget to render when this type is selected.
* @param widgetUnselected The widget to render when this type is unselected.
* @see #ConduitDisplayMode(Class, IWidgetIcon, IWidgetIcon)
*/
public ConduitDisplayMode(String name, IWidgetIcon widgetSelected, IWidgetIcon widgetUnselected) {
this(IConduit.class, widgetSelected, widgetUnselected);
@@ -1,20 +1,9 @@
package crazypants.enderio.conduit;
import static crazypants.enderio.ModObject.blockPainter;
import static crazypants.enderio.material.Alloy.CONDUCTIVE_IRON;
import static crazypants.enderio.material.Alloy.ELECTRICAL_STEEL;
import static crazypants.enderio.material.Alloy.END_STEEL;
import static crazypants.enderio.material.Alloy.ENERGETIC_ALLOY;
import static crazypants.enderio.material.Alloy.PHASED_GOLD;
import static crazypants.enderio.material.Alloy.REDSTONE_ALLOY;
import static crazypants.enderio.material.Material.CONDUIT_BINDER;
import static crazypants.enderio.material.Material.PHASED_IRON_NUGGET;
import static crazypants.enderio.material.endergy.AlloyEndergy.CRUDE_STEEL;
import static crazypants.enderio.material.endergy.AlloyEndergy.CRYSTALLINE_ALLOY;
import static crazypants.enderio.material.endergy.AlloyEndergy.CRYSTALLINE_PINK_SLIME;
import static crazypants.enderio.material.endergy.AlloyEndergy.ENERGETIC_SILVER;
import static crazypants.enderio.material.endergy.AlloyEndergy.MELODIC_ALLOY;
import static crazypants.enderio.material.endergy.AlloyEndergy.STELLAR_ALLOY;
import static crazypants.enderio.material.Alloy.*;
import static crazypants.enderio.material.Material.*;
import static crazypants.enderio.material.endergy.AlloyEndergy.*;
import static crazypants.util.RecipeUtil.addShaped;
import net.minecraft.init.Blocks;
@@ -92,7 +92,7 @@ public class ConduitUtil {
}
}
if (con.getNetwork() != null) { // this should have been destroyed when destroying the neighbours network but
// lets just make
// lets just make
// sure
con.getNetwork().destroyNetwork();
}
@@ -50,6 +50,7 @@ import crazypants.enderio.conduit.power.IPowerConduit;
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit;
import crazypants.enderio.config.Config;
import li.cil.oc.api.network.*;
import li.cil.oc.api.network.Message;
import li.cil.oc.api.network.Node;
import mekanism.api.gas.Gas;
@@ -1,7 +1,6 @@
package crazypants.enderio.conduit.gui;
import java.awt.Color;
import java.awt.Rectangle;
import java.awt.*;
import java.util.ArrayList;
import javax.annotation.Nonnull;
@@ -1,6 +1,6 @@
package crazypants.enderio.conduit.gui.item;
import java.awt.Color;
import java.awt.*;
import javax.annotation.Nonnull;
@@ -612,7 +612,8 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
@Override
public ItemStack createItem() {
return new ItemStack(EnderIO.itemItemConduit, 1, metaData);
ItemStack result = new ItemStack(EnderIO.itemItemConduit, 1, metaData);
return result;
}
@Override
@@ -30,7 +30,7 @@ public interface IItemFilter {
/**
* Checks if the given item passes the filter or not.
*
*
* @param inv the attached inventory - or null when used without an inventory (eg for a GUI)
* @param item the item to check
* @return true if the item is allowed to pass
@@ -13,6 +13,7 @@ import crazypants.enderio.EnderIOTab;
import crazypants.enderio.ModObject;
/**
*
* @author matthias
*/
public class ItemPowerItemFilter extends Item implements IItemFilterUpgrade, IResourceTooltipProvider {
@@ -19,6 +19,7 @@ import crazypants.enderio.conduit.item.NetworkedInventory;
import io.netty.buffer.ByteBuf;
/**
*
* @author matthias
*/
public class PowerItemFilter implements IItemFilter {
@@ -157,11 +157,11 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
boolean res;
if (mode == RedstoneControlMode.OFF) {
// if checking for no signal, must be no signal from both
res = RedstoneControlMode.isConditionMet(mode, signal)
res = mode.isConditionMet(mode, signal)
&& (col != DyeColor.RED || isConditionMetByExternalSignal(dir, mode, col));
} else {
// if checking for a signal, either is fine
res = RedstoneControlMode.isConditionMet(mode, signal)
res = mode.isConditionMet(mode, signal)
|| (col == DyeColor.RED && isConditionMetByExternalSignal(dir, mode, col));
}
return res;
@@ -180,12 +180,7 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
}
}
return RedstoneControlMode.isConditionMet(mode, externalSignal);
}
@Override
protected ConnectionMode getDefaultConnectionMode() {
return ConnectionMode.INPUT;
return mode.isConditionMet(mode, externalSignal);
}
@Override
@@ -1,10 +1,6 @@
package crazypants.enderio.conduit.liquid;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.*;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
@@ -1,5 +1,7 @@
package crazypants.enderio.conduit.liquid;
import static com.enderio.core.client.render.CubeRenderer.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -17,7 +19,6 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import com.enderio.core.client.render.BoundingBox;
import com.enderio.core.client.render.CubeRenderer;
import com.enderio.core.client.render.RenderUtil;
import com.enderio.core.common.util.ForgeDirectionOffsets;
import com.enderio.core.common.vecmath.Vector2f;
@@ -95,12 +96,12 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
List<Vertex> corners = component.bound
.getCornersWithUvForFace(component.dir, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV());
for (Vertex c : corners) {
CubeRenderer.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
}
// back face
for (int i = corners.size() - 1; i >= 0; i--) {
Vertex c = corners.get(i);
CubeRenderer.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
}
}
}
@@ -303,7 +304,7 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
float transY = (bound.sizeY() - sizeY) / 2;
Vector3d translation = new Vector3d(0, transY, 0);
CubeRenderer.setupVertices(bound.translate(translation));
setupVertices(bound.translate(translation));
}
private void calculateRatios(LiquidConduit conduit) {
@@ -1,14 +1,7 @@
package crazypants.enderio.conduit.render;
import static com.enderio.core.client.render.CubeRenderer.addVecWithUV;
import static com.enderio.core.client.render.CubeRenderer.setupVertices;
import static com.enderio.core.client.render.CubeRenderer.verts;
import static net.minecraftforge.common.util.ForgeDirection.DOWN;
import static net.minecraftforge.common.util.ForgeDirection.EAST;
import static net.minecraftforge.common.util.ForgeDirection.NORTH;
import static net.minecraftforge.common.util.ForgeDirection.SOUTH;
import static net.minecraftforge.common.util.ForgeDirection.UP;
import static net.minecraftforge.common.util.ForgeDirection.WEST;
import static com.enderio.core.client.render.CubeRenderer.*;
import static net.minecraftforge.common.util.ForgeDirection.*;
import java.util.Collection;
import java.util.List;
@@ -1,13 +1,8 @@
package crazypants.enderio.item;
import static crazypants.enderio.material.Alloy.CONDUCTIVE_IRON;
import static crazypants.enderio.material.Alloy.DARK_STEEL;
import static crazypants.enderio.material.Alloy.ELECTRICAL_STEEL;
import static crazypants.enderio.material.Alloy.END_STEEL;
import static crazypants.enderio.material.Alloy.ENERGETIC_ALLOY;
import static crazypants.enderio.material.Alloy.SOULARIUM;
import static crazypants.enderio.material.Alloy.*;
import static crazypants.enderio.material.Material.VIBRANT_CYSTAL;
import static crazypants.enderio.material.endergy.AlloyEndergy.STELLAR_ALLOY;
import static crazypants.enderio.material.endergy.AlloyEndergy.*;
import static crazypants.util.RecipeUtil.addShaped;
import net.minecraft.init.Blocks;
@@ -333,7 +333,7 @@ public class ItemDarkSteelPickaxe extends ItemPickaxe
@Override
public int canExtractInternal(ItemStack equipped, int power) {
return Math.min(getEnergyStored(equipped), power);
return extractEnergy(equipped, power, true);
}
private boolean isTravelUpgradeActive(EntityPlayer ep, ItemStack equipped) {
@@ -396,7 +396,7 @@ public class ItemDarkSteelSword extends ItemSword
@Override
public int canExtractInternal(ItemStack equipped, int power) {
return Math.min(getEnergyStored(equipped), power);
return extractEnergy(equipped, power, true);
}
private boolean isTravelUpgradeActive(EntityPlayer ep, ItemStack equipped) {
@@ -41,9 +41,9 @@ public class AbstractMachineRenderer implements ISimpleBlockRenderingHandler, II
private CustomCubeRenderer ccr = new CustomCubeRenderer();
private PaintedBlockRenderer paintedRenderer = new PaintedBlockRenderer(this.getRenderId(), null); // passthrough
// renderer for
// paintable
// machines
// renderer for
// paintable
// machines
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
@@ -9,10 +9,7 @@ import com.enderio.core.common.vecmath.VecmathUtil;
import crazypants.enderio.EnderIO;
import crazypants.enderio.network.PacketHandler;
import crazypants.enderio.power.Capacitors;
import crazypants.enderio.power.ICapacitor;
import crazypants.enderio.power.IInternalPoweredTile;
import crazypants.enderio.power.PowerHandlerUtil;
import crazypants.enderio.power.*;
public abstract class AbstractPoweredMachineEntity extends AbstractMachineEntity implements IInternalPoweredTile {
@@ -12,6 +12,7 @@ import crazypants.enderio.machine.recipe.RecipeBonusType;
* progress' recipe for a machine is stored to and retrieved from a machines TileEntity soley based on its UID.
*
* @author cp
*
*/
public interface IMachineRecipe {
@@ -49,7 +50,7 @@ public interface IMachineRecipe {
/**
* Returns the output from a single 'cycle' of the recipe (even if the inputs would allow the recipe to be crafted
* several times).
* <p>
*
* This method must not return null. If no output is generated an empty array should be returned.
*
* @param randomChance a random number to be used as a seed for determining whether '% chance' outputs are returned.
@@ -1,19 +1,9 @@
package crazypants.enderio.machine;
import static crazypants.enderio.EnderIO.itemBasicCapacitor;
import static crazypants.enderio.material.Alloy.DARK_STEEL;
import static crazypants.enderio.material.Alloy.ELECTRICAL_STEEL;
import static crazypants.enderio.material.Alloy.END_STEEL;
import static crazypants.enderio.material.Alloy.ENERGETIC_ALLOY;
import static crazypants.enderio.material.Alloy.PHASED_GOLD;
import static crazypants.enderio.material.Alloy.PHASED_IRON;
import static crazypants.enderio.material.Alloy.REDSTONE_ALLOY;
import static crazypants.enderio.material.Alloy.SOULARIUM;
import static crazypants.enderio.material.Material.CONDUIT_BINDER;
import static crazypants.enderio.material.Material.ENDER_CRYSTAL;
import static crazypants.enderio.material.Material.PULSATING_CYSTAL;
import static crazypants.enderio.material.Material.SILICON;
import static crazypants.enderio.material.Material.VIBRANT_CYSTAL;
import static crazypants.enderio.material.Alloy.*;
import static crazypants.enderio.material.Material.*;
import static crazypants.util.RecipeUtil.*;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -34,7 +24,6 @@ import crazypants.enderio.material.FrankenSkull;
import crazypants.enderio.material.MachinePart;
import crazypants.enderio.material.Material;
import crazypants.enderio.power.Capacitors;
import crazypants.util.RecipeUtil;
public class MachineRecipes {
@@ -73,24 +62,13 @@ public class MachineRecipes {
String silicon = SILICON.oreDict;
if (Config.addPeacefulRecipes) {
RecipeUtil.addShaped(
frankenZombie,
"gdg",
"dzd",
"gdg",
'g',
"ingotGold",
'd',
"gemDiamond",
'z',
zombieController);
RecipeUtil
.addShaped(sentientEnder, "ddd", "ded", "dgd", 'g', "blockGold", 'd', "gemDiamond", 'e', enderRes);
addShaped(frankenZombie, "gdg", "dzd", "gdg", 'g', "ingotGold", 'd', "gemDiamond", 'z', zombieController);
addShaped(sentientEnder, "ddd", "ded", "dgd", 'g', "blockGold", 'd', "gemDiamond", 'e', enderRes);
}
// stirling gen
ItemStack stirlingGen = new ItemStack(EnderIO.blockStirlingGenerator, 1, 0);
RecipeUtil.addShaped(
addShaped(
stirlingGen,
"bbb",
"bfb",
@@ -107,7 +85,7 @@ public class MachineRecipes {
// Combustion Gen
ItemStack res = new ItemStack(EnderIO.blockTank, 1, 0);
ItemStack comGen = new ItemStack(EnderIO.blockCombustionGenerator, 1, 0);
RecipeUtil.addShaped(
addShaped(
comGen,
"eee",
"rmr",
@@ -125,7 +103,7 @@ public class MachineRecipes {
// ZombieGen
ItemStack zg = new ItemStack(EnderIO.blockZombieGenerator, 1, 0);
RecipeUtil.addShaped(
addShaped(
zg,
"eee",
"qzq",
@@ -139,7 +117,7 @@ public class MachineRecipes {
// FrankenzombieGen
ItemStack fg = new ItemStack(EnderIO.blockFrankenZombieGenerator, 1, 0);
RecipeUtil.addShaped(
addShaped(
fg,
"eee",
"qzq",
@@ -153,7 +131,7 @@ public class MachineRecipes {
// EnderGen
ItemStack eg = new ItemStack(EnderIO.blockEnderGenerator, 1, 0);
RecipeUtil.addShaped(
addShaped(
eg,
"eee",
"qzq",
@@ -167,18 +145,17 @@ public class MachineRecipes {
// KillerJoe
ItemStack kj = new ItemStack(EnderIO.blockKillerJoe, 1, 0);
RecipeUtil.addShaped(kj, "sss", "qzq", "qqq", 's', darkSteel, 'q', fusedQuartz, 'z', frankenZombie);
addShaped(kj, "sss", "qzq", "qqq", 's', darkSteel, 'q', fusedQuartz, 'z', frankenZombie);
// Wireless charger
ItemStack wirelessCharger = new ItemStack(EnderIO.blockWirelessCharger);
// addShaped(wirelessCharger, "svs", "imi", "scs", 's', electricSteel, 'i', silicon, 'm', machineChassi, 'c',
// capacitor3, 'v', vibCry);
RecipeUtil
.addShaped(wirelessCharger, "sss", "ses", "scs", 's', electricalSteel, 'c', capacitor3, 'e', enderRes);
addShaped(wirelessCharger, "sss", "ses", "scs", 's', electricalSteel, 'c', capacitor3, 'e', enderRes);
// Crafter
ItemStack crafter = new ItemStack(EnderIO.blockCrafter, 1, 0);
RecipeUtil.addShaped(
addShaped(
crafter,
"iti",
"imi",
@@ -200,7 +177,7 @@ public class MachineRecipes {
} else {
zombieBit = zombieController;
}
RecipeUtil.addShaped(
addShaped(
poweredSpawner,
"ese",
"eme",
@@ -225,16 +202,15 @@ public class MachineRecipes {
} else {
glassSides = "glass";
}
RecipeUtil
.addShaped(reservoir, "gfg", "gcg", "gfg", 'g', glassSides, 'c', Items.cauldron, 'f', fusedQuartz);
addShaped(reservoir, "gfg", "gcg", "gfg", 'g', glassSides, 'c', Items.cauldron, 'f', fusedQuartz);
}
// Tanks
ItemStack basicTank = new ItemStack(EnderIO.blockTank, 1, 0);
RecipeUtil.addShaped(basicTank, "ibi", "bgb", "ibi", 'g', "glass", 'i', "ingotIron", 'b', Blocks.iron_bars);
addShaped(basicTank, "ibi", "bgb", "ibi", 'g', "glass", 'i', "ingotIron", 'b', Blocks.iron_bars);
ItemStack advTank = new ItemStack(EnderIO.blockTank, 1, 1);
RecipeUtil.addShaped(
addShaped(
advTank,
"ibi",
"bgb",
@@ -249,7 +225,7 @@ public class MachineRecipes {
// mill
ItemStack crusher = new ItemStack(EnderIO.blockCrusher, 1, 0);
if (Config.useHardRecipes) {
RecipeUtil.addShaped(
addShaped(
crusher,
"ooo",
"fmf",
@@ -265,7 +241,7 @@ public class MachineRecipes {
'o',
Blocks.obsidian);
} else {
RecipeUtil.addShaped(
addShaped(
crusher,
"fff",
"imi",
@@ -283,7 +259,7 @@ public class MachineRecipes {
// alloy smelter
ItemStack alloySmelter = new ItemStack(EnderIO.blockAlloySmelter, 1, 0);
if (Config.useHardRecipes) {
RecipeUtil.addShaped(
addShaped(
alloySmelter,
"bfb",
"fmf",
@@ -297,7 +273,7 @@ public class MachineRecipes {
'f',
Blocks.furnace);
} else {
RecipeUtil.addShaped(
addShaped(
alloySmelter,
"bfb",
"fmf",
@@ -314,7 +290,7 @@ public class MachineRecipes {
// Vat
ItemStack still = new ItemStack(EnderIO.blockVat, 1, 0);
RecipeUtil.addShaped(
addShaped(
still,
"eve",
"tmt",
@@ -334,14 +310,13 @@ public class MachineRecipes {
ItemStack capBank1 = BlockItemCapBank
.createItemStackWithPower(CapBankType.getMetaFromType(CapBankType.SIMPLE), 0);
RecipeUtil.addShaped(capBank1, "bcb", "cmc", "bcb", 'b', "ingotIron", 'c', capacitor, 'm', "blockRedstone");
addShaped(capBank1, "bcb", "cmc", "bcb", 'b', "ingotIron", 'c', capacitor, 'm', "blockRedstone");
ItemStack capBank2 = BlockItemCapBank
.createItemStackWithPower(CapBankType.getMetaFromType(CapBankType.ACTIVATED), 0);
RecipeUtil
.addShaped(capBank2, "bcb", "cmc", "bcb", 'b', electricalSteel, 'c', capacitor2, 'm', "blockRedstone");
addShaped(capBank2, "bcb", "cmc", "bcb", 'b', electricalSteel, 'c', capacitor2, 'm', "blockRedstone");
ItemStack capBank3 = BlockItemCapBank
.createItemStackWithPower(CapBankType.getMetaFromType(CapBankType.VIBRANT), 0);
RecipeUtil.addShaped(capBank3, "bcb", "cmc", "bcb", 'b', electricalSteel, 'c', capacitor3, 'm', vibCry);
addShaped(capBank3, "bcb", "cmc", "bcb", 'b', electricalSteel, 'c', capacitor3, 'm', vibCry);
ConvertOldRecipe convertRecipe = new ConvertOldRecipe();
GameRegistry.addRecipe(convertRecipe);
@@ -376,7 +351,7 @@ public class MachineRecipes {
// painter
ItemStack painter = new ItemStack(EnderIO.blockPainter, 1, 0);
if (Config.useHardRecipes) {
RecipeUtil.addShaped(
addShaped(
painter,
"qqq",
"mdm",
@@ -392,7 +367,7 @@ public class MachineRecipes {
'd',
"gemDiamond");
} else {
RecipeUtil.addShaped(
addShaped(
painter,
"qdq",
"mMm",
@@ -416,7 +391,7 @@ public class MachineRecipes {
} else {
zombieBit = zombieController;
}
RecipeUtil.addShaped(
addShaped(
farm,
"ehe",
"eme",
@@ -436,7 +411,7 @@ public class MachineRecipes {
// transceiver
ItemStack transceiver = new ItemStack(EnderIO.blockTransceiver, 1, 0);
if (Config.transceiverUseEasyRecipe) {
RecipeUtil.addShaped(
addShaped(
transceiver,
"oeo",
"pdp",
@@ -452,7 +427,7 @@ public class MachineRecipes {
'd',
Items.diamond);
} else {
RecipeUtil.addShaped(
addShaped(
transceiver,
"oeo",
"pdp",
@@ -467,7 +442,7 @@ public class MachineRecipes {
fusedQuartz,
'd',
endCry);
RecipeUtil.addShapeless(transceiver, new ItemStack(EnderIO.blockHyperCube, 1, 0));
addShapeless(transceiver, new ItemStack(EnderIO.blockHyperCube, 1, 0));
}
}
@@ -479,7 +454,7 @@ public class MachineRecipes {
ItemStack vibSolarPanel = new ItemStack(EnderIO.blockSolarPanel, 1, 2);
if (Config.useHardRecipes) {
RecipeUtil.addShaped(
addShaped(
solarPanel,
"efe",
"pfp",
@@ -494,7 +469,7 @@ public class MachineRecipes {
energeticAlloy,
'p',
phasedGold);
RecipeUtil.addShaped(
addShaped(
advSolarPanel,
"efe",
"pfp",
@@ -509,7 +484,7 @@ public class MachineRecipes {
phasedIron,
'p',
phasedGold);
RecipeUtil.addShaped(
addShaped(
vibSolarPanel,
"efe",
"pfp",
@@ -525,7 +500,7 @@ public class MachineRecipes {
'p',
phasedGold);
} else {
RecipeUtil.addShaped(
addShaped(
solarPanel,
"efe",
"pfp",
@@ -540,7 +515,7 @@ public class MachineRecipes {
energeticAlloy,
'c',
redstoneAlloy);
RecipeUtil.addShaped(
addShaped(
advSolarPanel,
"efe",
"pfp",
@@ -555,7 +530,7 @@ public class MachineRecipes {
phasedIron,
'c',
electricalSteel);
RecipeUtil.addShaped(
addShaped(
vibSolarPanel,
"efe",
"pfp",
@@ -578,7 +553,7 @@ public class MachineRecipes {
ItemStack powerConduit = new ItemStack(EnderIO.itemPowerConduit, 1, 0);
ItemStack redstoneConduit = new ItemStack(EnderIO.itemRedstoneConduit, 1, 2);
ItemStack mJMonitor = new ItemStack(EnderIO.blockPowerMonitor, 1, 0);
RecipeUtil.addShaped(
addShaped(
mJMonitor,
"sms",
"sMs",
@@ -596,11 +571,11 @@ public class MachineRecipes {
// Enchanter
ItemStack enchanter = new ItemStack(EnderIO.blockEnchanter);
RecipeUtil.addShaped(enchanter, "dbd", "sss", " s ", 'd', "gemDiamond", 'b', Items.book, 's', darkSteel);
addShaped(enchanter, "dbd", "sss", " s ", 'd', "gemDiamond", 'b', Items.book, 's', darkSteel);
// Vacuum Chest
ItemStack vacuumChest = new ItemStack(EnderIO.blockVacuumChest);
RecipeUtil.addShaped(vacuumChest, "iii", "ici", "ipi", 'i', "ingotIron", 'c', "chestWood", 'p', pulCry);
addShaped(vacuumChest, "iii", "ici", "ipi", 'i', "ingotIron", 'c', "chestWood", 'p', pulCry);
// Soul Binder
Object enderBit;
@@ -613,7 +588,7 @@ public class MachineRecipes {
ItemStack zombieSkull = new ItemStack(Items.skull, 1, 4);
ItemStack skeletonSkull = new ItemStack(Items.skull, 1, 0);
ItemStack soulBinder = new ItemStack(EnderIO.blockSoulFuser);
RecipeUtil.addShaped(
addShaped(
soulBinder,
"ses",
"zmc",
@@ -634,7 +609,7 @@ public class MachineRecipes {
// Attractor
ItemStack attractor = new ItemStack(EnderIO.blockAttractor);
ItemStack attractorCrystal = new ItemStack(EnderIO.itemMaterial, 1, Material.ATTRACTOR_CRYSTAL.ordinal());
RecipeUtil.addShaped(
addShaped(
attractor,
" c ",
"ese",
@@ -654,7 +629,7 @@ public class MachineRecipes {
EnderIO.blockEndermanSkull,
1,
BlockEndermanSkull.SkullType.TORMENTED.ordinal());
RecipeUtil.addShaped(
addShaped(
aversion,
" c ",
"ese",
@@ -671,12 +646,12 @@ public class MachineRecipes {
// Experience
ItemStack xp = new ItemStack(EnderIO.blockExperianceOblisk);
ItemStack xpItem = new ItemStack(EnderIO.itemXpTransfer);
RecipeUtil.addShaped(xp, " x ", " s ", "sms", 's', soularium, 'm', machineChassi, 'x', xpItem);
addShaped(xp, " x ", " s ", "sms", 's', soularium, 'm', machineChassi, 'x', xpItem);
// Weather
ItemStack weather = new ItemStack(EnderIO.blockWeatherObelisk);
ItemStack weatherItem = new ItemStack(EnderIO.itemMaterial, 1, Material.WEATHER_CRYSTAL.ordinal());
RecipeUtil.addShaped(
addShaped(
weather,
" x ",
"ese",
@@ -711,14 +686,14 @@ public class MachineRecipes {
EnderIO.blockElectricLight,
1,
BlockItemElectricLight.Type.WIRELESS_INV.ordinal());
RecipeUtil.addShapeless(wirelessLamp, poweredLamp, enderRes);
RecipeUtil.addShapeless(wirelessLamp, wirelessLampInv, Blocks.redstone_torch);
RecipeUtil.addShapeless(wirelessLampInv, poweredLampInv, enderRes);
RecipeUtil.addShapeless(wirelessLampInv, wirelessLamp, Blocks.redstone_torch);
addShapeless(wirelessLamp, poweredLamp, enderRes);
addShapeless(wirelessLamp, wirelessLampInv, Blocks.redstone_torch);
addShapeless(wirelessLampInv, poweredLampInv, enderRes);
addShapeless(wirelessLampInv, wirelessLamp, Blocks.redstone_torch);
// inventory panel
ItemStack awareness = new ItemStack(EnderIO.itemFunctionUpgrade, 1, FunctionUpgrade.INVENTORY_PANEL.ordinal());
RecipeUtil.addShaped(
addShaped(
awareness,
"bsb",
"ses",
@@ -732,7 +707,7 @@ public class MachineRecipes {
'i',
electricalSteel);
ItemStack invPanel = new ItemStack(EnderIO.blockInventoryPanel);
RecipeUtil.addShaped(
addShaped(
invPanel,
"dad",
"psp",
@@ -752,7 +727,7 @@ public class MachineRecipes {
// powered light
if (Config.useHardRecipes) {
RecipeUtil.addShaped(
addShaped(
poweredLamp,
"ggg",
"sds",
@@ -766,7 +741,7 @@ public class MachineRecipes {
'c',
capacitor);
} else {
RecipeUtil.addShaped(
addShaped(
poweredLamp,
"ggg",
"sds",
@@ -781,19 +756,19 @@ public class MachineRecipes {
capacitor);
}
ItemStack invPoweredLamp = new ItemStack(EnderIO.blockElectricLight, 1, 1);
RecipeUtil.addShapeless(invPoweredLamp, poweredLamp, Blocks.redstone_torch);
RecipeUtil.addShapeless(poweredLamp, invPoweredLamp, Blocks.redstone_torch);
addShapeless(invPoweredLamp, poweredLamp, Blocks.redstone_torch);
addShapeless(poweredLamp, invPoweredLamp, Blocks.redstone_torch);
// light
ItemStack lamp = new ItemStack(EnderIO.blockElectricLight, 1, 2);
RecipeUtil.addShaped(lamp, " ", "ggg", "isi", 'g', "glass", 's', "glowstone", 'i', "ingotIron");
addShaped(lamp, " ", "ggg", "isi", 'g', "glass", 's', "glowstone", 'i', "ingotIron");
ItemStack invLamp = new ItemStack(EnderIO.blockElectricLight, 1, 3);
RecipeUtil.addShapeless(invLamp, lamp, Blocks.redstone_torch);
RecipeUtil.addShapeless(lamp, invLamp, Blocks.redstone_torch);
addShapeless(invLamp, lamp, Blocks.redstone_torch);
addShapeless(lamp, invLamp, Blocks.redstone_torch);
// MJ Reader
RecipeUtil.addShaped(
addShaped(
mJReader,
"epe",
"gcg",
@@ -813,7 +788,7 @@ public class MachineRecipes {
// Slice'N'Splice
ItemStack sns = new ItemStack(EnderIO.blockSliceAndSplice);
RecipeUtil.addShaped(
addShaped(
sns,
"iki",
"ams",
@@ -833,28 +808,8 @@ public class MachineRecipes {
ItemStack itemBuffer = Type.getStack(Type.ITEM);
ItemStack powerBuffer = Type.getStack(Type.POWER);
ItemStack omniBuffer = Type.getStack(Type.OMNI);
RecipeUtil.addShaped(
itemBuffer,
"isi",
"scs",
"isi",
'i',
"ingotIron",
's',
"ingotElectricalSteel",
'c',
"chestWood");
RecipeUtil.addShaped(
powerBuffer,
"isi",
"sfs",
"isi",
'i',
"ingotIron",
's',
"ingotElectricalSteel",
'f',
machineChassis);
RecipeUtil.addShapeless(omniBuffer, itemBuffer, powerBuffer);
addShaped(itemBuffer, "isi", "scs", "isi", 'i', "ingotIron", 's', "ingotElectricalSteel", 'c', "chestWood");
addShaped(powerBuffer, "isi", "sfs", "isi", 'i', "ingotIron", 's', "ingotElectricalSteel", 'f', machineChassis);
addShapeless(omniBuffer, itemBuffer, powerBuffer);
}
}
@@ -4,20 +4,13 @@ import java.util.HashMap;
import java.util.Map;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.WorldEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import crazypants.enderio.machine.capbank.TileCapBank;
public class ClientNetworkManager {
private static final ClientNetworkManager instance = new ClientNetworkManager();
static {
MinecraftForge.EVENT_BUS.register(instance);
}
public static ClientNetworkManager getInstance() {
return instance;
}
@@ -60,12 +53,4 @@ public class ClientNetworkManager {
CapBankClientNetwork network = getOrCreateNetwork(id);
network.addMember(tileCapBank);
}
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
if (event.world.isRemote) {
networks.forEach((id, network) -> network.destroyNetwork());
networks.clear();
}
}
}
@@ -20,6 +20,7 @@ import crazypants.enderio.Log;
/**
* This is not in the FakePlayer hierarchy for reasons.
*
*/
public class FakeFarmPlayer extends EntityPlayerMP {
@@ -1,8 +1,6 @@
package crazypants.enderio.machine.farm;
import static org.lwjgl.opengl.GL11.GL_LIGHTING;
import static org.lwjgl.opengl.GL11.glDisable;
import static org.lwjgl.opengl.GL11.glEnable;
import static org.lwjgl.opengl.GL11.*;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
@@ -120,6 +120,7 @@ public enum Fertilizer {
/**
* Returns the singleton instance for the fertilizer that was given as parameter. If the given item is no
* fertilizer, it will return an instance of Fertilizer.None.
*
*/
public static Fertilizer getInstance(ItemStack stack) {
for (Fertilizer fertilizer : validFertilizers) {
@@ -143,7 +144,7 @@ public enum Fertilizer {
/**
* Tries to apply the given item on the given block using the type-specific method. SFX is played on success.
* <p>
*
* If the item was successfully applied, the stacksize will be decreased if appropriate. The caller will need to
* check for stacksize 0 and null the inventory slot if needed.
*
@@ -37,7 +37,7 @@ public class NaturaBerryFarmer extends PickableFarmer {
block = farm.getBlock(checkBlock);
if (super.canHarvest(farm, bc, block, meta)) { // redundant check because our canHarvest checks all 5 blocks
// so a bush may be invalid in
// so a bush may be invalid in
// the stack of 5
IHarvestResult blockRes = super.harvestBlock(farm, checkBlock, block, meta);
@@ -301,7 +301,7 @@ public class TileInventoryPanel extends AbstractMachineEntity implements IFluidH
/**
* This is called by PacketUpdateExtractionDisabled on the client side
*
*
* @param extractionDisabled if extraction is disabled
*/
void updateExtractionDisabled(boolean extractionDisabled) {
@@ -1,14 +1,6 @@
package crazypants.enderio.machine.obelisk;
import static org.lwjgl.opengl.GL11.GL_ALL_ATTRIB_BITS;
import static org.lwjgl.opengl.GL11.glDepthMask;
import static org.lwjgl.opengl.GL11.glPopAttrib;
import static org.lwjgl.opengl.GL11.glPopMatrix;
import static org.lwjgl.opengl.GL11.glPushAttrib;
import static org.lwjgl.opengl.GL11.glPushMatrix;
import static org.lwjgl.opengl.GL11.glRotatef;
import static org.lwjgl.opengl.GL11.glScalef;
import static org.lwjgl.opengl.GL11.glTranslated;
import static org.lwjgl.opengl.GL11.*;
import java.util.Random;
@@ -114,7 +106,7 @@ public class ObeliskSpecialRenderer<T extends TileEntity> extends TileEntitySpec
protected void renderItemStack(T te, World world, double x, double y, double z, float tick) {
if (ei == null) {
ei = new EntityItem(null, 0, 0, 0, getFloatingItem(te));
ei = new EntityItem(world, 0, 0, 0, getFloatingItem(te));
}
ei.setEntityItemStack(getFloatingItem(te));
@@ -151,7 +151,7 @@ public class TileSoulBinder extends AbstractPoweredTaskEntity implements IHaveEx
/**
* Computes the required amount of XP to start the current recipe.
*
*
* @return 0 if no XP is required, negative when more than required XP is stored.
*/
private int getXPRequired() {
@@ -1,28 +1,11 @@
package crazypants.enderio.material;
import static crazypants.enderio.material.Alloy.DARK_STEEL;
import static crazypants.enderio.material.Alloy.END_STEEL;
import static crazypants.enderio.material.Alloy.ENERGETIC_ALLOY;
import static crazypants.enderio.material.Alloy.PHASED_GOLD;
import static crazypants.enderio.material.Alloy.PHASED_IRON;
import static crazypants.enderio.material.Alloy.SOULARIUM;
import static crazypants.enderio.material.Material.BINDER_COMPOSITE;
import static crazypants.enderio.material.Material.CONDUIT_BINDER;
import static crazypants.enderio.material.Material.PRECIENT_CRYSTAL;
import static crazypants.enderio.material.endergy.AlloyEndergy.CRYSTALLINE_ALLOY;
import static crazypants.enderio.material.endergy.AlloyEndergy.ENERGETIC_SILVER;
import static crazypants.enderio.material.endergy.AlloyEndergy.MELODIC_ALLOY;
import static crazypants.enderio.material.endergy.AlloyEndergy.STELLAR_ALLOY;
import static crazypants.enderio.material.endergy.AlloyEndergy.VIVID_ALLOY;
import static crazypants.enderio.power.Capacitors.ACTIVATED_CAPACITOR;
import static crazypants.enderio.power.Capacitors.BASIC_CAPACITOR;
import static crazypants.enderio.power.Capacitors.CRYSTALLINE_CAPACITOR;
import static crazypants.enderio.power.Capacitors.ENDERGETIC_CAPACITOR;
import static crazypants.enderio.power.Capacitors.ENDERGISED_CAPACITOR;
import static crazypants.enderio.power.Capacitors.ENDER_CAPACITOR;
import static crazypants.enderio.power.Capacitors.MELODIC_CAPACITOR;
import static crazypants.enderio.power.Capacitors.SILVER_CAPACITOR;
import static crazypants.enderio.power.Capacitors.STELLAR_CAPACITOR;
import static com.enderio.core.common.util.OreDictionaryHelper.*;
import static crazypants.enderio.material.Alloy.*;
import static crazypants.enderio.material.Material.*;
import static crazypants.enderio.material.endergy.AlloyEndergy.*;
import static crazypants.enderio.power.Capacitors.*;
import static crazypants.util.RecipeUtil.*;
import java.util.ArrayList;
@@ -40,7 +23,6 @@ import crazypants.enderio.config.Config;
import crazypants.enderio.item.ItemEnderFood.EnderFood;
import crazypants.enderio.material.endergy.AlloyEndergy;
import crazypants.enderio.power.Capacitors;
import crazypants.util.RecipeUtil;
public class MaterialRecipes {
@@ -81,7 +63,7 @@ public class MaterialRecipes {
// Allow free conversion of additional/legacy oreDict name items into
// our item because we only register recipes for the primary oreDict
// name. Use a 2-to-2 recipe because the 1-to-n is already in use.
RecipeUtil.addShapeless(alloy.getStackIngot(2), oreDictName, oreDictName);
addShapeless(alloy.getStackIngot(2), oreDictName, oreDictName);
}
}
isPrimaryName = true;
@@ -90,7 +72,7 @@ public class MaterialRecipes {
if (isPrimaryName) {
isPrimaryName = false;
} else {
RecipeUtil.addShapeless(alloy.getStackBlock(2), oreDictName, oreDictName);
addShapeless(alloy.getStackBlock(2), oreDictName, oreDictName);
}
}
}
@@ -105,7 +87,7 @@ public class MaterialRecipes {
// Allow free conversion of additional/legacy oreDict name items into
// our item because we only register recipes for the primary oreDict
// name. Use a 2-to-2 recipe because the 1-to-n is already in use.
RecipeUtil.addShapeless(alloy.getStackIngot(2), oreDictName, oreDictName);
addShapeless(alloy.getStackIngot(2), oreDictName, oreDictName);
}
}
isPrimaryName = true;
@@ -114,7 +96,7 @@ public class MaterialRecipes {
if (isPrimaryName) {
isPrimaryName = false;
} else {
RecipeUtil.addShapeless(alloy.getStackBlock(2), oreDictName, oreDictName);
addShapeless(alloy.getStackBlock(2), oreDictName, oreDictName);
}
}
}
@@ -149,9 +131,9 @@ public class MaterialRecipes {
OreDictionary.registerOre("itemSkull", new ItemStack(EnderIO.blockEndermanSkull));
// Glass stuff for compatibility
RecipeUtil.addShaped(new ItemStack(Blocks.glass_pane, 16, 0), "eee", "eee", 'e', pureGlass);
RecipeUtil.addShapeless(new ItemStack(Blocks.glass), pureGlass);
RecipeUtil.addShaped(new ItemStack(Items.glass_bottle, 3, 0), "g g", " g ", 'g', pureGlass);
addShaped(new ItemStack(Blocks.glass_pane, 16, 0), "eee", "eee", 'e', pureGlass);
addShapeless(new ItemStack(Blocks.glass), pureGlass);
addShaped(new ItemStack(Items.glass_bottle, 3, 0), "g g", " g ", 'g', pureGlass);
Material.registerOres(EnderIO.itemMaterial);
MachinePart.registerOres(EnderIO.itemMachinePart);
@@ -188,7 +170,7 @@ public class MaterialRecipes {
// Capacitors
if (Config.useHardRecipes) {
RecipeUtil.addShaped(
addShaped(
BASIC_CAPACITOR.getItemStack(),
" gr",
"gig",
@@ -199,7 +181,7 @@ public class MaterialRecipes {
"ingotGold",
'i',
ingotCopper);
RecipeUtil.addShaped(
addShaped(
ACTIVATED_CAPACITOR.getItemStack(),
"iii",
"cCc",
@@ -210,7 +192,7 @@ public class MaterialRecipes {
BASIC_CAPACITOR.getItemStack(),
'C',
"dustCoal");
RecipeUtil.addShaped(
addShaped(
ENDER_CAPACITOR.getItemStack(),
"iii",
"cCc",
@@ -224,7 +206,7 @@ public class MaterialRecipes {
String prismarine = OreDictionary.doesOreNameExist("shardPrismarine") ? "shardPrismarine"
: "itemPulsatingCrystal";
RecipeUtil.addShaped(
addShaped(
CRYSTALLINE_CAPACITOR.getItemStack(),
"iii",
"cCc",
@@ -235,7 +217,7 @@ public class MaterialRecipes {
capacitorEnder,
'C',
prismarine);
RecipeUtil.addShaped(
addShaped(
MELODIC_CAPACITOR.getItemStack(),
"iii",
"cCc",
@@ -246,7 +228,7 @@ public class MaterialRecipes {
CRYSTALLINE_CAPACITOR.getItemStack(),
'C',
endSteel);
RecipeUtil.addShaped(
addShaped(
STELLAR_CAPACITOR.getItemStack(),
"iii",
"cCc",
@@ -258,7 +240,7 @@ public class MaterialRecipes {
'C',
PRECIENT_CRYSTAL.oreDict);
RecipeUtil.addShaped(
addShaped(
SILVER_CAPACITOR.getItemStack(),
" sr",
"sis",
@@ -269,7 +251,7 @@ public class MaterialRecipes {
"ingotSilver",
'i',
"ingotLead");
RecipeUtil.addShaped(
addShaped(
ENDERGETIC_CAPACITOR.getItemStack(),
"iii",
"cCc",
@@ -280,7 +262,7 @@ public class MaterialRecipes {
SILVER_CAPACITOR.getItemStack(),
'C',
"dustCoal");
RecipeUtil.addShaped(
addShaped(
ENDERGISED_CAPACITOR.getItemStack(),
"iii",
"cCc",
@@ -293,7 +275,7 @@ public class MaterialRecipes {
"glowstone");
} else {
RecipeUtil.addShaped(
addShaped(
BASIC_CAPACITOR.getItemStack(),
" gr",
"gig",
@@ -304,7 +286,7 @@ public class MaterialRecipes {
"ingotGold",
'i',
ingotCopper);
RecipeUtil.addShaped(
addShaped(
ACTIVATED_CAPACITOR.getItemStack(),
" i ",
"cCc",
@@ -315,7 +297,7 @@ public class MaterialRecipes {
BASIC_CAPACITOR.getItemStack(),
'C',
"dustCoal");
RecipeUtil.addShaped(
addShaped(
ENDER_CAPACITOR.getItemStack(),
" i ",
"cCc",
@@ -329,7 +311,7 @@ public class MaterialRecipes {
String prismarine = OreDictionary.doesOreNameExist("shardPrismarine") ? "shardPrismarine"
: "itemPulsatingCrystal";
RecipeUtil.addShaped(
addShaped(
CRYSTALLINE_CAPACITOR.getItemStack(),
" i ",
"cCc",
@@ -340,7 +322,7 @@ public class MaterialRecipes {
capacitorEnder,
'C',
prismarine);
RecipeUtil.addShaped(
addShaped(
MELODIC_CAPACITOR.getItemStack(),
" i ",
"cCc",
@@ -351,7 +333,7 @@ public class MaterialRecipes {
CRYSTALLINE_CAPACITOR.getItemStack(),
'C',
endSteel);
RecipeUtil.addShaped(
addShaped(
STELLAR_CAPACITOR.getItemStack(),
" i ",
"cCc",
@@ -363,7 +345,7 @@ public class MaterialRecipes {
'C',
PRECIENT_CRYSTAL.oreDict);
RecipeUtil.addShaped(
addShaped(
SILVER_CAPACITOR.getItemStack(),
" sr",
"sis",
@@ -374,7 +356,7 @@ public class MaterialRecipes {
"ingotSilver",
'i',
"ingotLead");
RecipeUtil.addShaped(
addShaped(
ENDERGETIC_CAPACITOR.getItemStack(),
" i ",
"cCc",
@@ -385,7 +367,7 @@ public class MaterialRecipes {
SILVER_CAPACITOR.getItemStack(),
'C',
"dustCoal");
RecipeUtil.addShaped(
addShaped(
ENDERGISED_CAPACITOR.getItemStack(),
" i ",
"cCc",
@@ -401,37 +383,37 @@ public class MaterialRecipes {
// Conduit Binder
ItemStack cbc = BINDER_COMPOSITE.getStack(8);
if (Config.useAlternateBinderRecipe) {
RecipeUtil.addShaped(cbc, "gcg", "sgs", "gcg", 'g', Blocks.gravel, 's', "sand", 'c', Items.clay_ball);
addShaped(cbc, "gcg", "sgs", "gcg", 'g', Blocks.gravel, 's', "sand", 'c', Items.clay_ball);
} else {
RecipeUtil.addShaped(cbc, "ggg", "scs", "ggg", 'g', Blocks.gravel, 's', "sand", 'c', Items.clay_ball);
addShaped(cbc, "ggg", "scs", "ggg", 'g', Blocks.gravel, 's', "sand", 'c', Items.clay_ball);
}
GameRegistry.addSmelting(BINDER_COMPOSITE.getStack(), CONDUIT_BINDER.getStack(4), 0);
// Nuggets
ItemStack phasedIronNugget = new ItemStack(EnderIO.itemMaterial, 9, Material.PHASED_IRON_NUGGET.ordinal());
RecipeUtil.addShapeless(phasedIronNugget, phasedIron);
addShapeless(phasedIronNugget, phasedIron);
phasedIronNugget = phasedIronNugget.copy();
phasedIronNugget.stackSize = 1;
RecipeUtil.addShaped(PHASED_IRON.getStackIngot(), "eee", "eee", "eee", 'e', phasedIronNugget);
addShaped(PHASED_IRON.getStackIngot(), "eee", "eee", "eee", 'e', phasedIronNugget);
ItemStack vibrantNugget = new ItemStack(EnderIO.itemMaterial, 9, Material.VIBRANT_NUGGET.ordinal());
RecipeUtil.addShapeless(vibrantNugget, phasedGold);
addShapeless(vibrantNugget, phasedGold);
vibrantNugget = vibrantNugget.copy();
vibrantNugget.stackSize = 1;
RecipeUtil.addShaped(PHASED_GOLD.getStackIngot(), "eee", "eee", "eee", 'e', vibrantNugget);
addShaped(PHASED_GOLD.getStackIngot(), "eee", "eee", "eee", 'e', vibrantNugget);
ItemStack endSteelNugget = new ItemStack(EnderIO.itemMaterial, 9, Material.END_STEEL_NUGGET.ordinal());
RecipeUtil.addShapeless(endSteelNugget, endSteel);
addShapeless(endSteelNugget, endSteel);
endSteelNugget = endSteelNugget.copy();
endSteelNugget.stackSize = 1;
RecipeUtil.addShaped(END_STEEL.getStackIngot(), "eee", "eee", "eee", 'e', endSteelNugget);
addShaped(END_STEEL.getStackIngot(), "eee", "eee", "eee", 'e', endSteelNugget);
// Crystals
ItemStack pulsCry = new ItemStack(EnderIO.itemMaterial, 1, Material.PULSATING_CYSTAL.ordinal());
RecipeUtil.addShaped(pulsCry, "nnn", "ngn", "nnn", 'n', phasedIronNugget, 'g', "gemDiamond");
addShaped(pulsCry, "nnn", "ngn", "nnn", 'n', phasedIronNugget, 'g', "gemDiamond");
ItemStack vibCry = new ItemStack(EnderIO.itemMaterial, 1, Material.VIBRANT_CYSTAL.ordinal());
RecipeUtil.addShaped(vibCry, "nnn", "ngn", "nnn", 'n', vibrantNugget, 'g', "gemEmerald");
addShaped(vibCry, "nnn", "ngn", "nnn", 'n', vibrantNugget, 'g', "gemEmerald");
// Smelting
ItemStack dustIron = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_IRON.ordinal());
@@ -444,23 +426,23 @@ public class MaterialRecipes {
// Ender Dusts
ItemStack enderDust = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_ENDER.ordinal());
RecipeUtil.addShaped(new ItemStack(Items.ender_pearl), "eee", "eee", "eee", 'e', enderDust);
addShaped(new ItemStack(Items.ender_pearl), "eee", "eee", "eee", 'e', enderDust);
// Dark Iron Bars
ItemStack diBars = new ItemStack(EnderIO.blockDarkIronBars, 16, 0);
RecipeUtil.addShaped(diBars, "ddd", "ddd", 'd', darkSteel);
addShaped(diBars, "ddd", "ddd", 'd', darkSteel);
// Dark Iron Bars
ItemStack soBars = new ItemStack(EnderIO.blockSoulariumBars, 16, 0);
RecipeUtil.addShaped(soBars, "ddd", "ddd", 'd', soularium);
addShaped(soBars, "ddd", "ddd", 'd', soularium);
// Dark Iron Bars
ItemStack esBars = new ItemStack(EnderIO.blockEndSteelBars, 16, 0);
RecipeUtil.addShaped(esBars, "ddd", "ddd", 'd', endSteel);
addShaped(esBars, "ddd", "ddd", 'd', endSteel);
// Fused Quartz Frame
RecipeUtil.addShaped(fusedQuartzFrame, "bsb", "s s", "bsb", 'b', conduitBinder, 's', "stickWood");
RecipeUtil.addShaped(fusedQuartzFrame, "bsb", "s s", "bsb", 'b', conduitBinder, 's', "woodStick");
addShaped(fusedQuartzFrame, "bsb", "s s", "bsb", 'b', conduitBinder, 's', "stickWood");
addShaped(fusedQuartzFrame, "bsb", "s s", "bsb", 'b', conduitBinder, 's', "woodStick");
// Machine Chassis
@@ -469,10 +451,10 @@ public class MaterialRecipes {
ItemStack chassis = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.MACHINE_CHASSI.ordinal());
String mat = Config.useSteelInChassi == true && steelIngots != null && !steelIngots.isEmpty() ? "ingotSteel"
: "ingotIron";
RecipeUtil.addShaped(chassis, "fif", "ici", "fif", 'f', Blocks.iron_bars, 'i', mat, 'c', capacitor);
addShaped(chassis, "fif", "ici", "fif", 'f', Blocks.iron_bars, 'i', mat, 'c', capacitor);
ItemStack soulchassis = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.SOUL_MACHINE_CHASSIS.ordinal());
RecipeUtil.addShaped(
addShaped(
soulchassis,
"fif",
"ici",
@@ -488,7 +470,7 @@ public class MaterialRecipes {
EnderIO.itemMachinePart,
1,
MachinePart.END_STEEL_MACHINE_CHASSIS.ordinal());
RecipeUtil.addShaped(
addShaped(
endchassis,
"fif",
"ici",
@@ -502,8 +484,8 @@ public class MaterialRecipes {
// Basic Gear
ItemStack gear = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.BASIC_GEAR.ordinal());
RecipeUtil.addShaped(gear, "scs", "c c", "scs", 's', "stickWood", 'c', "cobblestone");
RecipeUtil.addShaped(gear, "scs", "c c", "scs", 's', "woodStick", 'c', "cobblestone");
addShaped(gear, "scs", "c c", "scs", 's', "stickWood", 'c', "cobblestone");
addShaped(gear, "scs", "c c", "scs", 's', "woodStick", 'c', "cobblestone");
// Weather Crystal
ItemStack main = Config.useHardRecipes
@@ -520,7 +502,7 @@ public class MaterialRecipes {
if (Config.reinforcedObsidianUseDarkSteelBlocks) {
corners = Alloy.DARK_STEEL.getOreBlock();
}
RecipeUtil.addShaped(
addShaped(
reinfObs,
"dbd",
"bob",
@@ -533,39 +515,25 @@ public class MaterialRecipes {
Blocks.obsidian);
}
RecipeUtil.addShaped(
EnderIO.blockDarkSteelAnvil,
"bbb",
" i ",
"iii",
'b',
DARK_STEEL.getOreBlock(),
'i',
darkSteel);
addShaped(EnderIO.blockDarkSteelAnvil, "bbb", " i ", "iii", 'b', DARK_STEEL.getOreBlock(), 'i', darkSteel);
RecipeUtil.addShaped(
new ItemStack(EnderIO.blockDarkSteelLadder, 12),
"b",
"b",
"b",
'b',
EnderIO.blockDarkIronBars);
addShaped(new ItemStack(EnderIO.blockDarkSteelLadder, 12), "b", "b", "b", 'b', EnderIO.blockDarkIronBars);
for (Alloy alloy : Alloy.values()) {
RecipeUtil.addShaped(alloy.getStackBlock(), "iii", "iii", "iii", 'i', alloy.getOreIngot());
RecipeUtil.addShaped(alloy.getStackBall(5), " i ", "iii", " i ", 'i', alloy.getOreIngot());
RecipeUtil.addShapeless(alloy.getStackIngot(9), alloy.getOreBlock());
addShaped(alloy.getStackBlock(), "iii", "iii", "iii", 'i', alloy.getOreIngot());
addShaped(alloy.getStackBall(5), " i ", "iii", " i ", 'i', alloy.getOreIngot());
addShapeless(alloy.getStackIngot(9), alloy.getOreBlock());
}
for (AlloyEndergy alloy : AlloyEndergy.values()) {
RecipeUtil.addShaped(alloy.getStackBlock(), "iii", "iii", "iii", 'i', alloy.getOreIngot());
RecipeUtil.addShaped(alloy.getStackBall(5), " i ", "iii", " i ", 'i', alloy.getOreIngot());
RecipeUtil.addShapeless(alloy.getStackIngot(9), alloy.getOreBlock());
addShaped(alloy.getStackBlock(), "iii", "iii", "iii", 'i', alloy.getOreIngot());
addShaped(alloy.getStackBall(5), " i ", "iii", " i ", 'i', alloy.getOreIngot());
addShapeless(alloy.getStackIngot(9), alloy.getOreBlock());
}
// DS Rod
ItemStack darkRod = new ItemStack(EnderIO.itemMaterial, 1, Material.DARK_STEEL_ROD.ordinal());
RecipeUtil.addShaped(darkRod, " ns", "nsn", "sn ", 's', darkSteel, 'n', endSteelNugget);
addShaped(darkRod, " ns", "nsn", "sn ", 's', darkSteel, 'n', endSteelNugget);
// Food
ItemStack flour = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.FLOUR.ordinal());
@@ -574,14 +542,14 @@ public class MaterialRecipes {
GameRegistry.addSmelting(flour, bread, 0.35f);
ItemStack enderios = EnderFood.ENDERIOS.getStack();
RecipeUtil.addShapeless(enderios, Items.bowl, Items.milk_bucket, "cropWheat", "dustEnderPearl");
addShapeless(enderios, Items.bowl, Items.milk_bucket, "cropWheat", "dustEnderPearl");
if (OreDictionaryHelper.hasCopper()) {
if (hasCopper()) {
ItemStack dustCopper = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_COPPER.ordinal());
ItemStack ingotCoppper = OreDictionaryPreferences.instance.getPreferred(OreDictionaryHelper.INGOT_COPPER);
GameRegistry.addSmelting(dustCopper, ingotCoppper, 0);
}
if (OreDictionaryHelper.hasTin()) {
if (hasTin()) {
ItemStack dustTin = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_TIN.ordinal());
ItemStack ingotTin = OreDictionaryPreferences.instance.getPreferred(OreDictionaryHelper.INGOT_TIN);
GameRegistry.addSmelting(dustTin, ingotTin, 0);
@@ -1,10 +1,6 @@
package crazypants.enderio.material;
import static com.enderio.core.common.util.OreDictionaryHelper.DUST_ENDERPEARL;
import static com.enderio.core.common.util.OreDictionaryHelper.INGOT_COPPER;
import static com.enderio.core.common.util.OreDictionaryHelper.INGOT_ENDERIUM;
import static com.enderio.core.common.util.OreDictionaryHelper.INGOT_TIN;
import static com.enderio.core.common.util.OreDictionaryHelper.isRegistered;
import static com.enderio.core.common.util.OreDictionaryHelper.*;
public enum PowderIngot {
@@ -18,15 +18,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovementInput;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.util.*;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.common.MinecraftForge;
@@ -119,55 +111,42 @@ public class TravelController {
}
}
/**
* @return the error message, or null if the packet is valid.
*/
public String validatePacketTravelEvent(EntityPlayerMP toTp, int x, int y, int z, int powerUse,
public boolean validatePacketTravelEvent(EntityPlayerMP toTp, int x, int y, int z, int powerUse,
boolean conserveMotion, TravelSource source) {
BlockCoord target = new BlockCoord(x, y, z);
double dist = getDistanceSquared(toTp, target);
// allow 15% overshoot to account for rounding
if (dist * 100 > source.getMaxDistanceTravelledSq() * 115) return "dist check fail";
// allow 4 blocks of c/s player pos desync
if (getPower(toTp, source, target, -4F) > powerUse) return "power use too little";
if (dist * 100 > source.getMaxDistanceTravelledSq() * 115) return false;
if (powerUse < getRequiredPower(toTp, source, target)) return false;
ItemStack equippedItem = toTp.getCurrentEquippedItem();
switch (source) {
case TELEPAD:
// this source is invalid for this type of packet
return "invalid travel source";
return false;
case BLOCK:
// this source is only triggered when player is on any active travel anchor
BlockCoord on = getActiveTravelBlock(toTp);
if (on == null) return "on anchor is null";
if (on == null) return false;
// target must be a valid selectedCoord
// selectedCoord can either be a block right above/below when the player is on anchor...
if (on.x == x && on.z == z) return null;
if (on.x == x && on.z == z) return true;
// or another anchor
TileEntity maybeAnchor = target.getTileEntity(toTp.worldObj);
if (!(maybeAnchor instanceof ITravelAccessable)) return "not anchor";
if (!(maybeAnchor instanceof ITravelAccessable)) return false;
ITravelAccessable anchor = (ITravelAccessable) maybeAnchor;
if (!anchor.canBlockBeAccessed(toTp) && isValidTarget(toTp, target, TravelSource.BLOCK)) {
return "not valid target";
}
return null;
return anchor.canBlockBeAccessed(toTp) || !isValidTarget(toTp, target, TravelSource.BLOCK);
case STAFF:
case STAFF_BLINK:
if (equippedItem == null || !(equippedItem.getItem() instanceof IItemOfTravel)) return "not staff";
if (!((IItemOfTravel) equippedItem.getItem()).isActive(toTp, equippedItem)) return "staff not active";
if (equippedItem == null || !(equippedItem.getItem() instanceof IItemOfTravel)) return false;
if (!((IItemOfTravel) equippedItem.getItem()).isActive(toTp, equippedItem)) return false;
int energy = ((IItemOfTravel) equippedItem.getItem()).canExtractInternal(equippedItem, powerUse);
if (energy != -1 && energy != powerUse) {
return "not enough power";
}
return null;
return energy == -1 || energy == powerUse;
case TELEPORT_STAFF_BLINK:
case TELEPORT_STAFF:
// tp staff is creative version of traveling staff
// no energy check or anything else needed
// but the player must actually be equipped with one of these
if (equippedItem != null && equippedItem.getItem() instanceof ItemTeleportStaff) {
return null;
}
return "not staff";
return equippedItem != null && equippedItem.getItem() instanceof ItemTeleportStaff;
default:
throw new AssertionError("unidentified travel source");
}
@@ -683,7 +662,7 @@ public class TravelController {
}
int requiredPower;
ItemStack staff = player.getCurrentEquippedItem();
requiredPower = getPower(player, source, coord, 0F);
requiredPower = (int) (getDistance(player, coord) * source.getPowerCostPerBlockTraveledRF());
int canUsePower = getEnergyInTravelItem(staff);
if (requiredPower > canUsePower) {
// make sure chat is sent only once per trial
@@ -696,10 +675,6 @@ public class TravelController {
return requiredPower;
}
private int getPower(EntityPlayer player, TravelSource source, BlockCoord coord, float distanceWavier) {
return (int) ((getDistance(player, coord) + distanceWavier) * source.getPowerCostPerBlockTraveledRF());
}
private boolean isInRangeTarget(EntityPlayer player, BlockCoord bc, float maxSq) {
return getDistanceSquared(player, bc) <= maxSq;
}
@@ -83,14 +83,12 @@ public class PacketTravelEvent implements IMessage, IMessageHandler<PacketTravel
TravelSource source = TravelSource.values()[message.source];
String error = TravelController.instance
.validatePacketTravelEvent(toTp, x, y, z, message.powerUse, message.conserveMotion, source);
if (error != null) {
if (!TravelController.instance
.validatePacketTravelEvent(toTp, x, y, z, message.powerUse, message.conserveMotion, source)) {
Log.LOGGER.warn(
Log.securityMarker,
"Player {} tried to tp without valid prereq: {}",
ctx.getServerHandler().playerEntity.getGameProfile(),
error);
"Player {} tried to tp without valid prereq.",
ctx.getServerHandler().playerEntity.getGameProfile());
return null;
}
@@ -1,23 +1,6 @@
package crazypants.enderio.teleport.telepad;
import static org.lwjgl.opengl.GL11.GL_ALL_ATTRIB_BITS;
import static org.lwjgl.opengl.GL11.GL_ALPHA_TEST;
import static org.lwjgl.opengl.GL11.GL_BLEND;
import static org.lwjgl.opengl.GL11.GL_CULL_FACE;
import static org.lwjgl.opengl.GL11.GL_LIGHTING;
import static org.lwjgl.opengl.GL11.GL_ONE;
import static org.lwjgl.opengl.GL11.GL_SMOOTH;
import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA;
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
import static org.lwjgl.opengl.GL11.GL_ZERO;
import static org.lwjgl.opengl.GL11.glDepthMask;
import static org.lwjgl.opengl.GL11.glDisable;
import static org.lwjgl.opengl.GL11.glEnable;
import static org.lwjgl.opengl.GL11.glPushAttrib;
import static org.lwjgl.opengl.GL11.glPushMatrix;
import static org.lwjgl.opengl.GL11.glRotatef;
import static org.lwjgl.opengl.GL11.glShadeModel;
import static org.lwjgl.opengl.GL11.glTranslated;
import static org.lwjgl.opengl.GL11.*;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
@@ -16,7 +16,7 @@ public interface IWailaInfoProvider {
/**
* Adds the block's info to the WAILA information
*
*
* @param tooltip - current list of strings in the WAILA body
* @param world
* @param x
@@ -1,8 +1,6 @@
package crazypants.enderio.waila;
import static crazypants.enderio.waila.IWailaInfoProvider.BIT_BASIC;
import static crazypants.enderio.waila.IWailaInfoProvider.BIT_COMMON;
import static crazypants.enderio.waila.IWailaInfoProvider.BIT_DETAILED;
import static crazypants.enderio.waila.IWailaInfoProvider.*;
import java.text.MessageFormat;
import java.util.List;
@@ -125,6 +123,8 @@ public class WailaCompat implements IWailaDataProvider {
public static final WailaCompat INSTANCE = new WailaCompat();
private static IWailaDataAccessor _accessor = null;
public static void load(IWailaRegistrar registrar) {
registrar.registerStackProvider(INSTANCE, IFacade.class);
registrar.registerStackProvider(INSTANCE, BlockDarkSteelAnvil.class);
@@ -188,6 +188,8 @@ public class WailaCompat implements IWailaDataProvider {
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
_accessor = accessor;
EntityPlayer player = accessor.getPlayer();
MovingObjectPosition pos = accessor.getPosition();
int x = pos.blockX, y = pos.blockY, z = pos.blockZ;
@@ -263,7 +265,7 @@ public class WailaCompat implements IWailaDataProvider {
}
if (te instanceof IConduitBundle) {
getWailaBodyConduitBundle(itemStack, currenttip, accessor);
getWailaBodyConduitBundle(itemStack, currenttip);
} else if (te instanceof IInternalPoweredTile && block == accessor.getBlock() && !(te instanceof TileCapBank)) {
IInternalPoweredTile power = (IInternalPoweredTile) te;
@@ -293,13 +295,13 @@ public class WailaCompat implements IWailaDataProvider {
return currenttip;
}
private void getWailaBodyConduitBundle(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor) {
private void getWailaBodyConduitBundle(ItemStack itemStack, List<String> currenttip) {
if (itemStack == null) {
return;
}
if (itemStack.getItem() == EnderIO.itemPowerConduit || itemStack.getItem() == EnderIO.itemPowerConduitEndergy) {
NBTTagCompound nbtRoot = accessor.getNBTData();
NBTTagCompound nbtRoot = _accessor.getNBTData();
if (nbtRoot.hasKey("storedEnergyRF")) {
int stored = nbtRoot.getInteger("storedEnergyRF");
int max = nbtRoot.getInteger("maxStoredRF");
@@ -316,7 +318,7 @@ public class WailaCompat implements IWailaDataProvider {
}
} else if (itemStack.getItem() == EnderIO.itemLiquidConduit) {
NBTTagCompound nbtRoot = accessor.getNBTData();
NBTTagCompound nbtRoot = _accessor.getNBTData();
if (nbtRoot.hasKey("fluidLocked") && nbtRoot.hasKey("FluidName")) {
boolean fluidTypeLocked = nbtRoot.getBoolean("fluidLocked");
FluidStack fluid = FluidStack.loadFluidStackFromNBT(nbtRoot);
@@ -348,7 +350,7 @@ public class WailaCompat implements IWailaDataProvider {
}
} else if (itemStack.getItem() == EnderIO.itemMEConduit) {
NBTTagCompound nbtRoot = accessor.getNBTData();
NBTTagCompound nbtRoot = _accessor.getNBTData();
if (nbtRoot.hasKey("isDense")) {
boolean isDenseUltra = nbtRoot.getBoolean("isDenseUltra");
boolean isDense = nbtRoot.getBoolean("isDense");
@@ -407,4 +409,7 @@ public class WailaCompat implements IWailaDataProvider {
return tag;
}
public static NBTTagCompound getNBTData() {
return _accessor.getNBTData();
}
}
@@ -4,8 +4,9 @@ import net.minecraft.entity.player.EntityPlayer;
/**
* Values taken from OpenMods EnchantmentUtils to ensure consistent behavior
*
*
* @see {@link https://github.com/OpenMods/OpenModsLib/blob/master/src/main/java/openmods/utils/EnchantmentUtils.java}
*
*/
public class XpUtil {
@@ -66,7 +66,7 @@ public class BaublesUtil {
/**
* Do NOT modify this inventory on the client side of a singleplayer game!
* <p>
*
* Wrap it in a ShadowInventory if you need to.
*/
public IInventory getBaubles(EntityPlayer player) {
@@ -10,8 +10,9 @@ import crazypants.enderio.Log;
/**
* This is a near-verbatim copy of Galacticraft's API class 'AccessInventoryGC'.
* <p>
*
* We don't need the extended functionality and already have more APIs included than is good for our sanity.
*
*/
public class GalacticraftUtil {