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