mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Fix conveyor grabber delay
This commit is contained in:
parent
33c8ad70a3
commit
8aad7fb44b
@ -32,6 +32,7 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP
|
||||
|
||||
public boolean isWhitelist = false;
|
||||
public ModulePatternMatcher matcher;
|
||||
public long lastGrabbedTick = 0;
|
||||
|
||||
public TileEntityCraneGrabber() {
|
||||
super(11);
|
||||
@ -63,7 +64,7 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP
|
||||
}
|
||||
}
|
||||
|
||||
if(worldObj.getTotalWorldTime() % delay == 0 && !this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
|
||||
if(worldObj.getTotalWorldTime() >= lastGrabbedTick + delay && !this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
|
||||
int amount = 1;
|
||||
|
||||
if(slots[9] != null && slots[9].getItem() == ModItems.upgrade_stack) {
|
||||
@ -111,6 +112,8 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP
|
||||
boolean match = this.matchesFilter(stack);
|
||||
if(this.isWhitelist && !match || !this.isWhitelist && match) continue;
|
||||
|
||||
lastGrabbedTick = worldObj.getTotalWorldTime();
|
||||
|
||||
ItemStack copy = stack.copy();
|
||||
int toAdd = Math.min(stack.stackSize, amount);
|
||||
copy.stackSize = toAdd;
|
||||
@ -132,8 +135,7 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("isWhitelist", isWhitelist);
|
||||
this.matcher.writeToNBT(data);
|
||||
this.writeToNBT(data);
|
||||
this.networkPack(data, 15);
|
||||
}
|
||||
}
|
||||
@ -141,9 +143,7 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
super.networkUnpack(nbt);
|
||||
|
||||
this.isWhitelist = nbt.getBoolean("isWhitelist");
|
||||
this.matcher.modes = new String[this.matcher.modes.length];
|
||||
this.matcher.readFromNBT(nbt);
|
||||
this.readFromNBT(nbt);
|
||||
}
|
||||
|
||||
public boolean matchesFilter(ItemStack stack) {
|
||||
@ -175,6 +175,7 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP
|
||||
super.readFromNBT(nbt);
|
||||
this.isWhitelist = nbt.getBoolean("isWhitelist");
|
||||
this.matcher.readFromNBT(nbt);
|
||||
this.lastGrabbedTick = nbt.getLong("lastGrabbedTick");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -182,6 +183,7 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setBoolean("isWhitelist", this.isWhitelist);
|
||||
this.matcher.writeToNBT(nbt);
|
||||
nbt.setLong("lastGrabbedTick", lastGrabbedTick);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user