mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-15 09:34:50 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d92c0dd7f | ||
|
|
63cbe6e562 | ||
|
|
13d6533edc | ||
|
|
3194ecf6e8 | ||
|
|
a4373ebe5c | ||
|
|
638f04a58e | ||
|
|
f91de79376 | ||
|
|
e5e6e2fdba | ||
|
|
567cd3e78b | ||
|
|
5b46f376eb | ||
|
|
84e23b3e8e | ||
|
|
eba2bf1f86 | ||
|
|
47bd83e29e | ||
|
|
f7b49fccdd | ||
|
|
1a14946abb | ||
|
|
8ca820f71c | ||
|
|
4e40230bf3 | ||
|
|
76708883c0 | ||
|
|
0a1ee81780 | ||
|
|
1fd7ae7567 | ||
|
|
251fcc26b0 |
No files matched your search
+43
-28
@@ -1,4 +1,4 @@
|
||||
//version: 1677938302
|
||||
//version: 1680120787
|
||||
/*
|
||||
DO NOT CHANGE THIS FILE!
|
||||
Also, you may replace this file at any time if there is an update available.
|
||||
@@ -65,7 +65,7 @@ plugins {
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.8.0' apply false
|
||||
id 'org.jetbrains.kotlin.kapt' version '1.8.0' apply false
|
||||
id 'com.google.devtools.ksp' version '1.8.0-1.0.9' apply false
|
||||
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 '7.1.2' apply false
|
||||
id 'com.palantir.git-version' version '0.13.0' apply false // 0.13.0 is the last jvm8 supporting version
|
||||
id 'de.undercouch.download' version '5.3.0'
|
||||
@@ -73,7 +73,7 @@ plugins {
|
||||
id 'com.diffplug.spotless' version '6.7.2' apply false
|
||||
id 'com.modrinth.minotaur' version '2.+' apply false
|
||||
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
|
||||
id 'com.gtnewhorizons.retrofuturagradle' version '1.2.2'
|
||||
id 'com.gtnewhorizons.retrofuturagradle' version '1.2.4'
|
||||
}
|
||||
boolean settingsupdated = verifySettingsGradle()
|
||||
settingsupdated = verifyGitAttributes() || settingsupdated
|
||||
@@ -153,13 +153,21 @@ java {
|
||||
} else {
|
||||
languageVersion.set(projectJavaVersion)
|
||||
}
|
||||
vendor.set(JvmVendorSpec.ADOPTIUM)
|
||||
vendor.set(JvmVendorSpec.AZUL)
|
||||
}
|
||||
if (!noPublishedSources) {
|
||||
withSourcesJar()
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
tasks.withType(ScalaCompile).configureEach {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
pluginManager.withPlugin('org.jetbrains.kotlin.jvm') {
|
||||
// If Kotlin is enabled in the project
|
||||
kotlin {
|
||||
@@ -222,7 +230,7 @@ if (enableModernJavaSyntax.toBoolean()) {
|
||||
|
||||
javaCompiler.set(javaToolchains.compilerFor {
|
||||
languageVersion.set(JavaLanguageVersion.of(17))
|
||||
vendor.set(JvmVendorSpec.ADOPTIUM)
|
||||
vendor.set(JvmVendorSpec.AZUL)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -397,8 +405,6 @@ minecraft {
|
||||
extraRunJvmArguments.add("-ea:${modGroup}")
|
||||
|
||||
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
|
||||
extraTweakClasses.add("org.spongepowered.asm.launch.MixinTweaker")
|
||||
|
||||
if (usesMixinDebug.toBoolean()) {
|
||||
extraRunJvmArguments.addAll([
|
||||
"-Dmixin.debug.countInjections=true",
|
||||
@@ -513,14 +519,6 @@ repositories {
|
||||
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||
allowInsecureProtocol = true
|
||||
}
|
||||
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
|
||||
if (usesMixinDebug.toBoolean()) {
|
||||
maven {
|
||||
name = "Fabric Maven"
|
||||
url = "https://maven.fabricmc.net/"
|
||||
}
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name 'sonatype'
|
||||
url 'https://oss.sonatype.org/content/repositories/snapshots/'
|
||||
@@ -559,29 +557,49 @@ repositories {
|
||||
}
|
||||
}
|
||||
|
||||
def mixinProviderGroup = "io.github.legacymoddingmc"
|
||||
def mixinProviderModule = "unimixins"
|
||||
def mixinProviderVersion = "0.1.6"
|
||||
def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}"
|
||||
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
|
||||
|
||||
dependencies {
|
||||
if (usesMixins.toBoolean()) {
|
||||
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
|
||||
annotationProcessor('com.google.guava:guava:24.1.1-jre')
|
||||
annotationProcessor('com.google.code.gson:gson:2.8.6')
|
||||
annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.13:processor')
|
||||
annotationProcessor(mixinProviderSpec)
|
||||
if (usesMixinDebug.toBoolean()) {
|
||||
runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16')
|
||||
}
|
||||
}
|
||||
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
|
||||
implementation('com.gtnewhorizon:gtnhmixins:2.1.13')
|
||||
if (usesMixins.toBoolean()) {
|
||||
implementation(mixinProviderSpec)
|
||||
} else if (forceEnableMixins.toBoolean()) {
|
||||
runtimeOnlyNonPublishable(mixinProviderSpec)
|
||||
}
|
||||
}
|
||||
|
||||
pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
|
||||
if (usesMixins.toBoolean()) {
|
||||
dependencies {
|
||||
kapt('com.gtnewhorizon:gtnhmixins:2.1.13:processor')
|
||||
kapt(mixinProviderSpec)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Replace old mixin mods with unimixins
|
||||
// https://docs.gradle.org/8.0.2/userguide/resolution_rules.html#sec:substitution_with_classifier
|
||||
configurations.all {
|
||||
resolutionStrategy.dependencySubstitution {
|
||||
substitute module('com.gtnewhorizon:gtnhmixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
|
||||
substitute module('com.github.GTNewHorizons:Mixingasm') 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('io.github.legacymoddingmc:unimixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Our previous unimixins upload was missing the dev classifier")
|
||||
}
|
||||
}
|
||||
|
||||
apply from: 'dependencies.gradle'
|
||||
|
||||
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
|
||||
@@ -695,13 +713,13 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
def lwjgl3ifyVersion = '1.1.35'
|
||||
def lwjgl3ifyVersion = '1.3.3'
|
||||
def asmVersion = '9.4'
|
||||
if (modId != 'lwjgl3ify') {
|
||||
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
|
||||
}
|
||||
if (modId != 'hodgepodge') {
|
||||
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.0.40')
|
||||
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.4')
|
||||
}
|
||||
|
||||
java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false}
|
||||
@@ -793,10 +811,6 @@ public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask {
|
||||
!file.path.contains("2.9.4-nightly-20150209") // Remove lwjgl2
|
||||
}
|
||||
this.classpath(project.java17DependenciesCfg)
|
||||
|
||||
if (!(project.usesMixins.toBoolean() || project.forceEnableMixins.toBoolean())) {
|
||||
this.extraArgs.addAll("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1006,6 +1020,7 @@ idea {
|
||||
}
|
||||
compiler.javac {
|
||||
afterEvaluate {
|
||||
javacAdditionalOptions = "-encoding utf8"
|
||||
moduleJavacAdditionalOptions = [
|
||||
(project.name + ".main"): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ')
|
||||
]
|
||||
@@ -1125,7 +1140,7 @@ if (modrinthProjectId.size() != 0 && System.getenv("MODRINTH_TOKEN") != null) {
|
||||
}
|
||||
}
|
||||
if (usesMixins.toBoolean()) {
|
||||
addModrinthDep("required", "project", "gtnhmixins")
|
||||
addModrinthDep("required", "project", "unimixins")
|
||||
}
|
||||
tasks.modrinth.dependsOn(build)
|
||||
tasks.publish.dependsOn(tasks.modrinth)
|
||||
@@ -1169,7 +1184,7 @@ if (curseForgeProjectId.size() != 0 && System.getenv("CURSEFORGE_TOKEN") != null
|
||||
}
|
||||
}
|
||||
if (usesMixins.toBoolean()) {
|
||||
addCurseForgeRelation("requiredDependency", "gtnhmixins")
|
||||
addCurseForgeRelation("requiredDependency", "unimixins")
|
||||
}
|
||||
tasks.curseforge.dependsOn(build)
|
||||
tasks.publish.dependsOn(tasks.curseforge)
|
||||
@@ -1204,7 +1219,7 @@ def addCurseForgeRelation(String type, String name) {
|
||||
|
||||
// Updating
|
||||
|
||||
def buildscriptGradleVersion = "8.0.1"
|
||||
def buildscriptGradleVersion = "8.0.2"
|
||||
|
||||
tasks.named('wrapper', Wrapper).configure {
|
||||
gradleVersion = buildscriptGradleVersion
|
||||
|
||||
+9
-8
@@ -2,19 +2,20 @@
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:EnderCore:0.2.13:dev')
|
||||
implementation('com.github.GTNewHorizons:ForestryMC:4.5.8:dev')
|
||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.3.35-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:BuildCraft:7.1.27:dev')
|
||||
implementation('com.github.GTNewHorizons:ForestryMC:4.6.5:dev')
|
||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.3.45-GTNH:dev')
|
||||
implementation("com.github.GTNewHorizons:GTNHLib:0.0.13: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.5.23:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-168-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.5.24:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-195-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Baubles:1.0.1.14:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.13.6:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.14.1:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.11.13-GTNH:api') {transitive = false}
|
||||
implementation('com.github.GTNewHorizons:Chisel:2.10.8-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.8.0.13-GTNH:api') {transitive = false}
|
||||
implementation('com.github.GTNewHorizons:Chisel:2.10.17-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.9.1-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
|
||||
|
||||
@@ -84,6 +84,18 @@ public abstract class AbstractConduit implements IConduit {
|
||||
|
||||
protected boolean connectionsDirty = true;
|
||||
|
||||
/**
|
||||
* This shows if the currently running connection update should not finish with settings connectionsDirty to false.
|
||||
* 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;
|
||||
|
||||
private boolean isUpdatingConnections = false;
|
||||
|
||||
protected AbstractConduit() {}
|
||||
|
||||
@Override
|
||||
@@ -434,10 +446,13 @@ public abstract class AbstractConduit implements IConduit {
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
if (!connectionsDirty) {
|
||||
if (!connectionsDirty && !needUpdateConnections) {
|
||||
return;
|
||||
}
|
||||
|
||||
isUpdatingConnections = true;
|
||||
needUpdateConnections = false;
|
||||
|
||||
boolean externalConnectionsChanged = false;
|
||||
List<ForgeDirection> copy = new ArrayList<ForgeDirection>(externalConnections);
|
||||
// remove any no longer valid connections
|
||||
@@ -462,6 +477,21 @@ public abstract class AbstractConduit implements IConduit {
|
||||
}
|
||||
|
||||
connectionsDirty = false;
|
||||
isUpdatingConnections = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method prevents connection update from getting completed successfully by not settings connectionsDirty to
|
||||
* false. This will trigger an connection update at the next Tick.
|
||||
* <p>
|
||||
* Only use this while executing updateConnections().
|
||||
* <p>
|
||||
* See this PR for more info: https://github.com/GTNewHorizons/EnderIO/pull/111
|
||||
*/
|
||||
protected void needUpdateConnections() {
|
||||
if (isUpdatingConnections) {
|
||||
needUpdateConnections = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -682,6 +682,11 @@ public class ConduitRecipes {
|
||||
addShaped(res.copy(), "bbb", "fqf", "bbb", 'b', conduitBinder, 'f', pureFluix, 'q', quartzFiber);
|
||||
|
||||
res.stackSize = 1;
|
||||
addShaped(new ItemStack(EnderIO.itemMEConduit, 1, 1), "bCb", "CbC", "bCb", 'b', conduitBinder, 'C', res);
|
||||
ItemStack resDense = new ItemStack(EnderIO.itemMEConduit, 1, 1);
|
||||
ItemStack resUltra = new ItemStack(EnderIO.itemMEConduit, 1, 2);
|
||||
addShaped(resDense, "bCb", "CbC", "bCb", 'b', conduitBinder, 'C', res);
|
||||
if (Config.enableMEUltraDenseConduits) {
|
||||
addShaped(resUltra, "bCb", "CbC", "bCb", 'b', conduitBinder, 'C', resDense);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -248,7 +248,7 @@ public class ConduitUtil {
|
||||
|
||||
public static <T extends IConduit> Collection<T> getConnectedConduits(World world, int x, int y, int z,
|
||||
Class<T> type) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
TileEntity te = world.blockExists(x, y, z) ? world.getTileEntity(x, y, z) : null;
|
||||
if (!(te instanceof IConduitBundle)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -14,5 +14,7 @@ public interface IMEConduit extends IConduit {
|
||||
|
||||
boolean isDense();
|
||||
|
||||
boolean isDenseUltra();
|
||||
|
||||
int getChannelsInUse();
|
||||
}
|
||||
@@ -15,7 +15,8 @@ public class ItemMEConduit extends AbstractItemConduit {
|
||||
|
||||
private static ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
|
||||
new ItemConduitSubtype(ModObject.itemMEConduit.name(), "enderio:itemMeConduit"),
|
||||
new ItemConduitSubtype(ModObject.itemMEConduit.name() + "Dense", "enderio:itemMeConduitDense") };
|
||||
new ItemConduitSubtype(ModObject.itemMEConduit.name() + "Dense", "enderio:itemMeConduitDense"),
|
||||
new ItemConduitSubtype(ModObject.itemMEConduit.name() + "DenseUltra", "enderio:itemMeConduitDenseUltra") };
|
||||
|
||||
public static ItemMEConduit create() {
|
||||
ItemMEConduit result = new ItemMEConduit();
|
||||
|
||||
@@ -13,6 +13,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.IGridConnection;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -44,6 +45,7 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
public static IIcon[] longTextures;
|
||||
|
||||
private boolean isDense;
|
||||
private boolean isDenseUltra;
|
||||
private int playerID = -1;
|
||||
|
||||
public MEConduit() {
|
||||
@@ -51,6 +53,7 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
}
|
||||
|
||||
public MEConduit(int itemDamage) {
|
||||
isDenseUltra = itemDamage == 2;
|
||||
isDense = itemDamage == 1;
|
||||
}
|
||||
|
||||
@@ -59,14 +62,16 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
coreTextures = new IIcon[2];
|
||||
longTextures = new IIcon[2];
|
||||
coreTextures = new IIcon[3];
|
||||
longTextures = new IIcon[3];
|
||||
|
||||
coreTextures[0] = register.registerIcon(EnderIO.DOMAIN + ":meConduitCore");
|
||||
coreTextures[1] = register.registerIcon(EnderIO.DOMAIN + ":meConduitCoreDense");
|
||||
coreTextures[2] = register.registerIcon(EnderIO.DOMAIN + ":meConduitCoreDenseUltra");
|
||||
|
||||
longTextures[0] = register.registerIcon(EnderIO.DOMAIN + ":meConduit");
|
||||
longTextures[1] = register.registerIcon(EnderIO.DOMAIN + ":meConduitDense");
|
||||
longTextures[2] = register.registerIcon(EnderIO.DOMAIN + ":meConduitDenseUltra");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,8 +81,14 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
});
|
||||
}
|
||||
|
||||
public static int getDamageForState(boolean isDense) {
|
||||
return isDense ? 1 : 0;
|
||||
public static int getDamageForState(boolean isDense, boolean isDenseUltra) {
|
||||
if (isDenseUltra) {
|
||||
return 2;
|
||||
}
|
||||
if (isDense) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,7 +98,7 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
|
||||
@Override
|
||||
public ItemStack createItem() {
|
||||
return new ItemStack(EnderIO.itemMEConduit, 1, getDamageForState(isDense));
|
||||
return new ItemStack(EnderIO.itemMEConduit, 1, getDamageForState(isDense, isDenseUltra));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,6 +116,7 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
public void writeToNBT(NBTTagCompound nbtRoot) {
|
||||
super.writeToNBT(nbtRoot);
|
||||
nbtRoot.setBoolean("isDense", isDense);
|
||||
nbtRoot.setBoolean("isDenseUltra", isDenseUltra);
|
||||
nbtRoot.setInteger("playerID", playerID);
|
||||
}
|
||||
|
||||
@@ -117,6 +129,9 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
} else {
|
||||
playerID = -1;
|
||||
}
|
||||
if (nbtRoot.hasKey("isDenseUltra")) {
|
||||
isDenseUltra = nbtRoot.getBoolean("isDenseUltra");
|
||||
}
|
||||
}
|
||||
|
||||
public void setPlayerID(int playerID) {
|
||||
@@ -140,7 +155,16 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
public boolean canConnectToExternal(ForgeDirection dir, boolean ignoreDisabled) {
|
||||
World world = getBundle().getWorld();
|
||||
BlockCoord pos = getLocation();
|
||||
TileEntity te = world.getTileEntity(pos.x + dir.offsetX, pos.y + dir.offsetY, pos.z + dir.offsetZ);
|
||||
|
||||
final int exactPosX = pos.x + dir.offsetX;
|
||||
final int exactPosY = pos.y + dir.offsetY;
|
||||
final int exactPosZ = pos.z + dir.offsetZ;
|
||||
|
||||
if (!world.blockExists(exactPosX, exactPosY, exactPosZ)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntity te = world.getTileEntity(exactPosX, exactPosY, exactPosZ);
|
||||
|
||||
if (te instanceof TileConduitBundle) {
|
||||
return false;
|
||||
@@ -148,26 +172,44 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
|
||||
// because the AE2 API doesn't allow an easy query like "which side can connect to an ME cable" it needs this
|
||||
// mess
|
||||
IGridNode node = null;
|
||||
if (te instanceof IPartHost) {
|
||||
IPart part = ((IPartHost) te).getPart(dir.getOpposite());
|
||||
if (part == null) {
|
||||
part = ((IPartHost) te).getPart(ForgeDirection.UNKNOWN);
|
||||
return part != null;
|
||||
}
|
||||
if (part.getExternalFacingNode() != null) {
|
||||
return true;
|
||||
if (part != null) {
|
||||
node = part.getExternalFacingNode();
|
||||
if (node == null) {
|
||||
node = part.getGridNode();
|
||||
}
|
||||
if (node == null) {
|
||||
// The GridNode has not been initialized yet, let's try on the next Tick.
|
||||
needUpdateConnections();
|
||||
}
|
||||
}
|
||||
String name = part.getClass().getSimpleName();
|
||||
return "PartP2PTunnelME".equals(name) || "PartQuartzFiber".endsWith(name)
|
||||
|| "PartToggleBus".equals(name)
|
||||
|| "PartInvertedToggleBus".equals(name);
|
||||
} else if (te instanceof IGridHost) {
|
||||
IGridNode node = ((IGridHost) te).getGridNode(dir.getOpposite());
|
||||
node = ((IGridHost) te).getGridNode(dir.getOpposite());
|
||||
if (node == null) {
|
||||
node = ((IGridHost) te).getGridNode(ForgeDirection.UNKNOWN);
|
||||
}
|
||||
if (node != null) {
|
||||
return node.getGridBlock().getConnectableSides().contains(dir.getOpposite());
|
||||
}
|
||||
if (node != null) {
|
||||
return canConnectToGridNode(node, dir);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Method(modid = "appliedenergistics2")
|
||||
private Boolean canConnectToGridNode(IGridNode node, ForgeDirection dir) {
|
||||
if (node.getGridBlock().getConnectableSides().contains(dir.getOpposite())) {
|
||||
if (isDenseUltra()) {
|
||||
return node.hasFlag(GridFlags.ULTRA_DENSE_CAPACITY)
|
||||
|| ((node.hasFlag(GridFlags.DENSE_CAPACITY)) && !node.hasFlag(GridFlags.CANNOT_CARRY));
|
||||
} else if (isDense()) {
|
||||
return true;
|
||||
} else {
|
||||
return !node.hasFlag(GridFlags.ULTRA_DENSE_CAPACITY);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -175,7 +217,7 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
|
||||
@Override
|
||||
public IIcon getTextureForState(CollidableComponent component) {
|
||||
int state = getDamageForState(isDense);
|
||||
int state = getDamageForState(isDense, isDenseUltra);
|
||||
if (component.dir == ForgeDirection.UNKNOWN) {
|
||||
return coreTextures[state];
|
||||
} else {
|
||||
@@ -272,7 +314,11 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
private void onNodeChanged(BlockCoord location) {
|
||||
World world = getBundle().getWorld();
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
TileEntity te = location.getLocation(dir).getTileEntity(world);
|
||||
BlockCoord dirLocation = location.getLocation(dir);
|
||||
TileEntity te = null;
|
||||
if (world.blockExists(dirLocation.x, dirLocation.y, dirLocation.z)) {
|
||||
te = location.getLocation(dir).getTileEntity(world);
|
||||
}
|
||||
if (te != null && te instanceof IGridHost && !(te instanceof IConduitBundle)) {
|
||||
IGridNode node = ((IGridHost) te).getGridNode(ForgeDirection.UNKNOWN);
|
||||
if (node == null) {
|
||||
@@ -288,7 +334,12 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
@Override
|
||||
public void onAddedToBundle() {
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
TileEntity te = getLocation().getLocation(dir).getTileEntity(getBundle().getWorld());
|
||||
World world = getBundle().getWorld();
|
||||
BlockCoord dirLocation = getLocation().getLocation(dir);
|
||||
TileEntity te = null;
|
||||
if (world.blockExists(dirLocation.x, dirLocation.y, dirLocation.z)) {
|
||||
te = dirLocation.getTileEntity(world);
|
||||
}
|
||||
if (te instanceof TileConduitBundle) {
|
||||
IMEConduit cond = ((TileConduitBundle) te).getConduit(IMEConduit.class);
|
||||
if (cond != null) {
|
||||
@@ -343,4 +394,9 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
public boolean isDense() {
|
||||
return isDense;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDenseUltra() {
|
||||
return isDenseUltra;
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,13 @@ public class MEConduitGrid implements IGridBlock {
|
||||
|
||||
@Override
|
||||
public EnumSet<GridFlags> getFlags() {
|
||||
return conduit.isDense() ? EnumSet.of(GridFlags.DENSE_CAPACITY) : EnumSet.noneOf(GridFlags.class);
|
||||
if (conduit.isDenseUltra()) {
|
||||
return EnumSet.of(GridFlags.ULTRA_DENSE_CAPACITY);
|
||||
}
|
||||
if (conduit.isDense()) {
|
||||
return EnumSet.of(GridFlags.DENSE_CAPACITY);
|
||||
}
|
||||
return EnumSet.noneOf(GridFlags.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -68,17 +68,21 @@ public class PowerConduit extends AbstractConduit implements IPowerConduit {
|
||||
}
|
||||
|
||||
public static void initIcons() {
|
||||
initIcons(POSTFIX, ICONS);
|
||||
}
|
||||
|
||||
protected static void initIcons(String[] postfix, Map<String, IIcon> icons) {
|
||||
IconUtil.addIconProvider(new IconUtil.IIconProvider() {
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
for (String pf : POSTFIX) {
|
||||
ICONS.put(ICON_KEY + pf, register.registerIcon(ICON_KEY + pf));
|
||||
ICONS.put(ICON_KEY_INPUT + pf, register.registerIcon(ICON_KEY_INPUT));
|
||||
ICONS.put(ICON_KEY_OUTPUT + pf, register.registerIcon(ICON_KEY_OUTPUT));
|
||||
ICONS.put(ICON_CORE_KEY + pf, register.registerIcon(ICON_CORE_KEY + pf));
|
||||
for (String pf : postfix) {
|
||||
icons.put(ICON_KEY + pf, register.registerIcon(ICON_KEY + pf));
|
||||
icons.put(ICON_KEY_INPUT + pf, register.registerIcon(ICON_KEY_INPUT));
|
||||
icons.put(ICON_KEY_OUTPUT + pf, register.registerIcon(ICON_KEY_OUTPUT));
|
||||
icons.put(ICON_CORE_KEY + pf, register.registerIcon(ICON_CORE_KEY + pf));
|
||||
}
|
||||
ICONS.put(ICON_TRANSMISSION_KEY, register.registerIcon(ICON_TRANSMISSION_KEY));
|
||||
icons.put(ICON_TRANSMISSION_KEY, register.registerIcon(ICON_TRANSMISSION_KEY));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -119,6 +123,10 @@ public class PowerConduit extends AbstractConduit implements IPowerConduit {
|
||||
this.subtype = meta;
|
||||
}
|
||||
|
||||
protected int getSubtype() {
|
||||
return subtype;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getConnectionsDirty() {
|
||||
return connectionsDirty;
|
||||
|
||||
@@ -2,51 +2,20 @@ package crazypants.enderio.conduit.power.endergy;
|
||||
|
||||
import static crazypants.enderio.config.Config.powerConduitEndergyTiers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import com.enderio.core.client.render.IconUtil;
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
import com.enderio.core.common.vecmath.Vector3d;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
import crazypants.enderio.conduit.ConduitUtil;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.conduit.RaytraceResult;
|
||||
import crazypants.enderio.conduit.geom.CollidableCache.CacheKey;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.geom.ConduitGeometryUtil;
|
||||
import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
import crazypants.enderio.conduit.power.PowerConduit;
|
||||
import crazypants.enderio.conduit.power.PowerConduitNetwork;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.item.PacketConduitProbe;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.power.BasicCapacitor;
|
||||
import crazypants.enderio.power.ICapacitor;
|
||||
import crazypants.enderio.power.IPowerInterface;
|
||||
import crazypants.enderio.power.PowerHandlerUtil;
|
||||
import crazypants.enderio.tool.ToolUtil;
|
||||
|
||||
public class PowerConduitEndergy extends PowerConduit {
|
||||
|
||||
@@ -76,487 +45,51 @@ public class PowerConduitEndergy extends PowerConduit {
|
||||
}
|
||||
|
||||
public static void initIcons() {
|
||||
IconUtil.addIconProvider(new IconUtil.IIconProvider() {
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
for (String pf : POSTFIX) {
|
||||
ICONS.put(ICON_KEY + pf, register.registerIcon(ICON_KEY + pf));
|
||||
ICONS.put(ICON_KEY_INPUT + pf, register.registerIcon(ICON_KEY_INPUT));
|
||||
ICONS.put(ICON_KEY_OUTPUT + pf, register.registerIcon(ICON_KEY_OUTPUT));
|
||||
ICONS.put(ICON_CORE_KEY + pf, register.registerIcon(ICON_CORE_KEY + pf));
|
||||
}
|
||||
ICONS.put(ICON_TRANSMISSION_KEY, register.registerIcon(ICON_TRANSMISSION_KEY));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTextureType() {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
initIcons(POSTFIX, ICONS);
|
||||
}
|
||||
|
||||
public static final float WIDTH = 0.075f;
|
||||
public static final float HEIGHT = 0.075f;
|
||||
|
||||
public static final Vector3d MIN = new Vector3d(0.5f - WIDTH, 0.5 - HEIGHT, 0.5 - WIDTH);
|
||||
public static final Vector3d MAX = new Vector3d(MIN.x + WIDTH, MIN.y + HEIGHT, MIN.z + WIDTH);
|
||||
|
||||
public static final BoundingBox BOUNDS = new BoundingBox(MIN, MAX);
|
||||
|
||||
protected PowerConduitNetwork network;
|
||||
|
||||
private int energyStoredRF;
|
||||
|
||||
private int subtype;
|
||||
|
||||
protected final EnumMap<ForgeDirection, RedstoneControlMode> rsModes = new EnumMap<ForgeDirection, RedstoneControlMode>(
|
||||
ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> rsColors = new EnumMap<ForgeDirection, DyeColor>(
|
||||
ForgeDirection.class);
|
||||
|
||||
protected EnumMap<ForgeDirection, Long> recievedTicks;
|
||||
|
||||
private final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<ForgeDirection, Integer>();
|
||||
|
||||
private boolean redstoneStateDirty = true;
|
||||
|
||||
public PowerConduitEndergy() {}
|
||||
public PowerConduitEndergy() {
|
||||
super();
|
||||
}
|
||||
|
||||
public PowerConduitEndergy(int meta) {
|
||||
this.subtype = meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getConnectionsDirty() {
|
||||
return connectionsDirty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(EntityPlayer player, RaytraceResult res, List<RaytraceResult> all) {
|
||||
DyeColor col = DyeColor.getColorFromDye(player.getCurrentEquippedItem());
|
||||
if (ConduitUtil.isProbeEquipped(player)) {
|
||||
if (!player.worldObj.isRemote) {
|
||||
new PacketConduitProbe().sendInfoMessage(player, this);
|
||||
}
|
||||
return true;
|
||||
} else if (col != null && res.component != null && isColorBandRendered(res.component.dir)) {
|
||||
setExtractionSignalColor(res.component.dir, col);
|
||||
return true;
|
||||
} else if (ToolUtil.isToolEquipped(player)) {
|
||||
if (!getBundle().getEntity().getWorldObj().isRemote) {
|
||||
if (res != null && res.component != null) {
|
||||
ForgeDirection connDir = res.component.dir;
|
||||
ForgeDirection faceHit = ForgeDirection.getOrientation(res.movingObjectPosition.sideHit);
|
||||
if (connDir == ForgeDirection.UNKNOWN || connDir == faceHit) {
|
||||
if (getConnectionMode(faceHit) == ConnectionMode.DISABLED) {
|
||||
setConnectionMode(faceHit, getNextConnectionMode(faceHit));
|
||||
return true;
|
||||
}
|
||||
// Attempt to join networks
|
||||
return ConduitUtil.joinConduits(this, faceHit);
|
||||
} else if (externalConnections.contains(connDir)) {
|
||||
setConnectionMode(connDir, getNextConnectionMode(connDir));
|
||||
return true;
|
||||
} else if (containsConduitConnection(connDir)) {
|
||||
ConduitUtil.disconectConduits(this, connDir);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isColorBandRendered(ForgeDirection dir) {
|
||||
return getConnectionMode(dir) != ConnectionMode.DISABLED
|
||||
&& getExtractionRedstoneMode(dir) != RedstoneControlMode.IGNORE;
|
||||
super(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICapacitor getCapacitor() {
|
||||
return getCapacitors()[subtype];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExtractionRedstoneMode(RedstoneControlMode mode, ForgeDirection dir) {
|
||||
rsModes.put(dir, mode);
|
||||
setClientStateDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedstoneControlMode getExtractionRedstoneMode(ForgeDirection dir) {
|
||||
RedstoneControlMode res = rsModes.get(dir);
|
||||
if (res == null) {
|
||||
res = RedstoneControlMode.IGNORE;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExtractionSignalColor(ForgeDirection dir, DyeColor col) {
|
||||
rsColors.put(dir, col);
|
||||
setClientStateDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DyeColor getExtractionSignalColor(ForgeDirection dir) {
|
||||
DyeColor res = rsColors.get(dir);
|
||||
if (res == null) {
|
||||
res = DyeColor.RED;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
setExtractionSignalColor(dir, DyeColor.values()[dataRoot.getShort("extractionSignalColor")]);
|
||||
setExtractionRedstoneMode(RedstoneControlMode.values()[dataRoot.getShort("extractionRedstoneMode")], dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeTypeSettingsToNbt(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
dataRoot.setShort("extractionSignalColor", (short) getExtractionSignalColor(dir).ordinal());
|
||||
dataRoot.setShort("extractionRedstoneMode", (short) getExtractionRedstoneMode(dir).ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbtRoot) {
|
||||
super.writeToNBT(nbtRoot);
|
||||
nbtRoot.setShort("subtype", (short) subtype);
|
||||
nbtRoot.setInteger("energyStoredRF", energyStoredRF);
|
||||
|
||||
for (Entry<ForgeDirection, RedstoneControlMode> entry : rsModes.entrySet()) {
|
||||
if (entry.getValue() != null) {
|
||||
short ord = (short) entry.getValue().ordinal();
|
||||
nbtRoot.setShort("pRsMode." + entry.getKey().name(), ord);
|
||||
}
|
||||
}
|
||||
|
||||
for (Entry<ForgeDirection, DyeColor> entry : rsColors.entrySet()) {
|
||||
if (entry.getValue() != null) {
|
||||
short ord = (short) entry.getValue().ordinal();
|
||||
nbtRoot.setShort("pRsCol." + entry.getKey().name(), ord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtRoot, short nbtVersion) {
|
||||
super.readFromNBT(nbtRoot, nbtVersion);
|
||||
subtype = nbtRoot.getShort("subtype");
|
||||
|
||||
if (nbtRoot.hasKey("energyStored")) {
|
||||
nbtRoot.setInteger("energyStoredRF", (int) (nbtRoot.getFloat("energyStored") * 10));
|
||||
}
|
||||
setEnergyStored(nbtRoot.getInteger("energyStoredRF"));
|
||||
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
String key = "pRsMode." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < RedstoneControlMode.values().length) {
|
||||
rsModes.put(dir, RedstoneControlMode.values()[ord]);
|
||||
}
|
||||
}
|
||||
key = "pRsCol." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < DyeColor.values().length) {
|
||||
rsColors.put(dir, DyeColor.values()[ord]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick() {}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored() {
|
||||
return energyStoredRF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergyStored(int energyStored) {
|
||||
energyStoredRF = MathHelper.clamp_int(energyStored, 0, getMaxEnergyStored());
|
||||
}
|
||||
|
||||
private boolean isRedstoneEnabled(ForgeDirection dir) {
|
||||
boolean result;
|
||||
RedstoneControlMode mode = getExtractionRedstoneMode(dir);
|
||||
if (mode == RedstoneControlMode.NEVER) {
|
||||
return false;
|
||||
}
|
||||
if (mode == RedstoneControlMode.IGNORE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
DyeColor col = getExtractionSignalColor(dir);
|
||||
int signal = ConduitUtil.getInternalSignalForColor(getBundle(), col);
|
||||
int exSig = getExternalRedstoneSignalForDir(dir);
|
||||
boolean res;
|
||||
if (mode == RedstoneControlMode.OFF) {
|
||||
// if checking for no signal, must be no signal from both
|
||||
res = mode.isConditionMet(mode, signal) && (col != DyeColor.RED || mode.isConditionMet(mode, exSig));
|
||||
} else {
|
||||
// if checking for a signal, either is fine
|
||||
res = mode.isConditionMet(mode, signal) || (col == DyeColor.RED && mode.isConditionMet(mode, exSig));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private int getExternalRedstoneSignalForDir(ForgeDirection dir) {
|
||||
if (redstoneStateDirty) {
|
||||
externalRedstoneSignals.clear();
|
||||
redstoneStateDirty = false;
|
||||
}
|
||||
Integer cached = externalRedstoneSignals.get(dir);
|
||||
int result;
|
||||
if (cached == null) {
|
||||
TileEntity te = getBundle().getEntity();
|
||||
result = te.getWorldObj().getStrongestIndirectPower(te.xCoord, te.yCoord, te.zCoord);
|
||||
externalRedstoneSignals.put(dir, result);
|
||||
} else {
|
||||
result = cached;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyRecieved(ForgeDirection dir) {
|
||||
ConnectionMode mode = getConnectionMode(dir);
|
||||
if (mode == ConnectionMode.OUTPUT || mode == ConnectionMode.DISABLED || !isRedstoneEnabled(dir)) {
|
||||
return 0;
|
||||
}
|
||||
return getCapacitor().getMaxEnergyReceived();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyExtracted(ForgeDirection dir) {
|
||||
ConnectionMode mode = getConnectionMode(dir);
|
||||
if (mode == ConnectionMode.INPUT || mode == ConnectionMode.DISABLED || !isRedstoneEnabled(dir)) {
|
||||
return 0;
|
||||
}
|
||||
if (recievedRfThisTick(dir)) {
|
||||
return 0;
|
||||
}
|
||||
return getCapacitor().getMaxEnergyExtracted();
|
||||
}
|
||||
|
||||
private boolean recievedRfThisTick(ForgeDirection dir) {
|
||||
if (recievedTicks == null || dir == null
|
||||
|| recievedTicks.get(dir) == null
|
||||
|| getBundle() == null
|
||||
|| getBundle().getWorld() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
long curTick = getBundle().getWorld().getTotalWorldTime();
|
||||
long recT = recievedTicks.get(dir);
|
||||
if (curTick - recT <= 5) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onNeighborBlockChange(Block blockId) {
|
||||
redstoneStateDirty = true;
|
||||
if (network != null && network.powerManager != null) {
|
||||
network.powerManager.receptorsChanged();
|
||||
}
|
||||
return super.onNeighborBlockChange(blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConnectionMode(ForgeDirection dir, ConnectionMode mode) {
|
||||
super.setConnectionMode(dir, mode);
|
||||
recievedTicks = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
if (getMaxEnergyRecieved(from) == 0 || maxReceive <= 0) {
|
||||
return 0;
|
||||
}
|
||||
int freeSpace = getMaxEnergyStored() - getEnergyStored();
|
||||
int result = (int) Math.min(maxReceive, freeSpace);
|
||||
if (!simulate && result > 0) {
|
||||
setEnergyStored(getEnergyStored() + result);
|
||||
|
||||
if (getBundle() != null) {
|
||||
if (recievedTicks == null) {
|
||||
recievedTicks = new EnumMap<ForgeDirection, Long>(ForgeDirection.class);
|
||||
}
|
||||
recievedTicks.put(from, getBundle().getWorld().getTotalWorldTime());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from) {
|
||||
return getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from) {
|
||||
return getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractConduitNetwork<?, ?> getNetwork() {
|
||||
return network;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setNetwork(AbstractConduitNetwork<?, ?> network) {
|
||||
this.network = (PowerConduitNetwork) network;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectToExternal(ForgeDirection direction, boolean ignoreDisabled) {
|
||||
IPowerInterface rec = getExternalPowerReceptor(direction);
|
||||
|
||||
return rec != null && rec.canConduitConnect(direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectToConduit(ForgeDirection direction, IConduit conduit) {
|
||||
boolean res = super.canConnectToConduit(direction, conduit);
|
||||
if (!res) {
|
||||
return false;
|
||||
}
|
||||
if (Config.powerConduitCanDifferentTiersConnect) {
|
||||
return res;
|
||||
}
|
||||
if (!(conduit instanceof IPowerConduit)) {
|
||||
return false;
|
||||
}
|
||||
IPowerConduit pc = (IPowerConduit) conduit;
|
||||
return pc.getMaxEnergyStored() == getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void externalConnectionAdded(ForgeDirection direction) {
|
||||
super.externalConnectionAdded(direction);
|
||||
if (network != null) {
|
||||
TileEntity te = bundle.getEntity();
|
||||
network.powerReceptorAdded(
|
||||
this,
|
||||
direction,
|
||||
te.xCoord + direction.offsetX,
|
||||
te.yCoord + direction.offsetY,
|
||||
te.zCoord + direction.offsetZ,
|
||||
getExternalPowerReceptor(direction));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void externalConnectionRemoved(ForgeDirection direction) {
|
||||
super.externalConnectionRemoved(direction);
|
||||
if (network != null) {
|
||||
TileEntity te = bundle.getEntity();
|
||||
network.powerReceptorRemoved(
|
||||
te.xCoord + direction.offsetX,
|
||||
te.yCoord + direction.offsetY,
|
||||
te.zCoord + direction.offsetZ);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPowerInterface getExternalPowerReceptor(ForgeDirection direction) {
|
||||
TileEntity te = bundle.getEntity();
|
||||
World world = te.getWorldObj();
|
||||
if (world == null) {
|
||||
return null;
|
||||
}
|
||||
TileEntity test = world.getTileEntity(
|
||||
te.xCoord + direction.offsetX,
|
||||
te.yCoord + direction.offsetY,
|
||||
te.zCoord + direction.offsetZ);
|
||||
if (test == null) {
|
||||
return null;
|
||||
}
|
||||
if (test instanceof IConduitBundle) {
|
||||
return null;
|
||||
}
|
||||
return PowerHandlerUtil.create(test);
|
||||
return getCapacitors()[getSubtype()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack createItem() {
|
||||
return createItemStackForSubtype(subtype);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IConduit> getBaseConduitType() {
|
||||
return IPowerConduit.class;
|
||||
return createItemStackForSubtype(getSubtype());
|
||||
}
|
||||
|
||||
// Rendering
|
||||
@Override
|
||||
public IIcon getTextureForState(CollidableComponent component) {
|
||||
if (component.dir == ForgeDirection.UNKNOWN) {
|
||||
return ICONS.get(ICON_CORE_KEY + POSTFIX[subtype]);
|
||||
return ICONS.get(ICON_CORE_KEY + POSTFIX[getSubtype()]);
|
||||
}
|
||||
if (COLOR_CONTROLLER_ID.equals(component.data)) {
|
||||
return IconUtil.whiteTexture;
|
||||
}
|
||||
return ICONS.get(ICON_KEY + POSTFIX[subtype]);
|
||||
return ICONS.get(ICON_KEY + POSTFIX[getSubtype()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTextureForInputMode() {
|
||||
return ICONS.get(ICON_KEY_INPUT + POSTFIX[subtype]);
|
||||
return ICONS.get(ICON_KEY_INPUT + POSTFIX[getSubtype()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTextureForOutputMode() {
|
||||
return ICONS.get(ICON_KEY_OUTPUT + POSTFIX[subtype]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTransmitionTextureForState(CollidableComponent component) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<CollidableComponent> createCollidables(CacheKey key) {
|
||||
Collection<CollidableComponent> baseCollidables = super.createCollidables(key);
|
||||
if (key.dir == ForgeDirection.UNKNOWN) {
|
||||
return baseCollidables;
|
||||
}
|
||||
|
||||
BoundingBox bb = ConduitGeometryUtil.instance.createBoundsForConnectionController(key.dir, key.offset);
|
||||
CollidableComponent cc = new CollidableComponent(IPowerConduit.class, bb, key.dir, COLOR_CONTROLLER_ID);
|
||||
|
||||
List<CollidableComponent> result = new ArrayList<CollidableComponent>();
|
||||
result.addAll(baseCollidables);
|
||||
result.add(cc);
|
||||
|
||||
return result;
|
||||
return ICONS.get(ICON_KEY_OUTPUT + POSTFIX[getSubtype()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored() {
|
||||
return getCapacitors()[subtype].getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean displayPower() {
|
||||
return true;
|
||||
return getCapacitors()[getSubtype()].getMaxEnergyStored();
|
||||
}
|
||||
}
|
||||
@@ -84,6 +84,8 @@ public final class Config {
|
||||
public static boolean reinforcedObsidianEnabled = true;
|
||||
public static boolean reinforcedObsidianUseDarkSteelBlocks = false;
|
||||
|
||||
public static boolean enforceOfflinePlayerUUID = false;
|
||||
|
||||
public static boolean useAlternateBinderRecipe = false;
|
||||
|
||||
public static boolean useAlternateTesseractModel = false;
|
||||
@@ -101,6 +103,7 @@ public final class Config {
|
||||
public static int transceiverUpkeepCostRF = 10;
|
||||
public static int transceiverBucketTransmissionCostRF = 100;
|
||||
public static int transceiverMaxIoRF = 20480;
|
||||
public static int transceiverInternalBuffer = 500000;
|
||||
public static boolean transceiverUseEasyRecipe = false;
|
||||
|
||||
public static File configDirectory;
|
||||
@@ -438,6 +441,7 @@ public final class Config {
|
||||
|
||||
public static boolean isGasConduitEnabled = true;
|
||||
public static boolean enableMEConduits = true;
|
||||
public static boolean enableMEUltraDenseConduits = false;
|
||||
public static boolean enableOCConduits = true;
|
||||
public static boolean enableOCConduitsAnimatedTexture = true;
|
||||
|
||||
@@ -1001,6 +1005,13 @@ public final class Config {
|
||||
transceiverMaxIoRF,
|
||||
"Maximum RF/t sent and received by a Dimensional Transceiver per tick. Input and output limits are not cumulative")
|
||||
.getInt(transceiverMaxIoRF);
|
||||
transceiverInternalBuffer = config
|
||||
.get(
|
||||
sectionPower.name,
|
||||
"transceiverInternalBuffer",
|
||||
transceiverInternalBuffer,
|
||||
"Maximum RF for the send/receive buffer. Need to be at least transceiverMaxIoRF.")
|
||||
.getInt(transceiverInternalBuffer);
|
||||
transceiverBucketTransmissionCostRF = config
|
||||
.get(
|
||||
sectionEfficiency.name,
|
||||
@@ -1022,6 +1033,13 @@ public final class Config {
|
||||
"Enable per tick sampling on individual power inputs and outputs. This allows slightly more detailed messages from the RF Reader but has a negative impact on server performance.")
|
||||
.getBoolean(detailedPowerTrackingEnabled);
|
||||
|
||||
enforceOfflinePlayerUUID = config.get(
|
||||
sectionAdvanced.name,
|
||||
"enforceOfflinePlayerUUID",
|
||||
false,
|
||||
"Enforces to use the players offline UUID. Recommendet to use before creating your world, otherwise it might breaks all secuity related things.")
|
||||
.getBoolean(enforceOfflinePlayerUUID);
|
||||
|
||||
useSneakMouseWheelYetaWrench = config.get(
|
||||
sectionPersonal.name,
|
||||
"useSneakMouseWheelYetaWrench",
|
||||
@@ -2298,6 +2316,11 @@ public final class Config {
|
||||
sectionItems.name,
|
||||
enableMEConduits,
|
||||
"Allows ME conduits. Only has an effect with AE2 installed.");
|
||||
enableMEUltraDenseConduits = config.getBoolean(
|
||||
"enableMEUltraDenseConduits",
|
||||
sectionItems.name,
|
||||
enableMEUltraDenseConduits,
|
||||
"Allows ME Ultra Dense conduits. Only has an effect with AE2 installed.");
|
||||
enableOCConduits = config.getBoolean(
|
||||
"enableOCConduits",
|
||||
sectionItems.name,
|
||||
|
||||
@@ -131,6 +131,10 @@ public class ItemMagnet extends ItemEnergyContainer implements IResourceTooltipP
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
|
||||
if (maxReceive < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int res = super.receiveEnergy(container, maxReceive, simulate);
|
||||
if (res != 0 && !simulate) {
|
||||
updateDamage(container);
|
||||
@@ -148,6 +152,10 @@ public class ItemMagnet extends ItemEnergyContainer implements IResourceTooltipP
|
||||
}
|
||||
|
||||
public int extractEnergyInternal(ItemStack container, int maxExtract, boolean simulate) {
|
||||
if (maxExtract < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int res = super.extractEnergy(container, maxExtract, simulate);
|
||||
if (res != 0 && !simulate) {
|
||||
updateDamage(container);
|
||||
|
||||
@@ -54,7 +54,7 @@ public class TileTransceiver extends AbstractPoweredTaskEntity
|
||||
private final ICapacitor capacitor = new BasicCapacitor(
|
||||
0,
|
||||
Config.transceiverMaxIoRF * 2,
|
||||
500000,
|
||||
Config.transceiverInternalBuffer,
|
||||
Config.transceiverMaxIoRF);
|
||||
private boolean sendChannelsDirty = false;
|
||||
private boolean recieveChannelsDirty = false;
|
||||
|
||||
@@ -67,6 +67,12 @@ public class ItemTeleportStaff extends ItemTravelStaff {
|
||||
return equipped;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
|
||||
// Don't allow receiving energy, since we have infinite energy.
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
|
||||
// Don't allow extracting energy.
|
||||
|
||||
@@ -103,6 +103,10 @@ public class ItemTravelStaff extends ItemEnergyContainer implements IItemOfTrave
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
|
||||
if (maxReceive < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int res = super.receiveEnergy(container, maxReceive, simulate);
|
||||
if (res != 0 && !simulate) {
|
||||
updateDamage(container);
|
||||
@@ -112,6 +116,10 @@ public class ItemTravelStaff extends ItemEnergyContainer implements IItemOfTrave
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
|
||||
if (maxExtract < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int res = super.extractEnergy(container, maxExtract, simulate);
|
||||
if (res != 0 && !simulate) {
|
||||
updateDamage(container);
|
||||
|
||||
@@ -15,14 +15,10 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.entity.Entity;
|
||||
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.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;
|
||||
@@ -37,7 +33,9 @@ import com.enderio.core.common.vecmath.Vector2d;
|
||||
import com.enderio.core.common.vecmath.Vector3d;
|
||||
import com.google.common.collect.MultimapBuilder;
|
||||
import com.google.common.collect.SetMultimap;
|
||||
import com.gtnewhorizon.gtnhlib.GTNHLib;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
@@ -338,7 +336,7 @@ public class TravelController {
|
||||
}
|
||||
|
||||
if (displayOutOfRangeMessage && distanceMap.isEmpty()) {
|
||||
player.addChatComponentMessage(new ChatComponentTranslation("enderio.blockTravelPlatform.outOfRange"));
|
||||
showMessage(player, new ChatComponentTranslation("enderio.blockTravelPlatform.outOfRange"));
|
||||
}
|
||||
|
||||
return distanceMap.values().stream().findFirst();
|
||||
@@ -532,7 +530,7 @@ public class TravelController {
|
||||
TravelController.instance.selectedCoord.z);
|
||||
}
|
||||
} else {
|
||||
player.addChatComponentMessage(new ChatComponentTranslation("enderio.gui.travelAccessable.unauthorised"));
|
||||
showMessage(player, new ChatComponentTranslation("enderio.gui.travelAccessable.unauthorised"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -578,8 +576,7 @@ public class TravelController {
|
||||
if (te instanceof ITravelAccessable) {
|
||||
ITravelAccessable ta = (ITravelAccessable) te;
|
||||
if (!ta.canBlockBeAccessed(player)) {
|
||||
player.addChatComponentMessage(
|
||||
new ChatComponentTranslation("enderio.gui.travelAccessable.unauthorised"));
|
||||
showMessage(player, new ChatComponentTranslation("enderio.gui.travelAccessable.unauthorised"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -593,14 +590,13 @@ public class TravelController {
|
||||
|
||||
if (!isInRangeTarget(player, coord, source.getMaxDistanceTravelledSq())) {
|
||||
if (source != TravelSource.STAFF_BLINK && source != TravelSource.TELEPORT_STAFF_BLINK) {
|
||||
player.addChatComponentMessage(new ChatComponentTranslation("enderio.blockTravelPlatform.outOfRange"));
|
||||
showMessage(player, new ChatComponentTranslation("enderio.blockTravelPlatform.outOfRange"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (!isValidTarget(player, coord, source)) {
|
||||
if (source != TravelSource.STAFF_BLINK && source != TravelSource.TELEPORT_STAFF_BLINK) {
|
||||
player.addChatComponentMessage(
|
||||
new ChatComponentTranslation("enderio.blockTravelPlatform.invalidTarget"));
|
||||
showMessage(player, new ChatComponentTranslation("enderio.blockTravelPlatform.invalidTarget"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -630,7 +626,7 @@ public class TravelController {
|
||||
if (requiredPower > canUsePower) {
|
||||
// make sure chat is sent only once per trial
|
||||
if (!insufficientPower) {
|
||||
player.addChatComponentMessage(new ChatComponentTranslation("enderio.itemTravelStaff.notEnoughPower"));
|
||||
showMessage(player, new ChatComponentTranslation("enderio.itemTravelStaff.notEnoughPower"));
|
||||
insufficientPower = true;
|
||||
}
|
||||
return -1;
|
||||
@@ -745,17 +741,16 @@ public class TravelController {
|
||||
|
||||
if (Config.travelAnchorSkipWarning) {
|
||||
if (travelBlock.getRequiresPassword(player)) {
|
||||
player.addChatComponentMessage(
|
||||
new ChatComponentTranslation("enderio.gui.travelAccessable.skipLocked"));
|
||||
showMessage(player, new ChatComponentTranslation("enderio.gui.travelAccessable.skipLocked"));
|
||||
}
|
||||
|
||||
if (travelBlock.getAccessMode() == ITravelAccessable.AccessMode.PRIVATE
|
||||
&& !travelBlock.canUiBeAccessed(player)) {
|
||||
player.addChatComponentMessage(
|
||||
new ChatComponentTranslation("enderio.gui.travelAccessable.skipPrivate"));
|
||||
showMessage(player, new ChatComponentTranslation("enderio.gui.travelAccessable.skipPrivate"));
|
||||
}
|
||||
if (!isValidTarget(player, targetBlock, TravelSource.BLOCK)) {
|
||||
player.addChatComponentMessage(
|
||||
showMessage(
|
||||
player,
|
||||
new ChatComponentTranslation("enderio.gui.travelAccessable.skipObstructed"));
|
||||
}
|
||||
}
|
||||
@@ -944,4 +939,21 @@ public class TravelController {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void showMessage(EntityPlayer player, IChatComponent chatComponent) {
|
||||
if (Loader.isModLoaded("gtnhlib")) {
|
||||
if (player instanceof EntityPlayerMP) {
|
||||
chatComponent.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.WHITE));
|
||||
GTNHLib.proxy.sendMessageAboveHotbar((EntityPlayerMP) player, chatComponent, 60, true, true);
|
||||
} else {
|
||||
GTNHLib.proxy.printMessageAboveHotbar(
|
||||
EnumChatFormatting.WHITE + chatComponent.getFormattedText(),
|
||||
60,
|
||||
true,
|
||||
true);
|
||||
}
|
||||
} else {
|
||||
player.addChatComponentMessage(chatComponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -353,13 +353,14 @@ public class WailaCompat implements IWailaDataProvider {
|
||||
} else if (itemStack.getItem() == EnderIO.itemMEConduit) {
|
||||
NBTTagCompound nbtRoot = _accessor.getNBTData();
|
||||
if (nbtRoot.hasKey("isDense")) {
|
||||
boolean isDenseUltra = nbtRoot.getBoolean("isDenseUltra");
|
||||
boolean isDense = nbtRoot.getBoolean("isDense");
|
||||
int channelsInUse = nbtRoot.getInteger("channelsInUse");
|
||||
currenttip.add(
|
||||
MessageFormat.format(
|
||||
EnderIO.lang.localize("itemMEConduit.channelsUsed"),
|
||||
channelsInUse,
|
||||
isDense ? 32 : 8));
|
||||
isDenseUltra ? 128 : (isDense ? 32 : 8)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -395,6 +396,7 @@ public class WailaCompat implements IWailaDataProvider {
|
||||
if (mec != null) {
|
||||
tag.setInteger("channelsInUse", mec.getChannelsInUse());
|
||||
tag.setBoolean("isDense", mec.isDense());
|
||||
tag.setBoolean("isDenseUltra", mec.isDenseUltra());
|
||||
}
|
||||
} else if (te instanceof IInternalPoweredTile) {
|
||||
IInternalPoweredTile ipte = (IInternalPoweredTile) te;
|
||||
|
||||
@@ -6,12 +6,15 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.common.UsernameCache;
|
||||
|
||||
import com.enderio.core.common.util.PlayerUtil;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import crazypants.enderio.Log;
|
||||
import crazypants.enderio.config.Config;
|
||||
|
||||
public class UserIdent {
|
||||
|
||||
@@ -75,7 +78,7 @@ public class UserIdent {
|
||||
* changes, implement them and write a log message.
|
||||
*/
|
||||
public static @Nonnull UserIdent create(@Nonnull String suuid, @Nullable String playerName) {
|
||||
if (NONE_MARKER.equals(suuid)) {
|
||||
if (NONE_MARKER.equals(suuid) || Config.enforceOfflinePlayerUUID) {
|
||||
return new UserIdent(null, playerName);
|
||||
}
|
||||
try {
|
||||
@@ -109,8 +112,7 @@ public class UserIdent {
|
||||
*/
|
||||
public static @Nonnull UserIdent create(@Nullable GameProfile gameProfile) {
|
||||
if (gameProfile != null && (gameProfile.getId() != null || gameProfile.getName() != null)) {
|
||||
if (gameProfile.getId() != null && gameProfile.getName() != null
|
||||
&& gameProfile.getId().equals(offlineUUID(gameProfile.getName()))) {
|
||||
if (gameProfile.getName() != null && (Config.enforceOfflinePlayerUUID || !isOnlineMode())) {
|
||||
return new UserIdent(null, gameProfile.getName());
|
||||
} else {
|
||||
return new UserIdent(gameProfile.getId(), gameProfile.getName());
|
||||
@@ -120,6 +122,11 @@ public class UserIdent {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isOnlineMode() {
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
return server != null ? server.isServerInOnlineMode() : true;
|
||||
}
|
||||
|
||||
private static @Nonnull UUID offlineUUID(String playerName) {
|
||||
UUID result = UUID.nameUUIDFromBytes(("OfflinePlayer:" + playerName).getBytes(Charsets.UTF_8));
|
||||
return result != null ? result : new UUID(-1, -1);
|
||||
@@ -220,6 +227,9 @@ public class UserIdent {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof UUID) {
|
||||
return getUUID().equals(obj);
|
||||
}
|
||||
return this == obj;
|
||||
}
|
||||
|
||||
|
||||
@@ -130,6 +130,7 @@ enderio.itemGasConduit.tooltip.detailed.line1=Transportiert Mekanism-kompatible
|
||||
|
||||
enderio.itemMEConduit.name=ME-Leitung
|
||||
enderio.itemMEConduitDense.name=Dichte ME-Leitung
|
||||
enderio.itemMEConduitDenseUltra.name=Extrem Dichte ME-Leitungen
|
||||
enderio.itemMEConduit.channelsUsed={0,number} von {1,number} Kanälen
|
||||
|
||||
enderio.itemOCConduit.name=Netzwerkleitung (OC)
|
||||
|
||||
@@ -131,6 +131,7 @@ enderio.itemGasConduit.tooltip.detailed.line1=Transfers Mekanism-compatible gase
|
||||
|
||||
enderio.itemMEConduit.name=ME Conduit
|
||||
enderio.itemMEConduitDense.name=Dense ME Conduit
|
||||
enderio.itemMEConduitDenseUltra.name=Ultra Dense ME Conduit
|
||||
enderio.itemMEConduit.channelsUsed={0,number} of {1,number} Channels
|
||||
|
||||
enderio.itemOCConduit.name=Network Conduit (OC)
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 731 B |
Binary file not shown.
|
After Width: | Height: | Size: 298 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
Reference in new issue
Block a user