mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-10-25 20:22:23 +00:00
Try to fix energy overflow (#114)
This commit is contained in:
1 parent
76708883c0
commit
4e40230bf3
3 files changed
+22
No files matched your search
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user