Compare commits

..
14 Commits
20 changed files with 82 additions and 165 deletions

No files matched your search

+6 -5
View File
@@ -1,4 +1,4 @@
//version: 1699290261
//version: 1696265388
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
@@ -646,7 +646,7 @@ 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
@@ -793,12 +793,12 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies"
}
dependencies {
def lwjgl3ifyVersion = '1.5.1'
def lwjgl3ifyVersion = '1.5.0'
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.3.7')
}
java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false}
@@ -1187,8 +1187,9 @@ publishing {
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
}
}
repositories {
if (usesMavenPublishing.toBoolean() && System.getenv("MAVEN_USER") != null) {
if (usesMavenPublishing.toBoolean()) {
maven {
url = mavenPublishUrl
allowInsecureProtocol = mavenPublishUrl.startsWith("http://") // Mostly for the GTNH maven
+10 -10
View File
@@ -1,22 +1,22 @@
// 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.17:dev')
implementation('com.github.GTNewHorizons:ForestryMC:4.6.14:dev')
implementation('com.github.GTNewHorizons:NotEnoughItems:2.4.3-GTNH:dev')
implementation("com.github.GTNewHorizons:GTNHLib:0.0.13:dev")
api('com.github.GTNewHorizons:BuildCraft:7.1.36: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-259-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}
implementation('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.44.30:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Railcraft:9.15.0:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.12.0-GTNH:api') {transitive = false}
implementation('com.github.GTNewHorizons:Chisel:2.11.4-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.9.17-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
@@ -1,8 +1,6 @@
package crazypants.enderio;
import static crazypants.enderio.EnderIO.MODID;
import static crazypants.enderio.EnderIO.MOD_NAME;
import static crazypants.enderio.EnderIO.VERSION;
import static crazypants.enderio.EnderIO.*;
import java.io.BufferedWriter;
import java.io.File;
@@ -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;
@@ -1,20 +1,10 @@
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.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.endergy.AlloyEndergy.*;
import static crazypants.util.RecipeUtil.addShaped;
import net.minecraft.init.Blocks;
@@ -53,6 +53,11 @@ public abstract class AbstractGasConduit extends AbstractConduit implements IGas
return true;
}
@Override
protected ConnectionMode getDefaultConnectionMode() {
return ConnectionMode.INPUT;
}
@Override
public Class<? extends IConduit> getBaseConduitType() {
return IGasConduit.class;
@@ -75,6 +75,11 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
return true;
}
@Override
protected ConnectionMode getDefaultConnectionMode() {
return ConnectionMode.INPUT;
}
@Override
public Class<? extends IConduit> getBaseConduitType() {
return ILiquidConduit.class;
@@ -157,11 +162,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 +185,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,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;
@@ -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;
@@ -1035,6 +1037,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",
@@ -1,11 +1,6 @@
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.util.RecipeUtil.addShaped;
@@ -1,19 +1,8 @@
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 net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -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();
}
}
}
@@ -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;
@@ -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));
@@ -1,28 +1,9 @@
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 crazypants.enderio.material.Alloy.*;
import static crazypants.enderio.material.Material.*;
import static crazypants.enderio.material.endergy.AlloyEndergy.*;
import static crazypants.enderio.power.Capacitors.*;
import java.util.ArrayList;
@@ -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 {
@@ -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;
@@ -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();
}
}
+1 -4
View File
@@ -1,9 +1,6 @@
package crazypants.util;
import static crazypants.enderio.material.Material.BINDER_COMPOSITE;
import static crazypants.enderio.material.Material.CONDUIT_BINDER;
import static crazypants.enderio.material.Material.PHASED_IRON_NUGGET;
import static crazypants.enderio.material.Material.SILICON;
import static crazypants.enderio.material.Material.*;
import java.util.ArrayList;
import java.util.Arrays;
+12 -3
View File
@@ -6,6 +6,7 @@ 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;
@@ -13,6 +14,7 @@ import com.google.common.base.Charsets;
import com.mojang.authlib.GameProfile;
import crazypants.enderio.Log;
import crazypants.enderio.config.Config;
public class UserIdent {
@@ -76,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 {
@@ -110,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());
@@ -121,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);
@@ -221,6 +227,9 @@ public class UserIdent {
@Override
public boolean equals(Object obj) {
if (obj instanceof UUID) {
return getUUID().equals(obj);
}
return this == obj;
}