Merge pull request #197 from MrBretze/master

Fixed #192
This commit is contained in:
Modmuss50 2015-10-22 18:51:43 +02:00
commit e34436a94d
2 changed files with 7 additions and 6 deletions

View file

@ -1,6 +1,6 @@
#Sat Jun 06 13:39:31 BST 2015 #Thu Oct 22 04:43:39 CEST 2015
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip

View file

@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import org.apache.commons.lang3.StringUtils;
import techreborn.config.ConfigTechReborn; import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks; import techreborn.init.ModBlocks;
import techreborn.lib.Functions; import techreborn.lib.Functions;
@ -15,15 +16,15 @@ public class TileIDSU extends TilePowerAcceptor {
@Override @Override
public double getEnergy() { public double getEnergy() {
if(ownerUdid == null && !this.ownerUdid.isEmpty()){ if(ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid)) {
return 0; return 0.0;
} }
return IDSUManager.INSTANCE.getSaveDataForWorld(worldObj, ownerUdid).storedPower; return IDSUManager.INSTANCE.getSaveDataForWorld(worldObj, ownerUdid).storedPower;
} }
@Override @Override
public void setEnergy(double energy) { public void setEnergy(double energy) {
if(ownerUdid == null && !this.ownerUdid.isEmpty()){ if(ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid)) {
return; return;
} }
IDSUManager.INSTANCE.getSaveDataForWorld(worldObj, ownerUdid).storedPower = energy; IDSUManager.INSTANCE.getSaveDataForWorld(worldObj, ownerUdid).storedPower = energy;
@ -98,7 +99,7 @@ public class TileIDSU extends TilePowerAcceptor {
public void writeToNBT(NBTTagCompound nbttagcompound) { public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound); super.writeToNBT(nbttagcompound);
if(this.ownerUdid == null && !this.ownerUdid.isEmpty()){ if(ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid)) {
return; return;
} }
nbttagcompound.setString("ownerUdid", this.ownerUdid); nbttagcompound.setString("ownerUdid", this.ownerUdid);