Fixes IDSU not setting the players udid when placed.
This commit is contained in:
parent
029a75522c
commit
b4c873f54c
2 changed files with 11 additions and 2 deletions
|
@ -65,4 +65,13 @@ public class BlockIDSU extends BlockEnergyStorage {
|
||||||
list.add(new ItemStack(this, 1, 2));
|
list.add(new ItemStack(this, 1, 2));
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
|
||||||
|
super.onBlockPlacedBy(world, pos, state, placer, stack);
|
||||||
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
|
if (tile instanceof TileIDSU) {
|
||||||
|
((TileIDSU) tile).ownerUdid = placer.getUniqueID().toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class TileIDSU extends TilePowerAcceptor implements IWrenchable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getEnergy() {
|
public double getEnergy() {
|
||||||
if (ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid)) {
|
if (ownerUdid == null || ownerUdid.isEmpty()) {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
return IDSUManager.INSTANCE.getSaveDataForWorld(world, ownerUdid).storedPower;
|
return IDSUManager.INSTANCE.getSaveDataForWorld(world, ownerUdid).storedPower;
|
||||||
|
@ -66,7 +66,7 @@ public class TileIDSU extends TilePowerAcceptor implements IWrenchable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setEnergy(double energy) {
|
public void setEnergy(double energy) {
|
||||||
if (ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid)) {
|
if (ownerUdid == null || ownerUdid.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IDSUManager.INSTANCE.getSaveDataForWorld(world, ownerUdid).storedPower = energy;
|
IDSUManager.INSTANCE.getSaveDataForWorld(world, ownerUdid).storedPower = energy;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue