Fix too much machines being added to machine list

This commit is contained in:
Raoul Van den Berge
2016-05-20 21:03:10 +02:00
parent f2db05c581
commit bed5c26f4b
3 changed files with 18 additions and 9 deletions

View File

@@ -10,8 +10,6 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import refinedstorage.inventory.InventorySimple;
import refinedstorage.item.ItemUpgrade;
@@ -303,12 +301,6 @@ public class RefinedStorageUtils {
}
}
public static void sendToAllAround(World world, BlockPos pos, IMessage message) {
NetworkRegistry.TargetPoint target = new NetworkRegistry.TargetPoint(world.provider.getDimensionType().getId(), pos.getX(), pos.getY(), pos.getZ(), 64);
RefinedStorage.NETWORK.sendToAllAround(message, target);
}
public static void updateBlock(World world, BlockPos pos) {
world.notifyBlockUpdate(pos, world.getBlockState(pos), world.getBlockState(pos), 1 | 2);
}

View File

@@ -111,7 +111,6 @@ public class TileController extends TileBase implements IEnergyReceiver, ISynchr
super.update();
if (!worldObj.isRemote) {
// Prevent cache from re-adding the block
for (TileMachine machine : machinesToAdd) {
if (!machines.contains(machine)) {
machines.add(machine);

View File

@@ -171,4 +171,22 @@ public abstract class TileMachine extends TileBase implements ISynchronizedConta
public abstract int getEnergyUsage();
public abstract void updateMachine();
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if (!(other instanceof TileMachine)) {
return false;
}
return ((TileMachine) other).getPos().equals(pos);
}
@Override
public int hashCode() {
return pos.hashCode();
}
}