Small code improvements
This commit is contained in:
@@ -23,13 +23,13 @@ public abstract class TileBase extends TileEntity implements ITickable {
|
||||
|
||||
private EnumFacing direction = EnumFacing.NORTH;
|
||||
|
||||
protected int ticks;
|
||||
protected int ticks = 0;
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
if (!worldObj.isRemote) {
|
||||
ticks++;
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
if (this instanceof ISynchronizedContainer) {
|
||||
for (EntityPlayer player : worldObj.playerEntities) {
|
||||
if (((ISynchronizedContainer) this).getContainer() == player.openContainer.getClass()) {
|
||||
|
||||
@@ -14,6 +14,8 @@ import refinedstorage.tile.config.ICompareConfig;
|
||||
import refinedstorage.tile.config.RedstoneMode;
|
||||
|
||||
public class TileDetector extends TileMachine implements ICompareConfig {
|
||||
public static final int SPEED = 5;
|
||||
|
||||
public static final int MODE_UNDER = 0;
|
||||
public static final int MODE_EQUAL = 1;
|
||||
public static final int MODE_ABOVE = 2;
|
||||
@@ -45,7 +47,7 @@ public class TileDetector extends TileMachine implements ICompareConfig {
|
||||
|
||||
@Override
|
||||
public void updateMachine() {
|
||||
if (ticks % 5 == 0) {
|
||||
if (ticks % SPEED == 0) {
|
||||
ItemStack slot = filter.getStackInSlot(0);
|
||||
|
||||
boolean wasPowered = powered;
|
||||
|
||||
@@ -47,10 +47,8 @@ public abstract class TileMachine extends TileBase implements ISynchronizedConta
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
if (ticks == 1) {
|
||||
if (ticks == 0) {
|
||||
block = worldObj.getBlockState(pos).getBlock();
|
||||
|
||||
searchController(worldObj);
|
||||
@@ -66,6 +64,8 @@ public abstract class TileMachine extends TileBase implements ISynchronizedConta
|
||||
updateMachine();
|
||||
}
|
||||
}
|
||||
|
||||
super.update();
|
||||
}
|
||||
|
||||
public boolean maySendConnectivityData() {
|
||||
|
||||
Reference in New Issue
Block a user