use of mekanism.common.tile.machine.TileEntityOredictionificator in project Mekanism by mekanism.
the class PacketEditFilter method handle.
@Override
public void handle(NetworkEvent.Context context) {
PlayerEntity player = context.getSender();
if (player == null) {
return;
}
TileEntity tile = WorldUtils.getTileEntity(player.level, pos);
if (tile != null) {
if (filter instanceof SorterFilter && tile instanceof TileEntityLogisticalSorter) {
HashList<SorterFilter<?>> filters = ((TileEntityLogisticalSorter) tile).getFilters();
int index = filters.indexOf(filter);
if (index != -1) {
filters.remove(index);
if (!delete) {
filters.add(index, (SorterFilter<?>) edited);
}
}
} else if (filter instanceof MinerFilter && tile instanceof TileEntityDigitalMiner) {
HashList<MinerFilter<?>> filters = ((TileEntityDigitalMiner) tile).getFilters();
int index = filters.indexOf(filter);
if (index != -1) {
filters.remove(index);
if (!delete) {
filters.add(index, (MinerFilter<?>) edited);
}
}
} else if (filter instanceof OredictionificatorItemFilter && tile instanceof TileEntityOredictionificator) {
HashList<OredictionificatorItemFilter> filters = ((TileEntityOredictionificator) tile).getFilters();
int index = filters.indexOf(filter);
if (index != -1) {
filters.remove(index);
if (!delete) {
filters.add(index, (OredictionificatorItemFilter) edited);
}
}
} else if (filter instanceof QIOFilter && tile instanceof TileEntityQIOFilterHandler) {
HashList<QIOFilter<?>> filters = ((TileEntityQIOFilterHandler) tile).getFilters();
int index = filters.indexOf(filter);
if (index != -1) {
filters.remove(index);
if (!delete) {
filters.add(index, (QIOFilter<?>) edited);
}
}
}
tile.setChanged();
}
}
Aggregations